2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/spin_table.h>
12 int spin_table_update_dt(void *fdt)
14 int cpus_offset, offset;
17 unsigned long rsv_addr = (unsigned long)&spin_table_reserve_begin;
18 unsigned long rsv_size = &spin_table_reserve_end -
19 &spin_table_reserve_begin;
21 cpus_offset = fdt_path_offset(fdt, "/cpus");
25 for (offset = fdt_first_subnode(fdt, cpus_offset);
27 offset = fdt_next_subnode(fdt, offset)) {
28 prop = fdt_getprop(fdt, offset, "device_type", NULL);
29 if (!prop || strcmp(prop, "cpu"))
33 * In the first loop, we check if every CPU node specifies
34 * spin-table. Otherwise, just return successfully to not
35 * disturb other methods, like psci.
37 prop = fdt_getprop(fdt, offset, "enable-method", NULL);
38 if (!prop || strcmp(prop, "spin-table"))
42 for (offset = fdt_first_subnode(fdt, cpus_offset);
44 offset = fdt_next_subnode(fdt, offset)) {
45 prop = fdt_getprop(fdt, offset, "device_type", NULL);
46 if (!prop || strcmp(prop, "cpu"))
49 ret = fdt_setprop_u64(fdt, offset, "cpu-release-addr",
50 (unsigned long)&spin_table_cpu_release_addr);
55 ret = fdt_add_mem_rsv(fdt, rsv_addr, rsv_size);
59 printf(" Reserved memory region for spin-table: addr=%lx size=%lx\n",