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