xref: /reactos/drivers/bus/acpi/interface.c (revision 91323595)
1 #include "precomp.h"
2 
3 #define NDEBUG
4 #include <debug.h>
5 
6 VOID
7 NTAPI
AcpiInterfaceReference(PVOID Context)8 AcpiInterfaceReference(PVOID Context)
9 {
10   UNIMPLEMENTED;
11 }
12 
13 VOID
14 NTAPI
AcpiInterfaceDereference(PVOID Context)15 AcpiInterfaceDereference(PVOID Context)
16 {
17   UNIMPLEMENTED;
18 }
19 
20 NTSTATUS
21 NTAPI
AcpiInterfaceConnectVector(PDEVICE_OBJECT Context,ULONG GpeNumber,KINTERRUPT_MODE Mode,BOOLEAN Shareable,PGPE_SERVICE_ROUTINE ServiceRoutine,PVOID ServiceContext,PVOID ObjectContext)22 AcpiInterfaceConnectVector(PDEVICE_OBJECT Context,
23                            ULONG GpeNumber,
24                            KINTERRUPT_MODE Mode,
25                            BOOLEAN Shareable,
26                            PGPE_SERVICE_ROUTINE ServiceRoutine,
27                            PVOID ServiceContext,
28                            PVOID ObjectContext)
29 {
30   UNIMPLEMENTED;
31 
32   return STATUS_NOT_IMPLEMENTED;
33 }
34 
35 NTSTATUS
36 NTAPI
AcpiInterfaceDisconnectVector(PVOID ObjectContext)37 AcpiInterfaceDisconnectVector(PVOID ObjectContext)
38 {
39   UNIMPLEMENTED;
40 
41   return STATUS_NOT_IMPLEMENTED;
42 }
43 
44 NTSTATUS
45 NTAPI
AcpiInterfaceEnableEvent(PDEVICE_OBJECT Context,PVOID ObjectContext)46 AcpiInterfaceEnableEvent(PDEVICE_OBJECT Context,
47                          PVOID ObjectContext)
48 {
49   UNIMPLEMENTED;
50 
51   return STATUS_NOT_IMPLEMENTED;
52 }
53 
54 NTSTATUS
55 NTAPI
AcpiInterfaceDisableEvent(PDEVICE_OBJECT Context,PVOID ObjectContext)56 AcpiInterfaceDisableEvent(PDEVICE_OBJECT Context,
57                           PVOID ObjectContext)
58 {
59   UNIMPLEMENTED;
60 
61   return STATUS_NOT_IMPLEMENTED;
62 }
63 
64 NTSTATUS
65 NTAPI
AcpiInterfaceClearStatus(PDEVICE_OBJECT Context,PVOID ObjectContext)66 AcpiInterfaceClearStatus(PDEVICE_OBJECT Context,
67                          PVOID ObjectContext)
68 {
69   UNIMPLEMENTED;
70 
71   return STATUS_NOT_IMPLEMENTED;
72 }
73 
74 NTSTATUS
75 NTAPI
AcpiInterfaceNotificationsRegister(PDEVICE_OBJECT Context,PDEVICE_NOTIFY_CALLBACK NotificationHandler,PVOID NotificationContext)76 AcpiInterfaceNotificationsRegister(PDEVICE_OBJECT Context,
77                                    PDEVICE_NOTIFY_CALLBACK NotificationHandler,
78                                    PVOID NotificationContext)
79 {
80   UNIMPLEMENTED;
81 
82   return STATUS_SUCCESS;
83 }
84 
85 VOID
86 NTAPI
AcpiInterfaceNotificationsUnregister(PDEVICE_OBJECT Context,PDEVICE_NOTIFY_CALLBACK NotificationHandler)87 AcpiInterfaceNotificationsUnregister(PDEVICE_OBJECT Context,
88                                      PDEVICE_NOTIFY_CALLBACK NotificationHandler)
89 {
90   UNIMPLEMENTED;
91 }
92 
93 NTSTATUS
Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData,PIRP Irp)94 Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData,
95                        PIRP Irp)
96 {
97   PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
98   PACPI_INTERFACE_STANDARD AcpiInterface;
99 
100   if (IrpSp->Parameters.QueryInterface.Version != 1)
101   {
102       DPRINT1("Invalid version number: %d\n",
103               IrpSp->Parameters.QueryInterface.Version);
104       return STATUS_INVALID_PARAMETER;
105   }
106 
107   if (RtlCompareMemory(IrpSp->Parameters.QueryInterface.InterfaceType,
108                         &GUID_ACPI_INTERFACE_STANDARD, sizeof(GUID)) == sizeof(GUID))
109   {
110       DPRINT("GUID_ACPI_INTERFACE_STANDARD\n");
111 
112       if (IrpSp->Parameters.QueryInterface.Size < sizeof(ACPI_INTERFACE_STANDARD))
113       {
114           DPRINT1("Buffer too small! (%d)\n", IrpSp->Parameters.QueryInterface.Size);
115           return STATUS_BUFFER_TOO_SMALL;
116       }
117 
118      AcpiInterface = (PACPI_INTERFACE_STANDARD)IrpSp->Parameters.QueryInterface.Interface;
119 
120      AcpiInterface->InterfaceReference = AcpiInterfaceReference;
121      AcpiInterface->InterfaceDereference = AcpiInterfaceDereference;
122      AcpiInterface->GpeConnectVector = AcpiInterfaceConnectVector;
123      AcpiInterface->GpeDisconnectVector = AcpiInterfaceDisconnectVector;
124      AcpiInterface->GpeEnableEvent = AcpiInterfaceEnableEvent;
125      AcpiInterface->GpeDisableEvent = AcpiInterfaceDisableEvent;
126      AcpiInterface->GpeClearStatus = AcpiInterfaceClearStatus;
127      AcpiInterface->RegisterForDeviceNotifications = AcpiInterfaceNotificationsRegister;
128      AcpiInterface->UnregisterForDeviceNotifications = AcpiInterfaceNotificationsUnregister;
129 
130      return STATUS_SUCCESS;
131   }
132   else
133   {
134       DPRINT1("Invalid GUID\n");
135       return STATUS_NOT_SUPPORTED;
136   }
137 }
138