summaryrefslogtreecommitdiff
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-08-10 16:03:42 +0200
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-08-11 13:25:04 +0200
commita0f56915a02c95f04782df2c3b0285b08cd88ffa (patch)
treedd850b76c62f6baae5dfa6b2ef56075919268b4a /ArmPlatformPkg
parentb8f76eaec25e1eaaad805164b09d92231f3765e8 (diff)
downloadedk2-a0f56915a02c95f04782df2c3b0285b08cd88ffa.zip
edk2-a0f56915a02c95f04782df2c3b0285b08cd88ffa.tar.gz
edk2-a0f56915a02c95f04782df2c3b0285b08cd88ffa.tar.bz2
ArmPlatformPkg/ArmJunoLib: switch to ASM_FUNC() asm macro
Annotate functions with ASM_FUNC() so that they are emitted into separate sections. While we're at it, replace some inefficient uses of LoadConstantToReg() Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S37
-rw-r--r--ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S36
2 files changed, 21 insertions, 52 deletions
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
index 73b249c..4bdf08d 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
+++ b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/AArch64/ArmJunoHelper.S
@@ -15,25 +15,12 @@
#include <AsmMacroIoLibV8.h>
#include <Library/ArmLib.h>
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-
-PrimaryCoreMpid: .word 0x0
-
//UINTN
//ArmPlatformGetCorePosition (
// IN UINTN MpId
// );
// With this function: CorePos = (ClusterId * 2) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
+ASM_FUNC(ArmPlatformGetCorePosition)
and x1, x0, #ARM_CORE_MASK
and x0, x0, #ARM_CLUSTER_MASK
add x0, x1, x0, LSR #7
@@ -43,33 +30,29 @@ ASM_PFX(ArmPlatformGetCorePosition):
//ArmPlatformGetPrimaryCoreMpId (
// VOID
// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- ldr x0, =PrimaryCoreMpid
- ldrh w0, [x0]
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+ ldr w0, PrimaryCoreMpid
ret
//UINTN
//ArmPlatformIsPrimaryCore (
// IN UINTN MpId
// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1)
- ldrh w1, [x1]
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+ MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCoreMask))
and x0, x0, x1
- ldr x1, =PrimaryCoreMpid
- ldrh w1, [x1]
+ ldr w1, PrimaryCoreMpid
cmp w0, w1
- mov x0, #1
- mov x1, #0
- csel x0, x0, x1, eq
+ cset x0, eq
ret
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
// The trusted firmware passes the primary CPU MPID through x0 register.
// Save it in a variable.
- ldr x1, =PrimaryCoreMpid
+ adr x1, PrimaryCoreMpid
str w0, [x1]
ret
+PrimaryCoreMpid: .word 0x0
diff --git a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
index 2efb545..a7e904e 100644
--- a/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
+++ b/ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/Arm/ArmJunoHelper.S
@@ -12,22 +12,9 @@
*
**/
-#include <AsmMacroIoLibV8.h>
+#include <AsmMacroIoLib.h>
#include <Library/ArmLib.h>
-.text
-.align 3
-
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
-
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
-
-
-PrimaryCoreMpid: .word 0x0
-
//
// Return the core position from the value of its MpId register
//
@@ -41,7 +28,7 @@ PrimaryCoreMpid: .word 0x0
// IN UINTN MpId
// );
// With this function: CorePos = (ClusterId * 2) + CoreId
-ASM_PFX(ArmPlatformGetCorePosition):
+ASM_FUNC(ArmPlatformGetCorePosition)
and r1, r0, #ARM_CORE_MASK
and r0, r0, #ARM_CLUSTER_MASK
add r0, r1, r0, LSR #7
@@ -59,9 +46,8 @@ ASM_PFX(ArmPlatformGetCorePosition):
//ArmPlatformGetPrimaryCoreMpId (
// VOID
// );
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
- ldr r0, =PrimaryCoreMpid
- ldr r0, [r0]
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)
+ LDRL (r0, PrimaryCoreMpid)
bx lr
//
@@ -77,13 +63,11 @@ ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
//ArmPlatformIsPrimaryCore (
// IN UINTN MpId
// );
-ASM_PFX(ArmPlatformIsPrimaryCore):
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, r1)
- ldr r1, [r1]
+ASM_FUNC(ArmPlatformIsPrimaryCore)
+ MOV32 (r1, FixedPcdGet32 (PcdArmPrimaryCoreMask))
and r0, r0, r1
- ldr r1, =PrimaryCoreMpid
- ldr r1, [r1]
+ LDRL (r1, PrimaryCoreMpid)
cmp r0, r1
moveq r0, #1
@@ -97,9 +81,11 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
// or PrePeiCore modules. It allows to retrieve arguments passed to
// the UEFI firmware through the CPU registers.
//
-ASM_PFX(ArmPlatformPeiBootAction):
+ASM_FUNC(ArmPlatformPeiBootAction)
// The trusted firmware passes the primary CPU MPID through r0 register.
// Save it in a variable.
- ldr r1, =PrimaryCoreMpid
+ adr r1, PrimaryCoreMpid
str r0, [r1]
bx lr
+
+PrimaryCoreMpid: .word 0x0