Revision: 16589
          http://sourceforge.net/p/edk2/code/16589
Author:   oliviermartin
Date:     2015-01-06 15:54:12 +0000 (Tue, 06 Jan 2015)
Log Message:
-----------
ArmPlatformPkg/Bds: Signal when the variable 'Fdt' has been updated

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
    trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c
    trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec
    trunk/edk2/ArmPlatformPkg/Bds/Bds.c
    trunk/edk2/ArmPlatformPkg/Bds/Bds.inf
    trunk/edk2/ArmPlatformPkg/Bds/BdsInternal.h
    trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c

Added Paths:
-----------
    trunk/edk2/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf      
2015-01-06 15:52:52 UTC (rev 16588)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf      
2015-01-06 15:54:12 UTC (rev 16589)
@@ -53,6 +53,7 @@
   gEfiEndOfDxeEventGroupGuid
   gEfiFileInfoGuid
   gFdtTableGuid
+  gArmPlatformUpdateFdtEventGuid
 
 [Protocols]
   gEfiBlockIoProtocolGuid

Modified: trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c        
2015-01-06 15:52:52 UTC (rev 16588)
+++ trunk/edk2/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c        
2015-01-06 15:54:12 UTC (rev 16589)
@@ -1,6 +1,6 @@
 /** @file
 *
-*  Copyright (c) 2014, ARM Limited. All rights reserved.
+*  Copyright (c) 2014-2015, ARM Limited. All rights reserved.
 *
 *  This program and the accompanying materials
 *  are licensed and made available under the terms and conditions of the BSD 
License
@@ -28,6 +28,7 @@
 #include <Library/UefiRuntimeServicesTableLib.h>
 
 #include <Guid/ArmGlobalVariableHob.h>
+#include <Guid/ArmPlatformEvents.h>
 #include <Guid/EventGroup.h>
 #include <Guid/Fdt.h>
 #include <Guid/FileInfo.h>
@@ -293,7 +294,7 @@
 STATIC
 VOID
 EFIAPI
-OnEndOfDxe (
+LoadFdtOnEvent (
   EFI_EVENT                               Event,
   VOID                                    *Context
   )
@@ -304,6 +305,7 @@
   UINTN            VariableSize;
   CHAR16*          FdtDevicePathStr;
   EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *EfiDevicePathFromTextProtocol;
+  EFI_EVENT        ArmPlatformUpdateFdtEvent;
 
   //
   // Read the 'FDT' UEFI Variable to know where we should we read the blob 
from.
@@ -384,15 +386,29 @@
     }
   }
 
-  // Install the Binding protocol to verify when the FileSystem that contains 
the FDT has been installed
-  Status = gBS->InstallMultipleProtocolInterfaces (
-                  &gImageHandle,
-                  &gEfiDriverBindingProtocolGuid, &mJunoFdtBinding,
-                  NULL
-                  );
-  if (EFI_ERROR (Status)) {
+  // Context is not NULL when this function is called for a 
gEfiEndOfDxeEventGroupGuid event
+  if (Context) {
+    // Install the Binding protocol to verify when the FileSystem that 
contains the FDT has been installed
+    Status = gBS->InstallMultipleProtocolInterfaces (
+                    &gImageHandle,
+                    &gEfiDriverBindingProtocolGuid, &mJunoFdtBinding,
+                    NULL
+                    );
+    if (EFI_ERROR (Status)) {
+      ASSERT_EFI_ERROR (Status);
+      return;
+    }
+
+    // Register the event triggered when the 'Fdt' variable is updated.
+    Status = gBS->CreateEventEx (
+                    EVT_NOTIFY_SIGNAL,
+                    TPL_CALLBACK,
+                    LoadFdtOnEvent,
+                    NULL,
+                    &gArmPlatformUpdateFdtEventGuid,
+                    &ArmPlatformUpdateFdtEvent
+                    );
     ASSERT_EFI_ERROR (Status);
-    return;
   }
 
   //
@@ -401,6 +417,8 @@
   BdsConnectDevicePath (mFdtFileSystemDevicePath, &Handle, NULL);
 }
 
+STATIC CONST BOOLEAN mIsEndOfDxeEvent = TRUE;
+
 EFI_STATUS
 JunoFdtInstall (
   IN EFI_HANDLE                            ImageHandle
@@ -415,8 +433,8 @@
   Status = gBS->CreateEventEx (
                   EVT_NOTIFY_SIGNAL,
                   TPL_CALLBACK,
-                  OnEndOfDxe,
-                  NULL,
+                  LoadFdtOnEvent,
+                  &mIsEndOfDxeEvent,
                   &gEfiEndOfDxeEventGroupGuid,
                   &EndOfDxeEvent
                   );

Modified: trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec        2015-01-06 15:52:52 UTC 
(rev 16588)
+++ trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec        2015-01-06 15:54:12 UTC 
(rev 16589)
@@ -1,6 +1,6 @@
 #/** @file
 #
-#  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -42,6 +42,9 @@
 
   gArmBootMonFsFileInfoGuid   = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 
0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } }
 
+  ## Include/Guid/ArmPlatformEvents.h
+  gArmPlatformUpdateFdtEventGuid = { 0xaffe115b, 0x8589, 0x456d, { 0xba, 0xb5, 
0x8f, 0x2e, 0xda, 0x53, 0xae, 0xb7 } }
+
 [Ppis]
   ## Include/Ppi/ArmGlobalVariable.h
   gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 
0xcd, 0x92, 0x53, 0xe2, 0xe7} }

Modified: trunk/edk2/ArmPlatformPkg/Bds/Bds.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/Bds.c 2015-01-06 15:52:52 UTC (rev 16588)
+++ trunk/edk2/ArmPlatformPkg/Bds/Bds.c 2015-01-06 15:54:12 UTC (rev 16589)
@@ -427,7 +427,6 @@
                                 which is implementation-dependent.
 
 **/
