Skip to content

Commit

Permalink
ArmPlatformPkg: Introduced 'ArmPlatformSecLib'
Browse files Browse the repository at this point in the history
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 <[email protected]>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13260 6f19259b-4bc3-4df7-8a09-765794883524
  • Loading branch information
oliviermartin committed May 2, 2012
1 parent 315649c commit e314d56
Show file tree
Hide file tree
Showing 39 changed files with 569 additions and 371 deletions.
1 change: 1 addition & 0 deletions ArmPlatformPkg/ArmPlatformPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A8.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb-RTSM-A9x2.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,15 +13,15 @@

#include <AsmMacroIoLib.h>
#include <Base.h>
#include <Library/ArmPlatformLib.h>
#include <Library/ArmPlatformSecLib.h>
#include <ArmPlatform.h>
#include <AutoGen.h>

.text
.align 3

GCC_ASM_EXPORT(ArmPlatformSecBootAction)
GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)
GCC_ASM_EXPORT(ArmPlatformSecBootMemoryInit)

/**
Call at the beginning of the platform boot up
Expand All @@ -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
Expand All @@ -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
16 changes: 10 additions & 6 deletions ...rmRealViewEbLibRTSM/ArmRealViewEbBoot.asm → ...ealViewEbSecLibRTSM/ArmRealViewEbBoot.asm
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,17 +13,17 @@

#include <AsmMacroIoLib.h>
#include <Base.h>
#include <Library/ArmPlatformLib.h>
#include <Library/ArmPlatformSecLib.h>
#include <ArmPlatform.h>
#include <AutoGen.h>

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
Expand All @@ -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
Expand All @@ -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
17 changes: 12 additions & 5 deletions ...y/ArmRealViewEbLibRTSM/ArmRealViewEbSec.c → ...rmRealViewEbSecLibRTSM/ArmRealViewEbSec.c
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,7 +13,8 @@
**/

#include <Library/IoLib.h>
#include <Library/ArmPlatformLib.h>
#include <Library/ArmLib.h>
#include <Library/ArmPlatformSecLib.h>
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>

Expand All @@ -30,7 +31,7 @@
**/
VOID
ArmPlatformTrustzoneInit (
ArmPlatformSecTrustzoneInit (
IN UINTN MpId
)
{
Expand All @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -31,7 +31,6 @@
ArmLib

[Sources.common]
ArmRealViewEb.c
ArmRealViewEbSec.c
ArmRealViewEbBoot.asm | RVCT
ArmRealViewEbBoot.S | GCC
Expand All @@ -41,3 +40,6 @@

[FixedPcd]
gArmTokenSpaceGuid.PcdFvBaseAddress

gArmTokenSpaceGuid.PcdArmPrimaryCoreMask
gArmTokenSpaceGuid.PcdArmPrimaryCore
5 changes: 3 additions & 2 deletions ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit e314d56

Please sign in to comment.