Author: janderwald
Date: Thu Dec 11 05:23:14 2008
New Revision: 38011
URL:
http://svn.reactos.org/svn/reactos?rev=38011&view=rev
Log:
- Use FILE_DEVICE_KS when creating new device object
- Partly implement PcNewRegistryKey, PcRegisterSubdevice
- DPC event is a Synchronization event- Implement PcRegisterAdapterPowerManagement
Added:
trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c (with props)
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild
trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -144,7 +144,7 @@
status = IoCreateDevice(DriverObject,
DeviceExtensionSize,
NULL,
- PhysicalDeviceObject->DeviceType, /* FILE_DEVICE_KS ?
*/
+ FILE_DEVICE_KS,
PhysicalDeviceObject->Characteristics, /* TODO: Check */
FALSE,
&fdo);
@@ -161,9 +161,56 @@
ASSERT(portcls_ext);
/* Initialize */
+ RtlZeroMemory(portcls_ext, sizeof(PCExtension));
portcls_ext->StartDevice = StartDevice;
+ status = KsAllocateDeviceHeader(&portcls_ext->KsDeviceHeader, 0, NULL);
+ if (!NT_SUCCESS(status))
+ {
+ IoDeleteDevice(fdo);
+ return status;
+ }
+
DPRINT("PcAddAdapterDriver succeeded\n");
+ return status;
+}
+
+NTSTATUS
+NTAPI
+PciDriverDispatch(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp)
+{
+ DPRINT1("PortClsSysControl called\n");
+
+ /* TODO */
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = 0;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
return STATUS_SUCCESS;
}
+
+NTSTATUS NTAPI
+PcRegisterSubdevice(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PWCHAR Name,
+ IN PUNKNOWN Unknown)
+{
+ PCExtension* DeviceExt;
+ NTSTATUS Status;
+
+ if (!DeviceObject || !Name || !Unknown)
+ return STATUS_INVALID_PARAMETER;
+
+ DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ if (!DeviceExt)
+ return STATUS_UNSUCCESSFUL;
+
+ Status = KsAddObjectCreateItemToDeviceHeader(DeviceExt->KsDeviceHeader,
PciDriverDispatch, (PVOID)Unknown, Name, NULL);
+
+
+ return STATUS_UNSUCCESSFUL;
+}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -23,6 +23,7 @@
<file>registry.c</file>
<file>service_group.c</file>
<file>port.c</file>
+ <file>power.c</file>
<file>port_dmus.c</file>
<file>port_midi.c</file>
<file>port_topology.c</file>
Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c (added)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -1,0 +1,38 @@
+#include "private.h"
+
+const GUID IID_IAdapterPowerManagement;
+
+/*
+ * @implemented
+ */
+
+NTSTATUS
+NTAPI
+PcRegisterAdapterPowerManagement(
+ IN PUNKNOWN pUnknown,
+ IN PVOID pvContext)
+{
+ NTSTATUS Status;
+ PDEVICE_OBJECT pDeviceObject;
+ PCExtension* DeviceExt;
+ IAdapterPowerManagement * pPower;
+
+ if (!pUnknown || !pvContext)
+ return STATUS_INVALID_PARAMETER;
+
+ Status = pUnknown->lpVtbl->QueryInterface(pUnknown,
&IID_IAdapterPowerManagement, (PVOID*)&pPower);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ pDeviceObject = (PDEVICE_OBJECT)pvContext;
+ DeviceExt = (PCExtension*)pDeviceObject->DeviceExtension;
+
+ if (DeviceExt->AdapterPowerManagement)
+ {
+ pPower->lpVtbl->Release(pPower);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ DeviceExt->AdapterPowerManagement = pPower;
+ return STATUS_SUCCESS;
+}
Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -69,9 +69,17 @@
NTSTATUS NewPortWavePci(
OUT PPORT* OutPort);
+NTSTATUS NewDmaChannelSlave(
+ IN PDEVICE_DESCRIPTION DeviceDesc,
+ IN PDMA_ADAPTER Adapter,
+ OUT PDMACHANNELSLAVE* DmaChannel);
+
+
typedef struct
{
PCPFNSTARTDEVICE StartDevice;
+ KSDEVICE_HEADER KsDeviceHeader;
+ IAdapterPowerManagement * AdapterPowerManagement;
IResourceList* resources;
} PCExtension;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -198,6 +198,22 @@
return ZwSetValueKey(This->hKey, ValueName, 0, Type, Data, DataSize);
}
+static IRegistryKeyVtbl vt_IRegistryKey =
+{
+ /* IUnknown methods */
+ IRegistryKey_fnQueryInterface,
+ IRegistryKey_fnAddRef,
+ IRegistryKey_fnRelease,
+ /* IRegistryKey methods */
+ IRegistryKey_fnQueryKey,
+ IRegistryKey_fnEnumerateKey,
+ IRegistryKey_fnQueryValueKey,
+ IRegistryKey_fnEnumerateKeyValue,
+ IRegistryKey_fnSetValueKey,
+ IRegistryKey_fnQueryRegistryValues,
+ IRegistryKey_fnNewSubKey,
+ IRegistryKey_fnDeleteKey
+};
/*
* @unimplemented
@@ -214,9 +230,47 @@
IN ULONG CreateOptions OPTIONAL,
OUT PULONG Disposition OPTIONAL)
{
- UNIMPLEMENTED;
- //IoGetDeviceProperty
-
- return STATUS_UNSUCCESSFUL;
-}
-
+ HANDLE hHandle;
+ NTSTATUS Status = STATUS_UNSUCCESSFUL;
+ IRegistryKeyImpl * This;
+
+ if (!OutRegistryKey)
+ return STATUS_INVALID_PARAMETER;
+
+ if (RegistryKeyType != GeneralRegistryKey &&
+ RegistryKeyType != DeviceRegistryKey &&
+ RegistryKeyType != DriverRegistryKey &&
+ RegistryKeyType != HwProfileRegistryKey &&
+ RegistryKeyType != DeviceInterfaceRegistryKey)
+ {
+ return STATUS_INVALID_PARAMETER;
+ }
+
+ if (RegistryKeyType == GeneralRegistryKey)
+ {
+ if (!ObjectAttributes)
+ return STATUS_INVALID_PARAMETER;
+
+ Status = ZwOpenKey(&hHandle, DesiredAccess, ObjectAttributes);
+ }
+
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+
+ This = ExAllocatePoolWithTag(NonPagedPool, sizeof(IRegistryKeyImpl), TAG_PORTCLASS);
+ if (!This)
+ {
+ ZwClose(hHandle);
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ This->hKey = hHandle;
+ This->lpVtbl = &vt_IRegistryKey;
+ This->ref = 1;
+
+ *OutRegistryKey = (PREGISTRYKEY)&This->lpVtbl;
+ return STATUS_SUCCESS;
+}
+
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/service_group.c [iso-8859-1] Thu Dec
11 05:23:14 2008
@@ -191,7 +191,7 @@
if (!This->Initialized)
{
- KeInitializeEvent(&This->DpcEvent, NotificationEvent, FALSE);
+ KeInitializeEvent(&This->DpcEvent, SynchronizationEvent, FALSE);
KeInitializeTimerEx(&This->Timer, NotificationTimer);
KeInitializeDpc(&This->Dpc, IServiceGroupDpc, (PVOID)This);
This->Initialized = TRUE;
@@ -263,8 +263,5 @@
This->Initialized = FALSE;
*OutServiceGroup = (PSERVICEGROUP)&This->lpVtbl;
- return STATUS_UNSUCCESSFUL;
-}
-
-
-
+ return STATUS_SUCCESS;
+}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/stubs.c [iso-8859-1] Thu Dec 11
05:23:14 2008
@@ -31,18 +31,6 @@
/* ===============================================================
Power Management
*/
-
-/*
- * @unimplemented
- */
-NTSTATUS NTAPI
-PcRegisterAdapterPowerManagement(
- IN PUNKNOWN pUnknown,
- IN PVOID pvContext1)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}
/*
* @unimplemented
@@ -130,17 +118,3 @@
/*
* @unimplemented
*/
-
-
-/*
- * @unimplemented
- */
-NTSTATUS NTAPI
-PcRegisterSubdevice(
- IN PDEVICE_OBJECT DeviceObject,
- IN PWCHAR Name,
- IN PUNKNOWN Unknown)
-{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
-}