-STATIC
 VOID
 EFIAPI
 EmptyCallbackFunction (

Modified: trunk/edk2/ArmPlatformPkg/Bds/Bds.inf
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/Bds.inf       2015-01-06 15:52:52 UTC (rev 
16588)
+++ trunk/edk2/ArmPlatformPkg/Bds/Bds.inf       2015-01-06 15:54:12 UTC (rev 
16589)
@@ -2,7 +2,7 @@
 #
 #  Component description file for Bds module
 #
-#  Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
+#  Copyright (c) 2011-2015, ARM Ltd. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -53,6 +53,7 @@
   gEfiEndOfDxeEventGroupGuid
   gEfiFileSystemInfoGuid
   gArmGlobalVariableGuid
+  gArmPlatformUpdateFdtEventGuid
 
 [Protocols]
   gEfiBdsArchProtocolGuid

Modified: trunk/edk2/ArmPlatformPkg/Bds/BdsInternal.h
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/BdsInternal.h 2015-01-06 15:52:52 UTC (rev 
16588)
+++ trunk/edk2/ArmPlatformPkg/Bds/BdsInternal.h 2015-01-06 15:54:12 UTC (rev 
16589)
@@ -289,4 +289,19 @@
   OUT BOOLEAN *IsUnicode
   );
 
+/**
+  An empty function to pass error checking of CreateEventEx ().
+
+  @param  Event                 Event whose notification function is being 
invoked.
+  @param  Context               Pointer to the notification function's context,
+                                which is implementation-dependent.
+
+**/
+VOID
+EFIAPI
+EmptyCallbackFunction (
+  IN EFI_EVENT                Event,
+  IN VOID                     *Context
+  );
+
 #endif /* _BDSINTERNAL_H_ */

Modified: trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c    2015-01-06 15:52:52 UTC (rev 
16588)
+++ trunk/edk2/ArmPlatformPkg/Bds/BootMenu.c    2015-01-06 15:54:12 UTC (rev 
16589)
@@ -15,6 +15,7 @@
 #include "BdsInternal.h"
 
 #include <Guid/ArmGlobalVariableHob.h>
+#include <Guid/ArmPlatformEvents.h>
 
 extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList;
 
@@ -834,6 +835,7 @@
   BDS_SUPPORTED_DEVICE      *SupportedBootDevice;
   EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePathNodes;
   EFI_DEVICE_PATH_PROTOCOL  *FdtDevicePath;
+  EFI_EVENT                 UpdateFdtEvent;
 
   Status = SelectBootDevice (&SupportedBootDevice);
   if (EFI_ERROR(Status)) {
@@ -873,6 +875,23 @@
     ASSERT_EFI_ERROR(Status);
   }
 
+  if (!EFI_ERROR (Status)) {
+    //
+    // Signal FDT has been updated
+    //
+    Status = gBS->CreateEventEx (
+        EVT_NOTIFY_SIGNAL,
+        TPL_NOTIFY,
+        EmptyCallbackFunction,
+        NULL,
+        &gArmPlatformUpdateFdtEventGuid,
+        &UpdateFdtEvent
+        );
+    if (!EFI_ERROR (Status)) {
+      gBS->SignalEvent (UpdateFdtEvent);
+    }
+  }
+
 EXIT:
   if (Status == EFI_ABORTED) {
     Print(L"\n");

Added: trunk/edk2/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h
===================================================================
--- trunk/edk2/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h                  
        (rev 0)
+++ trunk/edk2/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h  2015-01-06 
15:54:12 UTC (rev 16589)
@@ -0,0 +1,23 @@
+/** @file
+*
+*  Copyright (c) 2015, ARM Limited. All rights reserved.
+*
+*  This program and the accompanying materials
+*  are licensed and made available under the terms and conditions of the BSD 
License
+*  which accompanies this distribution.  The full text of the license may be 
found at
+*  http://opensource.org/licenses/bsd-license.php
+*
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+*
+**/
+
+#ifndef __ARM_PLATFORM_EVENTS_H__
+#define __ARM_PLATFORM_EVENTS_H__
+
+#define ARM_PLATFORM_UPDATE_FDT_EVENT_GUID \
+  { 0xaffe115b, 0x8589, 0x456d, { 0xba, 0xb5, 0x8f, 0x2e, 0xda, 0x53, 0xae, 
0xb7 } }
+
+extern EFI_GUID gArmPlatformUpdateFdtEventGuid;
+
+#endif


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to