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