ReactOS  0.4.14-dev-293-g2b39b42
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
 

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
 

Enumerations

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

Functions

NTSTATUS ACPIEnumerateDevices (PFDO_DEVICE_DATA DeviceExtension)
 
NTSTATUS NTAPI Bus_PDO_EvalMethod (PPDO_DEVICE_DATA DeviceData, PIRP Irp)
 
NTSTATUS NTAPI Bus_CreateClose (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
VOID Bus_DriverUnload (PDRIVER_OBJECT DriverObject)
 
PCHAR PnPMinorFunctionString (UCHAR MinorFunction)
 
NTSTATUS NTAPI Bus_AddDevice (PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
 
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
 

Macro Definition Documentation

◆ FDO_FROM_PDO

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

Definition at line 76 of file acpisys.h.

◆ INITIALIZE_PNP_STATE

#define INITIALIZE_PNP_STATE (   _Data_)
Value:
(_Data_).DevicePnPState = NotStarted;\
(_Data_).PreviousPnPState = NotStarted;

Definition at line 79 of file acpisys.h.

◆ RESTORE_PREVIOUS_PNP_STATE

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

Definition at line 87 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 83 of file acpisys.h.

Typedef Documentation

◆ COMMON_DEVICE_DATA

◆ DEVICE_PNP_STATE

◆ FDO_DEVICE_DATA

◆ PCOMMON_DEVICE_DATA

◆ PDO_DEVICE_DATA

◆ PFDO_DEVICE_DATA

◆ PPDO_DEVICE_DATA

Enumeration Type Documentation

◆ _DEVICE_PNP_STATE

Enumerator
NotStarted 
Started 
StopPending 
Stopped 
RemovalPending 
UnKnown 
NotStarted 
Started 
StopPending 
Stopped 
RemovePending 
SurpriseRemovePending 
Deleted 
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 
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 }
#define NODE_TO_DEVICE(n)
Definition: acpienum.c:17
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
NTSTATUS Bus_PlugInDevice(struct acpi_device *Device, PFDO_DEVICE_DATA FdoData)
Definition: acpienum.c:22
void DPRINT(...)
Definition: polytest.cpp:61
#define HAS_CHILDREN(d)
Definition: acpienum.c:15
#define HAS_SIBLINGS(d)
Definition: acpienum.c:16
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
struct acpi_device * acpi_root
Definition: bus.c:51

Referenced by Bus_StartFdo().

◆ Bus_AddDevice()

NTSTATUS NTAPI Bus_AddDevice ( PDRIVER_OBJECT  DriverObject,
PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 31 of file main.c.

36 {
38  PDEVICE_OBJECT deviceObject = NULL;
39  PFDO_DEVICE_DATA deviceData = NULL;
40 #ifndef NDEBUG
41  PWCHAR deviceName = NULL;
42  ULONG nameLength;
43 #endif
44 
45  PAGED_CODE ();
46 
47  DPRINT("Add Device: 0x%p\n", PhysicalDeviceObject);
48 
49  DPRINT("#################### Bus_CreateClose Creating FDO Device ####################\n");
51  sizeof(FDO_DEVICE_DATA),
52  NULL,
55  TRUE,
56  &deviceObject);
57  if (!NT_SUCCESS(status))
58  {
59  DPRINT1("IoCreateDevice() failed with status 0x%X\n", status);
60  goto End;
61  }
62 
63  deviceData = (PFDO_DEVICE_DATA) deviceObject->DeviceExtension;
64  RtlZeroMemory (deviceData, sizeof (FDO_DEVICE_DATA));
65 
66  //
67  // Set the initial state of the FDO
68  //
69 
70  INITIALIZE_PNP_STATE(deviceData->Common);
71 
72  deviceData->Common.IsFDO = TRUE;
73 
74  deviceData->Common.Self = deviceObject;
75 
76  ExInitializeFastMutex (&deviceData->Mutex);
77 
78  InitializeListHead (&deviceData->ListOfPDOs);
79 
80  // Set the PDO for use with PlugPlay functions
81 
82  deviceData->UnderlyingPDO = PhysicalDeviceObject;
83 
84  //
85  // Set the initial powerstate of the FDO
86  //
87 
90 
91  deviceObject->Flags |= DO_POWER_PAGABLE;
92 
93  //
94  // Attach our FDO to the device stack.
95  // The return value of IoAttachDeviceToDeviceStack is the top of the
96  // attachment chain. This is where all the IRPs should be routed.
97  //
98 
100  deviceObject,
102 
103  if (NULL == deviceData->NextLowerDriver) {
104 
106  goto End;
107  }
108 
109 
110 #ifndef NDEBUG
111  //
112  // We will demonstrate here the step to retrieve the name of the PDO
113  //
114 
117  0,
118  NULL,
119  &nameLength);
120 
122  {
123  DPRINT1("AddDevice:IoGDP failed (0x%x)\n", status);
124  goto End;
125  }
126 
127  deviceName = ExAllocatePoolWithTag(NonPagedPool, nameLength, 'MpcA');
128 
129  if (NULL == deviceName) {
130  DPRINT1("AddDevice: no memory to alloc for deviceName(0x%x)\n", nameLength);
132  goto End;
133  }
134 
137  nameLength,
138  deviceName,
139  &nameLength);
140 
141  if (!NT_SUCCESS (status)) {
142 
143  DPRINT1("AddDevice:IoGDP(2) failed (0x%x)", status);
144  goto End;
145  }
146 
147  DPRINT("AddDevice: %p to %p->%p (%ws) \n",
148  deviceObject,
149  deviceData->NextLowerDriver,
151  deviceName);
152 
153 #endif
154 
155  //
156  // We are done with initializing, so let's indicate that and return.
157  // This should be the final step in the AddDevice process.
158  //
159  deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
160 
161 End:
162 #ifndef NDEBUG
163  if (deviceName){
164  ExFreePoolWithTag(deviceName, 'MpcA');
165  }
166 #endif
167  if (!NT_SUCCESS(status) && deviceObject){
168  if (deviceData && deviceData->NextLowerDriver){
169  IoDetachDevice (deviceData->NextLowerDriver);
170  }
171  IoDeleteDevice (deviceObject);
172  }
173  return status;
174 
175 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_POWER_PAGABLE
DEVICE_POWER_STATE DevicePowerState
Definition: acpisys.h:33
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
uint16_t * PWCHAR
Definition: typedefs.h:54
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
PDEVICE_OBJECT UnderlyingPDO
Definition: acpisys.h:59
#define PAGED_CODE()
Definition: video.h:57
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
PDEVICE_OBJECT Self
Definition: acpisys.h:28
SYSTEM_POWER_STATE SystemPowerState
Definition: acpisys.h:32
FAST_MUTEX Mutex
Definition: acpisys.h:72
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:4228
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY ListOfPDOs
Definition: acpisys.h:66
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
COMMON_DEVICE_DATA Common
Definition: acpisys.h:58
struct _FDO_DEVICE_DATA * PFDO_DEVICE_DATA
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DPRINT1
Definition: precomp.h:8
#define INITIALIZE_PNP_STATE(_Data_)
Definition: fbtusb.h:107
PDEVICE_OBJECT NextLowerDriver
Definition: acpisys.h:63
#define FILE_DEVICE_ACPI
Definition: winioctl.h:155
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by DriverEntry().

◆ 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 }
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define IO_NO_INCREMENT
Definition: iotypes.h:566

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 }
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
#define PAGED_CODE()
Definition: video.h:57
PWCHAR HardwareIDs
Definition: acpisys.h:44
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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 
154  ExAcquireFastMutex (&DeviceData->Mutex);
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  //
164  ExReleaseFastMutex (&DeviceData->Mutex);
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  //
197  ExReleaseFastMutex (&DeviceData->Mutex);
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 
243  ExReleaseFastMutex (&DeviceData->Mutex);
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 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
_In_ PIRP Irp
Definition: csq.h:116
struct _DEVICE_OBJECT * PDEVICE_OBJECT
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2055
LONG NTSTATUS
Definition: precomp.h:26
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
PDEVICE_OBJECT Self
Definition: acpisys.h:28
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define IRP_MN_QUERY_STOP_DEVICE
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define RESTORE_PREVIOUS_PNP_STATE(_Data_)
Definition: fbtusb.h:115
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define IRP_MN_START_DEVICE
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
uint32_t entry
Definition: isohybrid.c:63
Definition: typedefs.h:117
struct _DEVICE_RELATIONS DEVICE_RELATIONS
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
NTSTATUS Bus_StartFdo(PFDO_DEVICE_DATA FdoData, PIRP Irp)
Definition: pnp.c:267
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define SET_NEW_PNP_STATE(_Data_, _state_)
Definition: fbtusb.h:111
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define ULONG_PTR
Definition: config.h:101
#define IRP_MN_CANCEL_STOP_DEVICE
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
PCHAR DbgDeviceRelationString(DEVICE_RELATION_TYPE Type)
COMMON_DEVICE_DATA Common
Definition: acpisys.h:38
Definition: ps.c:97

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) ? \
71  DbgSystemPowerString(powerState.SystemState) :\
72  DbgDevicePowerString(powerState.DeviceState)));
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;
94  ASSERT(FALSE);
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 }
enum _POWER_STATE_TYPE POWER_STATE_TYPE
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
static stack_node_t * stack
Definition: rpn_ieee.c:37
UINT32 ACPI_STATUS
Definition: actypes.h:460
enum _SYSTEM_POWER_STATE SYSTEM_POWER_STATE
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
#define ACPI_STATE_S5
Definition: actypes.h:620
void DPRINT(...)
Definition: polytest.cpp:61
#define ACPI_STATE_S4
Definition: actypes.h:619
Definition: _stack.h:47
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ACPI_STATUS acpi_suspend(UINT32 state)
Definition: system.c:347
#define IRP_MN_SET_POWER
PCHAR DbgSystemPowerString(SYSTEM_POWER_STATE Type)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
#define ACPI_STATE_S1
Definition: actypes.h:616
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define ACPI_STATE_S2
Definition: actypes.h:617
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ACPI_STATE_S3
Definition: actypes.h:618
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
PCHAR DbgDevicePowerString(DEVICE_POWER_STATE Type)
#define ACPI_STATE_UNKNOWN
Definition: actypes.h:613
Definition: ps.c:97

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 1939 of file buspdo.c.

