[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 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_CreateClose (
96 PDEVICE_OBJECT DeviceObject,
97 PIRP Irp
98 );
99
100 VOID
101 Bus_DriverUnload (
102 PDRIVER_OBJECT DriverObject
103 );
104
105 PCHAR
106 PnPMinorFunctionString (
107 UCHAR MinorFunction
108 );
109
110 NTSTATUS
111 NTAPI
112 Bus_AddDevice(
113 PDRIVER_OBJECT DriverObject,
114 PDEVICE_OBJECT PhysicalDeviceObject
115 );
116
117 NTSTATUS
118 Bus_SendIrpSynchronously (
119 PDEVICE_OBJECT DeviceObject,
120 PIRP Irp
121 );
122
123 NTSTATUS
124 NTAPI
125 Bus_PnP (
126 PDEVICE_OBJECT DeviceObject,
127 PIRP Irp
128 );
129
130 NTSTATUS
131 Bus_CompletionRoutine(
132 PDEVICE_OBJECT DeviceObject,
133 PIRP Irp,
134 PVOID Context
135 );
136
137 VOID
138 Bus_InitializePdo (
139 PDEVICE_OBJECT Pdo,
140 PFDO_DEVICE_DATA FdoData
141 );
142
143
144 void
145 Bus_RemoveFdo (
146 PFDO_DEVICE_DATA FdoData
147 );
148
149 NTSTATUS
150 Bus_DestroyPdo (
151 PDEVICE_OBJECT Device,
152 PPDO_DEVICE_DATA PdoData
153 );
154
155
156 NTSTATUS
157 Bus_FDO_PnP (
158 PDEVICE_OBJECT DeviceObject,
159 PIRP Irp,
160 PIO_STACK_LOCATION IrpStack,
161 PFDO_DEVICE_DATA DeviceData
162 );
163
164
165 NTSTATUS
166 Bus_StartFdo (
167 PFDO_DEVICE_DATA FdoData,
168 PIRP Irp );
169
170 PCHAR
171 DbgDeviceIDString(
172 BUS_QUERY_ID_TYPE Type
173 );
174
175 PCHAR
176 DbgDeviceRelationString(
177 DEVICE_RELATION_TYPE Type
178 );
179
180 NTSTATUS
181 Bus_FDO_Power (
182 PFDO_DEVICE_DATA FdoData,
183 PIRP Irp
184 );
185
186 NTSTATUS
187 Bus_PDO_Power (
188 PPDO_DEVICE_DATA PdoData,
189 PIRP Irp
190 );
191
192 NTSTATUS
193 NTAPI
194 Bus_Power (
195 PDEVICE_OBJECT DeviceObject,
196 PIRP Irp
197 );
198
199 PCHAR
200 PowerMinorFunctionString (
201 UCHAR MinorFunction
202 );
203
204 PCHAR
205 DbgSystemPowerString(
206 SYSTEM_POWER_STATE Type
207 );
208
209 PCHAR
210 DbgDevicePowerString(
211 DEVICE_POWER_STATE Type
212 );
213
214 NTSTATUS
215 Bus_PDO_PnP (
216 PDEVICE_OBJECT DeviceObject,
217 PIRP Irp,
218 PIO_STACK_LOCATION IrpStack,
219 PPDO_DEVICE_DATA DeviceData
220 );
221
222 NTSTATUS
223 Bus_PDO_QueryDeviceCaps(
224 PPDO_DEVICE_DATA DeviceData,
225 PIRP Irp );
226
227 NTSTATUS
228 Bus_PDO_QueryDeviceId(
229 PPDO_DEVICE_DATA DeviceData,
230 PIRP Irp );
231
232
233 NTSTATUS
234 Bus_PDO_QueryDeviceText(
235 PPDO_DEVICE_DATA DeviceData,
236 PIRP Irp );
237
238 NTSTATUS
239 Bus_PDO_QueryResources(
240 PPDO_DEVICE_DATA DeviceData,
241 PIRP Irp );
242
243 NTSTATUS
244 Bus_PDO_QueryResourceRequirements(
245 PPDO_DEVICE_DATA DeviceData,
246 PIRP Irp );
247
248 NTSTATUS
249 Bus_PDO_QueryDeviceRelations(
250 PPDO_DEVICE_DATA DeviceData,
251 PIRP Irp );
252
253 NTSTATUS
254 Bus_PDO_QueryBusInformation(
255 PPDO_DEVICE_DATA DeviceData,
256 PIRP Irp );
257
258 NTSTATUS
259 Bus_GetDeviceCapabilities(
260 PDEVICE_OBJECT DeviceObject,
261 PDEVICE_CAPABILITIES DeviceCapabilities
262 );
263
264 NTSTATUS
265 Bus_PDO_QueryInterface(
266 PPDO_DEVICE_DATA DeviceData,
267 PIRP Irp );
268
269 BOOLEAN
270 Bus_GetCrispinessLevel(
271 PVOID Context,
272 PUCHAR Level
273 );
274 BOOLEAN
275 Bus_SetCrispinessLevel(
276 PVOID Context,
277 UCHAR Level
278 );
279 BOOLEAN
280 Bus_IsSafetyLockEnabled(
281 PVOID Context
282 );
283 VOID
284 Bus_InterfaceReference (
285 PVOID Context
286 );
287 VOID
288 Bus_InterfaceDereference (
289 PVOID Context
290 );
291
292 /* EOF */