mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 22:37:11 +00:00
[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 revertsf23e722
,d974e84
,3aff101
and4a9fcb6
CORE-5686
This commit is contained in:
parent
05a5edef12
commit
f75318b606
2 changed files with 69 additions and 105 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue