Author: janderwald
Date: Thu Jul  2 11:07:39 2015
New Revision: 68330
URL: 
http://svn.reactos.org/svn/reactos?rev=68330&view=rev
Log:
[HDAUDBUS]
- partly implement HDA_TransferCodecVerbs
- stubplement HDAUDIO_BUS_INTERFACE_V2
- silence traces
Modified:
    trunk/reactos/drivers/wdm/audio/hdaudbus/businterface.cpp
    trunk/reactos/drivers/wdm/audio/hdaudbus/fdo.cpp
    trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
    trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.h
Modified: trunk/reactos/drivers/wdm/audio/hdaudbus/businterface.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/hdaudbus…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/hdaudbus/businterface.cpp   [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/hdaudbus/businterface.cpp   [iso-8859-1] Thu Jul  2
11:07:39 2015
@@ -27,15 +27,37 @@
 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)
-{
-    UNIMPLEMENTED;
-    ASSERT(FALSE);
-    return STATUS_NOT_IMPLEMENTED;
+    IN PVOID _context,
+    IN ULONG Count,
+    IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer,
+    IN PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback,
+    IN PVOID Context)
+{
+    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
@@ -216,12 +238,70 @@
 }
 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,12 @@
     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;
@@ -251,11 +333,40 @@
         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;
+        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;
+
+        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;
 }
Modified: trunk/reactos/drivers/wdm/audio/hdaudbus/fdo.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/hdaudbus…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/hdaudbus/fdo.cpp    [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/hdaudbus/fdo.cpp    [iso-8859-1] Thu Jul  2 11:07:39
2015
@@ -127,6 +127,7 @@
     /* get device extension */
     DeviceExtension = (PHDA_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+    ASSERT(DeviceExtension->IsFDO);
     /* reset response count */
     Codec->ResponseCount = 0;
@@ -249,6 +250,7 @@
             ChildDeviceExtension->IsFDO = FALSE;
             ChildDeviceExtension->Codec = Entry;
             ChildDeviceExtension->AudioGroup = AudioGroup;
+            ChildDeviceExtension->FDO = DeviceObject;
             /* setup flags */
             AudioGroup->ChildPDO->Flags |= DO_POWER_PAGABLE;
Modified: trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/hdaudbus…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.cpp       [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.cpp       [iso-8859-1] Thu Jul  2
11:07:39 2015
@@ -98,18 +98,14 @@
     //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 @@
     {
         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 @@
         }
         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
Modified: trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/hdaudbus…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/hdaudbus/hdaudbus.h [iso-8859-1] Thu Jul  2 11:07:39
2015
@@ -85,6 +85,7 @@
        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 @@
     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