diff options
author | Ard Biesheuvel <ard.biesheuvel@arm.com> | 2020-04-08 10:12:11 +0200 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@arm.com> | 2020-04-09 07:47:00 +0200 |
commit | 4be1e20c81e2eabc72c36c190a6de543932c8e8d (patch) | |
tree | 3023b2cc1d95a22aecf46c5880c850b507cc1ae6 | |
parent | 9c4e5fe36d24ecd10c6e8b9e158354941bcb8fb8 (diff) |
Silicon/SynQuacer/PlatformDxe: defer device registration until EndOfDxe
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>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
-rw-r--r-- | Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.c | 37 | ||||
-rw-r--r-- | 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 b6e2789c..09200a91 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;
@@ -345,11 +368,6 @@ PlatformDxeEntryPoint ( }
Handle = NULL;
- Status = RegisterDevice (&gNetsecNonDiscoverableDeviceGuid, mNetsecDesc,
- &Handle);
- ASSERT_EFI_ERROR (Status);
-
- Handle = NULL;
Status = RegisterDevice (&gSynQuacerNonDiscoverableRuntimeI2cMasterGuid,
mI2c0Desc, &Handle);
ASSERT_EFI_ERROR (Status);
@@ -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 57f2d071..157f914e 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/PlatformDxe/PlatformDxe.inf @@ -57,6 +57,7 @@ [Guids]
g96BoardsI2c0MasterGuid
gEdkiiPlatformHasAcpiGuid
+ gEfiEndOfDxeEventGroupGuid
gEfiHiiPlatformSetupFormsetGuid
gFdtTableGuid
gNetsecNonDiscoverableDeviceGuid
|