diff --git a/include/lib/cpus/aarch64/cpu_macros.S b/include/lib/cpus/aarch64/cpu_macros.S index 724624c5e..404b7f91b 100644 --- a/include/lib/cpus/aarch64/cpu_macros.S +++ b/include/lib/cpus/aarch64/cpu_macros.S @@ -426,6 +426,23 @@ msr \_reg, x1 .endm +/* + * Clear a bit in a system register. Can clear multiple bits but is limited by + * the way the BIC instrucion encodes them. + * + * see sysreg_bit_set for usage + */ +.macro sysreg_bit_clear _reg:req, _bit:req + mrs x1, \_reg + bic x1, x1, #\_bit + msr \_reg, x1 +.endm + +.macro override_vector_table _table:req + adr x1, \_table + msr vbar_el3, x1 +.endm + /* * Apply erratum * @@ -497,6 +514,27 @@ endfunc check_erratum_\_cpu\()_\_id .endm +.macro check_erratum_chosen _cpu:req, _cve:req, _id:req, _chosen:req + func check_erratum_\_cpu\()_\_id + .if \_chosen + mov x0, #ERRATA_APPLIES + .else + mov x0, #ERRATA_MISSING + .endif + ret + endfunc check_erratum_\_cpu\()_\_id +.endm + +/* provide a shorthand for the name format for annoying errata */ +.macro check_erratum_custom_start _cpu:req, _cve:req, _id:req + func check_erratum_\_cpu\()_\_id +.endm + +.macro check_erratum_custom_end _cpu:req, _cve:req, _id:req + endfunc check_erratum_\_cpu\()_\_id +.endm + + /******************************************************************************* * CPU reset function wrapper ******************************************************************************/ diff --git a/include/lib/cpus/errata.h b/include/lib/cpus/errata.h index f8f9555d2..b280435d8 100644 --- a/include/lib/cpus/errata.h +++ b/include/lib/cpus/errata.h @@ -64,6 +64,10 @@ CASSERT(sizeof(struct erratum_entry) == ERRATUM_ENTRY_SIZE, #define CVE(year, id) year, id #define NO_ISB 1 #define NO_ASSERT 0 +#define NO_APPLY_AT_RESET 0 +#define APPLY_AT_RESET 1 +/* useful for errata that end up always being worked around */ +#define ERRATUM_ALWAYS_CHOSEN 1 #endif /* __ASSEMBLER__ */