mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 17:06:29 +00:00
[HAL]
- Simplify device extension setup - Allocate memory for existing PDOs in the device relations struct svn path=/trunk/; revision=53325
This commit is contained in:
parent
8f165f8f05
commit
e39c07a7a2
|
@ -82,6 +82,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
FdoExtension->ExtensionType = FdoExtensionType;
|
FdoExtension->ExtensionType = FdoExtensionType;
|
||||||
FdoExtension->PhysicalDeviceObject = TargetDevice;
|
FdoExtension->PhysicalDeviceObject = TargetDevice;
|
||||||
FdoExtension->FunctionalDeviceObject = DeviceObject;
|
FdoExtension->FunctionalDeviceObject = DeviceObject;
|
||||||
|
FdoExtension->ChildPdoList = NULL;
|
||||||
|
|
||||||
/* FDO is done initializing */
|
/* FDO is done initializing */
|
||||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
@ -115,26 +116,24 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
/* Setup the PDO device extension */
|
/* Setup the PDO device extension */
|
||||||
PdoExtension = PdoDeviceObject->DeviceExtension;
|
PdoExtension = PdoDeviceObject->DeviceExtension;
|
||||||
PdoExtension->Next = NULL;
|
|
||||||
PdoExtension->ExtensionType = PdoExtensionType;
|
PdoExtension->ExtensionType = PdoExtensionType;
|
||||||
PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
|
PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
|
||||||
PdoExtension->ParentFdoExtension = FdoExtension;
|
PdoExtension->ParentFdoExtension = FdoExtension;
|
||||||
PdoExtension->PdoType = AcpiPdo;
|
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 */
|
/* Find the ACPI watchdog table */
|
||||||
Wdrt = HalAcpiGetTable(0, 'TRDW');
|
Wdrt = HalAcpiGetTable(0, 'TRDW');
|
||||||
if (!Wdrt)
|
if (Wdrt)
|
||||||
{
|
|
||||||
/* None exists, there is nothing to do more */
|
|
||||||
PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
|
||||||
FdoExtension->ChildPdoList = PdoExtension;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* FIXME: TODO */
|
/* FIXME: TODO */
|
||||||
DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
|
DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
|
||||||
PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
|
||||||
FdoExtension->ChildPdoList = PdoExtension;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invalidate device relations since we added a new device */
|
/* Invalidate device relations since we added a new device */
|
||||||
|
@ -192,6 +191,12 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
||||||
PdoCount++;
|
PdoCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add the PDOs that already exist in the device relations */
|
||||||
|
if (*DeviceRelations)
|
||||||
|
{
|
||||||
|
PdoCount += (*DeviceRelations)->Count;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate our structure */
|
/* Allocate our structure */
|
||||||
FdoRelations = ExAllocatePoolWithTag(PagedPool,
|
FdoRelations = ExAllocatePoolWithTag(PagedPool,
|
||||||
FIELD_OFFSET(DEVICE_RELATIONS,
|
FIELD_OFFSET(DEVICE_RELATIONS,
|
||||||
|
|
Loading…
Reference in a new issue