[HDAUDBUS]

- partly implement HDA_TransferCodecVerbs
- stubplement HDAUDIO_BUS_INTERFACE_V2
- silence traces

svn path=/trunk/; revision=68330
This commit is contained in:
Johannes Anderwald 2015-07-02 11:07:39 +00:00
parent ed161d747f
commit 0c4a5a1f46
4 changed files with 135 additions and 27 deletions

View file

@ -27,15 +27,37 @@ PVOID BusContext)
NTSTATUS
NTAPI
HDA_TransferCodecVerbs(
IN PVOID _context,
IN ULONG Count,
IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer,
IN PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback,
IN PVOID Context)
IN PVOID _context,
IN ULONG Count,
IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer,
IN PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback,
IN PVOID Context)
{
UNIMPLEMENTED;
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
ULONG Verbs[MAX_CODEC_RESPONSES], Responses[MAX_CODEC_RESPONSES];
ULONG Index;
PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
DPRINT1("HDA_TransferCodecVerbs Coun %lu CodecTransfer %p Callback %p Context %p\n", Count, CodecTransfer, Callback, Context);
/* get device extension */
DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)_context;
ASSERT(DeviceExtension->IsFDO == FALSE);
/* FIXME handle callback*/
ASSERT(Callback == NULL);
for (Index = 0; Index < Count; Index++)
{
Verbs[Index] = CodecTransfer[Index].Output.Command;
}
HDA_SendVerbs(DeviceExtension->FDO, DeviceExtension->Codec, Verbs, Responses, Count);
for (Index = 0; Index < DeviceExtension->Codec->ResponseCount; Index++)
{
CodecTransfer[Index].Input.Response = DeviceExtension->Codec->Responses[Index];
}
return STATUS_SUCCESS;
}
NTSTATUS
@ -215,13 +237,71 @@ HDA_GetResourceInformation(
*FunctionGroupStartNode = DeviceExtension->AudioGroup->NodeId;
}
NTSTATUS
NTAPI
HDA_AllocateDmaBufferWithNotification(
IN PVOID _context,
IN HANDLE Handle,
IN ULONG NotificationCount,
IN SIZE_T RequestedBufferSize,
OUT PMDL *BufferMdl,
OUT PSIZE_T AllocatedBufferSize,
OUT PSIZE_T OffsetFromFirstPage,
OUT PUCHAR StreamId,
OUT PULONG FifoSize)
{
UNIMPLEMENTED;
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HDA_FreeDmaBufferWithNotification(
IN PVOID _context,
IN HANDLE Handle,
IN PMDL BufferMdl,
IN SIZE_T BufferSize)
{
UNIMPLEMENTED;
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HDA_RegisterNotificationEvent(
PVOID _context,
HANDLE Handle,
IN PKEVENT NotificationEvent)
{
UNIMPLEMENTED;
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
NTAPI
HDA_UnregisterNotificationEvent(
IN PVOID _context,
IN HANDLE Handle,
IN PKEVENT NotificationEvent)
{
UNIMPLEMENTED;
ASSERT(FALSE);
return STATUS_NOT_IMPLEMENTED;
}
NTSTATUS
HDA_PDOHandleQueryInterface(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION IoStack;
PHDAUDIO_BUS_INTERFACE InterfaceHDA;
PHDAUDIO_BUS_INTERFACE_V2 InterfaceHDA;
PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
/* get device extension */
@ -232,10 +312,37 @@ HDA_PDOHandleQueryInterface(
if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, GUID_HDAUDIO_BUS_INTERFACE))
{
InterfaceHDA = (PHDAUDIO_BUS_INTERFACE)IoStack->Parameters.QueryInterface.Interface;
InterfaceHDA = (PHDAUDIO_BUS_INTERFACE_V2)IoStack->Parameters.QueryInterface.Interface;
InterfaceHDA->Version = IoStack->Parameters.QueryInterface.Version;
InterfaceHDA->Size = IoStack->Parameters.QueryInterface.Size;
InterfaceHDA->Size = sizeof(HDAUDIO_BUS_INTERFACE);
InterfaceHDA->Context = DeviceExtension;
InterfaceHDA->InterfaceReference = HDA_InterfaceReference;
InterfaceHDA->InterfaceDereference = HDA_InterfaceDereference;
InterfaceHDA->TransferCodecVerbs = HDA_TransferCodecVerbs;
InterfaceHDA->AllocateCaptureDmaEngine = HDA_AllocateCaptureDmaEngine;
InterfaceHDA->AllocateRenderDmaEngine = HDA_AllocateRenderDmaEngine;
InterfaceHDA->ChangeBandwidthAllocation = HDA_ChangeBandwidthAllocation;
InterfaceHDA->AllocateDmaBuffer = HDA_AllocateDmaBuffer;
InterfaceHDA->FreeDmaBuffer = HDA_FreeDmaBuffer;
InterfaceHDA->FreeDmaEngine = HDA_FreeDmaEngine;
InterfaceHDA->SetDmaEngineState = HDA_SetDmaEngineState;
InterfaceHDA->GetWallClockRegister = HDA_GetWallClockRegister;
InterfaceHDA->GetLinkPositionRegister = HDA_GetLinkPositionRegister;
InterfaceHDA->RegisterEventCallback = HDA_RegisterEventCallback;
InterfaceHDA->UnregisterEventCallback = HDA_UnregisterEventCallback;
InterfaceHDA->GetDeviceInformation = HDA_GetDeviceInformation;
InterfaceHDA->GetResourceInformation = HDA_GetResourceInformation;
return STATUS_SUCCESS;
}
else if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, GUID_HDAUDIO_BUS_INTERFACE_V2))
{
InterfaceHDA = (PHDAUDIO_BUS_INTERFACE_V2)IoStack->Parameters.QueryInterface.Interface;
InterfaceHDA->Version = IoStack->Parameters.QueryInterface.Version;
InterfaceHDA->Size = sizeof(HDAUDIO_BUS_INTERFACE_V2);
InterfaceHDA->Context = DeviceExtension;
InterfaceHDA->InterfaceReference = HDA_InterfaceReference;
InterfaceHDA->InterfaceDereference = HDA_InterfaceDereference;
InterfaceHDA->TransferCodecVerbs = HDA_TransferCodecVerbs;
InterfaceHDA->AllocateCaptureDmaEngine = HDA_AllocateCaptureDmaEngine;
@ -252,10 +359,14 @@ HDA_PDOHandleQueryInterface(
InterfaceHDA->GetDeviceInformation = HDA_GetDeviceInformation;
InterfaceHDA->GetResourceInformation = HDA_GetResourceInformation;
return STATUS_SUCCESS;
InterfaceHDA->AllocateDmaBufferWithNotification = HDA_AllocateDmaBufferWithNotification;
InterfaceHDA->FreeDmaBufferWithNotification = HDA_FreeDmaBufferWithNotification;
InterfaceHDA->RegisterNotificationEvent = HDA_RegisterNotificationEvent;
InterfaceHDA->UnregisterNotificationEvent = HDA_UnregisterNotificationEvent;
}
// FIXME
// implement support for GUID_HDAUDIO_BUS_INTERFACE_BDL, GUID_HDAUDIO_BUS_INTERFACE_V2
// implement support for GUID_HDAUDIO_BUS_INTERFACE_BDL
UNIMPLEMENTED;
return STATUS_NOT_SUPPORTED;
}

View file

@ -127,6 +127,7 @@ HDA_SendVerbs(
/* get device extension */
DeviceExtension = (PHDA_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
ASSERT(DeviceExtension->IsFDO);
/* reset response count */
Codec->ResponseCount = 0;
@ -249,6 +250,7 @@ HDA_InitCodec(
ChildDeviceExtension->IsFDO = FALSE;
ChildDeviceExtension->Codec = Entry;
ChildDeviceExtension->AudioGroup = AudioGroup;
ChildDeviceExtension->FDO = DeviceObject;
/* setup flags */
AudioGroup->ChildPDO->Flags |= DO_POWER_PAGABLE;

View file

@ -98,18 +98,14 @@ HDA_Pnp(
//ChildDeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
IoStack = IoGetCurrentIrpStackLocation(Irp);
DPRINT1("HDA_Pnp Minor: %u IsFDO%d\n", IoStack->MinorFunction, FDODeviceExtension->IsFDO);
if (FDODeviceExtension->IsFDO)
{
if (IoStack->MinorFunction == IRP_MN_START_DEVICE)
{
DPRINT1("IRP_MN_START_DEVICE\n");
Status = HDA_FDOStartDevice(DeviceObject, Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS)
{
DPRINT1("IRP_MN_QUERY_DEVICE_RELATIONS\n");
/* handle bus device relations */
if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations)
{
@ -130,25 +126,21 @@ HDA_Pnp(
{
if (IoStack->MinorFunction == IRP_MN_START_DEVICE)
{
DPRINT1("IRP_MN_START_DEVICE\n");
/* no op for pdo */
Status = STATUS_SUCCESS;
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_BUS_INFORMATION)
{
DPRINT1("IRP_MN_QUERY_BUS_INFORMATION\n");
/* query bus information */
Status = HDA_PDOQueryBusInformation(Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE)
{
DPRINT1("IRP_MN_QUERY_PNP_DEVICE_STATE\n");
/* query pnp state */
Status = HDA_PDOQueryBusDevicePnpState(Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS)
{
DPRINT1("IRP_MN_QUERY_DEVICE_RELATIONS\n");
if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation)
{
/* handle target device relations */
@ -180,35 +172,29 @@ HDA_Pnp(
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_CAPABILITIES)
{
DPRINT1("IRP_MN_QUERY_CAPABILITIES\n");
/* query capabilities */
Status = HDA_PDOQueryBusDeviceCapabilities(Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
{
DPRINT1("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
/* no op */
Status = STATUS_SUCCESS;
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCES)
{
DPRINT1("IRP_MN_QUERY_RESOURCES\n");
/* no op */
Status = STATUS_SUCCESS;
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_ID)
{
DPRINT1("IRP_MN_QUERY_ID\n");
Status = HDA_PDOQueryId(DeviceObject, Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_TEXT)
{
DPRINT1("IRP_MN_QUERY_DEVICE_TEXT\n");
Status = HDA_PDOHandleQueryDeviceText(Irp);
}
else if (IoStack->MinorFunction == IRP_MN_QUERY_INTERFACE)
{
DPRINT1("IRP_MN_QUERY_INTERFACE\n");
Status = HDA_PDOHandleQueryInterface(DeviceObject, Irp);
}
else

View file

@ -85,6 +85,7 @@ typedef struct
BOOLEAN IsFDO;
PHDA_CODEC_ENTRY Codec;
PHDA_CODEC_AUDIO_GROUP AudioGroup;
PDEVICE_OBJECT FDO;
}HDA_PDO_DEVICE_EXTENSION, *PHDA_PDO_DEVICE_EXTENSION;
@ -131,6 +132,14 @@ HDA_FDOQueryBusRelations(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
VOID
HDA_SendVerbs(
IN PDEVICE_OBJECT DeviceObject,
IN PHDA_CODEC_ENTRY Codec,
IN PULONG Verbs,
OUT PULONG Responses,
IN ULONG Count);
/* pdo.cpp*/
NTSTATUS