From e314d564db4d52a9e904f6049dad7fc5dece5cb4 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Wed, 2 May 2012 20:13:32 +0000 Subject: [PATCH] ArmPlatformPkg: Introduced 'ArmPlatformSecLib' The function only used in Secure Firmware used to be mixed with the Non-Secure/Normal functions in ArmPlatformLib. When the Secure Firmware was not required for some platforms (eg: BeagleBoard), these functions were empty functions. This new interface has been created to clean the ArmPlatformLib interface between the SEC and PEI phases. Signed-off-by: Olivier Martin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13260 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/ArmPlatformPkg.dsc | 1 + .../ArmRealViewEb-RTSM-A8.dsc | 3 +- .../ArmRealViewEb-RTSM-A9x2.dsc | 3 +- .../ArmRealViewEbLibSec.inf | 44 +++++++ .../ArmRealViewEbBoot.S | 14 ++- .../ArmRealViewEbBoot.asm | 16 ++- .../ArmRealViewEbSec.c | 17 ++- .../ArmRealViewEbSecLib.inf | 8 +- .../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 5 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 5 +- .../ArmVExpress-RTSM-A15_MPCore.dsc | 5 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 5 +- ...xpressSecLib.inf => ArmVExpressLibSec.inf} | 110 +++++++++--------- .../ArmVExpressLibRTSM/ArmVExpressLibSec.inf | 50 ++++++++ .../ArmVExpressSecLib.inf | 59 ++++++++++ .../CTA9x4Boot.S | 6 +- .../CTA9x4Boot.asm | 6 +- .../CTA9x4Sec.c | 26 ++++- .../ArmVExpressSecLib.inf | 14 +-- .../RTSMBoot.S | 6 +- .../RTSMBoot.asm | 4 +- .../ArmVExpressSecLibRTSM/RTSMHelper.S | 71 +++++++++++ .../ArmVExpressSecLibRTSM/RTSMHelper.asm | 73 ++++++++++++ .../RTSMSec.c | 13 ++- .../Include/Library/ArmPlatformLib.h | 66 ----------- .../Include/Library/ArmPlatformSecLib.h | 84 +++++++++++++ .../ArmPlatformLibNullBoot.S | 6 +- .../ArmPlatformLibNullBoot.asm | 8 +- .../ArmPlatformLibNullSec.c | 14 ++- .../ArmPlatformLibNullSec.inf | 5 +- ArmPlatformPkg/Sec/Sec.c | 22 +--- ArmPlatformPkg/Sec/Sec.inf | 2 +- ArmPlatformPkg/Sec/SecEntryPoint.S | 4 +- ArmPlatformPkg/Sec/SecEntryPoint.asm | 4 +- ArmPlatformPkg/Sec/SecInternal.h | 7 +- .../Library/BeagleBoardLib/BeagleBoard.c | 35 ------ .../BeagleBoardLib/BeagleBoardHelper.S | 57 --------- .../BeagleBoardLib/BeagleBoardHelper.asm | 58 --------- .../Library/BeagleBoardLib/BeagleBoardLib.inf | 4 +- 39 files changed, 569 insertions(+), 371 deletions(-) create mode 100644 ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf rename ArmPlatformPkg/ArmRealViewEbPkg/Library/{ArmRealViewEbLibRTSM => ArmRealViewEbSecLibRTSM}/ArmRealViewEbBoot.S (80%) mode change 100755 => 100644 rename ArmPlatformPkg/ArmRealViewEbPkg/Library/{ArmRealViewEbLibRTSM => ArmRealViewEbSecLibRTSM}/ArmRealViewEbBoot.asm (79%) mode change 100755 => 100644 rename ArmPlatformPkg/ArmRealViewEbPkg/Library/{ArmRealViewEbLibRTSM => ArmRealViewEbSecLibRTSM}/ArmRealViewEbSec.c (81%) mode change 100755 => 100644 rename ArmPlatformPkg/ArmRealViewEbPkg/Library/{ArmRealViewEbLibRTSM => ArmRealViewEbSecLibRTSM}/ArmRealViewEbSecLib.inf (83%) rename ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/{ArmVExpressSecLib.inf => ArmVExpressLibSec.inf} (81%) create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibCTA9x4 => ArmVExpressSecLibCTA9x4}/CTA9x4Boot.S (94%) mode change 100755 => 100644 rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibCTA9x4 => ArmVExpressSecLibCTA9x4}/CTA9x4Boot.asm (94%) mode change 100755 => 100644 rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibCTA9x4 => ArmVExpressSecLibCTA9x4}/CTA9x4Sec.c (86%) rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibRTSM => ArmVExpressSecLibRTSM}/ArmVExpressSecLib.inf (79%) rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibRTSM => ArmVExpressSecLibRTSM}/RTSMBoot.S (88%) rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibRTSM => ArmVExpressSecLibRTSM}/RTSMBoot.asm (92%) create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S create mode 100644 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm rename ArmPlatformPkg/ArmVExpressPkg/Library/{ArmVExpressLibRTSM => ArmVExpressSecLibRTSM}/RTSMSec.c (90%) create mode 100644 ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h rename ArmPlatformPkg/Library/{ArmPlatformLibNull => ArmPlatformSecLibNull}/ArmPlatformLibNullBoot.S (87%) rename ArmPlatformPkg/Library/{ArmPlatformLibNull => ArmPlatformSecLibNull}/ArmPlatformLibNullBoot.asm (85%) rename ArmPlatformPkg/Library/{ArmPlatformLibNull => ArmPlatformSecLibNull}/ArmPlatformLibNullSec.c (84%) rename ArmPlatformPkg/Library/{ArmPlatformLibNull => ArmPlatformSecLibNull}/ArmPlatformLibNullSec.inf (86%) delete mode 100755 BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S delete mode 100755 BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc index 80ff4c787e..69cdfef3d5 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg.dsc @@ -115,6 +115,7 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf + ArmPlatformSecLib|ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf ArmTrustedMonitorLib|ArmPlatformPkg/Library/ArmTrustedMonitorLibNull/ArmTrustedMonitorLibNull.inf diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc index 7bc81867f1..703c84c221 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc @@ -40,7 +40,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8 --fpu=softvfp -I$(WORKSPACE)/ArmPlatformPkg/ArmRealViewEbPkg/Include/Platform diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc index eb9f243a46..53ef035693 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc @@ -40,7 +40,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A9 --fpu=softvfp -I$(WORKSPACE)/ArmPlatformPkg/ArmRealViewEbPkg/Include/Platform diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf new file mode 100644 index 0000000000..652211d991 --- /dev/null +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbLibSec.inf @@ -0,0 +1,44 @@ +#/* @file +# Copyright (c) 2011-2012, 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. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = ArmRealViewEbLibSec + FILE_GUID = 5d1013ae-57b8-4a37-87d8-f5bf70e49059 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + IoLib + ArmLib + +[Sources.common] + ArmRealViewEb.c + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.S old mode 100755 new mode 100644 similarity index 80% rename from ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S rename to ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.S index 3f8c9ce520..ba87650f99 --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.S +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include @@ -21,7 +21,7 @@ .align 3 GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) +GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) /** Call at the beginning of the platform boot up @@ -33,7 +33,11 @@ GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) **/ ASM_PFX(ArmPlatformSecBootAction): - bx lr + LoadConstantToReg (ARM_EB_SYS_FLAGS_NV_REG, r0) + ldr r0, [r0] + cmp r0, #0 + bxeq lr + bxne r0 /** Initialize the memory where the initial stacks will reside @@ -45,6 +49,6 @@ ASM_PFX(ArmPlatformSecBootAction): pointer is not used (probably required to use assembly language) **/ -ASM_PFX(ArmPlatformInitializeBootMemory): +ASM_PFX(ArmPlatformSecBootMemoryInit): // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.asm old mode 100755 new mode 100644 similarity index 79% rename from ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm rename to ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.asm index 9794aac430..1765dd13aa --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbBoot.asm +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbBoot.asm @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -13,17 +13,17 @@ #include #include -#include +#include #include #include INCLUDE AsmMacroIoLib.inc EXPORT ArmPlatformSecBootAction - EXPORT ArmPlatformInitializeBootMemory + EXPORT ArmPlatformSecBootMemoryInit PRESERVE8 - AREA CTA9x4BootMode, CODE, READONLY + AREA ArmRealviewEbBootMode, CODE, READONLY /** Call at the beginning of the platform boot up @@ -35,7 +35,11 @@ **/ ArmPlatformSecBootAction - bx lr + LoadConstantToReg (ARM_EB_SYS_FLAGS_NV_REG, r0) + ldr r0, [r0] + cmp r0, #0 + bxeq lr + bxne r0 /** Initialize the memory where the initial stacks will reside @@ -47,6 +51,6 @@ ArmPlatformSecBootAction pointer is not used (probably required to use assembly language) **/ -ArmPlatformInitializeBootMemory +ArmPlatformSecBootMemoryInit // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSec.c b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSec.c old mode 100755 new mode 100644 similarity index 81% rename from ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSec.c rename to ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSec.c index 7191835a61..10dcef92ad --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSec.c +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSec.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, 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 @@ -13,7 +13,8 @@ **/ #include -#include +#include +#include #include #include @@ -30,7 +31,7 @@ **/ VOID -ArmPlatformTrustzoneInit ( +ArmPlatformSecTrustzoneInit ( IN UINTN MpId ) { @@ -44,12 +45,18 @@ ArmPlatformTrustzoneInit ( For example, some L2x0 requires to be initialized in Secure World **/ -VOID +RETURN_STATUS ArmPlatformSecInitialize ( - VOID + IN UINTN MpId ) { + // If it is not the primary core then there is nothing to do + if (!IS_PRIMARY_CORE(MpId)) { + return RETURN_SUCCESS; + } + // Do nothing yet + return RETURN_SUCCESS; } /** diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSecLib.inf b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSecLib.inf similarity index 83% rename from ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSecLib.inf rename to ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSecLib.inf index f72b50dde4..b6971bc768 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbSecLib.inf +++ b/ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbSecLibRTSM/ArmRealViewEbSecLib.inf @@ -1,5 +1,5 @@ #/* @file -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -17,7 +17,7 @@ FILE_GUID = 6e02ebe0-1d96-11e0-b9cb-0002a5d5c51b MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib + LIBRARY_CLASS = ArmPlatformSecLib [Packages] MdePkg/MdePkg.dec @@ -31,7 +31,6 @@ ArmLib [Sources.common] - ArmRealViewEb.c ArmRealViewEbSec.c ArmRealViewEbBoot.asm | RVCT ArmRealViewEbBoot.S | GCC @@ -41,3 +40,6 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFvBaseAddress + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index 63d15e84b3..4f3b568117 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -54,7 +54,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf # Uncomment to turn on GDB stub in SEC. #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc index 6ec78346e3..69438ec38b 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -48,7 +48,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc index 69a89b633a..c06cb1d968 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -48,7 +48,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc index 719b66c328..cb92c17acb 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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,7 +42,8 @@ [LibraryClasses.common.SEC] ArmLib|ArmPkg/Library/ArmLib/ArmV7/ArmV7LibSec.inf - ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf + ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf + ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf # Uncomment to turn on GDB stub in SEC. #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf similarity index 81% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressSecLib.inf rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf index 47ad7396ad..f66e4c392f 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressSecLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/ArmVExpressLibSec.inf @@ -1,57 +1,53 @@ -#/* @file -# Copyright (c) 2011, 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. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = CTA9x4ArmVExpressLib - FILE_GUID = b16c63a0-f417-11df-b3af-0002a5d5c51b - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - ArmPkg/ArmPkg.dec - ArmPlatformPkg/ArmPlatformPkg.dec - -[LibraryClasses] - ArmLib - ArmTrustZoneLib - ArmPlatformSysConfigLib - ArmPlatformSecExtraActionLib - IoLib - L2X0CacheLib - PL301AxiLib - PL341DmcLib - PL35xSmcLib - SerialPortLib - -[Sources.common] - CTA9x4Sec.c - CTA9x4.c - CTA9x4Boot.asm | RVCT - CTA9x4Boot.S | GCC - -[FeaturePcd] - gEmbeddedTokenSpaceGuid.PcdCacheEnable - gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping - -[FixedPcd] - gArmTokenSpaceGuid.PcdTrustzoneSupport - - gArmTokenSpaceGuid.PcdL2x0ControllerBase - - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore +#/* @file +# Copyright (c) 2011-2012, 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. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = CTA9x4ArmVExpressLibSec + FILE_GUID = b16c63a0-f417-11df-b3af-0002a5d5c51b + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + IoLib + ArmLib + ArmTrustZoneLib + PL341DmcLib + PL301AxiLib + L2X0CacheLib + SerialPortLib + +[Sources.common] + CTA9x4.c + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping + +[FixedPcd] + gArmTokenSpaceGuid.PcdTrustzoneSupport + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + + gArmTokenSpaceGuid.PcdL2x0ControllerBase + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf new file mode 100644 index 0000000000..4938b939a2 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf @@ -0,0 +1,50 @@ +#/* @file +# Copyright (c) 2011-2012, 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. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = RTSMArmVExpressLibSec + FILE_GUID = a79eed97-4b98-4974-9690-37b32d6a5b56 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + IoLib + ArmLib + SerialPortLib + +[Sources.common] + RTSM.c + RTSMHelper.asm | RVCT + RTSMHelper.S | GCC + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping + gArmPlatformTokenSpaceGuid.PcdStandalone + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + gArmTokenSpaceGuid.PcdFvBaseAddress + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf new file mode 100644 index 0000000000..eeb4e0c5e4 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/ArmVExpressSecLib.inf @@ -0,0 +1,59 @@ +#/* @file +# Copyright (c) 2011-2012, 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. +# +#*/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = CTA9x4ArmVExpressLib + FILE_GUID = aac05341-56df-4a77-b20f-f5daa456bd90 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformSecLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + ArmTrustZoneLib + ArmPlatformLib + ArmPlatformSysConfigLib + ArmPlatformSecExtraActionLib + IoLib + L2X0CacheLib + PL301AxiLib + PL341DmcLib + PL35xSmcLib + SerialPortLib + +[Sources.common] + CTA9x4Sec.c + CTA9x4Boot.asm | RVCT + CTA9x4Boot.S | GCC + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping + gArmPlatformTokenSpaceGuid.PcdStandalone + gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec + +[FixedPcd] + gArmTokenSpaceGuid.PcdTrustzoneSupport + + gArmTokenSpaceGuid.PcdL2x0ControllerBase + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S old mode 100755 new mode 100644 similarity index 94% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S index cd7734fafe..c14c986ccf --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -22,7 +22,7 @@ .align 3 GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) +GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) GCC_ASM_IMPORT(PL35xSmcInitialize) // @@ -82,7 +82,7 @@ ASM_PFX(ArmPlatformSecBootAction): pointer is not used (probably required to use assembly language) **/ -ASM_PFX(ArmPlatformInitializeBootMemory): +ASM_PFX(ArmPlatformSecBootMemoryInit): mov r5, lr // diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm old mode 100755 new mode 100644 similarity index 94% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm index 0350608a2f..ebcee9a0d9 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Boot.asm @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -21,7 +21,7 @@ INCLUDE AsmMacroIoLib.inc EXPORT ArmPlatformSecBootAction - EXPORT ArmPlatformInitializeBootMemory + EXPORT ArmPlatformSecBootMemoryInit IMPORT PL35xSmcInitialize PRESERVE8 @@ -84,7 +84,7 @@ ArmPlatformSecBootAction pointer is not used (probably required to use assembly language) **/ -ArmPlatformInitializeBootMemory +ArmPlatformSecBootMemoryInit mov r5, lr // diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Sec.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c similarity index 86% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Sec.c rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c index 37140a4a58..ce9bc8b271 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Sec.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibCTA9x4/CTA9x4Sec.c @@ -31,7 +31,7 @@ **/ VOID -ArmPlatformTrustzoneInit ( +ArmPlatformSecTrustzoneInit ( IN UINTN MpId ) { @@ -114,10 +114,16 @@ ArmPlatformTrustzoneInit ( For example, some L2x0 requires to be initialized in Secure World **/ -VOID +RETURN_STATUS ArmPlatformSecInitialize ( - VOID - ) { + IN UINTN MpId + ) +{ + // If it is not the primary core then there is nothing to do + if (!IS_PRIMARY_CORE(MpId)) { + return RETURN_SUCCESS; + } + // The L2x0 controller must be intialize in Secure World L2x0CacheInit(PcdGet32(PcdL2x0ControllerBase), PL310_TAG_LATENCIES(L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES,L2x0_LATENCY_8_CYCLES), @@ -127,4 +133,16 @@ ArmPlatformSecInitialize ( // Initialize the System Configuration ArmPlatformSysConfigInitialize (); + + // If we skip the PEI Core we could want to initialize the DRAM in the SEC phase. + // If we are in standalone, we need the initialization to copy the UEFI firmware into DRAM + if ((FeaturePcdGet (PcdSystemMemoryInitializeInSec)) || (FeaturePcdGet (PcdStandalone) == FALSE)) { + // If it is not a standalone build ensure the PcdSystemMemoryInitializeInSec has been set + ASSERT(FeaturePcdGet (PcdSystemMemoryInitializeInSec) == TRUE); + + // Initialize system memory (DRAM) + ArmPlatformInitializeSystemMemory (); + } + + return RETURN_SUCCESS; } diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf similarity index 79% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf index bf6caadcee..e2f9191714 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressSecLib.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf @@ -1,5 +1,5 @@ #/* @file -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -13,11 +13,11 @@ [Defines] INF_VERSION = 0x00010005 - BASE_NAME = RTSMArmVExpressLib - FILE_GUID = 6352e3a0-ed14-4613-bf90-d316014dd142 + BASE_NAME = RTSMArmVExpressSecLib + FILE_GUID = 1fdaabb0-ab7d-480c-91ff-428dc1546f3a MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib + LIBRARY_CLASS = ArmPlatformSecLib [Packages] MdePkg/MdePkg.dec @@ -33,14 +33,11 @@ [Sources.common] RTSMSec.c - RTSM.c RTSMBoot.asm | RVCT RTSMBoot.S | GCC RTSMHelper.asm | RVCT RTSMHelper.S | GCC -[Protocols] - [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdCacheEnable gArmPlatformTokenSpaceGuid.PcdNorFlashRemapping @@ -48,3 +45,6 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFvBaseAddress + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S similarity index 88% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.S rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S index 088f1522fb..371adcb8f9 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -21,7 +21,7 @@ .align 3 GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) +GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) /** Call at the beginning of the platform boot up @@ -45,6 +45,6 @@ ASM_PFX(ArmPlatformSecBootAction): pointer is not used (probably required to use assembly language) **/ -ASM_PFX(ArmPlatformInitializeBootMemory): +ASM_PFX(ArmPlatformSecBootMemoryInit): // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm similarity index 92% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.asm rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm index 7603f373c6..f62a1998ed 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMBoot.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMBoot.asm @@ -20,7 +20,7 @@ INCLUDE AsmMacroIoLib.inc EXPORT ArmPlatformSecBootAction - EXPORT ArmPlatformInitializeBootMemory + EXPORT ArmPlatformSecBootMemoryInit PRESERVE8 AREA RTSMVExpressBootMode, CODE, READONLY @@ -47,6 +47,6 @@ ArmPlatformSecBootAction pointer is not used (probably required to use assembly language) **/ -ArmPlatformInitializeBootMemory +ArmPlatformSecBootMemoryInit // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S new file mode 100644 index 0000000000..f47a5312ff --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.S @@ -0,0 +1,71 @@ +# +# Copyright (c) 2011-2012, 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. +# +# + +#include +#include +#include +#include +#.include AsmMacroIoLib.inc + +#include + +.text +.align 2 + +GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) + +# IN None +# OUT r0 = SCU Base Address +ASM_PFX(ArmGetScuBaseAddress): + # Read Configuration Base Address Register. ArmCBar cannot be called to get + # the Configuration BAR as a stack is not necessary setup. The SCU is at the + # offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +# IN None +# OUT r0 = number of cores present in the system +ASM_PFX(ArmGetCpuCountPerCluster): + stmfd SP!, {r1-r2} + + # Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + # Check if the CPU is A15 + mov r1, r1, LSR #4 + LoadConstantToReg (ARM_CPU_TYPE_MASK, r0) + and r1, r1, r0 + + LoadConstantToReg (ARM_CPU_TYPE_A15, r0) + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15: + mov r2, lr @ Save link register + bl ArmGetScuBaseAddress @ Read SCU Base Address + mov lr, r2 @ Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg: + mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to get CPU count + lsr r0, #24 + +_Return: + and r0, r0, #3 + # Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + +ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm new file mode 100644 index 0000000000..402db58278 --- /dev/null +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMHelper.asm @@ -0,0 +1,73 @@ +// +// Copyright (c) 2011-2012, 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. +// +// + +#include +#include +#include + +#include + +#include + + INCLUDE AsmMacroIoLib.inc + + EXPORT ArmGetCpuCountPerCluster + + AREA RTSMHelper, CODE, READONLY + +// IN None +// OUT r0 = SCU Base Address +ArmGetScuBaseAddress + // Read Configuration Base Address Register. ArmCBar cannot be called to get + // the Configuration BAR as a stack is not necessary setup. The SCU is at the + // offset 0x0000 from the Private Memory Region. + mrc p15, 4, r0, c15, c0, 0 + bx lr + +// IN None +// OUT r0 = number of cores present in the system +ArmGetCpuCountPerCluster + stmfd SP!, {r1-r2} + + // Read CP15 MIDR + mrc p15, 0, r1, c0, c0, 0 + + // Check if the CPU is A15 + mov r1, r1, LSR #4 + mov r0, #ARM_CPU_TYPE_MASK + and r1, r1, r0 + + mov r0, #ARM_CPU_TYPE_A15 + cmp r1, r0 + beq _Read_cp15_reg + +_CPU_is_not_A15 + mov r2, lr ; Save link register + bl ArmGetScuBaseAddress ; Read SCU Base Address + mov lr, r2 ; Restore link register val + ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] ; Read SCU Config reg to get CPU count + b _Return + +_Read_cp15_reg + mrc p15, 1, r0, c9, c0, 2 ; Read C9 register of CP15 to get CPU count + lsr r0, #24 + + +_Return + and r0, r0, #3 + // Add '1' to the number of CPU on the Cluster + add r0, r0, #1 + ldmfd SP!, {r1-r2} + bx lr + + END diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMSec.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c similarity index 90% rename from ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMSec.c rename to ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c index c65c28c1fa..4ae6301603 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMSec.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/RTSMSec.c @@ -30,7 +30,7 @@ **/ VOID -ArmPlatformTrustzoneInit ( +ArmPlatformSecTrustzoneInit ( IN UINTN MpId ) { @@ -44,11 +44,16 @@ ArmPlatformTrustzoneInit ( For example, some L2x0 requires to be initialized in Secure World **/ -VOID +RETURN_STATUS ArmPlatformSecInitialize ( - VOID + IN UINTN MpId ) { + // If it is not the primary core then there is nothing to do + if (!IS_PRIMARY_CORE(MpId)) { + return RETURN_SUCCESS; + } + // Configure periodic timer (TIMER0) for 1MHz operation MmioOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, SP810_SYS_CTRL_TIMER0_TIMCLK); // Configure 1MHz clock @@ -57,6 +62,8 @@ ArmPlatformSecInitialize ( MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER2_EN, SP810_SYS_CTRL_TIMER2_TIMCLK); // Configure SP810 to use 1MHz clock and disable MmioAndThenOr32 (SP810_CTRL_BASE + SP810_SYS_CTRL_REG, ~SP810_SYS_CTRL_TIMER3_EN, SP810_SYS_CTRL_TIMER3_TIMCLK); + + return RETURN_SUCCESS; } /** diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h index bb5778f59b..3d7e1bc248 100644 --- a/ArmPlatformPkg/Include/Library/ArmPlatformLib.h +++ b/ArmPlatformPkg/Include/Library/ArmPlatformLib.h @@ -41,21 +41,6 @@ typedef struct { UINT64 NumberOfBytes; } ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR; -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -VOID -ArmPlatformInitializeBootMemory ( - VOID - ); - /** Return the current Boot Mode @@ -69,45 +54,6 @@ 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 - - Some peripherals must be initialized in Secure World. - For example, some L2x0 requires to be initialized in Secure World - -**/ -VOID -ArmPlatformSecInitialize ( - VOID - ); - -/** - Call before jumping to Normal World - - This function allows the firmware platform to do extra actions before - jumping to the Normal World - -**/ -VOID -ArmPlatformSecExtraAction ( - IN UINTN MpId, - OUT UINTN* JumpAddress - ); - /** Initialize controllers that must setup in the normal world @@ -131,18 +77,6 @@ ArmPlatformInitializeSystemMemory ( VOID ); -/** - Initialize the Secure peripherals and memory regions - - If Trustzone is supported by your platform then this function makes the required initialization - of the secure peripherals and memory regions. - -**/ -VOID -ArmPlatformTrustzoneInit ( - IN UINTN MpId - ); - /** Return the Virtual Memory Map of your platform diff --git a/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h b/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h new file mode 100644 index 0000000000..477fd7d99f --- /dev/null +++ b/ArmPlatformPkg/Include/Library/ArmPlatformSecLib.h @@ -0,0 +1,84 @@ +/** @file +* +* Copyright (c) 2011-2012, 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 _ARMPLATFORMSECLIB_H_ +#define _ARMPLATFORMSECLIB_H_ + +/** + Initialize the memory where the initial stacks will reside + + This memory can contain the initial stacks (Secure and Secure Monitor stacks). + In some platform, this region is already initialized and the implementation of this function can + do nothing. This memory can also represent the Secure RAM. + This function is called before the satck has been set up. Its implementation must ensure the stack + pointer is not used (probably required to use assembly language) + +**/ +VOID +ArmPlatformSecBootMemoryInit ( + 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 + + Some peripherals must be initialized in Secure World. + For example: Some L2 controller, interconnect, clock, DMC, etc + +**/ +RETURN_STATUS +ArmPlatformSecInitialize ( + IN UINTN MpId + ); + +/** + Call before jumping to Normal World + + This function allows the firmware platform to do extra actions before + jumping to the Normal World + +**/ +VOID +ArmPlatformSecExtraAction ( + IN UINTN MpId, + OUT UINTN* JumpAddress + ); + +/** + Initialize the Secure peripherals and memory regions + + If Trustzone is supported by your platform then this function makes the required initialization + of the secure peripherals and memory regions. + +**/ +VOID +ArmPlatformSecTrustzoneInit ( + IN UINTN MpId + ); + +#endif diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.S b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S similarity index 87% rename from ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.S rename to ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S index 83c9e30e94..a00fac4f81 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.S +++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -18,7 +18,7 @@ .align 3 GCC_ASM_EXPORT(ArmPlatformSecBootAction) -GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) +GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit) /** Call at the beginning of the platform boot up @@ -42,6 +42,6 @@ ASM_PFX(ArmPlatformSecBootAction): pointer is not used (probably required to use assembly language) **/ -ASM_PFX(ArmPlatformInitializeBootMemory): +ASM_PFX(ArmPlatformSecBootMemoryInit): // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.asm b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm similarity index 85% rename from ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.asm rename to ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm index d99b86feba..0cd5e37c70 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullBoot.asm +++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullBoot.asm @@ -1,5 +1,5 @@ // -// Copyright (c) 2011, ARM Limited. All rights reserved. +// Copyright (c) 2011-2012, 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 @@ -15,10 +15,10 @@ #include EXPORT ArmPlatformSecBootAction - EXPORT ArmPlatformInitializeBootMemory + EXPORT ArmPlatformSecBootMemoryInit PRESERVE8 - AREA ArmPlatformLibBoot, CODE, READONLY + AREA ArmPlatformSecLibBoot, CODE, READONLY /** Call at the beginning of the platform boot up @@ -42,6 +42,6 @@ ArmPlatformSecBootAction pointer is not used (probably required to use assembly language) **/ -ArmPlatformInitializeBootMemory +ArmPlatformSecBootMemoryInit // The SMC does not need to be initialized for RTSM bx lr diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.c b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c similarity index 84% rename from ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.c rename to ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c index 9622a32291..c548d8b3f9 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.c +++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2011-2012, 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 @@ -24,7 +24,7 @@ **/ VOID -ArmPlatformTrustzoneInit ( +ArmPlatformSecTrustzoneInit ( IN UINTN MpId ) { @@ -43,12 +43,18 @@ ArmPlatformTrustzoneInit ( For example, some L2x0 requires to be initialized in Secure World **/ -VOID +RETURN_STATUS ArmPlatformSecInitialize ( - VOID + IN UINTN MpId ) { + // If it is not the primary core then there is nothing to do + if (!IS_PRIMARY_CORE(MpId)) { + return RETURN_SUCCESS; + } + // Do nothing yet + return RETURN_SUCCESS; } /** diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf similarity index 86% rename from ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf rename to ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf index bd3dc4958c..46c803d20f 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNullSec.inf +++ b/ArmPlatformPkg/Library/ArmPlatformSecLibNull/ArmPlatformLibNullSec.inf @@ -14,10 +14,10 @@ [Defines] INF_VERSION = 0x00010005 BASE_NAME = ArmPlatformLibSecNull - FILE_GUID = 83333d9e-b00d-44cb-819c-e154c7efe79a + FILE_GUID = a2cf63c6-d44f-4cd0-8af6-722a0138c021 MODULE_TYPE = BASE VERSION_STRING = 1.0 - LIBRARY_CLASS = ArmPlatformLib + LIBRARY_CLASS = ArmPlatformSecLib [Packages] MdePkg/MdePkg.dec @@ -30,7 +30,6 @@ DebugLib [Sources.common] - ArmPlatformLibNull.c ArmPlatformLibNullSec.c ArmPlatformLibNullBoot.asm | RVCT ArmPlatformLibNullBoot.S | GCC diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c index 00293f0d00..f9746ad891 100644 --- a/ArmPlatformPkg/Sec/Sec.c +++ b/ArmPlatformPkg/Sec/Sec.c @@ -19,7 +19,6 @@ #include #include #include -#include #include "SecInternal.h" @@ -50,7 +49,11 @@ CEntryPoint ( if (FixedPcdGet32 (PcdVFPEnabled)) { ArmEnableVFP(); } - + + // Initialize peripherals that must be done at the early stage + // Example: Some L2 controller, interconnect, clock, DMC, etc + ArmPlatformSecInitialize (MpId); + // Primary CPU clears out the SCU tag RAMs, secondaries wait if (IS_PRIMARY_CORE(MpId)) { if (ArmIsMpCore()) { @@ -93,19 +96,6 @@ CEntryPoint ( // Enable Full Access to CoProcessors ArmWriteCpacr (CPACR_CP_FULL_ACCESS); - if (IS_PRIMARY_CORE(MpId)) { - // Initialize peripherals that must be done at the early stage - // Example: Some L2x0 controllers must be initialized in Secure World - ArmPlatformSecInitialize (); - - // If we skip the PEI Core we could want to initialize the DRAM in the SEC phase. - // If we are in standalone, we need the initialization to copy the UEFI firmware into DRAM - if (FeaturePcdGet (PcdSystemMemoryInitializeInSec)) { - // Initialize system memory (DRAM) - ArmPlatformInitializeSystemMemory (); - } - } - // Test if Trustzone is supported on this platform if (FixedPcdGetBool (PcdTrustzoneSupport)) { if (ArmIsMpCore()) { @@ -155,7 +145,7 @@ TrustedWorldInitialization ( ArmGicSetupNonSecure (MpId, PcdGet32(PcdGicDistributorBase), PcdGet32(PcdGicInterruptInterfaceBase)); // Initialize platform specific security policy - ArmPlatformTrustzoneInit (MpId); + ArmPlatformSecTrustzoneInit (MpId); // Setup the Trustzone Chipsets if (IS_PRIMARY_CORE(MpId)) { diff --git a/ArmPlatformPkg/Sec/Sec.inf b/ArmPlatformPkg/Sec/Sec.inf index 1aa7fd122b..a9ef056075 100644 --- a/ArmPlatformPkg/Sec/Sec.inf +++ b/ArmPlatformPkg/Sec/Sec.inf @@ -38,7 +38,7 @@ [LibraryClasses] ArmCpuLib ArmLib - ArmPlatformLib + ArmPlatformSecLib ArmTrustedMonitorLib BaseLib DebugLib diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.S b/ArmPlatformPkg/Sec/SecEntryPoint.S index 25b6696173..8266dad977 100644 --- a/ArmPlatformPkg/Sec/SecEntryPoint.S +++ b/ArmPlatformPkg/Sec/SecEntryPoint.S @@ -20,7 +20,7 @@ GCC_ASM_IMPORT(CEntryPoint) GCC_ASM_IMPORT(ArmPlatformSecBootAction) -GCC_ASM_IMPORT(ArmPlatformInitializeBootMemory) +GCC_ASM_IMPORT(ArmPlatformSecBootMemoryInit) GCC_ASM_IMPORT(ArmDisableInterrupts) GCC_ASM_IMPORT(ArmDisableCachesAndMmu) GCC_ASM_IMPORT(ArmWriteVBar) @@ -66,7 +66,7 @@ _WaitInitMem: _InitMem: // Initialize Init Boot Memory - bl ASM_PFX(ArmPlatformInitializeBootMemory) + bl ASM_PFX(ArmPlatformSecBootMemoryInit) // Only Primary CPU could run this line (the secondary cores have jumped from _IdentifyCpu to _SetupStack) LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r5) diff --git a/ArmPlatformPkg/Sec/SecEntryPoint.asm b/ArmPlatformPkg/Sec/SecEntryPoint.asm index 3556ce471f..a20a3fd9f6 100644 --- a/ArmPlatformPkg/Sec/SecEntryPoint.asm +++ b/ArmPlatformPkg/Sec/SecEntryPoint.asm @@ -19,7 +19,7 @@ IMPORT CEntryPoint IMPORT ArmPlatformSecBootAction - IMPORT ArmPlatformInitializeBootMemory + IMPORT ArmPlatformSecBootMemoryInit IMPORT ArmDisableInterrupts IMPORT ArmDisableCachesAndMmu IMPORT ArmWriteVBar @@ -68,7 +68,7 @@ _WaitInitMem _InitMem // Initialize Init Boot Memory - bl ArmPlatformInitializeBootMemory + bl ArmPlatformSecBootMemoryInit // Only Primary CPU could run this line (the secondary cores have jumped from _IdentifyCpu to _SetupStack) LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r5) diff --git a/ArmPlatformPkg/Sec/SecInternal.h b/ArmPlatformPkg/Sec/SecInternal.h index 9136db9b46..0d6daf993a 100644 --- a/ArmPlatformPkg/Sec/SecInternal.h +++ b/ArmPlatformPkg/Sec/SecInternal.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,11 +49,6 @@ SecVectorTable ( VOID ); -VOID -NonSecureWaitForFirmware ( - VOID - ); - VOID enter_monitor_mode ( IN UINTN MonitorEntryPoint, diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c index f1235c5daf..951873d3ff 100755 --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c +++ b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c @@ -54,41 +54,6 @@ BeagleBoardGetRevision ( return (BEAGLEBOARD_REVISION)((Revision >> 11) & 0x7); } -/** - Return if Trustzone is supported by your platform - - A non-zero value must be returned if you want to support a Secure World on your platform. - ArmPlatformTrustzoneInit() will later set up the secure regions. - This function can return 0 even if Trustzone is supported by your processor. In this case, - the platform will continue to run in Secure World. - - @return A non-zero value if Trustzone supported. - -**/ -UINTN -ArmPlatformTrustzoneSupported ( - VOID - ) -{ - // The BeagleBoard starts in Normal World (Non Secure World) - return FALSE; -} - -/** - Remap the memory at 0x0 - - Some platform requires or gives the ability to remap the memory at the address 0x0. - This function can do nothing if this feature is not relevant to your platform. - -**/ -VOID -ArmPlatformBootRemapping ( - VOID - ) -{ - // Do nothing for the BeagleBoard -} - /** Return the current Boot Mode diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S deleted file mode 100755 index 8bcb9d80c0..0000000000 --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) 2011, 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. -// -// - -#include -#include -#include -#include -#include - -.text -.align 3 - -GCC_ASM_EXPORT(ArmPlatformIsBootMemoryInitialized) -GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) - -/** - Called at the early stage of the Boot phase to know if the memory has already been initialized - - Running the code from the reset vector does not mean we start from cold boot. In some case, we - can go through this code with the memory already initialized. - Because this function is called at the early stage, the implementation must not use the stack. - Its implementation must probably done in assembly to ensure this requirement. - - @return Return a non zero value if initialized - -**/ -ASM_PFX(ArmPlatformIsBootMemoryInitialized): - // The system memory is initialized by the BeagleBoard firmware - mov r0, #1 - bx lr - - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -ASM_PFX(ArmPlatformInitializeBootMemory): - // We must need to go into this function - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm deleted file mode 100755 index d4b7ae46bc..0000000000 --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.asm +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) 2011, 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. -// -// - -#include -#include -#include -#include -#include - - INCLUDE AsmMacroIoLib.inc - - EXPORT ArmPlatformIsBootMemoryInitialized - EXPORT ArmPlatformInitializeBootMemory - - PRESERVE8 - AREA BeagleBoardHelper, CODE, READONLY - -/** - Called at the early stage of the Boot phase to know if the memory has already been initialized - - Running the code from the reset vector does not mean we start from cold boot. In some case, we - can go through this code with the memory already initialized. - Because this function is called at the early stage, the implementation must not use the stack. - Its implementation must probably done in assembly to ensure this requirement. - - @return Return a non zero value if initialized - -**/ -ArmPlatformIsBootMemoryInitialized - // The system memory is initialized by the BeagleBoard firmware - mov r0, #1 - bx lr - -/** - Initialize the memory where the initial stacks will reside - - This memory can contain the initial stacks (Secure and Secure Monitor stacks). - In some platform, this region is already initialized and the implementation of this function can - do nothing. This memory can also represent the Secure RAM. - This function is called before the satck has been set up. Its implementation must ensure the stack - pointer is not used (probably required to use assembly language) - -**/ -ArmPlatformInitializeBootMemory - // We must need to go into this function - bx lr - - END diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf index 3cd8551501..e076500b81 100755 --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf +++ b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf @@ -1,5 +1,5 @@ #/* @file -# Copyright (c) 2011, ARM Limited. All rights reserved. +# Copyright (c) 2011-2012, 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 @@ -37,8 +37,6 @@ [Sources.common] BeagleBoard.c BeagleBoardMem.c - BeagleBoardHelper.asm | RVCT - BeagleBoardHelper.S | GCC PadConfiguration.c Clock.c -- 2.39.2