]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/ModuleEntryPoint.asm
ArmPlatformPkg: Introduction of gArmPlatformTokenSpaceGuid.PcdCoreCount
[mirror_edk2.git] / ArmPlatformPkg / PrePi / ModuleEntryPoint.asm
index e0b622103f8e98d9aad45c5dc7a06090c91ff887..3437818b52a4d4cb4aa03a87cc58f0cdbe9c4a97 100644 (file)
@@ -20,7 +20,8 @@
   \r
   IMPORT  CEntryPoint\r
   IMPORT  ArmReadMpidr\r
-  IMPORT  ArmIsMpCore\r
+  IMPORT  ArmPlatformStackSet\r
+  \r
   EXPORT  _ModuleEntryPoint\r
 \r
   PRESERVE8\r
@@ -107,11 +108,20 @@ _GetStackBaseMpCore
   // r1 = The top of the Mpcore Stacks\r
   // Stack for the primary core = PrimaryCoreStack\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
-  sub   r7, r1, r2\r
-\r
-  // Stack for the secondary core = Number of Cluster * (4 Core per cluster) * SecondaryStackSize\r
-  LoadConstantToReg (FixedPcdGet32(PcdClusterCount), r2)\r
-  lsl   r2, r2, #2\r
+  sub   r8, r1, r2\r
+\r
+  // Stack for the secondary core = Number of Cores - 1\r
+  LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)\r
+  sub  r0, r0, #1\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)\r
+  mul   r1, r1, r0\r
+  sub   r8, r8, r1\r
+\r
+  // r8 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
+  mov  r0, r8\r
+  mov  r1, r6\r
+  //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)\r
   mul   r2, r2, r3\r
   sub   r7, r7, r2\r
@@ -132,7 +142,7 @@ _SetupSecondaryCoreStack
   // r1 = The base of the secondary Stacks\r
 \r
   // Get the position of the cores (ClusterId * 4) + CoreId\r
-  GetCorePositionInStack(r0, r5, r4)\r
+  GetCorePositionFromMpId(r0, r5, r4)\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
   // Get the offset for the Secondary Stack\r