ReactOS 0.4.16-dev-1279-gc894716
buspdo.c
Go to the documentation of this file.
1#ifndef UNIT_TEST
2#include "precomp.h"
3
4#include <initguid.h>
5#include <poclass.h>
6
7#define NDEBUG
8#include <debug.h>
9
10#ifdef ALLOC_PRAGMA
11#pragma alloc_text (PAGE, Bus_PDO_PnP)
12#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceCaps)
13#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceId)
14#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceText)
15#pragma alloc_text (PAGE, Bus_PDO_QueryResources)
16#pragma alloc_text (PAGE, Bus_PDO_QueryResourceRequirements)
17#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceRelations)
18#pragma alloc_text (PAGE, Bus_PDO_QueryBusInformation)
19#pragma alloc_text (PAGE, Bus_GetDeviceCapabilities)
20#endif
21
25 PIRP Irp,
26 PIO_STACK_LOCATION IrpStack,
28 )
29{
32 struct acpi_device *device = NULL;
33
34 PAGED_CODE ();
35
36 if (DeviceData->AcpiHandle)
38
39 //
40 // NB: Because we are a bus enumerator, we have no one to whom we could
41 // defer these irps. Therefore we do not pass them down but merely
42 // return them.
43 //
44
45 switch (IrpStack->MinorFunction) {
46
48 //
49 // Here we do what ever initialization and ``turning on'' that is
50 // required to allow others to access this device.
51 // Power up the device.
52 //
53 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
55 {
56 DPRINT1("Device %x failed to start!\n", DeviceData->AcpiHandle);
58 break;
59 }
60
61 DeviceData->InterfaceName.Length = 0;
63
64 if (!device)
65 {
67 &GUID_DEVICE_SYS_BUTTON,
68 NULL,
69 &DeviceData->InterfaceName);
70 }
71 else if (device->flags.hardware_id &&
72 strstr(device->pnp.hardware_id, ACPI_THERMAL_HID))
73 {
75 &GUID_DEVICE_THERMAL_ZONE,
76 NULL,
77 &DeviceData->InterfaceName);
78 }
79 else if (device->flags.hardware_id &&
80 strstr(device->pnp.hardware_id, ACPI_FAN_HID))
81 {
83 &GUID_DEVICE_FAN,
84 NULL,
85 &DeviceData->InterfaceName);
86 }
87 else if (device->flags.hardware_id &&
88 strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID))
89 {
91 &GUID_DEVICE_LID,
92 NULL,
93 &DeviceData->InterfaceName);
94 }
95 else if (device->flags.hardware_id &&
96 strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))
97 {
99 &GUID_DEVICE_PROCESSOR,
100 NULL,
101 &DeviceData->InterfaceName);
102 }
103
104 /* Failure to register an interface is not a fatal failure so don't return a failure status */
105 if (NT_SUCCESS(status) && DeviceData->InterfaceName.Length != 0)
106 IoSetDeviceInterfaceState(&DeviceData->InterfaceName, TRUE);
107
108 state.DeviceState = PowerDeviceD0;
110 DeviceData->Common.DevicePowerState = PowerDeviceD0;
113 break;
114
116
117 if (DeviceData->InterfaceName.Length != 0)
119
120 //
121 // Here we shut down the device and give up and unmap any resources
122 // we acquired for the device.
123 //
124 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
126 {
127 DPRINT1("Device %x failed to stop!\n", DeviceData->AcpiHandle);
129 break;
130 }
131
132 state.DeviceState = PowerDeviceD3;
134 DeviceData->Common.DevicePowerState = PowerDeviceD3;
137 break;
138
139
141
142 //
143 // No reason here why we can't stop the device.
144 // If there were a reason we should speak now, because answering success
145 // here may result in a stop device irp.
146 //
147
150 break;
151
153
154 //
155 // The stop was canceled. Whatever state we set, or resources we put
156 // on hold in anticipation of the forthcoming STOP device IRP should be
157 // put back to normal. Someone, in the long list of concerned parties,
158 // has failed the stop device query.
159 //
160
161 //
162 // First check to see whether you have received cancel-stop
163 // without first receiving a query-stop. This could happen if someone
164 // above us fails a query-stop and passes down the subsequent
165 // cancel-stop.
166 //
167
168 if (StopPending == DeviceData->Common.DevicePnPState)
169 {
170 //
171 // We did receive a query-stop, so restore.
172 //
174 }
175 status = STATUS_SUCCESS;// We must not fail this IRP.
176 break;
177
179 //
180 // We handle REMOVE_DEVICE just like STOP_DEVICE. This is because
181 // the device is still physically present (or at least we don't know any better)
182 // so we have to retain the PDO after stopping and removing power from it.
183 //
184 if (DeviceData->InterfaceName.Length != 0)
186
187 if (DeviceData->AcpiHandle && acpi_bus_power_manageable(DeviceData->AcpiHandle) &&
189 {
190 DPRINT1("Device %x failed to enter D3!\n", DeviceData->AcpiHandle);
191 state.DeviceState = PowerDeviceD3;
193 DeviceData->Common.DevicePowerState = PowerDeviceD3;
194 }
195
198 break;
199
203 break;
204
206 if (RemovalPending == DeviceData->Common.DevicePnPState)
207 {
209 }
211 break;
212
214
215 //
216 // Return the capabilities of a device, such as whether the device
217 // can be locked or ejected..etc
218 //
219
221
222 break;
223
224 case IRP_MN_QUERY_ID:
225
226 // Query the IDs of the device
228
229 break;
230
232
233 DPRINT("\tQueryDeviceRelation Type: %s\n",DbgDeviceRelationString(\
234 IrpStack->Parameters.QueryDeviceRelations.Type));
235
237
238 break;
239
241
243
244 break;
245
247
249
250 break;
251
253
255
256 break;
257
259
261
262 break;
263
265
267
268 break;
269
270
272
273 //
274 // OPTIONAL for bus drivers.
275 // The PnP Manager sends this IRP to a device
276 // stack so filter and function drivers can adjust the
277 // resources required by the device, if appropriate.
278 //
279
280 //break;
281
282 //case IRP_MN_QUERY_PNP_DEVICE_STATE:
283
284 //
285 // OPTIONAL for bus drivers.
286 // The PnP Manager sends this IRP after the drivers for
287 // a device return success from the IRP_MN_START_DEVICE
288 // request. The PnP Manager also sends this IRP when a
289 // driver for the device calls IoInvalidateDeviceState.
290 //
291
292 // break;
293
294 //case IRP_MN_READ_CONFIG:
295 //case IRP_MN_WRITE_CONFIG:
296
297 //
298 // Bus drivers for buses with configuration space must handle
299 // this request for their child devices. Our devices don't
300 // have a config space.
301 //
302
303 // break;
304
305 //case IRP_MN_SET_LOCK:
306
307 // break;
308
309 default:
310
311 //
312 // For PnP requests to the PDO that we do not understand we should
313 // return the IRP WITHOUT setting the status or information fields.
314 // These fields may have already been set by a filter (eg acpi).
315 status = Irp->IoStatus.Status;
316
317 break;
318 }
319
320 Irp->IoStatus.Status = status;
322
323 return status;
324}
325
329 PIRP Irp )
330{
331
333 PDEVICE_CAPABILITIES deviceCapabilities;
334 struct acpi_device *device = NULL;
335 ULONG i;
336
337 PAGED_CODE ();
338
339 if (DeviceData->AcpiHandle)
341
343
344 //
345 // Get the packet.
346 //
347 deviceCapabilities=stack->Parameters.DeviceCapabilities.Capabilities;
348
349 //
350 // Set the capabilities.
351 //
352
353 if (deviceCapabilities->Version != 1 ||
354 deviceCapabilities->Size < sizeof(DEVICE_CAPABILITIES))
355 {
356 return STATUS_UNSUCCESSFUL;
357 }
358
359 deviceCapabilities->D1Latency = 0;
360 deviceCapabilities->D2Latency = 0;
361 deviceCapabilities->D3Latency = 0;
362
363 deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
364 deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD3;
365 deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD3;
366 deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
367
368 for (i = 0; i < ACPI_D_STATE_COUNT && device; i++)
369 {
370 if (!device->power.states[i].flags.valid)
371 continue;
372
373 switch (i)
374 {
375 case ACPI_STATE_D0:
376 deviceCapabilities->DeviceState[PowerSystemWorking] = PowerDeviceD0;
377 break;
378
379 case ACPI_STATE_D1:
380 deviceCapabilities->DeviceState[PowerSystemSleeping1] = PowerDeviceD1;
381 deviceCapabilities->D1Latency = device->power.states[i].latency;
382 break;
383
384 case ACPI_STATE_D2:
385 deviceCapabilities->DeviceState[PowerSystemSleeping2] = PowerDeviceD2;
386 deviceCapabilities->D2Latency = device->power.states[i].latency;
387 break;
388
389 case ACPI_STATE_D3:
390 deviceCapabilities->DeviceState[PowerSystemSleeping3] = PowerDeviceD3;
391 deviceCapabilities->D3Latency = device->power.states[i].latency;
392 break;
393 }
394 }
395
396 // We can wake the system from D1
397 deviceCapabilities->DeviceWake = PowerDeviceD1;
398
399
400 deviceCapabilities->DeviceD1 =
401 (deviceCapabilities->DeviceState[PowerSystemSleeping1] == PowerDeviceD1) ? TRUE : FALSE;
402 deviceCapabilities->DeviceD2 =
403 (deviceCapabilities->DeviceState[PowerSystemSleeping2] == PowerDeviceD2) ? TRUE : FALSE;
404
405 deviceCapabilities->WakeFromD0 = FALSE;
406 deviceCapabilities->WakeFromD1 = TRUE; //Yes we can
407 deviceCapabilities->WakeFromD2 = FALSE;
408 deviceCapabilities->WakeFromD3 = FALSE;
409
410 if (device)
411 {
412 deviceCapabilities->LockSupported = device->flags.lockable;
413 deviceCapabilities->EjectSupported = device->flags.ejectable;
414 deviceCapabilities->HardwareDisabled = !device->status.enabled && !device->status.functional;
415 deviceCapabilities->Removable = device->flags.removable;
416 deviceCapabilities->SurpriseRemovalOK = device->flags.surprise_removal_ok;
417 deviceCapabilities->UniqueID = device->flags.unique_id;
418 deviceCapabilities->NoDisplayInUI = !device->status.show_in_ui;
419 deviceCapabilities->Address = device->pnp.bus_address;
420 }
421
422 if (DeviceData->DockDevice)
423 deviceCapabilities->DockDevice = TRUE;
424 DPRINT("DockDevice: %u\n", deviceCapabilities->DockDevice);
425
426 if (!device ||
427 (device->flags.hardware_id &&
428 (strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID) ||
429 strstr(device->pnp.hardware_id, ACPI_THERMAL_HID) ||
430 strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID))))
431 {
432 /* Allow ACPI to control the device if it is a lid button,
433 * a thermal zone, a processor, or a fixed feature button */
434 deviceCapabilities->RawDeviceOK = TRUE;
435 }
436
437 deviceCapabilities->SilentInstall = FALSE;
438 deviceCapabilities->UINumber = (ULONG)-1;
439
440 return STATUS_SUCCESS;
441
442}
443
447 PIRP Irp )
448{
451 WCHAR temp[256];
452 ULONG length, i;
454 struct acpi_device *Device;
455
456 PAGED_CODE ();
457
459
460 switch (stack->Parameters.QueryId.IdType) {
461
462 case BusQueryDeviceID:
463
464 /* This is a REG_SZ value */
465
466 if (DeviceData->AcpiHandle)
467 {
469
470 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
471 {
474 }
475 else
476 {
478 L"ACPI\\%hs",
479 Device->pnp.hardware_id);
480 }
481 }
482 else
483 {
484 /* We know it's a fixed feature button because
485 * these are direct children of the ACPI root device
486 * and therefore have no handle
487 */
489 L"ACPI\\FixedButton");
490 }
491
493
494 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
495
496 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
497
498 if (!buffer) {
500 break;
501 }
502
503 RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
504 Irp->IoStatus.Information = (ULONG_PTR) buffer;
505 DPRINT("BusQueryDeviceID: %ls\n",buffer);
506 break;
507
509
510 /* This is a REG_SZ value */
511
512 /* See comment in BusQueryDeviceID case */
513 if(DeviceData->AcpiHandle)
514 {
516
517 if (Device->flags.unique_id)
519 L"%hs",
520 Device->pnp.unique_id);
521 else
522 /* FIXME: Generate unique id! */
523 length = swprintf(temp, L"%ls", L"0");
524 }
525 else
526 {
527 /* FIXME: Generate unique id! */
528 length = swprintf(temp, L"%ls", L"0");
529 }
530
532
533 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
534
535 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
536 if (!buffer) {
538 break;
539 }
540
541 RtlCopyMemory (buffer, temp, length * sizeof (WCHAR));
542 DPRINT("BusQueryInstanceID: %ls\n",buffer);
543 Irp->IoStatus.Information = (ULONG_PTR) buffer;
544 break;
545
547
548 /* This is a REG_MULTI_SZ value */
549 length = 0;
551
552 /* See comment in BusQueryDeviceID case */
553 if (DeviceData->AcpiHandle)
554 {
556
557 if (!Device->flags.hardware_id)
558 {
559 /* We don't have the ID to satisfy this request */
560 break;
561 }
562
563 DPRINT("Device name: %s\n", Device->pnp.device_name);
564 DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
565
566 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
567 {
570 }
571 else
572 {
574 L"ACPI\\%hs",
575 Device->pnp.hardware_id);
577
579 L"*%hs",
580 Device->pnp.hardware_id);
583 src = temp;
584 }
585 }
586 else
587 {
589 L"ACPI\\FixedButton");
591
593 L"*FixedButton");
596 src = temp;
597 }
598
599 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
600
601 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
602
603 if (!buffer) {
605 break;
606 }
607
608 RtlCopyMemory (buffer, src, length * sizeof(WCHAR));
609 Irp->IoStatus.Information = (ULONG_PTR) buffer;
610 DPRINT("BusQueryHardwareIDs: %ls\n",buffer);
612 break;
613
615
616 /* This is a REG_MULTI_SZ value */
617 length = 0;
619
620 /* See comment in BusQueryDeviceID case */
621 if (DeviceData->AcpiHandle)
622 {
624
625 if (!Device->flags.hardware_id)
626 {
627 /* We don't have the ID to satisfy this request */
628 break;
629 }
630
631 DPRINT("Device name: %s\n", Device->pnp.device_name);
632 DPRINT("Hardware ID: %s\n", Device->pnp.hardware_id);
633
634 if (strcmp(Device->pnp.hardware_id, "Processor") == 0)
635 {
637 L"ACPI\\%hs",
638 Device->pnp.hardware_id);
640
642 L"*%hs",
643 Device->pnp.hardware_id);
646 }
647 else if (Device->flags.compatible_ids)
648 {
649 for (i = 0; i < Device->pnp.cid_list->Count; i++)
650 {
652 L"ACPI\\%hs",
653 Device->pnp.cid_list->Ids[i].String);
655
657 L"*%hs",
658 Device->pnp.cid_list->Ids[i].String);
660 }
661
663 }
664 else
665 {
666 /* No compatible IDs */
667 break;
668 }
669
670 NT_ASSERT(length * sizeof(WCHAR) <= sizeof(temp));
671
672 buffer = ExAllocatePoolWithTag(PagedPool, length * sizeof(WCHAR), 'IpcA');
673 if (!buffer)
674 {
676 break;
677 }
678
679 RtlCopyMemory (buffer, temp, length * sizeof(WCHAR));
680 Irp->IoStatus.Information = (ULONG_PTR) buffer;
681 DPRINT("BusQueryCompatibleIDs: %ls\n",buffer);
683 }
684 break;
685
686 default:
687 status = Irp->IoStatus.Status;
688 }
689 return status;
690}
691
695 PIRP Irp )
696{
697 PWCHAR Buffer, Temp;
699 NTSTATUS status = Irp->IoStatus.Status;
700 PAGED_CODE ();
701
703
704 switch (stack->Parameters.QueryDeviceText.DeviceTextType) {
705
707
708 if (!Irp->IoStatus.Information) {
709 if (wcsstr (DeviceData->HardwareIDs, L"PNP000") != 0)
710 Temp = L"Programmable interrupt controller";
711 else if (wcsstr(DeviceData->HardwareIDs, L"PNP010") != 0)
712 Temp = L"System timer";
713 else if (wcsstr(DeviceData->HardwareIDs, L"PNP020") != 0)
714 Temp = L"DMA controller";
715 else if (wcsstr(DeviceData->HardwareIDs, L"PNP03") != 0)
716 Temp = L"Keyboard";
717 else if (wcsstr(DeviceData->HardwareIDs, L"PNP040") != 0)
718 Temp = L"Parallel port";
719 else if (wcsstr(DeviceData->HardwareIDs, L"PNP05") != 0)
720 Temp = L"Serial port";
721 else if (wcsstr(DeviceData->HardwareIDs, L"PNP06") != 0)
722 Temp = L"Disk controller";
723 else if (wcsstr(DeviceData->HardwareIDs, L"PNP07") != 0)
724 Temp = L"Disk controller";
725 else if (wcsstr(DeviceData->HardwareIDs, L"PNP09") != 0)
726 Temp = L"Display adapter";
727 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A0") != 0)
728 Temp = L"Bus controller";
729 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0E0") != 0)
730 Temp = L"PCMCIA controller";
731 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0F") != 0)
732 Temp = L"Mouse device";
733 else if (wcsstr(DeviceData->HardwareIDs, L"PNP8") != 0)
734 Temp = L"Network adapter";
735 else if (wcsstr(DeviceData->HardwareIDs, L"PNPA0") != 0)
736 Temp = L"SCSI controller";
737 else if (wcsstr(DeviceData->HardwareIDs, L"PNPB0") != 0)
738 Temp = L"Multimedia device";
739 else if (wcsstr(DeviceData->HardwareIDs, L"PNPC00") != 0)
740 Temp = L"Modem";
741 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0C") != 0)
742 Temp = L"Power Button";
743 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0E") != 0)
744 Temp = L"Sleep Button";
745 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0D") != 0)
746 Temp = L"Lid Switch";
747 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C09") != 0)
748 Temp = L"ACPI Embedded Controller";
749 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0B") != 0)
750 Temp = L"ACPI Fan";
751 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
752 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
753 Temp = L"PCI Root Bridge";
754 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0A") != 0)
755 Temp = L"ACPI Battery";
756 else if (wcsstr(DeviceData->HardwareIDs, L"PNP0C0F") != 0)
757 Temp = L"PCI Interrupt Link";
758 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI_PWR") != 0)
759 Temp = L"ACPI Power Resource";
760 else if (wcsstr(DeviceData->HardwareIDs, L"Processor") != 0)
761 {
763 Temp = ProcessorNameString;
764 else
765 Temp = L"Processor";
766 }
767 else if (wcsstr(DeviceData->HardwareIDs, L"ThermalZone") != 0)
768 Temp = L"ACPI Thermal Zone";
769 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0002") != 0)
770 Temp = L"Smart Battery";
771 else if (wcsstr(DeviceData->HardwareIDs, L"ACPI0003") != 0)
772 Temp = L"AC Adapter";
773 /* Simply checking if AcpiHandle is NULL eliminates the need to check
774 * for the 4 different names that ACPI knows the fixed feature button as internally
775 */
776 else if (!DeviceData->AcpiHandle)
777 Temp = L"ACPI Fixed Feature Button";
778 else
779 Temp = L"Other ACPI device";
780
781 Buffer = ExAllocatePoolWithTag(PagedPool, (wcslen(Temp) + 1) * sizeof(WCHAR), 'IpcA');
782
783 if (!Buffer) {
785 break;
786 }
787
788 RtlCopyMemory (Buffer, Temp, (wcslen(Temp) + 1) * sizeof(WCHAR));
789
790 DPRINT("\tDeviceTextDescription :%ws\n", Buffer);
791
792 Irp->IoStatus.Information = (ULONG_PTR) Buffer;
794 }
795 break;
796
797 default:
798 break;
799 }
800
801 return status;
802
803}
804
808 PIRP Irp )
809{
810 ULONG NumberOfResources = 0;
812 PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
813 ACPI_STATUS AcpiStatus;
816 ULONG ResourceListSize;
817 ULONG i;
819 struct acpi_device *device;
820
821 if (!DeviceData->AcpiHandle)
822 {
823 return Irp->IoStatus.Status;
824 }
825
826 /* A bus number resource is not included in the list of current resources
827 * for the root PCI bus so we manually query one here and if we find it
828 * we create a resource list and add a bus number descriptor to it */
829 if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
830 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
831 {
833
834 AcpiStatus = acpi_evaluate_integer(DeviceData->AcpiHandle, "_BBN", NULL, &BusNumber);
835 if (AcpiStatus != AE_OK)
836 {
837#if 0
838 if (device->flags.unique_id)
839 {
840 /* FIXME: Try the unique ID */
841 }
842 else
843#endif
844 {
845 BusNumber = 0;
846 DPRINT1("Failed to find a bus number\n");
847 }
848 }
849 else
850 {
851 DPRINT("Using _BBN for bus number\n");
852 }
853
854 DPRINT("Found PCI root hub: %d\n", BusNumber);
855
856 ResourceListSize = sizeof(CM_RESOURCE_LIST);
857 ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
858 if (!ResourceList)
860
861 ResourceList->Count = 1;
862 ResourceList->List[0].InterfaceType = Internal;
863 ResourceList->List[0].BusNumber = 0;
864 ResourceList->List[0].PartialResourceList.Version = 1;
865 ResourceList->List[0].PartialResourceList.Revision = 1;
866 ResourceList->List[0].PartialResourceList.Count = 1;
867 ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
868
869 ResourceDescriptor->Type = CmResourceTypeBusNumber;
871 ResourceDescriptor->u.BusNumber.Start = BusNumber;
872 ResourceDescriptor->u.BusNumber.Length = 1;
873
874 Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
875 return STATUS_SUCCESS;
876 }
877
878 /* Get current resources */
879 Buffer.Length = 0;
880 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
881 if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
882 Buffer.Length == 0)
883 {
884 return Irp->IoStatus.Status;
885 }
886
887 Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
888 if (!Buffer.Pointer)
890
891 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
892 if (!ACPI_SUCCESS(AcpiStatus))
893 {
894 DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
895 ASSERT(FALSE);
896 return STATUS_UNSUCCESSFUL;
897 }
898
899 resource= Buffer.Pointer;
900 /* Count number of resources */
901 while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
902 {
903 switch (resource->Type)
904 {
906 {
908 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
909 break;
910 NumberOfResources += irq_data->InterruptCount;
911 break;
912 }
914 {
915 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
916 NumberOfResources += irq_data->InterruptCount;
917 break;
918 }
920 {
921 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
922 NumberOfResources += dma_data->ChannelCount;
923 break;
924 }
929 {
931 if (addr_res->ProducerConsumer == ACPI_PRODUCER)
932 break;
933 NumberOfResources++;
934 break;
935 }
941 {
942 NumberOfResources++;
943 break;
944 }
945 default:
946 {
947 DPRINT1("Unknown resource type: %d\n", resource->Type);
948 break;
949 }
950 }
952 }
953
954 /* Allocate memory */
955 ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
956 ResourceList = ExAllocatePoolWithTag(PagedPool, ResourceListSize, 'RpcA');
957
958 if (!ResourceList)
959 {
960 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
962 }
963 ResourceList->Count = 1;
964 ResourceList->List[0].InterfaceType = Internal; /* FIXME */
965 ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
966 ResourceList->List[0].PartialResourceList.Version = 1;
967 ResourceList->List[0].PartialResourceList.Revision = 1;
968 ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
969 ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
970
971 /* Fill resources list structure */
972 resource = Buffer.Pointer;
973 while (resource->Type != ACPI_RESOURCE_TYPE_END_TAG)
974 {
975 switch (resource->Type)
976 {
978 {
980 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
981 break;
982 for (i = 0; i < irq_data->InterruptCount; i++)
983 {
984 ResourceDescriptor->Type = CmResourceTypeInterrupt;
985
986 ResourceDescriptor->ShareDisposition =
988 ResourceDescriptor->Flags =
990 ResourceDescriptor->u.Interrupt.Level =
991 ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
992 ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
993
994 ResourceDescriptor++;
995 }
996 break;
997 }
999 {
1000 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
1001 for (i = 0; i < irq_data->InterruptCount; i++)
1002 {
1003 ResourceDescriptor->Type = CmResourceTypeInterrupt;
1004
1005 ResourceDescriptor->ShareDisposition =
1007 ResourceDescriptor->Flags =
1009 ResourceDescriptor->u.Interrupt.Level =
1010 ResourceDescriptor->u.Interrupt.Vector = irq_data->Interrupts[i];
1011 ResourceDescriptor->u.Interrupt.Affinity = (KAFFINITY)(-1);
1012
1013 ResourceDescriptor++;
1014 }
1015 break;
1016 }
1018 {
1019 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1020 for (i = 0; i < dma_data->ChannelCount; i++)
1021 {
1022 ResourceDescriptor->Type = CmResourceTypeDma;
1023 ResourceDescriptor->Flags = 0;
1024 switch (dma_data->Type)
1025 {
1026 case ACPI_TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1027 case ACPI_TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1028 case ACPI_TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1029 }
1030 if (dma_data->BusMaster == ACPI_BUS_MASTER)
1031 ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1032 switch (dma_data->Transfer)
1033 {
1034 case ACPI_TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1035 case ACPI_TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1036 case ACPI_TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1037 }
1038 ResourceDescriptor->u.Dma.Channel = dma_data->Channels[i];
1039
1040 ResourceDescriptor++;
1041 }
1042 break;
1043 }
1045 {
1046 ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &resource->Data;
1047 ResourceDescriptor->Type = CmResourceTypePort;
1049 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1050 if (io_data->IoDecode == ACPI_DECODE_16)
1051 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1052 else
1053 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1054 ResourceDescriptor->u.Port.Start.QuadPart = io_data->Minimum;
1055 ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1056
1057 ResourceDescriptor++;
1058 break;
1059 }
1061 {
1063 ResourceDescriptor->Type = CmResourceTypePort;
1065 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1066 ResourceDescriptor->u.Port.Start.QuadPart = io_data->Address;
1067 ResourceDescriptor->u.Port.Length = io_data->AddressLength;
1068
1069 ResourceDescriptor++;
1070 break;
1071 }
1073 {
1075 if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1076 break;
1077 if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1078 {
1079 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1080 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1081 ResourceDescriptor->Flags = 0;
1082 ResourceDescriptor->u.BusNumber.Start = addr16_data->Address.Minimum;
1083 ResourceDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1084 }
1085 else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1086 {
1087 ResourceDescriptor->Type = CmResourceTypePort;
1089 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1090 if (addr16_data->Decode == ACPI_POS_DECODE)
1091 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1092 ResourceDescriptor->u.Port.Start.QuadPart = addr16_data->Address.Minimum;
1093 ResourceDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1094 }
1095 else
1096 {
1097 ResourceDescriptor->Type = CmResourceTypeMemory;
1099 ResourceDescriptor->Flags = 0;
1100 if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1101 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1102 else
1103 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1104 switch (addr16_data->Info.Mem.Caching)
1105 {
1106 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1107 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1108 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1109 }
1110 ResourceDescriptor->u.Memory.Start.QuadPart = addr16_data->Address.Minimum;
1111 ResourceDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1112 }
1113 ResourceDescriptor++;
1114 break;
1115 }
1117 {
1119 if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1120 break;
1121 if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1122 {
1123 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1124 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1125 ResourceDescriptor->Flags = 0;
1126 ResourceDescriptor->u.BusNumber.Start = addr32_data->Address.Minimum;
1127 ResourceDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1128 }
1129 else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1130 {
1131 ResourceDescriptor->Type = CmResourceTypePort;
1133 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1134 if (addr32_data->Decode == ACPI_POS_DECODE)
1135 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1136 ResourceDescriptor->u.Port.Start.QuadPart = addr32_data->Address.Minimum;
1137 ResourceDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1138 }
1139 else
1140 {
1141 ResourceDescriptor->Type = CmResourceTypeMemory;
1143 ResourceDescriptor->Flags = 0;
1144 if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1145 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1146 else
1147 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1148 switch (addr32_data->Info.Mem.Caching)
1149 {
1150 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1151 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1152 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1153 }
1154 ResourceDescriptor->u.Memory.Start.QuadPart = addr32_data->Address.Minimum;
1155 ResourceDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1156 }
1157 ResourceDescriptor++;
1158 break;
1159 }
1161 {
1163 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1164 break;
1165 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1166 {
1167 DPRINT1("64-bit bus address is not supported!\n");
1168 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1169 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1170 ResourceDescriptor->Flags = 0;
1171 ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1172 ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1173 }
1174 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1175 {
1176 ResourceDescriptor->Type = CmResourceTypePort;
1178 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1179 if (addr64_data->Decode == ACPI_POS_DECODE)
1180 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1181 ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1182 ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1183 }
1184 else
1185 {
1186 ResourceDescriptor->Type = CmResourceTypeMemory;
1188 ResourceDescriptor->Flags = 0;
1189 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1190 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1191 else
1192 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1193 switch (addr64_data->Info.Mem.Caching)
1194 {
1195 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1196 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1197 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1198 }
1199 ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1200 ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1201 }
1202 ResourceDescriptor++;
1203 break;
1204 }
1206 {
1208 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1209 break;
1210 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1211 {
1212 DPRINT1("64-bit bus address is not supported!\n");
1213 ResourceDescriptor->Type = CmResourceTypeBusNumber;
1214 ResourceDescriptor->ShareDisposition = CmResourceShareShared;
1215 ResourceDescriptor->Flags = 0;
1216 ResourceDescriptor->u.BusNumber.Start = (ULONG)addr64_data->Address.Minimum;
1217 ResourceDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1218 }
1219 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1220 {
1221 ResourceDescriptor->Type = CmResourceTypePort;
1223 ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
1224 if (addr64_data->Decode == ACPI_POS_DECODE)
1225 ResourceDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1226 ResourceDescriptor->u.Port.Start.QuadPart = addr64_data->Address.Minimum;
1227 ResourceDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1228 }
1229 else
1230 {
1231 ResourceDescriptor->Type = CmResourceTypeMemory;
1233 ResourceDescriptor->Flags = 0;
1234 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1235 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1236 else
1237 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1238 switch (addr64_data->Info.Mem.Caching)
1239 {
1240 case ACPI_CACHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1241 case ACPI_WRITE_COMBINING_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1242 case ACPI_PREFETCHABLE_MEMORY: ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1243 }
1244 ResourceDescriptor->u.Memory.Start.QuadPart = addr64_data->Address.Minimum;
1245 ResourceDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1246 }
1247 ResourceDescriptor++;
1248 break;
1249 }
1251 {
1253 ResourceDescriptor->Type = CmResourceTypeMemory;
1255 ResourceDescriptor->Flags = CM_RESOURCE_MEMORY_24;
1256 if (mem24_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1257 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1258 else
1259 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1260 ResourceDescriptor->u.Memory.Start.QuadPart = mem24_data->Minimum;
1261 ResourceDescriptor->u.Memory.Length = mem24_data->AddressLength;
1262
1263 ResourceDescriptor++;
1264 break;
1265 }
1267 {
1269 ResourceDescriptor->Type = CmResourceTypeMemory;
1271 ResourceDescriptor->Flags = 0;
1272 if (mem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1273 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1274 else
1275 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1276 ResourceDescriptor->u.Memory.Start.QuadPart = mem32_data->Minimum;
1277 ResourceDescriptor->u.Memory.Length = mem32_data->AddressLength;
1278
1279 ResourceDescriptor++;
1280 break;
1281 }
1283 {
1285 ResourceDescriptor->Type = CmResourceTypeMemory;
1287 ResourceDescriptor->Flags = 0;
1288 if (memfixed32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1289 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1290 else
1291 ResourceDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1292 ResourceDescriptor->u.Memory.Start.QuadPart = memfixed32_data->Address;
1293 ResourceDescriptor->u.Memory.Length = memfixed32_data->AddressLength;
1294
1295 ResourceDescriptor++;
1296 break;
1297 }
1298 default:
1299 {
1300 break;
1301 }
1302 }
1304 }
1305
1306 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1307 Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
1308 return STATUS_SUCCESS;
1309}
1310#endif /* UNIT_TEST */
1311
1315 PIRP Irp )
1316{
1317 ULONG NumberOfResources = 0;
1318 ACPI_STATUS AcpiStatus;
1321 ULONG i, RequirementsListSize;
1323 PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
1324 BOOLEAN CurrentRes = FALSE;
1325 BOOLEAN SeenStartDependent;
1326
1327 PAGED_CODE ();
1328
1329 if (!DeviceData->AcpiHandle)
1330 {
1331 return Irp->IoStatus.Status;
1332 }
1333
1334 /* Handle the PCI root manually */
1335 if (wcsstr(DeviceData->HardwareIDs, L"PNP0A03") != 0 ||
1336 wcsstr(DeviceData->HardwareIDs, L"PNP0A08") != 0)
1337 {
1338 return Irp->IoStatus.Status;
1339 }
1340
1341 /* Get current resources */
1342 while (TRUE)
1343 {
1344 Buffer.Length = 0;
1345 if (CurrentRes)
1346 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1347 else
1348 AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1349 if ((!ACPI_SUCCESS(AcpiStatus) && AcpiStatus != AE_BUFFER_OVERFLOW) ||
1350 Buffer.Length == 0)
1351 {
1352 if (!CurrentRes)
1353 CurrentRes = TRUE;
1354 else
1355 return Irp->IoStatus.Status;
1356 }
1357 else
1358 break;
1359 }
1360
1361 Buffer.Pointer = ExAllocatePoolWithTag(PagedPool, Buffer.Length, 'BpcA');
1362 if (!Buffer.Pointer)
1364
1365 if (CurrentRes)
1366 AcpiStatus = AcpiGetCurrentResources(DeviceData->AcpiHandle, &Buffer);
1367 else
1368 AcpiStatus = AcpiGetPossibleResources(DeviceData->AcpiHandle, &Buffer);
1369 if (!ACPI_SUCCESS(AcpiStatus))
1370 {
1371 DPRINT1("AcpiGetCurrentResources #2 failed (0x%x)\n", AcpiStatus);
1372 ASSERT(FALSE);
1373 return STATUS_UNSUCCESSFUL;
1374 }
1375
1376 SeenStartDependent = FALSE;
1377 resource = Buffer.Pointer;
1378 /* Count number of resources */
1380 {
1382 {
1383 if (SeenStartDependent)
1384 {
1385 break;
1386 }
1387 SeenStartDependent = TRUE;
1388 }
1389 switch (resource->Type)
1390 {
1392 {
1394 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1395 break;
1396 NumberOfResources += irq_data->InterruptCount;
1397 break;
1398 }
1400 {
1401 ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data;
1402 NumberOfResources += irq_data->InterruptCount;
1403 break;
1404 }
1406 {
1407 ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data;
1408 NumberOfResources += dma_data->ChannelCount;
1409 break;
1410 }
1415 {
1417 if (res_addr->ProducerConsumer == ACPI_PRODUCER)
1418 break;
1419 NumberOfResources++;
1420 break;
1421 }
1427 {
1428 NumberOfResources++;
1429 break;
1430 }
1431 default:
1432 {
1433 break;
1434 }
1435 }
1437 }
1438
1439 RequirementsListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
1440 RequirementsList = ExAllocatePoolWithTag(PagedPool, RequirementsListSize, 'RpcA');
1441
1442 if (!RequirementsList)
1443 {
1444 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1446 }
1447 RequirementsList->ListSize = RequirementsListSize;
1448 RequirementsList->InterfaceType = Internal;
1449 RequirementsList->BusNumber = 0;
1450 RequirementsList->SlotNumber = 0; /* Not used by WDM drivers */
1451 RequirementsList->AlternativeLists = 1;
1452 RequirementsList->List[0].Version = 1;
1453 RequirementsList->List[0].Revision = 1;
1454 RequirementsList->List[0].Count = NumberOfResources;
1455 RequirementDescriptor = RequirementsList->List[0].Descriptors;
1456
1457 /* Fill resources list structure */
1458 SeenStartDependent = FALSE;
1459 resource = Buffer.Pointer;
1461 {
1463 {
1464 if (SeenStartDependent)
1465 {
1466 break;
1467 }
1468 SeenStartDependent = TRUE;
1469 }
1470 switch (resource->Type)
1471 {
1473 {
1474 ACPI_RESOURCE_EXTENDED_IRQ *irq_data = &resource->Data.ExtendedIrq;
1475 if (irq_data->ProducerConsumer == ACPI_PRODUCER)
1476 break;
1477 for (i = 0; i < irq_data->InterruptCount; i++)
1478 {
1479 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1480 RequirementDescriptor->Type = CmResourceTypeInterrupt;
1483 RequirementDescriptor->u.Interrupt.MinimumVector =
1484 RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1485
1486 RequirementDescriptor++;
1487 }
1488 break;
1489 }
1491 {
1492 ACPI_RESOURCE_IRQ *irq_data = &resource->Data.Irq;
1493 for (i = 0; i < irq_data->InterruptCount; i++)
1494 {
1495 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1496 RequirementDescriptor->Type = CmResourceTypeInterrupt;
1499 RequirementDescriptor->u.Interrupt.MinimumVector =
1500 RequirementDescriptor->u.Interrupt.MaximumVector = irq_data->Interrupts[i];
1501
1502 RequirementDescriptor++;
1503 }
1504 break;
1505 }
1507 {
1508 ACPI_RESOURCE_DMA *dma_data = &resource->Data.Dma;
1509 for (i = 0; i < dma_data->ChannelCount; i++)
1510 {
1511 RequirementDescriptor->Type = CmResourceTypeDma;
1512 RequirementDescriptor->Flags = 0;
1513 switch (dma_data->Type)
1514 {
1515 case ACPI_TYPE_A: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
1516 case ACPI_TYPE_B: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
1517 case ACPI_TYPE_F: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
1518 }
1519 if (dma_data->BusMaster == ACPI_BUS_MASTER)
1520 RequirementDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
1521 switch (dma_data->Transfer)
1522 {
1523 case ACPI_TRANSFER_8: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
1524 case ACPI_TRANSFER_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
1525 case ACPI_TRANSFER_8_16: RequirementDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
1526 }
1527
1528 RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
1529 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1530 RequirementDescriptor->u.Dma.MinimumChannel =
1531 RequirementDescriptor->u.Dma.MaximumChannel = dma_data->Channels[i];
1532 RequirementDescriptor++;
1533 }
1534 break;
1535 }
1537 {
1538 ACPI_RESOURCE_IO *io_data = &resource->Data.Io;
1539 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1540 if (io_data->IoDecode == ACPI_DECODE_16)
1541 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
1542 else
1543 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
1544 RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1545 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1546 RequirementDescriptor->Type = CmResourceTypePort;
1547 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1548 RequirementDescriptor->u.Port.Alignment = io_data->Alignment;
1549 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Minimum;
1550 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Maximum + io_data->AddressLength - 1;
1551
1552 RequirementDescriptor++;
1553 break;
1554 }
1556 {
1557 ACPI_RESOURCE_FIXED_IO *io_data = &resource->Data.FixedIo;
1558 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1559 RequirementDescriptor->u.Port.Length = io_data->AddressLength;
1560 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1561 RequirementDescriptor->Type = CmResourceTypePort;
1562 RequirementDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
1563 RequirementDescriptor->u.Port.Alignment = 1;
1564 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = io_data->Address;
1565 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = io_data->Address + io_data->AddressLength - 1;
1566
1567 RequirementDescriptor++;
1568 break;
1569 }
1571 {
1572 ACPI_RESOURCE_ADDRESS16 *addr16_data = &resource->Data.Address16;
1573 if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
1574 break;
1575 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1576 if (addr16_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1577 {
1578 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1579 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1580 RequirementDescriptor->Flags = 0;
1581 RequirementDescriptor->u.BusNumber.MinBusNumber = addr16_data->Address.Minimum;
1582 RequirementDescriptor->u.BusNumber.MaxBusNumber = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1583 RequirementDescriptor->u.BusNumber.Length = addr16_data->Address.AddressLength;
1584 }
1585 else if (addr16_data->ResourceType == ACPI_IO_RANGE)
1586 {
1587 RequirementDescriptor->Type = CmResourceTypePort;
1588 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1589 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1590 if (addr16_data->Decode == ACPI_POS_DECODE)
1591 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1592 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1593 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1594 RequirementDescriptor->u.Port.Length = addr16_data->Address.AddressLength;
1595 }
1596 else
1597 {
1598 RequirementDescriptor->Type = CmResourceTypeMemory;
1599 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1600 RequirementDescriptor->Flags = 0;
1601 if (addr16_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1602 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1603 else
1604 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1605 switch (addr16_data->Info.Mem.Caching)
1606 {
1607 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1608 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1609 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1610 }
1611 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr16_data->Address.Minimum;
1612 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr16_data->Address.Maximum + addr16_data->Address.AddressLength - 1;
1613 RequirementDescriptor->u.Memory.Length = addr16_data->Address.AddressLength;
1614 }
1615 RequirementDescriptor++;
1616 break;
1617 }
1619 {
1620 ACPI_RESOURCE_ADDRESS32 *addr32_data = &resource->Data.Address32;
1621 if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
1622 break;
1623 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1624 if (addr32_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1625 {
1626 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1627 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1628 RequirementDescriptor->Flags = 0;
1629 RequirementDescriptor->u.BusNumber.MinBusNumber = addr32_data->Address.Minimum;
1630 RequirementDescriptor->u.BusNumber.MaxBusNumber = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1631 RequirementDescriptor->u.BusNumber.Length = addr32_data->Address.AddressLength;
1632 }
1633 else if (addr32_data->ResourceType == ACPI_IO_RANGE)
1634 {
1635 RequirementDescriptor->Type = CmResourceTypePort;
1636 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1637 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1638 if (addr32_data->Decode == ACPI_POS_DECODE)
1639 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1640 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1641 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1642 RequirementDescriptor->u.Port.Length = addr32_data->Address.AddressLength;
1643 }
1644 else
1645 {
1646 RequirementDescriptor->Type = CmResourceTypeMemory;
1647 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1648 RequirementDescriptor->Flags = 0;
1649 if (addr32_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1650 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1651 else
1652 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1653 switch (addr32_data->Info.Mem.Caching)
1654 {
1655 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1656 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1657 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1658 }
1659 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr32_data->Address.Minimum;
1660 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr32_data->Address.Maximum + addr32_data->Address.AddressLength - 1;
1661 RequirementDescriptor->u.Memory.Length = addr32_data->Address.AddressLength;
1662 }
1663 RequirementDescriptor++;
1664 break;
1665 }
1667 {
1668 ACPI_RESOURCE_ADDRESS64 *addr64_data = &resource->Data.Address64;
1669 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1670 break;
1671 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1672 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1673 {
1674 DPRINT1("64-bit bus address is not supported!\n");
1675 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1676 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1677 RequirementDescriptor->Flags = 0;
1678 RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1679 RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1680 RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1681 }
1682 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1683 {
1684 RequirementDescriptor->Type = CmResourceTypePort;
1685 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1686 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1687 if (addr64_data->Decode == ACPI_POS_DECODE)
1688 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1689 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1690 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1691 RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1692 }
1693 else
1694 {
1695 RequirementDescriptor->Type = CmResourceTypeMemory;
1696 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1697 RequirementDescriptor->Flags = 0;
1698 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1699 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1700 else
1701 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1702 switch (addr64_data->Info.Mem.Caching)
1703 {
1704 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1705 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1706 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1707 }
1708 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1709 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1710 RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1711 }
1712 RequirementDescriptor++;
1713 break;
1714 }
1716 {
1717 ACPI_RESOURCE_EXTENDED_ADDRESS64 *addr64_data = &resource->Data.ExtAddress64;
1718 if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
1719 break;
1720 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1721 if (addr64_data->ResourceType == ACPI_BUS_NUMBER_RANGE)
1722 {
1723 DPRINT1("64-bit bus address is not supported!\n");
1724 RequirementDescriptor->Type = CmResourceTypeBusNumber;
1725 RequirementDescriptor->ShareDisposition = CmResourceShareShared;
1726 RequirementDescriptor->Flags = 0;
1727 RequirementDescriptor->u.BusNumber.MinBusNumber = (ULONG)addr64_data->Address.Minimum;
1728 RequirementDescriptor->u.BusNumber.MaxBusNumber = (ULONG)addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1729 RequirementDescriptor->u.BusNumber.Length = addr64_data->Address.AddressLength;
1730 }
1731 else if (addr64_data->ResourceType == ACPI_IO_RANGE)
1732 {
1733 RequirementDescriptor->Type = CmResourceTypePort;
1734 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1735 RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
1736 if (addr64_data->Decode == ACPI_POS_DECODE)
1737 RequirementDescriptor->Flags |= CM_RESOURCE_PORT_POSITIVE_DECODE;
1738 RequirementDescriptor->u.Port.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1739 RequirementDescriptor->u.Port.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1740 RequirementDescriptor->u.Port.Length = addr64_data->Address.AddressLength;
1741 }
1742 else
1743 {
1744 RequirementDescriptor->Type = CmResourceTypeMemory;
1745 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1746 RequirementDescriptor->Flags = 0;
1747 if (addr64_data->Info.Mem.WriteProtect == ACPI_READ_ONLY_MEMORY)
1748 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1749 else
1750 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1751 switch (addr64_data->Info.Mem.Caching)
1752 {
1753 case ACPI_CACHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_CACHEABLE; break;
1754 case ACPI_WRITE_COMBINING_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_COMBINEDWRITE; break;
1755 case ACPI_PREFETCHABLE_MEMORY: RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_PREFETCHABLE; break;
1756 }
1757 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = addr64_data->Address.Minimum;
1758 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = addr64_data->Address.Maximum + addr64_data->Address.AddressLength - 1;
1759 RequirementDescriptor->u.Memory.Length = addr64_data->Address.AddressLength;
1760 }
1761 RequirementDescriptor++;
1762 break;
1763 }
1765 {
1766 ACPI_RESOURCE_MEMORY24 *mem24_data = &resource->Data.Memory24;
1767 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1768 RequirementDescriptor->Type = CmResourceTypeMemory;
1769 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1770 RequirementDescriptor->Flags = CM_RESOURCE_MEMORY_24;
1771 if (mem24_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1772 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1773 else
1774 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1775 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem24_data->Minimum;
1776 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem24_data->Maximum + mem24_data->AddressLength - 1;
1777 RequirementDescriptor->u.Memory.Length = mem24_data->AddressLength;
1778
1779 RequirementDescriptor++;
1780 break;
1781 }
1783 {
1784 ACPI_RESOURCE_MEMORY32 *mem32_data = &resource->Data.Memory32;
1785 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1786 RequirementDescriptor->Type = CmResourceTypeMemory;
1787 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1788 RequirementDescriptor->Flags = 0;
1789 if (mem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1790 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1791 else
1792 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1793 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = mem32_data->Minimum;
1794 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = mem32_data->Maximum + mem32_data->AddressLength - 1;
1795 RequirementDescriptor->u.Memory.Length = mem32_data->AddressLength;
1796
1797 RequirementDescriptor++;
1798 break;
1799 }
1801 {
1802 ACPI_RESOURCE_FIXED_MEMORY32 *fixedmem32_data = &resource->Data.FixedMemory32;
1803 RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
1804 RequirementDescriptor->Type = CmResourceTypeMemory;
1805 RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
1806 RequirementDescriptor->Flags = 0;
1807 if (fixedmem32_data->WriteProtect == ACPI_READ_ONLY_MEMORY)
1808 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_ONLY;
1809 else
1810 RequirementDescriptor->Flags |= CM_RESOURCE_MEMORY_READ_WRITE;
1811 RequirementDescriptor->u.Memory.MinimumAddress.QuadPart = fixedmem32_data->Address;
1812 RequirementDescriptor->u.Memory.MaximumAddress.QuadPart = fixedmem32_data->Address + fixedmem32_data->AddressLength - 1;
1813 RequirementDescriptor->u.Memory.Length = fixedmem32_data->AddressLength;
1814
1815 RequirementDescriptor++;
1816 break;
1817 }
1818 default:
1819 {
1820 break;
1821 }
1822 }
1824 }
1825 ExFreePoolWithTag(Buffer.Pointer, 'BpcA');
1826
1827 Irp->IoStatus.Information = (ULONG_PTR)RequirementsList;
1828
1829 return STATUS_SUCCESS;
1830}
1831
1832#ifndef UNIT_TEST
1836 PIRP Irp )
1837/*++
1838
1839Routine Description:
1840
1841 The PnP Manager sends this IRP to gather information about
1842 devices with a relationship to the specified device.
1843 Bus drivers must handle this request for TargetDeviceRelation
1844 for their child devices (child PDOs).
1845
1846 If a driver returns relations in response to this IRP,
1847 it allocates a DEVICE_RELATIONS structure from paged
1848 memory containing a count and the appropriate number of
1849 device object pointers. The PnP Manager frees the structure
1850 when it is no longer needed. If a driver replaces a
1851 DEVICE_RELATIONS structure allocated by another driver,
1852 it must free the previous structure.
1853
1854 A driver must reference the PDO of any device that it
1855 reports in this IRP (ObReferenceObject). The PnP Manager
1856 removes the reference when appropriate.
1857
1858Arguments:
1859
1860 DeviceData - Pointer to the PDO's device extension.
1861 Irp - Pointer to the irp.
1862
1863Return Value:
1864
1865 NT STATUS
1866
1867--*/
1868{
1869
1871 PDEVICE_RELATIONS deviceRelations;
1873
1874 PAGED_CODE ();
1875
1877
1878 switch (stack->Parameters.QueryDeviceRelations.Type) {
1879
1881
1882 deviceRelations = (PDEVICE_RELATIONS) Irp->IoStatus.Information;
1883 if (deviceRelations) {
1884 //
1885 // Only PDO can handle this request. Somebody above
1886 // is not playing by rule.
1887 //
1888 ASSERTMSG("Someone above is handling TargetDeviceRelation\n", !deviceRelations);
1889 }
1890
1891 deviceRelations = ExAllocatePoolWithTag(PagedPool,
1892 sizeof(DEVICE_RELATIONS),
1893 'IpcA');
1894 if (!deviceRelations) {
1896 break;
1897 }
1898
1899 //
1900 // There is only one PDO pointer in the structure
1901 // for this relation type. The PnP Manager removes
1902 // the reference to the PDO when the driver or application
1903 // un-registers for notification on the device.
1904 //
1905
1906 deviceRelations->Count = 1;
1907 deviceRelations->Objects[0] = DeviceData->Common.Self;
1908 ObReferenceObject(DeviceData->Common.Self);
1909
1911 Irp->IoStatus.Information = (ULONG_PTR) deviceRelations;
1912 break;
1913
1914 case BusRelations: // Not handled by PDO
1915 case EjectionRelations: // optional for PDO
1916 case RemovalRelations: // // optional for PDO
1917 default:
1918 status = Irp->IoStatus.Status;
1919 }
1920
1921 return status;
1922}
1923
1927 PIRP Irp )
1928/*++
1929
1930Routine Description:
1931
1932 The PnP Manager uses this IRP to request the type and
1933 instance number of a device's parent bus. Bus drivers
1934 should handle this request for their child devices (PDOs).
1935
1936Arguments:
1937
1938 DeviceData - Pointer to the PDO's device extension.
1939 Irp - Pointer to the irp.
1940
1941Return Value:
1942
1943 NT STATUS
1944
1945--*/
1946{
1947
1948 PPNP_BUS_INFORMATION busInfo;
1949
1950 PAGED_CODE ();
1951
1953 sizeof(PNP_BUS_INFORMATION),
1954 'IpcA');
1955
1956 if (busInfo == NULL) {
1958 }
1959
1960 busInfo->BusTypeGuid = GUID_ACPI_INTERFACE_STANDARD;
1961
1963
1964 busInfo->BusNumber = 0; //fixme
1965
1966 Irp->IoStatus.Information = (ULONG_PTR)busInfo;
1967
1968 return STATUS_SUCCESS;
1969}
1970
1971
1976 )
1977{
1978 IO_STATUS_BLOCK ioStatus;
1979 KEVENT pnpEvent;
1981 PDEVICE_OBJECT targetObject;
1982 PIO_STACK_LOCATION irpStack;
1983 PIRP pnpIrp;
1984
1985 PAGED_CODE();
1986
1987 //
1988 // Initialize the capabilities that we will send down
1989 //
1992 DeviceCapabilities->Version = 1;
1993 DeviceCapabilities->Address = -1;
1994 DeviceCapabilities->UINumber = -1;
1995
1996 //
1997 // Initialize the event
1998 //
2000
2002
2003 //
2004 // Build an Irp
2005 //
2007 IRP_MJ_PNP,
2008 targetObject,
2009 NULL,
2010 0,
2011 NULL,
2012 &pnpEvent,
2013 &ioStatus
2014 );
2015 if (pnpIrp == NULL) {
2016
2018 goto GetDeviceCapabilitiesExit;
2019
2020 }
2021
2022 //
2023 // Pnp Irps all begin life as STATUS_NOT_SUPPORTED;
2024 //
2026
2027 //
2028 // Get the top of stack
2029 //
2030 irpStack = IoGetNextIrpStackLocation( pnpIrp );
2031
2032 //
2033 // Set the top of stack
2034 //
2035 RtlZeroMemory( irpStack, sizeof(IO_STACK_LOCATION ) );
2036 irpStack->MajorFunction = IRP_MJ_PNP;
2038 irpStack->Parameters.DeviceCapabilities.Capabilities = DeviceCapabilities;
2039
2040 //
2041 // Call the driver
2042 //
2043 status = IoCallDriver( targetObject, pnpIrp );
2044 if (status == STATUS_PENDING) {
2045
2046 //
2047 // Block until the irp comes back.
2048 // Important thing to note here is when you allocate
2049 // the memory for an event in the stack you must do a
2050 // KernelMode wait instead of UserMode to prevent
2051 // the stack from getting paged out.
2052 //
2053
2055 &pnpEvent,
2056 Executive,
2057 KernelMode,
2058 FALSE,
2059 NULL
2060 );
2061 status = ioStatus.Status;
2062
2063 }
2064
2065GetDeviceCapabilitiesExit:
2066 //
2067 // Done with reference
2068 //
2069 ObDereferenceObject( targetObject );
2070
2071 //
2072 // Done
2073 //
2074 return status;
2075
2076}
2077#endif /* UNIT_TEST */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
unsigned char BOOLEAN
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define AE_OK
Definition: acexcep.h:97
#define ACPI_BUTTON_HID_LID
Definition: acpi_drivers.h:106
#define ACPI_THERMAL_HID
Definition: acpi_drivers.h:266
#define ACPI_PROCESSOR_HID
Definition: acpi_drivers.h:221
#define ACPI_FAN_HID
Definition: acpi_drivers.h:139
@ RemovalPending
Definition: acpisys.h:17
@ StopPending
Definition: acpisys.h:15
@ Started
Definition: acpisys.h:14
LPWSTR ProcessorIdString
Definition: main.c:18
PCHAR DbgDeviceRelationString(DEVICE_RELATION_TYPE Type)
NTSTATUS Bus_PDO_QueryInterface(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: interface.c:94
UNICODE_STRING ProcessorHardwareIds
Definition: main.c:17
LPWSTR ProcessorNameString
Definition: main.c:19
#define ACPI_RESOURCE_TYPE_MEMORY32
Definition: acrestyp.h:732
#define ACPI_CACHABLE_MEMORY
Definition: acrestyp.h:61
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:812
#define ACPI_DECODE_16
Definition: acrestyp.h:85
#define ACPI_RESOURCE_TYPE_DMA
Definition: acrestyp.h:724
#define ACPI_RESOURCE_TYPE_MEMORY24
Definition: acrestyp.h:731
#define ACPI_READ_ONLY_MEMORY
Definition: acrestyp.h:57
#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ
Definition: acrestyp.h:738
#define ACPI_POS_DECODE
Definition: acrestyp.h:144
#define ACPI_RESOURCE_TYPE_IRQ
Definition: acrestyp.h:723
#define ACPI_RESOURCE_TYPE_FIXED_IO
Definition: acrestyp.h:728
#define ACPI_BUS_NUMBER_RANGE
Definition: acrestyp.h:139
#define ACPI_PRODUCER
Definition: acrestyp.h:149
#define ACPI_TRANSFER_8_16
Definition: acrestyp.h:124
#define ACPI_SHARED
Definition: acrestyp.h:105
#define ACPI_RESOURCE_TYPE_END_DEPENDENT
Definition: acrestyp.h:726
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:730
#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64
Definition: acrestyp.h:737
#define ACPI_RESOURCE_TYPE_START_DEPENDENT
Definition: acrestyp.h:725
#define ACPI_PREFETCHABLE_MEMORY
Definition: acrestyp.h:63
#define ACPI_TRANSFER_16
Definition: acrestyp.h:125
#define ACPI_TYPE_A
Definition: acrestyp.h:116
#define ACPI_TYPE_B
Definition: acrestyp.h:117
#define ACPI_TRANSFER_8
Definition: acrestyp.h:123
#define ACPI_BUS_MASTER
Definition: acrestyp.h:121
#define ACPI_RESOURCE_TYPE_ADDRESS64
Definition: acrestyp.h:736
#define ACPI_WRITE_COMBINING_MEMORY
Definition: acrestyp.h:62
#define ACPI_TYPE_F
Definition: acrestyp.h:118
#define ACPI_IO_RANGE
Definition: acrestyp.h:138
#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32
Definition: acrestyp.h:733
#define ACPI_RESOURCE_TYPE_ADDRESS32
Definition: acrestyp.h:735
#define ACPI_LEVEL_SENSITIVE
Definition: acrestyp.h:93
#define ACPI_RESOURCE_TYPE_IO
Definition: acrestyp.h:727
#define ACPI_RESOURCE_TYPE_ADDRESS16
Definition: acrestyp.h:734
#define ACPI_D_STATE_COUNT
Definition: actypes.h:638
#define ACPI_STATE_D2
Definition: actypes.h:635
#define ACPI_STATE_D0
Definition: actypes.h:633
#define ACPI_STATE_D3
Definition: actypes.h:636
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_STATE_D1
Definition: actypes.h:634
static int state
Definition: maze.c:121
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
NTSTATUS Bus_PDO_PnP(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpStack, PPDO_DEVICE_DATA DeviceData)
Definition: buspdo.c:23
NTSTATUS Bus_PDO_QueryResources(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:806
NTSTATUS Bus_PDO_QueryDeviceRelations(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1834
NTSTATUS Bus_PDO_QueryDeviceText(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:693
NTSTATUS Bus_PDO_QueryDeviceId(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:445
NTSTATUS Bus_PDO_QueryResourceRequirements(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1313
NTSTATUS Bus_PDO_QueryDeviceCaps(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:327
NTSTATUS Bus_PDO_QueryBusInformation(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1925
NTSTATUS Bus_GetDeviceCapabilities(PDEVICE_OBJECT DeviceObject, PDEVICE_CAPABILITIES DeviceCapabilities)
Definition: buspdo.c:1973
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
Definition: bufpool.h:45
wcscpy
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define swprintf
Definition: precomp.h:40
int acpi_bus_get_device(ACPI_HANDLE handle, struct acpi_device **device)
Definition: bus.c:108
BOOLEAN acpi_bus_power_manageable(ACPI_HANDLE handle)
Definition: bus.c:351
int acpi_bus_set_power(ACPI_HANDLE handle, int state)
Definition: bus.c:249
ACPI_STATUS acpi_evaluate_integer(ACPI_HANDLE handle, ACPI_STRING pathname, ACPI_OBJECT_LIST *arguments, unsigned long long *data)
Definition: utils.c:242
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define PagedPool
Definition: env_spec_w32.h:308
#define SET_NEW_PNP_STATE(_Data_, _state_)
Definition: fbtusb.h:111
@ Stopped
Definition: fbtusb.h:81
#define RESTORE_PREVIOUS_PNP_STATE(_Data_)
Definition: fbtusb.h:115
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
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
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypeDma
Definition: hwresource.cpp:126
@ InternalPowerBus
Definition: hwresource.cpp:150
@ Internal
Definition: hwresource.cpp:137
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeBusNumber
Definition: hwresource.cpp:128
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define resource
Definition: kernel32.h:9
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define for
Definition: utility.h:88
#define CM_RESOURCE_PORT_POSITIVE_DECODE
Definition: cmtypes.h:113
#define CM_RESOURCE_MEMORY_PREFETCHABLE
Definition: cmtypes.h:123
#define CM_RESOURCE_DMA_8_AND_16
Definition: cmtypes.h:134
#define CM_RESOURCE_DMA_BUS_MASTER
Definition: cmtypes.h:135
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_DMA_8
Definition: cmtypes.h:131
#define CM_RESOURCE_DMA_TYPE_A
Definition: cmtypes.h:136
#define CM_RESOURCE_DMA_TYPE_F
Definition: cmtypes.h:138
#define CM_RESOURCE_MEMORY_READ_ONLY
Definition: cmtypes.h:121
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CM_RESOURCE_MEMORY_COMBINEDWRITE
Definition: cmtypes.h:124
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
#define CM_RESOURCE_MEMORY_CACHEABLE
Definition: cmtypes.h:126
#define CM_RESOURCE_DMA_TYPE_B
Definition: cmtypes.h:137
#define CM_RESOURCE_DMA_16
Definition: cmtypes.h:132
#define CM_RESOURCE_MEMORY_24
Definition: cmtypes.h:125
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
#define CM_RESOURCE_PORT_10_BIT_DECODE
Definition: cmtypes.h:110
#define KernelMode
Definition: asm.h:38
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define UNICODE_NULL
@ NotificationEvent
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
Definition: device.c:1406
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:1437
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1793
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 IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:729
@ PowerSystemSleeping1
Definition: ntpoapi.h:37
@ PowerSystemSleeping2
Definition: ntpoapi.h:38
@ PowerSystemSleeping3
Definition: ntpoapi.h:39
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ DevicePowerState
Definition: ntpoapi.h:63
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD2
Definition: ntpoapi.h:51
@ PowerDeviceD3
Definition: ntpoapi.h:52
#define L(x)
Definition: ntvdm.h:50
static calc_node_t temp
Definition: rpn_ieee.c:38
ACPI_STATUS AcpiGetCurrentResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:225
ACPI_STATUS AcpiGetPossibleResources(ACPI_HANDLE DeviceHandle, ACPI_BUFFER *RetBuffer)
Definition: rsxface.c:273
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437::@440 Interrupt
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437::@445 BusNumber
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437::@442 Memory
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437::@443 Dma
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@437::@439 Port
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
struct _IO_RESOURCE_DESCRIPTOR::@2168::@2175 BusNumber
struct _IO_RESOURCE_DESCRIPTOR::@2168::@2171 Interrupt
struct _IO_RESOURCE_DESCRIPTOR::@2168::@2170 Memory
union _IO_RESOURCE_DESCRIPTOR::@2168 u
struct _IO_RESOURCE_DESCRIPTOR::@2168::@2172 Dma
struct _IO_RESOURCE_DESCRIPTOR::@2168::@2169 Port
struct _IO_STACK_LOCATION::@4138::@4165 DeviceCapabilities
struct _IO_STACK_LOCATION::@4138::@4163 QueryDeviceRelations
union _IO_STACK_LOCATION::@1648 Parameters
IO_STATUS_BLOCK IoStatus
INTERFACE_TYPE LegacyBusType
Definition: cmtypes.h:365
struct acpi_device_status status
Definition: acpi_bus.h:275
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS16_ATTRIBUTE Address
Definition: acrestyp.h:394
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS32_ATTRIBUTE Address
Definition: acrestyp.h:402
ACPI_RESOURCE_ADDRESS_COMMON ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:410
UINT8 Channels[1]
Definition: acrestyp.h:195
UINT8 ChannelCount
Definition: acrestyp.h:194
ACPI_ADDRESS64_ATTRIBUTE Address
Definition: acrestyp.h:419
UINT16 Maximum
Definition: acrestyp.h:220
UINT16 Minimum
Definition: acrestyp.h:219
UINT8 AddressLength
Definition: acrestyp.h:218
UINT8 Interrupts[1]
Definition: acrestyp.h:185
UINT8 InterruptCount
Definition: acrestyp.h:184
Definition: devices.h:37
bool removable
Definition: btrfs_drv.h:528
Definition: format.c:80
Definition: ps.c:97
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
#define DeviceCapabilities
Definition: wingdi.h:4449
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareShared
Definition: cmtypes.h:243
@ CmResourceShareDriverExclusive
Definition: cmtypes.h:242
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#define IRP_MN_CANCEL_STOP_DEVICE
DEVICE_CAPABILITIES
Definition: iotypes.h:965
@ EjectionRelations
Definition: iotypes.h:2153
@ RemovalRelations
Definition: iotypes.h:2155
@ BusRelations
Definition: iotypes.h:2152
@ TargetDeviceRelation
Definition: iotypes.h:2156
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IO_RESOURCE_ALTERNATIVE
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IO_RESOURCE_PREFERRED
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
@ DeviceTextDescription
Definition: iotypes.h:2945
@ BusQueryCompatibleIDs
Definition: iotypes.h:2938
@ BusQueryInstanceID
Definition: iotypes.h:2939
@ BusQueryDeviceID
Definition: iotypes.h:2936
@ BusQueryHardwareIDs
Definition: iotypes.h:2937
struct _IO_RESOURCE_REQUIREMENTS_LIST IO_RESOURCE_REQUIREMENTS_LIST
#define IRP_MN_QUERY_BUS_INFORMATION
#define IRP_MN_QUERY_REMOVE_DEVICE
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define NT_ASSERT
Definition: rtlfuncs.h:3327
__wchar_t WCHAR
Definition: xmlstorage.h:180