From: Olivier Martin Date: Tue, 6 Jan 2015 15:54:12 +0000 (+0000) Subject: ArmPlatformPkg/Bds: Signal when the variable 'Fdt' has been updated X-Git-Tag: edk2-stable201903~10470 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=5c2d456b9670cd8eeed1b06d3e50011598ade3b0 ArmPlatformPkg/Bds: Signal when the variable 'Fdt' has been updated Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16589 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf index bf930d23d9..3392a9538c 100644 --- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf +++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/ArmJunoDxe.inf @@ -53,6 +53,7 @@ gEfiEndOfDxeEventGroupGuid gEfiFileInfoGuid gFdtTableGuid + gArmPlatformUpdateFdtEventGuid [Protocols] gEfiBlockIoProtocolGuid diff --git a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c index d8df991e0a..337a4f079b 100644 --- a/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c +++ b/ArmPlatformPkg/ArmJunoPkg/Drivers/ArmJunoDxe/InstallFdt.c @@ -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 #include +#include #include #include #include @@ -293,7 +294,7 @@ EFI_DRIVER_BINDING_PROTOCOL mJunoFdtBinding = { STATIC VOID EFIAPI -OnEndOfDxe ( +LoadFdtOnEvent ( EFI_EVENT Event, VOID *Context ) @@ -304,6 +305,7 @@ OnEndOfDxe ( 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 @@ OnEndOfDxe ( } } - // 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 @@ OnEndOfDxe ( BdsConnectDevicePath (mFdtFileSystemDevicePath, &Handle, NULL); } +STATIC CONST BOOLEAN mIsEndOfDxeEvent = TRUE; + EFI_STATUS JunoFdtInstall ( IN EFI_HANDLE ImageHandle @@ -415,8 +433,8 @@ JunoFdtInstall ( Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, - OnEndOfDxe, - NULL, + LoadFdtOnEvent, + &mIsEndOfDxeEvent, &gEfiEndOfDxeEventGroupGuid, &EndOfDxeEvent ); diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index b9f38b6747..57a43c5037 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -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} } diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index debc93218b..971ab07524 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -427,7 +427,6 @@ StartDefaultBootOnTimeout ( which is implementation-dependent. **/ -STATIC VOID EFIAPI EmptyCallbackFunction ( diff --git a/ArmPlatformPkg/Bds/Bds.inf b/ArmPlatformPkg/Bds/Bds.inf index c3de53c2bd..9872ce38ac 100644 --- a/ArmPlatformPkg/Bds/Bds.inf +++ b/ArmPlatformPkg/Bds/Bds.inf @@ -2,7 +2,7 @@ # # Component description file for Bds module # -# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
+# Copyright (c) 2011-2015, ARM Ltd. All rights reserved.
# # 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 diff --git a/ArmPlatformPkg/Bds/BdsInternal.h b/ArmPlatformPkg/Bds/BdsInternal.h index f14e28591a..95cc0b65c9 100644 --- a/ArmPlatformPkg/Bds/BdsInternal.h +++ b/ArmPlatformPkg/Bds/BdsInternal.h @@ -289,4 +289,19 @@ IsPrintableString ( 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_ */ diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 04a2eee6f5..3676bf0245 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -15,6 +15,7 @@ #include "BdsInternal.h" #include +#include extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList; @@ -834,6 +835,7 @@ UpdateFdtPath ( 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 @@ UpdateFdtPath ( 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"); diff --git a/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h b/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h new file mode 100644 index 0000000000..9027bc395e --- /dev/null +++ b/ArmPlatformPkg/Include/Guid/ArmPlatformEvents.h @@ -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