Add a hw.model sysctl oid for arm64 which reports the CPU model similar to armv6/7.

Reviewed by:	andrew, manu
Differential Revision:	https://reviews.freebsd.org/D20123
This commit is contained in:
ganbold 2019-05-01 14:20:31 +00:00
parent f79fcaf038
commit dbc342b6b4

View File

@ -72,6 +72,10 @@ sysctl_hw_machine(SYSCTL_HANDLER_ARGS)
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class");
static char cpu_model[64];
SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
cpu_model, sizeof(cpu_model), "Machine model");
/*
* Per-CPU affinity as provided in MPIDR_EL1
* Indexed by CPU number in logical order selected by the system.
@ -1313,6 +1317,10 @@ identify_cpu(void)
cpu_desc[cpu].cpu_revision = CPU_REV(midr);
cpu_desc[cpu].cpu_variant = CPU_VAR(midr);
snprintf(cpu_model, sizeof(cpu_model), "%s %s r%dp%d",
cpu_desc[cpu].cpu_impl_name, cpu_desc[cpu].cpu_part_name,
cpu_desc[cpu].cpu_variant, cpu_desc[cpu].cpu_revision);
/* Save affinity for current CPU */
cpu_desc[cpu].mpidr = get_mpidr();
CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK;