From d6ef8f97e943f6568da3f4c74ff55746480accba Mon Sep 17 00:00:00 2001 From: Victor Perevertkin Date: Tue, 10 Nov 2020 01:56:59 +0300 Subject: [PATCH] [NTOS:PNP] Enumerate the device tree after loading boot drivers and HAL --- ntoskrnl/io/iomgr/driver.c | 6 ++++++ ntoskrnl/io/iomgr/iomgr.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c index 3c4f3433ecf..9fd8c9b87c5 100644 --- a/ntoskrnl/io/iomgr/driver.c +++ b/ntoskrnl/io/iomgr/driver.c @@ -1122,6 +1122,12 @@ IopInitializeBootDrivers(VOID) /* Initialize it */ IopInitializeBuiltinDriver(LdrEntry); + /* Start the devices found by a driver (if any) */ + PiQueueDeviceAction(IopRootDeviceNode->PhysicalDeviceObject, + PiActionEnumRootDevices, + NULL, + NULL); + /* Next entry */ NextEntry = NextEntry->Flink; } diff --git a/ntoskrnl/io/iomgr/iomgr.c b/ntoskrnl/io/iomgr/iomgr.c index ecdf3fbdb5e..0173cf4911d 100644 --- a/ntoskrnl/io/iomgr/iomgr.c +++ b/ntoskrnl/io/iomgr/iomgr.c @@ -543,6 +543,13 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Initialize HAL Root Bus Driver */ HalInitPnpDriver(); + /* Reenumerate what HAL has added (synchronously) + * This function call should eventually become a 2nd stage of the PnP initialization */ + PiQueueDeviceAction(IopRootDeviceNode->PhysicalDeviceObject, + PiActionEnumRootDevices, + NULL, + NULL); + /* Make loader block available for the whole kernel */ IopLoaderBlock = LoaderBlock;