summaryrefslogtreecommitdiffstats
path: root/sys/arm/arm
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2017-05-09 18:12:33 -0500
committerLuiz Souza <luiz@netgate.com>2017-07-20 15:24:34 -0500
commite32583804e5d2cadcfa741670c27db2cd9aafc9a (patch)
tree7724c1aef12b9ca14fe632b621690be512ed9a30 /sys/arm/arm
parent2b407824247ed9967be0ec6a053f41f7e950ea43 (diff)
downloadFreeBSD-src-e32583804e5d2cadcfa741670c27db2cd9aafc9a.zip
FreeBSD-src-e32583804e5d2cadcfa741670c27db2cd9aafc9a.tar.gz
Reimplement the commit 3a10a90e55b9cd00bf9c1343ff5df940cdd16a19 to export the ARM CPU model as hw.model.
(cherry picked from commit bb5db9ebc2bdf0bd680ae3efcc59150e0c0bbae5)
Diffstat (limited to 'sys/arm/arm')
-rw-r--r--sys/arm/arm/identcpu-v6.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arm/arm/identcpu-v6.c b/sys/arm/arm/identcpu-v6.c
index 7cc8170..e0db741 100644
--- a/sys/arm/arm/identcpu-v6.c
+++ b/sys/arm/arm/identcpu-v6.c
@@ -52,7 +52,10 @@ __FBSDID("$FreeBSD$");
#include <machine/md_var.h>
char machine[] = "arm";
-
+static char cpu_model[128];
+
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_MPSAFE,
+ cpu_model, 0, "Machine model");
SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
machine, 0, "Machine class");
@@ -266,6 +269,15 @@ identify_arm_cpu(void)
for(i = 0; i < nitems(cpu_names); i++) {
if (cpu_names[i].implementer == cpuinfo.implementer &&
cpu_names[i].part_number == cpuinfo.part_number) {
+ if (i == 0) {
+ memset(cpu_model, 0, sizeof(cpu_model));
+ snprintf(cpu_model, sizeof(cpu_model) - 1,
+ "CPU: %s %s r%dp%d (ECO: 0x%08X)\n",
+ cpu_names[i].impl_name, cpu_names[i].core_name,
+ cpuinfo.revision, cpuinfo.patch,
+ cpuinfo.midr != cpuinfo.revidr ?
+ cpuinfo.revidr : 0);
+ }
printf("CPU: %s %s r%dp%d (ECO: 0x%08X)\n",
cpu_names[i].impl_name, cpu_names[i].core_name,
cpuinfo.revision, cpuinfo.patch,
OpenPOWER on IntegriCloud