mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx
@ 2024-10-09  5:57 Ahmad Fatoum
  2024-10-09  5:57 ` [PATCH 2/2] ARM64: asm: mark assembly entry points as functions Ahmad Fatoum
  2024-10-14 12:49 ` [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-10-09  5:57 UTC (permalink / raw)
  To: barebox

From: Ahmad Fatoum <a.fatoum@barebox.org>

The encoding in the PAR_ELx register is a bit tricky, so add some
comments for each if-clause to make the code easier to read.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 arch/arm/cpu/mmuinfo_64.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/mmuinfo_64.c b/arch/arm/cpu/mmuinfo_64.c
index de4945f43e8e..0c5cf3e65cb7 100644
--- a/arch/arm/cpu/mmuinfo_64.c
+++ b/arch/arm/cpu/mmuinfo_64.c
@@ -133,7 +133,7 @@ static void decode_par(unsigned long par)
 {
 	u8 devmem_attr = BITS(63, 56, par);
 
-	if (par & 1) {
+	if (par & 1) { /* Faulting */
 		printf("  Translation aborted [9:8]: because of a fault in the %s%s\n",
 		       stage_fault[BITS(9, 9, par)],
 		       BITS(8, 8, par) ? " during a stage 1 translation table walk" : "");
@@ -141,30 +141,30 @@ static void decode_par(unsigned long par)
 		       decode_fault_status(BITS(6, 1, par)),
 		       decode_fault_status_level(BITS(6, 1, par)));
 		printf("  Failure [0]:                0x1\n");
-	} else {
-		if ((devmem_attr & 0xf0) && (devmem_attr & 0x0f)) {
+	} else { /* Successful */
+		if ((devmem_attr & 0xf0) && (devmem_attr & 0x0f)) { /* Normal Memory */
 			printf("  Outer mem. attr. [63:60]:   0x%02lx (%s)\n", BITS(63, 60, par),
 			       cache_attr[BITS(63, 60, par)]);
 			printf("  Inner mem. attr. [59:56]:   0x%02lx (%s)\n", BITS(59, 56, par),
 			       cache_attr[BITS(59, 56, par)]);
-		} else if ((devmem_attr & 0b11110010) == 0) {
+		} else if ((devmem_attr & 0b11110010) == 0) { /* Device Memory */
 			printf("  Memory attr. [63:56]:     0x%02x (%s)\n",
 			       devmem_attr, decode_devmem_attr(devmem_attr));
 			if (devmem_attr & 1)
 				printf("  (XS == 0 if FEAT_XS implemented)\n");
-		} else if (devmem_attr == 0b01000000) {
+		} else if (devmem_attr == 0b01000000) { /* FEAT_XS-specific */
 			printf("  Outer mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
 			       "Non-Cacheable");
 			printf("  Inner mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
 			       "Non-Cacheable");
 			printf("  (XS == 0 if FEAT_XS implemented)\n");
-		} else if (devmem_attr == 0b10100000) {
+		} else if (devmem_attr == 0b10100000) { /* FEAT_XS-specific */
 			printf("  Outer mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
 			       "Write-Through, No Write-Allocate");
 			printf("  Inner mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
 			       "Write-Through");
 			printf("  (XS == 0 if FEAT_XS implemented)\n");
-		} else if (devmem_attr == 0b11110000) {
+		} else if (devmem_attr == 0b11110000) {  /* FEAT_MTE2-specific */
 			printf("  Outer mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
 			       "Write-Back");
 			printf("  Inner mem. attr. [63:56]:   0x%02lx (%s)\n", BITS(63, 56, par),
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-14 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09  5:57 [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx Ahmad Fatoum
2024-10-09  5:57 ` [PATCH 2/2] ARM64: asm: mark assembly entry points as functions Ahmad Fatoum
2024-10-14 12:49 ` [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox