[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-8.0 16/19] target/sh4: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PATCH for-8.0 16/19] target/sh4: Convert to 3-phase reset |
Date: |
Thu, 24 Nov 2022 11:50:19 +0000 |
Convert the sh4 CPU class to use 3-phase reset, so it doesn't
need to use device_class_set_parent_reset() any more.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/sh4/cpu-qom.h | 4 ++--
target/sh4/cpu.c | 12 ++++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/sh4/cpu-qom.h b/target/sh4/cpu-qom.h
index d4192d10908..89785a90f02 100644
--- a/target/sh4/cpu-qom.h
+++ b/target/sh4/cpu-qom.h
@@ -34,7 +34,7 @@ OBJECT_DECLARE_CPU_TYPE(SuperHCPU, SuperHCPUClass, SUPERH_CPU)
/**
* SuperHCPUClass:
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
* @pvr: Processor Version Register
* @prr: Processor Revision Register
* @cvr: Cache Version Register
@@ -47,7 +47,7 @@ struct SuperHCPUClass {
/*< public >*/
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
uint32_t pvr;
uint32_t prr;
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 453268392bf..951eb6b9c8d 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -87,14 +87,16 @@ static bool superh_cpu_has_work(CPUState *cs)
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
-static void superh_cpu_reset(DeviceState *dev)
+static void superh_cpu_reset_hold(Object *obj)
{
- CPUState *s = CPU(dev);
+ CPUState *s = CPU(obj);
SuperHCPU *cpu = SUPERH_CPU(s);
SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(cpu);
CPUSH4State *env = &cpu->env;
- scc->parent_reset(dev);
+ if (scc->parent_phases.hold) {
+ scc->parent_phases.hold(obj);
+ }
memset(env, 0, offsetof(CPUSH4State, end_reset_fields));
@@ -274,11 +276,13 @@ static void superh_cpu_class_init(ObjectClass *oc, void
*data)
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
+ ResettableClass *rc = RESETTABLE_CLASS(oc);
device_class_set_parent_realize(dc, superh_cpu_realizefn,
&scc->parent_realize);
- device_class_set_parent_reset(dc, superh_cpu_reset, &scc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, superh_cpu_reset_hold, NULL,
+ &scc->parent_phases);
cc->class_by_name = superh_cpu_class_by_name;
cc->has_work = superh_cpu_has_work;
--
2.25.1
- [PATCH for-8.0 12/19] target/openrisc: Convert to 3-phase reset, (continued)
- [PATCH for-8.0 12/19] target/openrisc: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 18/19] target/tricore: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 14/19] target/riscv: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 17/19] target/sparc: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 13/19] target/ppc: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 15/19] target/rx: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [PATCH for-8.0 16/19] target/sh4: Convert to 3-phase reset,
Peter Maydell <=
- [PATCH for-8.0 19/19] target/xtensa: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- Re: [PATCH for-8.0 00/19] Convert most CPU classes to 3-phase reset, Philippe Mathieu-Daudé, 2022/11/24