[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-8.0 15/19] target/rx: Convert to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PATCH for-8.0 15/19] target/rx: Convert to 3-phase reset |
Date: |
Thu, 24 Nov 2022 11:50:18 +0000 |
Convert the rx 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/rx/cpu-qom.h | 4 ++--
target/rx/cpu.c | 13 ++++++++-----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/target/rx/cpu-qom.h b/target/rx/cpu-qom.h
index 4533759d966..1c8466a1870 100644
--- a/target/rx/cpu-qom.h
+++ b/target/rx/cpu-qom.h
@@ -31,7 +31,7 @@ OBJECT_DECLARE_CPU_TYPE(RXCPU, RXCPUClass, RX_CPU)
/*
* RXCPUClass:
* @parent_realize: The parent class' realize handler.
- * @parent_reset: The parent class' reset handler.
+ * @parent_phases: The parent class' reset phase handlers.
*
* A RX CPU model.
*/
@@ -41,7 +41,7 @@ struct RXCPUClass {
/*< public >*/
DeviceRealize parent_realize;
- DeviceReset parent_reset;
+ ResettablePhases parent_phases;
};
#endif
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 9003c6e9fed..219ef28e463 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -62,14 +62,16 @@ static bool rx_cpu_has_work(CPUState *cs)
(CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR);
}
-static void rx_cpu_reset(DeviceState *dev)
+static void rx_cpu_reset_hold(Object *obj)
{
- RXCPU *cpu = RX_CPU(dev);
+ RXCPU *cpu = RX_CPU(obj);
RXCPUClass *rcc = RX_CPU_GET_CLASS(cpu);
CPURXState *env = &cpu->env;
uint32_t *resetvec;
- rcc->parent_reset(dev);
+ if (rcc->parent_phases.hold) {
+ rcc->parent_phases.hold(obj);
+ }
memset(env, 0, offsetof(CPURXState, end_reset_fields));
@@ -215,11 +217,12 @@ static void rx_cpu_class_init(ObjectClass *klass, void
*data)
DeviceClass *dc = DEVICE_CLASS(klass);
CPUClass *cc = CPU_CLASS(klass);
RXCPUClass *rcc = RX_CPU_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
device_class_set_parent_realize(dc, rx_cpu_realize,
&rcc->parent_realize);
- device_class_set_parent_reset(dc, rx_cpu_reset,
- &rcc->parent_reset);
+ resettable_class_set_parent_phases(rc, NULL, rx_cpu_reset_hold, NULL,
+ &rcc->parent_phases);
cc->class_by_name = rx_cpu_class_by_name;
cc->has_work = rx_cpu_has_work;
--
2.25.1
- [PATCH for-8.0 11/19] target/nios2: Convert to 3-phase reset, (continued)
- [PATCH for-8.0 11/19] target/nios2: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [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 <=
- [PATCH for-8.0 16/19] target/sh4: Convert to 3-phase reset, Peter Maydell, 2022/11/24
- [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