summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCohen, Eugene <eugene@hp.com>2016-03-07 15:16:27 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-03-16 12:19:25 +0100
commitd2bb61a2328d512c0aeb201ab8a5a6497f415afb (patch)
tree3132795e6217e7fa467d1cc41d47710e4a5a2827
parent30ed3422ab2de03abf7c1433ebb482f6e5e16f45 (diff)
downloadedk2-platforms-d2bb61a2328d512c0aeb201ab8a5a6497f415afb.tar.xz
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>
-rw-r--r--ArmPkg/Include/Chipset/AArch64.h5
-rw-r--r--ArmPkg/Library/ArmLib/AArch64/AArch64Support.S6
2 files changed, 11 insertions, 0 deletions
diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h
index e53605f641..aa6a7e0a00 100644
--- a/ArmPkg/Include/Chipset/AArch64.h
+++ b/ArmPkg/Include/Chipset/AArch64.h
@@ -204,6 +204,11 @@ ArmWriteHcr (
);
UINTN
+ArmReadHcr (
+ VOID
+ );
+
+UINTN
ArmReadCurrentEL (
VOID
);
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
index db21f73f0e..1a3023b794 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
@@ -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