/* * arm_dt_init_cpu_maps - Function retrieves cpu nodes from the device tree * and builds the cpu logical map array containing MPIDR values related to * logical cpus * * Updates the cpu possible mask with the number of parsed cpu nodes
*/ void __init arm_dt_init_cpu_maps(void)
{ /* * Temp logical map is initialized with UINT_MAX values that are * considered invalid logical map entries since the logical map must * contain a list of MPIDR[23:0] values where MPIDR[31:24] must * read as 0.
*/ struct device_node *cpu, *cpus; int found_method = 0;
u32 i, j, cpuidx = 1;
u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
/* * Bits n:24 must be set to 0 in the DT since the reg property * defines the MPIDR[23:0].
*/ if (hwid & ~MPIDR_HWID_BITMASK) {
of_node_put(cpu); return;
}
/* * Duplicate MPIDRs are a recipe for disaster. * Scan all initialized entries and check for * duplicates. If any is found just bail out. * temp values were initialized to UINT_MAX * to avoid matching valid MPIDR[23:0] values.
*/ for (j = 0; j < cpuidx; j++) if (WARN(tmp_map[j] == hwid, "Duplicate /cpu reg properties in the DT\n")) {
of_node_put(cpu); return;
}
/* * Build a stashed array of MPIDR values. Numbering scheme * requires that if detected the boot CPU must be assigned * logical id 0. Other CPUs get sequential indexes starting * from 1. If a CPU node with a reg property matching the * boot CPU MPIDR is detected, this is recorded so that the * logical map built from DT is validated and can be used * to override the map created in smp_setup_processor_id().
*/ if (hwid == mpidr) {
i = 0;
bootcpu_valid = true;
} else {
i = cpuidx++;
}
if (!found_method)
found_method = set_smp_ops_by_method(cpu);
}
/* * Fallback to an enable-method in the cpus node if nothing found in * a cpu node.
*/ if (!found_method)
set_smp_ops_by_method(cpus);
if (!bootcpu_valid) {
pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n"); return;
}
/* * Since the boot CPU node contains proper data, and all nodes have * a reg property, the DT CPU list can be considered valid and the * logical map created in smp_setup_processor_id() can be overridden
*/ for (i = 0; i < cpuidx; i++) {
set_cpu_possible(i, true);
cpu_logical_map(i) = tmp_map[i];
pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i));
}
}
/** * setup_machine_fdt - Machine setup when an dtb was passed to the kernel * @dt_virt: virtual address of dt blob * * If a dtb was passed to the kernel in r2, then use it to choose the * correct machine_desc and to setup the system.
*/ conststruct machine_desc * __init setup_machine_fdt(void *dt_virt)
{ conststruct machine_desc *mdesc, *mdesc_best = NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.