riscv: hw: Change create_fdt() to return void
There is no need to return fdt at the end of create_fdt() because it's already saved in s->fdt. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Chih-Min Chao <chihmin.chao@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
parent
b179685b6a
commit
9f79638ec5
@ -67,7 +67,7 @@ static const struct MemmapEntry {
|
|||||||
|
|
||||||
#define GEM_REVISION 0x10070109
|
#define GEM_REVISION 0x10070109
|
||||||
|
|
||||||
static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
|
static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
|
||||||
uint64_t mem_size, const char *cmdline)
|
uint64_t mem_size, const char *cmdline)
|
||||||
{
|
{
|
||||||
void *fdt;
|
void *fdt;
|
||||||
@ -253,14 +253,11 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
|
|||||||
qemu_fdt_setprop_string(fdt, "/aliases", "serial0", nodename);
|
qemu_fdt_setprop_string(fdt, "/aliases", "serial0", nodename);
|
||||||
|
|
||||||
g_free(nodename);
|
g_free(nodename);
|
||||||
|
|
||||||
return fdt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void riscv_sifive_u_init(MachineState *machine)
|
static void riscv_sifive_u_init(MachineState *machine)
|
||||||
{
|
{
|
||||||
const struct MemmapEntry *memmap = sifive_u_memmap;
|
const struct MemmapEntry *memmap = sifive_u_memmap;
|
||||||
void *fdt;
|
|
||||||
|
|
||||||
SiFiveUState *s = g_new0(SiFiveUState, 1);
|
SiFiveUState *s = g_new0(SiFiveUState, 1);
|
||||||
MemoryRegion *system_memory = get_system_memory();
|
MemoryRegion *system_memory = get_system_memory();
|
||||||
@ -281,7 +278,7 @@ static void riscv_sifive_u_init(MachineState *machine)
|
|||||||
main_mem);
|
main_mem);
|
||||||
|
|
||||||
/* create device tree */
|
/* create device tree */
|
||||||
fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
|
create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
|
||||||
|
|
||||||
riscv_find_and_load_firmware(machine, BIOS_FILENAME,
|
riscv_find_and_load_firmware(machine, BIOS_FILENAME,
|
||||||
memmap[SIFIVE_U_DRAM].base);
|
memmap[SIFIVE_U_DRAM].base);
|
||||||
@ -294,9 +291,9 @@ static void riscv_sifive_u_init(MachineState *machine)
|
|||||||
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
||||||
machine->ram_size, kernel_entry,
|
machine->ram_size, kernel_entry,
|
||||||
&start);
|
&start);
|
||||||
qemu_fdt_setprop_cell(fdt, "/chosen",
|
qemu_fdt_setprop_cell(s->fdt, "/chosen",
|
||||||
"linux,initrd-start", start);
|
"linux,initrd-start", start);
|
||||||
qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
|
qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end",
|
||||||
end);
|
end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ static void create_pcie_irq_map(void *fdt, char *nodename,
|
|||||||
0x1800, 0, 0, 0x7);
|
0x1800, 0, 0, 0x7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
|
static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
|
||||||
uint64_t mem_size, const char *cmdline)
|
uint64_t mem_size, const char *cmdline)
|
||||||
{
|
{
|
||||||
void *fdt;
|
void *fdt;
|
||||||
@ -316,8 +316,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap,
|
|||||||
qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
|
qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline);
|
||||||
}
|
}
|
||||||
g_free(nodename);
|
g_free(nodename);
|
||||||
|
|
||||||
return fdt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -373,7 +371,6 @@ static void riscv_virt_board_init(MachineState *machine)
|
|||||||
size_t plic_hart_config_len;
|
size_t plic_hart_config_len;
|
||||||
int i;
|
int i;
|
||||||
unsigned int smp_cpus = machine->smp.cpus;
|
unsigned int smp_cpus = machine->smp.cpus;
|
||||||
void *fdt;
|
|
||||||
|
|
||||||
/* Initialize SOC */
|
/* Initialize SOC */
|
||||||
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
|
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
|
||||||
@ -392,7 +389,7 @@ static void riscv_virt_board_init(MachineState *machine)
|
|||||||
main_mem);
|
main_mem);
|
||||||
|
|
||||||
/* create device tree */
|
/* create device tree */
|
||||||
fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
|
create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
|
||||||
|
|
||||||
/* boot rom */
|
/* boot rom */
|
||||||
memory_region_init_rom(mask_rom, NULL, "riscv_virt_board.mrom",
|
memory_region_init_rom(mask_rom, NULL, "riscv_virt_board.mrom",
|
||||||
@ -411,9 +408,9 @@ static void riscv_virt_board_init(MachineState *machine)
|
|||||||
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
hwaddr end = riscv_load_initrd(machine->initrd_filename,
|
||||||
machine->ram_size, kernel_entry,
|
machine->ram_size, kernel_entry,
|
||||||
&start);
|
&start);
|
||||||
qemu_fdt_setprop_cell(fdt, "/chosen",
|
qemu_fdt_setprop_cell(s->fdt, "/chosen",
|
||||||
"linux,initrd-start", start);
|
"linux,initrd-start", start);
|
||||||
qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end",
|
qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end",
|
||||||
end);
|
end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user