[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 12/39] q35: Eliminate pc_q35_machine_options()
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC v2 12/39] q35: Eliminate pc_q35_machine_options() |
Date: |
Fri, 13 Jun 2014 16:43:51 -0300 |
Instead of calling it on every q35 class_init function, just register a
common parent class for all q35 machine-types.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/i386/pc_q35.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 521bff7..5750239 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -319,15 +319,24 @@ static void pc_q35_init_1_4(MachineState *machine)
pc_q35_init(machine);
}
-static void pc_q35_machine_options(MachineClass *mc)
+static void pc_q35_machine_class_init(ObjectClass *oc, void *data)
{
+ MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Standard PC (Q35 + ICH9, 2009)";
mc->hot_add_cpu = pc_hot_add_cpu;
}
+#define TYPE_PC_Q35_MACHINE "pc-q35" TYPE_MACHINE_SUFFIX
+
+static TypeInfo pc_q35_machine_type_info = {
+ .name = TYPE_PC_Q35_MACHINE,
+ .parent = TYPE_PC_MACHINE,
+ .class_init = pc_q35_machine_class_init,
+ .abstract = true,
+};
+
static void pc_q35_2_1_machine_options(MachineClass *mc)
{
- pc_q35_machine_options(mc);
mc->default_machine_opts = "firmware=bios-256k.bin";
}
@@ -342,7 +351,7 @@ static void pc_q35_machine_v2_1_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_q35_machine_v2_1_type_info = {
.name = "pc-q35-2.1" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v2_1_class_init,
};
@@ -363,12 +372,10 @@ static void pc_q35_machine_v2_0_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_q35_machine_v2_0_type_info = {
.name = "pc-q35-2.0" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v2_0_class_init,
};
-#define pc_q35_1_7_machine_options pc_q35_machine_options
-
static void pc_q35_machine_v1_7_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -376,7 +383,6 @@ static void pc_q35_machine_v1_7_class_init(ObjectClass *oc,
void *data)
PC_Q35_COMPAT_1_7,
{ /* end of list */ }
};
- pc_q35_1_7_machine_options(mc);
mc->init = pc_q35_init_1_7;
machine_class_add_compat_props(mc, compat_props);
mc->name = "pc-q35-1.7";
@@ -384,12 +390,10 @@ static void pc_q35_machine_v1_7_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_q35_machine_v1_7_type_info = {
.name = "pc-q35-1.7" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v1_7_class_init,
};
-#define pc_q35_1_6_machine_options pc_q35_machine_options
-
static void pc_q35_machine_v1_6_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -397,7 +401,6 @@ static void pc_q35_machine_v1_6_class_init(ObjectClass *oc,
void *data)
PC_Q35_COMPAT_1_6,
{ /* end of list */ }
};
- pc_q35_1_6_machine_options(mc);
mc->init = pc_q35_init_1_6;
machine_class_add_compat_props(mc, compat_props);
mc->name = "pc-q35-1.6";
@@ -405,7 +408,7 @@ static void pc_q35_machine_v1_6_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_q35_machine_v1_6_type_info = {
.name = "pc-q35-1.6" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v1_6_class_init,
};
@@ -416,7 +419,6 @@ static void pc_q35_machine_v1_5_class_init(ObjectClass *oc,
void *data)
PC_Q35_COMPAT_1_5,
{ /* end of list */ }
};
- pc_q35_1_6_machine_options(mc);
mc->init = pc_q35_init_1_5;
machine_class_add_compat_props(mc, compat_props);
mc->name = "pc-q35-1.5";
@@ -424,13 +426,12 @@ static void pc_q35_machine_v1_5_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_q35_machine_v1_5_type_info = {
.name = "pc-q35-1.5" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v1_5_class_init,
};
static void pc_q35_1_4_machine_options(MachineClass *mc)
{
- pc_q35_1_6_machine_options(mc);
mc->hot_add_cpu = NULL;
}
@@ -449,12 +450,13 @@ static void pc_q35_machine_v1_4_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_q35_machine_v1_4_type_info = {
.name = "pc-q35-1.4" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_Q35_MACHINE,
.class_init = pc_q35_machine_v1_4_class_init,
};
static void pc_q35_machine_init(void)
{
+ type_register_static(&pc_q35_machine_type_info);
type_register_static(&pc_q35_machine_v2_1_type_info);
type_register_static(&pc_q35_machine_v2_0_type_info);
type_register_static(&pc_q35_machine_v1_7_type_info);
--
1.9.0
- [Qemu-devel] [RFC v2 03/39] piix: Move pc-0.13 virtio-9p-pci compat to PC_COMPAT_0_13, (continued)
- [Qemu-devel] [RFC v2 03/39] piix: Move pc-0.13 virtio-9p-pci compat to PC_COMPAT_0_13, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 02/39] piix: Move pc-0.14 qxl compat properties to PC_COMPAT_0_14, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 05/39] piix: Move pc-0.11 drive version compat props TO PC_COMPAT_0_11, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 06/39] vl.c: Use qdev_prop_register_global() for single globals, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 07/39] machine: Make compat_props a linked list, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 08/39] pc: Register machine classes directly instead of using QEMUMachine, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 10/39] pc: Eliminate pc_default_machine_options(), Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 09/39] pc: Eliminate pc_common_machine_options(), Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 11/39] piix: Eliminate pc_i440fx_machine_options(), Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 13/39] q35: Eliminate pc_q35_1_4_machine_options(), Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 12/39] q35: Eliminate pc_q35_machine_options(),
Eduardo Habkost <=
- [Qemu-devel] [RFC v2 14/39] pc: Eliminate *machine_options macros, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 15/39] piix: Make all *machine_options() functions call the previous one, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 16/39] pc: Eliminate all *_machine_options() functions, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 21/39] pc: Move smbios_defaults to PCMachineClass, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 22/39] pc: Move has_acpi_build to PCMachineClass, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 23/39] pc: Move has_pci_info to PCMachineClass, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 24/39] pc: Move gigabyte_align to PCMachineClass, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 04/39] piix: Move pc-0.1[23] rombar compat props to PC_COMPAT_0_13, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 25/39] pc: Move has_reserved_memory to PCMachineClass, Eduardo Habkost, 2014/06/13
- [Qemu-devel] [RFC v2 26/39] pc: Move option_rom_has_mr/rom_file_has_mr to MachineClass, Eduardo Habkost, 2014/06/13