[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 11/39] piix: Eliminate pc_i440fx_machine_options()
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC v2 11/39] piix: Eliminate pc_i440fx_machine_options() |
Date: |
Fri, 13 Jun 2014 16:43:50 -0300 |
Instead of calling it on every i440fx class_init function, just register
a common parent class for all i440fx machine-types.
Signed-off-by: Eduardo Habkost <address@hidden>
---
hw/i386/pc_piix.c | 55 +++++++++++++++++++++++++++++--------------------------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index c829aa8..87108d4 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -405,15 +405,25 @@ static void pc_xen_hvm_init(MachineState *machine)
}
#endif
-static void pc_i440fx_machine_options(MachineClass *mc)
+static void pc_i440fx_machine_class_init(ObjectClass *oc, void *data)
{
+ MachineClass *mc = MACHINE_CLASS(oc);
mc->desc = "Standard PC (i440FX + PIIX, 1996)";
mc->hot_add_cpu = pc_hot_add_cpu;
}
+#define TYPE_PC_I440FX_MACHINE "pc-i440fx" TYPE_MACHINE_SUFFIX
+
+static TypeInfo pc_i440fx_machine_type_info = {
+ .name = TYPE_PC_I440FX_MACHINE,
+ .parent = TYPE_PC_MACHINE,
+ .class_init = pc_i440fx_machine_class_init,
+ .abstract = true,
+};
+
+
static void pc_i440fx_2_1_machine_options(MachineClass *mc)
{
- pc_i440fx_machine_options(mc);
mc->default_machine_opts = "firmware=bios-256k.bin";
}
@@ -429,7 +439,7 @@ static void pc_i440fx_machine_v2_1_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v2_1_type_info = {
.name = "pc-i440fx-2.1" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v2_1_class_init,
};
@@ -450,12 +460,10 @@ static void pc_i440fx_machine_v2_0_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v2_0_type_info = {
.name = "pc-i440fx-2.0" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v2_0_class_init,
};
-#define pc_i440fx_1_7_machine_options pc_i440fx_machine_options
-
static void pc_i440fx_machine_v1_7_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -463,7 +471,6 @@ static void pc_i440fx_machine_v1_7_class_init(ObjectClass
*oc, void *data)
PC_COMPAT_1_7,
{ /* end of list */ }
};
- pc_i440fx_1_7_machine_options(mc);
mc->init = pc_init_pci_1_7;
mc->name = "pc-i440fx-1.7";
machine_class_add_compat_props(mc, compat_props);
@@ -471,12 +478,10 @@ static void pc_i440fx_machine_v1_7_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v1_7_type_info = {
.name = "pc-i440fx-1.7" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v1_7_class_init,
};
-#define pc_i440fx_1_6_machine_options pc_i440fx_machine_options
-
static void pc_i440fx_machine_v1_6_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -484,7 +489,6 @@ static void pc_i440fx_machine_v1_6_class_init(ObjectClass
*oc, void *data)
PC_COMPAT_1_6,
{ /* end of list */ }
};
- pc_i440fx_1_6_machine_options(mc);
mc->init = pc_init_pci_1_6;
mc->name = "pc-i440fx-1.6";
machine_class_add_compat_props(mc, compat_props);
@@ -492,7 +496,7 @@ static void pc_i440fx_machine_v1_6_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v1_6_type_info = {
.name = "pc-i440fx-1.6" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v1_6_class_init,
};
@@ -503,7 +507,6 @@ static void pc_i440fx_machine_v1_5_class_init(ObjectClass
*oc, void *data)
PC_COMPAT_1_5,
{ /* end of list */ }
};
- pc_i440fx_1_6_machine_options(mc);
mc->init = pc_init_pci_1_5;
mc->name = "pc-i440fx-1.5";
machine_class_add_compat_props(mc, compat_props);
@@ -511,13 +514,12 @@ static void pc_i440fx_machine_v1_5_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v1_5_type_info = {
.name = "pc-i440fx-1.5" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v1_5_class_init,
};
static void pc_i440fx_1_4_machine_options(MachineClass *mc)
{
- pc_i440fx_1_6_machine_options(mc);
mc->hot_add_cpu = NULL;
}
@@ -536,7 +538,7 @@ static void pc_i440fx_machine_v1_4_class_init(ObjectClass
*oc, void *data)
static TypeInfo pc_i440fx_machine_v1_4_type_info = {
.name = "pc-i440fx-1.4" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_i440fx_machine_v1_4_class_init,
};
@@ -575,7 +577,7 @@ static void pc_machine_v1_3_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v1_3_type_info = {
.name = "pc-1.3" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v1_3_class_init,
};
@@ -627,7 +629,7 @@ static void pc_machine_v1_2_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v1_2_type_info = {
.name = "pc-1.2" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v1_2_class_init,
};
@@ -677,7 +679,7 @@ static void pc_machine_v1_1_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v1_1_type_info = {
.name = "pc-1.1" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v1_1_class_init,
};
@@ -716,7 +718,7 @@ static void pc_machine_v1_0_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v1_0_type_info = {
.name = "pc-1.0" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v1_0_class_init,
};
@@ -738,7 +740,7 @@ static void pc_machine_v0_15_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_15_type_info = {
.name = "pc-0.15" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_15_class_init,
};
@@ -785,7 +787,7 @@ static void pc_machine_v0_14_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_14_type_info = {
.name = "pc-0.14" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_14_class_init,
};
@@ -834,7 +836,7 @@ static void pc_machine_v0_13_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_13_type_info = {
.name = "pc-0.13" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_13_class_init,
};
@@ -877,7 +879,7 @@ static void pc_machine_v0_12_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_12_type_info = {
.name = "pc-0.12" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_12_class_init,
};
@@ -916,7 +918,7 @@ static void pc_machine_v0_11_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_11_type_info = {
.name = "pc-0.11" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_11_class_init,
};
@@ -956,7 +958,7 @@ static void pc_machine_v0_10_class_init(ObjectClass *oc,
void *data)
static TypeInfo pc_machine_v0_10_type_info = {
.name = "pc-0.10" TYPE_MACHINE_SUFFIX,
- .parent = TYPE_PC_MACHINE,
+ .parent = TYPE_PC_I440FX_MACHINE,
.class_init = pc_machine_v0_10_class_init,
};
@@ -1013,6 +1015,7 @@ static TypeInfo xenfv_machine_type_info = {
static void pc_machine_init(void)
{
+ type_register_static(&pc_i440fx_machine_type_info);
type_register_static(&pc_i440fx_machine_v2_1_type_info);
type_register_static(&pc_i440fx_machine_v2_0_type_info);
type_register_static(&pc_i440fx_machine_v1_7_type_info);
--
1.9.0
- [Qemu-devel] [RFC v2 02/39] piix: Move pc-0.14 qxl compat properties to PC_COMPAT_0_14, (continued)
- [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 <=
- [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, 2014/06/13
- [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