https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f75318b606fd97548ebef…
commit f75318b606fd97548ebefe751289d769f9625d28
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Mon Nov 9 01:28:50 2020 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Mon Nov 9 01:28:50 2020 +0300
[HALX86] Drop hacks in HalpAddDevice to work around PnP synchronization bugs
Our PnP manager handles OS boot in a synchronous manner thus we don't
need it anymore.
This effectively reverts f23e722, d974e84, 3aff101 and 4a9fcb6
CORE-5686
---
hal/halx86/acpi/halpnpdd.c | 96 ++++++++++++++++++--------------------------
hal/halx86/legacy/halpnpdd.c | 78 ++++++++++++++---------------------
2 files changed, 69 insertions(+), 105 deletions(-)
diff --git a/hal/halx86/acpi/halpnpdd.c b/hal/halx86/acpi/halpnpdd.c
index beec1190f76..03c195293a5 100644
--- a/hal/halx86/acpi/halpnpdd.c
+++ b/hal/halx86/acpi/halpnpdd.c
@@ -50,59 +50,6 @@ PDRIVER_OBJECT HalpDriverObject;
/* 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;
- PDESCRIPTION_HEADER Wdrt;
- 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;
-
- /* 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");
- }
-
- /* This will load the ACPI driver (IO initialization will wait for this operation to
finish) */
- IoInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
-}
-
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
@@ -110,7 +57,10 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
{
NTSTATUS Status;
PFDO_EXTENSION FdoExtension;
+ PPDO_EXTENSION PdoExtension;
PDEVICE_OBJECT DeviceObject, AttachedDevice;
+ PDEVICE_OBJECT PdoDeviceObject;
+ PDESCRIPTION_HEADER Wdrt;
DPRINT("HAL: PnP Driver ADD!\n");
@@ -151,10 +101,42 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
/* Save the attachment */
FdoExtension->AttachedDeviceObject = AttachedDevice;
- /* Register for reinitialization to report devices later */
- IoRegisterBootDriverReinitialization(DriverObject,
- HalpReportDetectedDevices,
- FdoExtension);
+ /* 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;
+
+ /* 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");
+ }
/* Return status */
DPRINT("Device added %lx\n", Status);
diff --git a/hal/halx86/legacy/halpnpdd.c b/hal/halx86/legacy/halpnpdd.c
index 4bf1ff3f18d..716b0d269e7 100644
--- a/hal/halx86/legacy/halpnpdd.c
+++ b/hal/halx86/legacy/halpnpdd.c
@@ -50,50 +50,6 @@ PDRIVER_OBJECT HalpDriverObject;
/* 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 */
- IoInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
-}
-
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
@@ -101,7 +57,9 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
{
NTSTATUS Status;
PFDO_EXTENSION FdoExtension;
+ PPDO_EXTENSION PdoExtension;
PDEVICE_OBJECT DeviceObject, AttachedDevice;
+ PDEVICE_OBJECT PdoDeviceObject;
// PDESCRIPTION_HEADER Wdrt;
DPRINT("HAL: PnP Driver ADD!\n");
@@ -143,10 +101,34 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
/* Save the attachment */
FdoExtension->AttachedDeviceObject = AttachedDevice;
- /* Register for reinitialization to report devices later */
- IoRegisterBootDriverReinitialization(DriverObject,
- HalpReportDetectedDevices,
- FdoExtension);
+ /* 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;
/* Return status */
DPRINT("Device added %lx\n", Status);