Now the alpha clipper machine will execute a proper reset we can use
the reset mechanisms to reset the CPU.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
target/alpha/cpu.h | 2 ++
target/alpha/cpu.c | 10 ++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h
index 45944e46b54..0da6a4a2f10 100644
--- a/target/alpha/cpu.h
+++ b/target/alpha/cpu.h
@@ -269,6 +269,7 @@ struct ArchCPU {
/**
* AlphaCPUClass:
* @parent_realize: The parent class' realize handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* An Alpha CPU model.
*/
@@ -276,6 +277,7 @@ struct AlphaCPUClass {
CPUClass parent_class;
DeviceRealize parent_realize;
+ ResettablePhases parent_phases;
};
#ifndef CONFIG_USER_ONLY
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 1780db7d1e2..e225f11ac0a 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -202,12 +202,10 @@ static void ev67_cpu_initfn(Object *obj)
cpu_env(CPU(obj))->amask |= AMASK_CIX | AMASK_PREFETCH;
}
-static void alpha_cpu_initfn(Object *obj)
+static void alpha_cpu_reset_exit(Object *obj, ResetType type)
{
CPUAlphaState *env = cpu_env(CPU(obj));
- /* TODO all this should be done in reset, not init */
-
env->lock_addr = -1;
/*
@@ -277,10 +275,15 @@ static void alpha_cpu_class_init(ObjectClass *oc, const void *data)
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
AlphaCPUClass *acc = ALPHA_CPU_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, alpha_cpu_realizefn,
&acc->parent_realize);
+ resettable_class_set_parent_phases(rc,
+ NULL, NULL, alpha_cpu_reset_exit,
+ &acc->parent_phases);
+
cc->class_by_name = alpha_cpu_class_by_name;
cc->dump_state = alpha_cpu_dump_state;
cc->set_pc = alpha_cpu_set_pc;
@@ -311,7 +314,6 @@ static const TypeInfo alpha_cpu_type_infos[] = {
.parent = TYPE_CPU,
.instance_size = sizeof(AlphaCPU),
.instance_align = __alignof(AlphaCPU),
- .instance_init = alpha_cpu_initfn,
.abstract = true,
.class_size = sizeof(AlphaCPUClass),
.class_init = alpha_cpu_class_init,
--
2.47.3