1 /* 2 * PROJECT: ReactOS ACPI bus driver 3 * FILE: acpi/ospm/include/acpisys.h 4 * PURPOSE: ACPI bus driver definitions 5 */ 6 7 extern UNICODE_STRING ProcessorHardwareIds; 8 extern LPWSTR ProcessorIdString; 9 extern LPWSTR ProcessorNameString; 10 11 typedef enum _DEVICE_PNP_STATE { 12 13 NotStarted = 0, // Not started yet 14 Started, // Device has received the START_DEVICE IRP 15 StopPending, // Device has received the QUERY_STOP IRP 16 Stopped, // Device has received the STOP_DEVICE IRP 17 RemovalPending, // Device has received the QUERY_REMOVE IRP 18 UnKnown // Unknown state 19 20 } DEVICE_PNP_STATE; 21 22 // 23 // A common header for the device extensions of the PDOs and FDO 24 // 25 26 typedef struct _COMMON_DEVICE_DATA 27 { 28 PDEVICE_OBJECT Self; 29 BOOLEAN IsFDO; 30 DEVICE_PNP_STATE DevicePnPState; 31 DEVICE_PNP_STATE PreviousPnPState; 32 SYSTEM_POWER_STATE SystemPowerState; 33 DEVICE_POWER_STATE DevicePowerState; 34 } COMMON_DEVICE_DATA, *PCOMMON_DEVICE_DATA; 35 36 typedef struct _PDO_DEVICE_DATA 37 { 38 COMMON_DEVICE_DATA Common; 39 ACPI_HANDLE AcpiHandle; 40 // A back pointer to the bus 41 PDEVICE_OBJECT ParentFdo; 42 // An array of (zero terminated wide character strings). 43 // The array itself also null terminated 44 PWCHAR HardwareIDs; 45 // Link point to hold all the PDOs for a single bus together 46 LIST_ENTRY Link; 47 ULONG InterfaceRefCount; 48 UNICODE_STRING InterfaceName; 49 50 } PDO_DEVICE_DATA, *PPDO_DEVICE_DATA; 51 52 // 53 // The device extension of the bus itself. From whence the PDO's are born. 54 // 55 56 typedef struct _FDO_DEVICE_DATA 57 { 58 COMMON_DEVICE_DATA Common; 59 PDEVICE_OBJECT UnderlyingPDO; 60 61 // The underlying bus PDO and the actual device object to which our 62 // FDO is attached 63 PDEVICE_OBJECT NextLowerDriver; 64 65 // List of PDOs created so far 66 LIST_ENTRY ListOfPDOs; 67 68 // The PDOs currently enumerated. 69 ULONG NumPDOs; 70 71 // A synchronization for access to the device extension. 72 FAST_MUTEX Mutex; 73 74 } FDO_DEVICE_DATA, *PFDO_DEVICE_DATA; 75 76 typedef struct _EVAL_WORKITEM_DATA 77 { 78 PPDO_DEVICE_DATA DeviceData; 79 PIRP Irp; 80 WORK_QUEUE_ITEM WorkQueueItem; 81 } EVAL_WORKITEM_DATA, *PEVAL_WORKITEM_DATA; 82 83 #define FDO_FROM_PDO(pdoData) \ 84 ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension) 85 86 #define INITIALIZE_PNP_STATE(_Data_) \ 87 (_Data_).DevicePnPState = NotStarted;\ 88 (_Data_).PreviousPnPState = NotStarted; 89 90 #define SET_NEW_PNP_STATE(_Data_, _state_) \ 91 (_Data_).PreviousPnPState = (_Data_).DevicePnPState;\ 92 (_Data_).DevicePnPState = (_state_); 93 94 #define RESTORE_PREVIOUS_PNP_STATE(_Data_) \ 95 (_Data_).DevicePnPState = (_Data_).PreviousPnPState;\ 96 97 /* acpienum.c */ 98 99 NTSTATUS 100 ACPIEnumerateDevices( 101 PFDO_DEVICE_DATA DeviceExtension); 102 103 CODE_SEG("PAGE") 104 WORKER_THREAD_ROUTINE Bus_PDO_EvalMethodWorker; 105 106 CODE_SEG("PAGE") 107 NTSTATUS 108 NTAPI 109 Bus_PDO_EvalMethod( 110 _In_ PPDO_DEVICE_DATA DeviceData, 111 _Inout_ PIRP Irp); 112 113 NTSTATUS 114 NTAPI 115 Bus_CreateClose ( 116 PDEVICE_OBJECT DeviceObject, 117 PIRP Irp 118 ); 119 120 VOID 121 Bus_DriverUnload ( 122 PDRIVER_OBJECT DriverObject 123 ); 124 125 PCHAR 126 PnPMinorFunctionString ( 127 UCHAR MinorFunction 128 ); 129 130 NTSTATUS 131 Bus_SendIrpSynchronously ( 132 PDEVICE_OBJECT DeviceObject, 133 PIRP Irp 134 ); 135 136 NTSTATUS 137 NTAPI 138 Bus_PnP ( 139 PDEVICE_OBJECT DeviceObject, 140 PIRP Irp 141 ); 142 143 NTSTATUS 144 NTAPI 145 Bus_CompletionRoutine( 146 PDEVICE_OBJECT DeviceObject, 147 PIRP Irp, 148 PVOID Context 149 ); 150 151 VOID 152 Bus_InitializePdo ( 153 PDEVICE_OBJECT Pdo, 154 PFDO_DEVICE_DATA FdoData 155 ); 156 157 158 void 159 Bus_RemoveFdo ( 160 PFDO_DEVICE_DATA FdoData 161 ); 162 163 NTSTATUS 164 Bus_DestroyPdo ( 165 PDEVICE_OBJECT Device, 166 PPDO_DEVICE_DATA PdoData 167 ); 168 169 170 NTSTATUS 171 Bus_FDO_PnP ( 172 PDEVICE_OBJECT DeviceObject, 173 PIRP Irp, 174 PIO_STACK_LOCATION IrpStack, 175 PFDO_DEVICE_DATA DeviceData 176 ); 177 178 179 NTSTATUS 180 Bus_StartFdo ( 181 PFDO_DEVICE_DATA FdoData, 182 PIRP Irp ); 183 184 PCHAR 185 DbgDeviceIDString( 186 BUS_QUERY_ID_TYPE Type 187 ); 188 189 PCHAR 190 DbgDeviceRelationString( 191 DEVICE_RELATION_TYPE Type 192 ); 193 194 NTSTATUS 195 Bus_FDO_Power ( 196 PFDO_DEVICE_DATA FdoData, 197 PIRP Irp 198 ); 199 200 NTSTATUS 201 Bus_PDO_Power ( 202 PPDO_DEVICE_DATA PdoData, 203 PIRP Irp 204 ); 205 206 NTSTATUS 207 NTAPI 208 Bus_Power ( 209 PDEVICE_OBJECT DeviceObject, 210 PIRP Irp 211 ); 212 213 PCHAR 214 PowerMinorFunctionString ( 215 UCHAR MinorFunction 216 ); 217 218 PCHAR 219 DbgSystemPowerString( 220 SYSTEM_POWER_STATE Type 221 ); 222 223 PCHAR 224 DbgDevicePowerString( 225 DEVICE_POWER_STATE Type 226 ); 227 228 NTSTATUS 229 Bus_PDO_PnP ( 230 PDEVICE_OBJECT DeviceObject, 231 PIRP Irp, 232 PIO_STACK_LOCATION IrpStack, 233 PPDO_DEVICE_DATA DeviceData 234 ); 235 236 NTSTATUS 237 Bus_PDO_QueryDeviceCaps( 238 PPDO_DEVICE_DATA DeviceData, 239 PIRP Irp ); 240 241 NTSTATUS 242 Bus_PDO_QueryDeviceId( 243 PPDO_DEVICE_DATA DeviceData, 244 PIRP Irp ); 245 246 247 NTSTATUS 248 Bus_PDO_QueryDeviceText( 249 PPDO_DEVICE_DATA DeviceData, 250 PIRP Irp ); 251 252 NTSTATUS 253 Bus_PDO_QueryResources( 254 PPDO_DEVICE_DATA DeviceData, 255 PIRP Irp ); 256 257 NTSTATUS 258 Bus_PDO_QueryResourceRequirements( 259 PPDO_DEVICE_DATA DeviceData, 260 PIRP Irp ); 261 262 NTSTATUS 263 Bus_PDO_QueryDeviceRelations( 264 PPDO_DEVICE_DATA DeviceData, 265 PIRP Irp ); 266 267 NTSTATUS 268 Bus_PDO_QueryBusInformation( 269 PPDO_DEVICE_DATA DeviceData, 270 PIRP Irp ); 271 272 NTSTATUS 273 Bus_GetDeviceCapabilities( 274 PDEVICE_OBJECT DeviceObject, 275 PDEVICE_CAPABILITIES DeviceCapabilities 276 ); 277 278 NTSTATUS 279 Bus_PDO_QueryInterface( 280 PPDO_DEVICE_DATA DeviceData, 281 PIRP Irp ); 282 283 BOOLEAN 284 Bus_GetCrispinessLevel( 285 PVOID Context, 286 PUCHAR Level 287 ); 288 BOOLEAN 289 Bus_SetCrispinessLevel( 290 PVOID Context, 291 UCHAR Level 292 ); 293 BOOLEAN 294 Bus_IsSafetyLockEnabled( 295 PVOID Context 296 ); 297 VOID 298 Bus_InterfaceReference ( 299 PVOID Context 300 ); 301 VOID 302 Bus_InterfaceDereference ( 303 PVOID Context 304 ); 305 306 /* EOF */ 307