1943 {
1944  IO_STATUS_BLOCK ioStatus;
1945  KEVENT pnpEvent;
1946  NTSTATUS status;
1947  PDEVICE_OBJECT targetObject;
1948  PIO_STACK_LOCATION irpStack;
1949  PIRP pnpIrp;
1950 
1951  PAGED_CODE();
1952 
1953  //
1954  // Initialize the capabilities that we will send down
1955  //
1957  DeviceCapabilities->Size = sizeof(DEVICE_CAPABILITIES);
1958  DeviceCapabilities->Version = 1;
1959  DeviceCapabilities->Address = -1;
1960  DeviceCapabilities->UINumber = -1;
1961 
1962  //
1963  // Initialize the event
1964  //
1965  KeInitializeEvent( &pnpEvent, NotificationEvent, FALSE );
1966 
1967  targetObject = IoGetAttachedDeviceReference( DeviceObject );
1968 
1969  //
1970  // Build an Irp
1971  //
1973  IRP_MJ_PNP,
1974  targetObject,
1975  NULL,
1976  0,
1977  NULL,
1978  &pnpEvent,
1979  &ioStatus
1980  );
1981  if (pnpIrp == NULL) {
1982 
1984  goto GetDeviceCapabilitiesExit;
1985 
1986  }
1987 
1988  //
1989  // Pnp Irps all begin life as STATUS_NOT_SUPPORTED;
1990  //
1991  pnpIrp->IoStatus.Status = STATUS_NOT_SUPPORTED;
1992 
1993  //
1994  // Get the top of stack
1995  //
1996  irpStack = IoGetNextIrpStackLocation( pnpIrp );
1997 
1998  //
1999  // Set the top of stack
2000  //
2001  RtlZeroMemory( irpStack, sizeof(IO_STACK_LOCATION ) );
2002  irpStack->MajorFunction = IRP_MJ_PNP;
2004  irpStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities;
2005 
2006  //
2007  // Call the driver
2008  //
2009  status = IoCallDriver( targetObject, pnpIrp );
2010  if (status == STATUS_PENDING) {
2011 
2012  //
2013  // Block until the irp comes back.
2014  // Important thing to note here is when you allocate
2015  // the memory for an event in the stack you must do a
2016  // KernelMode wait instead of UserMode to prevent
2017  // the stack from getting paged out.
2018  //
2019 
2021  &pnpEvent,
2022  Executive,
2023  KernelMode,
2024  FALSE,
2025  NULL
2026  );
2027  status = ioStatus.Status;
2028 
2029  }
2030 
2031 GetDeviceCapabilitiesExit:
2032  //
2033  // Done with reference
2034  //
2035  ObDereferenceObject( targetObject );
2036 
2037  //
2038  // Done
2039  //
2040  return status;
2041 
2042 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
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 IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
DEVICE_CAPABILITIES
Definition: iotypes.h:928
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
#define DeviceCapabilities
Definition: wingdi.h:4444
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
#define STATUS_PENDING
Definition: ntstatus.h:82
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
static SERVICE_STATUS status
Definition: service.c:31
#define IRP_MN_QUERY_CAPABILITIES
Definition: ps.c:97

◆ 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 
466  INITIALIZE_PNP_STATE(pdoData->Common);
467 
468  pdoData->Common.DevicePowerState = ntState;
469  pdoData->Common.SystemPowerState = FdoData->Common.SystemPowerState;
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.
478 
479 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
DEVICE_POWER_STATE DevicePowerState
Definition: acpisys.h:33
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:301
#define InsertTailList(ListHead, Entry)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
#define PAGED_CODE()
Definition: video.h:57
PDEVICE_OBJECT Self
Definition: acpisys.h:28
SYSTEM_POWER_STATE SystemPowerState
Definition: acpisys.h:32
FAST_MUTEX Mutex
Definition: acpisys.h:72
PVOID DeviceExtension
Definition: env_spec_w32.h:418
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY ListOfPDOs
Definition: acpisys.h:66
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
struct _PDO_DEVICE_DATA * PPDO_DEVICE_DATA
int acpi_bus_get_power(ACPI_HANDLE handle, int *state)
Definition: bus.c:198
#define ACPI_STATE_D3
Definition: actypes.h:627
COMMON_DEVICE_DATA Common
Definition: acpisys.h:58
PDEVICE_OBJECT ParentFdo
Definition: acpisys.h:41
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
ULONG NumPDOs
Definition: acpisys.h:69
ACPI_HANDLE AcpiHandle
Definition: acpisys.h:39
#define DPRINT1
Definition: precomp.h:8
#define INITIALIZE_PNP_STATE(_Data_)
Definition: fbtusb.h:107
#define ACPI_STATE_D0
Definition: actypes.h:624
#define ACPI_STATE_D1
Definition: actypes.h:625
LIST_ENTRY Link
Definition: acpisys.h:46
#define ACPI_STATE_D2
Definition: actypes.h:626
COMMON_DEVICE_DATA Common
Definition: acpisys.h:38

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 ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 85 of file eval.c.

87 {
90  ACPI_OBJECT_LIST ParamList;
91  PACPI_EVAL_INPUT_BUFFER EvalInputBuff = Irp->AssociatedIrp.SystemBuffer;
93  PACPI_EVAL_OUTPUT_BUFFER OutputBuf;
97  CHAR MethodName[5];
98 
99  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG))
101 
102  Signature = *((PULONG)Irp->AssociatedIrp.SystemBuffer);
103 
104  switch (Signature)
105  {
107  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ACPI_EVAL_INPUT_BUFFER))
109 
110  ParamList.Count = 0;
111  break;
112 
114  SimpleInt = Irp->AssociatedIrp.SystemBuffer;
115 
116  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER))
118 
119  ParamList.Count = 1;
120 
121  ParamList.Pointer = ExAllocatePoolWithTag(NonPagedPool, sizeof(ACPI_OBJECT), 'OpcA');
122  if (!ParamList.Pointer) return STATUS_INSUFFICIENT_RESOURCES;
123 
124  ParamList.Pointer[0].Type = ACPI_TYPE_INTEGER;
125  ParamList.Pointer[0].Integer.Value = SimpleInt->IntegerArgument;
126  break;
127 
129  SimpleStr = Irp->AssociatedIrp.SystemBuffer;
130 
131  if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING))
133 
134  ParamList.Count = 1;
135 
136  ParamList.Pointer = ExAllocatePoolWithTag(NonPagedPool, sizeof(ACPI_OBJECT), 'OpcA');
137  if (!ParamList.Pointer) return STATUS_INSUFFICIENT_RESOURCES;
138 
139  ParamList.Pointer[0].String.Pointer = (CHAR*)SimpleStr->String;
140  ParamList.Pointer[0].String.Length = SimpleStr->StringLength;
141  break;
142 
143  default:
144  DPRINT1("Unsupported input buffer signature: %d\n", Signature);
145  return STATUS_NOT_IMPLEMENTED;
146  }
147 
148  RtlCopyMemory(MethodName,
149  EvalInputBuff->MethodName,
150  sizeof(EvalInputBuff->MethodName));
151  MethodName[4] = ANSI_NULL;
152  Status = AcpiEvaluateObject(DeviceData->AcpiHandle,
153  MethodName,
154  &ParamList,
155  &RetBuff);
156 
157  if (ParamList.Count != 0)
158  ExFreePoolWithTag(ParamList.Pointer, 'OpcA');
159 
160  if (ACPI_SUCCESS(Status))
161  {
162  ACPI_OBJECT *Obj = RetBuff.Pointer;
163  ULONG ExtraParamLength = 0;
164  ULONG Count = 1;
165 
166  /* If we didn't get anything back then we're done */
167  if (!RetBuff.Pointer || RetBuff.Length == 0)
168  return STATUS_SUCCESS;
169 
170  switch (Obj->Type)
171  {
172  case ACPI_TYPE_INTEGER:
173  ExtraParamLength = sizeof(ACPI_METHOD_ARGUMENT);
174  break;
175 
176  case ACPI_TYPE_STRING:
177  ExtraParamLength = sizeof(ACPI_METHOD_ARGUMENT);
178  if (Obj->String.Length + 1 > sizeof(ULONG))
179  ExtraParamLength += Obj->String.Length + 1 - sizeof(ULONG);
180  break;
181 
182  case ACPI_TYPE_BUFFER:
183  ExtraParamLength = sizeof(ACPI_METHOD_ARGUMENT);
184  if (Obj->Buffer.Length > sizeof(ULONG))
185  ExtraParamLength += Obj->Buffer.Length + 1 - sizeof(ULONG);
186  break;
187 
188  case ACPI_TYPE_PACKAGE:
189  Status = GetPackageSize(Obj, &Count, &ExtraParamLength);
190  if (!NT_SUCCESS(Status))
191  return Status;
192  break;
193 
194  default:
195  ASSERT(FALSE);
196  return STATUS_UNSUCCESSFUL;
197  }
198 
199  DPRINT("ExtraParamLength %lu\n", ExtraParamLength);
201  sizeof(ACPI_EVAL_OUTPUT_BUFFER) - sizeof(ACPI_METHOD_ARGUMENT) + ExtraParamLength,
202  'BpcA');
203  if (!OutputBuf)
205 
206  OutputBuf->Signature = ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE;
207  OutputBuf->Length = ExtraParamLength;
208  OutputBuf->Count = Count;
209 
210  switch (Obj->Type)
211  {
212  case ACPI_TYPE_INTEGER:
213  ACPI_METHOD_SET_ARGUMENT_INTEGER(OutputBuf->Argument, Obj->Integer.Value);
214  break;
215 
216  case ACPI_TYPE_STRING:
217  ACPI_METHOD_SET_ARGUMENT_STRING(OutputBuf->Argument, Obj->String.Pointer);
218  break;
219 
220  case ACPI_TYPE_BUFFER:
221  ACPI_METHOD_SET_ARGUMENT_BUFFER(OutputBuf->Argument, Obj->Buffer.Pointer, Obj->Buffer.Length);
222  break;
223 
224  case ACPI_TYPE_PACKAGE:
225  Status = ConvertPackageArguments(OutputBuf->Argument, Obj);
226  if (!NT_SUCCESS(Status))
227  return Status;
228  break;
229 
230  default:
231  ASSERT(FALSE);
232  return STATUS_UNSUCCESSFUL;
233  }
234 
235  if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength >= sizeof(ACPI_EVAL_OUTPUT_BUFFER) - sizeof(ACPI_METHOD_ARGUMENT) +
236  ExtraParamLength)
237  {
238  RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, OutputBuf, sizeof(ACPI_EVAL_OUTPUT_BUFFER) - sizeof(ACPI_METHOD_ARGUMENT) +
239  ExtraParamLength);
240  Irp->IoStatus.Information = sizeof(ACPI_EVAL_OUTPUT_BUFFER) - sizeof(ACPI_METHOD_ARGUMENT) + ExtraParamLength;
241  ExFreePoolWithTag(OutputBuf, 'BpcA');
242  return STATUS_SUCCESS;
243  }
244  else
245  {
246  ExFreePoolWithTag(OutputBuf, 'BpcA');
248  }
249  }
250  else
251  {
252  DPRINT1("Query method %4s failed on %p\n", EvalInputBuff->MethodName, DeviceData->AcpiHandle);
253  return STATUS_UNSUCCESSFUL;
254  }
255 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define ACPI_METHOD_SET_ARGUMENT_BUFFER(Argument, BuffData, BuffLength)
Definition: acpiioct.h:165
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
ACPI_EVAL_OUTPUT_BUFFER UNALIGNED * PACPI_EVAL_OUTPUT_BUFFER
Definition: acpiioct.h:90
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE
Definition: acpiioct.h:9
ACPI_SIZE Length
Definition: actypes.h:1042
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
struct acpi_object::@600 Integer
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
void * Pointer
Definition: actypes.h:1043
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE
Definition: acpiioct.h:8
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
#define ANSI_NULL
static NTSTATUS GetPackageSize(ACPI_OBJECT *Package, PULONG Count, PULONG Size)
Definition: eval.c:8
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE
Definition: acpiioct.h:11
struct _ACPI_METHOD_ARGUMENT ACPI_METHOD_ARGUMENT
#define ACPI_ALLOCATE_BUFFER
Definition: actypes.h:1035
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static NTSTATUS ConvertPackageArguments(ACPI_METHOD_ARGUMENT *Argument, ACPI_OBJECT *Package)
Definition: eval.c:50
#define ACPI_METHOD_SET_ARGUMENT_STRING(Argument, StrData)
Definition: acpiioct.h:160
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ACPI_METHOD_SET_ARGUMENT_INTEGER(MethodArgument, IntData)
Definition: acpiioct.h:155
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE
Definition: acpiioct.h:7
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
Definition: nsxfeval.c:217
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
unsigned int * PULONG
Definition: retypes.h:1
ACPI_OBJECT * Pointer
Definition: actypes.h:1018
#define DPRINT1
Definition: precomp.h:8
struct acpi_object::@601 String
unsigned int ULONG
Definition: retypes.h:1
struct _ACPI_EVAL_OUTPUT_BUFFER ACPI_EVAL_OUTPUT_BUFFER
#define ACPI_TYPE_STRING
Definition: actypes.h:680
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
ACPI_OBJECT_TYPE Type
Definition: actypes.h:959
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
static const WCHAR Signature[]
Definition: parser.c:141

