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