ReactOS 0.4.17-dev-966-gf06eace
halpnpdd.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HAL
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: hal/halx86/legacy/halpnpdd.c
5 * PURPOSE: HAL Plug and Play Device Driver
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include <hal.h>
12#define NDEBUG
13#include <debug.h>
14
15#include <initguid.h>
16#include <wdmguid.h>
17
18typedef enum _EXTENSION_TYPE
19{
23
24typedef enum _PDO_TYPE
25{
26 AcpiPdo = 0x80,
27 WdPdo
29
30typedef struct _FDO_EXTENSION
31{
38
39typedef struct _PDO_EXTENSION
40{
42 struct _PDO_EXTENSION* Next;
49
50/* GLOBALS ********************************************************************/
51
53
54/* PRIVATE FUNCTIONS **********************************************************/
55
60{
64 PDEVICE_OBJECT DeviceObject, AttachedDevice;
66// PDESCRIPTION_HEADER Wdrt;
67
68 DPRINT("HAL: PnP Driver ADD!\n");
69
70 /* Create the FDO */
72 sizeof(FDO_EXTENSION),
73 NULL,
75 0,
76 FALSE,
78 if (!NT_SUCCESS(Status))
79 {
80 /* Should not happen */
82 return Status;
83 }
84
85 /* Setup the FDO extension */
86 FdoExtension = DeviceObject->DeviceExtension;
87 FdoExtension->ExtensionType = FdoExtensionType;
88 FdoExtension->PhysicalDeviceObject = TargetDevice;
89 FdoExtension->FunctionalDeviceObject = DeviceObject;
90 FdoExtension->ChildPdoList = NULL;
91
92 /* FDO is done initializing */
93 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
94
95 /* Attach to the physical device object (the bus) */
97 if (!AttachedDevice)
98 {
99 /* Failed, undo everything */
102 }
103
104 /* Save the attachment */
105 FdoExtension->AttachedDeviceObject = AttachedDevice;
106
107 /* Create the PDO */
109 sizeof(PDO_EXTENSION),
110 NULL,
113 FALSE,
115 if (!NT_SUCCESS(Status))
116 {
117 /* Fail */
118 DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
119 return Status;
120 }
121
122 /* Setup the PDO device extension */
123 PdoExtension = PdoDeviceObject->DeviceExtension;
124 PdoExtension->ExtensionType = PdoExtensionType;
125 PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
126 PdoExtension->ParentFdoExtension = FdoExtension;
127 PdoExtension->PdoType = AcpiPdo;
128
129 /* Add the PDO to the head of the list */
130 PdoExtension->Next = FdoExtension->ChildPdoList;
131 FdoExtension->ChildPdoList = PdoExtension;
132
133 /* Initialization is finished */
134 PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
135
136 /* Return status */
137 DPRINT("Device added %lx\n", Status);
138 return Status;
139}
140
141static
142VOID
143NTAPI
145{
146 PPDO_EXTENSION HalPdoExtension = ((PDEVICE_OBJECT)Context)->DeviceExtension;
148}
149
150static
151VOID
152NTAPI
154{
155 PPDO_EXTENSION HalPdoExtension = ((PDEVICE_OBJECT)Context)->DeviceExtension;
157}
158
159static
161NTAPI
166{
167 DeviceDescriptor->BusNumber = 0;
169}
170
172NTAPI
177 IN ULONG InterfaceBufferSize,
180{
182
183 if (((PFDO_EXTENSION)DeviceObject->DeviceExtension)->ExtensionType == FdoExtensionType)
184 {
185 //TODO: Does PC98 Have PIR? Or does it needs it's own Arbiter?
186#if !defined(SARCH_XBOX) && !defined(SARCH_PC98)
187 if (!IsEqualIID(InterfaceType, &GUID_ARBITER_INTERFACE_STANDARD) ||
189 {
190 return Status;
191 }
192
194 if (NT_SUCCESS(Status))
195 {
196 HalpLegacyPCQueryArbInterface(Interface, InterfaceBufferSize, Length);
197 }
198#endif
199 }
200
201 if (IsEqualIID(InterfaceType, &GUID_BUS_INTERFACE_STANDARD))
202 {
204
205 *Length = sizeof(*BusInterface);
206 if (InterfaceBufferSize < sizeof(*BusInterface))
208
209 RtlZeroMemory(BusInterface, sizeof(*BusInterface));
210 BusInterface->Size = sizeof(*BusInterface);
211 BusInterface->Version = 1;
212 BusInterface->Context = DeviceObject;
216 }
217 else if (IsEqualIID(InterfaceType, &GUID_PCI_BUS_INTERFACE_STANDARD))
218 {
220
221 *Length = sizeof(*PciBusInterface);
222 if (InterfaceBufferSize < sizeof(*PciBusInterface))
224
225 RtlZeroMemory(PciBusInterface, sizeof(*PciBusInterface));
226 PciBusInterface->Size = sizeof(*PciBusInterface);
227 PciBusInterface->Version = 1;
228 PciBusInterface->Context = DeviceObject;
233 }
234 else
235 {
236 DPRINT1("HalpQueryInterface({%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}) is UNIMPLEMENTED\n",
237 InterfaceType->Data1, InterfaceType->Data2, InterfaceType->Data3,
238 InterfaceType->Data4[0], InterfaceType->Data4[1],
239 InterfaceType->Data4[2], InterfaceType->Data4[3],
240 InterfaceType->Data4[4], InterfaceType->Data4[5],
241 InterfaceType->Data4[6], InterfaceType->Data4[7]);
242 }
243
244 return Status;
245}
246
248NTAPI
251 OUT PDEVICE_RELATIONS* DeviceRelations)
252{
256 PDEVICE_RELATIONS PdoRelations, FdoRelations;
257 PDEVICE_OBJECT* ObjectEntry;
258 ULONG i = 0, PdoCount = 0;
259
260 /* Get FDO device extension and PDO count */
261 FdoExtension = DeviceObject->DeviceExtension;
262 ExtensionType = FdoExtension->ExtensionType;
263
264 /* What do they want? */
266 {
267 /* This better be an FDO */
269 {
270 /* Count how many PDOs we have */
271 PdoExtension = FdoExtension->ChildPdoList;
272 while (PdoExtension)
273 {
274 /* Next one */
276 PdoCount++;
277 }
278
279 /* Add the PDOs that already exist in the device relations */
280 if (*DeviceRelations)
281 {
282 PdoCount += (*DeviceRelations)->Count;
283 }
284
285 /* Allocate our structure */
286 FdoRelations = ExAllocatePoolWithTag(PagedPool,
288 Objects) +
289 sizeof(PDEVICE_OBJECT) * PdoCount,
290 TAG_HAL);
291 if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
292
293 /* Save our count */
294 FdoRelations->Count = PdoCount;
295
296 /* Query existing relations */
297 ObjectEntry = FdoRelations->Objects;
298 if (*DeviceRelations)
299 {
300 /* Check if there were any */
301 if ((*DeviceRelations)->Count)
302 {
303 /* Loop them all */
304 do
305 {
306 /* Copy into our structure */
307 *ObjectEntry++ = (*DeviceRelations)->Objects[i];
308 }
309 while (++i < (*DeviceRelations)->Count);
310 }
311
312 /* Free existing structure */
313 ExFreePool(*DeviceRelations);
314 }
315
316 /* Now check if we have a PDO list */
317 PdoExtension = FdoExtension->ChildPdoList;
318 if (PdoExtension)
319 {
320 /* Loop the PDOs */
321 do
322 {
323 /* Save our own PDO and reference it */
324 *ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
325 ObReferenceObject(PdoExtension->PhysicalDeviceObject);
326
327 /* Go to our next PDO */
329 }
330 while (PdoExtension);
331 }
332
333 /* Return the new structure */
334 *DeviceRelations = FdoRelations;
335 return STATUS_SUCCESS;
336 }
337 }
338 else
339 {
340 /* The only other thing we support is a target relation for the PDO */
343 {
344 /* Only one entry */
345 PdoRelations = ExAllocatePoolWithTag(PagedPool,
346 sizeof(DEVICE_RELATIONS),
347 TAG_HAL);
348 if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
349
350 /* Fill it out and reference us */
351 PdoRelations->Count = 1;
352 PdoRelations->Objects[0] = DeviceObject;
354
355 /* Return it */
356 *DeviceRelations = PdoRelations;
357 return STATUS_SUCCESS;
358 }
359 }
360
361 /* We don't support anything else */
363}
364
366NTAPI
369{
370 //PPDO_EXTENSION PdoExtension;
372 PAGED_CODE();
373
374 /* Get the extension and check for valid version */
375 //PdoExtension = DeviceObject->DeviceExtension;
376 ASSERT(Capabilities->Version == 1);
377 if (Capabilities->Version == 1)
378 {
379 /* Can't lock or eject us */
380 Capabilities->LockSupported = FALSE;
381 Capabilities->EjectSupported = FALSE;
382
383 /* Can't remove or dock us */
384 Capabilities->Removable = FALSE;
385 Capabilities->DockDevice = FALSE;
386
387 /* Can't access us raw */
388 Capabilities->RawDeviceOK = FALSE;
389
390 /* We have a unique ID, and don't bother the user */
391 Capabilities->UniqueID = TRUE;
392 Capabilities->SilentInstall = TRUE;
393
394 /* Fill out the address */
397
398 /* Fill out latencies */
399 Capabilities->D1Latency = 0;
400 Capabilities->D2Latency = 0;
401 Capabilities->D3Latency = 0;
402
403 /* Fill out supported device states */
408
409 /* Done */
411 }
412 else
413 {
414 /* Fail */
416 }
417
418 /* Return status */
419 return Status;
420}
421
423NTAPI
426{
427 PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
430// PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
431// PIO_RESOURCE_DESCRIPTOR Descriptor;
432// PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDesc;
433// ULONG i;
434 PAGED_CODE();
435
436 /* Only the ACPI PDO has requirements */
437 if (DeviceExtension->PdoType == AcpiPdo)
438 {
439#if 0
440 /* Query ACPI requirements */
442 if (!NT_SUCCESS(Status)) return Status;
443
444 ASSERT(RequirementsList->AlternativeLists == 1);
445#endif
446
447 /* Allocate the resourcel ist */
449 sizeof(CM_RESOURCE_LIST),
450 TAG_HAL);
451 if (!ResourceList )
452 {
453 /* Fail, no memory */
455// ExFreePoolWithTag(RequirementsList, TAG_HAL);
456 return Status;
457 }
458
459 /* Initialize it */
461 ResourceList->Count = 1;
462
463 /* Setup the list fields */
464 ResourceList->List[0].BusNumber = 0;
465 ResourceList->List[0].InterfaceType = PCIBus;
466 ResourceList->List[0].PartialResourceList.Version = 1;
467 ResourceList->List[0].PartialResourceList.Revision = 1;
468 ResourceList->List[0].PartialResourceList.Count = 0;
469
470 /* Setup the first descriptor */
471 //PartialDesc = ResourceList->List[0].PartialResourceList.PartialDescriptors;
472
473 /* Find the requirement descriptor for the SCI */
474#if 0
475 for (i = 0; i < RequirementsList->List[0].Count; i++)
476 {
477 /* Get this descriptor */
478 Descriptor = &RequirementsList->List[0].Descriptors[i];
480 {
481 /* Copy requirements descriptor into resource descriptor */
482 PartialDesc->Type = CmResourceTypeInterrupt;
483 PartialDesc->ShareDisposition = Descriptor->ShareDisposition;
484 PartialDesc->Flags = Descriptor->Flags;
485 ASSERT(Descriptor->u.Interrupt.MinimumVector ==
486 Descriptor->u.Interrupt.MaximumVector);
487 PartialDesc->u.Interrupt.Vector = Descriptor->u.Interrupt.MinimumVector;
488 PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector;
489 PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF;
490
491 ResourceList->List[0].PartialResourceList.Count++;
492
493 break;
494 }
495 }
496#endif
497
498 /* Return resources and success */
500
501// ExFreePoolWithTag(RequirementsList, TAG_HAL);
502
503 return STATUS_SUCCESS;
504 }
505 else if (DeviceExtension->PdoType == WdPdo)
506 {
507 /* Watchdog doesn't */
509 }
510 else
511 {
512 /* This shouldn't happen */
513 return STATUS_UNSUCCESSFUL;
514 }
515}
516
518NTAPI
521{
522 PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
523 PAGED_CODE();
524
525 /* Only the ACPI PDO has requirements */
526 if (DeviceExtension->PdoType == AcpiPdo)
527 {
528 /* Query ACPI requirements */
529// return HalpQueryAcpiResourceRequirements(Requirements);
530 return STATUS_SUCCESS;
531 }
532 else if (DeviceExtension->PdoType == WdPdo)
533 {
534 /* Watchdog doesn't */
536 }
537 else
538 {
539 /* This shouldn't happen */
540 return STATUS_UNSUCCESSFUL;
541 }
542}
543
545NTAPI
548 OUT PUSHORT *BusQueryId)
549{
552 PWCHAR CurrentId;
553 WCHAR Id[100];
555 ULONG Length = 0;
557
558 /* Get the PDO type */
559 PdoExtension = DeviceObject->DeviceExtension;
560 PdoType = PdoExtension->PdoType;
561
562 /* What kind of ID is being requested? */
563 DPRINT("ID: %d\n", IdType);
564 switch (IdType)
565 {
566 case BusQueryDeviceID:
568
569 /* What kind of PDO is this? */
570 if (PdoType == AcpiPdo)
571 {
572 /* ACPI ID */
573 CurrentId = L"PCI_HAL\\PNP0A03";
574 RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
575 Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
576
577 CurrentId = L"*PNP0A03";
578 RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
579 Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
580 }
581#if 0
582 else if (PdoType == WdPdo)
583 {
584 /* WatchDog ID */
585 CurrentId = L"ACPI_HAL\\PNP0C18";
586 RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
587 Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
588
589 CurrentId = L"*PNP0C18";
590 RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
591 Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
592 }
593#endif
594 else
595 {
596 /* Unknown */
598 }
599 break;
600
602
603 /* Instance ID */
604 CurrentId = L"0";
605 RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
606 Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
607 break;
608
610 default:
611
612 /* We don't support anything else */
614 }
615
616 /* Allocate the buffer */
618 Length + sizeof(UNICODE_NULL),
619 TAG_HAL);
620 if (Buffer)
621 {
622 /* Copy the string and null-terminate it */
624 Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
625
626 /* Return string */
627 *BusQueryId = Buffer;
629 DPRINT("Returning: %S\n", *BusQueryId);
630 }
631 else
632 {
633 /* Fail */
635 }
636
637 /* Return status */
638 return Status;
639}
640
642NTAPI
645 OUT PUSHORT *BusQueryId)
646{
649 PWCHAR Id;
651
652 /* What kind of ID is being requested? */
653 DPRINT("ID: %d\n", IdType);
654 switch (IdType)
655 {
656 case BusQueryDeviceID:
658
659 /* This is our hardware ID */
661 break;
662
664
665 /* And our instance ID */
666 Id = L"0";
667 break;
668
669 default:
670
671 /* We don't support anything else */
673 }
674
675 /* Calculate the length */
676 Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
677
678 /* Allocate the buffer */
680 Length + sizeof(UNICODE_NULL),
681 TAG_HAL);
682 if (Buffer)
683 {
684 /* Copy the string and null-terminate it */
686 Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
687
688 /* Return string */
689 *BusQueryId = Buffer;
691 DPRINT("Returning: %S\n", *BusQueryId);
692 }
693 else
694 {
695 /* Fail */
697 }
698
699 /* Return status */
700 return Status;
701}
702
704NTAPI
706 IN PIRP Irp)
707{
709 //PPDO_EXTENSION PdoExtension;
712 UCHAR Minor;
713
714 /* Get the device extension and stack location */
715 FdoExtension = DeviceObject->DeviceExtension;
718
719 /* FDO? */
720 if (FdoExtension->ExtensionType == FdoExtensionType)
721 {
722 /* Query the IRP type */
723 switch (Minor)
724 {
726
727 /* Call the worker */
728 DPRINT("Querying device relations for FDO\n");
731 (PVOID)&Irp->IoStatus.Information);
732 break;
733
735
736 /* Call the worker */
737 DPRINT("Querying interface for FDO\n");
741 IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
744 (PVOID)&Irp->IoStatus.Information);
745 break;
746
747 case IRP_MN_QUERY_ID:
748
749 /* Call the worker */
750 DPRINT("Querying ID for FDO\n");
753 (PVOID)&Irp->IoStatus.Information);
754 break;
755
757
758 /* Call the worker */
759 DPRINT("Querying the capabilities for the FDO\n");
762 break;
763
764 default:
765
766 DPRINT("Other IRP: %lx\n", Minor);
768 break;
769 }
770
771 /* What happpened? */
773 {
774 /* Set the IRP status, unless this isn't understood */
776 {
777 Irp->IoStatus.Status = Status;
778 }
779
780 /* Pass it on */
782 return IoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
783 }
784
785 /* Otherwise, we failed, so set the status and complete the request */
786 DPRINT1("IRP failed with status: %lx\n", Status);
787 Irp->IoStatus.Status = Status;
789 return Status;
790 }
791 else
792 {
793 /* This is a PDO instead */
794 ASSERT(FdoExtension->ExtensionType == PdoExtensionType);
795 //PdoExtension = (PPDO_EXTENSION)FdoExtension;
796
797 /* Query the IRP type */
799 switch (Minor)
800 {
802
803 /* We only care about a PCI PDO */
804 DPRINT("Start device received\n");
805 /* Complete the IRP normally */
806 break;
807
809
810 /* Check if this is a PCI device */
811 DPRINT("Remove device received\n");
812
813 /* We're done */
815 break;
816
818
819 /* Inherit whatever status we had */
820 DPRINT("Surprise removal IRP\n");
821 Status = Irp->IoStatus.Status;
822 break;
823
825
826 /* Query the device relations */
827 DPRINT("Querying PDO relations\n");
830 (PVOID)&Irp->IoStatus.Information);
831 break;
832
834
835 /* Call the worker */
836 DPRINT("Querying interface for PDO\n");
840 IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
843 (PVOID)&Irp->IoStatus.Information);
844 break;
845
847
848 /* Call the worker */
849 DPRINT("Querying the capabilities for the PDO\n");
852 break;
853
855
856 /* Call the worker */
857 DPRINT("Querying the resources for the PDO\n");
858 Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
859 break;
860
862
863 /* Call the worker */
864 DPRINT("Querying the resource requirements for the PDO\n");
866 (PVOID)&Irp->IoStatus.Information);
867 break;
868
869 case IRP_MN_QUERY_ID:
870
871 /* Call the worker */
872 DPRINT("Query the ID for the PDO\n");
875 (PVOID)&Irp->IoStatus.Information);
876 break;
877
879
880 /* Inherit whatever status we had */
881 DPRINT("Query text for the PDO\n");
882 Status = Irp->IoStatus.Status;
883 break;
884
886
887 /* Inherit whatever status we had */
888 DPRINT("Filter resource requirements for the PDO\n");
889 Status = Irp->IoStatus.Status;
890 break;
891
893
894 /* Inherit whatever status we had */
895 DPRINT("Query device state for the PDO\n");
896 Status = Irp->IoStatus.Status;
897 break;
898
900
901 /* Inherit whatever status we had */
902 DPRINT("Query bus information for the PDO\n");
903 Status = Irp->IoStatus.Status;
904 break;
905
906 default:
907
908 /* We don't handle anything else, so inherit the old state */
909 DPRINT1("Illegal IRP: %lx\n", Minor);
910 Status = Irp->IoStatus.Status;
911 break;
912 }
913
914 /* If it's not supported, inherit the old status */
915 if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
916
917 /* Complete the IRP */
918 DPRINT("IRP completed with status: %lx\n", Status);
919 Irp->IoStatus.Status = Status;
921 return Status;
922 }
923}
924
926NTAPI
928 IN PIRP Irp)
929{
930 UNIMPLEMENTED_DBGBREAK("HAL: PnP Driver WMI!\n");
931 return STATUS_SUCCESS;
932}
933
935NTAPI
937 IN PIRP Irp)
938{
940
941 DPRINT1("HAL: PnP Driver Power!\n");
942 FdoExtension = DeviceObject->DeviceExtension;
943 if (FdoExtension->ExtensionType == FdoExtensionType)
944 {
947 return PoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
948 }
949 else
950 {
952 Irp->IoStatus.Status = STATUS_SUCCESS;
954 return STATUS_SUCCESS;
955 }
956}
957
959NTAPI
962{
965
966 DPRINT("HAL: PnP Driver ENTRY!\n");
967
968 /* This is us */
970
971 /* Set up add device */
973
974 /* Set up the callouts */
975 DriverObject->MajorFunction[IRP_MJ_PNP] = HalpDispatchPnp;
978
979 /* Create the PDO and tell the PnP manager about us*/
982 -1,
983 -1,
984 NULL,
985 NULL,
986 FALSE,
987 &TargetDevice);
988 if (!NT_SUCCESS(Status))
989 return Status;
990
991 TargetDevice->Flags &= ~DO_DEVICE_INITIALIZING;
992
993 /* Set up the device stack */
995 if (!NT_SUCCESS(Status))
996 {
998 return Status;
999 }
1000
1001 /* Return to kernel */
1002 return Status;
1003}
1004
1006NTAPI
1008{
1010 UNICODE_STRING DriverString;
1011 PAGED_CODE();
1012
1013 /* Create the driver */
1014 RtlInitUnicodeString(&DriverString, L"\\Driver\\PCI_HAL");
1015 Status = IoCreateDriver(&DriverString, HalpDriverEntry);
1016
1017 /* Return status */
1018 return Status;
1019}
1020
1021/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define PAGED_CODE()
DWORD Id
NTSTATUS NTAPI HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, OUT PCM_RESOURCE_LIST *Resources)
Definition: halpnpdd.c:357
enum _PDO_TYPE PDO_TYPE
struct _FDO_EXTENSION * PFDO_EXTENSION
_EXTENSION_TYPE
Definition: halpnpdd.c:20
@ PdoExtensionType
Definition: halpnpdd.c:21
@ FdoExtensionType
Definition: halpnpdd.c:22
NTSTATUS NTAPI HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halpnpdd.c:448
NTSTATUS NTAPI HalpQueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID *InterfaceType, IN USHORT Version, IN PVOID InterfaceSpecificData, IN ULONG InterfaceBufferSize, IN PINTERFACE Interface, OUT PULONG Length)
Definition: halpnpdd.c:152
NTSTATUS NTAPI HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:474
NTSTATUS NTAPI HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:835
NTSTATUS NTAPI HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: halpnpdd.c:859
NTSTATUS NTAPI HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:826
NTSTATUS NTAPI HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:570
NTSTATUS NTAPI HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_CAPABILITIES Capabilities)
Definition: halpnpdd.c:300
enum _EXTENSION_TYPE EXTENSION_TYPE
NTSTATUS NTAPI HalpAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT TargetDevice)
Definition: halpnpdd.c:59
struct _PDO_EXTENSION PDO_EXTENSION
NTSTATUS NTAPI HaliInitPnpDriver(VOID)
Definition: halpnpdd.c:906
struct _FDO_EXTENSION FDO_EXTENSION
NTSTATUS NTAPI HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE RelationType, OUT PDEVICE_RELATIONS *DeviceRelations)
Definition: halpnpdd.c:182
PDRIVER_OBJECT HalpDriverObject
Definition: halpnpdd.c:53
_PDO_TYPE
Definition: halpnpdd.c:26
@ AcpiPdo
Definition: halpnpdd.c:27
@ WdPdo
Definition: halpnpdd.c:28
struct _PDO_EXTENSION * PPDO_EXTENSION
NTSTATUS NTAPI HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:632
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
ULONG NTAPI HaliPciInterfaceReadConfig(_In_ PBUS_HANDLER RootBusHandler, _In_ ULONG BusNumber, _In_ PCI_SLOT_NUMBER SlotNumber, _Out_writes_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Definition: pcibus.c:934
ULONG NTAPI HaliPciInterfaceWriteConfig(_In_ PBUS_HANDLER RootBusHandler, _In_ ULONG BusNumber, _In_ PCI_SLOT_NUMBER SlotNumber, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Definition: pcibus.c:957
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
Definition: bufpool.h:45
_In_ BUS_QUERY_ID_TYPE IdType
Definition: classpnp.h:374
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
_Check_return_ _In_ ULONG _Inout_ PDXGK_DEVICE_DESCRIPTOR DeviceDescriptor
Definition: dispmprt.h:1263
#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
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define L(x)
Definition: resources.c:13
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
EXTENSION_TYPE
Definition: precomp.h:45
@ PdoExtension
Definition: precomp.h:49
@ FdoExtension
Definition: precomp.h:48
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:24
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
PDMA_ADAPTER NTAPI HalpGetDmaAdapter(IN PVOID Context, IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:850
#define TAG_HAL
Definition: hal.h:61
PWCHAR HalHardwareIdString
Definition: halacpi.c:44
NTSTATUS NTAPI HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halacpi.c:1067
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT _In_ PUSB_PORT_PATH _Out_ PUSB_CD_ERROR_INFORMATION _In_ USHORT _In_ PDEVICE_OBJECT PdoDeviceObject
Definition: hubbusif.h:95
static PDMA_ADAPTER NTAPI HalpBusInterfaceGetDmaAdapter(_Inout_opt_ PVOID Context, _In_ PDEVICE_DESCRIPTION DeviceDescriptor, _Out_ PULONG NumberOfMapRegisters)
Definition: halpnpdd.c:162
static VOID NTAPI HalpBusInterfaceReference(PVOID Context)
Definition: halpnpdd.c:144
static VOID NTAPI HalpBusInterfaceDereference(PVOID Context)
Definition: halpnpdd.c:153
NTSTATUS NTAPI HalpLegacyPCQueryArbInterface(_Out_writes_bytes_(Size) PVOID Interface, _In_ ULONG Size, _Out_ PULONG Length)
Query the legacy PC Arbiter.
NTSTATUS NTAPI HalpLegacyPCCreateArbiter(_In_ PDEVICE_OBJECT BusFdo)
Initialize the legacy PC arbiter that uses PIR for PIC IRQ assignments.
#define ASSERT(a)
Definition: mode.c:44
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:142
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:971
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:1036
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1259
NTSTATUS NTAPI IoCreateDriver(_In_opt_ PUNICODE_STRING DriverName, _In_ PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1591
#define IoCompleteRequest
Definition: irp.c:1272
#define IoCallDriver
Definition: irp.c:1257
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
@ PowerSystemSleeping3
Definition: ntpoapi.h:39
@ PowerSystemShutdown
Definition: ntpoapi.h:41
@ PowerSystemWorking
Definition: ntpoapi.h:36
@ PowerSystemHibernate
Definition: ntpoapi.h:40
@ PowerDeviceD0
Definition: ntpoapi.h:49
@ PowerDeviceD3
Definition: ntpoapi.h:52
#define CONST
Definition: pedump.c:81
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI IoReportDetectedDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ INTERFACE_TYPE LegacyBusType, _In_ ULONG BusNumber, _In_ ULONG SlotNumber, _In_opt_ PCM_RESOURCE_LIST ResourceList, _In_opt_ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements, _In_ BOOLEAN ResourceAssigned, _Inout_ PDEVICE_OBJECT *DeviceObject)
Definition: pnpreport.c:148
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:87
@ InterfaceTypeUndefined
Definition: restypes.h:121
@ PCIBus
Definition: restypes.h:127
#define CmResourceTypeInterrupt
Definition: restypes.h:105
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
_In_ PVOID Context
Definition: storport.h:2269
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:911
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:912
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:914
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2222
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2284
PDEVICE_OBJECT FunctionalDeviceObject
Definition: halpnpdd.c:36
PDEVICE_OBJECT AttachedDeviceObject
Definition: halpnpdd.c:37
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:33
struct _PDO_EXTENSION * ChildPdoList
Definition: halpnpdd.c:34
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:35
union _IO_STACK_LOCATION::@1803 Parameters
struct _IO_STACK_LOCATION::@4925::@4950 QueryDeviceRelations
struct _IO_STACK_LOCATION::@4925::@4951 QueryInterface
struct _IO_STACK_LOCATION::@4925::@4952 DeviceCapabilities
struct _IO_STACK_LOCATION::@4925::@4956 QueryId
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:5330
PCI_READ_WRITE_CONFIG ReadConfig
Definition: iotypes.h:5331
PINTERFACE_REFERENCE InterfaceReference
Definition: iotypes.h:5329
PCI_READ_WRITE_CONFIG WriteConfig
Definition: iotypes.h:5332
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:44
PDESCRIPTION_HEADER WdTable
Definition: halpnpdd.c:47
struct _PDO_EXTENSION * Next
Definition: halpnpdd.c:43
PFDO_EXTENSION ParentFdoExtension
Definition: halpnpdd.c:45
LONG InterfaceReferenceCount
Definition: halpnpdd.c:48
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:42
PDO_TYPE PdoType
Definition: halpnpdd.c:46
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PIO_STACK_LOCATION IoStackLocation
Definition: usbdlib.h:265
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_In_ DEVICE_RELATION_TYPE RelationType
Definition: wdfdevice.h:1059
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:472
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
NTSYSAPI void WINAPI DbgBreakPoint(void)
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:691
@ BusRelations
Definition: iotypes.h:2154
@ TargetDeviceRelation
Definition: iotypes.h:2158
struct _PCI_BUS_INTERFACE_STANDARD * PPCI_BUS_INTERFACE_STANDARD
#define IRP_MN_QUERY_PNP_DEVICE_STATE
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
ULONG(NTAPI * PCI_READ_WRITE_CONFIG)(_In_ PVOID Context, _In_ ULONG BusOffset, _In_ ULONG Slot, _In_reads_bytes_(Length) PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Definition: iotypes.h:5296
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
struct _BUS_INTERFACE_STANDARD * PBUS_INTERFACE_STANDARD
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
* PDEVICE_CAPABILITIES
Definition: iotypes.h:965
#define IRP_MJ_POWER
@ BusQueryCompatibleIDs
Definition: iotypes.h:2940
@ BusQueryInstanceID
Definition: iotypes.h:2941
@ BusQueryDeviceID
Definition: iotypes.h:2938
@ BusQueryHardwareIDs
Definition: iotypes.h:2939
enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE
#define IRP_MN_QUERY_BUS_INFORMATION
#define ObReferenceObject
Definition: obfuncs.h:204