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
;
43 } PDO_DEVICE_DATA
, *PPDO_DEVICE_DATA
;
46 // The device extension of the bus itself. From whence the PDO's are born.
49 typedef struct _FDO_DEVICE_DATA
51 COMMON_DEVICE_DATA Common
;
52 PDEVICE_OBJECT UnderlyingPDO
;
54 // The underlying bus PDO and the actual device object to which our
56 PDEVICE_OBJECT NextLowerDriver
;
58 // List of PDOs created so far
59 LIST_ENTRY ListOfPDOs
;
61 // The PDOs currently enumerated.
64 // A synchronization for access to the device extension.
67 // The name returned from IoRegisterDeviceInterface,
68 // which is used as a handle for IoSetDeviceInterfaceState.
69 UNICODE_STRING InterfaceName
;
71 } FDO_DEVICE_DATA
, *PFDO_DEVICE_DATA
;
73 #define FDO_FROM_PDO(pdoData) \
74 ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension)
76 #define INITIALIZE_PNP_STATE(_Data_) \
77 (_Data_).DevicePnPState = NotStarted;\
78 (_Data_).PreviousPnPState = NotStarted;
80 #define SET_NEW_PNP_STATE(_Data_, _state_) \
81 (_Data_).PreviousPnPState = (_Data_).DevicePnPState;\
82 (_Data_).DevicePnPState = (_state_);
84 #define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
85 (_Data_).DevicePnPState = (_Data_).PreviousPnPState;\
91 PFDO_DEVICE_DATA DeviceExtension
);
96 PDEVICE_OBJECT DeviceObject
,
102 PDRIVER_OBJECT DriverObject
106 PnPMinorFunctionString (
113 PDRIVER_OBJECT DriverObject
,
114 PDEVICE_OBJECT PhysicalDeviceObject
118 Bus_SendIrpSynchronously (
119 PDEVICE_OBJECT DeviceObject
,
126 PDEVICE_OBJECT DeviceObject
,
131 Bus_CompletionRoutine(
132 PDEVICE_OBJECT DeviceObject
,
140 PFDO_DEVICE_DATA FdoData
146 PFDO_DEVICE_DATA FdoData
151 PDEVICE_OBJECT Device
,
152 PPDO_DEVICE_DATA PdoData
158 PDEVICE_OBJECT DeviceObject
,
160 PIO_STACK_LOCATION IrpStack
,
161 PFDO_DEVICE_DATA DeviceData
167 PFDO_DEVICE_DATA FdoData
,
172 BUS_QUERY_ID_TYPE Type
176 DbgDeviceRelationString(
177 DEVICE_RELATION_TYPE Type
182 PFDO_DEVICE_DATA FdoData
,
188 PPDO_DEVICE_DATA PdoData
,
195 PDEVICE_OBJECT DeviceObject
,
200 PowerMinorFunctionString (
205 DbgSystemPowerString(
206 SYSTEM_POWER_STATE Type
210 DbgDevicePowerString(
211 DEVICE_POWER_STATE Type
216 PDEVICE_OBJECT DeviceObject
,
218 PIO_STACK_LOCATION IrpStack
,
219 PPDO_DEVICE_DATA DeviceData
223 Bus_PDO_QueryDeviceCaps(
224 PPDO_DEVICE_DATA DeviceData
,
228 Bus_PDO_QueryDeviceId(
229 PPDO_DEVICE_DATA DeviceData
,
234 Bus_PDO_QueryDeviceText(
235 PPDO_DEVICE_DATA DeviceData
,
239 Bus_PDO_QueryResources(
240 PPDO_DEVICE_DATA DeviceData
,
244 Bus_PDO_QueryResourceRequirements(
245 PPDO_DEVICE_DATA DeviceData
,
249 Bus_PDO_QueryDeviceRelations(
250 PPDO_DEVICE_DATA DeviceData
,
254 Bus_PDO_QueryBusInformation(
255 PPDO_DEVICE_DATA DeviceData
,
259 Bus_GetDeviceCapabilities(
260 PDEVICE_OBJECT DeviceObject
,
261 PDEVICE_CAPABILITIES DeviceCapabilities
265 Bus_PDO_QueryInterface(
266 PPDO_DEVICE_DATA DeviceData
,
270 Bus_GetCrispinessLevel(
275 Bus_SetCrispinessLevel(
280 Bus_IsSafetyLockEnabled(
284 Bus_InterfaceReference (
288 Bus_InterfaceDereference (