feat(cpus): add more errata framework helpers

Figuring out the naming format of errata is annoying, so add a shorthand
for the custom checker functions. Also add some more semantic macros
instead of passing around constants.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: Ibdcf72146738026df4ebd047bfb30790fd4a1053
This commit is contained in:
Boyan Karatotev 2023-04-04 11:29:00 +01:00
parent 6a0e8e80fb
commit 94a75ad456
2 changed files with 42 additions and 0 deletions

View file

@ -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
******************************************************************************/

View file

@ -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__ */