mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[HAL]
- Remove differences between legacy and ACPI HAL initialization svn path=/branches/usb-bringup-trunk/; revision=55337
This commit is contained in:
parent
4a9fcb6569
commit
5236296f5c
1 changed files with 50 additions and 43 deletions
|
@ -50,6 +50,50 @@ PDRIVER_OBJECT HalpDriverObject;
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS **********************************************************/
|
/* 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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
|
@ -57,9 +101,9 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFDO_EXTENSION FdoExtension;
|
PFDO_EXTENSION FdoExtension;
|
||||||
PPDO_EXTENSION PdoExtension;
|
PDEVICE_OBJECT DeviceObject, AttachedDevice;
|
||||||
PDEVICE_OBJECT DeviceObject, PdoDeviceObject, AttachedDevice;
|
|
||||||
// PDESCRIPTION_HEADER Wdrt;
|
// PDESCRIPTION_HEADER Wdrt;
|
||||||
|
|
||||||
DPRINT("HAL: PnP Driver ADD!\n");
|
DPRINT("HAL: PnP Driver ADD!\n");
|
||||||
|
|
||||||
/* Create the FDO */
|
/* Create the FDO */
|
||||||
|
@ -99,47 +143,10 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
/* Save the attachment */
|
/* Save the attachment */
|
||||||
FdoExtension->AttachedDeviceObject = AttachedDevice;
|
FdoExtension->AttachedDeviceObject = AttachedDevice;
|
||||||
|
|
||||||
/* Create the PDO */
|
/* Register for reinitialization to report devices later */
|
||||||
Status = IoCreateDevice(DriverObject,
|
IoRegisterBootDriverReinitialization(DriverObject,
|
||||||
sizeof(PDO_EXTENSION),
|
HalpReportDetectedDevices,
|
||||||
NULL,
|
FdoExtension);
|
||||||
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);
|
|
||||||
|
|
||||||
/* Return status */
|
/* Return status */
|
||||||
DPRINT("Device added %lx\n", Status);
|
DPRINT("Device added %lx\n", Status);
|
||||||
|
|
Loading…
Reference in a new issue