]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ARM Packages: Replaced the macro GetCorePositionFromMpId() by the ArmPlatformGetCoreP...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 10 May 2013 12:46:11 +0000 (12:46 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 10 May 2013 12:46:11 +0000 (12:46 +0000)
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@14346 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Include/AsmMacroIoLib.h
ArmPkg/Include/AsmMacroIoLib.inc
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.S
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.asm
ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S
ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm
ArmPlatformPkg/Sec/Arm/SecEntryPoint.S
ArmPlatformPkg/Sec/Arm/SecEntryPoint.asm

index c5073297417568a7ced154547a70fbb4cf31ffc0..dac2e150cc88bc468ab3a560abfa10f9b6769ae2 100644 (file)
   .long (_Data)           ;                 \\r
 1:\r
 \r
-// Convert the (ClusterId,CoreId) into a Core Position\r
-// We assume there are 4 cores per cluster\r
-// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK\r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)  \\r
-  ldr   Tmp, =0xFFFF                             \\r
-  and   MpId, Tmp                                \\r
-  lsr   Pos, MpId, #6 ;                          \\r
-  and   Tmp, MpId, #3 ;                          \\r
-  add   Pos, Pos, Tmp\r
-\r
 // Reserve a region at the top of the Primary Core stack\r
 // for Global variables for the XIP phase\r
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \\r
@@ -211,16 +201,6 @@ _InitializePrimaryStackEnd:
 #define LoadConstantToReg(Data, Reg) \\r
   ldr  Reg, =Data\r
 \r
-// Convert the (ClusterId,CoreId) into a Core Position\r
-// We assume there are 4 cores per cluster\r
-// Note: 0xFFFF is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK\r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)    \\r
-  ldr   Tmp, =0xFFFF ;                             \\r
-  and   MpId, Tmp ;                                \\r
-  lsr   Pos, MpId, #6 ;                            \\r
-  and   Tmp, MpId, #3 ;                            \\r
-  add   Pos, Pos, Tmp\r
-\r
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \\r
   and     Tmp, GlobalSize, #7         ;             \\r
   rsbne   Tmp, Tmp, #8                ;             \\r
@@ -313,8 +293,6 @@ _InitializePrimaryStackEnd:
 // conditional load testing eq flag\r
 #define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg\r
 \r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)  GetCorePositionFromMpId Pos, MpId, Tmp\r
-\r
 #define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp\r
 \r
 // Initialize the Global Variable with '0'\r
index 5796adcb12970fad235326ad42a0d86c0a224b90..54c32d4c34f949fb6cd4013bcf5325327cbfa239 100644 (file)
   ldr  $Reg, =($Data) \r
   MEND \r
   \r
-  MACRO\r
-  GetCorePositionFromMpId $Pos, $MpId, $Tmp\r
-  ;Note: The ARM macro does not support the pre-processing. 0xFF and (0xFF << 8) are the values of\r
-  ;      ARM_CORE_MASK and ARM_CLUSTER_MASK \r
-  mov   $Tmp, #(0xFF :OR: (0xFF << 8))\r
-  and   $MpId, $Tmp\r
-  lsr   $Pos, $MpId, #6\r
-  and   $Tmp, $MpId, #3\r
-  add   $Pos, $Pos, $Tmp\r
-  MEND\r
-  \r
   ; The reserved place must be 8-bytes aligned for pushing 64-bit variable on the stack\r
   ; Note: Global Size will be modified\r
   MACRO\r
index 3fbc701dadb78615701cedac392217ddd31f1a20..fc7312b6f1809a28c7a6e7efc2b111d8e4bcd73d 100644 (file)
 #\r
 \r
 #include <AsmMacroIoLib.h>\r
+#include <Library/ArmLib.h>\r
 \r
 .text\r
 .align 2\r
 \r
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
 \r
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
@@ -46,4 +48,12 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
   movne r0, #0\r
   bx    lr\r
 \r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+//  IN UINTN MpId\r
+//  );\r
+ASM_PFX(ArmPlatformGetCorePosition):\r
+  and   r0, r0, #ARM_CORE_MASK\r
+  bx    lr\r
+\r
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
index 246ea554d8e9c079153eb136b4d7bb1e53201463..c2db346723a778b311edcb533408bfcd438afac1 100644 (file)
@@ -12,6 +12,7 @@
 //\r
 \r
 #include <AsmMacroIoLib.h>\r
+#include <Library/ArmLib.h>\r
 \r
 #include <AutoGen.h>\r
 \r
@@ -19,6 +20,7 @@
 \r
   EXPORT  ArmPlatformIsPrimaryCore\r
   EXPORT  ArmPlatformGetPrimaryCoreMpId\r
+  EXPORT  ArmPlatformGetCorePosition\r
 \r
   IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
   IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask\r
@@ -51,4 +53,13 @@ ArmPlatformIsPrimaryCore FUNCTION
   bx    lr\r
   ENDFUNC\r
 \r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+//  IN UINTN MpId\r
+//  );\r
+ArmPlatformGetCorePosition FUNCTION\r
+  and   r0, r0, #ARM_CORE_MASK\r
+  bx    lr\r
+  ENDFUNC\r
+\r
   END\r
index 847424fb4b9a6e78cd1676b5de9f4e98639122fe..1c256af2412d87b6722aa0b5804bc7c934f8f6ec 100644 (file)
@@ -13,6 +13,7 @@
 \r
 #include <AsmMacroIoLib.h>\r
 #include <Base.h>\r
+#include <Library/ArmLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <AutoGen.h>\r
 \r
@@ -24,6 +25,7 @@
 GCC_ASM_EXPORT(ArmGetCpuCountPerCluster)\r
 GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
 GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
 \r
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
 GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
@@ -96,4 +98,14 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
   movne r0, #0\r
   bx   lr\r
 \r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+//  IN UINTN MpId\r
+//  );\r
+ASM_PFX(ArmPlatformGetCorePosition):\r
+  and   r1, r0, #ARM_CORE_MASK\r
+  and   r0, r0, #ARM_CLUSTER_MASK\r
+  add   r0, r1, r0, LSR #7\r
+  bx    lr\r
+\r
 ASM_FUNCTION_REMOVE_IF_UNREFERENCED \r
index 167762c34e1a47f599bc13181aabf4f15d99d27a..02b9f0f4a7f0aa149a0c93fad63ecdebf0a3f7b0 100644 (file)
@@ -1,5 +1,5 @@
 //\r
-//  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+//  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
 //  \r
 //  This program and the accompanying materials                          \r
 //  are licensed and made available under the terms and conditions of the BSD License         \r
@@ -13,6 +13,7 @@
 \r
 #include <AsmMacroIoLib.h>\r
 #include <Base.h>\r
+#include <Library/ArmLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
 #include <Chipset/ArmCortexA9.h>\r
   EXPORT    ArmGetCpuCountPerCluster\r
   EXPORT    ArmPlatformIsPrimaryCore\r
   EXPORT    ArmPlatformGetPrimaryCoreMpId\r
+  EXPORT    ArmPlatformGetCorePosition\r
 \r
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask\r
+  IMPORT    _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
+  IMPORT    _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask\r
 \r
   AREA RTSMHelper, CODE, READONLY\r
 \r
@@ -103,4 +105,15 @@ ArmPlatformIsPrimaryCore FUNCTION
   bx   lr\r
   ENDFUNC\r
 \r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+//  IN UINTN MpId\r
+//  );\r
+ArmPlatformGetCorePosition FUNCTION\r
+  and   r1, r0, #ARM_CORE_MASK\r
+  and   r0, r0, #ARM_CLUSTER_MASK\r
+  add   r0, r1, r0, LSR #7\r
+  bx    lr\r
+  ENDFUNC\r
+\r
   END\r
index 1fb8570eb397c9399dabe037243de03118f54545..3b463eabee35150985fde70392a9956332ddc60d 100644 (file)
@@ -20,6 +20,7 @@
 .align 3\r
 \r
 GCC_ASM_IMPORT(CEntryPoint)\r
+GCC_ASM_IMPORT(ArmPlatformGetCorePosition)\r
 GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
 GCC_ASM_IMPORT(ArmReadMpidr)\r
 GCC_ASM_EXPORT(_ModuleEntryPoint)\r
@@ -47,8 +48,10 @@ ASM_PFX(_ModuleEntryPoint):
 _SetupSecondaryCoreStack:\r
   // r1 contains the base of the secondary stacks\r
 \r
-  // Get the Core Position (ClusterId * 4) + CoreId\r
-  GetCorePositionFromMpId(r0, r5, r2)\r
+  // Get the Core Position\r
+  mov   r6, r1      // Save base of the secondary stacks\r
+  mov   r0, r5\r
+  bl    ASM_PFX(ArmPlatformGetCorePosition)\r
   // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack\r
   add   r0, r0, #1\r
 \r
@@ -56,7 +59,7 @@ _SetupSecondaryCoreStack:
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)\r
   mul   r0, r0, r2\r
   // SP = StackBase + StackOffset\r
-  add   sp, r1, r0\r
+  add   sp, r6, r0\r
 \r
 _PrepareArguments:\r
   // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector\r
