Author: janderwald
Date: Sat Jan 17 16:22:09 2009
New Revision: 38857
URL:
http://svn.reactos.org/svn/reactos?rev=38857&view=rev
Log:
- Store DeviceObject before calling IMiniportWaveCyclic as the driver might immediately
call port functions
- Pass the PhysicalDeviceObject to IoGetDmaAdapter
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] Sat Jan 17
16:22:09 2009
@@ -484,8 +484,12 @@
ULONG MapRegisters;
INTERFACE_TYPE BusType;
ULONG ResultLength;
+ PCExtension* DeviceExt;
IDmaChannelSlaveImpl * This;
+
+ DPRINT1("OutDmaChannel %p OuterUnknown %p PoolType %p DeviceDescription %p
DeviceObject %p\n",
+ OutDmaChannel, OuterUnknown, PoolType, DeviceDescription, DeviceObject);
This = AllocateItem(PoolType, sizeof(IDmaChannelSlaveImpl), TAG_PORTCLASS);
if (!This)
@@ -493,6 +497,7 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
+ DeviceExt = (PCExtension*) DeviceObject->DeviceExtension;
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyLegacyBusType,
sizeof(BusType), (PVOID)&BusType, &ResultLength);
if (NT_SUCCESS(Status))
@@ -500,7 +505,9 @@
DeviceDescription->InterfaceType = BusType;
}
- Adapter = IoGetDmaAdapter(DeviceObject, DeviceDescription, &MapRegisters);
+ DPRINT1("Calling IoGetDmaAdapter\n");
+
+ Adapter = IoGetDmaAdapter(DeviceExt->PhysicalDeviceObject, DeviceDescription,
&MapRegisters);
if (!Adapter)
{
FreeItem(This, TAG_PORTCLASS);
@@ -516,7 +523,7 @@
This->MaxMapRegisters = MapRegisters;
*OutDmaChannel = (PVOID)(&This->lpVtbl);
-
+ DPRINT1("PcNewDmaChannel result %p\n", *OutDmaChannel);
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Sat Jan
17 16:22:09 2009
@@ -139,6 +139,8 @@
PPOWERNOTIFY PowerNotify;
IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)iface;
+ DPRINT1("IPortWaveCyclic_Init entered\n");
+
if (This->bInitialized)
{
DPRINT("IPortWaveCyclic_Init called again\n");
@@ -151,43 +153,6 @@
DPRINT("IPortWaveCyclic_Init called with invalid IMiniport
adapter\n");
return STATUS_INVALID_PARAMETER;
}
-
- Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList,
iface);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("IMiniportWaveCyclic_Init failed with %x\n", Status);
- Miniport->lpVtbl->Release(Miniport);
- return Status;
- }
-
- /* check if it supports IPinCount interface */
- Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPinCount, (PVOID*)&PinCount);
- if (NT_SUCCESS(Status))
- {
- This->pPinCount = PinCount;
- This->pDescriptor = NULL;
- }
- else
- {
- Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
- if (!NT_SUCCESS(Status))
- {
- Miniport->lpVtbl->Release(Miniport);
- return Status;
- }
- This->pPinCount = NULL;
- }
-
- Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPowerNotify, (PVOID*)&PowerNotify);
- if (NT_SUCCESS(Status))
- {
- This->pPowerNotify = PowerNotify;
- }
- else
- {
- This->pPowerNotify = NULL;
- }
-
/* Initialize port object */
This->pMiniport = Miniport;
@@ -197,9 +162,50 @@
/* increment reference on miniport adapter */
Miniport->lpVtbl->AddRef(Miniport);
+
+ Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList,
iface);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("IMiniportWaveCyclic_Init failed with %x\n", Status);
+ Miniport->lpVtbl->Release(Miniport);
+ This->bInitialized = FALSE;
+ return Status;
+ }
+
+ /* check if it supports IPinCount interface */
+ Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPinCount, (PVOID*)&PinCount);
+ if (NT_SUCCESS(Status))
+ {
+ This->pPinCount = PinCount;
+ This->pDescriptor = NULL;
+ }
+ else
+ {
+ Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("failed to get description\n");
+ Miniport->lpVtbl->Release(Miniport);
+ return Status;
+ }
+ This->pPinCount = NULL;
+ }
+
+ Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPowerNotify, (PVOID*)&PowerNotify);
+ if (NT_SUCCESS(Status))
+ {
+ This->pPowerNotify = PowerNotify;
+ }
+ else
+ {
+ This->pPowerNotify = NULL;
+ }
+
/* increment reference on resource list */
ResourceList->lpVtbl->AddRef(ResourceList);
+
+ DPRINT1("IPortWaveCyclic successfully initialized\n");
return STATUS_SUCCESS;
}
@@ -314,7 +320,7 @@
ServiceGroup->lpVtbl->RequestService (ServiceGroup);
}
-static const IPortWaveCyclicVtbl vt_IPortWaveCyclicVtbl =
+static IPortWaveCyclicVtbl vt_IPortWaveCyclicVtbl =
{
IPortWaveCyclic_fnQueryInterface,
IPortWaveCyclic_fnAddRef,
@@ -506,8 +512,8 @@
if (!This)
return STATUS_INSUFFICIENT_RESOURCES;
- This->lpVtbl = (IPortWaveCyclicVtbl*)&vt_IPortWaveCyclicVtbl;
- This->lpVtblSubDevice = (ISubdeviceVtbl*)&vt_ISubdeviceVtbl;
+ This->lpVtbl = &vt_IPortWaveCyclicVtbl;
+ This->lpVtblSubDevice = &vt_ISubdeviceVtbl;
This->ref = 1;
*OutPort = (PPORT)(&This->lpVtbl);