3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: hal/halx86/generic/acpi/halpnpdd.c
5 * PURPOSE: HAL Plug and Play Device Driver
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
15 typedef enum _EXTENSION_TYPE
17 PdoExtensionType
= 0xC0,
21 typedef enum _PDO_TYPE
27 typedef struct _FDO_EXTENSION
29 EXTENSION_TYPE ExtensionType
;
30 struct _PDO_EXTENSION
* ChildPdoList
;
31 PDEVICE_OBJECT PhysicalDeviceObject
;
32 PDEVICE_OBJECT FunctionalDeviceObject
;
33 PDEVICE_OBJECT AttachedDeviceObject
;
34 } FDO_EXTENSION
, *PFDO_EXTENSION
;
36 typedef struct _PDO_EXTENSION
38 EXTENSION_TYPE ExtensionType
;
39 struct _PDO_EXTENSION
* Next
;
40 PDEVICE_OBJECT PhysicalDeviceObject
;
41 PFDO_EXTENSION ParentFdoExtension
;
43 PDESCRIPTION_HEADER WdTable
;
44 LONG InterfaceReferenceCount
;
45 } PDO_EXTENSION
, *PPDO_EXTENSION
;
47 /* GLOBALS ********************************************************************/
49 PDRIVER_OBJECT HalpDriverObject
;
51 /* PRIVATE FUNCTIONS **********************************************************/
55 HalpAddDevice(IN PDRIVER_OBJECT DriverObject
,
56 IN PDEVICE_OBJECT TargetDevice
)
59 PFDO_EXTENSION FdoExtension
;
60 PPDO_EXTENSION PdoExtension
;
61 PDEVICE_OBJECT DeviceObject
, PdoDeviceObject
, AttachedDevice
;
62 PDESCRIPTION_HEADER Wdrt
;
63 DbgPrint("HAL: PnP Driver ADD!\n");
66 Status
= IoCreateDevice(DriverObject
,
67 sizeof(FDO_EXTENSION
),
69 FILE_DEVICE_BUS_EXTENDER
,
73 if (!NT_SUCCESS(Status
))
75 /* Should not happen */
80 /* Setup the FDO extension */
81 FdoExtension
= DeviceObject
->DeviceExtension
;
82 FdoExtension
->ExtensionType
= FdoExtensionType
;
83 FdoExtension
->PhysicalDeviceObject
= TargetDevice
;
84 FdoExtension
->FunctionalDeviceObject
= DeviceObject
;
86 /* FDO is done initializing */
87 DeviceObject
->Flags
&= DO_DEVICE_INITIALIZING
;
89 /* Attach to the physical device object (the bus) */
90 AttachedDevice
= IoAttachDeviceToDeviceStack(DeviceObject
, TargetDevice
);
93 /* Failed, undo everything */
94 IoDeleteDevice(DeviceObject
);
95 return STATUS_NO_SUCH_DEVICE
;
98 /* Save the attachment */
99 FdoExtension
->AttachedDeviceObject
= AttachedDevice
;
102 Status
= IoCreateDevice(DriverObject
,
103 sizeof(PDO_EXTENSION
),
105 FILE_DEVICE_BUS_EXTENDER
,
106 FILE_AUTOGENERATED_DEVICE_NAME
,
109 if (!NT_SUCCESS(Status
))
112 DbgPrint("HAL: Could not create ACPI device object status=0x%08x\n", Status
);
116 /* Setup the PDO device extension */
117 PdoExtension
= PdoDeviceObject
->DeviceExtension
;
118 PdoExtension
->Next
= NULL
;
119 PdoExtension
->ExtensionType
= PdoExtensionType
;
120 PdoExtension
->PhysicalDeviceObject
= PdoDeviceObject
;
121 PdoExtension
->ParentFdoExtension
= FdoExtension
;
122 PdoExtension
->PdoType
= AcpiPdo
;
124 /* Find the ACPI watchdog table */
125 Wdrt
= HalAcpiGetTable(0, 'TRDW');
128 /* None exists, there is nothing to do more */
129 PdoDeviceObject
->Flags
&= DO_DEVICE_INITIALIZING
;
130 FdoExtension
->ChildPdoList
= PdoExtension
;
135 DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
136 PdoDeviceObject
->Flags
&= DO_DEVICE_INITIALIZING
;
137 FdoExtension
->ChildPdoList
= PdoExtension
;
141 DPRINT1("Device added %lx\n", Status
);
147 HalpQueryInterface(IN PDEVICE_OBJECT DeviceObject
,
148 IN CONST GUID
* InterfaceType
,
150 IN PVOID InterfaceSpecificData
,
151 IN ULONG InterfaceBufferSize
,
152 IN PINTERFACE Interface
,
157 return STATUS_NO_SUCH_DEVICE
;
162 HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject
,
163 IN DEVICE_RELATION_TYPE RelationType
,
164 OUT PDEVICE_RELATIONS
* DeviceRelations
)
166 EXTENSION_TYPE ExtensionType
;
167 PPDO_EXTENSION PdoExtension
;
168 PFDO_EXTENSION FdoExtension
;
169 PDEVICE_RELATIONS PdoRelations
, FdoRelations
;
170 PDEVICE_OBJECT
* ObjectEntry
;
171 ULONG i
= 0, PdoCount
= 0;
173 /* Get FDO device extension and PDO count */
174 FdoExtension
= DeviceObject
->DeviceExtension
;
175 ExtensionType
= FdoExtension
->ExtensionType
;
177 /* What do they want? */
178 if (RelationType
== BusRelations
)
180 /* This better be an FDO */
181 if (ExtensionType
== FdoExtensionType
)
183 /* Count how many PDOs we have */
184 PdoExtension
= FdoExtension
->ChildPdoList
;
188 PdoExtension
= PdoExtension
->Next
;
192 /* Allocate our structure */
193 FdoRelations
= ExAllocatePoolWithTag(PagedPool
,
194 FIELD_OFFSET(DEVICE_RELATIONS
,
198 if (!FdoRelations
) return STATUS_INSUFFICIENT_RESOURCES
;
201 FdoRelations
->Count
= PdoCount
;
203 /* Query existing relations */
204 ObjectEntry
= FdoRelations
->Objects
;
205 if (*DeviceRelations
)
207 /* Check if there were any */
208 if ((*DeviceRelations
)->Count
)
213 /* Copy into our structure */
214 *ObjectEntry
++ = (*DeviceRelations
)->Objects
[i
];
216 while (++i
< (*DeviceRelations
)->Count
);
219 /* Free existing structure */
220 ExFreePoolWithTag(*DeviceRelations
, 0);
223 /* Now check if we have a PDO list */
224 PdoExtension
= FdoExtension
->ChildPdoList
;
230 /* Save our own PDO and reference it */
231 *ObjectEntry
++ = PdoExtension
->PhysicalDeviceObject
;
232 ObfReferenceObject(PdoExtension
->PhysicalDeviceObject
);
234 /* Go to our next PDO */
235 PdoExtension
= PdoExtension
->Next
;
237 while (PdoExtension
);
240 /* Return the new structure */
241 *DeviceRelations
= FdoRelations
;
242 return STATUS_SUCCESS
;
247 /* The only other thing we support is a target relation for the PDO */
248 if ((RelationType
== TargetDeviceRelation
) &&
249 (ExtensionType
== PdoExtensionType
))
252 PdoRelations
= ExAllocatePoolWithTag(PagedPool
,
253 sizeof(DEVICE_RELATIONS
),
255 if (!PdoRelations
) return STATUS_INSUFFICIENT_RESOURCES
;
257 /* Fill it out and reference us */
258 PdoRelations
->Count
= 1;
259 PdoRelations
->Objects
[0] = DeviceObject
;
260 ObfReferenceObject(DeviceObject
);
263 *DeviceRelations
= PdoRelations
;
264 return STATUS_SUCCESS
;
268 /* We don't support anything else */
269 return STATUS_NOT_SUPPORTED
;
274 HalpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject
,
275 OUT PDEVICE_CAPABILITIES Capabilities
)
277 PPDO_EXTENSION PdoExtension
;
281 /* Get the extension and check for valid version */
282 PdoExtension
= DeviceObject
->DeviceExtension
;
283 ASSERT(Capabilities
->Version
== 1);
284 if (Capabilities
->Version
== 1)
286 /* Can't lock or eject us */
287 Capabilities
->LockSupported
= FALSE
;
288 Capabilities
->EjectSupported
= FALSE
;
290 /* Can't remove or dock us */
291 Capabilities
->Removable
= FALSE
;
292 Capabilities
->DockDevice
= FALSE
;
294 /* Can't access us raw */
295 Capabilities
->RawDeviceOK
= FALSE
;
297 /* We have a unique ID, and don't bother the user */
298 Capabilities
->UniqueID
= TRUE
;
299 Capabilities
->SilentInstall
= TRUE
;
301 /* Fill out the adress */
302 Capabilities
->Address
= InterfaceTypeUndefined
;
303 Capabilities
->UINumber
= InterfaceTypeUndefined
;
305 /* Fill out latencies */
306 Capabilities
->D1Latency
= 0;
307 Capabilities
->D2Latency
= 0;
308 Capabilities
->D3Latency
= 0;
310 /* Fill out supported device states */
311 Capabilities
->DeviceState
[PowerSystemWorking
] = PowerDeviceD0
;
312 Capabilities
->DeviceState
[PowerSystemHibernate
] = PowerDeviceD3
;
313 Capabilities
->DeviceState
[PowerSystemShutdown
] = PowerDeviceD3
;
314 Capabilities
->DeviceState
[PowerSystemSleeping3
] = PowerDeviceD3
;
317 Status
= STATUS_SUCCESS
;
322 Status
= STATUS_NOT_SUPPORTED
;
331 HalpQueryResources(IN PDEVICE_OBJECT DeviceObject
,
332 OUT PCM_RESOURCE_LIST
*Resources
)
334 PPDO_EXTENSION DeviceExtension
= DeviceObject
->DeviceExtension
;
336 PCM_RESOURCE_LIST ResourceList
;
337 PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList
;
338 PIO_RESOURCE_DESCRIPTOR Descriptor
;
339 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDesc
;
343 /* Only the ACPI PDO has requirements */
344 if (DeviceExtension
->PdoType
== AcpiPdo
)
346 /* Query ACPI requirements */
347 Status
= HalpQueryAcpiResourceRequirements(&RequirementsList
);
348 ASSERT(RequirementsList
->AlternativeLists
== 1);
349 if (!NT_SUCCESS(Status
)) return Status
;
351 /* Allocate the resourcel ist */
352 ResourceList
= ExAllocatePoolWithTag(PagedPool
,
353 sizeof(CM_RESOURCE_LIST
),
357 /* Fail, no memory */
358 Status
= STATUS_INSUFFICIENT_RESOURCES
;
359 ExFreePoolWithTag(RequirementsList
, 0);
364 RtlZeroMemory(ResourceList
, sizeof(CM_RESOURCE_LIST
));
365 ResourceList
->Count
= 1;
367 /* Setup the list fields */
368 ResourceList
->List
[0].BusNumber
= -1;
369 ResourceList
->List
[0].InterfaceType
= PNPBus
;
370 ResourceList
->List
[0].PartialResourceList
.Version
= 1;
371 ResourceList
->List
[0].PartialResourceList
.Revision
= 1;
372 ResourceList
->List
[0].PartialResourceList
.Count
= 1;
374 /* Setup the first descriptor */
375 PartialDesc
= ResourceList
->List
[0].PartialResourceList
.PartialDescriptors
;
376 PartialDesc
->Type
= CmResourceTypeInterrupt
;
378 /* Find the requirement descriptor for the SCI */
379 for (i
= 0; i
< RequirementsList
->List
[0].Count
; i
++)
381 /* Get this descriptor */
382 Descriptor
= &RequirementsList
->List
[0].Descriptors
[i
];
383 if (Descriptor
->Type
== CmResourceTypeInterrupt
) break;
387 /* Make sure we found the descriptor */
390 /* Copy requirements descriptor into resource descriptor */
391 PartialDesc
->ShareDisposition
= Descriptor
->ShareDisposition
;
392 PartialDesc
->Flags
= Descriptor
->Flags
;
393 ASSERT(Descriptor
->u
.Interrupt
.MinimumVector
==
394 Descriptor
->u
.Interrupt
.MaximumVector
);
395 PartialDesc
->u
.Interrupt
.Vector
= Descriptor
->u
.Interrupt
.MinimumVector
;
396 PartialDesc
->u
.Interrupt
.Level
= Descriptor
->u
.Interrupt
.MinimumVector
;
397 PartialDesc
->u
.Interrupt
.Affinity
= 0xFFFFFFFF;
399 /* Return resources and success */
400 *Resources
= ResourceList
;
401 ExFreePoolWithTag(RequirementsList
, 0);
402 return STATUS_SUCCESS
;
405 /* Free memory and fail */
406 ExFreePoolWithTag(RequirementsList
, 0);
407 ExFreePoolWithTag(ResourceList
, 0);
408 Status
= STATUS_NOT_FOUND
;
410 else if (DeviceExtension
->PdoType
== WdPdo
)
412 /* Watchdog doesn't */
413 return STATUS_NOT_SUPPORTED
;
417 /* This shouldn't happen */
418 return STATUS_UNSUCCESSFUL
;
421 /* Return the status */
427 HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject
,
428 OUT PIO_RESOURCE_REQUIREMENTS_LIST
*Requirements
)
430 PPDO_EXTENSION DeviceExtension
= DeviceObject
->DeviceExtension
;
434 /* Only the ACPI PDO has requirements */
435 if (DeviceExtension
->PdoType
== AcpiPdo
)
437 /* Query ACPI requirements */
438 Status
= HalpQueryAcpiResourceRequirements(Requirements
);
440 else if (DeviceExtension
->PdoType
== WdPdo
)
442 /* Watchdog doesn't */
443 return STATUS_NOT_SUPPORTED
;
447 /* This shouldn't happen */
448 return STATUS_UNSUCCESSFUL
;
451 /* Return the status */
457 HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject
,
458 IN BUS_QUERY_ID_TYPE IdType
,
459 OUT PUSHORT
*BusQueryId
)
461 PPDO_EXTENSION PdoExtension
;
468 /* Get the PDO type */
469 PdoExtension
= DeviceObject
->DeviceExtension
;
470 PdoType
= PdoExtension
->PdoType
;
472 /* What kind of ID is being requested? */
473 DPRINT("ID: %d\n", IdType
);
476 case BusQueryDeviceID
:
477 case BusQueryHardwareIDs
:
479 /* What kind of PDO is this? */
480 if (PdoType
== AcpiPdo
)
483 Id
= L
"ACPI_HAL\\PNP0C08";
485 else if (PdoType
== WdPdo
)
488 Id
= L
"ACPI_HAL\\PNP0C18";
493 return STATUS_NOT_SUPPORTED
;
500 case BusQueryInstanceID
:
502 /* And our instance ID */
504 Length
= sizeof(L
"0") + sizeof(UNICODE_NULL
);
507 case BusQueryCompatibleIDs
:
510 /* We don't support anything else */
511 return STATUS_NOT_SUPPORTED
;
514 /* Allocate the buffer */
515 Buffer
= ExAllocatePoolWithTag(PagedPool
,
516 Length
+ sizeof(UNICODE_NULL
),
520 /* Copy the string and null-terminate it */
521 RtlCopyMemory(Buffer
, Id
, Length
);
522 Buffer
[Length
/ sizeof(WCHAR
)] = UNICODE_NULL
;
525 *BusQueryId
= Buffer
;
526 Status
= STATUS_SUCCESS
;
527 DPRINT("Returning: %S\n", *BusQueryId
);
532 Status
= STATUS_INSUFFICIENT_RESOURCES
;
541 HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject
,
542 IN BUS_QUERY_ID_TYPE IdType
,
543 OUT PUSHORT
*BusQueryId
)
550 /* What kind of ID is being requested? */
551 DPRINT("ID: %d\n", IdType
);
554 case BusQueryDeviceID
:
555 case BusQueryHardwareIDs
:
557 /* This is our hardware ID */
558 Id
= HalHardwareIdString
;
559 Length
= wcslen(HalHardwareIdString
) + sizeof(UNICODE_NULL
);
562 case BusQueryInstanceID
:
564 /* And our instance ID */
566 Length
= sizeof(L
"0") + sizeof(UNICODE_NULL
);
571 /* We don't support anything else */
572 return STATUS_NOT_SUPPORTED
;
575 /* Allocate the buffer */
576 Buffer
= ExAllocatePoolWithTag(PagedPool
,
577 Length
+ sizeof(UNICODE_NULL
),
581 /* Copy the string and null-terminate it */
582 RtlCopyMemory(Buffer
, Id
, Length
);
583 Buffer
[Length
/ sizeof(WCHAR
)] = UNICODE_NULL
;
586 *BusQueryId
= Buffer
;
587 Status
= STATUS_SUCCESS
;
588 DPRINT("Returning: %S\n", *BusQueryId
);
593 Status
= STATUS_INSUFFICIENT_RESOURCES
;
602 HalpPassIrpFromFdoToPdo(IN PDEVICE_OBJECT DeviceObject
,
605 PFDO_EXTENSION FdoExtension
;
607 /* Get the extension */
608 FdoExtension
= DeviceObject
->DeviceExtension
;
610 /* Pass it to the attached device (our PDO) */
611 IoSkipCurrentIrpStackLocation(Irp
);
612 return IoCallDriver(FdoExtension
->AttachedDeviceObject
, Irp
);
617 HalpDispatchPnp(IN PDEVICE_OBJECT DeviceObject
,
620 PIO_STACK_LOCATION IoStackLocation
;
621 PPDO_EXTENSION PdoExtension
;
622 PFDO_EXTENSION FdoExtension
;
626 /* Get the device extension and stack location */
627 FdoExtension
= DeviceObject
->DeviceExtension
;
628 IoStackLocation
= IoGetCurrentIrpStackLocation(Irp
);
629 Minor
= IoStackLocation
->MinorFunction
;
632 if (FdoExtension
->ExtensionType
== FdoExtensionType
)
634 /* Query the IRP type */
637 case IRP_MN_QUERY_DEVICE_RELATIONS
:
639 /* Call the worker */
640 DPRINT("Querying device relations for FDO\n");
641 Status
= HalpQueryDeviceRelations(DeviceObject
,
642 IoStackLocation
->Parameters
.QueryDeviceRelations
.Type
,
643 (PVOID
)&Irp
->IoStatus
.Information
);
646 case IRP_MN_QUERY_INTERFACE
:
648 /* Call the worker */
649 DPRINT("Querying interface for FDO\n");
650 Status
= HalpQueryInterface(DeviceObject
,
651 IoStackLocation
->Parameters
.QueryInterface
.InterfaceType
,
652 IoStackLocation
->Parameters
.QueryInterface
.Size
,
653 IoStackLocation
->Parameters
.QueryInterface
.InterfaceSpecificData
,
654 IoStackLocation
->Parameters
.QueryInterface
.Version
,
655 IoStackLocation
->Parameters
.QueryInterface
.Interface
,
656 (PVOID
)&Irp
->IoStatus
.Information
);
660 case IRP_MN_QUERY_ID
:
662 /* Call the worker */
663 DPRINT("Querying ID for FDO\n");
664 Status
= HalpQueryIdFdo(DeviceObject
,
665 IoStackLocation
->Parameters
.QueryId
.IdType
,
666 (PVOID
)&Irp
->IoStatus
.Information
);
671 /* Pass it to the PDO */
672 DPRINT("Other IRP: %lx\n", Minor
);
673 return HalpPassIrpFromFdoToPdo(DeviceObject
, Irp
);
676 /* What happpened? */
677 if ((NT_SUCCESS(Status
)) || (Status
== STATUS_NOT_SUPPORTED
))
679 /* Set the IRP status, unless this isn't understood */
680 if (Status
!= STATUS_NOT_SUPPORTED
) Irp
->IoStatus
.Status
= Status
;
683 DPRINT("Passing IRP to PDO\n");
684 return HalpPassIrpFromFdoToPdo(DeviceObject
, Irp
);
687 /* Otherwise, we failed, so set the status and complete the request */
688 DPRINT1("IRP failed with status: %lx\n", Status
);
689 Irp
->IoStatus
.Status
= Status
;
690 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
695 /* This is a PDO instead */
696 ASSERT(FdoExtension
->ExtensionType
== PdoExtensionType
);
697 PdoExtension
= (PPDO_EXTENSION
)FdoExtension
;
699 /* Query the IRP type */
700 Status
= STATUS_SUCCESS
;
703 case IRP_MN_START_DEVICE
:
705 /* We only care about a PCI PDO */
706 DPRINT1("Start device received\n");
707 /* Complete the IRP normally */
710 case IRP_MN_REMOVE_DEVICE
:
712 /* Check if this is a PCI device */
713 DPRINT1("Remove device received\n");
716 Status
= STATUS_SUCCESS
;
719 case IRP_MN_SURPRISE_REMOVAL
:
721 /* Inherit whatever status we had */
722 DPRINT1("Surprise removal IRP\n");
723 Status
= Irp
->IoStatus
.Status
;
726 case IRP_MN_QUERY_DEVICE_RELATIONS
:
728 /* Query the device relations */
729 DPRINT("Querying PDO relations\n");
730 Status
= HalpQueryDeviceRelations(DeviceObject
,
731 IoStackLocation
->Parameters
.QueryDeviceRelations
.Type
,
732 (PVOID
)&Irp
->IoStatus
.Information
);
735 case IRP_MN_QUERY_INTERFACE
:
737 /* Call the worker */
738 DPRINT("Querying interface for PDO\n");
739 Status
= HalpQueryInterface(DeviceObject
,
740 IoStackLocation
->Parameters
.QueryInterface
.InterfaceType
,
741 IoStackLocation
->Parameters
.QueryInterface
.Size
,
742 IoStackLocation
->Parameters
.QueryInterface
.InterfaceSpecificData
,
743 IoStackLocation
->Parameters
.QueryInterface
.Version
,
744 IoStackLocation
->Parameters
.QueryInterface
.Interface
,
745 (PVOID
)&Irp
->IoStatus
.Information
);
748 case IRP_MN_QUERY_CAPABILITIES
:
750 /* Call the worker */
751 DPRINT("Querying the capabilities for the PDO\n");
752 Status
= HalpQueryCapabilities(DeviceObject
,
753 IoStackLocation
->Parameters
.DeviceCapabilities
.Capabilities
);
756 case IRP_MN_QUERY_RESOURCES
:
758 /* Call the worker */
759 DPRINT("Querying the resources for the PDO\n");
760 Status
= HalpQueryResources(DeviceObject
, (PVOID
)&Irp
->IoStatus
.Information
);
763 case IRP_MN_QUERY_RESOURCE_REQUIREMENTS
:
765 /* Call the worker */
766 DPRINT("Querying the resource requirements for the PDO\n");
767 Status
= HalpQueryResourceRequirements(DeviceObject
,
768 (PVOID
)&Irp
->IoStatus
.Information
);
771 case IRP_MN_QUERY_ID
:
773 /* Call the worker */
774 DPRINT("Query the ID for the PDO\n");
775 Status
= HalpQueryIdPdo(DeviceObject
,
776 IoStackLocation
->Parameters
.QueryId
.IdType
,
777 (PVOID
)&Irp
->IoStatus
.Information
);
782 /* We don't handle anything else, so inherit the old state */
783 DPRINT("Illegal IRP: %lx\n", Minor
);
784 Status
= Irp
->IoStatus
.Status
;
788 /* If it's not supported, inherit the old status */
789 if (Status
== STATUS_NOT_SUPPORTED
) Status
= Irp
->IoStatus
.Status
;
791 /* Complete the IRP */
792 DPRINT("IRP completed with status: %lx\n", Status
);
793 Irp
->IoStatus
.Status
= Status
;
794 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
801 HalpDispatchWmi(IN PDEVICE_OBJECT DeviceObject
,
804 DbgPrint("HAL: PnP Driver WMI!\n");
806 return STATUS_SUCCESS
;
811 HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject
,
814 DbgPrint("HAL: PnP Driver Power!\n");
816 return STATUS_SUCCESS
;
821 HalpDriverEntry(IN PDRIVER_OBJECT DriverObject
,
822 IN PUNICODE_STRING RegistryPath
)
825 PDEVICE_OBJECT TargetDevice
= NULL
;
826 DPRINT("HAL: PnP Driver ENTRY!\n");
829 HalpDriverObject
= DriverObject
;
831 /* Set up add device */
832 DriverObject
->DriverExtension
->AddDevice
= HalpAddDevice
;
834 /* Set up the callouts */
835 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = HalpDispatchPnp
;
836 DriverObject
->MajorFunction
[IRP_MJ_POWER
] = HalpDispatchPower
;
837 DriverObject
->MajorFunction
[IRP_MJ_SYSTEM_CONTROL
] = HalpDispatchWmi
;
839 /* Tell the PnP about us */
840 Status
= IoReportDetectedDevice(DriverObject
,
841 InterfaceTypeUndefined
,
850 if (NT_SUCCESS(Status
)) Status
= HalpAddDevice(DriverObject
, TargetDevice
);
852 /* Return to kernel */
858 HaliInitPnpDriver(VOID
)
861 UNICODE_STRING DriverString
;
864 /* Create the driver */
865 RtlInitUnicodeString(&DriverString
, L
"\\Driver\\ACPI_HAL");
866 Status
= IoCreateDriver(&DriverString
, HalpDriverEntry
);