ReactOS  0.4.14-dev-98-gb0d4763
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/acpi/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 typedef enum _EXTENSION_TYPE
16 {
20 
21 typedef enum _PDO_TYPE
22 {
23  AcpiPdo = 0x80,
25 } PDO_TYPE;
26 
27 typedef struct _FDO_EXTENSION
28 {
35 
36 typedef struct _PDO_EXTENSION
37 {
46 
47 /* GLOBALS ********************************************************************/
48 
50 
51 /* PRIVATE FUNCTIONS **********************************************************/
52 
53 VOID
54 NTAPI
57  IN ULONG Count)
58 {
64 
65  /* Create the PDO */
67  sizeof(PDO_EXTENSION),
68  NULL,
71  FALSE,
73  if (!NT_SUCCESS(Status))
74  {
75  /* Fail */
76  DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
77  return;
78  }
79 
80  /* Setup the PDO device extension */
81  PdoExtension = PdoDeviceObject->DeviceExtension;
82  PdoExtension->ExtensionType = PdoExtensionType;
83  PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
84  PdoExtension->ParentFdoExtension = FdoExtension;
85  PdoExtension->PdoType = AcpiPdo;
86 
87  /* Add the PDO to the head of the list */
88  PdoExtension->Next = FdoExtension->ChildPdoList;
89  FdoExtension->ChildPdoList = PdoExtension;
90 
91  /* Initialization is finished */
93 
94  /* Find the ACPI watchdog table */
95  Wdrt = HalAcpiGetTable(0, 'TRDW');
96  if (Wdrt)
97  {
98  /* FIXME: TODO */
99  DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
100  }
101 
102  /* This will synchronously load the ACPI driver (needed because we're critical for boot) */
104 }
105 
106 NTSTATUS
107 NTAPI
110 {
113  PDEVICE_OBJECT DeviceObject, AttachedDevice;
114 
115  DPRINT("HAL: PnP Driver ADD!\n");
116 
117  /* Create the FDO */
119  sizeof(FDO_EXTENSION),
120  NULL,
122  0,
123  FALSE,
124  &DeviceObject);
125  if (!NT_SUCCESS(Status))
126  {
127  /* Should not happen */
128  DbgBreakPoint();
129  return Status;
130  }
131 
132  /* Setup the FDO extension */
134  FdoExtension->ExtensionType = FdoExtensionType;
135  FdoExtension->PhysicalDeviceObject = TargetDevice;
136  FdoExtension->FunctionalDeviceObject = DeviceObject;
137  FdoExtension->ChildPdoList = NULL;
138 
139  /* FDO is done initializing */
141 
142  /* Attach to the physical device object (the bus) */
144  if (!AttachedDevice)
145  {
146  /* Failed, undo everything */
148  return STATUS_NO_SUCH_DEVICE;
149  }
150 
151  /* Save the attachment */
152  FdoExtension->AttachedDeviceObject = AttachedDevice;
153 
154  /* Register for reinitialization to report devices later */
157  FdoExtension);
158 
159  /* Return status */
160  DPRINT("Device added %lx\n", Status);
161  return Status;
162 }
163 
164 NTSTATUS
165 NTAPI
167  IN CONST GUID* InterfaceType,
168  IN USHORT Version,
169  IN PVOID InterfaceSpecificData,
170  IN ULONG InterfaceBufferSize,
172  OUT PULONG Length)
173 {
175  return STATUS_NOT_SUPPORTED;
176 }
177 
178 NTSTATUS
179 NTAPI
181  IN DEVICE_RELATION_TYPE RelationType,
182  OUT PDEVICE_RELATIONS* DeviceRelations)
183 {
187  PDEVICE_RELATIONS PdoRelations, FdoRelations;
188  PDEVICE_OBJECT* ObjectEntry;
189  ULONG i = 0, PdoCount = 0;
190 
191  /* Get FDO device extension and PDO count */
193  ExtensionType = FdoExtension->ExtensionType;
194 
195  /* What do they want? */
196  if (RelationType == BusRelations)
197  {
198  /* This better be an FDO */
200  {
201  /* Count how many PDOs we have */
202  PdoExtension = FdoExtension->ChildPdoList;
203  while (PdoExtension)
204  {
205  /* Next one */
206  PdoExtension = PdoExtension->Next;
207  PdoCount++;
208  }
209 
210  /* Add the PDOs that already exist in the device relations */
211  if (*DeviceRelations)
212  {
213  PdoCount += (*DeviceRelations)->Count;
214  }
215 
216  /* Allocate our structure */
217  FdoRelations = ExAllocatePoolWithTag(PagedPool,
219  Objects) +
220  sizeof(PDEVICE_OBJECT) * PdoCount,
221  TAG_HAL);
222  if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
223 
224  /* Save our count */
225  FdoRelations->Count = PdoCount;
226 
227  /* Query existing relations */
228  ObjectEntry = FdoRelations->Objects;
229  if (*DeviceRelations)
230  {
231  /* Check if there were any */
232  if ((*DeviceRelations)->Count)
233  {
234  /* Loop them all */
235  do
236  {
237  /* Copy into our structure */
238  *ObjectEntry++ = (*DeviceRelations)->Objects[i];
239  }
240  while (++i < (*DeviceRelations)->Count);
241  }
242 
243  /* Free existing structure */
244  ExFreePool(*DeviceRelations);
245  }
246 
247  /* Now check if we have a PDO list */
248  PdoExtension = FdoExtension->ChildPdoList;
249  if (PdoExtension)
250  {
251  /* Loop the PDOs */
252  do
253  {
254  /* Save our own PDO and reference it */
255  *ObjectEntry++ = PdoExtension->PhysicalDeviceObject;
256  ObReferenceObject(PdoExtension->PhysicalDeviceObject);
257 
258  /* Go to our next PDO */
259  PdoExtension = PdoExtension->Next;
260  }
261  while (PdoExtension);
262  }
263 
264  /* Return the new structure */
265  *DeviceRelations = FdoRelations;
266  return STATUS_SUCCESS;
267  }
268  }
269  else
270  {
271  /* The only other thing we support is a target relation for the PDO */
272  if ((RelationType == TargetDeviceRelation) &&
274  {
275  /* Only one entry */
276  PdoRelations = ExAllocatePoolWithTag(PagedPool,
277  sizeof(DEVICE_RELATIONS),
278  TAG_HAL);
279  if (!PdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
280 
281  /* Fill it out and reference us */
282  PdoRelations->Count = 1;
283  PdoRelations->Objects[0] = DeviceObject;
285 
286  /* Return it */
287  *DeviceRelations = PdoRelations;
288  return STATUS_SUCCESS;
289  }
290  }
291 
292  /* We don't support anything else */
293  return STATUS_NOT_SUPPORTED;
294 }
295 
296 NTSTATUS
297 NTAPI
300 {
301  //PPDO_EXTENSION PdoExtension;
303  PAGED_CODE();
304 
305  /* Get the extension and check for valid version */
306  //PdoExtension = DeviceObject->DeviceExtension;
307  ASSERT(Capabilities->Version == 1);
308  if (Capabilities->Version == 1)
309  {
310  /* Can't lock or eject us */
311  Capabilities->LockSupported = FALSE;
312  Capabilities->EjectSupported = FALSE;
313 
314  /* Can't remove or dock us */
315  Capabilities->Removable = FALSE;
316  Capabilities->DockDevice = FALSE;
317 
318  /* Can't access us raw */
319  Capabilities->RawDeviceOK = FALSE;
320 
321  /* We have a unique ID, and don't bother the user */
322  Capabilities->UniqueID = TRUE;
323  Capabilities->SilentInstall = TRUE;
324 
325  /* Fill out the adress */
328 
329  /* Fill out latencies */
330  Capabilities->D1Latency = 0;
331  Capabilities->D2Latency = 0;
332  Capabilities->D3Latency = 0;
333 
334  /* Fill out supported device states */
339 
340  /* Done */
342  }
343  else
344  {
345  /* Fail */
347  }
348 
349  /* Return status */
350  return Status;
351 }
352 
353 NTSTATUS
354 NTAPI
357 {
358  PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
361  PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
364  ULONG i;
365  PAGED_CODE();
366 
367  /* Only the ACPI PDO has requirements */
368  if (DeviceExtension->PdoType == AcpiPdo)
369  {
370  /* Query ACPI requirements */
371  Status = HalpQueryAcpiResourceRequirements(&RequirementsList);
372  if (!NT_SUCCESS(Status)) return Status;
373 
374  ASSERT(RequirementsList->AlternativeLists == 1);
375 
376  /* Allocate the resourcel ist */
378  sizeof(CM_RESOURCE_LIST),
379  TAG_HAL);
380  if (!ResourceList )
381  {
382  /* Fail, no memory */
384  ExFreePoolWithTag(RequirementsList, TAG_HAL);
385  return Status;
386  }
387 
388  /* Initialize it */
390  ResourceList->Count = 1;
391 
392  /* Setup the list fields */
393  ResourceList->List[0].BusNumber = -1;
394  ResourceList->List[0].InterfaceType = PNPBus;
395  ResourceList->List[0].PartialResourceList.Version = 1;
396  ResourceList->List[0].PartialResourceList.Revision = 1;
397  ResourceList->List[0].PartialResourceList.Count = 0;
398 
399  /* Setup the first descriptor */
400  PartialDesc = ResourceList->List[0].PartialResourceList.PartialDescriptors;
401 
402  /* Find the requirement descriptor for the SCI */
403  for (i = 0; i < RequirementsList->List[0].Count; i++)
404  {
405  /* Get this descriptor */
406  Descriptor = &RequirementsList->List[0].Descriptors[i];
407  if (Descriptor->Type == CmResourceTypeInterrupt)
408  {
409  /* Copy requirements descriptor into resource descriptor */
410  PartialDesc->Type = CmResourceTypeInterrupt;
411  PartialDesc->ShareDisposition = Descriptor->ShareDisposition;
412  PartialDesc->Flags = Descriptor->Flags;
413  ASSERT(Descriptor->u.Interrupt.MinimumVector ==
414  Descriptor->u.Interrupt.MaximumVector);
415  PartialDesc->u.Interrupt.Vector = Descriptor->u.Interrupt.MinimumVector;
416  PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector;
417  PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF;
418 
419  ResourceList->List[0].PartialResourceList.Count++;
420 
421  break;
422  }
423  }
424 
425  /* Return resources and success */
427 
428  ExFreePoolWithTag(RequirementsList, TAG_HAL);
429 
430  return STATUS_SUCCESS;
431  }
432  else if (DeviceExtension->PdoType == WdPdo)
433  {
434  /* Watchdog doesn't */
435  return STATUS_NOT_SUPPORTED;
436  }
437  else
438  {
439  /* This shouldn't happen */
440  return STATUS_UNSUCCESSFUL;
441  }
442 }
443 
444 NTSTATUS
445 NTAPI
447  OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
448 {
449  PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
450  PAGED_CODE();
451 
452  /* Only the ACPI PDO has requirements */
453  if (DeviceExtension->PdoType == AcpiPdo)
454  {
455  /* Query ACPI requirements */
456  return HalpQueryAcpiResourceRequirements(Requirements);
457  }
458  else if (DeviceExtension->PdoType == WdPdo)
459  {
460  /* Watchdog doesn't */
461  return STATUS_NOT_SUPPORTED;
462  }
463  else
464  {
465  /* This shouldn't happen */
466  return STATUS_UNSUCCESSFUL;
467  }
468 }
469 
470 NTSTATUS
471 NTAPI
474  OUT PUSHORT *BusQueryId)
475 {
478  PWCHAR CurrentId;
479  WCHAR Id[100];
481  SIZE_T Length = 0;
482  PWCHAR Buffer;
483 
484  /* Get the PDO type */
486  PdoType = PdoExtension->PdoType;
487 
488  /* What kind of ID is being requested? */
489  DPRINT("ID: %d\n", IdType);
490  switch (IdType)
491  {
492  case BusQueryDeviceID:
493  case BusQueryHardwareIDs:
494 
495  /* What kind of PDO is this? */
496  if (PdoType == AcpiPdo)
497  {
498  /* ACPI ID */
499  CurrentId = L"ACPI_HAL\\PNP0C08";
500  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
501  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
502 
503  CurrentId = L"*PNP0C08";
504  RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
505  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
506  }
507  else if (PdoType == WdPdo)
508  {
509  /* WatchDog ID */
510  CurrentId = L"ACPI_HAL\\PNP0C18";
511  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
512  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
513 
514  CurrentId = L"*PNP0C18";
515  RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
516  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
517  }
518  else
519  {
520  /* Unknown */
521  return STATUS_NOT_SUPPORTED;
522  }
523  break;
524 
525  case BusQueryInstanceID:
526 
527  /* Instance ID */
528  CurrentId = L"0";
529  RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL));
530  Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
531  break;
532 
534  default:
535 
536  /* We don't support anything else */
537  return STATUS_NOT_SUPPORTED;
538  }
539 
540 
541  /* Allocate the buffer */
543  Length + sizeof(UNICODE_NULL),
544  TAG_HAL);
545  if (Buffer)
546  {
547  /* Copy the string and null-terminate it */
549  Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
550 
551  /* Return string */
552  *BusQueryId = Buffer;
554  DPRINT("Returning: %S\n", *BusQueryId);
555  }
556  else
557  {
558  /* Fail */
560  }
561 
562  /* Return status */
563  return Status;
564 }
565 
566 NTSTATUS
567 NTAPI
570  OUT PUSHORT *BusQueryId)
571 {
573  SIZE_T Length;
574  PWCHAR Id;
575  PWCHAR Buffer;
576 
577  /* What kind of ID is being requested? */
578  DPRINT("ID: %d\n", IdType);
579  switch (IdType)
580  {
581  case BusQueryDeviceID:
582  /* HACK */
583  Id = L"Root\\ACPI_HAL";
584  break;
585 
586  case BusQueryHardwareIDs:
587 
588  /* This is our hardware ID */
590  break;
591 
592  case BusQueryInstanceID:
593 
594  /* And our instance ID */
595  Id = L"0";
596  break;
597 
598  default:
599 
600  /* We don't support anything else */
601  return STATUS_NOT_SUPPORTED;
602  }
603 
604  /* Calculate the length */
605  Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
606 
607  /* Allocate the buffer */
609  Length + sizeof(UNICODE_NULL),
610  TAG_HAL);
611  if (Buffer)
612  {
613  /* Copy the string and null-terminate it */
615  Buffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
616 
617  /* Return string */
618  *BusQueryId = Buffer;
620  DPRINT("Returning: %S\n", *BusQueryId);
621  }
622  else
623  {
624  /* Fail */
626  }
627 
628  /* Return status */
629  return Status;
630 }
631 
632 NTSTATUS
633 NTAPI
635  IN PIRP Irp)
636 {
637  PIO_STACK_LOCATION IoStackLocation;
638  //PPDO_EXTENSION PdoExtension;
641  UCHAR Minor;
642 
643  /* Get the device extension and stack location */
645  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
646  Minor = IoStackLocation->MinorFunction;
647 
648  /* FDO? */
649  if (FdoExtension->ExtensionType == FdoExtensionType)
650  {
651  /* Query the IRP type */
652  switch (Minor)
653  {
655 
656  /* Call the worker */
657  DPRINT("Querying device relations for FDO\n");
659  IoStackLocation->Parameters.QueryDeviceRelations.Type,
660  (PVOID)&Irp->IoStatus.Information);
661  break;
662 
664 
665  /* Call the worker */
666  DPRINT("Querying interface for FDO\n");
668  IoStackLocation->Parameters.QueryInterface.InterfaceType,
669  IoStackLocation->Parameters.QueryInterface.Size,
670  IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
671  IoStackLocation->Parameters.QueryInterface.Version,
672  IoStackLocation->Parameters.QueryInterface.Interface,
673  (PVOID)&Irp->IoStatus.Information);
674  break;
675 
676 
677  case IRP_MN_QUERY_ID:
678 
679  /* Call the worker */
680  DPRINT("Querying ID for FDO\n");
682  IoStackLocation->Parameters.QueryId.IdType,
683  (PVOID)&Irp->IoStatus.Information);
684  break;
685 
687 
688  /* Call the worker */
689  DPRINT("Querying the capabilities for the FDO\n");
691  IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
692  break;
693 
694  default:
695 
696  DPRINT("Other IRP: %lx\n", Minor);
697  Status = Irp->IoStatus.Status;
698  break;
699  }
700 
701  /* Nowhere for the IRP to go since we also own the PDO */
702  Irp->IoStatus.Status = Status;
704  return Status;
705  }
706  else
707  {
708  /* This is a PDO instead */
709  ASSERT(FdoExtension->ExtensionType == PdoExtensionType);
710  //PdoExtension = (PPDO_EXTENSION)FdoExtension;
711  /* Query the IRP type */
713  switch (Minor)
714  {
715  case IRP_MN_START_DEVICE:
716 
717  /* We only care about a PCI PDO */
718  DPRINT1("Start device received\n");
719  /* Complete the IRP normally */
720  break;
721 
723 
724  /* Check if this is a PCI device */
725  DPRINT1("Remove device received\n");
726 
727  /* We're done */
729  break;
730 
732 
733  /* Inherit whatever status we had */
734  DPRINT1("Surprise removal IRP\n");
735  Status = Irp->IoStatus.Status;
736  break;
737 
739 
740  /* Query the device relations */
741  DPRINT("Querying PDO relations\n");
743  IoStackLocation->Parameters.QueryDeviceRelations.Type,
744  (PVOID)&Irp->IoStatus.Information);
745  break;
746 
748 
749  /* Call the worker */
750  DPRINT("Querying interface for PDO\n");
752  IoStackLocation->Parameters.QueryInterface.InterfaceType,
753  IoStackLocation->Parameters.QueryInterface.Size,
754  IoStackLocation->Parameters.QueryInterface.InterfaceSpecificData,
755  IoStackLocation->Parameters.QueryInterface.Version,
756  IoStackLocation->Parameters.QueryInterface.Interface,
757  (PVOID)&Irp->IoStatus.Information);
758  break;
759 
761 
762  /* Call the worker */
763  DPRINT("Querying the capabilities for the PDO\n");
765  IoStackLocation->Parameters.DeviceCapabilities.Capabilities);
766  break;
767 
769 
770  /* Call the worker */
771  DPRINT("Querying the resources for the PDO\n");
772  Status = HalpQueryResources(DeviceObject, (PVOID)&Irp->IoStatus.Information);
773  break;
774 
776 
777  /* Call the worker */
778  DPRINT("Querying the resource requirements for the PDO\n");
780  (PVOID)&Irp->IoStatus.Information);
781  break;
782 
783  case IRP_MN_QUERY_ID:
784 
785  /* Call the worker */
786  DPRINT("Query the ID for the PDO\n");
788  IoStackLocation->Parameters.QueryId.IdType,
789  (PVOID)&Irp->IoStatus.Information);
790  break;
791 
792  default:
793 
794  /* We don't handle anything else, so inherit the old state */
795  DPRINT("Illegal IRP: %lx\n", Minor);
796  Status = Irp->IoStatus.Status;
797  break;
798  }
799 
800  /* If it's not supported, inherit the old status */
801  if (Status == STATUS_NOT_SUPPORTED) Status = Irp->IoStatus.Status;
802 
803  /* Complete the IRP */
804  DPRINT("IRP completed with status: %lx\n", Status);
805  Irp->IoStatus.Status = Status;
807  return Status;
808  }
809 }
810 
811 NTSTATUS
812 NTAPI
814  IN PIRP Irp)
815 {
816  UNIMPLEMENTED_DBGBREAK("HAL: PnP Driver WMI!\n");
817  return STATUS_SUCCESS;
818 }
819 
820 NTSTATUS
821 NTAPI
823  IN PIRP Irp)
824 {
826 
827  DPRINT("HAL: PnP Driver Power!\n");
829  if (FdoExtension->ExtensionType == FdoExtensionType)
830  {
833  return PoCallDriver(FdoExtension->AttachedDeviceObject, Irp);
834  }
835  else
836  {
838  Irp->IoStatus.Status = STATUS_SUCCESS;
840  return STATUS_SUCCESS;
841  }
842 }
843 
844 NTSTATUS
845 NTAPI
848 {
851 
852  DPRINT("HAL: PnP Driver ENTRY!\n");
853 
854  /* This is us */
856 
857  /* Set up add device */
859 
860  /* Set up the callouts */
864 
865  /* Create the PDO */
867  0,
868  NULL,
870  0,
871  FALSE,
872  &TargetDevice);
873  if (!NT_SUCCESS(Status))
874  return Status;
875 
877 
878  /* Set up the device stack */
880  if (!NT_SUCCESS(Status))
881  {
883  return Status;
884  }
885 
886  /* Tell the PnP manager about us */
889  -1,
890  -1,
891  NULL,
892  NULL,
893  FALSE,
894  &TargetDevice);
895 
896  /* Return to kernel */
897  return Status;
898 }
899 
900 NTSTATUS
901 NTAPI
903 {
905  UNICODE_STRING DriverString;
906  PAGED_CODE();
907 
908  /* Create the driver */
909  RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
910  Status = IoCreateDriver(&DriverString, HalpDriverEntry);
911 
912  /* Return status */
913  return Status;
914 }
915 
916 /* EOF */
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
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:166
NTSTATUS NTAPI IoSynchronousInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:5147
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44
NTSTATUS NTAPI HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:472
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define IRP_MN_QUERY_RESOURCES
enum _BUS_QUERY_ID_TYPE BUS_QUERY_ID_TYPE
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IRP_MN_QUERY_ID
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:688
LONG InterfaceReferenceCount
Definition: halpnpdd.c:44
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:31
_In_ PIRP Irp
Definition: csq.h:116
PDRIVER_OBJECT HalpDriverObject
Definition: halpnpdd.c:49
NTSTATUS NTAPI HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:822
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2055
_PDO_TYPE
Definition: halpnpdd.c:21
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PDEVICE_OBJECT PhysicalDeviceObject
Definition: halpnpdd.c:40
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI HalAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG Signature)
Definition: halacpi.c:446
struct _PDO_EXTENSION * Next
Definition: halpnpdd.c:39
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
enum _EXTENSION_TYPE EXTENSION_TYPE
EXTENSION_TYPE
Definition: precomp.h:44
NTSTATUS NTAPI HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halacpi.c:1016
_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:89
uint16_t * PWCHAR
Definition: typedefs.h:54
void DbgBreakPoint()
Definition: mach.c:553
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
NTSTATUS NTAPI HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
Definition: halpnpdd.c:446
#define PAGED_CODE()
Definition: video.h:57
DWORD Id
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@375::@378 Interrupt
PDEVICE_OBJECT FunctionalDeviceObject
Definition: halpnpdd.c:32
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
NTSTATUS NTAPI HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:634
NTSTATUS NTAPI IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, IN INTERFACE_TYPE LegacyBusType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PCM_RESOURCE_LIST ResourceList, IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL, IN BOOLEAN ResourceAssigned, IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL)
Definition: pnpreport.c:162
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
#define UNICODE_NULL
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
long LONG
Definition: pedump.c:60
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@375 u
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, IN BUS_QUERY_ID_TYPE IdType, OUT PUSHORT *BusQueryId)
Definition: halpnpdd.c:568
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS NTAPI HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: halpnpdd.c:813
Definition: bufpool.h:45
_In_ BUS_QUERY_ID_TYPE IdType
Definition: classpnp.h:357
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
PFDO_EXTENSION ParentFdoExtension
Definition: halpnpdd.c:41
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:38
struct _PDO_EXTENSION * PPDO_EXTENSION
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
PWCHAR HalHardwareIdString
Definition: halacpi.c:44
PDEVICE_OBJECT AttachedDeviceObject
Definition: halpnpdd.c:33
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_INTERFACE
NTSTATUS NTAPI HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: halpnpdd.c:846
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
enum _PDO_TYPE PDO_TYPE
VOID NTAPI IoRegisterBootDriverReinitialization(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_REINITIALIZE ReinitRoutine, IN PVOID Context)
Definition: driver.c:1706
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IRP_MJ_POWER
struct _FDO_EXTENSION * PFDO_EXTENSION
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2393
static const WCHAR L[]
Definition: oid.c:1250
#define TAG_HAL
Definition: hal.h:55
EXTENSION_TYPE ExtensionType
Definition: halpnpdd.c:29
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2383
PDESCRIPTION_HEADER WdTable
Definition: halpnpdd.c:43
VOID NTAPI HalpReportDetectedDevices(IN PDRIVER_OBJECT DriverObject, IN PVOID Context, IN ULONG Count)
Definition: halpnpdd.c:55
PDO_TYPE PdoType
Definition: halpnpdd.c:42
#define IRP_MJ_SYSTEM_CONTROL
* PDEVICE_CAPABILITIES
Definition: iotypes.h:928
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
ULONG_PTR SIZE_T
Definition: typedefs.h:78
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
NTSTATUS NTAPI IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, IN PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1683
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
unsigned short USHORT
Definition: pedump.c:61
struct _PDO_EXTENSION * ChildPdoList
Definition: halpnpdd.c:30
NTSTATUS NTAPI HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, OUT PCM_RESOURCE_LIST *Resources)
Definition: halpnpdd.c:355
NTSTATUS NTAPI HalpAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT TargetDevice)
Definition: halpnpdd.c:108
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int * PULONG
Definition: retypes.h:1
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
NTSTATUS NTAPI HaliInitPnpDriver(VOID)
Definition: halpnpdd.c:902
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define DPRINT1
Definition: precomp.h:8
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
NTSTATUS NTAPI HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE RelationType, OUT PDEVICE_RELATIONS *DeviceRelations)
Definition: halpnpdd.c:180
#define OUT
Definition: typedefs.h:39
#define ObReferenceObject
Definition: obfuncs.h:204
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
struct tagContext Context
Definition: acpixf.h:1024
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
Definition: halpnpdd.c:24
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define FILE_DEVICE_BUS_EXTENDER
Definition: winioctl.h:147
struct _FDO_EXTENSION FDO_EXTENSION
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned short * PUSHORT
Definition: retypes.h:2
#define CONST
Definition: pedump.c:81
_EXTENSION_TYPE
Definition: halpnpdd.c:15
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
struct _PDO_EXTENSION PDO_EXTENSION
NTSTATUS NTAPI HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_CAPABILITIES Capabilities)
Definition: halpnpdd.c:298
#define IRP_MN_QUERY_CAPABILITIES
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966