mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/ArmPlatformLib: Added ArmPlatformGetPrimaryCoreMpId()
ArmPlatformGetPrimaryCoreMpId returns the MPID of the primary core. The primary core might not be known at build time (eg: the platform allows the boot CPU to be changed through board config). This function is used during the secondary core stack initialization to know the position of the secondary core in the SoC. A secondary core that is at the position N, with N greater than the primary core position, will be at the position N-1 in the list of secondary stacks (the primary core has its own separate bigger stack). 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@14345 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
bebda7ceec
commit
d05ca26cb8
|
@ -17,10 +17,20 @@
|
|||
.align 2
|
||||
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformIsPrimaryCore (
|
||||
// IN UINTN MpId
|
||||
|
|
|
@ -18,12 +18,23 @@
|
|||
INCLUDE AsmMacroIoLib.inc
|
||||
|
||||
EXPORT ArmPlatformIsPrimaryCore
|
||||
EXPORT ArmPlatformGetPrimaryCoreMpId
|
||||
|
||||
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
|
||||
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
|
||||
|
||||
AREA CTA9x4Helper, CODE, READONLY
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformIsPrimaryCore (
|
||||
// IN UINTN MpId
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
|
||||
|
@ -36,6 +37,15 @@ ASM_PFX(ArmGetScuBaseAddress):
|
|||
mrc p15, 4, r0, c15, c0, 0
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
# IN None
|
||||
# OUT r0 = number of cores present in the system
|
||||
ASM_PFX(ArmGetCpuCountPerCluster):
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
EXPORT ArmGetCpuCountPerCluster
|
||||
EXPORT ArmPlatformIsPrimaryCore
|
||||
EXPORT ArmPlatformGetPrimaryCoreMpId
|
||||
|
||||
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
|
||||
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask
|
||||
|
@ -39,6 +40,16 @@ ArmGetScuBaseAddress FUNCTION
|
|||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
// IN None
|
||||
// OUT r0 = number of cores present in the system
|
||||
ArmGetCpuCountPerCluster FUNCTION
|
||||
|
|
|
@ -69,6 +69,20 @@ ArmPlatformIsPrimaryCore (
|
|||
IN UINTN MpId
|
||||
);
|
||||
|
||||
/**
|
||||
Return the MpId of the primary core
|
||||
|
||||
This function returns the MpId of the primary core.
|
||||
This function might be called from assembler before any stack is set.
|
||||
|
||||
@return Return the MpId of the primary core
|
||||
|
||||
**/
|
||||
UINTN
|
||||
ArmPlatformGetPrimaryCoreMpId (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Return the current Boot Mode
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
.align 3
|
||||
|
||||
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
|
||||
|
@ -33,6 +34,14 @@ ASM_PFX(ArmPlatformGetCorePosition):
|
|||
add r0, r1, r0, LSR #7
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformIsPrimaryCore (
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
INCLUDE AsmMacroIoLib.inc
|
||||
|
||||
EXPORT ArmPlatformGetCorePosition
|
||||
EXPORT ArmPlatformGetPrimaryCoreMpId
|
||||
EXPORT ArmPlatformIsPrimaryCore
|
||||
|
||||
IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
|
||||
|
@ -36,6 +37,16 @@ ArmPlatformGetCorePosition FUNCTION
|
|||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformIsPrimaryCore (
|
||||
// IN UINTN MpId
|
||||
|
|
Loading…
Reference in New Issue