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