ArmPkg/ArmLib: add ArmReadHcr to enable read-modify-write of HCR

Add ArmReadHcr() to ArmLib to enable read-modify-write of the HCR system
register.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Cohen, Eugene 2016-03-07 15:16:27 +00:00 committed by Ard Biesheuvel
parent 30ed3422ab
commit d2bb61a232
2 changed files with 11 additions and 0 deletions

View File

@ -203,6 +203,11 @@ ArmWriteHcr (
IN UINTN Hcr
);
UINTN
ArmReadHcr (
VOID
);
UINTN
ArmReadCurrentEL (
VOID

View File

@ -54,6 +54,7 @@ GCC_ASM_EXPORT (ArmIsArchTimerImplemented)
GCC_ASM_EXPORT (ArmReadIdPfr0)
GCC_ASM_EXPORT (ArmReadIdPfr1)
GCC_ASM_EXPORT (ArmWriteHcr)
GCC_ASM_EXPORT (ArmReadHcr)
GCC_ASM_EXPORT (ArmReadCurrentEL)
.set CTRL_M_BIT, (1 << 0)
@ -470,6 +471,11 @@ ASM_PFX(ArmWriteHcr):
msr hcr_el2, x0 // Write the passed HCR value
ret
// UINTN ArmReadHcr(VOID)
ASM_PFX(ArmReadHcr):
mrs x0, hcr_el2
ret
// UINTN ArmReadCurrentEL(VOID)
ASM_PFX(ArmReadCurrentEL):
mrs x0, CurrentEL