From e39c07a7a2d6e771c7fcaf81b69a16d5ab18ebb8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 19 Aug 2011 20:56:39 +0000 Subject: [PATCH] [HAL] - Simplify device extension setup - Allocate memory for existing PDOs in the device relations struct svn path=/trunk/; revision=53325 --- reactos/hal/halx86/generic/acpi/halpnpdd.c | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/reactos/hal/halx86/generic/acpi/halpnpdd.c b/reactos/hal/halx86/generic/acpi/halpnpdd.c index 209a42c81a2..77a75c4c0df 100644 --- a/reactos/hal/halx86/generic/acpi/halpnpdd.c +++ b/reactos/hal/halx86/generic/acpi/halpnpdd.c @@ -82,6 +82,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject, FdoExtension->ExtensionType = FdoExtensionType; FdoExtension->PhysicalDeviceObject = TargetDevice; FdoExtension->FunctionalDeviceObject = DeviceObject; + FdoExtension->ChildPdoList = NULL; /* FDO is done initializing */ DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; @@ -115,26 +116,24 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject, /* Setup the PDO device extension */ PdoExtension = PdoDeviceObject->DeviceExtension; - PdoExtension->Next = NULL; 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) - { - /* None exists, there is nothing to do more */ - PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; - FdoExtension->ChildPdoList = PdoExtension; - } - else + if (Wdrt) { /* FIXME: TODO */ 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 */ @@ -191,7 +190,13 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, PdoExtension = PdoExtension->Next; PdoCount++; } - + + /* Add the PDOs that already exist in the device relations */ + if (*DeviceRelations) + { + PdoCount += (*DeviceRelations)->Count; + } + /* Allocate our structure */ FdoRelations = ExAllocatePoolWithTag(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS,