- Remove differences between legacy and ACPI HAL initialization

svn path=/branches/usb-bringup-trunk/; revision=55337
This commit is contained in:
Cameron Gutman 2012-01-30 21:47:30 +00:00
parent 4a9fcb6569
commit 5236296f5c

View file

@ -50,6 +50,50 @@ 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 */
IoSynchronousInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
}
NTSTATUS
NTAPI
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
@ -57,9 +101,9 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
{
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 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
/* 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);