[PATCH 1/2] ARM: cpuinfo: print CPU mainid if unknown

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Jun 3 00:24:35 PDT 2022


Instead of e.g.

  core: unknown r0p3

We now get

  core: unknown (0x410fd083) r0p3

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/cpu/cpuinfo.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index a08fc253efbb..5dce34536efc 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -191,7 +191,7 @@ static int do_cpuinfo(int argc, char *argv[])
 
 	if (cpu_arch >= CPU_ARCH_ARMv7) {
 		unsigned int major, minor;
-		char *part;
+		const char *part = NULL;
 		major = (mainid >> 20) & 0xf;
 		minor = mainid & 0xf;
 		switch (mainid & 0xfff0) {
@@ -217,9 +217,13 @@ static int do_cpuinfo(int argc, char *argv[])
 			part = "Cortex-A57";
 			break;
 		default:
-			part = "unknown";
+			printf("core: unknown (0x%08lx) r%up%u\n",
+			       mainid, major, minor);
+			break;
 		}
-		printf("core: %s r%up%u\n", part, major, minor);
+
+		if (part)
+			printf("core: %s r%up%u\n", part, major, minor);
 	}
 
 	if (cache & (1 << 24)) {
-- 
2.30.2




More information about the barebox mailing list