mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
b8f76eaec2
commit
a0f56915a0
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue