[coreboot-gerrit] Patch set updated for coreboot: 8830008 arm64: Add conditional read/write from/to EL3 assembly macros.

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Apr 10 15:00:42 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9538

-gerrit

commit 8830008e09a0bf7a4b0a1a2c3bed80115b198bc6
Author: Furquan Shaikh <furquan at google.com>
Date:   Fri Nov 21 15:35:17 2014 -0800

    arm64: Add conditional read/write from/to EL3 assembly macros.
    
    Some registers are available only at EL3. Add conditional read/write functions
    that perform operations only if currently we are in EL3.
    
    BUG=chrome-os-partner:33962
    BRANCH=None
    TEST=Compiles and boots to kernel prompt.
    
    Change-Id: Ic95838d10e18f58867b6b77aee937bdacae50597
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 62a0e324a00248dba92cb3e2ac2f4072d0e4e2a7
    Original-Signed-off-by: Furquan Shaikh <furquan at google.com>
    Original-Change-Id: Ia170d94adb9ecc141ff86e4a3041ddbf9045bc89
    Original-Reviewed-on: https://chromium-review.googlesource.com/231549
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    Original-Tested-by: Furquan Shaikh <furquan at chromium.org>
    Original-Commit-Queue: Furquan Shaikh <furquan at chromium.org>
---
 src/arch/arm64/include/armv8/arch/lib_helpers.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/arch/arm64/include/armv8/arch/lib_helpers.h b/src/arch/arm64/include/armv8/arch/lib_helpers.h
index a804747..422b81a 100644
--- a/src/arch/arm64/include/armv8/arch/lib_helpers.h
+++ b/src/arch/arm64/include/armv8/arch/lib_helpers.h
@@ -214,6 +214,31 @@
 104:
 .endm
 
+/* Macro to read from a register at EL3 only if we are currently at that
+   level. This is required to ensure that we do not attempt to read registers
+   from a level lower than el3. e.g. SCR is available for read only at EL3.
+   IMPORTANT: if EL != EL3, macro silently doesn't perform the read.
+*/
+.macro read_el3 xreg sysreg
+	switch_el \xreg, 402f, 402f, 401f
+401:
+	mrs	\xreg, \sysreg\()_el3
+402:
+.endm
+
+/* Macro to write to a register at EL3 only if we are currently at that
+   level. This is required to ensure that we do not attempt to write to
+   registers from a level lower than el3. e.g. SCR is available to write only at
+   EL3.
+   IMPORTANT: if EL != EL3, macro silently doesn't perform the write.
+*/
+.macro write_el3 sysreg xreg temp
+	switch_el \temp, 402f, 402f, 401f
+401:
+	msr	\sysreg\()_el3, \xreg
+402:
+.endm
+
 #else
 
 #include <stdint.h>



More information about the coreboot-gerrit mailing list