EDK2 carries an interesting quirk which dates back to the EFI 1.02 days,
where each protocol that is installed onto a handle during the execution
of a DXE driver's entrypoint is connected immediately (in the UEFI driver
model sense) after the entry point returns.
This means that, depending on the order that these drivers happen to end
up being dispatched, we may enter the BDS phase with the device's driver
stack fully connected, even if the device in question is not being used
to boot the machine.
Given the substantial delays that this might incur, let's work around
this 'feature' by deferring the registration of the network and eMMC
controllers to an EndOfDxe event handler.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 37 ++++++++++++++------
Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf | 1 +
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
index b6e2789cb9d2..09200a918009 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c
@@ -301,6 +301,28 @@ InstallAcpiTables (
}
}
+STATIC
+VOID
+EFIAPI
+RegisterDevices (
+ EFI_EVENT Event,
+ VOID *Context
+ )
+{
+ EFI_HANDLE Handle;
+ EFI_STATUS Status;
+
+ Handle = NULL;
+ Status = RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDesc,
+ &Handle);
+ ASSERT_EFI_ERROR (Status);
+
+ if (mHiiSettings->EnableEmmc == EMMC_ENABLED) {
+ Status = RegisterEmmc ();
+ ASSERT_EFI_ERROR (Status);
+ }
+}
+
EFI_STATUS
EFIAPI
PlatformDxeEntryPoint (
@@ -315,6 +337,7 @@ PlatformDxeEntryPoint (
EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
UINTN SsdtSize;
UINTN Index;
+ EFI_EVENT EndOfDxeEvent;
mHiiSettingsVal = PcdGet64 (PcdPlatformSettings);
mHiiSettings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&mHiiSettingsVal;
@@ -344,11 +367,6 @@ PlatformDxeEntryPoint (
}
}
- Handle = NULL;
- Status = RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDesc,
- &Handle);
- ASSERT_EFI_ERROR (Status);
-
Handle = NULL;
Status = RegisterDevice (&gSynQuacerNonDiscoverableRuntimeI2cMasterGuid,
mI2c0Desc, &Handle);
@@ -387,11 +405,6 @@ PlatformDxeEntryPoint (
Status = EnableSettingsForm ();
ASSERT_EFI_ERROR (Status);
- if (mHiiSettings->EnableEmmc == EMMC_ENABLED) {
- Status = RegisterEmmc ();
- ASSERT_EFI_ERROR (Status);
- }
-
if (mHiiSettings->AcpiPref == ACPIPREF_ACPI) {
//
// Load the SSDT tables from a raw section in this FFS file.
@@ -431,5 +444,9 @@ PlatformDxeEntryPoint (
}
}
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RegisterDevices,
+ NULL, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent);
+ ASSERT_EFI_ERROR (Status);
+
return EFI_SUCCESS;
}
diff --git a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
index 57f2d071c14e..157f914ea85d 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
+++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf
@@ -57,6 +57,7 @@ [LibraryClasses]
[Guids]
g96BoardsI2c0MasterGuid
gEdkiiPlatformHasAcpiGuid
+ gEfiEndOfDxeEventGroupGuid
gEfiHiiPlatformSetupFormsetGuid
gFdtTableGuid
gNetsecNonDiscoverableDeviceGuid
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#57068): https://edk2.groups.io/g/devel/message/57068
Mute This Topic: https://groups.io/mt/72877589/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.