summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2017-05-09 18:12:33 -0500
committerLuiz Souza <luiz@netgate.com>2017-07-17 13:43:20 -0500
commitb87c360f5ecba9902d4d592ac2ad74e226e3494b (patch)
treeabba71bb3d8f5f9db6af99a6cb5f3504bf316afc
parentf873d15ebf1ab8674a347f0ab8292ed2954470b7 (diff)
downloadFreeBSD-src-b87c360f5ecba9902d4d592ac2ad74e226e3494b.zip
FreeBSD-src-b87c360f5ecba9902d4d592ac2ad74e226e3494b.tar.gz
Reimplement the commit 3a10a90e55b9cd00bf9c1343ff5df940cdd16a19 to export the ARM CPU model as hw.model.
(cherry picked from commit bb5db9ebc2bdf0bd680ae3efcc59150e0c0bbae5)
-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