diff options
author | Olivier Martin <olivier.martin@arm.com> | 2013-12-06 16:12:24 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-12-06 16:12:24 +0000 |
commit | 8a25bd7c54f6d65472450d328706736050dc8281 (patch) | |
tree | 44861544e34a19a79e2b057a3af2cda5a6c5fc96 /ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm | |
parent | 99267097f393fdfd71d5c9c56824f3fb771e46a7 (diff) | |
download | edk2-8a25bd7c54f6d65472450d328706736050dc8281.zip edk2-8a25bd7c54f6d65472450d328706736050dc8281.tar.gz edk2-8a25bd7c54f6d65472450d328706736050dc8281.tar.bz2 |
ArmPlatformPkg/ArmPlatformStackLib: Do not directly use PcdArmPrimaryCore
To make the code platform independent we should not use PcdArmPrimaryCore
in libraries other than the platform specific libraries.
Some platforms allow to change the primary core with external registers.
These platforms do not use PcdArmPrimaryCore to identify the primary CPU.
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@14938 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm')
-rw-r--r-- | ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm index db92023..e7fd4a0 100644 --- a/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm +++ b/ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.asm @@ -1,5 +1,5 @@ //
-// Copyright (c) 2012, ARM Limited. All rights reserved.
+// Copyright (c) 2012-2013, ARM Limited. All rights reserved.
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
@@ -21,10 +21,11 @@ EXPORT ArmPlatformStackSetPrimary
EXPORT ArmPlatformStackSetSecondary
+ IMPORT ArmPlatformIsPrimaryCore
IMPORT ArmPlatformGetCorePosition
+ IMPORT ArmPlatformGetPrimaryCoreMpId
IMPORT _gPcd_FixedAtBuild_PcdCoreCount
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore
PRESERVE8
AREA ArmPlatformStackLib, CODE, READONLY
@@ -37,14 +38,29 @@ // IN UINTN SecondaryStackSize
// );
ArmPlatformStackSet FUNCTION
+ // Save parameters
+ mov r6, r3
+ mov r5, r2
+ mov r4, r1
+ mov r3, r0
+
+ // Save the Link register
+ mov r7, lr
+
// Identify Stack
- // Mask for ClusterId|CoreId
- LoadConstantToReg (0xFFFF, r4)
- and r1, r1, r4
- // Is it the Primary Core ?
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r4)
- ldr r4, [r4]
- cmp r1, r4
+ mov r0, r1
+ bl ArmPlatformIsPrimaryCore
+ cmp r0, #1
+
+ // Restore parameters
+ mov r0, r3
+ mov r1, r4
+ mov r2, r5
+ mov r3, r6
+
+ // Restore the Link register
+ mov lr, r7
+
beq ArmPlatformStackSetPrimary
bne ArmPlatformStackSetSecondary
ENDFUNC
@@ -91,8 +107,7 @@ ArmPlatformStackSetSecondary FUNCTION mov r5, r0
// Get Primary Core Position
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
- ldr r0, [r0]
+ bl ArmPlatformGetPrimaryCoreMpId
bl ArmPlatformGetCorePosition
// Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
|