2 * PROJECT: ReactOS ACPI bus driver
3 * FILE: acpi/ospm/include/acpisys.h
4 * PURPOSE: ACPI bus driver definitions
6 typedef enum _DEVICE_PNP_STATE
{
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
17 // A common header for the device extensions of the PDOs and FDO
20 typedef struct _COMMON_DEVICE_DATA
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
;
30 typedef struct _PDO_DEVICE_DATA
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
39 // Link point to hold all the PDOs for a single bus together
41 ULONG InterfaceRefCount
;
42 UNICODE_STRING InterfaceName
;
44 } PDO_DEVICE_DATA
, *PPDO_DEVICE_DATA
;
47 // The device extension of the bus itself. From whence the PDO's are born.
50 typedef struct _FDO_DEVICE_DATA
52 COMMON_DEVICE_DATA Common
;
53 PDEVICE_OBJECT UnderlyingPDO
;
55 // The underlying bus PDO and the actual device object to which our
57 PDEVICE_OBJECT NextLowerDriver
;
59 // List of PDOs created so far
60 LIST_ENTRY ListOfPDOs
;
62 // The PDOs currently enumerated.
65 // A synchronization for access to the device extension.
68 } FDO_DEVICE_DATA
, *PFDO_DEVICE_DATA
;
70 #define FDO_FROM_PDO(pdoData) \
71 ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension)
73 #define INITIALIZE_PNP_STATE(_Data_) \
74 (_Data_).DevicePnPState = NotStarted;\
75 (_Data_).PreviousPnPState = NotStarted;
77 #define SET_NEW_PNP_STATE(_Data_, _state_) \
78 (_Data_).PreviousPnPState = (_Data_).DevicePnPState;\
79 (_Data_).DevicePnPState = (_state_);
81 #define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
82 (_Data_).DevicePnPState = (_Data_).PreviousPnPState;\
88 PFDO_DEVICE_DATA DeviceExtension
);
92 Bus_PDO_EvalMethod(PPDO_DEVICE_DATA DeviceData
,
98 PDEVICE_OBJECT DeviceObject
,
104 PDRIVER_OBJECT DriverObject
108 PnPMinorFunctionString (
115 PDRIVER_OBJECT DriverObject
,
116 PDEVICE_OBJECT PhysicalDeviceObject
120 Bus_SendIrpSynchronously (
121 PDEVICE_OBJECT DeviceObject
,
128 PDEVICE_OBJECT DeviceObject
,
134 Bus_CompletionRoutine(
135 PDEVICE_OBJECT DeviceObject
,
143 PFDO_DEVICE_DATA FdoData
149 PFDO_DEVICE_DATA FdoData
154 PDEVICE_OBJECT Device
,
155 PPDO_DEVICE_DATA PdoData
161 PDEVICE_OBJECT DeviceObject
,
163 PIO_STACK_LOCATION IrpStack
,
164 PFDO_DEVICE_DATA DeviceData
170 PFDO_DEVICE_DATA FdoData
,
175 BUS_QUERY_ID_TYPE Type
179 DbgDeviceRelationString(
180 DEVICE_RELATION_TYPE Type
185 PFDO_DEVICE_DATA FdoData
,
191 PPDO_DEVICE_DATA PdoData
,
198 PDEVICE_OBJECT DeviceObject
,
203 PowerMinorFunctionString (
208 DbgSystemPowerString(
209 SYSTEM_POWER_STATE Type
213 DbgDevicePowerString(
214 DEVICE_POWER_STATE Type
219 PDEVICE_OBJECT DeviceObject
,
221 PIO_STACK_LOCATION IrpStack
,
222 PPDO_DEVICE_DATA DeviceData
226 Bus_PDO_QueryDeviceCaps(
227 PPDO_DEVICE_DATA DeviceData
,
231 Bus_PDO_QueryDeviceId(
232 PPDO_DEVICE_DATA DeviceData
,
237 Bus_PDO_QueryDeviceText(
238 PPDO_DEVICE_DATA DeviceData
,
242 Bus_PDO_QueryResources(
243 PPDO_DEVICE_DATA DeviceData
,
247 Bus_PDO_QueryResourceRequirements(
248 PPDO_DEVICE_DATA DeviceData
,
252 Bus_PDO_QueryDeviceRelations(
253 PPDO_DEVICE_DATA DeviceData
,
257 Bus_PDO_QueryBusInformation(
258 PPDO_DEVICE_DATA DeviceData
,
262 Bus_GetDeviceCapabilities(
263 PDEVICE_OBJECT DeviceObject
,
264 PDEVICE_CAPABILITIES DeviceCapabilities
268 Bus_PDO_QueryInterface(
269 PPDO_DEVICE_DATA DeviceData
,
273 Bus_GetCrispinessLevel(
278 Bus_SetCrispinessLevel(
283 Bus_IsSafetyLockEnabled(
287 Bus_InterfaceReference (
291 Bus_InterfaceDereference (