From 99267097f393fdfd71d5c9c56824f3fb771e46a7 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Fri, 6 Dec 2013 16:11:34 +0000 Subject: 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 git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14937 6f19259b-4bc3-4df7-8a09-765794883524 --- .../ArmVExpressLibCTA15-A7/CTA15-A7Helper.S | 21 ++++++++++++++++++++ .../ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm | 23 ++++++++++++++++++++++ .../Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S | 3 ++- .../Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm | 2 +- .../ArmVExpressLibRTSM/AArch64/RTSMHelper.S | 10 ++++++++++ .../Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S | 2 +- .../Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm | 2 +- .../ArmPlatformLibNull/Arm/ArmPlatformHelper.S | 2 +- .../ArmPlatformLibNull/Arm/ArmPlatformHelper.asm | 2 +- 9 files changed, 61 insertions(+), 6 deletions(-) (limited to 'ArmPlatformPkg') diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S index b560f56c51..ac5378a622 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.S @@ -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 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm index ec2093adc9..2e323a1dd2 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA15-A7/CTA15-A7Helper.asm @@ -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 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S index e12b8cd4e9..d419bcfeaf 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S @@ -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 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm index 9508cedd84..e969db8744 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm @@ -33,7 +33,7 @@ // VOID // ); ArmPlatformGetPrimaryCoreMpId FUNCTION - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r0) + LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0) ldr r0, [r0] bx lr ENDFUNC diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S index 50703ec275..b24085cb24 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/AArch64/RTSMHelper.S @@ -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): diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S index 95006c5f25..04651e7eaa 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S @@ -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 diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm index 5befec31ef..bcc56ca56d 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm @@ -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 diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S index 49f3fde667..1fc6b7af5c 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S +++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.S @@ -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 diff --git a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm index 6047ca25c4..5cdf6fa1a6 100644 --- a/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm +++ b/ArmPlatformPkg/Library/ArmPlatformLibNull/Arm/ArmPlatformHelper.asm @@ -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 -- cgit v1.2.3