mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 08:00:24 +00:00
- 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 svn path=/trunk/; revision=38923
This commit is contained in:
parent
fb169370fe
commit
eacb6ae11a
10 changed files with 486 additions and 67 deletions
|
@ -260,8 +260,9 @@ PcRegisterSubdevice(
|
|||
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 @@ PcRegisterSubdevice(
|
|||
}
|
||||
#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 = SubDevice->lpVtbl->GetDescriptor(SubDevice, &SubDeviceDescriptor);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
DPRINT1("Failed to get subdevice descriptor %x\n", Status);
|
||||
SubDevice->lpVtbl->Release(SubDevice);
|
||||
}
|
||||
|
||||
DPRINT1("PcRegisterSubdevice Status %x\n", Status);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// HACK
|
||||
/// IoRegisterDeviceInterface fails with
|
||||
/// STATUS_OBJECT_PATH_NOT_FOUND
|
||||
/// return Status;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,12 @@ DECLARE_INTERFACE_(IIrpTarget, IUnknown)
|
|||
*/
|
||||
|
||||
struct IIrpTargetFactory;
|
||||
struct SUBDEVICE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG InterfaceCount;
|
||||
GUID *Interfaces;
|
||||
}SUBDEVICE_DESCRIPTOR, *PSUBDEVICE_DESCRIPTOR;
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ISubdevice
|
||||
|
@ -123,7 +127,7 @@ DECLARE_INTERFACE_(ISubdevice, IUnknown)
|
|||
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,
|
||||
|
|
|
@ -41,10 +41,11 @@ IInterruptSync_fnQueryInterface(
|
|||
|
||||
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 @@ IInterruptSync_fnAddRef(
|
|||
|
||||
DPRINT1("IInterruptSync_AddRef: This %p\n", This);
|
||||
|
||||
return _InterlockedIncrement(&This->ref);
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
@ -72,7 +73,7 @@ IInterruptSync_fnRelease(
|
|||
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 @@ IInterruptSynchronizedRoutine(
|
|||
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 @@ IInterruptSync_fnConnect(
|
|||
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 @@ static IInterruptSyncVtbl vt_IInterruptSyncVtbl =
|
|||
};
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
PcNewInterruptSync(
|
||||
|
@ -326,7 +329,8 @@ PcNewInterruptSync(
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -129,6 +129,7 @@ PortClsPnp(
|
|||
|
||||
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 @@ PortClsPnp(
|
|||
|
||||
/* Do not complete? */
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else if ( irp_stack->MinorFunction == IRP_MN_QUERY_INTERFACE )
|
||||
{
|
||||
|
@ -148,7 +150,11 @@ PortClsPnp(
|
|||
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 @@ return STATUS_SUCCESS;
|
|||
/* 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);
|
||||
|
|
|
@ -13,9 +13,23 @@ typedef struct
|
|||
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
|
||||
KSPROPERTY_SET PinPropertySet =
|
||||
|
@ -72,11 +86,10 @@ IPortTopology_fnQueryInterface(
|
|||
{
|
||||
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 @@ IPortTopology_fnInit(
|
|||
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 @@ NTSTATUS
|
|||
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
|
||||
|
|
|
@ -18,11 +18,40 @@ typedef struct
|
|||
PPINCOUNT pPinCount;
|
||||
PPOWERNOTIFY pPowerNotify;
|
||||
PPCFILTER_DESCRIPTOR pDescriptor;
|
||||
|
||||
PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor;
|
||||
}IPortWaveCyclicImpl;
|
||||
|
||||
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}
|
||||
}
|
||||
};
|
||||
|
||||
const GUID GUID_DEVCLASS_SOUND; //FIXME
|
||||
#if 0
|
||||
static const KSIDENTIFIER Identifiers[] =
|
||||
{
|
||||
{
|
||||
&KSINTERFACESETID_Standard,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
&KSINTERFACESETID_Standard,
|
||||
1,
|
||||
0
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// IPortEvents
|
||||
|
@ -276,6 +305,41 @@ IPortWaveCyclic_fnInit(
|
|||
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))
|
||||
|
@ -283,17 +347,6 @@ IPortWaveCyclic_fnInit(
|
|||
/* 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*/
|
||||
Status = UnknownMiniport->lpVtbl->QueryInterface(UnknownMiniport, &IID_IPowerNotify, (PVOID*)&PowerNotify);
|
||||
|
@ -510,12 +563,14 @@ NTSTATUS
|
|||
NTAPI
|
||||
ISubDevice_fnGetDescriptor(
|
||||
IN ISubdevice *iface,
|
||||
IN struct SUBDEVICE_DESCRIPTOR ** Descriptor)
|
||||
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
|
||||
|
|
|
@ -5,6 +5,7 @@ typedef struct
|
|||
IPortWavePciVtbl *lpVtbl;
|
||||
IServiceSinkVtbl *lpVtblServiceSink;
|
||||
IPortEventsVtbl *lpVtblPortEvents;
|
||||
ISubdeviceVtbl *lpVtblSubDevice;
|
||||
|
||||
#if 0
|
||||
IUnregisterSubdevice *lpVtblUnregisterSubDevice;
|
||||
|
@ -17,8 +18,28 @@ typedef struct
|
|||
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}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// IPortEvents
|
||||
|
@ -225,6 +246,12 @@ IPortWavePci_fnQueryInterface(
|
|||
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 @@ IPortWavePci_fnInit(
|
|||
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 @@ IPortWavePci_fnInit(
|
|||
return Status;
|
||||
}
|
||||
|
||||
/* store service group */
|
||||
This->ServiceGroup = ServiceGroup;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* add ourselves to service group which is called when miniport receives an isr */
|
||||
ServiceGroup->lpVtbl->AddMember(ServiceGroup, (PSERVICESINK)&This->lpVtblServiceSink);
|
||||
/* create the subdevice descriptor */
|
||||
Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor,
|
||||
3,
|
||||
InterfaceGuids,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
This->pDescriptor);
|
||||
|
||||
/* increment reference on service group */
|
||||
ServiceGroup->lpVtbl->AddRef(ServiceGroup);
|
||||
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;
|
||||
|
||||
DPRINT("IPortWaveCyclic_Init sucessfully initialized\n");
|
||||
/* 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 @@ IPortWavePci_fnNewRegistryKey(
|
|||
|
||||
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 @@ IPortWavePci_fnGetDeviceProperty(
|
|||
|
||||
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 @@ static IPortWavePciVtbl vt_IPortWavePci =
|
|||
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 @@ NewPortWavePci(
|
|||
|
||||
This->lpVtblServiceSink = &vt_IServiceSink;
|
||||
This->lpVtbl = &vt_IPortWavePci;
|
||||
This->lpVtblSubDevice = &vt_ISubdeviceVtbl;
|
||||
This->lpVtblPortEvents = &vt_IPortEvents;
|
||||
This->ref = 1;
|
||||
|
||||
|
|
|
@ -157,6 +157,22 @@ PcDmaSlaveDescription(
|
|||
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
|
||||
|
|
|
@ -22,7 +22,7 @@ IRegistryKey_fnAddRef(
|
|||
|
||||
DPRINT("IRegistryKey_AddRef: This %p\n", This);
|
||||
|
||||
return _InterlockedIncrement(&This->ref);
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
ULONG
|
||||
|
@ -32,7 +32,7 @@ IRegistryKey_fnRelease(
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -79,12 +79,55 @@ PcCaptureFormat(
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue