ReactOS 0.4.15-dev-8100-g1887773
acpisys.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _COMMON_DEVICE_DATA
 
struct  _PDO_DEVICE_DATA
 
struct  _FDO_DEVICE_DATA
 
struct  _EVAL_WORKITEM_DATA
 

Macros

#define FDO_FROM_PDO(pdoData)    ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension)
 
#define INITIALIZE_PNP_STATE(_Data_)
 
#define SET_NEW_PNP_STATE(_Data_, _state_)
 
#define RESTORE_PREVIOUS_PNP_STATE(_Data_)    (_Data_).DevicePnPState = (_Data_).PreviousPnPState;\
 

Typedefs

typedef enum _DEVICE_PNP_STATE DEVICE_PNP_STATE
 
typedef struct _COMMON_DEVICE_DATA COMMON_DEVICE_DATA
 
typedef struct _COMMON_DEVICE_DATAPCOMMON_DEVICE_DATA
 
typedef struct _PDO_DEVICE_DATA PDO_DEVICE_DATA
 
typedef struct _PDO_DEVICE_DATAPPDO_DEVICE_DATA
 
typedef struct _FDO_DEVICE_DATA FDO_DEVICE_DATA
 
typedef struct _FDO_DEVICE_DATAPFDO_DEVICE_DATA
 
typedef struct _EVAL_WORKITEM_DATA EVAL_WORKITEM_DATA
 
typedef struct _EVAL_WORKITEM_DATAPEVAL_WORKITEM_DATA
 

Enumerations

enum  _DEVICE_PNP_STATE {
  NotStarted = 0 , Started , StopPending , Stopped ,
  RemovalPending , UnKnown
}
 

Functions

NTSTATUS ACPIEnumerateDevices (PFDO_DEVICE_DATA DeviceExtension)
 
NTSTATUS NTAPI Bus_PDO_EvalMethod (_In_ PPDO_DEVICE_DATA DeviceData, _Inout_ PIRP Irp)
 
NTSTATUS NTAPI Bus_CreateClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
VOID Bus_DriverUnload (PDRIVER_OBJECT DriverObject)
 
PCHAR PnPMinorFunctionString (UCHAR MinorFunction)
 
