mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-03 10:17:21 +00:00
ARMv8/fsl-lsch3: Patch cpu node properties in DT for online cores
U-Boot should only add "enable-method" and "cpu-release-address" properties to the "cpu" node of the online cores. Signed-off-by: Arnab Basu <arnab.basu@freescale.com> Signed-off-by: York Sun <yorksun@freescale.com>
This commit is contained in:
parent
6c747f4ad4
commit
60385d94e5
3 changed files with 23 additions and 9 deletions
|
@ -16,7 +16,7 @@ void ft_fixup_cpu(void *blob)
|
||||||
__maybe_unused u64 spin_tbl_addr = (u64)get_spin_tbl_addr();
|
__maybe_unused u64 spin_tbl_addr = (u64)get_spin_tbl_addr();
|
||||||
fdt32_t *reg;
|
fdt32_t *reg;
|
||||||
int addr_cells;
|
int addr_cells;
|
||||||
u64 val;
|
u64 val, core_id;
|
||||||
size_t *boot_code_size = &(__secondary_boot_code_size);
|
size_t *boot_code_size = &(__secondary_boot_code_size);
|
||||||
|
|
||||||
off = fdt_path_offset(blob, "/cpus");
|
off = fdt_path_offset(blob, "/cpus");
|
||||||
|
@ -29,15 +29,20 @@ void ft_fixup_cpu(void *blob)
|
||||||
off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
|
off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
|
||||||
while (off != -FDT_ERR_NOTFOUND) {
|
while (off != -FDT_ERR_NOTFOUND) {
|
||||||
reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
|
reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
|
||||||
|
core_id = of_read_number(reg, addr_cells);
|
||||||
if (reg) {
|
if (reg) {
|
||||||
val = spin_tbl_addr;
|
if (core_id == 0 || (is_core_online(core_id))) {
|
||||||
val += id_to_core(of_read_number(reg, addr_cells))
|
val = spin_tbl_addr;
|
||||||
* SPIN_TABLE_ELEM_SIZE;
|
val += id_to_core(core_id) *
|
||||||
val = cpu_to_fdt64(val);
|
SPIN_TABLE_ELEM_SIZE;
|
||||||
fdt_setprop_string(blob, off, "enable-method",
|
val = cpu_to_fdt64(val);
|
||||||
"spin-table");
|
fdt_setprop_string(blob, off, "enable-method",
|
||||||
fdt_setprop(blob, off, "cpu-release-addr",
|
"spin-table");
|
||||||
&val, sizeof(val));
|
fdt_setprop(blob, off, "cpu-release-addr",
|
||||||
|
&val, sizeof(val));
|
||||||
|
} else {
|
||||||
|
debug("skipping offline core\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
puts("Warning: found cpu node without reg property\n");
|
puts("Warning: found cpu node without reg property\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,14 @@ int is_core_valid(unsigned int core)
|
||||||
return !!((1 << core) & cpu_mask());
|
return !!((1 << core) & cpu_mask());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_core_online(u64 cpu_id)
|
||||||
|
{
|
||||||
|
u64 *table;
|
||||||
|
int pos = id_to_core(cpu_id);
|
||||||
|
table = (u64 *)get_spin_tbl_addr() + pos * WORDS_PER_SPIN_TABLE_ENTRY;
|
||||||
|
return table[SPIN_TABLE_ELEM_STATUS_IDX] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
int cpu_reset(int nr)
|
int cpu_reset(int nr)
|
||||||
{
|
{
|
||||||
puts("Feature is not implemented.\n");
|
puts("Feature is not implemented.\n");
|
||||||
|
|
|
@ -32,5 +32,6 @@ int fsl_lsch3_wake_seconday_cores(void);
|
||||||
void *get_spin_tbl_addr(void);
|
void *get_spin_tbl_addr(void);
|
||||||
phys_addr_t determine_mp_bootpg(void);
|
phys_addr_t determine_mp_bootpg(void);
|
||||||
void secondary_boot_func(void);
|
void secondary_boot_func(void);
|
||||||
|
int is_core_online(u64 cpu_id);
|
||||||
#endif
|
#endif
|
||||||
#endif /* _FSL_CH3_MP_H */
|
#endif /* _FSL_CH3_MP_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue