xref: /reactos/drivers/bus/acpi/include/acpisys.h (revision 40462c92)
1 /*
2  * PROJECT: ReactOS ACPI bus driver
3  * FILE:    acpi/ospm/include/acpisys.h
4  * PURPOSE: ACPI bus driver definitions
5  */
6 
7 extern UNICODE_STRING ProcessorHardwareIds;
8 extern LPWSTR ProcessorIdString;
9 extern LPWSTR ProcessorNameString;
10 
11 typedef enum _DEVICE_PNP_STATE {
12 
13     NotStarted = 0,         // Not started yet
14     Started,                // Device has received the START_DEVICE IRP
15     StopPending,            // Device has received the QUERY_STOP IRP
16     Stopped,                // Device has received the STOP_DEVICE IRP
17     RemovalPending,         // Device has received the QUERY_REMOVE IRP
18     UnKnown                 // Unknown state
19 
20 } DEVICE_PNP_STATE;
21 
22 //
23 // A common header for the device extensions of the PDOs and FDO
24 //
25 
26 typedef struct _COMMON_DEVICE_DATA
27 {
28     PDEVICE_OBJECT  Self;
29     BOOLEAN         IsFDO;
30     DEVICE_PNP_STATE DevicePnPState;
31     DEVICE_PNP_STATE PreviousPnPState;
32     SYSTEM_POWER_STATE  SystemPowerState;
33     DEVICE_POWER_STATE  DevicePowerState;
34 } COMMON_DEVICE_DATA, *PCOMMON_DEVICE_DATA;
35 
36 typedef struct _PDO_DEVICE_DATA
37 {
38     COMMON_DEVICE_DATA Common;
39     ACPI_HANDLE AcpiHandle;
40     // A back pointer to the bus
41     PDEVICE_OBJECT  ParentFdo;
42     // An array of (zero terminated wide character strings).
43     // The array itself also null terminated
44     PWCHAR      HardwareIDs;
45     // Link point to hold all the PDOs for a single bus together
46     LIST_ENTRY  Link;
47     ULONG       InterfaceRefCount;
48     UNICODE_STRING InterfaceName;
49 
50 } PDO_DEVICE_DATA, *PPDO_DEVICE_DATA;
51 
52 //
53 // The device extension of the bus itself.  From whence the PDO's are born.
54 //
55 
56 typedef struct _FDO_DEVICE_DATA
57 {
58     COMMON_DEVICE_DATA Common;
59     PDEVICE_OBJECT  UnderlyingPDO;
60 
61     // The underlying bus PDO and the actual device object to which our
62     // FDO is attached
63     PDEVICE_OBJECT  NextLowerDriver;
64 
65     // List of PDOs created so far
66     LIST_ENTRY      ListOfPDOs;
67 
68     // The PDOs currently enumerated.
69     ULONG           NumPDOs;
70 
71     // A synchronization for access to the device extension.
72     FAST_MUTEX      Mutex;
73 
74 } FDO_DEVICE_DATA, *PFDO_DEVICE_DATA;
75 
76 #define FDO_FROM_PDO(pdoData) \
77           ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension)
78 
79 #define INITIALIZE_PNP_STATE(_Data_)    \
80         (_Data_).DevicePnPState =  NotStarted;\
81         (_Data_).PreviousPnPState = NotStarted;
82 
83 #define SET_NEW_PNP_STATE(_Data_, _state_) \
84         (_Data_).PreviousPnPState =  (_Data_).DevicePnPState;\
85         (_Data_).DevicePnPState = (_state_);
86 
87 #define RESTORE_PREVIOUS_PNP_STATE(_Data_)   \
88         (_Data_).DevicePnPState =   (_Data_).PreviousPnPState;\
89 
90 /* acpienum.c */
91 
92 NTSTATUS
93 ACPIEnumerateDevices(
94   PFDO_DEVICE_DATA DeviceExtension);
95 
96 NTSTATUS
97 NTAPI
98 Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData,
99                    PIRP Irp);
100 
101 NTSTATUS
102 NTAPI
103 Bus_CreateClose (
104     PDEVICE_OBJECT  DeviceObject,
105     PIRP            Irp
106     );
107 
108 VOID
109 Bus_DriverUnload (
110     PDRIVER_OBJECT DriverObject
111     );
112 
113 PCHAR
114 PnPMinorFunctionString (
115     UCHAR MinorFunction
116 );
117 
118 NTSTATUS
119 NTAPI
120 Bus_AddDevice(
121     PDRIVER_OBJECT DriverObject,
122     PDEVICE_OBJECT PhysicalDeviceObject
123     );
124 
125 NTSTATUS
126 Bus_SendIrpSynchronously (
127     PDEVICE_OBJECT DeviceObject,
128     PIRP Irp
129     );
130 
131 NTSTATUS
132 NTAPI
133 Bus_PnP (
134     PDEVICE_OBJECT   DeviceObject,
135     PIRP             Irp
136     );
137 
138 NTSTATUS
139 NTAPI
140 Bus_CompletionRoutine(
141      PDEVICE_OBJECT   DeviceObject,
142      PIRP             Irp,
143      PVOID            Context
144     );
145 
146 VOID
147 Bus_InitializePdo (
148     PDEVICE_OBJECT      Pdo,
149     PFDO_DEVICE_DATA    FdoData
150     );
151 
152 
153 void
154 Bus_RemoveFdo (
155      PFDO_DEVICE_DATA    FdoData
156     );
157 
158 NTSTATUS
159 Bus_DestroyPdo (
160     PDEVICE_OBJECT      Device,
161     PPDO_DEVICE_DATA    PdoData
162     );
163 
164 
165 NTSTATUS
166 Bus_FDO_PnP (
167      PDEVICE_OBJECT       DeviceObject,
168      PIRP                 Irp,
169      PIO_STACK_LOCATION   IrpStack,
170      PFDO_DEVICE_DATA     DeviceData
171     );
172 
173 
174 NTSTATUS
175 Bus_StartFdo (
176       PFDO_DEVICE_DATA            FdoData,
177       PIRP   Irp );
178 
179 PCHAR
180 DbgDeviceIDString(
181     BUS_QUERY_ID_TYPE Type
182     );
183 
184 PCHAR
185 DbgDeviceRelationString(
186      DEVICE_RELATION_TYPE Type
187     );
188 
189 NTSTATUS
190 Bus_FDO_Power (
191     PFDO_DEVICE_DATA    FdoData,
192     PIRP                Irp
193     );
194 
195 NTSTATUS
196 Bus_PDO_Power (
197     PPDO_DEVICE_DATA    PdoData,
198     PIRP                Irp
199     );
200 
201 NTSTATUS
202 NTAPI
203 Bus_Power (
204      PDEVICE_OBJECT DeviceObject,
205      PIRP Irp
206     );
207 
208 PCHAR
209 PowerMinorFunctionString (
210     UCHAR MinorFunction
211 );
212 
213 PCHAR
214 DbgSystemPowerString(
215      SYSTEM_POWER_STATE Type
216     );
217 
218 PCHAR
219 DbgDevicePowerString(
220      DEVICE_POWER_STATE Type
221     );
222 
223 NTSTATUS
224 Bus_PDO_PnP (
225      PDEVICE_OBJECT       DeviceObject,
226      PIRP                 Irp,
227      PIO_STACK_LOCATION   IrpStack,
228      PPDO_DEVICE_DATA     DeviceData
229     );
230 
231 NTSTATUS
232 Bus_PDO_QueryDeviceCaps(
233      PPDO_DEVICE_DATA     DeviceData,
234       PIRP   Irp );
235 
236 NTSTATUS
237 Bus_PDO_QueryDeviceId(
238      PPDO_DEVICE_DATA     DeviceData,
239       PIRP   Irp );
240 
241 
242 NTSTATUS
243 Bus_PDO_QueryDeviceText(
244      PPDO_DEVICE_DATA     DeviceData,
245       PIRP   Irp );
246 
247 NTSTATUS
248 Bus_PDO_QueryResources(
249      PPDO_DEVICE_DATA     DeviceData,
250       PIRP   Irp );
251 
252 NTSTATUS
253 Bus_PDO_QueryResourceRequirements(
254      PPDO_DEVICE_DATA     DeviceData,
255       PIRP   Irp );
256 
257 NTSTATUS
258 Bus_PDO_QueryDeviceRelations(
259      PPDO_DEVICE_DATA     DeviceData,
260       PIRP   Irp );
261 
262 NTSTATUS
263 Bus_PDO_QueryBusInformation(
264      PPDO_DEVICE_DATA     DeviceData,
265       PIRP   Irp );
266 
267 NTSTATUS
268 Bus_GetDeviceCapabilities(
269       PDEVICE_OBJECT          DeviceObject,
270       PDEVICE_CAPABILITIES    DeviceCapabilities
271     );
272 
273 NTSTATUS
274 Bus_PDO_QueryInterface(
275      PPDO_DEVICE_DATA     DeviceData,
276       PIRP   Irp );
277 
278 BOOLEAN
279 Bus_GetCrispinessLevel(
280        PVOID Context,
281       PUCHAR Level
282     );
283 BOOLEAN
284 Bus_SetCrispinessLevel(
285        PVOID Context,
286       UCHAR Level
287     );
288 BOOLEAN
289 Bus_IsSafetyLockEnabled(
290      PVOID Context
291     );
292 VOID
293 Bus_InterfaceReference (
294     PVOID Context
295    );
296 VOID
297 Bus_InterfaceDereference (
298     PVOID Context
299    );
300 
301 /* EOF */
302