chore(lib/arch): rename PA range defines
This patch renames the PARange defines various PA sizes
from Arch defined bit patterns to user readable size based
name.
Change-Id: I17dc23ea24707ae8cf1499d498bd90946e37daff
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
diff --git a/lib/arch/include/arch.h b/lib/arch/include/arch.h
index aed5db8..ffa26e2 100644
--- a/lib/arch/include/arch.h
+++ b/lib/arch/include/arch.h
@@ -527,13 +527,14 @@
#define ID_AA64MMFR0_EL1_PARANGE_SHIFT U(0)
#define ID_AA64MMFR0_EL1_PARANGE_WIDTH UL(4)
-#define PARANGE_0000_WIDTH U(32)
-#define PARANGE_0001_WIDTH U(36)
-#define PARANGE_0010_WIDTH U(40)
-#define PARANGE_0011_WIDTH U(42)
-#define PARANGE_0100_WIDTH U(44)
-#define PARANGE_0101_WIDTH U(48)
-#define PARANGE_0110_WIDTH U(52)
+/* Defines for PA width corresponding to PARange [0:3] in id_aa64mmfr0_el1 */
+#define PARANGE_WIDTH_32BITS U(32) /* PARange - 0x0 */
+#define PARANGE_WIDTH_36BITS U(36) /* PARange - 0x1 */
+#define PARANGE_WIDTH_40BITS U(40) /* PARange - 0x2 */
+#define PARANGE_WIDTH_42BITS U(42) /* PARange - 0x3 */
+#define PARANGE_WIDTH_44BITS U(44) /* PARange - 0x4 */
+#define PARANGE_WIDTH_48BITS U(48) /* PARange - 0x5 */
+#define PARANGE_WIDTH_52BITS U(52) /* PARange - 0x6 */
#define ID_AA64MMFR0_EL1_ECV_SHIFT UL(60)
#define ID_AA64MMFR0_EL1_ECV_WIDTH UL(4)
diff --git a/lib/arch/src/arch_features.c b/lib/arch/src/arch_features.c
index 59bc4a6..875e6d9 100644
--- a/lib/arch/src/arch_features.c
+++ b/lib/arch/src/arch_features.c
@@ -18,12 +18,16 @@
{
/*
* Physical Address ranges supported in the AArch64 Memory Model.
- * Value 0b110 is supported in ARMv8.2 onwards but not used in RMM.
+ * Each array index is a valid PARange [0:3] in ID_AA64MMFR0_EL1.
*/
const unsigned int pa_range_bits_arr[] = {
- PARANGE_0000_WIDTH, PARANGE_0001_WIDTH, PARANGE_0010_WIDTH,
- PARANGE_0011_WIDTH, PARANGE_0100_WIDTH, PARANGE_0101_WIDTH,
- PARANGE_0110_WIDTH
+ [0x0] = PARANGE_WIDTH_32BITS,
+ [0x1] = PARANGE_WIDTH_36BITS,
+ [0x2] = PARANGE_WIDTH_40BITS,
+ [0x3] = PARANGE_WIDTH_42BITS,
+ [0x4] = PARANGE_WIDTH_44BITS,
+ [0x5] = PARANGE_WIDTH_48BITS,
+ [0x6] = PARANGE_WIDTH_52BITS
};
unsigned long pa_range = EXTRACT(ID_AA64MMFR0_EL1_PARANGE,
@@ -39,7 +43,7 @@
/* cppcheck-suppress [misra-c2012-17.3] */
if (pa_range >= ARRAY_SIZE(pa_range_bits_arr)) {
return (is_feat_lpa2_4k_present() ?
- PARANGE_0110_WIDTH : PARANGE_0101_WIDTH);
+ PARANGE_WIDTH_52BITS : PARANGE_WIDTH_48BITS);
}
return pa_range_bits_arr[pa_range];