From 3f1c847d1fec852a2b98ee408e4193d70949acd4 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Tue, 17 Mar 2020 07:59:49 -0700 Subject: [PATCH] platform: sifive/fu540: Replace cpu0 node fix-up with the new helper This replaces the FU540 specific cpu0 node "status" property fix-up with the newly introduced generic fdt_cpu_fixup() helper. Unlike previous logic, the helper routine does not test the "mmu-type" property to determine which node we should fix up, instead it uses sbi_platform_hart_disabled() API. Signed-off-by: Bin Meng Reviewed-by: Anup Patel --- platform/sifive/fu540/platform.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index b655d45..6a8c7b2 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -58,31 +58,7 @@ static void fu540_modify_dt(void *fdt) { - u32 i, size; - int err; - int cpu_offset; - 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); - mmu_type = fdt_getprop(fdt, cpu_offset, "mmu-type", NULL); - if (mmu_type && (!strcmp(mmu_type, "riscv,sv32") || - !strcmp(mmu_type, "riscv,sv39") || - !strcmp(mmu_type, "riscv,sv48"))) - continue; - else - fdt_setprop_string(fdt, cpu_offset, "status", - "disabled"); - memset(cpu_node, 0, sizeof(cpu_node)); - } + fdt_cpu_fixup(fdt); fdt_plic_fixup(fdt, "riscv,plic0"); -- 2.7.4