]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Signal when the variable 'Fdt' has been updated
authorOlivier Martin <olivier.martin@arm.com>
Tue, 6 Jan 2015 15:54:12 +0000 (15:54 +0000)
committeroliviermartin <oliviermartin@Edk2>
Tue, 6 Jan 2015 15:54:12 +0000 (15:54 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16589 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPlatformPkg/Bds/Bds.c
ArmPlatformPkg/Bds/Bds.inf
ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg/Bds/BootMenu.c
ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h [new file with mode: 0644]

index bf930d23d9a6d1d38a1ebce96ffbe827ab56282a..3392a9538c28ed6822cc179d22ca235e1fe04df8 100644 (file)
@@ -53,6 +53,7 @@
   gEfiEndOfDxeEventGroupGuid\r
   gEfiFileInfoGuid\r
   gFdtTableGuid\r
+  gArmPlatformUpdateFdtEventGuid\r
 \r
 [Protocols]\r
   gEfiBlockIoProtocolGuid\r
index d8df991e0a5ece59eb2d08d4f7e9b1d8e5400455..337a4f079b589d4f00f78f456cb584b97d2b3942 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2014, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2014-2015, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
@@ -28,6 +28,7 @@
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 \r
 #include <Guid/ArmGlobalVariableHob.h>\r
+#include <Guid/ArmPlatformEvents.h>\r
 #include <Guid/EventGroup.h>\r
 #include <Guid/Fdt.h>\r
 #include <Guid/FileInfo.h>\r
@@ -293,7 +294,7 @@ EFI_DRIVER_BINDING_PROTOCOL mJunoFdtBinding = {
 STATIC\r
 VOID\r
 EFIAPI\r
-OnEndOfDxe (\r
+LoadFdtOnEvent (\r
   EFI_EVENT                               Event,\r
   VOID                                    *Context\r
   )\r
@@ -304,6 +305,7 @@ OnEndOfDxe (
   UINTN            VariableSize;\r
   CHAR16*          FdtDevicePathStr;\r
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;\r
+  EFI_EVENT        ArmPlatformUpdateFdtEvent;\r
 \r
   //\r
   // Read the 'FDT' UEFI Variable to know where we should we read the blob from.\r
@@ -384,15 +386,29 @@ OnEndOfDxe (
     }\r
   }\r
 \r
-  // Install the Binding protocol to verify when the FileSystem that contains the FDT has been installed\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &gImageHandle,\r
-                  &gEfiDriverBindingProtocolGuid, &mJunoFdtBinding,\r
-                  NULL\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
+  // Context is not NULL when this function is called for a gEfiEndOfDxeEventGroupGuid event\r
+  if (Context) {\r
+    // Install the Binding protocol to verify when the FileSystem that contains the FDT has been installed\r
+    Status = gBS->InstallMultipleProtocolInterfaces (\r
+                    &gImageHandle,\r
+                    &gEfiDriverBindingProtocolGuid, &mJunoFdtBinding,\r
+                    NULL\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      ASSERT_EFI_ERROR (Status);\r
+      return;\r
+    }\r
+\r
+    // Register the event triggered when the 'Fdt' variable is updated.\r
+    Status = gBS->CreateEventEx (\r
+                    EVT_NOTIFY_SIGNAL,\r
+                    TPL_CALLBACK,\r
+                    LoadFdtOnEvent,\r
+                    NULL,\r
+                    &gArmPlatformUpdateFdtEventGuid,\r
+                    &ArmPlatformUpdateFdtEvent\r
+                    );\r
     ASSERT_EFI_ERROR (Status);\r
-    return;\r
   }\r
 \r
   //\r
@@ -401,6 +417,8 @@ OnEndOfDxe (
   BdsConnectDevicePath (mFdtFileSystemDevicePath, &Handle, NULL);\r
 }\r
 \r
+STATIC CONST BOOLEAN mIsEndOfDxeEvent = TRUE;\r
+\r
 EFI_STATUS\r
 JunoFdtInstall (\r
   IN EFI_HANDLE                            ImageHandle\r
@@ -415,8 +433,8 @@ JunoFdtInstall (
   Status = gBS->CreateEventEx (\r
                   EVT_NOTIFY_SIGNAL,\r
                   TPL_CALLBACK,\r
-                  OnEndOfDxe,\r
-                  NULL,\r
+                  LoadFdtOnEvent,\r
+                  &mIsEndOfDxeEvent,\r
                   &gEfiEndOfDxeEventGroupGuid,\r
                   &EndOfDxeEvent\r
                   );\r
index b9f38b674700ba1fc2fe52b110856044811727af..57a43c503758b3667b67f58713d25fb2aa53044a 100644 (file)
@@ -1,6 +1,6 @@
 #/** @file\r
 #\r
-#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -42,6 +42,9 @@
 \r
   gArmBootMonFsFileInfoGuid   = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } }\r
 \r
+  ## Include/Guid/ArmPlatformEvents.h\r
+  gArmPlatformUpdateFdtEventGuid = { 0xaffe115b, 0x8589, 0x456d, { 0xba, 0xb5, 0x8f, 0x2e, 0xda, 0x53, 0xae, 0xb7 } }\r
+\r
 [Ppis]\r
   ## Include/Ppi/ArmGlobalVariable.h\r
   gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }\r
index debc93218bfe41d8625cdd5d3747b5930655993b..971ab07524d70c22e681adff479c5d6638bc08f9 100644 (file)
@@ -427,7 +427,6 @@ StartDefaultBootOnTimeout (
                                 which is implementation-dependent.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EFIAPI\r
 EmptyCallbackFunction (\r
index c3de53c2bdbce12239a9637ec5ce70b75c9c5736..9872ce38aca5c1631b292e01e147aa3e9c704553 100644 (file)
@@ -2,7 +2,7 @@
 #\r
 #  Component description file for Bds module\r
 #\r
-#  Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
+#  Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -53,6 +53,7 @@
   gEfiEndOfDxeEventGroupGuid\r
   gEfiFileSystemInfoGuid\r
   gArmGlobalVariableGuid\r
+  gArmPlatformUpdateFdtEventGuid\r
 \r
 [Protocols]\r
   gEfiBdsArchProtocolGuid\r
index f14e28591a095794b43835dbe9d55eca933bc796..95cc0b65c91c1c4c5b657829dd3640212a38fea2 100644 (file)
@@ -289,4 +289,19 @@ IsPrintableString (
   OUT BOOLEAN *IsUnicode\r
   );\r
 \r
+/**\r
+  An empty function to pass error checking of CreateEventEx ().\r
+\r
+  @param  Event                 Event whose notification function is being invoked.\r
+  @param  Context               Pointer to the notification function's context,\r
+                                which is implementation-dependent.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EmptyCallbackFunction (\r
+  IN EFI_EVENT                Event,\r
+  IN VOID                     *Context\r
+  );\r
+\r
 #endif /* _BDSINTERNAL_H_ */\r
index 04a2eee6f5a88217369a68533ce9345c4e85f54f..3676bf02459471f26a5bc82d4db750f2701dd7c5 100644 (file)
@@ -15,6 +15,7 @@
 #include "BdsInternal.h"\r
 \r
 #include <Guid/ArmGlobalVariableHob.h>\r
+#include <Guid/ArmPlatformEvents.h>\r
 \r
 extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList;\r
 \r
@@ -834,6 +835,7 @@ UpdateFdtPath (
   BDS_SUPPORTED_DEVICE      *SupportedBootDevice;\r
   EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePathNodes;\r
   EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePath;\r
+  EFI_EVENT                 UpdateFdtEvent;\r
 \r
   Status = SelectBootDevice (&SupportedBootDevice);\r
   if (EFI_ERROR(Status)) {\r
@@ -873,6 +875,23 @@ UpdateFdtPath (
     ASSERT_EFI_ERROR(Status);\r
   }\r
 \r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // Signal FDT has been updated\r
+    //\r
+    Status = gBS->CreateEventEx (\r
+        EVT_NOTIFY_SIGNAL,\r
+        TPL_NOTIFY,\r
+        EmptyCallbackFunction,\r
+        NULL,\r
+        &gArmPlatformUpdateFdtEventGuid,\r
+        &UpdateFdtEvent\r
+        );\r
+    if (!EFI_ERROR (Status)) {\r
+      gBS->SignalEvent (UpdateFdtEvent);\r
+    }\r
+  }\r
+\r
 EXIT:\r
   if (Status == EFI_ABORTED) {\r
     Print(L"\n");\r
diff --git a/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h b/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h
new file mode 100644 (file)
index 0000000..9027bc3
--- /dev/null
@@ -0,0 +1,23 @@
+/** @file\r
+*\r
+*  Copyright (c) 2015, ARM Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef __ARM_PLATFORM_EVENTS_H__\r
+#define __ARM_PLATFORM_EVENTS_H__\r
+\r
+#define ARM_PLATFORM_UPDATE_FDT_EVENT_GUID \\r
+  { 0xaffe115b, 0x8589, 0x456d, { 0xba, 0xb5, 0x8f, 0x2e, 0xda, 0x53, 0xae, 0xb7 } }\r
+\r
+extern EFI_GUID gArmPlatformUpdateFdtEventGuid;\r
+\r
+#endif\r