aboutsummaryrefslogtreecommitdiff
path: root/target-openrisc/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-05 14:11:07 +0100
committerAndreas Färber <afaerber@suse.de>2013-02-16 14:50:56 +0100
commitc296262bc94651a7a43639857d8343470f4129f3 (patch)
tree09e643e5586cf49a7c8f6c844db0600f477021e9 /target-openrisc/cpu.c
parent2b6f294cacd9f4e133a7813d22e1b4e87ac6b2a3 (diff)
target-openrisc: Update OpenRISCCPU to QOM realizefn
Update the openrisc_cpu_realize() signature, hook it up to DeviceClass::realize and set realized = true in cpu_openrisc_init(). qapi/error.h is now included through qdev and no longer needed. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Jia Liu <proljc@gmail.com>
Diffstat (limited to 'target-openrisc/cpu.c')
-rw-r--r--target-openrisc/cpu.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index a7a8de8a37..d8cc533efe 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -62,12 +62,15 @@ static inline void set_feature(OpenRISCCPU *cpu, int feature)
cpu->env.cpucfgr = cpu->feature;
}
-void openrisc_cpu_realize(Object *obj, Error **errp)
+static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(obj);
+ OpenRISCCPU *cpu = OPENRISC_CPU(dev);
+ OpenRISCCPUClass *occ = OPENRISC_CPU_GET_CLASS(dev);
qemu_init_vcpu(&cpu->env);
cpu_reset(CPU(cpu));
+
+ occ->parent_realize(dev, errp);
}
static void openrisc_cpu_initfn(Object *obj)
@@ -134,6 +137,10 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
{
OpenRISCCPUClass *occ = OPENRISC_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(occ);
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ occ->parent_realize = dc->realize;
+ dc->realize = openrisc_cpu_realizefn;
occ->parent_reset = cc->reset;
cc->reset = openrisc_cpu_reset;
@@ -187,7 +194,7 @@ OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
cpu = OPENRISC_CPU(object_new(object_class_get_name(oc)));
cpu->env.cpu_model_str = cpu_model;
- openrisc_cpu_realize(OBJECT(cpu), NULL);
+ object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
return cpu;
}