]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 9 Mar 2017 15:45:07 +0000 (16:45 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 9 Mar 2017 17:37:04 +0000 (18:37 +0100)
Defer FDT configuration table installation until ReadyToBoot is signaled.
This allows any driver to make modifications in the mean time, and will
also allow us to defer the decision of whether to install it in the first
place to later on in the boot.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf

index 547a29fce62c9fc06cc525776daf5ba983af708f..4cf79f70cb2ae857797fb0452c8bd7427078b231 100644 (file)
@@ -20,6 +20,7 @@
 #include <Library/HobLib.h>\r
 #include <libfdt.h>\r
 \r
+#include <Guid/EventGroup.h>\r
 #include <Guid/Fdt.h>\r
 #include <Guid/FdtHob.h>\r
 \r
@@ -306,6 +307,30 @@ STATIC FDT_CLIENT_PROTOCOL mFdtClientProtocol = {
   GetOrInsertChosenNode,\r
 };\r
 \r
+STATIC\r
+VOID\r
+EFIAPI\r
+OnReadyToBoot (\r
+  EFI_EVENT       Event,\r
+  VOID            *Context\r
+  )\r
+{\r
+  EFI_STATUS      Status;\r
+\r
+  if (!FeaturePcdGet (PcdPureAcpiBoot)) {\r
+    //\r
+    // Only install the FDT as a configuration table if we want to leave it up\r
+    // to the OS to decide whether it prefers ACPI over DT.\r
+    //\r
+    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, mDeviceTreeBase);\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  gBS->CloseEvent (Event);\r
+}\r
+\r
+STATIC EFI_EVENT         mReadyToBootEvent;\r
+\r
 EFI_STATUS\r
 EFIAPI\r
 InitializeFdtClientDxe (\r
@@ -333,15 +358,21 @@ InitializeFdtClientDxe (
 \r
   DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, mDeviceTreeBase));\r
 \r
-  if (!FeaturePcdGet (PcdPureAcpiBoot)) {\r
-    //\r
-    // Only install the FDT as a configuration table if we want to leave it up\r
-    // to the OS to decide whether it prefers ACPI over DT.\r
-    //\r
-    Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);\r
-    ASSERT_EFI_ERROR (Status);\r
+  Status = gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE, &mFdtClientProtocol);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
   }\r
 \r
-  return gBS->InstallProtocolInterface (&ImageHandle, &gFdtClientProtocolGuid,\r
-                EFI_NATIVE_INTERFACE, &mFdtClientProtocol);\r
+  Status = gBS->CreateEventEx (\r
+                  EVT_NOTIFY_SIGNAL,\r
+                  TPL_CALLBACK,\r
+                  OnReadyToBoot,\r
+                  NULL,\r
+                  &gEfiEventReadyToBootGuid,\r
+                  &mReadyToBootEvent\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return EFI_SUCCESS;\r
 }\r
index 3a0cd37040ebd4a6c33b651cb3960117f194f3ae..00017727c32caef95667bcda7829249cf1e00cbd 100644 (file)
@@ -42,6 +42,7 @@
   gFdtClientProtocolGuid                  ## PRODUCES\r
 \r
 [Guids]\r
+  gEfiEventReadyToBootGuid\r
   gFdtHobGuid\r
   gFdtTableGuid\r
 \r