Author: cgutman
Date: Mon Jan 30 21:47:30 2012
New Revision: 55337
URL:
http://svn.reactos.org/svn/reactos?rev=55337&view=rev
Log:
[HAL]
- Remove differences between legacy and ACPI HAL initialization
Modified:
branches/usb-bringup-trunk/hal/halx86/legacy/halpnpdd.c
Modified: branches/usb-bringup-trunk/hal/halx86/legacy/halpnpdd.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/hal/halx86/le…
==============================================================================
--- branches/usb-bringup-trunk/hal/halx86/legacy/halpnpdd.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/hal/halx86/legacy/halpnpdd.c [iso-8859-1] Mon Jan 30
21:47:30 2012
@@ -50,6 +50,50 @@
/* PRIVATE FUNCTIONS **********************************************************/
+VOID
+NTAPI
+HalpReportDetectedDevices(IN PDRIVER_OBJECT DriverObject,
+ IN PVOID Context,
+ IN ULONG Count)
+{
+ PFDO_EXTENSION FdoExtension = Context;
+ PPDO_EXTENSION PdoExtension;
+ PDEVICE_OBJECT PdoDeviceObject;
+ NTSTATUS Status;
+
+ /* Create the PDO */
+ Status = IoCreateDevice(DriverObject,
+ sizeof(PDO_EXTENSION),
+ NULL,
+ FILE_DEVICE_BUS_EXTENDER,
+ FILE_AUTOGENERATED_DEVICE_NAME,
+ FALSE,
+ &PdoDeviceObject);
+ if (!NT_SUCCESS(Status))
+ {
+ /* Fail */
+ DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n",
Status);
+ return;
+ }
+
+ /* Setup the PDO device extension */
+ PdoExtension = PdoDeviceObject->DeviceExtension;
+ PdoExtension->ExtensionType = PdoExtensionType;
+ PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
+ PdoExtension->ParentFdoExtension = FdoExtension;
+ PdoExtension->PdoType = AcpiPdo;
+
+ /* Add the PDO to the head of the list */
+ PdoExtension->Next = FdoExtension->ChildPdoList;
+ FdoExtension->ChildPdoList = PdoExtension;
+
+ /* Initialization is finished */
+ PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
+
+ /* Invalidate device relations since we added a new device */
+ IoSynchronousInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject,
BusRelations);
+}
+
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
@@ -57,9 +101,9 @@
{
NTSTATUS Status;
PFDO_EXTENSION FdoExtension;
- PPDO_EXTENSION PdoExtension;
- PDEVICE_OBJECT DeviceObject, PdoDeviceObject, AttachedDevice;
+ PDEVICE_OBJECT DeviceObject, AttachedDevice;
// PDESCRIPTION_HEADER Wdrt;
+
DPRINT("HAL: PnP Driver ADD!\n");
/* Create the FDO */
@@ -99,47 +143,10 @@
/* Save the attachment */
FdoExtension->AttachedDeviceObject = AttachedDevice;
- /* Create the PDO */
- Status = IoCreateDevice(DriverObject,
- sizeof(PDO_EXTENSION),
- NULL,
- FILE_DEVICE_BUS_EXTENDER,
- FILE_AUTOGENERATED_DEVICE_NAME,
- FALSE,
- &PdoDeviceObject);
- if (!NT_SUCCESS(Status))
- {
- /* Fail */
- DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n",
Status);
- return Status;
- }
-
- /* Setup the PDO device extension */
- PdoExtension = PdoDeviceObject->DeviceExtension;
- PdoExtension->ExtensionType = PdoExtensionType;
- PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
- PdoExtension->ParentFdoExtension = FdoExtension;
- PdoExtension->PdoType = AcpiPdo;
-
- /* Add the PDO to the head of the list */
- PdoExtension->Next = FdoExtension->ChildPdoList;
- FdoExtension->ChildPdoList = PdoExtension;
-
- /* Initialization is finished */
- PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
-#if 0
- /* Find the ACPI watchdog table */
- Wdrt = HalAcpiGetTable(0, 'TRDW');
- if (Wdrt)
- {
- /* FIXME: TODO */
- DPRINT1("You have an ACPI Watchdog. That's great! You should be proud
;-)\n");
- }
-#endif
-
- /* Invalidate device relations since we added a new device */
- IoSynchronousInvalidateDeviceRelations(TargetDevice, BusRelations);
+ /* Register for reinitialization to report devices later */
+ IoRegisterBootDriverReinitialization(DriverObject,
+ HalpReportDetectedDevices,
+ FdoExtension);
/* Return status */
DPRINT("Device added %lx\n", Status);