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
This commit is contained in:
oliviermartin 2011-09-22 23:02:13 +00:00
parent 0787bc6184
commit 44e272fd6a
7 changed files with 82 additions and 8 deletions

View File

@ -20,8 +20,21 @@
.text .text
.align 3 .align 3
GCC_ASM_EXPORT(ArmPlatformSecBootAction)
GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) 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 Initialize the memory where the initial stacks will reside

View File

@ -19,11 +19,24 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformSecBootAction
EXPORT ArmPlatformInitializeBootMemory EXPORT ArmPlatformInitializeBootMemory
PRESERVE8 PRESERVE8
AREA CTA9x4BootMode, CODE, READONLY 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 Initialize the memory where the initial stacks will reside

View File

@ -21,6 +21,7 @@
.text .text
.align 3 .align 3
GCC_ASM_EXPORT(ArmPlatformSecBootAction)
GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory)
GCC_ASM_IMPORT(PL35xSmcInitialize) 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 .word PL350_SMC_SET_OPMODE_MEM_WIDTH_32 | PL350_SMC_SET_OPMODE_SET_RD_SYNC | PL350_SMC_SET_OPMODE_SET_WR_SYNC
VersatileExpressSmcConfigurationEnd: 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 Initialize the memory where the initial stacks will reside

View File

@ -20,6 +20,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
EXPORT ArmPlatformSecBootAction
EXPORT ArmPlatformInitializeBootMemory EXPORT ArmPlatformInitializeBootMemory
IMPORT PL35xSmcInitialize 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 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 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 Initialize the memory where the initial stacks will reside

View File

@ -82,6 +82,20 @@ ArmPlatformGetBootMode (
VOID 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 Initialize controllers that must setup at the early stage

View File

@ -30,6 +30,7 @@ GCC_ASM_EXPORT(_ModuleEntryPoint)
#global functions referenced by this module #global functions referenced by this module
GCC_ASM_IMPORT(CEntryPoint) GCC_ASM_IMPORT(CEntryPoint)
GCC_ASM_IMPORT(ArmPlatformSecBootAction)
GCC_ASM_IMPORT(ArmPlatformIsMemoryInitialized) GCC_ASM_IMPORT(ArmPlatformIsMemoryInitialized)
GCC_ASM_IMPORT(ArmPlatformInitializeBootMemory) GCC_ASM_IMPORT(ArmPlatformInitializeBootMemory)
GCC_ASM_IMPORT(ArmDisableInterrupts) GCC_ASM_IMPORT(ArmDisableInterrupts)
@ -46,16 +47,19 @@ StartupAddr: .word ASM_PFX(CEntryPoint)
SecVectorTableAddr: .word ASM_PFX(SecVectorTable) SecVectorTableAddr: .word ASM_PFX(SecVectorTable)
ASM_PFX(_ModuleEntryPoint): 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 # First ensure all interrupts are disabled
bl ASM_PFX(ArmDisableInterrupts) bl ASM_PFX(ArmDisableInterrupts)
# Ensure that the MMU and caches are off # Ensure that the MMU and caches are off
bl ASM_PFX(ArmDisableCachesAndMmu) 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: _IdentifyCpu:
# Identify CPU ID # Identify CPU ID
bl ASM_PFX(ArmReadMpidr) bl ASM_PFX(ArmReadMpidr)

View File

@ -20,6 +20,7 @@
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
IMPORT CEntryPoint IMPORT CEntryPoint
IMPORT ArmPlatformSecBootAction
IMPORT ArmPlatformIsMemoryInitialized IMPORT ArmPlatformIsMemoryInitialized
IMPORT ArmPlatformInitializeBootMemory IMPORT ArmPlatformInitializeBootMemory
IMPORT ArmDisableInterrupts IMPORT ArmDisableInterrupts
@ -39,16 +40,19 @@
StartupAddr DCD CEntryPoint StartupAddr DCD CEntryPoint
_ModuleEntryPoint _ModuleEntryPoint
//Set VBAR to the start of the exception vectors in Secure Mode
ldr r0, =SecVectorTable
blx ArmWriteVBar
// First ensure all interrupts are disabled // First ensure all interrupts are disabled
blx ArmDisableInterrupts blx ArmDisableInterrupts
// Ensure that the MMU and caches are off // Ensure that the MMU and caches are off
blx ArmDisableCachesAndMmu 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 _IdentifyCpu
// Identify CPU ID // Identify CPU ID
bl ArmReadMpidr bl ArmReadMpidr