@@ -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) \
@@ -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
@@ -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)
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(-)