ArmPlatform/ArmPlatformLib: Introduced ArmPlatformPeiBootAction()

This function allows platform to do any specific actions prior to
the start the PEI phase.
For instance, this function could be used by some platforms to initialize clocks that
are required at the early stage of the PEI phase.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Acked-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14347 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2013-05-10 12:49:10 +00:00
parent 2d45f194d9
commit b5a572238d
19 changed files with 91 additions and 21 deletions

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2012, ARM Limited. All rights reserved. // Copyright (c) 2012-2013, 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
@ -15,8 +15,9 @@
#include <Library/ArmLib.h> #include <Library/ArmLib.h>
.text .text
.align 3 .align 2
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(ArmPlatformGetCorePosition) GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
@ -47,3 +48,6 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
moveq r0, #1 moveq r0, #1
movne r0, #0 movne r0, #0
bx lr bx lr
ASM_PFX(ArmPlatformPeiBootAction):
bx lr

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2012, ARM Limited. All rights reserved. // Copyright (c) 2012-2013, 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
@ -16,14 +16,14 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmPlatformGetCorePosition EXPORT ArmPlatformGetCorePosition
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
PRESERVE8 AREA ArmRealViewEbHelper, CODE, READONLY
AREA ArmPlatformNullHelper, CODE, READONLY
//UINTN //UINTN
//ArmPlatformGetCorePosition ( //ArmPlatformGetCorePosition (
@ -52,5 +52,8 @@ ArmPlatformIsPrimaryCore FUNCTION
bx lr bx lr
ENDFUNC ENDFUNC
END ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
END

View File

@ -1,5 +1,5 @@
#/* @file #/* @file
# Copyright (c) 2011-2012, ARM Limited. All rights reserved. # Copyright (c) 2011-2013, 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
@ -32,6 +32,8 @@
MemoryAllocationLib MemoryAllocationLib
[Sources.common] [Sources.common]
ArmRealViewEbHelper.asm | RVCT
ArmRealViewEbHelper.S | GCC
ArmRealViewEb.c ArmRealViewEb.c
ArmRealViewEbMem.c ArmRealViewEbMem.c
ArmRealViewEbHelper.asm | RVCT ArmRealViewEbHelper.asm | RVCT

View File

@ -17,11 +17,15 @@
#include <ArmPlatform.h> #include <ArmPlatform.h>
.text .text
.align 3 .align 2
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(ArmPlatformGetCorePosition) GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
ASM_PFX(ArmPlatformPeiBootAction):
bx lr
//UINTN //UINTN
//ArmPlatformGetCorePosition ( //ArmPlatformGetCorePosition (
// IN UINTN MpId // IN UINTN MpId

View File

@ -18,12 +18,17 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmPlatformGetCorePosition EXPORT ArmPlatformGetCorePosition
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
PRESERVE8 PRESERVE8
AREA CTA15A7Helper, CODE, READONLY AREA CTA15A7Helper, CODE, READONLY
ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
//UINTN //UINTN
//ArmPlatformGetCorePosition ( //ArmPlatformGetCorePosition (
// IN UINTN MpId // IN UINTN MpId

View File

@ -1,5 +1,5 @@
#/* @file #/* @file
# Copyright (c) 2011-2012, ARM Limited. All rights reserved. # Copyright (c) 2011-2013, 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
@ -37,6 +37,8 @@
SerialPortLib SerialPortLib
[Sources.common] [Sources.common]
CTA9x4Helper.asm | RVCT
CTA9x4Helper.S | GCC
CTA9x4.c CTA9x4.c
CTA9x4Mem.c CTA9x4Mem.c
CTA9x4Helper.S | GCC CTA9x4Helper.S | GCC

View File

@ -17,8 +17,8 @@
.text .text
.align 2 .align 2
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
GCC_ASM_EXPORT(ArmPlatformGetCorePosition) GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore) GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
@ -56,4 +56,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
and r0, r0, #ARM_CORE_MASK and r0, r0, #ARM_CORE_MASK
bx lr bx lr
ASM_PFX(ArmPlatformPeiBootAction):
bx lr
ASM_FUNCTION_REMOVE_IF_UNREFERENCED ASM_FUNCTION_REMOVE_IF_UNREFERENCED

View File

@ -18,6 +18,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
EXPORT ArmPlatformGetPrimaryCoreMpId EXPORT ArmPlatformGetPrimaryCoreMpId
EXPORT ArmPlatformGetCorePosition EXPORT ArmPlatformGetCorePosition
@ -62,4 +63,8 @@ ArmPlatformGetCorePosition FUNCTION
bx lr bx lr
ENDFUNC ENDFUNC
ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
END END

View File

@ -16,12 +16,14 @@
#include <Library/ArmLib.h> #include <Library/ArmLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <AutoGen.h> #include <AutoGen.h>
#include "AsmMacroIoLib.inc"
#include <Chipset/ArmCortexA9.h> #include <Chipset/ArmCortexA9.h>
.text .text
.align 2 .align 2
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
@ -30,6 +32,9 @@ GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore) GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask) GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
ASM_PFX(ArmPlatformPeiBootAction):
bx lr
# IN None # IN None
# OUT r0 = SCU Base Address # OUT r0 = SCU Base Address
ASM_PFX(ArmGetScuBaseAddress): ASM_PFX(ArmGetScuBaseAddress):

View File

@ -22,6 +22,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmGetCpuCountPerCluster EXPORT ArmGetCpuCountPerCluster
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
EXPORT ArmPlatformGetPrimaryCoreMpId EXPORT ArmPlatformGetPrimaryCoreMpId
@ -32,6 +33,10 @@
AREA RTSMHelper, CODE, READONLY AREA RTSMHelper, CODE, READONLY
ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
// IN None // IN None
// OUT r0 = SCU Base Address // OUT r0 = SCU Base Address
ArmGetScuBaseAddress FUNCTION ArmGetScuBaseAddress FUNCTION

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2012, ARM Limited. All rights reserved. // Copyright (c) 2012-2013, 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
@ -15,8 +15,9 @@
#include <Library/ArmLib.h> #include <Library/ArmLib.h>
.text .text
.align 3 .align 2
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(ArmPlatformGetCorePosition) GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
@ -24,6 +25,9 @@ GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore) GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask) GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
ASM_PFX(ArmPlatformPeiBootAction):
bx lr
//UINTN //UINTN
//ArmPlatformGetCorePosition ( //ArmPlatformGetCorePosition (
// IN UINTN MpId // IN UINTN MpId

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2012, ARM Limited. All rights reserved. // Copyright (c) 2012-2013, 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
@ -16,6 +16,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmPlatformGetCorePosition EXPORT ArmPlatformGetCorePosition
EXPORT ArmPlatformGetPrimaryCoreMpId EXPORT ArmPlatformGetPrimaryCoreMpId
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
@ -26,6 +27,10 @@
PRESERVE8 PRESERVE8
AREA ArmPlatformNullHelper, CODE, READONLY AREA ArmPlatformNullHelper, CODE, READONLY
ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
//UINTN //UINTN
//ArmPlatformGetCorePosition ( //ArmPlatformGetCorePosition (
// IN UINTN MpId // IN UINTN MpId

View File

@ -23,11 +23,15 @@ GCC_ASM_IMPORT(CEntryPoint)
GCC_ASM_IMPORT(ArmPlatformGetCorePosition) GCC_ASM_IMPORT(ArmPlatformGetCorePosition)
GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_IMPORT(ArmReadMpidr) GCC_ASM_IMPORT(ArmReadMpidr)
GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
GCC_ASM_EXPORT(_ModuleEntryPoint) GCC_ASM_EXPORT(_ModuleEntryPoint)
StartupAddr: .word CEntryPoint StartupAddr: .word CEntryPoint
ASM_PFX(_ModuleEntryPoint): ASM_PFX(_ModuleEntryPoint):
// Do early platform specific actions
bl ASM_PFX(ArmPlatformPeiBootAction)
// Identify CPU ID // Identify CPU ID
bl ASM_PFX(ArmReadMpidr) bl ASM_PFX(ArmReadMpidr)
// Keep a copy of the MpId register value // Keep a copy of the MpId register value

View File

@ -22,6 +22,7 @@
IMPORT ArmPlatformGetCorePosition IMPORT ArmPlatformGetCorePosition
IMPORT ArmPlatformIsPrimaryCore IMPORT ArmPlatformIsPrimaryCore
IMPORT ArmReadMpidr IMPORT ArmReadMpidr
IMPORT ArmPlatformPeiBootAction
EXPORT _ModuleEntryPoint EXPORT _ModuleEntryPoint
PRESERVE8 PRESERVE8
@ -30,6 +31,9 @@
StartupAddr DCD CEntryPoint StartupAddr DCD CEntryPoint
_ModuleEntryPoint _ModuleEntryPoint
// Do early platform specific actions
bl ArmPlatformPeiBootAction
// Identify CPU ID // Identify CPU ID
bl ArmReadMpidr bl ArmReadMpidr
// Keep a copy of the MpId register value // Keep a copy of the MpId register value