index 3b756b492a565d21f185237954ad2dc1a2828749..1510fb84d03936c0ae28139309a3a064a42e8ded 100644 (file)
@@ -19,6 +19,7 @@
   INCLUDE AsmMacroIoLib.inc\r
   \r
   IMPORT  CEntryPoint\r
+  IMPORT  ArmPlatformGetCorePosition\r
   IMPORT  ArmPlatformIsPrimaryCore\r
   IMPORT  ArmReadMpidr\r
   EXPORT  _ModuleEntryPoint\r
@@ -49,8 +50,10 @@ _ModuleEntryPoint
 _SetupSecondaryCoreStack\r
   // r1 contains the base of the secondary stacks\r
 \r
-  // Get the Core Position (ClusterId * 4) + CoreId\r
-  GetCorePositionFromMpId(r0, r5, r2)\r
+  // Get the Core Position\r
+  mov   r6, r1      // Save base of the secondary stacks\r
+  mov   r0, r5\r
+  bl    ArmPlatformGetCorePosition\r
   // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack\r
   add   r0, r0, #1\r
 \r
@@ -58,7 +61,7 @@ _SetupSecondaryCoreStack
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r2)\r
   mul   r0, r0, r2\r
   // SP = StackBase + StackOffset\r
-  add   sp, r1, r0\r
+  add   sp, r6, r0\r
 \r
 _PrepareArguments\r
   // The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector\r
index 07fb71fdcc95b12d9c02b5bd23bb130e5d474cd8..5096251a74dd91574eff901302ca2f722cad3b5b 100644 (file)
@@ -20,6 +20,7 @@
 \r
 GCC_ASM_IMPORT(CEntryPoint)\r
 GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
+GCC_ASM_IMPORT(ArmPlatformGetCorePosition)\r
 GCC_ASM_IMPORT(ArmPlatformSecBootAction)\r
 GCC_ASM_IMPORT(ArmPlatformSecBootMemoryInit)\r
 GCC_ASM_IMPORT(ArmDisableInterrupts)\r
@@ -91,10 +92,11 @@ _SetupSecondaryCoreStack:
   // Get the top of the primary stacks (and the base of the secondary stacks)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)\r
-  add   r1, r1, r2\r
+  add   r6, r1, r2\r
 \r
-  // Get the Core Position (ClusterId * 4) + CoreId\r
-  GetCorePositionFromMpId(r0, r9, r2)\r
+  // Get the Core Position\r
+  mov   r0, r9\r
+  bl    ASM_PFX(ArmPlatformGetCorePosition)\r
   // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack\r
   add   r0, r0, #1\r
 \r
@@ -102,7 +104,7 @@ _SetupSecondaryCoreStack:
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)\r
   mul   r0, r0, r2\r
   // SP = StackBase + StackOffset\r
-  add   sp, r1, r0\r
+  add   sp, r6, r0\r
 \r
 _PrepareArguments:\r
   // Move sec startup address into a data register\r
index f89aefd2d6ec91c0227d2802f400a414ebf28b86..14f7e9c6631418fd0a18d1559bf84ce1718035d1 100644 (file)
@@ -19,6 +19,7 @@
   \r
   IMPORT  CEntryPoint\r
   IMPORT  ArmPlatformIsPrimaryCore\r
+  IMPORT  ArmPlatformGetCorePosition\r
   IMPORT  ArmPlatformSecBootAction\r
   IMPORT  ArmPlatformSecBootMemoryInit\r
   IMPORT  ArmDisableInterrupts\r
@@ -93,10 +94,11 @@ _SetupSecondaryCoreStack
   // Get the top of the primary stacks (and the base of the secondary stacks)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecPrimaryStackSize), r2)\r
-  add   r1, r1, r2\r
+  add   r6, r1, r2\r
 \r
-  // Get the Core Position (ClusterId * 4) + CoreId\r
-  GetCorePositionFromMpId(r0, r9, r2)\r
+  // Get the Core Position\r
+  mov   r0, r9\r
+  bl    ArmPlatformGetCorePosition\r
   // The stack starts at the top of the stack region. Add '1' to the Core Position to get the top of the stack\r
   add   r0, r0, #1\r
 \r
@@ -104,7 +106,7 @@ _SetupSecondaryCoreStack
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecSecondaryStackSize), r2)\r
   mul   r0, r0, r2\r
   // SP = StackBase + StackOffset\r
-  add   sp, r1, r0\r
+  add   sp, r6, r0\r
 \r
 _PrepareArguments\r
   // Move sec startup address into a data register\r