[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH-for-9.1 03/29] hw/i386/pc: Pass base machine type as argument
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH-for-9.1 03/29] hw/i386/pc: Pass base machine type as argument to DEFINE_PC_MACHINE() |
Date: |
Thu, 28 Mar 2024 16:54:11 +0100 |
Currently PC machines are based on TYPE_PC_MACHINE.
In preparation of being based on different types,
pass the current type as argument.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/i386/pc.h | 4 ++--
hw/i386/pc_piix.c | 9 +++++----
hw/i386/pc_q35.c | 3 ++-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 6b885424bb..33023ebbbe 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -268,7 +268,7 @@ extern const size_t pc_compat_2_4_len;
extern GlobalProperty pc_compat_2_3[];
extern const size_t pc_compat_2_3_len;
-#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
+#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn, parent_class) \
static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
{ \
MachineClass *mc = MACHINE_CLASS(oc); \
@@ -277,7 +277,7 @@ extern const size_t pc_compat_2_3_len;
} \
static const TypeInfo pc_machine_type_##suffix = { \
.name = namestr TYPE_MACHINE_SUFFIX, \
- .parent = TYPE_PC_MACHINE, \
+ .parent = parent_class, \
.class_init = pc_machine_##suffix##_class_init, \
}; \
static void pc_machine_init_##suffix(void) \
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 1be1e050c7..b9f85148e3 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -462,7 +462,8 @@ static void pc_xen_hvm_init(MachineState *machine)
} \
pc_init1(machine, TYPE_I440FX_PCI_DEVICE); \
} \
- DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
+ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \
+ TYPE_PC_MACHINE)
static void pc_i440fx_machine_options(MachineClass *m)
{
@@ -824,7 +825,7 @@ static void isapc_machine_options(MachineClass *m)
}
DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
- isapc_machine_options);
+ isapc_machine_options, TYPE_PC_MACHINE);
#endif
#ifdef CONFIG_XEN
@@ -837,7 +838,7 @@ static void xenfv_4_2_machine_options(MachineClass *m)
}
DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
- xenfv_4_2_machine_options);
+ xenfv_4_2_machine_options, TYPE_PC_MACHINE);
static void xenfv_3_1_machine_options(MachineClass *m)
{
@@ -849,5 +850,5 @@ static void xenfv_3_1_machine_options(MachineClass *m)
}
DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
- xenfv_3_1_machine_options);
+ xenfv_3_1_machine_options, TYPE_PC_MACHINE);
#endif
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 43ee1e595c..7dbee38f03 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -338,7 +338,8 @@ static void pc_q35_init(MachineState *machine)
} \
pc_q35_init(machine); \
} \
- DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
+ DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn, \
+ TYPE_PC_MACHINE)
static void pc_q35_machine_options(MachineClass *m)
--
2.41.0
- [RFC PATCH-for-9.1 00/29] hw/i386/pc: Decouple ISA vs PCI-based machines, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 01/29] hw/i386/pc: Declare CPU QOM types using DEFINE_TYPES() macro, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 02/29] hw/i386/pc: Extract pc_machine_is_pci_enabled() helper, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 03/29] hw/i386/pc: Pass base machine type as argument to DEFINE_PC_MACHINE(),
Philippe Mathieu-Daudé <=
- [RFC PATCH-for-9.1 04/29] hw/i386/pc: Introduce PC_PCI_MACHINE QOM type, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 05/29] hw/i386/pc: Remove PCMachineClass::pci_enabled field, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 06/29] hw/i386/pc: Move pci_root_uid field to PcPciMachineClass, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 07/29] hw/i386/pc: Call fw_cfg_add_extra_pci_roots() in pc_pci_machine_done(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 08/29] hw/i386/pc: Move CXLState to PcPciMachineState, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 09/29] hw/i386/pc: Pass PCMachineState argument to acpi_setup(), Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 10/29] hw/i386/pc: Remove PCMachineClass::has_acpi_build field, Philippe Mathieu-Daudé, 2024/03/28
- [RFC PATCH-for-9.1 11/29] hw/i386/pc: Move acpi_setup() call to pc_pci_machine_done(), Philippe Mathieu-Daudé, 2024/03/28