ArmPlatformPkg/Bds: Signal when the variable 'Fdt' has been updated

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
This commit is contained in:
Olivier Martin 2015-01-06 15:54:12 +00:00 committed by oliviermartin
parent f2c730d312
commit 5c2d456b96
8 changed files with 94 additions and 15 deletions

View File

@ -53,6 +53,7 @@
gEfiEndOfDxeEventGroupGuid gEfiEndOfDxeEventGroupGuid
gEfiFileInfoGuid gEfiFileInfoGuid
gFdtTableGuid gFdtTableGuid
gArmPlatformUpdateFdtEventGuid
[Protocols] [Protocols]
gEfiBlockIoProtocolGuid gEfiBlockIoProtocolGuid

View File

@ -1,6 +1,6 @@
/** @file /** @file
* *
* Copyright (c) 2014, ARM Limited. All rights reserved. * Copyright (c) 2014-2015, ARM Limited. All rights reserved.
* *
* This program and the accompanying materials * This program and the accompanying materials
* are licensed and made available under the terms and conditions of the BSD License * are licensed and made available under the terms and conditions of the BSD License
@ -28,6 +28,7 @@
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>
#include <Guid/ArmGlobalVariableHob.h> #include <Guid/ArmGlobalVariableHob.h>
#include <Guid/ArmPlatformEvents.h>
#include <Guid/EventGroup.h> #include <Guid/EventGroup.h>
#include <Guid/Fdt.h> #include <Guid/Fdt.h>
#include <Guid/FileInfo.h> #include <Guid/FileInfo.h>
@ -293,7 +294,7 @@ EFI_DRIVER_BINDING_PROTOCOL mJunoFdtBinding = {
STATIC STATIC
VOID VOID
EFIAPI EFIAPI
OnEndOfDxe ( LoadFdtOnEvent (
EFI_EVENT Event, EFI_EVENT Event,
VOID *Context VOID *Context
) )
@ -304,6 +305,7 @@ OnEndOfDxe (
UINTN VariableSize; UINTN VariableSize;
CHAR16* FdtDevicePathStr; CHAR16* FdtDevicePathStr;
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *EfiDevicePathFromTextProtocol; 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. // Read the 'FDT' UEFI Variable to know where we should we read the blob from.
@ -384,6 +386,8 @@ OnEndOfDxe (
} }
} }
// 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 // Install the Binding protocol to verify when the FileSystem that contains the FDT has been installed
Status = gBS->InstallMultipleProtocolInterfaces ( Status = gBS->InstallMultipleProtocolInterfaces (
&gImageHandle, &gImageHandle,
@ -395,12 +399,26 @@ OnEndOfDxe (
return; 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);
}
// //
// Force to connect the FileSystem that contains the FDT // Force to connect the FileSystem that contains the FDT
// //
BdsConnectDevicePath (mFdtFileSystemDevicePath, &Handle, NULL); BdsConnectDevicePath (mFdtFileSystemDevicePath, &Handle, NULL);
} }
STATIC CONST BOOLEAN mIsEndOfDxeEvent = TRUE;
EFI_STATUS EFI_STATUS
JunoFdtInstall ( JunoFdtInstall (
IN EFI_HANDLE ImageHandle IN EFI_HANDLE ImageHandle
@ -415,8 +433,8 @@ JunoFdtInstall (
Status = gBS->CreateEventEx ( Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL, EVT_NOTIFY_SIGNAL,
TPL_CALLBACK, TPL_CALLBACK,
OnEndOfDxe, LoadFdtOnEvent,
NULL, &mIsEndOfDxeEvent,
&gEfiEndOfDxeEventGroupGuid, &gEfiEndOfDxeEventGroupGuid,
&EndOfDxeEvent &EndOfDxeEvent
); );

View File

@ -1,6 +1,6 @@
#/** @file #/** @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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 } } 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] [Ppis]
## Include/Ppi/ArmGlobalVariable.h ## Include/Ppi/ArmGlobalVariable.h
gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} } gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }

View File

@ -427,7 +427,6 @@ StartDefaultBootOnTimeout (
which is implementation-dependent. which is implementation-dependent.
**/ **/
STATIC
VOID VOID
EFIAPI EFIAPI
EmptyCallbackFunction ( EmptyCallbackFunction (

View File

@ -2,7 +2,7 @@
# #
# Component description file for Bds module # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -53,6 +53,7 @@
gEfiEndOfDxeEventGroupGuid gEfiEndOfDxeEventGroupGuid
gEfiFileSystemInfoGuid gEfiFileSystemInfoGuid
gArmGlobalVariableGuid gArmGlobalVariableGuid
gArmPlatformUpdateFdtEventGuid
[Protocols] [Protocols]
gEfiBdsArchProtocolGuid gEfiBdsArchProtocolGuid

View File

@ -289,4 +289,19 @@ IsPrintableString (
OUT BOOLEAN *IsUnicode 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_ */ #endif /* _BDSINTERNAL_H_ */

View File

@ -15,6 +15,7 @@
#include "BdsInternal.h" #include "BdsInternal.h"
#include <Guid/ArmGlobalVariableHob.h> #include <Guid/ArmGlobalVariableHob.h>
#include <Guid/ArmPlatformEvents.h>
extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList; extern BDS_LOAD_OPTION_SUPPORT *BdsLoadOptionSupportList;
@ -834,6 +835,7 @@ UpdateFdtPath (
BDS_SUPPORTED_DEVICE *SupportedBootDevice; BDS_SUPPORTED_DEVICE *SupportedBootDevice;
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNodes; EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNodes;
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath; EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;
EFI_EVENT UpdateFdtEvent;
Status = SelectBootDevice (&SupportedBootDevice); Status = SelectBootDevice (&SupportedBootDevice);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
@ -873,6 +875,23 @@ UpdateFdtPath (
ASSERT_EFI_ERROR(Status); 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: EXIT:
if (Status == EFI_ABORTED) { if (Status == EFI_ABORTED) {
Print(L"\n"); Print(L"\n");

View File

@ -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