arm-trusted-firmware/common
Andre Przywara a8d5d3d540 refactor(cpufeat): introduce wrapper macro for read_feat_...() functions
At the moment we have some elaborate, but very schematic functions to
allow checking for CPU feature enablement. Adding some more becomes
tedious and is also error-prone.

Provide two wrapper macros that reduce most of the features to a
single line:
- CREATE_FEATURE_FUNCS(name, idreg, idfield, guard)
creates two functions read_<name>_id_field() and is_<name>_supported(),
that check the 4-bit CPU ID field starting at bit <idfield> in <idreg>
for being not 0, and compares it against the build time <guard> symbol.
For the usual feature (like PAN) this looks like:
CREATE_FEATURE_FUNCS(feat_pan, id_aa64mmfr1_el1,
		     ID_AA64MMFR1_EL1_PAN_SHIFT, ENABLE_FEAT_PAN)

- CREATE_FEATURE_FUNCS_VER(name, read_func, idvalue, guard)
creates one function to check for a certain CPU ID field *value*, so
when "!= 0" is not sufficient. It's meant to be used in addition to
the above macro, since that generates the CPU ID field accessor
function:
CREATE_FEATURE_FUNCS(feat_amu, id_aa64pfr0_el1, ID_AA64PFR0_AMU_SHIFT,
		     ENABLE_FEAT_AMU)
CREATE_FEATURE_FUNCS_VER(feat_amuv1p1, read_feat_amu_id_field,
			 ID_AA64PFR0_AMU_V1P1, ENABLE_FEAT_AMUv1p1)

Describe the existing feature accessor functions using those new macros,
to reduce the size of the file, improve readability and decrease the
possibility of (copy&paste) bugs.

Change-Id: Ib136a875b4857058ff561c4635ace344006f29bf
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-08-16 12:04:23 +01:00
..
aarch32 refactor(aarch64): rename do_panic and el3_panic 2023-02-21 17:26:01 +00:00
aarch64 refactor(bl31): use elx_panic for sysreg_handler64 2023-02-22 17:24:17 +00:00
backtrace fix(debug): decouple "get_el_str()" from backtrace 2022-11-08 10:10:19 +00:00
bl_common.c feat(bl): add interface to query TF-A semantic ver 2022-08-02 16:04:23 -05:00
desc_image_load.c SPMD: extract SPMC DTB header size from SPMD 2020-05-13 08:08:39 +02:00
fdt_fixup.c Merge "feat(libfdt): add function to set MAC addresses" into integration 2022-07-08 13:29:58 +02:00
fdt_wrappers.c fix(fdt-wrappers): use correct prototypes 2023-01-10 18:59:58 +01:00
fdt_wrappers.mk build(fdt-wrappers): introduce FDT wrappers makefile 2021-10-26 12:14:28 +01:00
feat_detect.c refactor(cpufeat): introduce wrapper macro for read_feat_...() functions 2023-08-16 12:04:23 +01:00
image_decompress.c Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
runtime_svc.c Remove support for the SMC Calling Convention 2.0 2019-01-30 16:01:49 +00:00
tf_crc32.c refactor(hw_crc32): renamed hw_crc32 to tf_crc32 2021-08-02 17:15:41 +01:00
tf_log.c feat(common/debug): add new macro ERROR_NL() to print just a newline 2021-07-21 00:01:06 +02:00
uuid.c fix(uuid): add missing #include directives 2023-04-17 16:13:16 +01:00