NTSTATUS Bus_SendIrpSynchronously (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Bus_PnP (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS NTAPI Bus_CompletionRoutine (PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
 
VOID Bus_InitializePdo (PDEVICE_OBJECT Pdo, PFDO_DEVICE_DATA FdoData)
 
void Bus_RemoveFdo (PFDO_DEVICE_DATA FdoData)
 
NTSTATUS Bus_DestroyPdo (PDEVICE_OBJECT Device, PPDO_DEVICE_DATA PdoData)
 
NTSTATUS Bus_FDO_PnP (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpStack, PFDO_DEVICE_DATA DeviceData)
 
NTSTATUS Bus_StartFdo (PFDO_DEVICE_DATA FdoData, PIRP Irp)
 
PCHAR DbgDeviceIDString (BUS_QUERY_ID_TYPE Type)
 
PCHAR DbgDeviceRelationString (DEVICE_RELATION_TYPE Type)
 
NTSTATUS Bus_FDO_Power (PFDO_DEVICE_DATA FdoData, PIRP Irp)
 
NTSTATUS Bus_PDO_Power (PPDO_DEVICE_DATA PdoData, PIRP Irp)
 
NTSTATUS NTAPI Bus_Power (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
PCHAR PowerMinorFunctionString (UCHAR MinorFunction)
 
PCHAR DbgSystemPowerString (SYSTEM_POWER_STATE Type)
 
PCHAR DbgDevicePowerString (DEVICE_POWER_STATE Type)
 
NTSTATUS Bus_PDO_PnP (PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpStack, PPDO_DEVICE_DATA DeviceData)
 
NTSTATUS Bus_PDO_QueryDeviceCaps (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryDeviceId (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryDeviceText (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryResources (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryResourceRequirements (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryDeviceRelations (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_PDO_QueryBusInformation (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS Bus_GetDeviceCapabilities (PDEVICE_OBJECT DeviceObject, PDEVICE_CAPABILITIES DeviceCapabilities)
 
NTSTATUS Bus_PDO_QueryInterface (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
BOOLEAN Bus_GetCrispinessLevel (PVOID Context, PUCHAR Level)
 
BOOLEAN Bus_SetCrispinessLevel (PVOID Context, UCHAR Level)
 
BOOLEAN Bus_IsSafetyLockEnabled (PVOID Context)
 
VOID Bus_InterfaceReference (PVOID Context)
 
VOID Bus_InterfaceDereference (PVOID Context)
 

Variables

UNICODE_STRING ProcessorHardwareIds
 
LPWSTR ProcessorIdString
 
LPWSTR ProcessorNameString
 
WORKER_THREAD_ROUTINE Bus_PDO_EvalMethodWorker
 

Macro Definition Documentation

◆ FDO_FROM_PDO

#define FDO_FROM_PDO (   pdoData)     ((PFDO_DEVICE_DATA) (pdoData)->ParentFdo->DeviceExtension)

Definition at line 83 of file acpisys.h.

◆ INITIALIZE_PNP_STATE

#define INITIALIZE_PNP_STATE (   _Data_)
Value:
(_Data_).DevicePnPState = NotStarted;\
(_Data_).PreviousPnPState = NotStarted;
@ NotStarted
Definition: acpisys.h:13

Definition at line 86 of file acpisys.h.

◆ RESTORE_PREVIOUS_PNP_STATE

#define RESTORE_PREVIOUS_PNP_STATE (   _Data_)     (_Data_).DevicePnPState = (_Data_).PreviousPnPState;\

Definition at line 94 of file acpisys.h.

◆ SET_NEW_PNP_STATE

#define SET_NEW_PNP_STATE (   _Data_,
  _state_ 
)
Value:
(_Data_).PreviousPnPState = (_Data_).DevicePnPState;\
(_Data_).DevicePnPState = (_state_);

Definition at line 90 of file acpisys.h.

Typedef Documentation

◆ COMMON_DEVICE_DATA

◆ DEVICE_PNP_STATE

◆ EVAL_WORKITEM_DATA

◆ FDO_DEVICE_DATA

◆ PCOMMON_DEVICE_DATA

◆ PDO_DEVICE_DATA

◆ PEVAL_WORKITEM_DATA

◆ PFDO_DEVICE_DATA

◆ PPDO_DEVICE_DATA

Enumeration Type Documentation

◆ _DEVICE_PNP_STATE

Enumerator
NotStarted 
Started 
StopPending 
Stopped 
RemovalPending 
UnKnown 

Definition at line 11 of file acpisys.h.

11 {
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
@ Stopped
Definition: acpisys.h:16
@ RemovalPending
Definition: acpisys.h:17
@ StopPending
Definition: acpisys.h:15
@ UnKnown
Definition: acpisys.h:18
@ Started
Definition: acpisys.h:14
enum _DEVICE_PNP_STATE DEVICE_PNP_STATE

Function Documentation

◆ ACPIEnumerateDevices()

NTSTATUS ACPIEnumerateDevices ( PFDO_DEVICE_DATA  DeviceExtension)

Definition at line 146 of file acpienum.c.

147{
148 ULONG Count = 0;
149 struct acpi_device *Device = acpi_root;
150
151 while(Device)
152 {
153 if (Device->status.present && Device->status.enabled &&
154 Device->flags.hardware_id)
155 {
156 Bus_PlugInDevice(Device, DeviceExtension);
157 Count++;
158 }
159
160 if (HAS_CHILDREN(Device)) {
161 Device = NODE_TO_DEVICE(Device->children.next);
162 continue;
163 }
164 if (HAS_SIBLINGS(Device)) {
165 Device = NODE_TO_DEVICE(Device->node.next);
166 continue;
167 }
168 while ((Device = Device->parent)) {
169 if (HAS_SIBLINGS(Device)) {
170 Device = NODE_TO_DEVICE(Device->node.next);
171 break;
172 }
173 }
174 }
175 DPRINT("acpi device count: %d\n", Count);
176 return STATUS_SUCCESS;
177}
struct acpi_device * acpi_root
Definition: bus.c:51
NTSTATUS Bus_PlugInDevice(struct acpi_device *Device, PFDO_DEVICE_DATA FdoData)
Definition: acpienum.c:22
#define NODE_TO_DEVICE(n)
Definition: acpienum.c:17
#define HAS_SIBLINGS(d)
Definition: acpienum.c:16
#define HAS_CHILDREN(d)
Definition: acpienum.c:15
int Count
Definition: noreturn.cpp:7
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

Referenced by Bus_StartFdo().

◆ Bus_CompletionRoutine()

NTSTATUS NTAPI Bus_CompletionRoutine ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PVOID  Context 
)

Definition at line 369 of file pnp.c.

374{
376
377 //
378 // If the lower driver didn't return STATUS_PENDING, we don't need to
379 // set the event because we won't be waiting on it.
380 // This optimization avoids grabbing the dispatcher lock and improves perf.
381 //
382 if (Irp->PendingReturned != FALSE) {
383
385 }
386 return STATUS_MORE_PROCESSING_REQUIRED; // Keep this IRP
387}
_In_ PIRP Irp
Definition: csq.h:116
#define FALSE
Definition: types.h:117
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by Bus_SendIrpSynchronously().

◆ Bus_CreateClose()

NTSTATUS NTAPI Bus_CreateClose ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

◆ Bus_DestroyPdo()

NTSTATUS Bus_DestroyPdo ( PDEVICE_OBJECT  Device,
PPDO_DEVICE_DATA  PdoData 
)

Definition at line 390 of file pnp.c.

394{
395 PAGED_CODE ();
396
397 //
398 // BusEnum does not queue any irps at this time so we have nothing to do.
399 //
400
401 //
402 // Free any resources.
403 //
404
405 if (PdoData->HardwareIDs) {
406 ExFreePoolWithTag(PdoData->HardwareIDs, 'DpcA');
407 PdoData->HardwareIDs = NULL;
408 }
409
410 DPRINT("\tDeleting PDO: 0x%p\n", Device);
412 return STATUS_SUCCESS;
413}
#define PAGED_CODE()
#define NULL
Definition: types.h:112
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PWCHAR HardwareIDs
Definition: acpisys.h:44

◆ Bus_DriverUnload()

VOID Bus_DriverUnload ( PDRIVER_OBJECT  DriverObject)

◆ Bus_FDO_PnP()

NTSTATUS Bus_FDO_PnP ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpStack,
PFDO_DEVICE_DATA  DeviceData 
)

Definition at line 72 of file pnp.c.

78{
80 ULONG length, prevcount, numPdosPresent;
82 PPDO_DEVICE_DATA pdoData;
83 PDEVICE_RELATIONS relations, oldRelations;
84
85 PAGED_CODE ();
86
87 switch (IrpStack->MinorFunction) {
88
90
92
93
94 //
95 // We must now complete the IRP, since we stopped it in the
96 // completion routine with MORE_PROCESSING_REQUIRED.
97 //
98
99 Irp->IoStatus.Status = status;
101
102 return status;
103
105
106 //
107 // The PnP manager is trying to stop the device
108 // for resource rebalancing.
109 //
111 Irp->IoStatus.Status = STATUS_SUCCESS;
112 break;
113
115
116 //
117 // The PnP Manager sends this IRP, at some point after an
118 // IRP_MN_QUERY_STOP_DEVICE, to inform the drivers for a
119 // device that the device will not be stopped for
120 // resource reconfiguration.
121 //
122 //
123 // First check to see whether you have received cancel-stop
124 // without first receiving a query-stop. This could happen if
125 // someone above us fails a query-stop and passes down the subsequent
126 // cancel-stop.
127 //
128
129 if (StopPending == DeviceData->Common.DevicePnPState)
130 {
131 //
132 // We did receive a query-stop, so restore.
133 //
135 ASSERT(DeviceData->Common.DevicePnPState == Started);
136 }
137 Irp->IoStatus.Status = STATUS_SUCCESS; // We must not fail the IRP.
138 break;
139
141
142 DPRINT("\tQueryDeviceRelation Type: %s\n",
144 IrpStack->Parameters.QueryDeviceRelations.Type));
145
146 if (BusRelations != IrpStack->Parameters.QueryDeviceRelations.Type) {
147 //
148 // We don't support any other Device Relations
149 //
150 break;
151 }
152
153
155
156 oldRelations = (PDEVICE_RELATIONS) Irp->IoStatus.Information;
157 if (oldRelations) {
158 prevcount = oldRelations->Count;
159 if (!DeviceData->NumPDOs) {
160 //
161 // There is a device relations struct already present and we have
162 // nothing to add to it, so just call IoSkip and IoCall
163 //
165 break;
166 }
167 }
168 else {
169 prevcount = 0;
170 }
171
172 //
173 // Calculate the number of PDOs actually present on the bus
174 //
175 numPdosPresent = 0;
176 for (entry = DeviceData->ListOfPDOs.Flink;
177 entry != &DeviceData->ListOfPDOs;
178 entry = entry->Flink) {
180 numPdosPresent++;
181 }
182
183 //
184 // Need to allocate a new relations structure and add our
185 // PDOs to it.
186 //
187
188 length = sizeof(DEVICE_RELATIONS) +
189 (((numPdosPresent + prevcount) - 1) * sizeof (PDEVICE_OBJECT));
190
191 relations = ExAllocatePoolWithTag(PagedPool, length, 'IpcA');
192
193 if (NULL == relations) {
194 //
195 // Fail the IRP
196 //
198 Irp->IoStatus.Status = status = STATUS_INSUFFICIENT_RESOURCES;
200 return status;
201
202 }
203
204 //
205 // Copy in the device objects so far
206 //
207 if (prevcount) {
208 RtlCopyMemory (relations->Objects, oldRelations->Objects,
209 prevcount * sizeof (PDEVICE_OBJECT));
210 }
211
212 relations->Count = prevcount + numPdosPresent;
213
214 //
215 // For each PDO present on this bus add a pointer to the device relations
216 // buffer, being sure to take out a reference to that object.
217 // The Plug & Play system will dereference the object when it is done
218 // with it and free the device relations buffer.
219 //
220
221 for (entry = DeviceData->ListOfPDOs.Flink;
222 entry != &DeviceData->ListOfPDOs;
223 entry = entry->Flink) {
224
226 relations->Objects[prevcount] = pdoData->Common.Self;
227 ObReferenceObject (pdoData->Common.Self);
228 prevcount++;
229 }
230
231 DPRINT("\t#PDOs present = %d\n\t#PDOs reported = %d\n",
232 DeviceData->NumPDOs, relations->Count);
233
234 //
235 // Replace the relations structure in the IRP with the new
236 // one.
237 //
238 if (oldRelations) {
239 ExFreePoolWithTag(oldRelations, 0);
240 }
241 Irp->IoStatus.Information = (ULONG_PTR) relations;
242
244
245 //
246 // Set up and pass the IRP further down the stack
247 //
248 Irp->IoStatus.Status = STATUS_SUCCESS;
249 break;
250
251 default:
252
253 //
254 // In the default case we merely call the next driver.
255 // We must not modify Irp->IoStatus.Status or complete the IRP.
256 //
257
258 break;
259 }
260
262 status = IoCallDriver (DeviceData->NextLowerDriver, Irp);
263 return STATUS_SUCCESS;
264}
PCHAR DbgDeviceRelationString(DEVICE_RELATION_TYPE Type)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS Bus_StartFdo(PFDO_DEVICE_DATA FdoData, PIRP Irp)
Definition: pnp.c:267
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define PagedPool
Definition: env_spec_w32.h:308
#define SET_NEW_PNP_STATE(_Data_, _state_)
Definition: fbtusb.h:111
#define RESTORE_PREVIOUS_PNP_STATE(_Data_)
Definition: fbtusb.h:115
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
uint32_t entry
Definition: isohybrid.c:63
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
PDEVICE_OBJECT Self
Definition: acpisys.h:28
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
union _IO_STACK_LOCATION::@1567 Parameters
struct _IO_STACK_LOCATION::@3982::@4007 QueryDeviceRelations
Definition: typedefs.h:120
COMMON_DEVICE_DATA Common
Definition: acpisys.h:38
Definition: ps.c:97
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static int Link(const char **args)
Definition: vfdcmd.c:2414
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define IRP_MN_CANCEL_STOP_DEVICE
@ BusRelations
Definition: iotypes.h:2152
#define IRP_MN_START_DEVICE
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
struct _DEVICE_RELATIONS DEVICE_RELATIONS
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by Bus_PnP().

◆ Bus_FDO_Power()

NTSTATUS Bus_FDO_Power ( PFDO_DEVICE_DATA  FdoData,
PIRP  Irp 
)

Definition at line 49 of file power.c.

53{
55 POWER_STATE powerState;
56 POWER_STATE_TYPE powerType;
58 ULONG AcpiState;
59 ACPI_STATUS AcpiStatus;
60 SYSTEM_POWER_STATE oldPowerState;
61
63 powerType = stack->Parameters.Power.Type;
64 powerState = stack->Parameters.Power.State;
65
66
67 if (stack->MinorFunction == IRP_MN_SET_POWER) {
68 DPRINT("\tRequest to set %s state to %s\n",
69 ((powerType == SystemPowerState) ? "System" : "Device"),
70 ((powerType == SystemPowerState) ? \
73
74 if (powerType == SystemPowerState)
75 {
76 switch (powerState.SystemState) {
78 AcpiState = ACPI_STATE_S1;
79 break;
81 AcpiState = ACPI_STATE_S2;
82 break;
84 AcpiState = ACPI_STATE_S3;
85 break;
87 AcpiState = ACPI_STATE_S4;
88 break;
90 AcpiState = ACPI_STATE_S5;
91 break;
92 default:
93 AcpiState = ACPI_STATE_UNKNOWN;
95 break;
96 }
97 oldPowerState = Data->Common.SystemPowerState;
98 Data->Common.SystemPowerState = powerState.SystemState;
99 AcpiStatus = acpi_suspend(AcpiState);
100 if (!ACPI_SUCCESS(AcpiStatus)) {
101 DPRINT1("Failed to enter sleep state %d (Status 0x%X)\n",
102 AcpiState, AcpiStatus);
103 Data->Common.SystemPowerState = oldPowerState;
105 }
106 }
107 }
110 status = PoCallDriver (Data->NextLowerDriver, Irp);
111 return status;
112}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
PCHAR DbgSystemPowerString(SYSTEM_POWER_STATE Type)
PCHAR DbgDevicePowerString(DEVICE_POWER_STATE Type)
#define ACPI_STATE_S5
Definition: actypes.h:629
#define ACPI_STATE_S2
Definition: actypes.h:626
#define ACPI_STATE_S1
Definition: actypes.h:625
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_STATE_S4
Definition: actypes.h:628
#define ACPI_STATE_UNKNOWN
Definition: actypes.h:622
#define ACPI_STATE_S3
Definition: actypes.h:627
#define DPRINT1
Definition: precomp.h:8
Definition: _stack.h:55
ACPI_STATUS acpi_suspend(UINT32 state)
Definition: system.c:347
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
@ PowerSystemSleeping1
Definition: ntpoapi.h:37
@ PowerSystemSleeping2
Definition: ntpoapi.h:38
@ PowerSystemSleeping3
Definition: ntpoapi.h:39
@ PowerSystemShutdown
Definition: ntpoapi.h:41
@ PowerSystemHibernate
Definition: ntpoapi.h:40
enum _POWER_STATE_TYPE POWER_STATE_TYPE
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
#define IRP_MN_SET_POWER
_In_ SYSTEM_POWER_STATE SystemPowerState
Definition: iotypes.h:7519

Referenced by Bus_Power().

◆ Bus_GetCrispinessLevel()

BOOLEAN Bus_GetCrispinessLevel ( PVOID  Context,
PUCHAR  Level 
)

◆ Bus_GetDeviceCapabilities()

NTSTATUS Bus_GetDeviceCapabilities ( PDEVICE_OBJECT  DeviceObject,
PDEVICE_CAPABILITIES  DeviceCapabilities 
)

Definition at line 1961 of file buspdo.c.

1965{
1966 IO_STATUS_BLOCK ioStatus;
1967 KEVENT pnpEvent;
1969 PDEVICE_OBJECT targetObject;
1970 PIO_STACK_LOCATION irpStack;
1971 PIRP pnpIrp;
1972
1973 PAGED_CODE();
1974
1975 //
1976 // Initialize the capabilities that we will send down
1977 //
1980 DeviceCapabilities->Version = 1;
1981 DeviceCapabilities->Address = -1;
1982 DeviceCapabilities->UINumber = -1;
1983
1984 //
1985 // Initialize the event
1986 //
1988
1990
1991 //
1992 // Build an Irp
1993 //
1995 IRP_MJ_PNP,
1996 targetObject,
1997 NULL,
1998 0,
1999 NULL,
2000 &pnpEvent,
2001 &ioStatus
2002 );
2003 if (pnpIrp == NULL) {
2004
2006 goto GetDeviceCapabilitiesExit;
2007
2008 }
2009
2010 //
2011 // Pnp Irps all begin life as STATUS_NOT_SUPPORTED;
2012 //
2014
2015 //
2016 // Get the top of stack
2017 //
2018 irpStack = IoGetNextIrpStackLocation( pnpIrp );
2019
2020 //
2021 // Set the top of stack
2022 //
2023 RtlZeroMemory( irpStack, sizeof(IO_STACK_LOCATION ) );
2024 irpStack->MajorFunction = IRP_MJ_PNP;
2026 irpStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities;
2027
2028 //
2029 // Call the driver
2030 //
2031 status = IoCallDriver( targetObject, pnpIrp );
2032 if (status == STATUS_PENDING) {
2033
2034 //
2035 // Block until the irp comes back.
2036 // Important thing to note here is when you allocate
2037 // the memory for an event in the stack you must do a
2038 // KernelMode wait instead of UserMode to prevent
2039 // the stack from getting paged out.
2040 //
2041
2043 &pnpEvent,
2044 Executive,
2045 KernelMode,
2046 FALSE,
2047 NULL
2048 );
2049 status = ioStatus.Status;
2050
2051 }
2052
2053GetDeviceCapabilitiesExit:
2054 //
2055 // Done with reference
2056 //
2057 ObDereferenceObject( targetObject );
2058
2059 //
2060 // Done
2061 //
2062 return status;
2063
2064}
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KernelMode
Definition: asm.h:34
@ NotificationEvent
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
struct _IO_STACK_LOCATION::@3982::@4009 DeviceCapabilities
IO_STATUS_BLOCK IoStatus
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define DeviceCapabilities
Definition: wingdi.h:4449
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
DEVICE_CAPABILITIES
Definition: iotypes.h:965
#define IRP_MN_QUERY_CAPABILITIES
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ Bus_InitializePdo()

VOID Bus_InitializePdo ( PDEVICE_OBJECT  Pdo,
PFDO_DEVICE_DATA  FdoData 
)

Definition at line 417 of file pnp.c.

421{
422 PPDO_DEVICE_DATA pdoData;
423 int acpistate;
424 DEVICE_POWER_STATE ntState;
425
426 PAGED_CODE ();
427
428 pdoData = (PPDO_DEVICE_DATA) Pdo->DeviceExtension;
429
430 DPRINT("pdo 0x%p, extension 0x%p\n", Pdo, pdoData);
431
432 if (pdoData->AcpiHandle)
433 acpi_bus_get_power(pdoData->AcpiHandle, &acpistate);
434 else
435 acpistate = ACPI_STATE_D0;
436
437 switch(acpistate)
438 {
439 case ACPI_STATE_D0:
440 ntState = PowerDeviceD0;
441 break;
442 case ACPI_STATE_D1:
443 ntState = PowerDeviceD1;
444 break;
445 case ACPI_STATE_D2:
446 ntState = PowerDeviceD2;
447 break;
448 case ACPI_STATE_D3:
449 ntState = PowerDeviceD3;
450 break;
451 default:
452 DPRINT1("Unknown power state (%d) returned by acpi\n",acpistate);
453 ntState = PowerDeviceUnspecified;
454 break;
455 }
456
457 //
458 // Initialize the rest
459 //
460 pdoData->Common.IsFDO = FALSE;
461 pdoData->Common.Self = Pdo;
462
463 pdoData->ParentFdo = FdoData->Common.Self;
464
465
467
468 pdoData->Common.DevicePowerState = ntState;
470
471 ExAcquireFastMutex (&FdoData->Mutex);
472 InsertTailList(&FdoData->ListOfPDOs, &pdoData->Link);
473 FdoData->NumPDOs++;
474 ExReleaseFastMutex (&FdoData->Mutex);
475
476 // This should be the last step in initialization.
477 Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
478
479}
struct _PDO_DEVICE_DATA * PPDO_DEVICE_DATA
#define ACPI_STATE_D2
Definition: actypes.h:635
#define ACPI_STATE_D0
Definition: actypes.h:633
#define ACPI_STATE_D3
Definition: actypes.h:636
#define ACPI_STATE_D1
Definition: actypes.h:634
int acpi_bus_get_power(ACPI_HANDLE handle, int *state)
Definition: bus.c:198
#define InsertTailList(ListHead, Entry)
#define INITIALIZE_PNP_STATE(_Data_)
Definition: fbtusb.h:107
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceUnspecified
Definition: ntpoapi.h:48
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
SYSTEM_POWER_STATE SystemPowerState
Definition: acpisys.h:32
DEVICE_POWER_STATE DevicePowerState
Definition: acpisys.h:33
COMMON_DEVICE_DATA Common
Definition: acpisys.h:58
FAST_MUTEX Mutex
Definition: acpisys.h:72
LIST_ENTRY ListOfPDOs
Definition: acpisys.h:66
ULONG NumPDOs
Definition: acpisys.h:69
ACPI_HANDLE AcpiHandle
Definition: acpisys.h:39
PDEVICE_OBJECT ParentFdo
Definition: acpisys.h:41
LIST_ENTRY Link
Definition: acpisys.h:46
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
Definition: wdfminiport.h:72

Referenced by Bus_PlugInDevice().

◆ Bus_InterfaceDereference()

VOID Bus_InterfaceDereference ( PVOID  Context)

◆ Bus_InterfaceReference()

VOID Bus_InterfaceReference ( PVOID  Context)

◆ Bus_IsSafetyLockEnabled()

BOOLEAN Bus_IsSafetyLockEnabled ( PVOID  Context)

◆ Bus_PDO_EvalMethod()

NTSTATUS NTAPI Bus_PDO_EvalMethod ( _In_ PPDO_DEVICE_DATA  DeviceData,
_Inout_ PIRP  Irp 
)

Definition at line 796 of file eval.c.

799{
800 PIO_STACK_LOCATION IoStack;
801 PACPI_EVAL_INPUT_BUFFER EvalInputBuffer;
802 ACPI_OBJECT_LIST ParamList;
803 ACPI_STATUS AcpiStatus;
805 ACPI_BUFFER ReturnBuffer = { ACPI_ALLOCATE_BUFFER, NULL };
806
807 PAGED_CODE();
808
810 EvalInputBuffer = Irp->AssociatedIrp.SystemBuffer;
811
812 Status = EvalCreateParametersList(Irp, IoStack, EvalInputBuffer, &ParamList);
813 if (!NT_SUCCESS(Status))
814 return Status;
815
816 AcpiStatus = EvalEvaluateObject(DeviceData, EvalInputBuffer, &ParamList, &ReturnBuffer);
817
818 if (ParamList.Count != 0)
819 EvalFreeParametersList(&ParamList);
820
821 if (!ACPI_SUCCESS(AcpiStatus))
822 {
823 DPRINT("Query method '%.4s' failed on %p with status 0x%04lx\n",
824 EvalInputBuffer->MethodName,
825 DeviceData->AcpiHandle,
826 AcpiStatus);
827
828 return EvalAcpiStatusToNtStatus(AcpiStatus);
829 }
830
831 Status = EvalCreateOutputArguments(Irp, IoStack, &ReturnBuffer);
832
833 if (ReturnBuffer.Pointer)
834 AcpiOsFree(ReturnBuffer.Pointer);
835
836 return Status;
837}
void AcpiOsFree(void *Memory)
Definition: osl.c:167
#define ACPI_ALLOCATE_BUFFER
Definition: actypes.h:1046
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static NTSTATUS EvalCreateOutputArguments(_In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack, _In_ ACPI_BUFFER *ReturnBuffer)
Writes the results from the evaluation into the output IRP buffer.
Definition: eval.c:730
static NTSTATUS EvalCreateParametersList(_In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack, _In_ PACPI_EVAL_INPUT_BUFFER EvalInputBuffer, _Out_ ACPI_OBJECT_LIST *ParamList)
Creates a counted array of ACPI_OBJECTs from the given input buffer.
Definition: eval.c:436
static ACPI_STATUS EvalEvaluateObject(_In_ PPDO_DEVICE_DATA DeviceData, _In_ PACPI_EVAL_INPUT_BUFFER EvalInputBuffer, _In_ ACPI_OBJECT_LIST *ParamList, _In_ ACPI_BUFFER *ReturnBuffer)
Evaluates an ACPI namespace object.
Definition: eval.c:708
static VOID EvalFreeParametersList(_In_ ACPI_OBJECT_LIST *ParamList)
Deallocates the given array of ACPI_OBJECTs.
Definition: eval.c:631
static NTSTATUS EvalAcpiStatusToNtStatus(_In_ ACPI_STATUS AcpiStatus)
Converts the provided value of ACPI_STATUS to NTSTATUS return value.
Definition: eval.c:654
Status
Definition: gdiplustypes.h:25
void * Pointer
Definition: actypes.h:1054

Referenced by ACPIDispatchDeviceControl(), Bus_PDO_EvalMethodWorker(), and DrvCallAcpiDriver().

◆ Bus_PDO_PnP()

NTSTATUS Bus_PDO_PnP ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
PIO_STACK_LOCATION  IrpStack,
PPDO_DEVICE_DATA  DeviceData 
)

Definition at line 23 of file buspdo.c.

29{
32 struct acpi_device *device = NULL;
33
34 PAGED_CODE ();
35
36 if (DeviceData->AcpiHandle)
38
39 //
40 // NB: Because we are a bus enumerator, we have no one to whom we could
41 // defer these irps. Therefore we do not pass them down but merely
42 // return them.
43 //
44
45 switch (IrpStack->MinorFunction) {
46
48 //
49 // Here we do what ever initialization and ``turning on'' that is
50 // required to allow others to access this device.
51 // Power up the device.
52 //
53 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
55 {
56 DPRINT1("Device %x failed to start!\n", DeviceData->AcpiHandle);
58 break;
59 }
60
61 DeviceData->InterfaceName.Length = 0;
63
64 if (!device)
65 {
67 &GUID_DEVICE_SYS_BUTTON,
68 NULL,
69 &DeviceData->InterfaceName);
70 }
71 else if (device->flags.hardware_id &&
72 strstr(device->pnp.hardware_id, ACPI_THERMAL_HID))
73 {
75 &GUID_DEVICE_THERMAL_ZONE,
76 NULL,
77 &DeviceData->InterfaceName);
78 }
79 else if (device->flags.hardware_id &&
80 strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID))
81 {
83 &GUID_DEVICE_LID,
84 NULL,
85 &DeviceData->InterfaceName);
86 }
87 else if (device->flags.hardware_id &&
88 strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))
89 {
91 &GUID_DEVICE_PROCESSOR,
92 NULL,
93 &DeviceData->InterfaceName);
94 }
95
96 /* Failure to register an interface is not a fatal failure so don't return a failure status */
97 if (NT_SUCCESS(status) && DeviceData->InterfaceName.Length != 0)
99
100 state.DeviceState = PowerDeviceD0;
102 DeviceData->Common.DevicePowerState = PowerDeviceD0;
105 break;
106
108
109 if (DeviceData->InterfaceName.Length != 0)
111
112 //
113 // Here we shut down the device and give up and unmap any resources
114 // we acquired for the device.
115 //
116 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
118 {
119 DPRINT1("Device %x failed to stop!\n", DeviceData->AcpiHandle);
121 break;
122 }
123
124 state.DeviceState = PowerDeviceD3;
126 DeviceData->Common.DevicePowerState = PowerDeviceD3;
129 break;
130
131
133
134 //
135 // No reason here why we can't stop the device.
136 // If there were a reason we should speak now, because answering success
137 // here may result in a stop device irp.
138 //
139
142 break;
143
145
146 //
147 // The stop was canceled. Whatever state we set, or resources we put
148 // on hold in anticipation of the forthcoming STOP device IRP should be
149 // put back to normal. Someone, in the long list of concerned parties,
150 // has failed the stop device query.
151 //
152
153 //
154 // First check to see whether you have received cancel-stop
155 // without first receiving a query-stop. This could happen if someone
156 // above us fails a query-stop and passes down the subsequent
157 // cancel-stop.
158 //
159
160 if (StopPending == DeviceData->Common.DevicePnPState)
161 {
162 //
163 // We did receive a query-stop, so restore.
164 //
166 }
167 status = STATUS_SUCCESS;// We must not fail this IRP.
168 break;
169
171 //
172 // We handle REMOVE_DEVICE just like STOP_DEVICE. This is because
173 // the device is still physically present (or at least we don't know any better)
174 // so we have to retain the PDO after stopping and removing power from it.
175 //
176 if (DeviceData->InterfaceName.Length != 0)
178
179 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
181 {
182 DPRINT1("Device %x failed to enter D3!\n", DeviceData->AcpiHandle);
183 state.DeviceState = PowerDeviceD3;
185 DeviceData->Common.DevicePowerState = PowerDeviceD3;
186 }
187
190 break;
191
195 break;
196
198 if (RemovalPending == DeviceData->Common.DevicePnPState)
199 {
201 }
203 break;
204
206
207 //
208 // Return the capabilities of a device, such as whether the device
209 // can be locked or ejected..etc
210 //
211
213
214 break;
215
216 case IRP_MN_QUERY_ID:
217
218 // Query the IDs of the device
220
221 break;
222
224
225 DPRINT("\tQueryDeviceRelation Type: %s\n",DbgDeviceRelationString(\
226 IrpStack->Parameters.QueryDeviceRelations.Type));
227
229
230 break;
231
233
235
236 break;
237
239
241
242 break;
243
245
247
248 break;
249
251
253
254 break;
255
257
259
260 break;
261
262
264
265 //
266 // OPTIONAL for bus drivers.
267 // The PnP Manager sends this IRP to a device
268 // stack so filter and function drivers can adjust the
269 // resources required by the device, if appropriate.
270 //
271
272 //break;
273
274 //case IRP_MN_QUERY_PNP_DEVICE_STATE:
275
276 //
277 // OPTIONAL for bus drivers.
278 // The PnP Manager sends this IRP after the drivers for
279 // a device return success from the IRP_MN_START_DEVICE
280 // request. The PnP Manager also sends this IRP when a
281 // driver for the device calls IoInvalidateDeviceState.
282 //
283
284 // break;
285
286 //case IRP_MN_READ_CONFIG:
287 //case IRP_MN_WRITE_CONFIG:
288
289 //
290 // Bus drivers for buses with configuration space must handle
291 // this request for their child devices. Our devices don't
292 // have a config space.
293 //
294
295 // break;
296
297 //case IRP_MN_SET_LOCK:
298
299 // break;
300
301 default:
302
303 //
304 // For PnP requests to the PDO that we do not understand we should
305 // return the IRP WITHOUT setting the status or information fields.
306 // These fields may have already been set by a filter (eg acpi).
307 status = Irp->IoStatus.Status;
308
309 break;
310 }
311
312 Irp->IoStatus.Status = status;
314
315 return status;
316}
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define ACPI_BUTTON_HID_LID
Definition: acpi_drivers.h:106
#define ACPI_THERMAL_HID
Definition: acpi_drivers.h:266
#define ACPI_PROCESSOR_HID
Definition: acpi_drivers.h:221
NTSTATUS Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: interface.c:94
static int state
Definition: maze.c:121
NTSTATUS Bus_PDO_QueryResources(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:794
NTSTATUS Bus_PDO_QueryDeviceRelations(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1822
NTSTATUS Bus_PDO_QueryDeviceText(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:681
NTSTATUS Bus_PDO_QueryDeviceId(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:433
NTSTATUS Bus_PDO_QueryResourceRequirements(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1301
NTSTATUS Bus_PDO_QueryDeviceCaps(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:319
NTSTATUS Bus_PDO_QueryBusInformation(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1913
#define TRUE
Definition: types.h:120
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
BOOLEAN acpi_bus_power_manageable(ACPI_HANDLE handle)
Definition: bus.c:351
int acpi_bus_set_power(ACPI_HANDLE handle, int state)
Definition: bus.c:249
@ Stopped
Definition: fbtusb.h:81
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:729
@ DevicePowerState
Definition: ntpoapi.h:63
struct acpi_device_status status
Definition: acpi_bus.h:275
Definition: devices.h:37
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_BUS_INFORMATION
#define IRP_MN_QUERY_REMOVE_DEVICE

Referenced by Bus_PnP().

◆ Bus_PDO_Power()

NTSTATUS Bus_PDO_Power ( PPDO_DEVICE_DATA  PdoData,
PIRP  Irp 
)

Definition at line 116 of file power.c.

120{
123 POWER_STATE powerState;
124 POWER_STATE_TYPE powerType;
125 ULONG error;
126
128 powerType = stack->Parameters.Power.Type;
129 powerState = stack->Parameters.Power.State;
130
131 switch (stack->MinorFunction) {
132 case IRP_MN_SET_POWER:
133
134 DPRINT("\tSetting %s power state to %s\n",
135 ((powerType == SystemPowerState) ? "System" : "Device"),
136 ((powerType == SystemPowerState) ? \
137 DbgSystemPowerString(powerState.SystemState) : \
138 DbgDevicePowerString(powerState.DeviceState)));
139
140 switch (powerType) {
141 case DevicePowerState:
142 if (!PdoData->AcpiHandle || !acpi_bus_power_manageable(PdoData->AcpiHandle))
143 {
144 PoSetPowerState(PdoData->Common.Self, DevicePowerState, powerState);
145 PdoData->Common.DevicePowerState = powerState.DeviceState;
147 break;
148 }
149
150 switch (powerState.DeviceState)
151 {
152 case PowerDeviceD0:
154 break;
155
156 case PowerDeviceD1:
158 break;
159
160 case PowerDeviceD2:
162 break;
163
164 case PowerDeviceD3:
166 break;
167
168 default:
169 error = 0;
170 break;
171 }
172
173 if (ACPI_SUCCESS(error))
174 {
175 PoSetPowerState(PdoData->Common.Self, DevicePowerState, powerState);
176 PdoData->Common.DevicePowerState = powerState.DeviceState;
178 }
179 else
181 break;
182
183 case SystemPowerState:
184 PdoData->Common.SystemPowerState = powerState.SystemState;
186 break;
187
188 default:
190 break;
191 }
192 break;
193
196 break;
197
198 case IRP_MN_WAIT_WAKE:
199 //
200 // We cannot support wait-wake because we are root-enumerated
201 // driver, and our parent, the PnP manager, doesn't support wait-wake.
202 //
204 default:
206 break;
207 }
208
210
211 Irp->IoStatus.Status = status;
212 }
213
215 status = Irp->IoStatus.Status;
217
218 return status;
219}
#define error(str)
Definition: mkdosfs.c:1605
#define IRP_MN_WAIT_WAKE
#define IRP_MN_POWER_SEQUENCE
#define IRP_MN_QUERY_POWER

Referenced by Bus_Power().

◆ Bus_PDO_QueryBusInformation()

NTSTATUS Bus_PDO_QueryBusInformation ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1913 of file buspdo.c.

1934{
1935
1936 PPNP_BUS_INFORMATION busInfo;
1937
1938 PAGED_CODE ();
1939
1941 sizeof(PNP_BUS_INFORMATION),
1942 'IpcA');
1943
1944 if (busInfo == NULL) {
1946 }
1947
1948 busInfo->BusTypeGuid = GUID_ACPI_INTERFACE_STANDARD;
1949
1951
1952 busInfo->BusNumber = 0; //fixme
1953
1954 Irp->IoStatus.Information = (ULONG_PTR)busInfo;
1955
1956 return STATUS_SUCCESS;
1957}
@ InternalPowerBus
Definition: hwresource.cpp:150
INTERFACE_TYPE LegacyBusType
Definition: cmtypes.h:365

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceCaps()

NTSTATUS Bus_PDO_QueryDeviceCaps ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 319 of file buspdo.c.

322{
323
325 PDEVICE_CAPABILITIES deviceCapabilities;
326 struct acpi_device *device = NULL;
327 ULONG i;
328
329 PAGED_CODE ();
330
331 if (DeviceData->AcpiHandle)
333
335
336 //
337 // Get the packet.
338 //
339 deviceCapabilities=stack->Parameters.DeviceCapabilities.Capabilities;
340
341 //
342 // Set the capabilities.
343 //
344
345 if (deviceCapabilities->Version != 1 ||
346 deviceCapabilities->Size < sizeof(DEVICE_CAPABILITIES))
347 {
348 return STATUS_UNSUCCESSFUL;
349 }
350
351 deviceCapabilities->D1Latency = 0;
352 deviceCapabilities->D2Latency = 0;
353 deviceCapabilities->D3Latency = 0;
354
355 deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
356 deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD3;
357 deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD3;
358 deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
359
360 for (i = 0; i < ACPI_D_STATE_COUNT && device; i++)
361 {
362 if (!device->power.states[i].flags.valid)
363 continue;
364
365 switch (i)
366 {
367 case ACPI_STATE_D0:
368 deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
369 break;
370
371 case ACPI_STATE_D1:
372 deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD1;
373 deviceCapabilities->D1Latency = device->power.states[i].latency;
374 break;
375
376 case ACPI_STATE_D2:
377 deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD2;
378 deviceCapabilities->D2Latency = device->power.states[i].latency;
379 break;
380
381 case ACPI_STATE_D3:
382 deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
383 deviceCapabilities->D3Latency = device->power.states[i].latency;
384 break;
385 }
386 }
387
388 // We can wake the system from D1
389 deviceCapabilities->DeviceWake = PowerDeviceD1;
390
391
392 deviceCapabilities->DeviceD1 =
393 (deviceCapabilities->DeviceState[PowerSystemSleeping1] == PowerDeviceD1) ? TRUE : FALSE;
394 deviceCapabilities->DeviceD2 =
395 (deviceCapabilities->DeviceState[PowerSystemSleeping2] == PowerDeviceD2) ? TRUE : FALSE;
396
397 deviceCapabilities->WakeFromD0 = FALSE;
398 deviceCapabilities->WakeFromD1 = TRUE; //Yes we can
399 deviceCapabilities->WakeFromD2 = FALSE;
400 deviceCapabilities->WakeFromD3 = FALSE;
401
402 if (device)
403 {
404 deviceCapabilities->LockSupported = device->flags.lockable;
405 deviceCapabilities->EjectSupported = device->flags.ejectable;
406 deviceCapabilities->HardwareDisabled = !device->status.enabled && !device->status.functional;
407 deviceCapabilities->Removable = device->flags.removable;
408 deviceCapabilities->SurpriseRemovalOK = device->flags.surprise_removal_ok;
409 deviceCapabilities->UniqueID = device->flags.unique_id;
410 deviceCapabilities->NoDisplayInUI = !device->status.show_in_ui;
411 deviceCapabilities->Address = device->pnp.bus_address;
412 }
413
414 if (!device ||
415 (device->flags.hardware_id &&
416 (strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID) ||
417 strstr(device->pnp.hardware_id, ACPI_THERMAL_HID) ||
418 strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))))
419 {
420 /* Allow ACPI to control the device if it is a lid button,
421 * a thermal zone, a processor, or a fixed feature button */
422 deviceCapabilities->RawDeviceOK = TRUE;
423 }
424
425 deviceCapabilities->SilentInstall = FALSE;
426 deviceCapabilities->UINumber = (ULONG)-1;
427
428 return STATUS_SUCCESS;
429
430}
#define ACPI_D_STATE_COUNT
Definition: actypes.h:638
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ PowerSystemWorking
Definition: ntpoapi.h:36
bool removable
Definition: btrfs_drv.h:528
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceId()

NTSTATUS Bus_PDO_QueryDeviceId ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 433 of file buspdo.c.

436{
439 WCHAR temp[256];
440 ULONG length, i;
442 struct acpi_device *Device;
443
444 PAGED_CODE ();
445
447
448 switch (stack->Parameters.QueryId.IdType) {
449
450 case BusQueryDeviceID:
451
452 /* This is a REG_SZ value */
453
454 if (DeviceData->AcpiHandle)
455 {
457
458 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
459 {
462 }
463 else
464 {
466 L"ACPI\\%hs",
467 Device->pnp.hardware_id);
468 }
469 }
470 else
471 {
472 /* We know it's a fixed feature button because
473 * these are direct children of the ACPI root device
474 * and therefore have no handle
475 */
477 L"ACPI\\FixedButton");
478 }
479
481
482 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
483
484 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
485
486 if (!buffer) {
488 break;
489 }
490
491 RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
492 Irp->IoStatus.Information = (ULONG_PTR) buffer;
493 DPRINT("BusQueryDeviceID: %ls\n",buffer);
494 break;
495
497
498 /* This is a REG_SZ value */
499
500 /* See comment in BusQueryDeviceID case */
501 if(DeviceData->AcpiHandle)
502 {
504
505 if (Device->flags.unique_id)
507 L"%hs",
508 Device->pnp.unique_id);
509 else
510 /* FIXME: Generate unique id! */
511 length = swprintf(temp, L"%ls", L"0");
512 }
513 else
514 {
515 /* FIXME: Generate unique id! */
516 length = swprintf(temp, L"%ls", L"0");
517 }
518
520
521 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
522
523 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
524 if (!buffer) {
526 break;
527 }
528
529 RtlCopyMemory (buffer, temp, length * sizeof (WCHAR));
530 DPRINT("BusQueryInstanceID: %ls\n",buffer);
531 Irp->IoStatus.Information = (ULONG_PTR) buffer;
532 break;
533
535
536 /* This is a REG_MULTI_SZ value */
537 length = 0;
539
540 /* See comment in BusQueryDeviceID case */
541 if (DeviceData->AcpiHandle)
542 {
544
545 if (!Device->flags.hardware_id)
546 {
547 /* We don't have the ID to satisfy this request */
548 break;
549 }
550
551 DPRINT("Device name: %s\n", Device->pnp.device_name);
552 DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
553
554 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
555 {
558 }
559 else
560 {
562 L"ACPI\\%hs",
563 Device->pnp.hardware_id);
565
567 L"*%hs",
568 Device->pnp.hardware_id);
571 src = temp;
572 }
573 }
574 else
575 {
577 L"ACPI\\FixedButton");
579
581 L"*FixedButton");
584 src = temp;
585 }
586
587 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
588
589 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
590
591 if (!buffer) {
593 break;
594 }
595
596 RtlCopyMemory (buffer, src, length * sizeof(WCHAR));
597 Irp->IoStatus.Information = (ULONG_PTR) buffer;
598 DPRINT("BusQueryHardwareIDs: %ls\n",buffer);
600 break;
601
603
604 /* This is a REG_MULTI_SZ value */
605 length = 0;
607
608 /* See comment in BusQueryDeviceID case */
609 if (DeviceData->AcpiHandle)
610 {
612
613 if (!Device->flags.hardware_id)
614 {
615 /* We don't have the ID to satisfy this request */
616 break;
617 }
618
619 DPRINT("Device name: %s\n", Device->pnp.device_name);
620 DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
621
622 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
623 {
625 L"ACPI\\%hs",
626 Device->pnp.hardware_id);
628
630 L"*%hs",
631 Device->pnp.hardware_id);
634 }
635 else if (Device->flags.compatible_ids)
636 {
637 for (i = 0; i < Device->pnp.cid_list->Count; i++)
638 {
640 L"ACPI\\%hs",
641 Device->pnp.cid_list->Ids[i].String);
643
645 L"*%hs",
646 Device->pnp.cid_list->Ids[i].String);
648 }
649
651 }
652 else
653 {
654 /* No compatible IDs */
655 break;
656 }
657
658 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
659
660 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
661 if (!buffer)
662 {
664 break;
665 }
666
667 RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
668 Irp->IoStatus.Information = (ULONG_PTR) buffer;
669 DPRINT("BusQueryCompatibleIDs: %ls\n",buffer);
671 }
672 break;
673
674 default:
675 status = Irp->IoStatus.Status;
676 }
677 return status;
678}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
LPWSTR ProcessorIdString
Definition: main.c:18
UNICODE_STRING ProcessorHardwareIds
Definition: main.c:17
#define swprintf
Definition: precomp.h:40
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
static calc_node_t temp
Definition: rpn_ieee.c:38
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
uint16_t * PWCHAR
Definition: typedefs.h:56
@ BusQueryCompatibleIDs
Definition: iotypes.h:2938
@ BusQueryInstanceID
Definition: iotypes.h:2939
@ BusQueryDeviceID
Definition: iotypes.h:2936
@ BusQueryHardwareIDs
Definition: iotypes.h:2937
#define NT_ASSERT
Definition: rtlfuncs.h:3310
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceRelations()

