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
,
133 Bus_CompletionRoutine(
134 PDEVICE_OBJECT DeviceObject
,
142 PFDO_DEVICE_DATA FdoData
148 PFDO_DEVICE_DATA FdoData
153 PDEVICE_OBJECT Device
,
154 PPDO_DEVICE_DATA PdoData
160 PDEVICE_OBJECT DeviceObject
,
162 PIO_STACK_LOCATION IrpStack
,
163 PFDO_DEVICE_DATA DeviceData
169 PFDO_DEVICE_DATA FdoData
,
174 BUS_QUERY_ID_TYPE Type
178 DbgDeviceRelationString(
179 DEVICE_RELATION_TYPE Type
184 PFDO_DEVICE_DATA FdoData
,
190 PPDO_DEVICE_DATA PdoData
,
197 PDEVICE_OBJECT DeviceObject
,
202 PowerMinorFunctionString (
207 DbgSystemPowerString(
208 SYSTEM_POWER_STATE Type
212 DbgDevicePowerString(
213 DEVICE_POWER_STATE Type
218 PDEVICE_OBJECT DeviceObject
,
220 PIO_STACK_LOCATION IrpStack
,
221 PPDO_DEVICE_DATA DeviceData
225 Bus_PDO_QueryDeviceCaps(
226 PPDO_DEVICE_DATA DeviceData
,
230 Bus_PDO_QueryDeviceId(
231 PPDO_DEVICE_DATA DeviceData
,
236 Bus_PDO_QueryDeviceText(
237 PPDO_DEVICE_DATA DeviceData
,
241 Bus_PDO_QueryResources(
242 PPDO_DEVICE_DATA DeviceData
,
246 Bus_PDO_QueryResourceRequirements(
247 PPDO_DEVICE_DATA DeviceData
,
251 Bus_PDO_QueryDeviceRelations(
252 PPDO_DEVICE_DATA DeviceData
,
256 Bus_PDO_QueryBusInformation(
257 PPDO_DEVICE_DATA DeviceData
,
261 Bus_GetDeviceCapabilities(
262 PDEVICE_OBJECT DeviceObject
,
263 PDEVICE_CAPABILITIES DeviceCapabilities
267 Bus_PDO_QueryInterface(
268 PPDO_DEVICE_DATA DeviceData
,
272 Bus_GetCrispinessLevel(
277 Bus_SetCrispinessLevel(
282 Bus_IsSafetyLockEnabled(
286 Bus_InterfaceReference (
290 Bus_InterfaceDereference (