mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg: Fix and Implement ArmPlatformGetPrimaryCoreMpId
- Used correct PCD - Implement the function for AArch64, BeagleBoard, CTA15A7 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14937 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d5ad0813ac
commit
99267097f3
|
@ -22,6 +22,7 @@
|
|||
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
|
||||
ASM_PFX(ArmPlatformPeiBootAction):
|
||||
bx lr
|
||||
|
@ -66,3 +67,23 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
|
|||
movne r0, #0
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
// Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
|
||||
// with cpu_id[0:3] and cluster_id[4:7]
|
||||
LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)
|
||||
ldr r0, [r0]
|
||||
lsr r0, #24
|
||||
|
||||
// Shift the SCC value to get the cluster ID at the offset #8
|
||||
lsl r1, r0, #4
|
||||
and r1, r1, #0xF00
|
||||
|
||||
// Keep only the cpu ID from the original SCC
|
||||
and r0, r0, #0x0F
|
||||
// Add the Cluster ID to the Cpu ID
|
||||
orr r0, r0, r1
|
||||
bx lr
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
EXPORT ArmPlatformPeiBootAction
|
||||
EXPORT ArmPlatformGetCorePosition
|
||||
EXPORT ArmPlatformIsPrimaryCore
|
||||
EXPORT ArmPlatformGetPrimaryCoreMpId
|
||||
|
||||
PRESERVE8
|
||||
AREA CTA15A7Helper, CODE, READONLY
|
||||
|
@ -71,4 +72,26 @@ ArmPlatformIsPrimaryCore FUNCTION
|
|||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
// Extract cpu_id and cluster_id from ARM_SCC_CFGREG48
|
||||
// with cpu_id[0:3] and cluster_id[4:7]
|
||||
LoadConstantToReg (ARM_CTA15A7_SCC_CFGREG48, r0)
|
||||
ldr r0, [r0]
|
||||
lsr r0, #24
|
||||
|
||||
// Shift the SCC value to get the cluster ID at the offset #8
|
||||
lsl r1, r0, #4
|
||||
and r1, r1, #0xF00
|
||||
|
||||
// Keep only the cpu ID from the original SCC
|
||||
and r0, r0, #0x0F
|
||||
// Add the Cluster ID to the Cpu ID
|
||||
orr r0, r0, r1
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
END
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
|
||||
|
||||
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
|
||||
|
@ -29,7 +30,7 @@ GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
|
|||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
|
||||
GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)
|
||||
|
||||
|
@ -32,6 +33,15 @@ GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
|
|||
ASM_PFX(ArmPlatformPeiBootAction):
|
||||
ret
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
|
||||
ldrh w0, [x0]
|
||||
ret
|
||||
|
||||
# IN None
|
||||
# OUT x0 = number of cores present in the system
|
||||
ASM_PFX(ArmGetCpuCountPerCluster):
|
||||
|
|
|
@ -49,7 +49,7 @@ ASM_PFX(ArmGetScuBaseAddress):
|
|||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ArmGetScuBaseAddress FUNCTION
|
|||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
|
|
@ -43,7 +43,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
|
|||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ ArmPlatformGetCorePosition FUNCTION
|
|||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0)
|
||||
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
||||
ldr r0, [r0]
|
||||
bx lr
|
||||
ENDFUNC
|
||||
|
|
|
@ -18,8 +18,11 @@
|
|||
.align 2
|
||||
|
||||
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
||||
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
||||
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
|
||||
|
||||
GCC_ASM_IMPORT(ArmReadMpidr)
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformIsPrimaryCore (
|
||||
// IN UINTN MpId
|
||||
|
@ -32,4 +35,13 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
|
|||
ASM_PFX(ArmPlatformPeiBootAction):
|
||||
bx lr
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
||||
// The BeagleBoard is a uniprocessor platform. The MPIDR of primary core is
|
||||
// always the MPIDR of the calling CPU.
|
||||
b ASM_PFX(ArmReadMpidr)
|
||||
|
||||
ASM_FUNCTION_REMOVE_IF_UNREFERENCED
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
EXPORT ArmPlatformPeiBootAction
|
||||
EXPORT ArmPlatformIsPrimaryCore
|
||||
EXPORT ArmPlatformGetPrimaryCoreMpId
|
||||
|
||||
IMPORT ArmReadMpidr
|
||||
|
||||
AREA BeagleBoardHelper, CODE, READONLY
|
||||
|
||||
|
@ -37,4 +40,14 @@ ArmPlatformPeiBootAction FUNCTION
|
|||
bx lr
|
||||
ENDFUNC
|
||||
|
||||
//UINTN
|
||||
//ArmPlatformGetPrimaryCoreMpId (
|
||||
// VOID
|
||||
// );
|
||||
ArmPlatformGetPrimaryCoreMpId FUNCTION
|
||||
// The BeagleBoard is a uniprocessor platform. The MPIDR of primary core is
|
||||
// always the MPIDR of the calling CPU.
|
||||
b ArmReadMpidr
|
||||
ENDFUNC
|
||||
|
||||
END
|
||||
|
|
Loading…
Reference in New Issue