View File

@ -24,6 +24,7 @@
GCC_ASM_IMPORT(CEntryPoint) GCC_ASM_IMPORT(CEntryPoint)
GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_IMPORT(ArmReadMpidr) GCC_ASM_IMPORT(ArmReadMpidr)
GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
GCC_ASM_IMPORT(ArmPlatformStackSet) GCC_ASM_IMPORT(ArmPlatformStackSet)
GCC_ASM_EXPORT(_ModuleEntryPoint) GCC_ASM_EXPORT(_ModuleEntryPoint)
@ -31,6 +32,9 @@ StartupAddr: .word CEntryPoint
ASM_PFX(_ModuleEntryPoint): ASM_PFX(_ModuleEntryPoint):
// Do early platform specific actions
bl ASM_PFX(ArmPlatformPeiBootAction)
// Get ID of this CPU in Multicore system // Get ID of this CPU in Multicore system
bl ASM_PFX(ArmReadMpidr) bl ASM_PFX(ArmReadMpidr)
// Keep a copy of the MpId register value // Keep a copy of the MpId register value

View File

@ -23,6 +23,7 @@
IMPORT CEntryPoint IMPORT CEntryPoint
IMPORT ArmPlatformIsPrimaryCore IMPORT ArmPlatformIsPrimaryCore
IMPORT ArmReadMpidr IMPORT ArmReadMpidr
IMPORT ArmPlatformPeiBootAction
IMPORT ArmPlatformStackSet IMPORT ArmPlatformStackSet
EXPORT _ModuleEntryPoint EXPORT _ModuleEntryPoint
@ -33,6 +34,9 @@
StartupAddr DCD CEntryPoint StartupAddr DCD CEntryPoint
_ModuleEntryPoint _ModuleEntryPoint
// Do early platform specific actions
bl ArmPlatformPeiBootAction
// Get ID of this CPU in Multicore system // Get ID of this CPU in Multicore system
bl ArmReadMpidr bl ArmReadMpidr
// Keep a copy of the MpId register value // Keep a copy of the MpId register value

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2012, ARM Limited. All rights reserved. # Copyright (c) 2012-2013, 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
@ -18,6 +18,7 @@
.align 2 .align 2
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
//UINTN //UINTN
//ArmPlatformIsPrimaryCore ( //ArmPlatformIsPrimaryCore (
@ -28,4 +29,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
mov r0, #1 mov r0, #1
bx lr bx lr
ASM_PFX(ArmPlatformPeiBootAction):
bx lr
ASM_FUNCTION_REMOVE_IF_UNREFERENCED ASM_FUNCTION_REMOVE_IF_UNREFERENCED

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2012, ARM Limited. All rights reserved. // Copyright (c) 2012-2013, 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
@ -18,6 +18,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformPeiBootAction
EXPORT ArmPlatformIsPrimaryCore EXPORT ArmPlatformIsPrimaryCore
AREA BeagleBoardHelper, CODE, READONLY AREA BeagleBoardHelper, CODE, READONLY
@ -32,5 +33,8 @@ ArmPlatformIsPrimaryCore FUNCTION
bx lr bx lr
ENDFUNC ENDFUNC
END ArmPlatformPeiBootAction FUNCTION
bx lr
ENDFUNC
END

View File

@ -1,5 +1,5 @@
#/* @file #/* @file
# Copyright (c) 2011-2012, ARM Limited. All rights reserved. # Copyright (c) 2011-2013, 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
@ -31,10 +31,11 @@
[LibraryClasses] [LibraryClasses]
IoLib IoLib
ArmLib ArmLib
# OmapLib
MemoryAllocationLib MemoryAllocationLib
[Sources.common] [Sources.common]
BeagleBoardHelper.asm | RVCT
BeagleBoardHelper.S | GCC
BeagleBoard.c BeagleBoard.c
BeagleBoardMem.c BeagleBoardMem.c
PadConfiguration.c PadConfiguration.c
@ -42,8 +43,6 @@
BeagleBoardHelper.S | GCC BeagleBoardHelper.S | GCC
BeagleBoardHelper.asm | RVCT BeagleBoardHelper.asm | RVCT
[Protocols]
[FeaturePcd] [FeaturePcd]
gEmbeddedTokenSpaceGuid.PcdCacheEnable gEmbeddedTokenSpaceGuid.PcdCacheEnable