ArmPkg/Library/ArmLib: add ArmWriteSctlr

This currently isn't needed by anything in the edk2 tree but
it's useful for externally maintained platforms which have
to set this register e.g. to disable alignment aborts.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Michael Zimmermann 2018-01-13 07:52:45 +01:00 committed by Ard Biesheuvel
parent 29af38b0f8
commit 1e1d16971d
4 changed files with 22 additions and 0 deletions

View File

@ -558,6 +558,12 @@ ArmReadSctlr (
VOID VOID
); );
VOID
EFIAPI
ArmWriteSctlr (
IN UINT32 Value
);
UINTN UINTN
EFIAPI EFIAPI
ArmReadHVBar ( ArmReadHVBar (

View File

@ -187,4 +187,13 @@ ASM_FUNC(ArmReadSctlr)
3:mrs x0, sctlr_el3 3:mrs x0, sctlr_el3
4:ret 4:ret
ASM_FUNC(ArmWriteSctlr)
EL1_OR_EL2_OR_EL3(x1)
1:msr sctlr_el1, x0
ret
2:msr sctlr_el2, x0
ret
3:msr sctlr_el3, x0
4:ret
ASM_FUNCTION_REMOVE_IF_UNREFERENCED ASM_FUNCTION_REMOVE_IF_UNREFERENCED

View File

@ -153,6 +153,10 @@ ASM_FUNC(ArmReadSctlr)
mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR into R0 (Read control register configuration data) mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR into R0 (Read control register configuration data)
bx lr bx lr
ASM_FUNC(ArmWriteSctlr)
mcr p15, 0, r0, c1, c0, 0
bx lr
ASM_FUNC(ArmReadCpuActlr) ASM_FUNC(ArmReadCpuActlr)
mrc p15, 0, r0, c1, c0, 1 mrc p15, 0, r0, c1, c0, 1
bx lr bx lr

View File

@ -155,6 +155,9 @@
mrc p15, 0, r0, c1, c0, 0 // Read SCTLR into R0 (Read control register configuration data) mrc p15, 0, r0, c1, c0, 0 // Read SCTLR into R0 (Read control register configuration data)
bx lr bx lr
RVCT_ASM_EXPORT ArmWriteSctlr
mcr p15, 0, r0, c1, c0, 0
bx lr
RVCT_ASM_EXPORT ArmReadCpuActlr RVCT_ASM_EXPORT ArmReadCpuActlr
mrc p15, 0, r0, c1, c0, 1 mrc p15, 0, r0, c1, c0, 1