Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Feb 2018 23:58:56 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330044 - head/sys/arm/arm
Message-ID:  <201802262358.w1QNwunm070316@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Feb 26 23:58:56 2018
New Revision: 330044
URL: https://svnweb.freebsd.org/changeset/base/330044

Log:
  Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
  to what other arches (all except riscv and armv4/5) do.
  
  Submitted by:	Hyun Hwang <hyun@caffeinated.codes>
  Differential Revision:	https://reviews.freebsd.org/D14465

Modified:
  head/sys/arm/arm/identcpu-v6.c

Modified: head/sys/arm/arm/identcpu-v6.c
==============================================================================
--- head/sys/arm/arm/identcpu-v6.c	Mon Feb 26 22:57:52 2018	(r330043)
+++ head/sys/arm/arm/identcpu-v6.c	Mon Feb 26 23:58:56 2018	(r330044)
@@ -56,6 +56,10 @@ char machine[] = "arm";
 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
 	machine, 0, "Machine class");
 
+static char cpu_model[64];
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+    cpu_model, sizeof(cpu_model), "Machine model");
+
 static char hw_buf[81];
 static int hw_buf_idx;
 static bool hw_buf_newline;
@@ -285,11 +289,13 @@ identify_arm_cpu(void)
 		if (cpu_names[i].implementer == cpuinfo.implementer &&
 		    cpu_names[i].part_number == cpuinfo.part_number) {
 			cpu_class = cpu_names[i].cpu_class;
-			printf("CPU: %s %s r%dp%d (ECO: 0x%08X)\n",
+			snprintf(cpu_model, sizeof(cpu_model),
+			    "%s %s r%dp%d (ECO: 0x%08X)",
 			    cpu_names[i].impl_name, cpu_names[i].core_name,
 			    cpuinfo.revision, cpuinfo.patch,
 			    cpuinfo.midr != cpuinfo.revidr ?
 			    cpuinfo.revidr : 0);
+			printf("CPU: %s\n", cpu_model);
 			break;
 		}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802262358.w1QNwunm070316>