diff options
author | Andreas Färber <afaerber@suse.de> | 2013-01-05 14:01:30 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-02-16 14:50:56 +0100 |
commit | bd1b282836a7885a13c13f9cc63123fa8e32f02f (patch) | |
tree | 51a39430f759f1a162be051fffae111e72ac62ec | |
parent | 4f65809994274989bdf51c8605bb974565cb1c9e (diff) | |
download | qemu-bd1b282836a7885a13c13f9cc63123fa8e32f02f.zip qemu-bd1b282836a7885a13c13f9cc63123fa8e32f02f.tar.gz qemu-bd1b282836a7885a13c13f9cc63123fa8e32f02f.tar.bz2 |
target-alpha: Update AlphaCPU to QOM realizefn
Update the alpha_cpu_realize() signature and hook up to
DeviceClass::realize. Set realized = true in cpu_alpha_init().
qapi/error.h is included through qdev now and no longer needed.
Acked-by: Richard Henderson <rth@twiddle.net>
[AF: Invoke parent's realizefn]
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r-- | target-alpha/cpu-qom.h | 2 | ||||
-rw-r--r-- | target-alpha/cpu.c | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h index 16367d2..c0f6c6d 100644 --- a/target-alpha/cpu-qom.h +++ b/target-alpha/cpu-qom.h @@ -34,6 +34,7 @@ /** * AlphaCPUClass: + * @parent_realize: The parent class' realize handler. * @parent_reset: The parent class' reset handler. * * An Alpha CPU model. @@ -43,6 +44,7 @@ typedef struct AlphaCPUClass { CPUClass parent_class; /*< public >*/ + DeviceRealize parent_realize; void (*parent_reset)(CPUState *cpu); } AlphaCPUClass; diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c index 0ad69f0..0cdae69 100644 --- a/target-alpha/cpu.c +++ b/target-alpha/cpu.c @@ -21,14 +21,16 @@ #include "cpu.h" #include "qemu-common.h" -#include "qapi/error.h" -static void alpha_cpu_realize(Object *obj, Error **errp) +static void alpha_cpu_realizefn(DeviceState *dev, Error **errp) { - AlphaCPU *cpu = ALPHA_CPU(obj); + AlphaCPU *cpu = ALPHA_CPU(dev); + AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev); qemu_init_vcpu(&cpu->env); + + acc->parent_realize(dev, errp); } /* Sort alphabetically by type name. */ @@ -134,7 +136,8 @@ AlphaCPU *cpu_alpha_init(const char *cpu_model) env->cpu_model_str = cpu_model; - alpha_cpu_realize(OBJECT(cpu), NULL); + object_property_set_bool(OBJECT(cpu), true, "realized", NULL); + return cpu; } @@ -250,7 +253,12 @@ static void alpha_cpu_initfn(Object *obj) static void alpha_cpu_class_init(ObjectClass *oc, void *data) { + DeviceClass *dc = DEVICE_CLASS(oc); CPUClass *cc = CPU_CLASS(oc); + AlphaCPUClass *acc = ALPHA_CPU_CLASS(oc); + + acc->parent_realize = dc->realize; + dc->realize = alpha_cpu_realizefn; cc->class_by_name = alpha_cpu_class_by_name; } |