Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/identcpu.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
error = SYSCTL_OUT(req, machine, sizeof(machine)); | error = SYSCTL_OUT(req, machine, sizeof(machine)); | ||||
return (error); | return (error); | ||||
} | } | ||||
SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD | | SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD | | ||||
CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class"); | 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 | * Per-CPU affinity as provided in MPIDR_EL1 | ||||
* Indexed by CPU number in logical order selected by the system. | * Indexed by CPU number in logical order selected by the system. | ||||
* Relevant fields can be extracted using CPU_AFFn macros, | * Relevant fields can be extracted using CPU_AFFn macros, | ||||
* Aff3.Aff2.Aff1.Aff0 construct a unique CPU address in the system. | * Aff3.Aff2.Aff1.Aff0 construct a unique CPU address in the system. | ||||
* | * | ||||
* Fields used by us: | * Fields used by us: | ||||
* Aff1 - Cluster number | * Aff1 - Cluster number | ||||
▲ Show 20 Lines • Show All 1,224 Lines • ▼ Show 20 Lines | if (part_id == cpu_partsp[i].part_id || | ||||
cpu_desc[cpu].cpu_part_num = part_id; | cpu_desc[cpu].cpu_part_num = part_id; | ||||
cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; | cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
cpu_desc[cpu].cpu_revision = CPU_REV(midr); | cpu_desc[cpu].cpu_revision = CPU_REV(midr); | ||||
cpu_desc[cpu].cpu_variant = CPU_VAR(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 */ | /* Save affinity for current CPU */ | ||||
cpu_desc[cpu].mpidr = get_mpidr(); | cpu_desc[cpu].mpidr = get_mpidr(); | ||||
CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; | CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; | ||||
cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(ID_AA64DFR0_EL1); | cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(ID_AA64DFR0_EL1); | ||||
cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(ID_AA64DFR1_EL1); | cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(ID_AA64DFR1_EL1); | ||||
cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); | cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |