From 695df8ba90dc01b6a4cd7d79e6d1a40e517186a6 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Fri, 28 Sep 2012 10:43:28 +0000 Subject: ArmPlatformPkg: Introduction of gArmPlatformTokenSpaceGuid.PcdCoreCount On ARM PLatforms, there is no standard way to know how many cores are available on the platform. This PCD is expected to contain this number. Signed-off-by: Olivier Martin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13769 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/PrePi/ModuleEntryPoint.asm | 22 ++++++++++++++++------ ArmPlatformPkg/PrePi/PeiMPCore.inf | 1 + ArmPlatformPkg/PrePi/PeiUniCore.inf | 1 + ArmPlatformPkg/PrePi/PrePi.c | 2 ++ 4 files changed, 20 insertions(+), 6 deletions(-) (limited to 'ArmPlatformPkg/PrePi') diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm b/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm index 0c7299a99..3437818b5 100644 --- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm +++ b/ArmPlatformPkg/PrePi/ModuleEntryPoint.asm @@ -20,7 +20,8 @@ IMPORT CEntryPoint IMPORT ArmReadMpidr - IMPORT ArmIsMpCore + IMPORT ArmPlatformStackSet + EXPORT _ModuleEntryPoint PRESERVE8 @@ -107,11 +108,20 @@ _GetStackBaseMpCore // r1 = The top of the Mpcore Stacks // Stack for the primary core = PrimaryCoreStack LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) - sub r7, r1, r2 - - // Stack for the secondary core = Number of Clusters * (4 Cores per cluster) * SecondaryStackSize - LoadConstantToReg (FixedPcdGet32(PcdClusterCount), r2) - lsl r2, r2, #2 + sub r8, r1, r2 + + // Stack for the secondary core = Number of Cores - 1 + LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0) + sub r0, r0, #1 + LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1) + mul r1, r1, r0 + sub r8, r8, r1 + + // r8 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov r0, r8 + mov r1, r6 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3) mul r2, r2, r3 sub r7, r7, r2 diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiMPCore.inf index cd61b7a2f..1d27f9c94 100755 --- a/ArmPlatformPkg/PrePi/PeiMPCore.inf +++ b/ArmPlatformPkg/PrePi/PeiMPCore.inf @@ -91,6 +91,7 @@ gArmTokenSpaceGuid.PcdSystemMemorySize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + gArmPlatformTokenSpaceGuid.PcdCoreCount gArmPlatformTokenSpaceGuid.PcdClusterCount gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.inf index f28768ecf..304461c3e 100755 --- a/ArmPlatformPkg/PrePi/PeiUniCore.inf +++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf @@ -85,6 +85,7 @@ gArmTokenSpaceGuid.PcdSystemMemorySize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + gArmPlatformTokenSpaceGuid.PcdCoreCount gArmPlatformTokenSpaceGuid.PcdClusterCount gArmTokenSpaceGuid.PcdArmPrimaryCoreMask gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index c3fca90ca..bdeb60d84 100755 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -212,6 +212,8 @@ CEntryPoint ( { UINT64 StartTimeStamp; + ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1)); + // Initialize the platform specific controllers ArmPlatformInitialize (MpId); -- cgit v1.2.3