]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/FdtClientDxe/FdtClientDxe.c
ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot
[mirror_edk2.git] / ArmVirtPkg / FdtClientDxe / FdtClientDxe.c
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