From 44e272fd6ab9d7b859588eeffc02b8cd78d3c76b Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Thu, 22 Sep 2011 23:02:13 +0000 Subject: [PATCH] ArmPlatformPkg/ArmPlatformLib: Introduce ArmPlatformSecBootAction function This function is called at the initial stage of the Secure boot process to allow platform vendors to add early actions. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12413 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S | 13 +++++++++++++ .../ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm | 13 +++++++++++++ .../Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S | 13 +++++++++++++ .../Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm | 13 +++++++++++++ ArmPlatformPkg/Include/Library/ArmPlatformLib.h | 14 ++++++++++++++ ArmPlatformPkg/Sec/SecEntryPoint.S | 12 ++++++++---- ArmPlatformPkg/Sec/SecEntryPoint.asm | 12 ++++++++---- 7 files changed, 82 insertions(+), 8 deletions(-) diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S index 037efd9c20..3f8c9ce520 100755 --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S @@ -20,8 +20,21 @@ .text .align 3 +GCC_ASM_EXPORT(ArmPlatformSecBootAction) GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ASM_PFX(ArmPlatformSecBootAction): + bx lr + /** Initialize the memory where the initial stacks will reside diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm index 272a05a8fa..9794aac430 100755 --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm @@ -19,11 +19,24 @@ INCLUDE AsmMacroIoLib.inc + EXPORT ArmPlatformSecBootAction EXPORT ArmPlatformInitializeBootMemory PRESERVE8 AREA CTA9x4BootMode, CODE, READONLY +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ArmPlatformSecBootAction + bx lr + /** Initialize the memory where the initial stacks will reside diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S index c49c66332f..cd7734fafe 100755 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S @@ -21,6 +21,7 @@ .text .align 3 +GCC_ASM_EXPORT(ArmPlatformSecBootAction) GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) GCC_ASM_IMPORT(PL35xSmcInitialize) @@ -59,6 +60,18 @@ VersatileExpressSmcConfiguration: .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_SYNC | PL350_SMC_SET_OPMODE_SET_WR_SYNC VersatileExpressSmcConfigurationEnd: +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ASM_PFX(ArmPlatformSecBootAction): + bx lr + /** Initialize the memory where the initial stacks will reside diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm index 5a08307e13..0350608a2f 100755 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm @@ -20,6 +20,7 @@ INCLUDE AsmMacroIoLib.inc + EXPORT ArmPlatformSecBootAction EXPORT ArmPlatformInitializeBootMemory IMPORT PL35xSmcInitialize @@ -61,6 +62,18 @@ VersatileExpressSmcConfiguration DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC VersatileExpressSmcConfigurationEnd +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +ArmPlatformSecBootAction + bx lr + /** Initialize the memory where the initial stacks will reside diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h index 4ea640f0d2..b2667416e1 100644 --- a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h @@ -82,6 +82,20 @@ ArmPlatformGetBootMode ( VOID ); +/** + Call at the beginning of the platform boot up + + This function allows the firmware platform to do extra actions at the early + stage of the platform power up. + + Note: This function must be implemented in assembler as there is no stack set up yet + +**/ +VOID +ArmPlatformSecBootAction ( + VOID + ); + /** Initialize controllers that must setup at the early stage diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.S b/ArmPlatformPkg/Sec/SecEntryPoint.S index 909f7fafbc..f8599393cb 100644 --- a/ArmPlatformPkg/Sec/SecEntryPoint.S +++ b/ArmPlatformPkg/Sec/SecEntryPoint.S @@ -30,6 +30,7 @@ GCC_ASM_EXPORT(_ModuleEntryPoint) #global functions referenced by this module GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmPlatformSecBootAction) GCC_ASM_IMPORT(ArmPlatformIsMemoryInitialized) GCC_ASM_IMPORT(ArmPlatformInitializeBootMemory) GCC_ASM_IMPORT(ArmDisableInterrupts) @@ -46,16 +47,19 @@ StartupAddr: .word ASM_PFX(CEntryPoint) SecVectorTableAddr: .word ASM_PFX(SecVectorTable) ASM_PFX(_ModuleEntryPoint): - #Set VBAR to the start of the exception vectors in Secure Mode - ldr r0, SecVectorTableAddr - bl ASM_PFX(ArmWriteVBar) - # First ensure all interrupts are disabled bl ASM_PFX(ArmDisableInterrupts) # Ensure that the MMU and caches are off bl ASM_PFX(ArmDisableCachesAndMmu) + # Jump to Platform Specific Boot Action function + blx ASM_PFX(ArmPlatformSecBootAction) + + # Set VBAR to the start of the exception vectors in Secure Mode + ldr r0, =SecVectorTable + bl ASM_PFX(ArmWriteVBar) + _IdentifyCpu: # Identify CPU ID bl ASM_PFX(ArmReadMpidr) diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.asm b/ArmPlatformPkg/Sec/SecEntryPoint.asm index b291e5062f..472abde7f2 100644 --- a/ArmPlatformPkg/Sec/SecEntryPoint.asm +++ b/ArmPlatformPkg/Sec/SecEntryPoint.asm @@ -20,6 +20,7 @@ INCLUDE AsmMacroIoLib.inc IMPORT CEntryPoint + IMPORT ArmPlatformSecBootAction IMPORT ArmPlatformIsMemoryInitialized IMPORT ArmPlatformInitializeBootMemory IMPORT ArmDisableInterrupts @@ -39,16 +40,19 @@ StartupAddr DCD CEntryPoint _ModuleEntryPoint - //Set VBAR to the start of the exception vectors in Secure Mode - ldr r0, =SecVectorTable - blx ArmWriteVBar - // First ensure all interrupts are disabled blx ArmDisableInterrupts // Ensure that the MMU and caches are off blx ArmDisableCachesAndMmu + // Jump to Platform Specific Boot Action function + blx ArmPlatformSecBootAction + + // Set VBAR to the start of the exception vectors in Secure Mode + ldr r0, =SecVectorTable + blx ArmWriteVBar + _IdentifyCpu // Identify CPU ID bl ArmReadMpidr -- 2.39.2