[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/14] machine: add phase_get() and document phase_check()/adv
From: |
Damien Hedde |
Subject: |
[PATCH v4 01/14] machine: add phase_get() and document phase_check()/advance() |
Date: |
Wed, 23 Feb 2022 10:06:53 +0100 |
phase_get() returns the current phase, we'll use it in next
commit.
Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---
include/hw/qdev-core.h | 19 +++++++++++++++++++
hw/core/qdev.c | 5 +++++
2 files changed, 24 insertions(+)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 92c3d65208..e29c705b74 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -887,7 +887,26 @@ typedef enum MachineInitPhase {
PHASE_MACHINE_READY,
} MachineInitPhase;
+/*
+ * phase_get:
+ * Returns the current phase
+ */
+MachineInitPhase phase_get(void);
+
+/**
+ * phase_check:
+ * Test if current phase is at least @phase.
+ *
+ * Returns true if this is the case.
+ */
extern bool phase_check(MachineInitPhase phase);
+
+/**
+ * @phase_advance:
+ * Update the current phase to @phase.
+ *
+ * Must only be used to make a single phase step.
+ */
extern void phase_advance(MachineInitPhase phase);
#endif
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 84f3019440..632dc0a4be 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -910,6 +910,11 @@ Object *qdev_get_machine(void)
static MachineInitPhase machine_phase;
+MachineInitPhase phase_get(void)
+{
+ return machine_phase;
+}
+
bool phase_check(MachineInitPhase phase)
{
return machine_phase >= phase;
--
2.35.1
- [PATCH v4 00/14] Initial support for machine creation via QMP, Damien Hedde, 2022/02/23
- [PATCH v4 05/14] qapi/device_add: handle the rom_order_override when cold-plugging, Damien Hedde, 2022/02/23
- [PATCH v4 10/14] none-machine: allow several cpus, Damien Hedde, 2022/02/23
- [PATCH v4 08/14] none-machine: add 'ram-addr' property, Damien Hedde, 2022/02/23
- [PATCH v4 02/14] machine&vl: introduce phase_until() to handle phase transitions, Damien Hedde, 2022/02/23
- [PATCH v4 06/14] qapi/device_add: Allow execution in machine initialized phase, Damien Hedde, 2022/02/23
- [PATCH v4 07/14] none-machine: add the NoneMachineState structure, Damien Hedde, 2022/02/23
- [PATCH v4 01/14] machine: add phase_get() and document phase_check()/advance(),
Damien Hedde <=
- [PATCH v4 03/14] vl: support machine-initialized target in phase_until(), Damien Hedde, 2022/02/23
- [PATCH v4 12/14] add sysbus-mmio-map qapi command, Damien Hedde, 2022/02/23
- [PATCH v4 04/14] qapi/device_add: compute is_hotplug flag, Damien Hedde, 2022/02/23
- [PATCH v4 09/14] none-machine: allow cold plugging sysbus devices, Damien Hedde, 2022/02/23
- [PATCH v4 13/14] hw/mem/system-memory: add a memory sysbus device, Damien Hedde, 2022/02/23