Author: janderwald
Date: Sun Jan 18 17:46:09 2009
New Revision: 38923
URL:
http://svn.reactos.org/svn/reactos?rev=38923&view=rev
Log:
- Register all device interfaces identified in the subdevice descriptor
- Add IUnknown to IInteruptSync interface
- Handle IRP_MN_QUERY_INTERFACE
- Create a subdevice descriptor for IPortWavePci, IPortWaveCyclic and IPortTopology and
handle the respective ISubDevice::GetDescriptor
- Always request PCFILTER_DESCRIPTOR regardless of present IPinCount interface
- Check if IMiniportWavePci omits a IServiceGroup
- Implement ISubDevice interface for IPortWavePci port driver
- Add primitive implementation of PcCreateSubdeviceDescriptor
- Intel AC97 audio driver now successfully initializes under Vbox
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c
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/undoc.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] Sun Jan 18
17:46:09 2009
@@ -260,8 +260,9 @@
PCExtension* DeviceExt;
NTSTATUS Status;
ISubdevice *SubDevice;
- UNICODE_STRING ReferenceString;
UNICODE_STRING SymbolicLinkName;
+ SUBDEVICE_DESCRIPTOR * SubDeviceDescriptor;
+ ULONG Index;
DPRINT1("PcRegisterSubdevice DeviceObject %p Name %S Unknown %p\n",
DeviceObject, Name, Unknown);
@@ -293,25 +294,26 @@
}
#endif
- /* FIXME retrieve guid from subdescriptor */
-
- RtlInitUnicodeString(&ReferenceString, Name);
- /* register device interface */
- Status = IoRegisterDeviceInterface(DeviceExt->PhysicalDeviceObject,
- &GUID_DEVCLASS_SOUND, //FIXME
- &ReferenceString,
- &SymbolicLinkName);
- if (NT_SUCCESS(Status))
- {
- Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
- RtlFreeUnicodeString(&SymbolicLinkName);
- }
-
- DPRINT1("PcRegisterSubdevice Status %x\n", Status);
-
- /// HACK
- /// IoRegisterDeviceInterface fails with
- /// STATUS_OBJECT_PATH_NOT_FOUND
- /// return Status;
+
+ Status = SubDevice->lpVtbl->GetDescriptor(SubDevice,
&SubDeviceDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to get subdevice descriptor %x\n", Status);
+ SubDevice->lpVtbl->Release(SubDevice);
+ }
+
+ for(Index = 0; Index < SubDeviceDescriptor->InterfaceCount; Index++)
+ {
+ Status = IoRegisterDeviceInterface(DeviceExt->PhysicalDeviceObject,
+
&SubDeviceDescriptor->Interfaces[Index],
+ NULL,
+ &SymbolicLinkName);
+ if (NT_SUCCESS(Status))
+ {
+ IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
+ RtlFreeUnicodeString(&SymbolicLinkName);
+ }
+ }
+
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Sun Jan 18
17:46:09 2009
@@ -96,8 +96,12 @@
*/
struct IIrpTargetFactory;
-struct SUBDEVICE_DESCRIPTOR;
-
+
+typedef struct
+{
+ ULONG InterfaceCount;
+ GUID *Interfaces;
+}SUBDEVICE_DESCRIPTOR, *PSUBDEVICE_DESCRIPTOR;
#undef INTERFACE
#define INTERFACE ISubdevice
@@ -123,7 +127,7 @@
STDMETHOD_(NTSTATUS, ReleaseChildren)(THIS) PURE;
STDMETHOD_(NTSTATUS, GetDescriptor)(THIS_
- IN struct SUBDEVICE_DESCRIPTOR **) PURE;
+ IN SUBDEVICE_DESCRIPTOR **) PURE;
STDMETHOD_(NTSTATUS, DataRangeIntersection)(THIS_
IN ULONG PinId,
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interrupt.c [iso-8859-1] Sun Jan 18
17:46:09 2009
@@ -41,10 +41,11 @@
DPRINT1("IInterruptSync_fnQueryInterface: This %p\n", This);
- if (IsEqualGUIDAligned(refiid, &IID_IInterruptSync))
+ if (IsEqualGUIDAligned(refiid, &IID_IInterruptSync) ||
+ IsEqualGUIDAligned(refiid, &IID_IUnknown))
{
*Output = &This->lpVtbl;
- _InterlockedIncrement(&This->ref);
+ InterlockedIncrement(&This->ref);
return STATUS_SUCCESS;
}
DPRINT1("IInterruptSync_fnQueryInterface: This %p UNKNOWN interface
requested\n", This);
@@ -60,7 +61,7 @@
DPRINT1("IInterruptSync_AddRef: This %p\n", This);
- return _InterlockedIncrement(&This->ref);
+ return InterlockedIncrement(&This->ref);
}
ULONG
@@ -72,7 +73,7 @@
PSYNC_ENTRY Entry;
IInterruptSyncImpl * This = (IInterruptSyncImpl*)iface;
- _InterlockedDecrement(&This->ref);
+ InterlockedDecrement(&This->ref);
DPRINT1("IInterruptSync_Release: This %p new ref %u\n", This,
This->ref);
@@ -105,7 +106,7 @@
IN PVOID ServiceContext)
{
IInterruptSyncImpl * This = (IInterruptSyncImpl*)ServiceContext;
- DPRINT1("IInterruptSynchronizedRoutine This %p SyncRoutine%p\n", This,
This->SyncRoutine);
+ DPRINT1("IInterruptSynchronizedRoutine This %p SyncRoutine %p Context
%p\n", This, This->SyncRoutine, This->DynamicContext);
return This->SyncRoutine((IInterruptSync*)&This->lpVtbl,
This->DynamicContext);
}
@@ -241,14 +242,16 @@
Status = IoConnectInterrupt(&This->Interrupt,
IInterruptServiceRoutine,
(PVOID)This,
- &This->Lock, Descriptor->u.Interrupt.Vector,
+ &This->Lock,
+ Descriptor->u.Interrupt.Vector,
Descriptor->u.Interrupt.Level,
Descriptor->u.Interrupt.Level, //FIXME
LevelSensitive, //FIXME
- TRUE, //FIXME
+ TRUE,
Descriptor->u.Interrupt.Affinity,
FALSE);
+ DPRINT1("IInterruptSync_fnConnect result %x\n", Status);
return Status;
}
@@ -314,7 +317,7 @@
};
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS NTAPI
PcNewInterruptSync(
@@ -326,7 +329,8 @@
{
IInterruptSyncImpl * This;
- DPRINT1("PcNewInterruptSync entered\n");
+ DPRINT1("PcNewInterruptSync entered OutInterruptSync %p OuterUnknown %p
ResourceList %p ResourceIndex %u Mode %d\n",
+ OutInterruptSync, OuterUnknown, ResourceList, ResourceIndex, Mode);
if (!OutInterruptSync || !ResourceList || Mode > InterruptSyncModeRepeat || Mode
< 0)
return STATUS_INVALID_PARAMETER;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] Sun Jan 18 17:46:09
2009
@@ -129,6 +129,7 @@
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return status;
}
else if ( irp_stack->MinorFunction == IRP_MN_REMOVE_DEVICE )
{
@@ -140,6 +141,7 @@
/* Do not complete? */
Irp->IoStatus.Status = STATUS_SUCCESS;
+ return STATUS_SUCCESS;
}
else if ( irp_stack->MinorFunction == IRP_MN_QUERY_INTERFACE )
{
@@ -148,7 +150,11 @@
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
return Irp->IoStatus.Status;
}
-
+ else if ( irp_stack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS)
+ {
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ return Irp->IoStatus.Status;
+ }
DPRINT1("unhandled function %u\n", irp_stack->MinorFunction);
return STATUS_SUCCESS;
@@ -302,11 +308,13 @@
/* initialize the notification event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
+ /* setup a completion routine */
+ IoSetCompletionRoutine(Irp, IrpCompletionRoutine, (PVOID)&Event, TRUE, FALSE,
FALSE);
+
/* copy the current stack location */
IoCopyCurrentIrpStackLocationToNext(Irp);
- /* setup a completion routine */
- IoSetCompletionRoutine(Irp, IrpCompletionRoutine, (PVOID)&Event, TRUE, FALSE,
FALSE);
+ DPRINT1("PcForwardIrpSynchronous %p Irp %p\n",
DeviceExt->PrevDeviceObject, Irp);
/* now call the driver */
Status = IoCallDriver(DeviceExt->PrevDeviceObject, Irp);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] Sun Jan
18 17:46:09 2009
@@ -13,8 +13,22 @@
PPINCOUNT pPinCount;
PPOWERNOTIFY pPowerNotify;
+ PPCFILTER_DESCRIPTOR pDescriptor;
+ PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor;
}IPortTopologyImpl;
+
+static GUID InterfaceGuids[3] =
+{
+ {
+ /// KS_CATEGORY_TOPOLOGY
+ 0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}
+ },
+ {
+ /// KS_CATEGORY_AUDIO
+ 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ }
+};
#if 0
static
@@ -72,11 +86,10 @@
{
return NewPortClsVersion((PPORTCLSVERSION*)Output);
}
+
StringFromCLSID(refiid, Buffer);
DPRINT1("IPortTopology_fnQueryInterface no iface %S\n", Buffer);
- StringFromCLSID(&IID_IUnknown, Buffer);
- DPRINT1("IPortTopology_fnQueryInterface IUnknown %S\n", Buffer);
-
+ KeBugCheckEx(0, 0, 0, 0, 0);
return STATUS_UNSUCCESSFUL;
}
@@ -168,16 +181,43 @@
This->pDeviceObject = DeviceObject;
This->bInitialized = TRUE;
+ /* increment reference on miniport adapter */
+ Miniport->lpVtbl->AddRef(Miniport);
+
Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList,
iface);
if (!NT_SUCCESS(Status))
{
DPRINT1("IPortTopology_Init failed with %x\n", Status);
This->bInitialized = FALSE;
+ Miniport->lpVtbl->Release(Miniport);
return Status;
}
- /* increment reference on miniport adapter */
- Miniport->lpVtbl->AddRef(Miniport);
+ /* get the miniport device descriptor */
+ Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("failed to get description\n");
+ Miniport->lpVtbl->Release(Miniport);
+ This->bInitialized = FALSE;
+ return Status;
+ }
+
+ /* create the subdevice descriptor */
+ Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
+ 2,
+ InterfaceGuids,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ This->pDescriptor);
DPRINT1("IPortTopology_fnInit success\n");
@@ -302,12 +342,13 @@
NTAPI
ISubDevice_fnGetDescriptor(
IN ISubdevice *iface,
- IN struct SUBDEVICE_DESCRIPTOR ** Descriptor)
+ IN SUBDEVICE_DESCRIPTOR ** Descriptor)
{
IPortTopologyImpl * This = (IPortTopologyImpl*)CONTAINING_RECORD(iface,
IPortTopologyImpl, lpVtblSubDevice);
DPRINT1("ISubDevice_GetDescriptor this %p\n", This);
- return STATUS_UNSUCCESSFUL;
+ *Descriptor = This->SubDeviceDescriptor;
+ return STATUS_SUCCESS;
}
static
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] Sun Jan
18 17:46:09 2009
@@ -18,11 +18,40 @@
PPINCOUNT pPinCount;
PPOWERNOTIFY pPowerNotify;
PPCFILTER_DESCRIPTOR pDescriptor;
-
+ PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor;
}IPortWaveCyclicImpl;
-
-const GUID GUID_DEVCLASS_SOUND; //FIXME
+static GUID InterfaceGuids[3] =
+{
+ {
+ /// KSCATEGORY_RENDER
+ 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ },
+ {
+ /// KSCATEGORY_CAPTURE
+ 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ },
+ {
+ /// KS_CATEGORY_AUDIO
+ 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ }
+};
+
+#if 0
+static const KSIDENTIFIER Identifiers[] =
+{
+ {
+ &KSINTERFACESETID_Standard,
+ 0,
+ 0
+ },
+ {
+ &KSINTERFACESETID_Standard,
+ 1,
+ 0
+ }
+};
+#endif
//---------------------------------------------------------------
// IPortEvents
@@ -276,23 +305,47 @@
return Status;
}
+
+ /* get the miniport device descriptor */
+ Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("failed to get description\n");
+ Miniport->lpVtbl->Release(Miniport);
+ This->bInitialized = FALSE;
+ return Status;
+ }
+
+ /* create the subdevice descriptor */
+ Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
+ 3,
+ InterfaceGuids,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ This->pDescriptor);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("PcCreateSubdeviceDescriptor 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))
{
/* store IPinCount interface */
This->pPinCount = PinCount;
- }
- else
- {
- /* check if the miniport adapter provides a valid device descriptor */
- Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("failed to get description\n");
- Miniport->lpVtbl->Release(Miniport);
- return Status;
- }
}
/* does the Miniport adapter support IPowerNotify interface*/
@@ -510,12 +563,14 @@
NTAPI
ISubDevice_fnGetDescriptor(
IN ISubdevice *iface,
- IN struct SUBDEVICE_DESCRIPTOR ** Descriptor)
-{
- IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortWaveCyclicImpl, lpVtblSubDevice);
+ IN SUBDEVICE_DESCRIPTOR ** Descriptor)
+{
+ IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl*)CONTAINING_RECORD(iface,
IPortWaveCyclicImpl, lpVtblSubDevice);
+
+ *Descriptor = This->SubDeviceDescriptor;
DPRINT1("ISubDevice_GetDescriptor this %p\n", This);
- return STATUS_UNSUCCESSFUL;
+ return STATUS_SUCCESS;
}
static
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] Sun Jan 18
17:46:09 2009
@@ -5,6 +5,7 @@
IPortWavePciVtbl *lpVtbl;
IServiceSinkVtbl *lpVtblServiceSink;
IPortEventsVtbl *lpVtblPortEvents;
+ ISubdeviceVtbl *lpVtblSubDevice;
#if 0
IUnregisterSubdevice *lpVtblUnregisterSubDevice;
@@ -17,7 +18,27 @@
BOOL bInitialized;
PRESOURCELIST pResourceList;
PSERVICEGROUP ServiceGroup;
+ PPINCOUNT pPinCount;
+ PPOWERNOTIFY pPowerNotify;
+ PPCFILTER_DESCRIPTOR pDescriptor;
+ PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor;
}IPortWavePciImpl;
+
+static GUID InterfaceGuids[3] =
+{
+ {
+ /// KSCATEGORY_RENDER
+ 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ },
+ {
+ /// KSCATEGORY_CAPTURE
+ 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ },
+ {
+ /// KS_CATEGORY_AUDIO
+ 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}
+ }
+};
//---------------------------------------------------------------
@@ -225,6 +246,12 @@
InterlockedIncrement(&This->ref);
return STATUS_SUCCESS;
}
+ else if (IsEqualGUIDAligned(refiid, &IID_ISubdevice))
+ {
+ *Output = &This->lpVtblSubDevice;
+ InterlockedIncrement(&This->ref);
+ return STATUS_SUCCESS;
+ }
else if (IsEqualGUIDAligned(refiid, &IID_IPortClsVersion))
{
return NewPortClsVersion((PPORTCLSVERSION*)Output);
@@ -303,6 +330,8 @@
IMiniportWavePci * Miniport;
PSERVICEGROUP ServiceGroup;
NTSTATUS Status;
+ PPINCOUNT PinCount;
+ PPOWERNOTIFY PowerNotify;
IPortWavePciImpl * This = (IPortWavePciImpl*)iface;
DPRINT1("IPortWavePci_fnInit entered with This %p, DeviceObject %p Irp %p
UnknownMiniport %p, UnknownAdapter %p ResourceList %p\n",
@@ -348,17 +377,70 @@
return Status;
}
- /* store service group */
- This->ServiceGroup = ServiceGroup;
-
- /* add ourselves to service group which is called when miniport receives an isr */
- ServiceGroup->lpVtbl->AddMember(ServiceGroup,
(PSERVICESINK)&This->lpVtblServiceSink);
-
- /* increment reference on service group */
- ServiceGroup->lpVtbl->AddRef(ServiceGroup);
-
-
- DPRINT("IPortWaveCyclic_Init sucessfully initialized\n");
+ /* check if the miniport adapter provides a valid device descriptor */
+ Status = Miniport->lpVtbl->GetDescription(Miniport,
&This->pDescriptor);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("failed to get description\n");
+ Miniport->lpVtbl->Release(Miniport);
+ This->bInitialized = FALSE;
+ return Status;
+ }
+
+ /* create the subdevice descriptor */
+ Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
+ 3,
+ InterfaceGuids,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ 0,
+ NULL,
+ 0,
+ NULL,
+ This->pDescriptor);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("PcCreateSubdeviceDescriptor failed with %x\n", Status);
+ Miniport->lpVtbl->Release(Miniport);
+ This->bInitialized = FALSE;
+ return Status;
+ }
+
+ /* did we get a service group */
+ if (ServiceGroup)
+ {
+ /* store service group in context */
+ This->ServiceGroup = ServiceGroup;
+
+ /* add ourselves to service group which is called when miniport receives an isr
*/
+ ServiceGroup->lpVtbl->AddMember(ServiceGroup,
(PSERVICESINK)&This->lpVtblServiceSink);
+
+ /* increment reference on service group */
+ ServiceGroup->lpVtbl->AddRef(ServiceGroup);
+ }
+
+ /* check if it supports IPinCount interface */
+ Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPinCount, (PVOID*)&PinCount);
+ if (NT_SUCCESS(Status))
+ {
+ /* store IPinCount interface */
+ This->pPinCount = PinCount;
+ }
+
+ /* does the Miniport adapter support IPowerNotify interface*/
+ Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport,
&IID_IPowerNotify, (PVOID*)&PowerNotify);
+ if (NT_SUCCESS(Status))
+ {
+ /* store reference */
+ This->pPowerNotify = PowerNotify;
+ }
+
+ DPRINT("IPortWavePci_Init sucessfully initialized\n");
return STATUS_SUCCESS;
}
@@ -380,7 +462,7 @@
if (!This->bInitialized)
{
- DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initiazed\n");
+ DPRINT("IPortWavePci_fnNewRegistryKey called w/o initiazed\n");
return STATUS_UNSUCCESSFUL;
}
@@ -410,7 +492,7 @@
if (!This->bInitialized)
{
- DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initiazed\n");
+ DPRINT("IPortWavePci_fnNewRegistryKey called w/o initiazed\n");
return STATUS_UNSUCCESSFUL;
}
@@ -483,6 +565,169 @@
IPortWavePci_fnNewMasterDmaChannel,
};
+//---------------------------------------------------------------
+// ISubdevice interface
+//
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnQueryInterface(
+ IN ISubdevice *iface,
+ IN REFIID InterfaceId,
+ IN PVOID* Interface)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ return IPortWavePci_fnQueryInterface((IPortWavePci*)This, InterfaceId, Interface);
+}
+
+static
+ULONG
+NTAPI
+ISubDevice_fnAddRef(
+ IN ISubdevice *iface)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ return IPortWavePci_fnAddRef((IPortWavePci*)This);
+}
+
+static
+ULONG
+NTAPI
+ISubDevice_fnRelease(
+ IN ISubdevice *iface)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ return IPortWavePci_fnRelease((IPortWavePci*)This);
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnNewIrpTarget(
+ IN ISubdevice *iface,
+ OUT struct IIrpTarget **OutTarget,
+ IN WCHAR * Name,
+ IN PUNKNOWN Unknown,
+ IN POOL_TYPE PoolType,
+ IN PDEVICE_OBJECT * DeviceObject,
+ IN PIRP Irp,
+ IN KSOBJECT_CREATE *CreateObject)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ DPRINT1("ISubDevice_NewIrpTarget this %p\n", This);
+ return STATUS_UNSUCCESSFUL;
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnReleaseChildren(
+ IN ISubdevice *iface)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ DPRINT1("ISubDevice_ReleaseChildren this %p\n", This);
+ return STATUS_UNSUCCESSFUL;
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnGetDescriptor(
+ IN ISubdevice *iface,
+ IN SUBDEVICE_DESCRIPTOR ** Descriptor)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ DPRINT1("ISubDevice_GetDescriptor this %p\n", This);
+ *Descriptor = This->SubDeviceDescriptor;
+ return STATUS_SUCCESS;
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnDataRangeIntersection(
+ IN ISubdevice *iface,
+ IN ULONG PinId,
+ IN PKSDATARANGE DataRange,
+ IN PKSDATARANGE MatchingDataRange,
+ IN ULONG OutputBufferLength,
+ OUT PVOID ResultantFormat OPTIONAL,
+ OUT PULONG ResultantFormatLength)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ DPRINT("ISubDevice_DataRangeIntersection this %p\n", This);
+
+ if (This->Miniport)
+ {
+ return This->Miniport->lpVtbl->DataRangeIntersection (This->Miniport,
PinId, DataRange, MatchingDataRange, OutputBufferLength, ResultantFormat,
ResultantFormatLength);
+ }
+
+ return STATUS_UNSUCCESSFUL;
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnPowerChangeNotify(
+ IN ISubdevice *iface,
+ IN POWER_STATE PowerState)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ if (This->pPowerNotify)
+ {
+ This->pPowerNotify->lpVtbl->PowerChangeNotify(This->pPowerNotify,
PowerState);
+ }
+
+ return STATUS_SUCCESS;
+}
+
+static
+NTSTATUS
+NTAPI
+ISubDevice_fnPinCount(
+ IN ISubdevice *iface,
+ IN ULONG PinId,
+ IN OUT PULONG FilterNecessary,
+ IN OUT PULONG FilterCurrent,
+ IN OUT PULONG FilterPossible,
+ IN OUT PULONG GlobalCurrent,
+ IN OUT PULONG GlobalPossible)
+{
+ IPortWavePciImpl * This = (IPortWavePciImpl*)CONTAINING_RECORD(iface,
IPortWavePciImpl, lpVtblSubDevice);
+
+ if (This->pPinCount)
+ {
+ This->pPinCount->lpVtbl->PinCount(This->pPinCount, PinId,
FilterNecessary, FilterCurrent, FilterPossible, GlobalCurrent, GlobalPossible);
+ return STATUS_SUCCESS;
+ }
+
+ /* FIXME
+ * scan filter descriptor
+ */
+ return STATUS_UNSUCCESSFUL;
+}
+
+static ISubdeviceVtbl vt_ISubdeviceVtbl =
+{
+ ISubDevice_fnQueryInterface,
+ ISubDevice_fnAddRef,
+ ISubDevice_fnRelease,
+ ISubDevice_fnNewIrpTarget,
+ ISubDevice_fnReleaseChildren,
+ ISubDevice_fnGetDescriptor,
+ ISubDevice_fnDataRangeIntersection,
+ ISubDevice_fnPowerChangeNotify,
+ ISubDevice_fnPinCount
+};
NTSTATUS
NewPortWavePci(
@@ -496,6 +741,7 @@
This->lpVtblServiceSink = &vt_IServiceSink;
This->lpVtbl = &vt_IPortWavePci;
+ This->lpVtblSubDevice = &vt_ISubdeviceVtbl;
This->lpVtblPortEvents = &vt_IPortEvents;
This->ref = 1;
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] Sun Jan 18
17:46:09 2009
@@ -157,6 +157,22 @@
IN ULONG DmaPort,
OUT PDEVICE_DESCRIPTION DeviceDescription);
-
+NTSTATUS
+NTAPI
+PcCreateSubdeviceDescriptor(
+ OUT SUBDEVICE_DESCRIPTOR ** OutSubdeviceDescriptor,
+ IN ULONG InterfaceCount,
+ IN GUID * InterfaceGuids,
+ IN ULONG IdentifierCount,
+ IN KSIDENTIFIER *Identifier,
+ IN ULONG FilterPropertiesCount,
+ IN KSPROPERTY_SET * FilterProperties,
+ IN ULONG Unknown1,
+ IN ULONG Unknown2,
+ IN ULONG PinPropertiesCount,
+ IN KSPROPERTY_SET * PinProperties,
+ IN ULONG EventSetCount,
+ IN KSEVENT_SET * EventSet,
+ IN PPCFILTER_DESCRIPTOR FilterDescription);
#endif
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] Sun Jan 18
17:46:09 2009
@@ -22,7 +22,7 @@
DPRINT("IRegistryKey_AddRef: This %p\n", This);
- return _InterlockedIncrement(&This->ref);
+ return InterlockedIncrement(&This->ref);
}
ULONG
@@ -32,7 +32,7 @@
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
- _InterlockedDecrement(&This->ref);
+ InterlockedDecrement(&This->ref);
DPRINT1("IRegistryKey_fnRelease ref %u this %p entered\n", This->ref,
This);
if (This->ref == 0)
{
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] Sun Jan 18
17:46:09 2009
@@ -79,12 +79,55 @@
return STATUS_NOT_IMPLEMENTED;
}
+
+/*
+ * @unimplemented
+ */
NTSTATUS
+NTAPI
PcCreateSubdeviceDescriptor(
- /* TODO */ )
+ OUT SUBDEVICE_DESCRIPTOR ** OutSubdeviceDescriptor,
+ IN ULONG InterfaceCount,
+ IN GUID * InterfaceGuids,
+ IN ULONG IdentifierCount,
+ IN KSIDENTIFIER *Identifier,
+ IN ULONG FilterPropertiesCount,
+ IN KSPROPERTY_SET * FilterProperties,
+ IN ULONG Unknown1,
+ IN ULONG Unknown2,
+ IN ULONG PinPropertiesCount,
+ IN KSPROPERTY_SET * PinProperties,
+ IN ULONG EventSetCount,
+ IN KSEVENT_SET * EventSet,
+ IN PPCFILTER_DESCRIPTOR FilterDescription)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ SUBDEVICE_DESCRIPTOR * Descriptor;
+ NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;
+
+ Descriptor = AllocateItem(NonPagedPool, sizeof(SUBDEVICE_DESCRIPTOR),
TAG_PORTCLASS);
+ if (!Descriptor)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ Descriptor->Interfaces = AllocateItem(NonPagedPool, sizeof(GUID) * InterfaceCount,
TAG_PORTCLASS);
+ if (!Descriptor->Interfaces)
+ goto cleanup;
+
+ /* copy interface guids */
+ RtlCopyMemory(Descriptor->Interfaces, InterfaceGuids, sizeof(GUID) *
InterfaceCount);
+ Descriptor->InterfaceCount = InterfaceCount;
+
+ *OutSubdeviceDescriptor = Descriptor;
+ return STATUS_SUCCESS;
+
+cleanup:
+ if (Descriptor)
+ {
+ if (Descriptor->Interfaces)
+ FreeItem(Descriptor->Interfaces, TAG_PORTCLASS);
+
+ FreeItem(Descriptor, TAG_PORTCLASS);
+ }
+ return Status;
}
/* PcDeleteSubdeviceDescriptor */