On Wed, Mar 7, 2018 at 12:27 PM, Philippe Mathieu-Daudé
wrote:
> Hi Michael,
>
> On 03/06/2018 05:43 PM, Michael Clark wrote:
> > Removes a whole lot of unnecessary boilerplate code. Machines
> > don't need to be objects. The expansion of the SOC object model
> > for the RISC-V machines will happen in the future as SiFive
> > plans to add their FE310 and FU540 SOCs to QEMU. However, it
> > seems that this present boilerplate is complete unnecessary.
> >
> > Signed-off-by: Michael Clark
> > Signed-off-by: Palmer Dabbelt
> > ---
> > hw/riscv/sifive_e.c | 25 -
> > hw/riscv/sifive_u.c | 25 -
> > hw/riscv/spike.c| 20
> > hw/riscv/virt.c | 25 -
> > include/hw/riscv/sifive_e.h | 9 -
> > include/hw/riscv/sifive_u.h | 9 -
> > include/hw/riscv/virt.h | 9 -
> > 7 files changed, 122 deletions(-)
> >
> > diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
> > index 09c9d49..4872b68 100644
> > --- a/hw/riscv/sifive_e.c
> > +++ b/hw/riscv/sifive_e.c
> > @@ -194,24 +194,6 @@ static void riscv_sifive_e_init(MachineState
> *machine)
> > }
> > }
> >
> > -static int riscv_sifive_e_sysbus_device_init(SysBusDevice *sysbusdev)
> > -{
> > -return 0;
> > -}
> > -
> > -static void riscv_sifive_e_class_init(ObjectClass *klass, void *data)
> > -{
> > -SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> > -k->init = riscv_sifive_e_sysbus_device_init;
> > -}
> > -
> > -static const TypeInfo riscv_sifive_e_device = {
> > -.name = TYPE_SIFIVE_E,
> > -.parent= TYPE_SYS_BUS_DEVICE,
> > -.instance_size = sizeof(SiFiveEState),
> > -.class_init= riscv_sifive_e_class_init,
> > -};
> > -
> > static void riscv_sifive_e_machine_init(MachineClass *mc)
> > {
> > mc->desc = "RISC-V Board compatible with SiFive E SDK";
> > @@ -220,10 +202,3 @@ static void riscv_sifive_e_machine_init(MachineClass
> *mc)
> > }
> >
> > DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
> > -
> > -static void riscv_sifive_e_register_types(void)
> > -{
> > -type_register_static(&riscv_sifive_e_device);
> > -}
> > -
> > -type_init(riscv_sifive_e_register_types);
> > diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> > index 25df16c..083043a 100644
> > --- a/hw/riscv/sifive_u.c
> > +++ b/hw/riscv/sifive_u.c
> > @@ -302,31 +302,6 @@ static void riscv_sifive_u_init(MachineState
> *machine)
> > SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE);
> > }
> >
> > -static int riscv_sifive_u_sysbus_device_init(SysBusDevice *sysbusdev)
> > -{
> > -return 0;
> > -}
> > -
> > -static void riscv_sifive_u_class_init(ObjectClass *klass, void *data)
> > -{
> > -SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> > -k->init = riscv_sifive_u_sysbus_device_init;
> > -}
> > -
> > -static const TypeInfo riscv_sifive_u_device = {
> > -.name = TYPE_SIFIVE_U,
> > -.parent= TYPE_SYS_BUS_DEVICE,
> > -.instance_size = sizeof(SiFiveUState),
> > -.class_init= riscv_sifive_u_class_init,
> > -};
> > -
> > -static void riscv_sifive_u_register_types(void)
> > -{
> > -type_register_static(&riscv_sifive_u_device);
> > -}
> > -
> > -type_init(riscv_sifive_u_register_types);
> > -
> > static void riscv_sifive_u_machine_init(MachineClass *mc)
> > {
> > mc->desc = "RISC-V Board compatible with SiFive U SDK";
> > diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
> > index 74edf33..64e585e 100644
> > --- a/hw/riscv/spike.c
> > +++ b/hw/riscv/spike.c
> > @@ -336,18 +336,6 @@ static void spike_v1_09_1_board_init(MachineState
> *machine)
> > smp_cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE,
> SIFIVE_TIME_BASE);
> > }
> >
> > -static const TypeInfo spike_v_1_09_1_device = {
> > -.name = TYPE_RISCV_SPIKE_V1_09_1_BOARD,
> > -.parent= TYPE_SYS_BUS_DEVICE,
> > -.instance_size = sizeof(SpikeState),
> > -};
> > -
> > -static const TypeInfo spike_v_1_10_0_device = {
> > -.name = TYPE_RISCV_SPIKE_V1_10_0_BOARD,
> > -.parent= TYPE_SYS_BUS_DEVICE,
> > -.instance_size = sizeof(SpikeState),
> > -};
> > -
> > static void spike_v1_09_1_machine_init(MachineClass *mc)
> > {
> > mc->desc = "RISC-V Spike Board (Privileged ISA v1.9.1)";
> > @@ -365,11 +353,3 @@ static void spike_v1_10_0_machine_init(MachineClass
> *mc)
> >
> > DEFINE_MACHINE("spike_v1.9.1", spike_v1_09_1_machine_init)
> > DEFINE_MACHINE("spike_v1.10", spike_v1_10_0_machine_init)
> > -
> > -static void riscv_spike_board_register_types(void)
> > -{
> > -type_register_static(&spike_v_1_09_1_device);
> > -type_register_static(&spike_v_1_10_0_device);
> > -}
> > -
> > -type_init(riscv_spike_board_register_types);
> > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> > index f1e3641..5913100 100644
> > --- a/hw/riscv/virt.c
> > +++ b/hw/riscv/virt.c
> > @@ -380,24 +