Referenced by ACPIDispatchDeviceControl().

◆ Bus_PDO_PnP()

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

Definition at line 22 of file buspdo.c.

28 {
31  struct acpi_device *device = NULL;
32 
33  PAGED_CODE ();
34 
35  if (DeviceData->AcpiHandle)
36  acpi_bus_get_device(DeviceData->AcpiHandle, &device);
37 
38  //
39  // NB: Because we are a bus enumerator, we have no one to whom we could
40  // defer these irps. Therefore we do not pass them down but merely
41  // return them.
42  //
43 
44  switch (IrpStack->MinorFunction) {
45 
47  //
48  // Here we do what ever initialization and ``turning on'' that is
49  // required to allow others to access this device.
50  // Power up the device.
51  //
52  if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
54  {
55  DPRINT1("Device %x failed to start!\n", DeviceData->AcpiHandle);
57  break;
58  }
59 
60  DeviceData->InterfaceName.Length = 0;
62 
63  if (!device)
64  {
66  &GUID_DEVICE_SYS_BUTTON,
67  NULL,
68  &DeviceData->InterfaceName);
69  }
70  else if (device->flags.hardware_id &&
71  strstr(device->pnp.hardware_id, ACPI_THERMAL_HID))
72  {
74  &GUID_DEVICE_THERMAL_ZONE,
75  NULL,
76  &DeviceData->InterfaceName);
77  }
78  else if (device->flags.hardware_id &&
79  strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID))
80  {
82  &GUID_DEVICE_LID,
83  NULL,
84  &DeviceData->InterfaceName);
85  }
86  else if (device->flags.hardware_id &&
87  strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))
88  {
90  &GUID_DEVICE_PROCESSOR,
91  NULL,
92  &DeviceData->InterfaceName);
93  }
94 
95  /* Failure to register an interface is not a fatal failure so don't return a failure status */
96  if (NT_SUCCESS(status) && DeviceData->InterfaceName.Length != 0)
97  IoSetDeviceInterfaceState(&DeviceData->InterfaceName, TRUE);
98 
99  state.DeviceState = PowerDeviceD0;
101  DeviceData->Common.DevicePowerState = PowerDeviceD0;
104  break;
105 
106  case IRP_MN_STOP_DEVICE:
107 
108  if (DeviceData->InterfaceName.Length != 0)
109  IoSetDeviceInterfaceState(&DeviceData->InterfaceName, FALSE);
110 
111  //
112  // Here we shut down the device and give up and unmap any resources
113  // we acquired for the device.
114  //
115  if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
117  {
118  DPRINT1("Device %x failed to stop!\n", DeviceData->AcpiHandle);
120  break;
121  }
122 
123  state.DeviceState = PowerDeviceD3;
125  DeviceData->Common.DevicePowerState = PowerDeviceD3;
128  break;
129 
130 
132 
133  //
134  // No reason here why we can't stop the device.
135  // If there were a reason we should speak now, because answering success
136  // here may result in a stop device irp.
137  //
138 
141  break;
142 
144 
145  //
146  // The stop was canceled. Whatever state we set, or resources we put
147  // on hold in anticipation of the forthcoming STOP device IRP should be
148  // put back to normal. Someone, in the long list of concerned parties,
149  // has failed the stop device query.
150  //
151 
152  //
153  // First check to see whether you have received cancel-stop
154  // without first receiving a query-stop. This could happen if someone
155  // above us fails a query-stop and passes down the subsequent
156  // cancel-stop.
157  //
158 
159  if (StopPending == DeviceData->Common.DevicePnPState)
160  {
161  //
162  // We did receive a query-stop, so restore.
163  //
165  }
166  status = STATUS_SUCCESS;// We must not fail this IRP.
167  break;
168 
170  //
171  // We handle REMOVE_DEVICE just like STOP_DEVICE. This is because
172  // the device is still physically present (or at least we don't know any better)
173  // so we have to retain the PDO after stopping and removing power from it.
174  //
175  if (DeviceData->InterfaceName.Length != 0)
176  IoSetDeviceInterfaceState(&DeviceData->InterfaceName, FALSE);
177 
178  if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
180  {
181  DPRINT1("Device %x failed to enter D3!\n", DeviceData->AcpiHandle);
182  state.DeviceState = PowerDeviceD3;
184  DeviceData->Common.DevicePowerState = PowerDeviceD3;
185  }
186 
189  break;
190 
194  break;
195 
197  if (RemovalPending == DeviceData->Common.DevicePnPState)
198  {
200  }
202  break;
203 
205 
206  //
207  // Return the capabilities of a device, such as whether the device
208  // can be locked or ejected..etc
209  //
210 
212 
213  break;
214 
215  case IRP_MN_QUERY_ID:
216 
217  // Query the IDs of the device
219 
220  break;
221 
223 
224  DPRINT("\tQueryDeviceRelation Type: %s\n",DbgDeviceRelationString(\
225  IrpStack->Parameters.QueryDeviceRelations.Type));
226 
228 
229  break;
230 
232 
234 
235  break;
236 
238 
240 
241  break;
242 
244 
246 
247  break;
248 
250 
252 
253  break;
254 
256 
258 
259  break;
260 
261 
263 
264  //
265  // OPTIONAL for bus drivers.
266  // The PnP Manager sends this IRP to a device
267  // stack so filter and function drivers can adjust the
268  // resources required by the device, if appropriate.
269  //
270 
271  //break;
272 
273  //case IRP_MN_QUERY_PNP_DEVICE_STATE:
274 
275  //
276  // OPTIONAL for bus drivers.
277  // The PnP Manager sends this IRP after the drivers for
278  // a device return success from the IRP_MN_START_DEVICE
279  // request. The PnP Manager also sends this IRP when a
280  // driver for the device calls IoInvalidateDeviceState.
281  //
282 
283  // break;
284 
285  //case IRP_MN_READ_CONFIG:
286  //case IRP_MN_WRITE_CONFIG:
287 
288  //
289  // Bus drivers for buses with configuration space must handle
290  // this request for their child devices. Our devices don't
291  // have a config space.
292  //
293 
294  // break;
295 
296  //case IRP_MN_SET_LOCK:
297 
298  // break;
299 
300  default:
301 
302  //
303  // For PnP requests to the PDO that we do not understand we should
304  // return the IRP WITHOUT setting the status or information fields.
305  // These fields may have already been set by a filter (eg acpi).
306  status = Irp->IoStatus.Status;
307 
308  break;
309  }
310 
311  Irp->IoStatus.Status = status;
313 
314  return status;
315 }
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define TRUE
Definition: types.h:120
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_ID
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
NTSTATUS Bus_PDO_QueryResources(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:793
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN acpi_bus_power_manageable(ACPI_HANDLE handle)
Definition: bus.c:351
NTSTATUS Bus_PDO_QueryResourceRequirements(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1299
#define PAGED_CODE()
Definition: video.h:57
#define ACPI_PROCESSOR_HID
Definition: acpi_drivers.h:221
#define IRP_MN_QUERY_REMOVE_DEVICE
Definition: devices.h:37
#define ACPI_THERMAL_HID
Definition: acpi_drivers.h:266
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
Definition: fbtusb.h:81
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RESTORE_PREVIOUS_PNP_STATE(_Data_)
Definition: fbtusb.h:115
NTSTATUS Bus_PDO_QueryDeviceId(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:432
NTSTATUS Bus_PDO_QueryDeviceRelations(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1800
#define IRP_MN_START_DEVICE
NTSTATUS Bus_PDO_QueryDeviceText(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:680
#define ACPI_BUTTON_HID_LID
Definition: acpi_drivers.h:106
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_INTERFACE
#define ACPI_STATE_D3
Definition: actypes.h:627
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IRP_MN_QUERY_BUS_INFORMATION
NTSTATUS Bus_PDO_QueryBusInformation(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1891
static int state
Definition: maze.c:121
int acpi_bus_set_power(ACPI_HANDLE handle, int state)
Definition: bus.c:249
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define DPRINT1
Definition: precomp.h:8
#define SET_NEW_PNP_STATE(_Data_, _state_)
Definition: fbtusb.h:111
#define ACPI_STATE_D0
Definition: actypes.h:624
#define IO_NO_INCREMENT
Definition: iotypes.h:566
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:597
NTSTATUS Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: interface.c:94
#define IRP_MN_CANCEL_STOP_DEVICE
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS Bus_PDO_QueryDeviceCaps(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:318
PCHAR DbgDeviceRelationString(DEVICE_RELATION_TYPE Type)
#define IRP_MN_QUERY_CAPABILITIES
Definition: ps.c:97

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 
194  case IRP_MN_QUERY_POWER:
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 
209  if (status != STATUS_NOT_SUPPORTED) {
210 
211  Irp->IoStatus.Status = status;
212  }
213 
215  status = Irp->IoStatus.Status;
217 
218  return status;
219 }
enum _POWER_STATE_TYPE POWER_STATE_TYPE
DEVICE_POWER_STATE DevicePowerState
Definition: acpisys.h:33
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define error(str)
Definition: mkdosfs.c:1605
#define IRP_MN_POWER_SEQUENCE
#define IRP_MN_QUERY_POWER
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN acpi_bus_power_manageable(ACPI_HANDLE handle)
Definition: bus.c:351
static stack_node_t * stack
Definition: rpn_ieee.c:37
PDEVICE_OBJECT Self
Definition: acpisys.h:28
SYSTEM_POWER_STATE SystemState
Definition: ntpoapi.h:57
SYSTEM_POWER_STATE SystemPowerState
Definition: acpisys.h:32
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
Definition: _stack.h:47
DEVICE_POWER_STATE DeviceState
Definition: ntpoapi.h:58
#define ACPI_STATE_D3
Definition: actypes.h:627
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define IRP_MN_SET_POWER
PCHAR DbgSystemPowerString(SYSTEM_POWER_STATE Type)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
int acpi_bus_set_power(ACPI_HANDLE handle, int state)
Definition: bus.c:249
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
ACPI_HANDLE AcpiHandle
Definition: acpisys.h:39
#define ACPI_STATE_D0
Definition: actypes.h:624
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:597
#define IRP_MN_WAIT_WAKE
#define ACPI_STATE_D1
Definition: actypes.h:625
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
#define ACPI_STATE_D2
Definition: actypes.h:626
COMMON_DEVICE_DATA Common
Definition: acpisys.h:38
PCHAR DbgDevicePowerString(DEVICE_POWER_STATE Type)
Definition: ps.c:97

Referenced by Bus_Power().

◆ Bus_PDO_QueryBusInformation()

NTSTATUS Bus_PDO_QueryBusInformation ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1891 of file buspdo.c.

1912 {
1913 
1914  PPNP_BUS_INFORMATION busInfo;
1915 
1916  PAGED_CODE ();
1917 
1918  busInfo = ExAllocatePoolWithTag(PagedPool,
1919  sizeof(PNP_BUS_INFORMATION),
1920  'IpcA');
1921 
1922  if (busInfo == NULL) {
1924  }
1925 
1926  busInfo->BusTypeGuid = GUID_ACPI_INTERFACE_STANDARD;
1927 
1928  busInfo->LegacyBusType = InternalPowerBus;
1929 
1930  busInfo->BusNumber = 0; //fixme
1931 
1932  Irp->IoStatus.Information = (ULONG_PTR)busInfo;
1933 
1934  return STATUS_SUCCESS;
1935 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ULONG_PTR
Definition: config.h:101
return STATUS_SUCCESS
Definition: btrfs.c:2966
INTERFACE_TYPE LegacyBusType
Definition: cmtypes.h:363

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceCaps()

NTSTATUS Bus_PDO_QueryDeviceCaps ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 318 of file buspdo.c.

321 {
322 
324  PDEVICE_CAPABILITIES deviceCapabilities;
325  struct acpi_device *device = NULL;
326  ULONG i;
327 
328  PAGED_CODE ();
329 
330  if (DeviceData->AcpiHandle)
331  acpi_bus_get_device(DeviceData->AcpiHandle, &device);
332 
334 
335  //
336  // Get the packet.
337  //
338  deviceCapabilities=stack->Parameters.DeviceCapabilities.Capabilities;
339 
340  //
341  // Set the capabilities.
342  //
343 
344  if (deviceCapabilities->Version != 1 ||
345  deviceCapabilities->Size < sizeof(DEVICE_CAPABILITIES))
346  {
347  return STATUS_UNSUCCESSFUL;
348  }
349 
350  deviceCapabilities->D1Latency = 0;
351  deviceCapabilities->D2Latency = 0;
352  deviceCapabilities->D3Latency = 0;
353 
354  deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
355  deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD3;
356  deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD3;
357  deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
358 
359  for (i = 0; i < ACPI_D_STATE_COUNT && device; i++)
360  {
361  if (!device->power.states[i].flags.valid)
362  continue;
363 
364  switch (i)
365  {
366  case ACPI_STATE_D0:
367  deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
368  break;
369 
370  case ACPI_STATE_D1:
371  deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD1;
372  deviceCapabilities->D1Latency = device->power.states[i].latency;
373  break;
374 
375  case ACPI_STATE_D2:
376  deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD2;
377  deviceCapabilities->D2Latency = device->power.states[i].latency;
378  break;
379 
380  case ACPI_STATE_D3:
381  deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
382  deviceCapabilities->D3Latency = device->power.states[i].latency;
383  break;
384  }
385  }
386 
387  // We can wake the system from D1
388  deviceCapabilities->DeviceWake = PowerDeviceD1;
389 
390 
391  deviceCapabilities->DeviceD1 =
392  (deviceCapabilities->DeviceState[PowerSystemSleeping1] == PowerDeviceD1) ? TRUE : FALSE;
393  deviceCapabilities->DeviceD2 =
394  (deviceCapabilities->DeviceState[PowerSystemSleeping2] == PowerDeviceD2) ? TRUE : FALSE;
395 
396  deviceCapabilities->WakeFromD0 = FALSE;
397  deviceCapabilities->WakeFromD1 = TRUE; //Yes we can
398  deviceCapabilities->WakeFromD2 = FALSE;
399  deviceCapabilities->WakeFromD3 = FALSE;
400 
401  if (device)
402  {
403  deviceCapabilities->LockSupported = device->flags.lockable;
404  deviceCapabilities->EjectSupported = device->flags.ejectable;
405  deviceCapabilities->HardwareDisabled = !device->status.enabled && !device->status.functional;
406  deviceCapabilities->Removable = device->flags.removable;
407  deviceCapabilities->SurpriseRemovalOK = device->flags.surprise_removal_ok;
408  deviceCapabilities->UniqueID = device->flags.unique_id;
409  deviceCapabilities->NoDisplayInUI = !device->status.show_in_ui;
410  deviceCapabilities->Address = device->pnp.bus_address;
411  }
412 
413  if (!device ||
414  (device->flags.hardware_id &&
415  (strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID) ||
416  strstr(device->pnp.hardware_id, ACPI_THERMAL_HID) ||
417  strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))))
418  {
419  /* Allow ACPI to control the device if it is a lid button,
420  * a thermal zone, a processor, or a fixed feature button */
421  deviceCapabilities->RawDeviceOK = TRUE;
422  }
423 
424  deviceCapabilities->SilentInstall = FALSE;
425  deviceCapabilities->UINumber = (ULONG)-1;
426 
427  return STATUS_SUCCESS;
428 
429 }
#define TRUE
Definition: types.h:120
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
_In_ PIRP Irp
Definition: csq.h:116
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
DEVICE_CAPABILITIES
Definition: iotypes.h:928
static stack_node_t * stack
Definition: rpn_ieee.c:37
#define PAGED_CODE()
Definition: video.h:57
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
#define ACPI_PROCESSOR_HID
Definition: acpi_drivers.h:221
Definition: devices.h:37
#define ACPI_THERMAL_HID
Definition: acpi_drivers.h:266
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_D_STATE_COUNT
Definition: actypes.h:629
Definition: _stack.h:47
bool removable
Definition: btrfs_drv.h:515
#define ACPI_BUTTON_HID_LID
Definition: acpi_drivers.h:106
#define ACPI_STATE_D3
Definition: actypes.h:627
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
* PDEVICE_CAPABILITIES
Definition: iotypes.h:928
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define ACPI_STATE_D0
Definition: actypes.h:624
unsigned int ULONG
Definition: retypes.h:1
#define ACPI_STATE_D1
Definition: actypes.h:625
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ACPI_STATE_D2
Definition: actypes.h:626

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceId()

NTSTATUS Bus_PDO_QueryDeviceId ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 432 of file buspdo.c.

435 {
437  PWCHAR buffer, src;
438  WCHAR temp[256];
439  ULONG length, i;
441  struct acpi_device *Device;
442 
443  PAGED_CODE ();
444 
446 
447  switch (stack->Parameters.QueryId.IdType) {
448 
449  case BusQueryDeviceID:
450 
451  /* This is a REG_SZ value */
452 
453  if (DeviceData->AcpiHandle)
454  {
455  acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
456 
457  if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
458  {
461  }
462  else
463  {
464  length = swprintf(temp,
465  L"ACPI\\%hs",
466  Device->pnp.hardware_id);
467  }
468  }
469  else
470  {
471  /* We know it's a fixed feature button because
472  * these are direct children of the ACPI root device
473  * and therefore have no handle
474  */
475  length = swprintf(temp,
476  L"ACPI\\FixedButton");
477  }
478 
479  temp[length++] = UNICODE_NULL;
480 
481  NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
482 
483  buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
484 
485  if (!buffer) {
487  break;
488  }
489 
490  RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
491  Irp->IoStatus.Information = (ULONG_PTR) buffer;
492  DPRINT("BusQueryDeviceID: %ls\n",buffer);
493  break;
494 
495  case BusQueryInstanceID:
496 
497  /* This is a REG_SZ value */
498 
499  /* See comment in BusQueryDeviceID case */
500  if(DeviceData->AcpiHandle)
501  {
502  acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
503 
504  if (Device->flags.unique_id)
505  length = swprintf(temp,
506  L"%hs",
507  Device->pnp.unique_id);
508  else
509  /* FIXME: Generate unique id! */
510  length = swprintf(temp, L"%ls", L"0");
511  }
512  else
513  {
514  /* FIXME: Generate unique id! */
515  length = swprintf(temp, L"%ls", L"0");
516  }
517 
518  temp[length++] = UNICODE_NULL;
519 
520  NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
521 
522  buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
523  if (!buffer) {
525  break;
526  }
527 
528  RtlCopyMemory (buffer, temp, length * sizeof (WCHAR));
529  DPRINT("BusQueryInstanceID: %ls\n",buffer);
530  Irp->IoStatus.Information = (ULONG_PTR) buffer;
531  break;
532 
533  case BusQueryHardwareIDs:
534 
535  /* This is a REG_MULTI_SZ value */
536  length = 0;
538 
539  /* See comment in BusQueryDeviceID case */
540  if (DeviceData->AcpiHandle)
541  {
542  acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
543 
544  if (!Device->flags.hardware_id)
545  {
546  /* We don't have the ID to satisfy this request */
547  break;
548  }
549 
550  DPRINT("Device name: %s\n", Device->pnp.device_name);
551  DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
552 
553  if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
554  {
557  }
558  else
559  {
560  length += swprintf(&temp[length],
561  L"ACPI\\%hs",
562  Device->pnp.hardware_id);
563  temp[length++] = UNICODE_NULL;
564 
565  length += swprintf(&temp[length],
566  L"*%hs",
567  Device->pnp.hardware_id);
568  temp[length++] = UNICODE_NULL;
569  temp[length++] = UNICODE_NULL;
570  src = temp;
571  }
572  }
573  else
574  {
575  length += swprintf(&temp[length],
576  L"ACPI\\FixedButton");
577  temp[length++] = UNICODE_NULL;
578 
579  length += swprintf(&temp[length],
580  L"*FixedButton");
581  temp[length++] = UNICODE_NULL;
582  temp[length++] = UNICODE_NULL;
583  src = temp;
584  }
585 
586  NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
587 
588  buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
589 
590  if (!buffer) {
592  break;
593  }
594 
595  RtlCopyMemory (buffer, src, length * sizeof(WCHAR));
596  Irp->IoStatus.Information = (ULONG_PTR) buffer;
597  DPRINT("BusQueryHardwareIDs: %ls\n",buffer);
599  break;
600 
602 
603  /* This is a REG_MULTI_SZ value */
604  length = 0;
606 
607  /* See comment in BusQueryDeviceID case */
608  if (DeviceData->AcpiHandle)
609  {
610  acpi_bus_get_device(DeviceData->AcpiHandle, &Device);
611 
612  if (!Device->flags.hardware_id)
613  {
614  /* We don't have the ID to satisfy this request */
615  break;
616  }
617 
618  DPRINT("Device name: %s\n", Device->pnp.device_name);
619  DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
620 
621  if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
622  {
623  length += swprintf(&temp[length],
624  L"ACPI\\%hs",
625  Device->pnp.hardware_id);
626  temp[length++] = UNICODE_NULL;
627 
628  length += swprintf(&temp[length],
629  L"*%hs",
630  Device->pnp.hardware_id);
631  temp[length++] = UNICODE_NULL;
632  temp[length++] = UNICODE_NULL;
633  }
634  else if (Device->flags.compatible_ids)
635  {
636  for (i = 0; i < Device->pnp.cid_list->Count; i++)
637  {
638  length += swprintf(&temp[length],
639  L"ACPI\\%hs",
640  Device->pnp.cid_list->Ids[i].String);
641  temp[length++] = UNICODE_NULL;
642 
643  length += swprintf(&temp[length],
644  L"*%hs",
645  Device->pnp.cid_list->Ids[i].String);
646  temp[length++] = UNICODE_NULL;
647  }
648 
649  temp[length++] = UNICODE_NULL;
650  }
651  else
652  {
653  /* No compatible IDs */
654  break;
655  }
656 
657  NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
658 
659  buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
660  if (!buffer)
661  {
663  break;
664  }
665 
666  RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
667  Irp->IoStatus.Information = (ULONG_PTR) buffer;
668  DPRINT("BusQueryCompatibleIDs: %ls\n",buffer);
670  }
671  break;
672 
673  default:
674  status = Irp->IoStatus.Status;
675  }
676  return status;
677 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2020
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
GLuint buffer
Definition: glext.h:5915
static stack_node_t * stack
Definition: rpn_ieee.c:37
uint16_t * PWCHAR
Definition: typedefs.h:54
#define PAGED_CODE()
Definition: video.h:57
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
#define UNICODE_NULL
void DPRINT(...)
Definition: polytest.cpp:61
Definition: _stack.h:47
LPWSTR ProcessorIdString
Definition: main.c:25
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
GLenum src
Definition: glext.h:6340
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
static calc_node_t temp
Definition: rpn_ieee.c:38
UNICODE_STRING ProcessorHardwareIds
Definition: main.c:24
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ULONG_PTR
Definition: config.h:101
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define NT_ASSERT
Definition: rtlfuncs.h:3312
Definition: ps.c:97

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceRelations()

NTSTATUS Bus_PDO_QueryDeviceRelations ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1800 of file buspdo.c.

1834 {
1835 
1837  PDEVICE_RELATIONS deviceRelations;
1838  NTSTATUS status;
1839 
1840  PAGED_CODE ();
1841 
1843 
1844  switch (stack->Parameters.QueryDeviceRelations.Type) {
1845 
1846  case TargetDeviceRelation:
1847 
1848  deviceRelations = (PDEVICE_RELATIONS) Irp->IoStatus.Information;
1849  if (deviceRelations) {
1850  //
1851  // Only PDO can handle this request. Somebody above
1852  // is not playing by rule.
1853  //
1854  ASSERTMSG("Someone above is handling TargetDeviceRelation\n", !deviceRelations);
1855  }
1856 
1857  deviceRelations = ExAllocatePoolWithTag(PagedPool,
1858  sizeof(DEVICE_RELATIONS),
1859  'IpcA');
1860  if (!deviceRelations) {
1862  break;
1863  }
1864 
1865  //
1866  // There is only one PDO pointer in the structure
1867  // for this relation type. The PnP Manager removes
1868  // the reference to the PDO when the driver or application
1869  // un-registers for notification on the device.
1870  //
1871 
1872  deviceRelations->Count = 1;
1873  deviceRelations->Objects[0] = DeviceData->Common.Self;
1874  ObReferenceObject(DeviceData->Common.Self);
1875 
1877  Irp->IoStatus.Information = (ULONG_PTR) deviceRelations;
1878  break;
1879 
1880  case BusRelations: // Not handled by PDO
1881  case EjectionRelations: // optional for PDO
1882  case RemovalRelations: // // optional for PDO
1883  default:
1884  status = Irp->IoStatus.Status;
1885  }
1886 
1887  return status;
1888 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2055
LONG NTSTATUS
Definition: precomp.h:26
static stack_node_t * stack
Definition: rpn_ieee.c:37
#define PAGED_CODE()
Definition: video.h:57
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
Definition: _stack.h:47
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define ObReferenceObject
Definition: obfuncs.h:204
#define ULONG_PTR
Definition: config.h:101
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryDeviceText()

NTSTATUS Bus_PDO_QueryDeviceText ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 680 of file buspdo.c.

683 {
684  PWCHAR Buffer, Temp;
686  NTSTATUS status = Irp->IoStatus.Status;
687  PAGED_CODE ();
688 
690 
691  switch (stack->Parameters.QueryDeviceText.DeviceTextType) {
692 
694 
695  if (!Irp->IoStatus.Information) {
696  if (wcsstr (DeviceData->HardwareIDs, L"PNP000") != 0)
697  Temp = L"Programmable interrupt controller";
698  else if (wcsstr(DeviceData->HardwareIDs, L"PNP010") != 0)
699  Temp = L"System timer";
700  else if (wcsstr(DeviceData->HardwareIDs, L"PNP020") != 0)
701  Temp = L"DMA controller";
702  else if (wcsstr(DeviceData->HardwareIDs, L"PNP03") != 0)
703  Temp = L"Keyboard";
704  else if (wcsstr(DeviceData->HardwareIDs, L"PNP040") != 0)
705  Temp = L"Parallel port";
706  else if (wcsstr(DeviceData->HardwareIDs, L"PNP05") != 0)
707  Temp = L"Serial port";
708  else if (wcsstr(DeviceData->HardwareIDs, L"PNP06") != 0)
709  Temp = L"Disk controller";
710  else if (wcsstr(DeviceData->HardwareIDs, L"PNP07") != 0)
711  Temp = L"Disk controller";
712  else if (wcsstr(DeviceData->HardwareIDs, L"PNP09") != 0)
713  Temp = L"Display adapter";
714  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A0") != 0)
715  Temp = L"Bus controller";
716  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0E0") != 0)
717  Temp = L"PCMCIA controller";
718  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0F") != 0)
719  Temp = L"Mouse device";
720  else if (wcsstr(DeviceData->HardwareIDs, L"PNP8") != 0)
721  Temp = L"Network adapter";
722  else if (wcsstr(DeviceData->HardwareIDs, L"PNPA0") != 0)
723  Temp = L"SCSI controller";
724  else if (wcsstr(DeviceData->HardwareIDs, L"PNPB0") != 0)
725  Temp = L"Multimedia device";
726  else if (wcsstr(DeviceData->HardwareIDs, L"PNPC00") != 0)
727  Temp = L"Modem";
728  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0C") != 0)
729  Temp = L"Power Button";
730  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0E") != 0)
731  Temp = L"Sleep Button";
732  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0D") != 0)
733  Temp = L"Lid Switch";
734  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C09") != 0)
735  Temp = L"ACPI Embedded Controller";
736  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0B") != 0)
737  Temp = L"ACPI Fan";
738  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
739  wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
740  Temp = L"PCI Root Bridge";
741  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0A") != 0)
742  Temp = L"ACPI Battery";
743  else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0F") != 0)
744  Temp = L"PCI Interrupt Link";
745  else if (wcsstr(DeviceData->HardwareIDs, L"ACPI_PWR") != 0)
746  Temp = L"ACPI Power Resource";
747  else if (wcsstr(DeviceData->HardwareIDs, L"Processor") != 0)
748  {
749  if (ProcessorNameString != NULL)
750  Temp = ProcessorNameString;
751  else
752  Temp = L"Processor";
753  }
754  else if (wcsstr(DeviceData->HardwareIDs, L"ThermalZone") != 0)
755  Temp = L"ACPI Thermal Zone";
756  else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0002") != 0)
757  Temp = L"Smart Battery";
758  else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0003") != 0)
759  Temp = L"AC Adapter";
760  /* Simply checking if AcpiHandle is NULL eliminates the need to check
761  * for the 4 different names that ACPI knows the fixed feature button as internally
762  */
763  else if (!DeviceData->AcpiHandle)
764  Temp = L"ACPI Fixed Feature Button";
765  else
766  Temp = L"Other ACPI device";
767 
768  Buffer = ExAllocatePoolWithTag(PagedPool, (wcslen(Temp) + 1) * sizeof(WCHAR), 'IpcA');
769 
770  if (!Buffer) {
772  break;
773  }
774 
775  RtlCopyMemory (Buffer, Temp, (wcslen(Temp) + 1) * sizeof(WCHAR));
776 
777  DPRINT("\tDeviceTextDescription :%ws\n", Buffer);
778 
779  Irp->IoStatus.Information = (ULONG_PTR) Buffer;
781  }
782  break;
783 
784  default:
785  break;
786  }
787 
788  return status;
789 
790 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIRP Irp
Definition: csq.h:116
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
LONG NTSTATUS
Definition: precomp.h:26
static stack_node_t * stack
Definition: rpn_ieee.c:37
uint16_t * PWCHAR
Definition: typedefs.h:54
#define PAGED_CODE()
Definition: video.h:57
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
Definition: _stack.h:47
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
LPWSTR ProcessorNameString
Definition: main.c:26
static const WCHAR L[]
Definition: oid.c:1250
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define ULONG_PTR
Definition: config.h:101
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
static SERVICE_STATUS status
Definition: service.c:31
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
Definition: ps.c:97

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",
103  IrpSp->Parameters.QueryInterface.Version);
105  }
106 
107  if (RtlCompareMemory(IrpSp->Parameters.QueryInterface.InterfaceType,
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 
124  AcpiInterface->GpeEnableEvent = AcpiInterfaceEnableEvent;
126  AcpiInterface->GpeClearStatus = AcpiInterfaceClearStatus;
129 
130  return STATUS_SUCCESS;
131  }
132  else
133  {
134  DPRINT1("Invalid GUID\n");
135  return STATUS_NOT_SUPPORTED;
136  }
137 }
NTSTATUS NTAPI AcpiInterfaceEnableEvent(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:46
NTSTATUS NTAPI AcpiInterfaceClearStatus(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:66
PGPE_CLEAR_STATUS GpeClearStatus
Definition: iotypes.h:2666
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
VOID NTAPI AcpiInterfaceDereference(PVOID Context)
Definition: interface.c:15
PGPE_DISABLE_EVENT GpeDisableEvent
Definition: iotypes.h:2665
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
NTSTATUS NTAPI AcpiInterfaceNotificationsRegister(PDEVICE_OBJECT Context, PDEVICE_NOTIFY_CALLBACK NotificationHandler, PVOID NotificationContext)
Definition: interface.c:76
PUNREGISTER_FOR_DEVICE_NOTIFICATIONS UnregisterForDeviceNotifications
Definition: iotypes.h:2668
PGPE_DISCONNECT_VECTOR GpeDisconnectVector
Definition: iotypes.h:2663
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI AcpiInterfaceDisconnectVector(PVOID ObjectContext)
Definition: interface.c:37
struct _ACPI_INTERFACE_STANDARD * PACPI_INTERFACE_STANDARD
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:2660
VOID NTAPI AcpiInterfaceNotificationsUnregister(PDEVICE_OBJECT Context, PDEVICE_NOTIFY_CALLBACK NotificationHandler)
Definition: interface.c:87
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
PGPE_ENABLE_EVENT GpeEnableEvent
Definition: iotypes.h:2664
VOID NTAPI AcpiInterfaceReference(PVOID Context)
Definition: interface.c:8
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PREGISTER_FOR_DEVICE_NOTIFICATIONS RegisterForDeviceNotifications
Definition: iotypes.h:2667
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:2661
NTSTATUS NTAPI AcpiInterfaceDisableEvent(PDEVICE_OBJECT Context, PVOID ObjectContext)
Definition: interface.c:56
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
return STATUS_SUCCESS
Definition: btrfs.c:2966
PGPE_CONNECT_VECTOR GpeConnectVector
Definition: iotypes.h:2662
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryResourceRequirements()

NTSTATUS Bus_PDO_QueryResourceRequirements ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 1299 of file buspdo.c.

1302 {
1303  ULONG NumberOfResources = 0;
1304  ACPI_STATUS AcpiStatus;
1307  ULONG i, RequirementsListSize;
1308  PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
1309  PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
1310  BOOLEAN CurrentRes = FALSE;
1311 
1312  PAGED_CODE ();
1313 
1314  if (!DeviceData->AcpiHandle)
1315  {
1316  return Irp->IoStatus.Status;
1317  }
1318 
1319  /* Handle the PCI root manually */
1320  if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
1321  wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
1322  {
1323  return Irp->IoStatus.Status;
1324  }
1325 
1326  /* Get current resources */
1327  while (TRUE)
1328  {
1329  Buffer.Length = 0;
1330  if (CurrentRes)
1331  AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1332  else
1333  AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1334  if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
1335  Buffer.Length == 0)
1336  {
1337  if (!CurrentRes)
1338  CurrentRes = TRUE;
1339  else
1340  return Irp->IoStatus.Status;
1341  }
1342  else
1343  break;
1344  }
1345 
1346  Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
1347  if (!Buffer.Pointer)
1349 
1350  if (CurrentRes)
1351  AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1352  else
1353  AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1354  if (!ACPI_SUCCESS(AcpiStatus))
1355  {
1356  DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
1357  ASSERT(FALSE);
1358  return STATUS_UNSUCCESSFUL;
1359  }
1360 
1361  resource= Buffer.Pointer;
1362  /* Count number of resources */
1363  while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
1364  {
1365  switch (resource->Type)
1366  {
1368  {
1370  if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1371  break;
1372  NumberOfResources += irq_data->InterruptCount;
1373  break;
1374  }
1376  {
1377  ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
1378  NumberOfResources += irq_data->InterruptCount;
1379  break;
1380  }
1382  {
1383  ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1384  NumberOfResources += dma_data->ChannelCount;
1385  break;
1386  }
1391  {
1393  if (res_addr->ProducerConsumer == ACPI_PRODUCER)
1394  break;
1395  NumberOfResources++;
1396  break;
1397  }
1402  case ACPI_RESOURCE_TYPE_IO:
1403  {
1404  NumberOfResources++;
1405  break;
1406  }
1407  default:
1408  {
1409  break;
1410  }
1411  }
1413  }
1414 
1415  RequirementsListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
1416  RequirementsList = ExAllocatePoolWithTag(PagedPool, RequirementsListSize, 'RpcA');
1417 
1418  if (!RequirementsList)
1419  {
1420  ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1422  }
1423  RequirementsList->ListSize = RequirementsListSize;
1424  RequirementsList->InterfaceType = Internal;
1425  RequirementsList->BusNumber = 0;
1426  RequirementsList->SlotNumber = 0; /* Not used by WDM drivers */
1427  RequirementsList->AlternativeLists = 1;
1428  RequirementsList->List[0].Version = 1;
1429  RequirementsList->List[0].Revision = 1;
1430  RequirementsList->List[0].Count = NumberOfResources;
1431  RequirementDescriptor = RequirementsList->List[0].Descriptors;
1432 
1433  /* Fill resources list structure */
1434  resource = Buffer.Pointer;
1436  {
1437  switch (resource->Type)
1438  {
1440  {
1442  if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1443  break;
1444  for (i = 0; i < irq_data->InterruptCount; i++)
1445  {
1446  RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1447  RequirementDescriptor->Type = CmResourceTypeInterrupt;
1450  RequirementDescriptor->u.Interrupt.MinimumVector =
1451  RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1452 
1453  RequirementDescriptor++;
1454  }
1455  break;
1456  }
1458  {
1459  ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
1460  for (i = 0; i < irq_data->InterruptCount; i++)
1461  {
1462  RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1463  RequirementDescriptor->Type = CmResourceTypeInterrupt;
1466  RequirementDescriptor->u.Interrupt.MinimumVector =
1467  RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1468 
1469  RequirementDescriptor++;
1470  }
1471  break;
1472  }
1474  {
1475  ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1476  for (i = 0; i < dma_data->ChannelCount; i++)
1477  {
1478  RequirementDescriptor->Type = CmResourceTypeDma;
1479  RequirementDescriptor->Flags = 0;
1480  switch (dma_data->Type)
1481  {
1482  case ACPI_TYPE_A: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1483  case ACPI_TYPE_B: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1484  case ACPI_TYPE_F: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1485  }
1486  if (dma_data->BusMaster == ACPI_BUS_MASTER)
1487  RequirementDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1488  switch (dma_data->Transfer)
1489  {
1490  case ACPI_TRANSFER_8: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1491  case ACPI_TRANSFER_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1492  case ACPI_TRANSFER_8_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1493  }
1494 
1495  RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1496  RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1497  RequirementDescriptor->u.Dma.MinimumChannel =
1498  RequirementDescriptor->u.Dma.MaximumChannel = dma_data->Channels[i];
1499  RequirementDescriptor++;
1500  }
1501  break;
1502  }
1503  case ACPI_RESOURCE_TYPE_IO:
1504  {
1505  ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &resource->Data;
1506  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1507  if (io_data->IoDecode == ACPI_DECODE_16)
1508  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1509  else
1510  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1511  RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1512  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1513  RequirementDescriptor->Type = CmResourceTypePort;
1514  RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1515  RequirementDescriptor->u.Port.Alignment = io_data->Alignment;
1516  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Minimum;
1517  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum + io_data->AddressLength - 1;
1518 
1519  RequirementDescriptor++;
1520  break;
1521  }
1523  {
1525  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1526  RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1527  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1528  RequirementDescriptor->Type = CmResourceTypePort;
1529  RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1530  RequirementDescriptor->u.Port.Alignment = 1;
1531  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Address;
1532  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Address + io_data->AddressLength - 1;
1533 
1534  RequirementDescriptor++;
1535  break;
1536  }
1538  {
1539  ACPI_RESOURCE_ADDRESS16 *addr16_data = (ACPI_RESOURCE_ADDRESS16*) &resource->Data;
1540  if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1541  break;
1542  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1543  if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1544  {
1545  RequirementDescriptor->Type = CmResourceTypeBusNumber;
1546  RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1547  RequirementDescriptor->Flags = 0;
1548  RequirementDescriptor->u.BusNumber.MinBusNumber = addr16_data->Address.Minimum;
1549  RequirementDescriptor->u.BusNumber.MaxBusNumber = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1550  RequirementDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1551  }
1552  else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1553  {
1554  RequirementDescriptor->Type = CmResourceTypePort;
1555  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1556  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1557  if (addr16_data->Decode == ACPI_POS_DECODE)
1558  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1559  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1560  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1561  RequirementDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1562  }
1563  else
1564  {
1565  RequirementDescriptor->Type = CmResourceTypeMemory;
1566  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1567  RequirementDescriptor->Flags = 0;
1568  if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1569  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1570  else
1571  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1572  switch (addr16_data->Info.Mem.Caching)
1573  {
1574  case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1575  case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1576  case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1577  }
1578  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1579  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1580  RequirementDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1581  }
1582  RequirementDescriptor++;
1583  break;
1584  }
1586  {
1587  ACPI_RESOURCE_ADDRESS32 *addr32_data = (ACPI_RESOURCE_ADDRESS32*) &resource->Data;
1588  if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1589  break;
1590  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1591  if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1592  {
1593  RequirementDescriptor->Type = CmResourceTypeBusNumber;
1594  RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1595  RequirementDescriptor->Flags = 0;
1596  RequirementDescriptor->u.BusNumber.MinBusNumber = addr32_data->Address.Minimum;
1597  RequirementDescriptor->u.BusNumber.MaxBusNumber = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1598  RequirementDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1599  }
1600  else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1601  {
1602  RequirementDescriptor->Type = CmResourceTypePort;
1603  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1604  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1605  if (addr32_data->Decode == ACPI_POS_DECODE)
1606  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1607  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1608  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1609  RequirementDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1610  }
1611  else
1612  {
1613  RequirementDescriptor->Type = CmResourceTypeMemory;
1614  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1615  RequirementDescriptor->Flags = 0;
1616  if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1617  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1618  else
1619  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1620  switch (addr32_data->Info.Mem.Caching)
1621  {
1622  case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1623  case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1624  case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1625  }
1626  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1627  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1628  RequirementDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1629  }
1630  RequirementDescriptor++;
1631  break;
1632  }
1634  {
1635  ACPI_RESOURCE_ADDRESS64 *addr64_data = (ACPI_RESOURCE_ADDRESS64*) &resource->Data;
1636  if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1637  break;
1638  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1639  if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1640  {
1641  DPRINT1("64-bit bus address is not supported!\n");
1642  RequirementDescriptor->Type = CmResourceTypeBusNumber;
1643  RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1644  RequirementDescriptor->Flags = 0;
1645  RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1646  RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1647  RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1648  }
1649  else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1650  {
1651  RequirementDescriptor->Type = CmResourceTypePort;
1652  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1653  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1654  if (addr64_data->Decode == ACPI_POS_DECODE)
1655  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1656  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1657  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1658  RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1659  }
1660  else
1661  {
1662  RequirementDescriptor->Type = CmResourceTypeMemory;
1663  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1664  RequirementDescriptor->Flags = 0;
1665  if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1666  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1667  else
1668  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1669  switch (addr64_data->Info.Mem.Caching)
1670  {
1671  case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1672  case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1673  case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1674  }
1675  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1676  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1677  RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1678  }
1679  RequirementDescriptor++;
1680  break;
1681  }
1683  {
1685  if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1686  break;
1687  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1688  if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1689  {
1690  DPRINT1("64-bit bus address is not supported!\n");
1691  RequirementDescriptor->Type = CmResourceTypeBusNumber;
1692  RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1693  RequirementDescriptor->Flags = 0;
1694  RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1695  RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1696  RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1697  }
1698  else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1699  {
1700  RequirementDescriptor->Type = CmResourceTypePort;
1701  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1702  RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1703  if (addr64_data->Decode == ACPI_POS_DECODE)
1704  RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1705  RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1706  RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1707  RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1708  }
1709  else
1710  {
1711  RequirementDescriptor->Type = CmResourceTypeMemory;
1712  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1713  RequirementDescriptor->Flags = 0;
1714  if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1715  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1716  else
1717  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1718  switch (addr64_data->Info.Mem.Caching)
1719  {
1720  case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1721  case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1722  case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1723  }
1724  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1725  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1726  RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1727  }
1728  RequirementDescriptor++;
1729  break;
1730  }
1732  {
1733  ACPI_RESOURCE_MEMORY24 *mem24_data = (ACPI_RESOURCE_MEMORY24*) &resource->Data;
1734  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1735  RequirementDescriptor->Type = CmResourceTypeMemory;
1736  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1737  RequirementDescriptor->Flags = CM_RESOURCE_MEMORY_24;
1738  if (mem24_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1739  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1740  else
1741  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1742  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem24_data->Minimum;
1743  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem24_data->Maximum + mem24_data->AddressLength - 1;
1744  RequirementDescriptor->u.Memory.Length = mem24_data->AddressLength;
1745 
1746  RequirementDescriptor++;
1747  break;
1748  }
1750  {
1751  ACPI_RESOURCE_MEMORY32 *mem32_data = (ACPI_RESOURCE_MEMORY32*) &resource->Data;
1752  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1753  RequirementDescriptor->Type = CmResourceTypeMemory;
1754  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1755  RequirementDescriptor->Flags = 0;
1756  if (mem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1757  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1758  else
1759  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1760  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem32_data->Minimum;
1761  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem32_data->Maximum + mem32_data->AddressLength - 1;
1762  RequirementDescriptor->u.Memory.Length = mem32_data->AddressLength;
1763 
1764  RequirementDescriptor++;
1765  break;
1766  }
1768  {
1770  RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1771  RequirementDescriptor->Type = CmResourceTypeMemory;
1772  RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1773  RequirementDescriptor->Flags = 0;
1774  if (fixedmem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1775  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1776  else
1777  RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1778  RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = fixedmem32_data->Address;
1779  RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = fixedmem32_data->Address + fixedmem32_data->AddressLength - 1;
1780  RequirementDescriptor->u.Memory.Length = fixedmem32_data->AddressLength;
1781 
1782  RequirementDescriptor++;
1783  break;
1784  }
1785  default:
1786  {
1787  break;
1788  }
1789  }
1791  }
1792  ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1793 
1794  Irp->IoStatus.Information = (ULONG_PTR)RequirementsList;
1795 
1796  return STATUS_SUCCESS;
1797 }
struct _IO_RESOURCE_DESCRIPTOR::@1986::@1990 Dma
#define CM_RESOURCE_DMA_16
Definition: cmtypes.h:132
#define ACPI_WRITE_COMBINING_MEMORY
Definition: acrestyp.h:62
#define CM_RESOURCE_MEMORY_PREFETCHABLE
Definition: cmtypes.h:123
#define TRUE
Definition: types.h:120
struct _IO_RESOURCE_DESCRIPTOR::@1986::@1988 Memory
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_PRODUCER
Definition: acrestyp.h:149
#define ACPI_TYPE_A
Definition: acrestyp.h:116
_In_ PIRP Irp
Definition: csq.h:116
#define ACPI_RESOURCE_TYPE_END_DEPENDENT
Definition: acrestyp.h:717
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define ACPI_TRANSFER_8_16
Definition: acrestyp.h:124
#define ACPI_BUS_MASTER
Definition: acrestyp.h:121
#define ACPI_RESOURCE_TYPE_IRQ
Definition: acrestyp.h:714
#define ACPI_TYPE_F
Definition: acrestyp.h:118
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:721
#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64
Definition: acrestyp.h:728
UINT8 AddressLength
Definition: acrestyp.h:218
#define ACPI_READ_ONLY_MEMORY
Definition: acrestyp.h:57
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define CM_RESOURCE_DMA_TYPE_F
Definition: cmtypes.h:138
UINT32 ACPI_STATUS
Definition: actypes.h:460
int resource
Definition: rdpsnd_sgi.c:44
#define CM_RESOURCE_DMA_TYPE_A
Definition: cmtypes.h:136
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define PAGED_CODE()
Definition: video.h:57
#define ACPI_BUS_NUMBER_RANGE
Definition: acrestyp.h:139
#define ACPI_RESOURCE_TYPE_IO
Definition: acrestyp.h:718
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
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define CM_RESOURCE_MEMORY_24
Definition: cmtypes.h:125
struct _IO_RESOURCE_DESCRIPTOR::@1986::@1993 BusNumber
#define ACPI_SHARED
Definition: acrestyp.h:105
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:121
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2388
unsigned char BOOLEAN
#define CM_RESOURCE_DMA_8_AND_16
Definition: cmtypes.h:134
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define IO_RESOURCE_ALTERNATIVE
Definition: bufpool.h:45
#define ACPI_PREFETCHABLE_MEMORY
Definition: acrestyp.h:63
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define ACPI_TRANSFER_8
Definition: acrestyp.h:123
struct _IO_RESOURCE_DESCRIPTOR::@1986::@1989 Interrupt
struct _IO_RESOURCE_DESCRIPTOR::@1986::@1987 Port
#define ACPI_RESOURCE_TYPE_ADDRESS32
Definition: acrestyp.h:726
UINT8 Interrupts[1]
Definition: acrestyp.h:185
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define CM_RESOURCE_PORT_POSITIVE_DECODE
Definition: cmtypes.h:113
UINT16 Minimum
Definition: acrestyp.h:219
ACPI_STATUS AcpiGetPossibleResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:273
#define for
Definition: utility.h:88
#define CM_RESOURCE_MEMORY_COMBINEDWRITE
Definition: cmtypes.h:124
#define ACPI_RESOURCE_TYPE_ADDRESS64
Definition: acrestyp.h:727
#define ACPI_IO_RANGE
Definition: acrestyp.h:138
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define CM_RESOURCE_DMA_TYPE_B
Definition: cmtypes.h:137
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ACPI_TRANSFER_16
Definition: acrestyp.h:125
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2393
static const WCHAR L[]
Definition: oid.c:1250
#define CM_RESOURCE_DMA_8
Definition: cmtypes.h:131
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ
Definition: acrestyp.h:729
#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32
Definition: acrestyp.h:724
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2383
#define ACPI_RESOURCE_TYPE_MEMORY32
Definition: acrestyp.h:723
#define CM_RESOURCE_MEMORY_CACHEABLE
Definition: cmtypes.h:126
UINT8 ChannelCount
Definition: acrestyp.h:194
ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:419
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:802
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:410
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define ACPI_RESOURCE_TYPE_DMA
Definition: acrestyp.h:715
#define ACPI_TYPE_B
Definition: acrestyp.h:117
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT1
Definition: precomp.h:8
UINT16 Maximum
Definition: acrestyp.h:220
#define ACPI_RESOURCE_TYPE_ADDRESS16
Definition: acrestyp.h:725
#define ACPI_RESOURCE_TYPE_MEMORY24
Definition: acrestyp.h:722
#define ACPI_DECODE_16
Definition: acrestyp.h:85
union _IO_RESOURCE_DESCRIPTOR::@1986 u
#define ACPI_POS_DECODE
Definition: acrestyp.h:144
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS16_ATTRIBUTE Address
Definition: acrestyp.h:394
#define CmResourceTypeBusNumber
Definition: hwresource.cpp:128
#define IO_RESOURCE_PREFERRED
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS32_ATTRIBUTE Address
Definition: acrestyp.h:402
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
UINT8 InterruptCount
Definition: acrestyp.h:184
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define ACPI_RESOURCE_TYPE_FIXED_IO
Definition: acrestyp.h:719
ACPI_STATUS AcpiGetCurrentResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:225
#define ACPI_LEVEL_SENSITIVE
Definition: acrestyp.h:93
#define CM_RESOURCE_DMA_BUS_MASTER
Definition: cmtypes.h:135
#define ACPI_CACHABLE_MEMORY
Definition: acrestyp.h:61
#define CmResourceTypeDma
Definition: hwresource.cpp:126
UINT8 Channels[1]
Definition: acrestyp.h:195

Referenced by Bus_PDO_PnP().

◆ Bus_PDO_QueryResources()

NTSTATUS Bus_PDO_QueryResources ( PPDO_DEVICE_DATA  DeviceData,
PIRP  Irp 
)

Definition at line 793 of file buspdo.c.

796 {
797  ULONG NumberOfResources = 0;
799  PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
800  ACPI_STATUS AcpiStatus;
803  ULONG ResourceListSize;
804  ULONG i;
806  struct acpi_device *device;
807 
808  if (!DeviceData->AcpiHandle)
809  {
810  return Irp->IoStatus.Status;
811  }
812 
813  /* A bus number resource is not included in the list of current resources
814  * for the root PCI bus so we manually query one here and if we find it
815  * we create a resource list and add a bus number descriptor to it */
816  if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
817  wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
818  {
819  acpi_bus_get_device(DeviceData->AcpiHandle, &device);
820 
821  AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN", NULL, &BusNumber);
822  if (AcpiStatus != AE_OK)
823  {
824 #if 0
825  if (device->flags.unique_id)
826  {
827  /* FIXME: Try the unique ID */
828  }
829  else
830 #endif
831  {
832  BusNumber = 0;
833  DPRINT1("Failed to find a bus number\n");
834  }
835  }
836  else
837  {
838  DPRINT("Using _BBN for bus number\n");
839  }
840 
841  DPRINT("Found PCI root hub: %d\n", BusNumber);
842 
843  ResourceListSize = sizeof(CM_RESOURCE_LIST);
844  ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
845  if (!ResourceList)
847 
848  ResourceList->Count = 1;
849  ResourceList->List[0].InterfaceType = Internal;
850  ResourceList->List[0].BusNumber = 0;
851  ResourceList->List[0].PartialResourceList.Version = 1;
852  ResourceList->List[0].PartialResourceList.Revision = 1;
853  ResourceList->List[0].PartialResourceList.Count = 1;
854  ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
855 
856  ResourceDescriptor->Type = CmResourceTypeBusNumber;
857  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
858  ResourceDescriptor->u.BusNumber.Start = BusNumber;
859  ResourceDescriptor->u.BusNumber.Length = 1;
860 
861  Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
862  return STATUS_SUCCESS;
863  }
864 
865  /* Get current resources */
866  Buffer.Length = 0;
867  AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
868  if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
869  Buffer.Length == 0)
870  {
871  return Irp->IoStatus.Status;
872  }
873 
874  Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
875  if (!Buffer.Pointer)
877 
878  AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
879  if (!ACPI_SUCCESS(AcpiStatus))
880  {
881  DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
882  ASSERT(FALSE);
883  return STATUS_UNSUCCESSFUL;
884  }
885 
886  resource= Buffer.Pointer;
887  /* Count number of resources */
888  while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
889  {
890  switch (resource->Type)
891  {
893  {
895  if (irq_data->ProducerConsumer == ACPI_PRODUCER)
896  break;
897  NumberOfResources += irq_data->InterruptCount;
898  break;
899  }
901  {
902  ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
903  NumberOfResources += irq_data->InterruptCount;
904  break;
905  }
907  {
908  ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
909  NumberOfResources += dma_data->ChannelCount;
910  break;
911  }
916  {
918  if (addr_res->ProducerConsumer == ACPI_PRODUCER)
919  break;
920  NumberOfResources++;
921  break;
922  }
928  {
929  NumberOfResources++;
930  break;
931  }
932  default:
933  {
934  DPRINT1("Unknown resource type: %d\n", resource->Type);
935  break;
936  }
937  }
939  }
940 
941  /* Allocate memory */
942  ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
943  ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
944 
945  if (!ResourceList)
946  {
947  ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
949  }
950  ResourceList->Count = 1;
951  ResourceList->List[0].InterfaceType = Internal; /* FIXME */
952  ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
953  ResourceList->List[0].PartialResourceList.Version = 1;
954  ResourceList->List[0].PartialResourceList.Revision = 1;
955  ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
956  ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
957 
958  /* Fill resources list structure */
959  resource = Buffer.Pointer;
960  while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
961  {
962  switch (resource->Type)
963  {
965  {
967  if (irq_data->ProducerConsumer == ACPI_PRODUCER)
968  break;
969  for (i = 0; i < irq_data->InterruptCount; i++)
970  {
971  ResourceDescriptor->Type = CmResourceTypeInterrupt;
972 
973  ResourceDescriptor->ShareDisposition =
975  ResourceDescriptor->Flags =
977  ResourceDescriptor->u.Interrupt.Level =
978  ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
979  ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
980 
981  ResourceDescriptor++;
982  }
983  break;
984  }
986  {
987  ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
988  for (i = 0; i < irq_data->InterruptCount; i++)
989  {
990  ResourceDescriptor->Type = CmResourceTypeInterrupt;
991 
992  ResourceDescriptor->ShareDisposition =
994  ResourceDescriptor->Flags =
996  ResourceDescriptor->u.Interrupt.Level =
997  ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
998  ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
999 
1000  ResourceDescriptor++;
1001  }
1002  break;
1003  }
1005  {
1006  ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1007  for (i = 0; i < dma_data->ChannelCount; i++)
1008  {
1009  ResourceDescriptor->Type = CmResourceTypeDma;
1010  ResourceDescriptor->Flags = 0;
1011  switch (dma_data->Type)
1012  {
1013  case ACPI_TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1014  case ACPI_TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1015  case ACPI_TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1016  }
1017  if (dma_data->BusMaster == ACPI_BUS_MASTER)
1018  ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1019  switch (dma_data->Transfer)
1020  {
1021  case ACPI_TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1022  case ACPI_TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1023  case ACPI_TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1024  }
1025  ResourceDescriptor->u.Dma.Channel = dma_data->Channels[i];
1026 
1027  ResourceDescriptor++;
1028  }
1029  break;
1030  }
1031  case ACPI_RESOURCE_TYPE_IO:
1032  {
1033  ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &resource->Data;
1034  ResourceDescriptor->Type = CmResourceTypePort;
1035  ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1036  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1037  if (io_data->IoDecode == ACPI_DECODE_16)
1038  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1039  else
1040  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1041  ResourceDescriptor->u.Port.Start.QuadPart = io_data->Minimum;
1042  ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1043 
1044  ResourceDescriptor++;
1045  break;
1046  }
1048  {
1050  ResourceDescriptor->Type = CmResourceTypePort;
1051  ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1052  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1053  ResourceDescriptor->u.Port.Start.QuadPart = io_data->Address;
1054  ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1055 
1056  ResourceDescriptor++;
1057  break;
1058  }
1060  {
1061  ACPI_RESOURCE_ADDRESS16 *addr16_data = (ACPI_RESOURCE_ADDRESS16*) &resource->Data;
1062  if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1063  break;
1064  if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1065  {
1066  ResourceDescriptor->Type = CmResourceTypeBusNumber;
1067  ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1068  ResourceDescriptor->Flags = 0;
1069  ResourceDescriptor->u.BusNumber.Start = addr16_data->Address.Minimum;
1070  ResourceDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1071  }
1072  else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1073  {
1074  ResourceDescriptor->Type = CmResourceTypePort;
1075  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1076  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1077  if (addr16_data->Decode == ACPI_POS_DECODE)
1078  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1079  ResourceDescriptor->u.Port.Start.QuadPart = addr16_data->Address.Minimum;
1080  ResourceDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1081  }
1082  else
1083  {
1084  ResourceDescriptor->Type = CmResourceTypeMemory;
1085  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1086  ResourceDescriptor->Flags = 0;
1087  if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1088  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1089  else
1090  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1091  switch (addr16_data->Info.Mem.Caching)
1092  {
1093  case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1094  case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1095  case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1096  }
1097  ResourceDescriptor->u.Memory.Start.QuadPart = addr16_data->Address.Minimum;
1098  ResourceDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1099  }
1100  ResourceDescriptor++;
1101  break;
1102  }
1104  {
1105  ACPI_RESOURCE_ADDRESS32 *addr32_data = (ACPI_RESOURCE_ADDRESS32*) &resource->Data;
1106  if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1107  break;
1108  if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1109  {
1110  ResourceDescriptor->Type = CmResourceTypeBusNumber;
1111  ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1112  ResourceDescriptor->Flags = 0;
1113  ResourceDescriptor->u.BusNumber.Start = addr32_data->Address.Minimum;
1114  ResourceDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1115  }
1116  else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1117  {
1118  ResourceDescriptor->Type = CmResourceTypePort;
1119  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1120  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1121  if (addr32_data->Decode == ACPI_POS_DECODE)
1122  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1123  ResourceDescriptor->u.Port.Start.QuadPart = addr32_data->Address.Minimum;
1124  ResourceDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1125  }
1126  else
1127  {
1128  ResourceDescriptor->Type = CmResourceTypeMemory;
1129  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1130  ResourceDescriptor->Flags = 0;
1131  if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1132  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1133  else
1134  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1135  switch (addr32_data->Info.Mem.Caching)
1136  {
1137  case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1138  case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1139  case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1140  }
1141  ResourceDescriptor->u.Memory.Start.QuadPart = addr32_data->Address.Minimum;
1142  ResourceDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1143  }
1144  ResourceDescriptor++;
1145  break;
1146  }
1148  {
1149  ACPI_RESOURCE_ADDRESS64 *addr64_data = (ACPI_RESOURCE_ADDRESS64*) &resource->Data;
1150  if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1151  break;
1152  if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1153  {
1154  DPRINT1("64-bit bus address is not supported!\n");
1155  ResourceDescriptor->Type = CmResourceTypeBusNumber;
1156  ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1157  ResourceDescriptor->Flags = 0;
1158  ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1159  ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1160  }
1161  else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1162  {
1163  ResourceDescriptor->Type = CmResourceTypePort;
1164  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1165  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1166  if (addr64_data->Decode == ACPI_POS_DECODE)
1167  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1168  ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1169  ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1170  }
1171  else
1172  {
1173  ResourceDescriptor->Type = CmResourceTypeMemory;
1174  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1175  ResourceDescriptor->Flags = 0;
1176  if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1177  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1178  else
1179  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1180  switch (addr64_data->Info.Mem.Caching)
1181  {
1182  case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1183  case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1184  case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1185  }
1186  ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1187  ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1188  }
1189  ResourceDescriptor++;
1190  break;
1191  }
1193  {
1195  if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1196  break;
1197  if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1198  {
1199  DPRINT1("64-bit bus address is not supported!\n");
1200  ResourceDescriptor->Type = CmResourceTypeBusNumber;
1201  ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1202  ResourceDescriptor->Flags = 0;
1203  ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1204  ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1205  }
1206  else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1207  {
1208  ResourceDescriptor->Type = CmResourceTypePort;
1209  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1210  ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1211  if (addr64_data->Decode == ACPI_POS_DECODE)
1212  ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1213  ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1214  ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1215  }
1216  else
1217  {
1218  ResourceDescriptor->Type = CmResourceTypeMemory;
1219  ResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1220  ResourceDescriptor->Flags = 0;
1221  if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1222  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1223  else
1224  ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1225  switch (addr64_data->Info.Mem.Caching)
1226  {
1227  case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1228  case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1229  case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1230  }
1231  ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1232  ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1233  }
1234  ResourceDescriptor++;
1235  break;
1236  }
1238  {
1239  ACPI_RESOURCE_MEMORY24 *mem24_data = (