riscv/sifive_u: Fix up file ordering
Split the file into clear machine and SoC sections. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
648db19685
commit
523e346467
@ -312,7 +312,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
|
||||
g_free(nodename);
|
||||
}
|
||||
|
||||
static void riscv_sifive_u_init(MachineState *machine)
|
||||
static void sifive_u_machine_init(MachineState *machine)
|
||||
{
|
||||
const struct MemmapEntry *memmap = sifive_u_memmap;
|
||||
SiFiveUState *s = RISCV_U_MACHINE(machine);
|
||||
@ -403,6 +403,59 @@ static void riscv_sifive_u_init(MachineState *machine)
|
||||
&address_space_memory);
|
||||
}
|
||||
|
||||
static bool sifive_u_machine_get_start_in_flash(Object *obj, Error **errp)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
return s->start_in_flash;
|
||||
}
|
||||
|
||||
static void sifive_u_machine_set_start_in_flash(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
s->start_in_flash = value;
|
||||
}
|
||||
|
||||
static void sifive_u_machine_instance_init(Object *obj)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
s->start_in_flash = false;
|
||||
object_property_add_bool(obj, "start-in-flash", sifive_u_machine_get_start_in_flash,
|
||||
sifive_u_machine_set_start_in_flash, NULL);
|
||||
object_property_set_description(obj, "start-in-flash",
|
||||
"Set on to tell QEMU's ROM to jump to "
|
||||
"flash. Otherwise QEMU will jump to DRAM",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
|
||||
mc->desc = "RISC-V Board compatible with SiFive U SDK";
|
||||
mc->init = sifive_u_machine_init;
|
||||
mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
|
||||
mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
|
||||
mc->default_cpus = mc->min_cpus;
|
||||
}
|
||||
|
||||
static const TypeInfo sifive_u_machine_typeinfo = {
|
||||
.name = MACHINE_TYPE_NAME("sifive_u"),
|
||||
.parent = TYPE_MACHINE,
|
||||
.class_init = sifive_u_machine_class_init,
|
||||
.instance_init = sifive_u_machine_instance_init,
|
||||
.instance_size = sizeof(SiFiveUState),
|
||||
};
|
||||
|
||||
static void sifive_u_machine_init_register_types(void)
|
||||
{
|
||||
type_register_static(&sifive_u_machine_typeinfo);
|
||||
}
|
||||
|
||||
type_init(sifive_u_machine_init_register_types)
|
||||
|
||||
static void riscv_sifive_u_soc_init(Object *obj)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
@ -443,33 +496,6 @@ static void riscv_sifive_u_soc_init(Object *obj)
|
||||
TYPE_CADENCE_GEM);
|
||||
}
|
||||
|
||||
static bool sifive_u_get_start_in_flash(Object *obj, Error **errp)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
return s->start_in_flash;
|
||||
}
|
||||
|
||||
static void sifive_u_set_start_in_flash(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
s->start_in_flash = value;
|
||||
}
|
||||
|
||||
static void riscv_sifive_u_machine_instance_init(Object *obj)
|
||||
{
|
||||
SiFiveUState *s = RISCV_U_MACHINE(obj);
|
||||
|
||||
s->start_in_flash = false;
|
||||
object_property_add_bool(obj, "start-in-flash", sifive_u_get_start_in_flash,
|
||||
sifive_u_set_start_in_flash, NULL);
|
||||
object_property_set_description(obj, "start-in-flash",
|
||||
"Set on to tell QEMU's ROM to jump to "
|
||||
"flash. Otherwise QEMU will jump to DRAM",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
@ -607,29 +633,3 @@ static void riscv_sifive_u_soc_register_types(void)
|
||||
}
|
||||
|
||||
type_init(riscv_sifive_u_soc_register_types)
|
||||
|
||||
static void riscv_sifive_u_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
|
||||
mc->desc = "RISC-V Board compatible with SiFive U SDK";
|
||||
mc->init = riscv_sifive_u_init;
|
||||
mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
|
||||
mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
|
||||
mc->default_cpus = mc->min_cpus;
|
||||
}
|
||||
|
||||
static const TypeInfo riscv_sifive_u_machine_typeinfo = {
|
||||
.name = MACHINE_TYPE_NAME("sifive_u"),
|
||||
.parent = TYPE_MACHINE,
|
||||
.class_init = riscv_sifive_u_machine_class_init,
|
||||
.instance_init = riscv_sifive_u_machine_instance_init,
|
||||
.instance_size = sizeof(SiFiveUState),
|
||||
};
|
||||
|
||||
static void riscv_sifive_u_machine_init_register_types(void)
|
||||
{
|
||||
type_register_static(&riscv_sifive_u_machine_typeinfo);
|
||||
}
|
||||
|
||||
type_init(riscv_sifive_u_machine_init_register_types)
|
||||
|
Loading…
Reference in New Issue
Block a user