NTSTATUS Bus_PDO_QueryDeviceRelations ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1822 of file buspdo.c.

1856{
1857
1859 PDEVICE_RELATIONS deviceRelations;
1861
1862 PAGED_CODE ();
1863
1865
1866 switch (stack->Parameters.QueryDeviceRelations.Type) {
1867
1869
1870 deviceRelations = (PDEVICE_RELATIONS) Irp->IoStatus.Information;
1871 if (deviceRelations) {
1872 //
1873 // Only PDO can handle this request. Somebody above
1874 // is not playing by rule.
1875 //
1876 ASSERTMSG("Someone above is handling TargetDeviceRelation\n", !deviceRelations);
1877 }
1878
1879 deviceRelations = ExAllocatePoolWithTag(PagedPool,
1880 sizeof(DEVICE_RELATIONS),
1881 'IpcA');
1882 if (!deviceRelations) {
1884 break;
1885 }
1886
1887 //
1888 // There is only one PDO pointer in the structure
1889 // for this relation type. The PnP Manager removes
1890 // the reference to the PDO when the driver or application
1891 // un-registers for notification on the device.
1892 //
1893
1894 deviceRelations->Count = 1;
1895 deviceRelations->Objects[0] = DeviceData->Common.Self;
1896 ObReferenceObject(DeviceData->Common.Self);
1897
1899 Irp->IoStatus.Information = (ULONG_PTR) deviceRelations;
1900 break;
1901
1902 case BusRelations: // Not handled by PDO
1903 case EjectionRelations: // optional for PDO
1904 case RemovalRelations: // // optional for PDO
1905 default:
1906 status = Irp->IoStatus.Status;
1907 }
1908
1909 return status;
1910}
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
@ EjectionRelations
Definition: iotypes.h:2153
@ RemovalRelations
Definition: iotypes.h:2155
@ TargetDeviceRelation
Definition: iotypes.h:2156

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceText()

