[ACPI]
authorCameron Gutman <aicommander@gmail.com>
Tue, 23 Mar 2010 03:05:57 +0000 (03:05 +0000)
committerCameron Gutman <aicommander@gmail.com>
Tue, 23 Mar 2010 03:05:57 +0000 (03:05 +0000)
 - Add stubs for ACPI_INTERFACE_STANDARD and write all of the glue code for IRP_MN_QUERY_INTERFACE

svn path=/trunk/; revision=46353

reactos/drivers/bus/acpi/acpi.rbuild
reactos/drivers/bus/acpi/buspdo.c
reactos/drivers/bus/acpi/interface.c [new file with mode: 0644]

index cbc124a..4b9ec86 100644 (file)
@@ -26,6 +26,7 @@
        </directory>
        <file>osl.c</file>
        <file>acpienum.c</file>
+       <file>interface.c</file>
        <file>pnp.c</file>
        <file>power.c</file>
        <file>buspdo.c</file>
index 4a9498e..ed6439d 100644 (file)
@@ -176,6 +176,12 @@ Bus_PDO_PnP (
 
         break;
 
+    case IRP_MN_QUERY_INTERFACE:
+
+        status = Bus_PDO_QueryInterface(DeviceData, Irp);
+
+        break;
+
 
     case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
 
diff --git a/reactos/drivers/bus/acpi/interface.c b/reactos/drivers/bus/acpi/interface.c
new file mode 100644 (file)
index 0000000..5971705
--- /dev/null
@@ -0,0 +1,138 @@
+#include <ntddk.h>
+
+#include <acpi.h>
+
+#include <acpisys.h>
+#include <acpi_bus.h>
+#include <acpi_drivers.h>
+
+#include <wdmguid.h>
+#define NDEBUG
+#include <debug.h>
+
+VOID
+NTAPI
+AcpiInterfaceReference(PVOID Context)
+{
+  UNIMPLEMENTED
+}
+
+VOID
+NTAPI
+AcpiInterfaceDereference(PVOID Context)
+{
+  UNIMPLEMENTED
+}
+
+NTSTATUS
+AcpiInterfaceConnectVector(PDEVICE_OBJECT Context,
+                           ULONG GpeNumber,
+                           KINTERRUPT_MODE Mode,
+                           BOOLEAN Shareable,
+                           PGPE_SERVICE_ROUTINE ServiceRoutine,
+                           PVOID ServiceContext,
+                           PVOID *ObjectContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+AcpiInterfaceDisconnectVector(PDEVICE_OBJECT Context,
+                              PVOID ObjectContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+AcpiInterfaceEnableEvent(PDEVICE_OBJECT Context,
+                         PVOID ObjectContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+AcpiInterfaceDisableEvent(PDEVICE_OBJECT Context,
+                          PVOID ObjectContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+AcpiInterfaceClearStatus(PDEVICE_OBJECT Context,
+                         PVOID ObjectContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+AcpiInterfaceNotificationsRegister(PDEVICE_OBJECT Context,
+                                   PDEVICE_NOTIFY_CALLBACK NotificationHandler,
+                                   PVOID NotificationContext)
+{
+  UNIMPLEMENTED
+
+  return STATUS_NOT_IMPLEMENTED;
+}
+
+VOID
+AcpiInterfaceNotificationsUnregister(PDEVICE_OBJECT Context,
+                                     PDEVICE_NOTIFY_CALLBACK NotificationHandler)
+{
+  UNIMPLEMENTED
+}
+
+NTSTATUS
+Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData,
+                       PIRP Irp)
+{
+  PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
+  PACPI_INTERFACE_STANDARD AcpiInterface;
+
+  if (IrpSp->Parameters.QueryInterface.Version != 1)
+  {
+      DPRINT1("Invalid version number: %d\n",
+              IrpSp->Parameters.QueryInterface.Version);
+      return STATUS_INVALID_PARAMETER;
+  }
+
+  if (RtlCompareMemory(IrpSp->Parameters.QueryInterface.InterfaceType,
+                        &GUID_ACPI_INTERFACE_STANDARD, sizeof(GUID)) == sizeof(GUID))
+  {
+      DPRINT("GUID_ACPI_INTERFACE_STANDARD\n");
+
+      if (IrpSp->Parameters.QueryInterface.Size < sizeof(ACPI_INTERFACE_STANDARD))
+      {
+          DPRINT1("Buffer too small! (%d)\n", IrpSp->Parameters.QueryInterface.Size);
+          return STATUS_BUFFER_TOO_SMALL;
+      }
+
+     AcpiInterface = (PACPI_INTERFACE_STANDARD)IrpSp->Parameters.QueryInterface.Interface;
+
+     AcpiInterface->InterfaceReference = AcpiInterfaceReference;
+     AcpiInterface->InterfaceDereference = AcpiInterfaceDereference;
+     AcpiInterface->GpeConnectVector = AcpiInterfaceConnectVector;
+     AcpiInterface->GpeDisconnectVector = AcpiInterfaceDisconnectVector;
+     AcpiInterface->GpeEnableEvent = AcpiInterfaceEnableEvent;
+     AcpiInterface->GpeDisableEvent = AcpiInterfaceDisableEvent;
+     AcpiInterface->GpeClearStatus = AcpiInterfaceClearStatus;
+     AcpiInterface->RegisterForDeviceNotifications = AcpiInterfaceNotificationsRegister;
+     AcpiInterface->UnregisterForDeviceNotifications = AcpiInterfaceNotificationsUnregister;
+
+     return STATUS_SUCCESS;
+  }
+  else
+  {
+      DPRINT1("Invalid GUID\n");
+      return STATUS_INVALID_PARAMETER;
+  }
+}