summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2019-08-08 10:20:23 +0300
committerAnup Patel <anup@brainfault.org>2019-08-09 10:00:06 +0300
commit446b6f30a44a856e81aa50684ac428f30221f4bb (patch)
tree80e61ef5f9cf569b84785ca814939b658d8440ce /platform
parentc1b9dd3ab5177c3f3116b713e0e398243f73f2fa (diff)
downloadopensbi-446b6f30a44a856e81aa50684ac428f30221f4bb.tar.xz
platform: sifive: fu540: Expand FDT size before any patching
We should expand the FDT size before any patching, otherwise it's possible the "status" fix up might fail due to insufficient space. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/sifive/fu540/platform.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c
index ee90790..827e294 100644
--- a/platform/sifive/fu540/platform.c
+++ b/platform/sifive/fu540/platform.c
@@ -62,6 +62,12 @@ static void fu540_modify_dt(void *fdt)
char cpu_node[32] = "";
const char *mmu_type;
+ size = fdt_totalsize(fdt);
+ err = fdt_open_into(fdt, fdt, size + 256);
+ if (err < 0)
+ sbi_printf(
+ "Device Tree can't be expanded to accmodate new node");
+
for (i = 0; i < FU540_HART_COUNT; i++) {
sbi_sprintf(cpu_node, "/cpus/cpu@%d", i);
cpu_offset = fdt_path_offset(fdt, cpu_node);
@@ -74,11 +80,6 @@ static void fu540_modify_dt(void *fdt)
"disabled");
memset(cpu_node, 0, sizeof(cpu_node));
}
- size = fdt_totalsize(fdt);
- err = fdt_open_into(fdt, fdt, size + 256);
- if (err < 0)
- sbi_printf(
- "Device Tree can't be expanded to accmodate new node");
chosen_offset = fdt_path_offset(fdt, "/chosen");
fdt_setprop_string(fdt, chosen_offset, "stdout-path",