NTSTATUS Bus_PDO_QueryDeviceText ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 681 of file buspdo.c.

684{
685 PWCHAR Buffer, Temp;
687 NTSTATUS status = Irp->IoStatus.Status;
688 PAGED_CODE ();
689
691
692 switch (stack->Parameters.QueryDeviceText.DeviceTextType) {
693
695
696 if (!Irp->IoStatus.Information) {
697 if (wcsstr (DeviceData->HardwareIDs, L"PNP000") != 0)
698 Temp = L"Programmable interrupt controller";
699 else if (wcsstr(DeviceData->HardwareIDs, L"PNP010") != 0)
700 Temp = L"System timer";
701 else if (wcsstr(DeviceData->HardwareIDs, L"PNP020") != 0)
702 Temp = L"DMA controller";
703 else if (wcsstr(DeviceData->HardwareIDs, L"PNP03") != 0)
704 Temp = L"Keyboard";
705 else if (wcsstr(DeviceData->HardwareIDs, L"PNP040") != 0)
706 Temp = L"Parallel port";
707 else if (wcsstr(DeviceData->HardwareIDs, L"PNP05") != 0)
708 Temp = L"Serial port";
709 else if (wcsstr(DeviceData->HardwareIDs, L"PNP06") != 0)
710 Temp = L"Disk controller";
711 else if (wcsstr(DeviceData->HardwareIDs, L"PNP07") != 0)
712 Temp = L"Disk controller";
713 else if (wcsstr(DeviceData->HardwareIDs, L"PNP09") != 0)
714 Temp = L"Display adapter";
715 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A0") != 0)
716 Temp = L"Bus controller";
717 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0E0") != 0)
718 Temp = L"PCMCIA controller";
719 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0F") != 0)
720 Temp = L"Mouse device";
721 else if (wcsstr(DeviceData->HardwareIDs, L"PNP8") != 0)
722 Temp = L"Network adapter";
723 else if (wcsstr(DeviceData->HardwareIDs, L"PNPA0") != 0)
724 Temp = L"SCSI controller";
725 else if (wcsstr(DeviceData->HardwareIDs, L"PNPB0") != 0)
726 Temp = L"Multimedia device";
727 else if (wcsstr(DeviceData->HardwareIDs, L"PNPC00") != 0)
728 Temp = L"Modem";
729 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0C") != 0)
730 Temp = L"Power Button";
731 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0E") != 0)
732 Temp = L"Sleep Button";
733 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0D") != 0)
734 Temp = L"Lid Switch";
735 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C09") != 0)
736 Temp = L"ACPI Embedded Controller";
737 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0B") != 0)
738 Temp = L"ACPI Fan";
739 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
740 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
741 Temp = L"PCI Root Bridge";
742 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0A") != 0)
743 Temp = L"ACPI Battery";
744 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0F") != 0)
745 Temp = L"PCI Interrupt Link";
746 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI_PWR") != 0)
747 Temp = L"ACPI Power Resource";
748 else if (wcsstr(DeviceData->HardwareIDs, L"Processor") != 0)
749 {
751 Temp = ProcessorNameString;
752 else
753 Temp = L"Processor";
754 }
755 else if (wcsstr(DeviceData->HardwareIDs, L"ThermalZone") != 0)
756 Temp = L"ACPI Thermal Zone";
757 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0002") != 0)
758 Temp = L"Smart Battery";
759 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0003") != 0)
760 Temp = L"AC Adapter";
761 /* Simply checking if AcpiHandle is NULL eliminates the need to check
762 * for the 4 different names that ACPI knows the fixed feature button as internally
763 */
764 else if (!DeviceData->AcpiHandle)
765 Temp = L"ACPI Fixed Feature Button";
766 else
767 Temp = L"Other ACPI device";
768
769 Buffer = ExAllocatePoolWithTag(PagedPool, (wcslen(Temp) + 1) * sizeof(WCHAR), 'IpcA');
770
771 if (!Buffer) {
773 break;
774 }
775
776 RtlCopyMemory (Buffer, Temp, (wcslen(Temp) + 1) * sizeof(WCHAR));
777
778 DPRINT("\tDeviceTextDescription :%ws\n", Buffer);
779
780 Irp->IoStatus.Information = (ULONG_PTR) Buffer;
782 }
783 break;
784
785 default:
786 break;
787 }
788
789 return status;
790
791}
LPWSTR ProcessorNameString
Definition: main.c:19
Definition: bufpool.h:45
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
@ DeviceTextDescription
Definition: iotypes.h:2945

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryInterface()

NTSTATUS Bus_PDO_QueryInterface ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 94 of file interface.c.

96{
98 PACPI_INTERFACE_STANDARD AcpiInterface;
99
100 if (IrpSp->Parameters.QueryInterface.Version != 1)
101 {
102 DPRINT1("Invalid version number: %d\n",
105 }
106
108 &GUID_ACPI_INTERFACE_STANDARD, sizeof(GUID)) == sizeof(GUID))
109 {
110 DPRINT("GUID_ACPI_INTERFACE_STANDARD\n");
111
113 {
114 DPRINT1("Buffer too small! (%d)\n", IrpSp->Parameters.QueryInterface.Size);
116 }
117
118 AcpiInterface = (PACPI_INTERFACE_STANDARD)IrpSp->Parameters.QueryInterface.Interface;
119
129
130 return STATUS_SUCCESS;
131 }
132 else
133 {
134 DPRINT1("Invalid GUID\n");
136 }
137}
VOID NTAPI AcpiInterfaceReference(PVOID Context)
Definition: interface.c:8
NTSTATUS NTAPI AcpiInterfaceNotificationsRegister(PDEVICE_OBJECT Context, PDEVICE_NOTIFY_CALLBACK NotificationHandler, PVOID NotificationContext)
Definition: interface.c:76
NTSTATUS NTAPI AcpiInterfaceClearStatus(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:66
VOID NTAPI AcpiInterfaceDereference(PVOID Context)
Definition: interface.c:15
NTSTATUS NTAPI AcpiInterfaceEnableEvent(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:46
NTSTATUS NTAPI AcpiInterfaceDisableEvent(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:56
VOID NTAPI AcpiInterfaceNotificationsUnregister(PDEVICE_OBJECT Context, PDEVICE_NOTIFY_CALLBACK NotificationHandler)
Definition: interface.c:87
NTSTATUS NTAPI AcpiInterfaceDisconnectVector(PVOID ObjectContext)
Definition: interface.c:37
NTSTATUS NTAPI AcpiInterfaceConnectVector(PDEVICE_OBJECT Context, ULONG GpeNumber, KINTERRUPT_MODE Mode, BOOLEAN Shareable, PGPE_SERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext, PVOID ObjectContext)
Definition: interface.c:22
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications
Definition: iotypes.h:3024
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:3017
PGPE_CLEAR_STATUS GpeClearStatus
Definition: iotypes.h:3022
PGPE_ENABLE_EVENT GpeEnableEvent
Definition: iotypes.h:3020
PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications
Definition: iotypes.h:3023
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:3016
PGPE_DISCONNECT_VECTOR GpeDisconnectVector
Definition: iotypes.h:3019
PGPE_DISABLE_EVENT GpeDisableEvent
Definition: iotypes.h:3021
PGPE_CONNECT_VECTOR GpeConnectVector
Definition: iotypes.h:3018
struct _IO_STACK_LOCATION::@3982::@4008 QueryInterface
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _ACPI_INTERFACE_STANDARD * PACPI_INTERFACE_STANDARD

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryResourceRequirements()

NTSTATUS Bus_PDO_QueryResourceRequirements ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1301 of file buspdo.c.

1304{
1305 ULONG NumberOfResources = 0;
1306 ACPI_STATUS AcpiStatus;
1309 ULONG i, RequirementsListSize;
1311 PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
1312 BOOLEAN CurrentRes = FALSE;
1313 BOOLEAN SeenStartDependent;
1314
1315 PAGED_CODE ();
1316
1317 if (!DeviceData->AcpiHandle)
1318 {
1319 return Irp->IoStatus.Status;
1320 }
1321
1322 /* Handle the PCI root manually */
1323 if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
1324 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
1325 {
1326 return Irp->IoStatus.Status;
1327 }
1328
1329 /* Get current resources */
1330 while (TRUE)
1331 {
1332 Buffer.Length = 0;
1333 if (CurrentRes)
1334 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1335 else
1336 AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1337 if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
1338 Buffer.Length == 0)
1339 {
1340 if (!CurrentRes)
1341 CurrentRes = TRUE;
1342 else
1343 return Irp->IoStatus.Status;
1344 }
1345 else
1346 break;
1347 }
1348
1349 Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
1350 if (!Buffer.Pointer)
1352
1353 if (CurrentRes)
1354 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1355 else
1356 AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1357 if (!ACPI_SUCCESS(AcpiStatus))
1358 {
1359 DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
1360 ASSERT(FALSE);
1361 return STATUS_UNSUCCESSFUL;
1362 }
1363
1364 SeenStartDependent = FALSE;
1365 resource = Buffer.Pointer;
1366 /* Count number of resources */
1368 {
1370 {
1371 if (SeenStartDependent)
1372 {
1373 break;
1374 }
1375 SeenStartDependent = TRUE;
1376 }
1377 switch (resource->Type)
1378 {
1380 {
1382 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1383 break;
1384 NumberOfResources += irq_data->InterruptCount;
1385 break;
1386 }
1388 {
1389 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
1390 NumberOfResources += irq_data->InterruptCount;
1391 break;
1392 }
1394 {
1395 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1396 NumberOfResources += dma_data->ChannelCount;
1397 break;
1398 }
1403 {
1405 if (res_addr->ProducerConsumer == ACPI_PRODUCER)
1406 break;
1407 NumberOfResources++;
1408 break;
1409 }
1415 {
1416 NumberOfResources++;
1417 break;
1418 }
1419 default:
1420 {
1421 break;
1422 }
1423 }
1425 }
1426
1427 RequirementsListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
1428 RequirementsList = ExAllocatePoolWithTag(PagedPool, RequirementsListSize, 'RpcA');
1429
1430 if (!RequirementsList)
1431 {
1432 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1434 }
1435 RequirementsList->ListSize = RequirementsListSize;
1436 RequirementsList->InterfaceType = Internal;
1437 RequirementsList->BusNumber = 0;
1438 RequirementsList->SlotNumber = 0; /* Not used by WDM drivers */
1439 RequirementsList->AlternativeLists = 1;
1440 RequirementsList->List[0].Version = 1;
1441 RequirementsList->List[0].Revision = 1;
1442 RequirementsList->List[0].Count = NumberOfResources;
1443 RequirementDescriptor = RequirementsList->List[0].Descriptors;
1444
1445 /* Fill resources list structure */
1446 SeenStartDependent = FALSE;
1447 resource = Buffer.Pointer;
1449 {
1451 {
1452 if (SeenStartDependent)
1453 {
1454 break;
1455 }
1456 SeenStartDependent = TRUE;
1457 }
1458 switch (resource->Type)
1459 {
1461 {
1462 ACPI_RESOURCE_EXTENDED_IRQ *irq_data = &resource->Data.ExtendedIrq;
1463 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1464 break;
1465 for (i = 0; i < irq_data->InterruptCount; i++)
1466 {
1467 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1468 RequirementDescriptor->Type = CmResourceTypeInterrupt;
1471 RequirementDescriptor->u.Interrupt.MinimumVector =
1472 RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1473
1474 RequirementDescriptor++;
1475 }
1476 break;
1477 }
1479 {
1480 ACPI_RESOURCE_IRQ *irq_data = &resource->Data.Irq;
1481 for (i = 0; i < irq_data->InterruptCount; i++)
1482 {
1483 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1484 RequirementDescriptor->Type = CmResourceTypeInterrupt;
1487 RequirementDescriptor->u.Interrupt.MinimumVector =
1488 RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1489
1490 RequirementDescriptor++;
1491 }
1492 break;
1493 }
1495 {
1496 ACPI_RESOURCE_DMA *dma_data = &resource->Data.Dma;
1497 for (i = 0; i < dma_data->ChannelCount; i++)
1498 {
1499 RequirementDescriptor->Type = CmResourceTypeDma;
1500 RequirementDescriptor->Flags = 0;
1501 switch (dma_data->Type)
1502 {
1503 case ACPI_TYPE_A: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1504 case ACPI_TYPE_B: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1505 case ACPI_TYPE_F: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1506 }
1507 if (dma_data->BusMaster == ACPI_BUS_MASTER)
1508 RequirementDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1509 switch (dma_data->Transfer)
1510 {
1511 case ACPI_TRANSFER_8: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1512 case ACPI_TRANSFER_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1513 case ACPI_TRANSFER_8_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1514 }
1515
1516 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1517 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1518 RequirementDescriptor->u.Dma.MinimumChannel =
1519 RequirementDescriptor->u.Dma.MaximumChannel = dma_data->Channels[i];
1520 RequirementDescriptor++;
1521 }
1522 break;
1523 }
1525 {
1526 ACPI_RESOURCE_IO *io_data = &resource->Data.Io;
1527 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1528 if (io_data->IoDecode == ACPI_DECODE_16)
1529 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1530 else
1531 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1532 RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1533 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1534 RequirementDescriptor->Type = CmResourceTypePort;
1535 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1536 RequirementDescriptor->u.Port.Alignment = io_data->Alignment;
1537 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Minimum;
1538 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum + io_data->AddressLength - 1;
1539
1540 RequirementDescriptor++;
1541 break;
1542 }
1544 {
1545 ACPI_RESOURCE_FIXED_IO *io_data = &resource->Data.FixedIo;
1546 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1547 RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1548 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1549 RequirementDescriptor->Type = CmResourceTypePort;
1550 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1551 RequirementDescriptor->u.Port.Alignment = 1;
1552 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Address;
1553 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Address + io_data->AddressLength - 1;
1554
1555 RequirementDescriptor++;
1556 break;
1557 }
1559 {
1560 ACPI_RESOURCE_ADDRESS16 *addr16_data = &resource->Data.Address16;
1561 if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1562 break;
1563 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1564 if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1565 {
1566 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1567 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1568 RequirementDescriptor->Flags = 0;
1569 RequirementDescriptor->u.BusNumber.MinBusNumber = addr16_data->Address.Minimum;
1570 RequirementDescriptor->u.BusNumber.MaxBusNumber = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1571 RequirementDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1572 }
1573 else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1574 {
1575 RequirementDescriptor->Type = CmResourceTypePort;
1576 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1577 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1578 if (addr16_data->Decode == ACPI_POS_DECODE)
1579 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1580 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1581 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1582 RequirementDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1583 }
1584 else
1585 {
1586 RequirementDescriptor->Type = CmResourceTypeMemory;
1587 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1588 RequirementDescriptor->Flags = 0;
1589 if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1590 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1591 else
1592 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1593 switch (addr16_data->Info.Mem.Caching)
1594 {
1595 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1596 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1597 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1598 }
1599 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1600 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1601 RequirementDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1602 }
1603 RequirementDescriptor++;
1604 break;
1605 }
1607 {
1608 ACPI_RESOURCE_ADDRESS32 *addr32_data = &resource->Data.Address32;
1609 if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1610 break;
1611 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1612 if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1613 {
1614 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1615 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1616 RequirementDescriptor->Flags = 0;
1617 RequirementDescriptor->u.BusNumber.MinBusNumber = addr32_data->Address.Minimum;
1618 RequirementDescriptor->u.BusNumber.MaxBusNumber = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1619 RequirementDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1620 }
1621 else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1622 {
1623 RequirementDescriptor->Type = CmResourceTypePort;
1624 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1625 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1626 if (addr32_data->Decode == ACPI_POS_DECODE)
1627 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1628 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1629 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1630 RequirementDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1631 }
1632 else
1633 {
1634 RequirementDescriptor->Type = CmResourceTypeMemory;
1635 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1636 RequirementDescriptor->Flags = 0;
1637 if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1638 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1639 else
1640 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1641 switch (addr32_data->Info.Mem.Caching)
1642 {
1643 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1644 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1645 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1646 }
1647 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1648 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1649 RequirementDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1650 }
1651 RequirementDescriptor++;
1652 break;
1653 }
1655 {
1656 ACPI_RESOURCE_ADDRESS64 *addr64_data = &resource->Data.Address64;
1657 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1658 break;
1659 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1660 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1661 {
1662 DPRINT1("64-bit bus address is not supported!\n");
1663 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1664 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1665 RequirementDescriptor->Flags = 0;
1666 RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1667 RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1668 RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1669 }
1670 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1671 {
1672 RequirementDescriptor->Type = CmResourceTypePort;
1673 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1674 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1675 if (addr64_data->Decode == ACPI_POS_DECODE)
1676 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1677 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1678 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1679 RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1680 }
1681 else
1682 {
1683 RequirementDescriptor->Type = CmResourceTypeMemory;
1684 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1685 RequirementDescriptor->Flags = 0;
1686 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1687 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1688 else
1689 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1690 switch (addr64_data->Info.Mem.Caching)
1691 {
1692 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1693 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1694 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1695 }
1696 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1697 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1698 RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1699 }
1700 RequirementDescriptor++;
1701 break;
1702 }
1704 {
1705 ACPI_RESOURCE_EXTENDED_ADDRESS64 *addr64_data = &resource->Data.ExtAddress64;
1706 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1707 break;
1708 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1709 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1710 {
1711 DPRINT1("64-bit bus address is not supported!\n");
1712 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1713 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1714 RequirementDescriptor->Flags = 0;
1715 RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1716 RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1717 RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1718 }
1719 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1720 {
1721 RequirementDescriptor->Type = CmResourceTypePort;
1722 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1723 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1724 if (addr64_data->Decode == ACPI_POS_DECODE)
1725 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1726 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1727 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1728 RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1729 }
1730 else
1731 {
1732 RequirementDescriptor->Type = CmResourceTypeMemory;
1733 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1734 RequirementDescriptor->Flags = 0;
1735 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1736 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1737 else
1738 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1739 switch (addr64_data->Info.Mem.Caching)
1740 {
1741 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1742 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1743 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1744 }
1745 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1746 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1747 RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1748 }
1749 RequirementDescriptor++;
1750 break;
1751 }
1753 {
1754 ACPI_RESOURCE_MEMORY24 *mem24_data = &resource->Data.Memory24;
1755 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1756 RequirementDescriptor->Type = CmResourceTypeMemory;
1757 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1758 RequirementDescriptor->Flags = CM_RESOURCE_MEMORY_24;
1759 if (mem24_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1760 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1761 else
1762 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1763 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem24_data->Minimum;
1764 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem24_data->Maximum + mem24_data->AddressLength - 1;
1765 RequirementDescriptor->u.Memory.Length = mem24_data->AddressLength;
1766
1767 RequirementDescriptor++;
1768 break;
1769 }
1771 {
1772 ACPI_RESOURCE_MEMORY32 *mem32_data = &resource->Data.Memory32;
1773 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1774 RequirementDescriptor->Type = CmResourceTypeMemory;
1775 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1776 RequirementDescriptor->Flags = 0;
1777 if (mem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1778 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1779 else
1780 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1781 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem32_data->Minimum;
1782 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem32_data->Maximum + mem32_data->AddressLength - 1;
1783 RequirementDescriptor->u.Memory.Length = mem32_data->AddressLength;
1784
1785 RequirementDescriptor++;
1786 break;
1787 }
1789 {
1790 ACPI_RESOURCE_FIXED_MEMORY32 *fixedmem32_data = &resource->Data.FixedMemory32;
1791 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1792 RequirementDescriptor->Type = CmResourceTypeMemory;
1793 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1794 RequirementDescriptor->Flags = 0;
1795 if (fixedmem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1796 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1797 else
1798 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1799 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = fixedmem32_data->Address;
1800 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = fixedmem32_data->Address + fixedmem32_data->AddressLength - 1;
1801 RequirementDescriptor->u.Memory.Length = fixedmem32_data->AddressLength;
1802
1803 RequirementDescriptor++;
1804 break;
1805 }
1806 default:
1807 {
1808 break;
1809 }
1810 }
1812 }
1813 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1814
1815 Irp->IoStatus.Information = (ULONG_PTR)RequirementsList;
1816
1817 return STATUS_SUCCESS;
1818}
unsigned char BOOLEAN
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define ACPI_RESOURCE_TYPE_MEMORY32
Definition: acrestyp.h:732
#define ACPI_CACHABLE_MEMORY
Definition: acrestyp.h:61
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:812
#define ACPI_DECODE_16
Definition: acrestyp.h:85
#define ACPI_RESOURCE_TYPE_DMA
Definition: acrestyp.h:724
#define ACPI_RESOURCE_TYPE_MEMORY24
Definition: acrestyp.h:731
#define ACPI_READ_ONLY_MEMORY
Definition: acrestyp.h:57
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ
Definition: acrestyp.h:738
#define ACPI_POS_DECODE
Definition: acrestyp.h:144
#define ACPI_RESOURCE_TYPE_IRQ
Definition: acrestyp.h:723
#define ACPI_RESOURCE_TYPE_FIXED_IO
Definition: acrestyp.h:728
#define ACPI_BUS_NUMBER_RANGE
Definition: acrestyp.h:139
#define ACPI_PRODUCER
Definition: acrestyp.h:149
#define ACPI_TRANSFER_8_16
Definition: acrestyp.h:124
#define ACPI_SHARED
Definition: acrestyp.h:105
#define ACPI_RESOURCE_TYPE_END_DEPENDENT
Definition: acrestyp.h:726
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:730
#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64
Definition: acrestyp.h:737
#define ACPI_RESOURCE_TYPE_START_DEPENDENT
Definition: acrestyp.h:725
#define ACPI_PREFETCHABLE_MEMORY
Definition: acrestyp.h:63
#define ACPI_TRANSFER_16
Definition: acrestyp.h:125
#define ACPI_TYPE_A
Definition: acrestyp.h:116
#define ACPI_TYPE_B
Definition: acrestyp.h:117
#define ACPI_TRANSFER_8
Definition: acrestyp.h:123
#define ACPI_BUS_MASTER
Definition: acrestyp.h:121
#define ACPI_RESOURCE_TYPE_ADDRESS64
Definition: acrestyp.h:736
#define ACPI_WRITE_COMBINING_MEMORY
Definition: acrestyp.h:62
#define ACPI_TYPE_F
Definition: acrestyp.h:118
#define ACPI_IO_RANGE
Definition: acrestyp.h:138
#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32
Definition: acrestyp.h:733
#define ACPI_RESOURCE_TYPE_ADDRESS32
Definition: acrestyp.h:735
#define ACPI_LEVEL_SENSITIVE
Definition: acrestyp.h:93
#define ACPI_RESOURCE_TYPE_IO
Definition: acrestyp.h:727
#define ACPI_RESOURCE_TYPE_ADDRESS16
Definition: acrestyp.h:734
#define IO_RESOURCE_ALTERNATIVE
Definition: edit.c:119
#define IO_RESOURCE_PREFERRED
Definition: edit.c:117
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypeDma
Definition: hwresource.cpp:126
@ Internal
Definition: hwresource.cpp:137
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeBusNumber
Definition: hwresource.cpp:128
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define resource
Definition: kernel32.h:9
#define CM_RESOURCE_PORT_POSITIVE_DECODE
Definition: cmtypes.h:113
#define CM_RESOURCE_MEMORY_PREFETCHABLE
Definition: cmtypes.h:123
#define CM_RESOURCE_DMA_8_AND_16
Definition: cmtypes.h:134
#define CM_RESOURCE_DMA_BUS_MASTER
Definition: cmtypes.h:135
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_DMA_8
Definition: cmtypes.h:131
#define CM_RESOURCE_DMA_TYPE_A
Definition: cmtypes.h:136
#define CM_RESOURCE_DMA_TYPE_F
Definition: cmtypes.h:138
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:121
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CM_RESOURCE_MEMORY_COMBINEDWRITE
Definition: cmtypes.h:124
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CM_RESOURCE_MEMORY_CACHEABLE
Definition: cmtypes.h:126
#define CM_RESOURCE_DMA_TYPE_B
Definition: cmtypes.h:137
#define CM_RESOURCE_DMA_16
Definition: cmtypes.h:132
#define CM_RESOURCE_MEMORY_24
Definition: cmtypes.h:125
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
ACPI_STATUS AcpiGetCurrentResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:225
ACPI_STATUS AcpiGetPossibleResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:273
struct _IO_RESOURCE_DESCRIPTOR::@23::@26 Interrupt
struct _IO_RESOURCE_DESCRIPTOR::@23::@27 Dma
struct _IO_RESOURCE_DESCRIPTOR::@23::@30 BusNumber
struct _IO_RESOURCE_DESCRIPTOR::@23::@24 Port
union _IO_RESOURCE_DESCRIPTOR::@23 u
struct _IO_RESOURCE_DESCRIPTOR::@23::@25 Memory
UCHAR ShareDisposition
Definition: edit.c:61
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS16_ATTRIBUTE Address
Definition: acrestyp.h:394
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS32_ATTRIBUTE Address
Definition: acrestyp.h:402
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:410
UINT8 Channels[1]
Definition: acrestyp.h:195
UINT8 ChannelCount
Definition: acrestyp.h:194
ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:419
UINT16 Maximum
Definition: acrestyp.h:220
UINT16 Minimum
Definition: acrestyp.h:219
UINT8 AddressLength
Definition: acrestyp.h:218
UINT8 Interrupts[1]
Definition: acrestyp.h:185
UINT8 InterruptCount
Definition: acrestyp.h:184
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareShared
Definition: cmtypes.h:243
@ CmResourceShareDriverExclusive
Definition: cmtypes.h:242

Referenced by Bus_PDO_PnP(), and START_TEST().

◆ Bus_PDO_QueryResources()

NTSTATUS Bus_PDO_QueryResources ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 794 of file buspdo.c.

797{
798 ULONG NumberOfResources = 0;
800 PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
801 ACPI_STATUS AcpiStatus;
804 ULONG ResourceListSize;
805 ULONG i;
807 struct acpi_device *device;
808
809 if (!DeviceData->AcpiHandle)
810 {
811 return Irp->IoStatus.Status;
812 }
813
814 /* A bus number resource is not included in the list of current resources
815 * for the root PCI bus so we manually query one here and if we find it
816 * we create a resource list and add a bus number descriptor to it */
817 if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
818 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
819 {
821
822 AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN", NULL, &BusNumber);
823 if (AcpiStatus != AE_OK)
824 {
825#if 0
826 if (device->flags.unique_id)
827 {
828 /* FIXME: Try the unique ID */
829 }
830 else
831#endif
832 {
833 BusNumber = 0;
834 DPRINT1("Failed to find a bus number\n");
835 }
836 }
837 else
838 {
839 DPRINT("Using _BBN for bus number\n");
840 }
841
842 DPRINT("Found PCI root hub: %d\n", BusNumber);
843
844 ResourceListSize = sizeof(CM_RESOURCE_LIST);
845 ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
846 if (!ResourceList)
848
849 ResourceList->Count = 1;
850 ResourceList->List[0].InterfaceType = Internal;
851 ResourceList->List[0].BusNumber = 0;
852 ResourceList->List[0].PartialResourceList.Version = 1;
853 ResourceList->List[0].PartialResourceList.Revision = 1;
854 ResourceList->List[0].PartialResourceList.Count = 1;
855 ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
856
857 ResourceDescriptor->Type = CmResourceTypeBusNumber;
859 ResourceDescriptor->u.BusNumber.Start = BusNumber;
860 ResourceDescriptor->u.BusNumber.Length = 1;
861
862 Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
863 return STATUS_SUCCESS;
864 }
865
866 /* Get current resources */
867 Buffer.Length = 0;
868 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
869 if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
870 Buffer.Length == 0)
871 {
872 return Irp->IoStatus.Status;
873 }
874
875 Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
876 if (!Buffer.Pointer)
878
879 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
880 if (!ACPI_SUCCESS(AcpiStatus))
881 {
882 DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
883 ASSERT(FALSE);
884 return STATUS_UNSUCCESSFUL;
885 }
886
887 resource= Buffer.Pointer;
888 /* Count number of resources */
889 while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
890 {
891 switch (resource->Type)
892 {
894 {
896 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
897 break;
898 NumberOfResources += irq_data->InterruptCount;
899 break;
900 }
902 {
903 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
904 NumberOfResources += irq_data->InterruptCount;
905 break;
906 }
908 {
909 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
910 NumberOfResources += dma_data->ChannelCount;
911 break;
912 }
917 {
919 if (addr_res->ProducerConsumer == ACPI_PRODUCER)
920 break;
921 NumberOfResources++;
922 break;
923 }
929 {
930 NumberOfResources++;
931 break;
932 }
933 default:
934 {
935 DPRINT1("Unknown resource type: %d\n", resource->Type);
936 break;
937 }
938 }
940 }
941
942 /* Allocate memory */
943 ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
944 ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
945
946 if (!ResourceList)
947 {
948 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
950 }
951 ResourceList->Count = 1;
952 ResourceList->List[0].InterfaceType = Internal; /* FIXME */
953 ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
954 ResourceList->List[0].PartialResourceList.Version = 1;
955 ResourceList->List[0].PartialResourceList.Revision = 1;
956 ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
957 ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
958
959 /* Fill resources list structure */
960 resource = Buffer.Pointer;
961 while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
962 {
963 switch (resource->Type)
964 {
966 {
968 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
969 break;
970 for (i = 0; i < irq_data->InterruptCount; i++)
971 {
972 ResourceDescriptor->Type = CmResourceTypeInterrupt;
973
974 ResourceDescriptor->ShareDisposition =
976 ResourceDescriptor->Flags =
978 ResourceDescriptor->u.Interrupt.Level =
979 ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
980 ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
981
982 ResourceDescriptor++;
983 }
984 break;
985 }
987 {
988 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
989 for (i = 0; i < irq_data->InterruptCount; i++)
990 {
991 ResourceDescriptor->Type = CmResourceTypeInterrupt;
992
993 ResourceDescriptor->ShareDisposition =
995 ResourceDescriptor->Flags =
997 ResourceDescriptor->u.Interrupt.Level =
998 ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
999 ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
1000
1001 ResourceDescriptor++;
1002 }
1003 break;
1004 }
1006 {
1007 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1008 for (i = 0; i < dma_data->ChannelCount; i++)
1009 {
1010 ResourceDescriptor->Type = CmResourceTypeDma;
1011 ResourceDescriptor->Flags = 0;
1012 switch (dma_data->Type)
1013 {
1014 case ACPI_TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1015 case ACPI_TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1016 case ACPI_TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1017 }
1018 if (dma_data->BusMaster == ACPI_BUS_MASTER)
1019 ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1020 switch (dma_data->Transfer)
1021 {
1022 case ACPI_TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1023 case ACPI_TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1024 case ACPI_TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1025 }
1026 ResourceDescriptor->u.Dma.Channel = dma_data->Channels[i];
1027
1028 ResourceDescriptor++;
1029 }
1030 break;
1031 }
1033 {
1034 ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &resource->Data;
1035 ResourceDescriptor->Type = CmResourceTypePort;
1037 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1038 if (io_data->IoDecode == ACPI_DECODE_16)
1039 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1040 else
1041 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1042 ResourceDescriptor->u.Port.Start.QuadPart = io_data->Minimum;
1043 ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1044
1045 ResourceDescriptor++;
1046 break;
1047 }
1049 {
1051 ResourceDescriptor->Type = CmResourceTypePort;
1053 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1054 ResourceDescriptor->u.Port.Start.QuadPart = io_data->Address;
1055 ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1056
1057 ResourceDescriptor++;
1058 break;
1059 }
1061 {
1063 if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1064 break;
1065 if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1066 {
1067 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1068 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1069 ResourceDescriptor->Flags = 0;
1070 ResourceDescriptor->u.BusNumber.Start = addr16_data->Address.Minimum;
1071 ResourceDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1072 }
1073 else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1074 {
1075 ResourceDescriptor->Type = CmResourceTypePort;
1077 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1078 if (addr16_data->Decode == ACPI_POS_DECODE)
1079 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1080 ResourceDescriptor->u.Port.Start.QuadPart = addr16_data->Address.Minimum;
1081 ResourceDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1082 }
1083 else
1084 {
1085 ResourceDescriptor->Type = CmResourceTypeMemory;
1087 ResourceDescriptor->Flags = 0;
1088 if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1089 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1090 else
1091 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1092 switch (addr16_data->Info.Mem.Caching)
1093 {
1094 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1095 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1096 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1097 }
1098 ResourceDescriptor->u.Memory.Start.QuadPart = addr16_data->Address.Minimum;
1099 ResourceDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1100 }
1101 ResourceDescriptor++;
1102 break;
1103 }
1105 {
1107 if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1108 break;
1109 if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1110 {
1111 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1112 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1113 ResourceDescriptor->Flags = 0;
1114 ResourceDescriptor->u.BusNumber.Start = addr32_data->Address.Minimum;
1115 ResourceDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1116 }
1117 else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1118 {
1119 ResourceDescriptor->Type = CmResourceTypePort;
1121 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1122 if (addr32_data->Decode == ACPI_POS_DECODE)
1123 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1124 ResourceDescriptor->u.Port.Start.QuadPart = addr32_data->Address.Minimum;
1125 ResourceDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1126 }
1127 else
1128 {
1129 ResourceDescriptor->Type = CmResourceTypeMemory;
1131 ResourceDescriptor->Flags = 0;
1132 if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1133 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1134 else
1135 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1136 switch (addr32_data->Info.Mem.Caching)
1137 {
1138 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1139 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1140 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1141 }
1142 ResourceDescriptor->u.Memory.Start.QuadPart = addr32_data->Address.Minimum;
1143 ResourceDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1144 }
1145 ResourceDescriptor++;
1146 break;
1147 }
1149 {
1151 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1152 break;
1153 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1154 {
1155 DPRINT1("64-bit bus address is not supported!\n");
1156 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1157 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1158 ResourceDescriptor->Flags = 0;
1159 ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1160 ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1161 }
1162 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1163 {
1164 ResourceDescriptor->Type = CmResourceTypePort;
1166 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1167 if (addr64_data->Decode == ACPI_POS_DECODE)
1168 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1169 ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1170 ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1171 }
1172 else
1173 {
1174 ResourceDescriptor->Type = CmResourceTypeMemory;
1176 ResourceDescriptor->Flags = 0;
1177 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1178 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1179 else
1180 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1181 switch (addr64_data->Info.Mem.Caching)
1182 {
1183 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1184 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1185 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1186 }
1187 ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1188 ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1189 }
1190 ResourceDescriptor++;
1191 break;
1192 }
1194 {
1196 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1197 break;
1198 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1199 {
1200 DPRINT1("64-bit bus address is not supported!\n");
1201 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1202 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1203 ResourceDescriptor->Flags = 0;
1204 ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1205 ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1206 }
1207 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1208 {
1209 ResourceDescriptor->Type = CmResourceTypePort;
1211 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1212 if (addr64_data->Decode == ACPI_POS_DECODE)
1213 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1214 ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1215 ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1216 }
1217 else
1218 {
1219 ResourceDescriptor->Type = CmResourceTypeMemory;
1221 ResourceDescriptor->Flags = 0;
1222 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1223 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1224 else
1225 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1226 switch (addr64_data->Info.Mem.Caching)
1227 {
1228 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1229 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1230 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1231 }
1232 ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1233 ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1234 }
1235 ResourceDescriptor++;
1236 break;
1237 }
1239 {
1241 ResourceDescriptor->Type = CmResourceTypeMemory;
1243 ResourceDescriptor->Flags = CM_RESOURCE_MEMORY_24;
1244 if (mem24_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1245 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1246 else
1247 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1248 ResourceDescriptor->u.Memory.Start.QuadPart = mem24_data->Minimum;
1249 ResourceDescriptor->u.Memory.Length = mem24_data->AddressLength;
1250
1251 ResourceDescriptor++;
1252 break;
1253 }
1255 {
1257 ResourceDescriptor->Type = CmResourceTypeMemory;
1259 ResourceDescriptor->Flags = 0;
1260 if (mem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1261 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1262 else
1263 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1264 ResourceDescriptor->u.Memory.Start.QuadPart = mem32_data->Minimum;
1265 ResourceDescriptor->u.Memory.Length = mem32_data->AddressLength;
1266
1267 ResourceDescriptor++;
1268 break;
1269 }
1271 {
1273 ResourceDescriptor->Type = CmResourceTypeMemory;
1275 ResourceDescriptor->Flags = 0;
1276 if (memfixed32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1277 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1278 else
1279 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1280 ResourceDescriptor->u.Memory.Start.QuadPart = memfixed32_data->Address;
1281 ResourceDescriptor->u.Memory.Length = memfixed32_data->AddressLength;
1282
1283 ResourceDescriptor++;
1284 break;
1285 }
1286 default:
1287 {
1288 break;
1289 }
1290 }
1292 }
1293
1294 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1295 Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
1296 return STATUS_SUCCESS;
1297}
#define AE_OK
Definition: acexcep.h:97
ULONG_PTR KAFFINITY
Definition: compat.h:85
ACPI_STATUS acpi_evaluate_integer(ACPI_HANDLE handle, ACPI_STRING pathname, ACPI_OBJECT_LIST *arguments, unsigned long long *data)
Definition: utils.c:242
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define for
Definition: utility.h:88
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395::@403 BusNumber
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395::@398 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395::@401 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395::@400 Memory
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395::@397 Port
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@395 u
uint64_t ULONGLONG
Definition: typedefs.h:67
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by Bus_PDO_PnP().

◆ Bus_PnP()

NTSTATUS NTAPI Bus_PnP ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 25 of file pnp.c.

29{
30 PIO_STACK_LOCATION irpStack;
32 PCOMMON_DEVICE_DATA commonData;
33
34 PAGED_CODE ();
35
37 ASSERT (IRP_MJ_PNP == irpStack->MajorFunction);
38
39 commonData = (PCOMMON_DEVICE_DATA) DeviceObject->DeviceExtension;
40
41
42 if (commonData->IsFDO) {
43 DPRINT("FDO %s IRP:0x%p\n",
45 Irp);
46 //
47 // Request is for the bus FDO
48 //
51 Irp,
52 irpStack,
53 (PFDO_DEVICE_DATA) commonData);
54 } else {
55 DPRINT("PDO %s IRP: 0x%p\n",
57 Irp);
58 //
59 // Request is for the child PDO.
60 //
63 Irp,
64 irpStack,
65 (PPDO_DEVICE_DATA) commonData);
66 }
67
68 return status;
69}
struct _COMMON_DEVICE_DATA * PCOMMON_DEVICE_DATA
NTSTATUS Bus_PDO_PnP(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpStack, PPDO_DEVICE_DATA DeviceData)
Definition: buspdo.c:23
NTSTATUS Bus_FDO_PnP(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpStack, PFDO_DEVICE_DATA DeviceData)
Definition: pnp.c:72
PCHAR NTAPI PnPMinorFunctionString(UCHAR MinorFunction)
Definition: fbtpnp.c:1831

Referenced by DriverEntry().

◆ Bus_Power()

NTSTATUS NTAPI Bus_Power ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 8 of file power.c.

12{
13 PIO_STACK_LOCATION irpStack;
15 PCOMMON_DEVICE_DATA commonData;
16
19 ASSERT (IRP_MJ_POWER == irpStack->MajorFunction);
20
21 commonData = (PCOMMON_DEVICE_DATA) DeviceObject->DeviceExtension;
22
23 if (commonData->IsFDO) {
24
25 DPRINT("FDO %s IRP:0x%p %s %s\n",
29
30
32 Irp);
33 } else {
34
35 DPRINT("PDO %s IRP:0x%p %s %s\n",
39
41 Irp);
42 }
43
44 return status;
45}
NTSTATUS Bus_PDO_Power(PPDO_DEVICE_DATA PdoData, PIRP Irp)
Definition: power.c:116
NTSTATUS Bus_FDO_Power(PFDO_DEVICE_DATA Data, PIRP Irp)
Definition: power.c:49
PCHAR NTAPI PowerMinorFunctionString(IN UCHAR MinorFunction)
Definition: fbtpwr.c:1042
#define IRP_MJ_POWER

Referenced by DriverEntry().

◆ Bus_RemoveFdo()

void Bus_RemoveFdo ( PFDO_DEVICE_DATA  FdoData)

◆ Bus_SendIrpSynchronously()

NTSTATUS Bus_SendIrpSynchronously ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 322 of file pnp.c.

326{
329
330 PAGED_CODE();
331
333
335
338 &event,
339 TRUE,
340 TRUE,
341 TRUE
342 );
343
345
346 //
347 // Wait for lower drivers to be done with the Irp.
348 // Important thing to note here is when you allocate
349 // the memory for an event in the stack you must do a
350 // KernelMode wait instead of UserMode to prevent
351 // the stack from getting paged out.
352 //
353
354 if (status == STATUS_PENDING) {
356 Executive,
358 FALSE,
359 NULL
360 );
361 status = Irp->IoStatus.Status;
362 }
363
364 return status;
365}
NTSTATUS NTAPI Bus_CompletionRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
Definition: pnp.c:369
struct _cl_event * event
Definition: glext.h:7739
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413

◆ Bus_SetCrispinessLevel()

BOOLEAN Bus_SetCrispinessLevel ( PVOID  Context,
UCHAR  Level 
)

◆ Bus_StartFdo()

NTSTATUS Bus_StartFdo ( PFDO_DEVICE_DATA  FdoData,
PIRP  Irp 
)

Definition at line 267 of file pnp.c.

270{
272 POWER_STATE powerState;
273 ACPI_STATUS AcpiStatus;
274
275 PAGED_CODE ();
276
278 powerState.DeviceState = PowerDeviceD0;
279 PoSetPowerState ( FdoData->Common.Self, DevicePowerState, powerState );
280
282
283 AcpiStatus = AcpiInitializeSubsystem();
284 if(ACPI_FAILURE(AcpiStatus)){
285 DPRINT1("Unable to AcpiInitializeSubsystem\n");
286 return STATUS_UNSUCCESSFUL;
287 }
288
289 AcpiStatus = AcpiInitializeTables(NULL, 16, 0);
290 if (ACPI_FAILURE(AcpiStatus)){
291 DPRINT1("Unable to AcpiInitializeTables\n");
292 return STATUS_UNSUCCESSFUL;
293 }
294
295 AcpiStatus = AcpiLoadTables();
296 if(ACPI_FAILURE(AcpiStatus)){
297 DPRINT1("Unable to AcpiLoadTables\n");
299 return STATUS_UNSUCCESSFUL;
300 }
301
303 if (!NT_SUCCESS(status))
304 {
305 DPRINT1("Unable to create ACPI tables in registry\n");
306 }
307
308 DPRINT("Acpi subsystem init\n");
309 /* Initialize ACPI bus manager */
310 AcpiStatus = acpi_init();
311 if (!ACPI_SUCCESS(AcpiStatus)) {
312 DPRINT1("acpi_init() failed with status 0x%X\n", AcpiStatus);
314 return STATUS_UNSUCCESSFUL;
315 }
316 status = ACPIEnumerateDevices(FdoData);
317
318 return status;
319}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
NTSTATUS ACPIEnumerateDevices(PFDO_DEVICE_DATA DeviceExtension)
Definition: acpienum.c:146
int acpi_init(void)
Definition: bus.c:1754
NTSTATUS acpi_create_volatile_registry_tables(void)
Definition: utils.c:525
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeTables(ACPI_TABLE_DESC *InitialTableArray, UINT32 InitialTableCount, BOOLEAN AllowResize)
Definition: tbxface.c:107
ACPI_STATUS ACPI_INIT_FUNCTION AcpiLoadTables(void)
Definition: tbxfload.c:69
ACPI_STATUS ACPI_INIT_FUNCTION AcpiTerminate(void)
Definition: utxface.c:67
ACPI_STATUS ACPI_INIT_FUNCTION AcpiInitializeSubsystem(void)
Definition: utxfinit.c:76

Referenced by Bus_FDO_PnP().

◆ DbgDeviceIDString()

PCHAR DbgDeviceIDString ( BUS_QUERY_ID_TYPE  Type)

◆ DbgDevicePowerString()

PCHAR DbgDevicePowerString ( DEVICE_POWER_STATE  Type)

◆ DbgDeviceRelationString()

PCHAR DbgDeviceRelationString ( DEVICE_RELATION_TYPE  Type)

Referenced by Bus_FDO_PnP(), and Bus_PDO_PnP().

◆ DbgSystemPowerString()

PCHAR DbgSystemPowerString ( SYSTEM_POWER_STATE  Type)

◆ PnPMinorFunctionString()

PCHAR PnPMinorFunctionString ( UCHAR  MinorFunction)

Definition at line 1831 of file fbtpnp.c.

1832{
1833 switch (MinorFunction)
1834 {
1836 return "IRP_MN_START_DEVICE\n";
1837
1839 return "IRP_MN_QUERY_REMOVE_DEVICE\n";
1840
1842 return "IRP_MN_REMOVE_DEVICE\n";
1843
1845 return "IRP_MN_CANCEL_REMOVE_DEVICE\n";
1846
1847 case IRP_MN_STOP_DEVICE:
1848 return "IRP_MN_STOP_DEVICE\n";
1849
1851 return "IRP_MN_QUERY_STOP_DEVICE\n";
1852
1854 return "IRP_MN_CANCEL_STOP_DEVICE\n";
1855
1857 return "IRP_MN_QUERY_DEVICE_RELATIONS\n";
1858
1860 return "IRP_MN_QUERY_INTERFACE\n";
1861
1863 return "IRP_MN_QUERY_CAPABILITIES\n";
1864
1866 return "IRP_MN_QUERY_RESOURCES\n";
1867
1869 return "IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n";
1870
1872 return "IRP_MN_QUERY_DEVICE_TEXT\n";
1873
1875 return "IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n";
1876
1877 case IRP_MN_READ_CONFIG:
1878 return "IRP_MN_READ_CONFIG\n";
1879
1881 return "IRP_MN_WRITE_CONFIG\n";
1882
1883 case IRP_MN_EJECT:
1884 return "IRP_MN_EJECT\n";
1885
1886 case IRP_MN_SET_LOCK:
1887 return "IRP_MN_SET_LOCK\n";
1888
1889 case IRP_MN_QUERY_ID:
1890 return "IRP_MN_QUERY_ID\n";
1891
1893 return "IRP_MN_QUERY_PNP_DEVICE_STATE\n";
1894
1896 return "IRP_MN_QUERY_BUS_INFORMATION\n";
1897
1899 return "IRP_MN_DEVICE_USAGE_NOTIFICATION\n";
1900
1902 return "IRP_MN_SURPRISE_REMOVAL\n";
1903
1904 default:
1905 return "IRP_MN_?????\n";
1906
1907 }
1908
1909}
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
_In_ UCHAR _In_ UCHAR MinorFunction
Definition: wdfdevice.h:1699
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_EJECT
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_READ_CONFIG
#define IRP_MN_WRITE_CONFIG
#define IRP_MN_SET_LOCK

Referenced by Bus_PnP(), and FreeBT_DispatchPnP().

◆ PowerMinorFunctionString()

PCHAR PowerMinorFunctionString ( UCHAR  MinorFunction)

Variable Documentation

◆ Bus_PDO_EvalMethodWorker

WORKER_THREAD_ROUTINE Bus_PDO_EvalMethodWorker

Definition at line 104 of file acpisys.h.

Referenced by ACPIDispatchDeviceControl().

◆ ProcessorHardwareIds

UNICODE_STRING ProcessorHardwareIds
extern

Definition at line 17 of file main.c.

Referenced by Bus_PDO_QueryDeviceId(), and GetProcessorInformation().

◆ ProcessorIdString

LPWSTR ProcessorIdString
extern

Definition at line 18 of file main.c.

Referenced by Bus_PDO_QueryDeviceId(), and GetProcessorInformation().

◆ ProcessorNameString

LPWSTR ProcessorNameString
extern

Definition at line 19 of file main.c.

Referenced by Bus_PDO_QueryDeviceText(), and GetProcessorInformation().