diff mbox

[RFC,v3,23/35] pc: Move smbios_legacy_mode to PCMachineClass

Message ID 1404519002-10224-24-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost July 5, 2014, 12:09 a.m. UTC
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc_piix.c    | 9 +++++----
 hw/i386/pc_q35.c     | 7 ++++---
 include/hw/i386/pc.h | 1 +
 3 files changed, 10 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e26fedd..22388c1 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -62,7 +62,6 @@  static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
 static bool has_pci_info;
 static bool has_acpi_build = true;
 static bool smbios_defaults = true;
-static bool smbios_legacy_mode;
 /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
  * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
  * pages in the host.
@@ -170,9 +169,10 @@  static void pc_init1(MachineState *machine)
 
     if (smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
+        PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(mc);
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
-                            mc->name, smbios_legacy_mode);
+                            mc->name, pcmc->smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
@@ -297,7 +297,6 @@  static void pc_init_pci(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    smbios_legacy_mode = true;
     has_reserved_memory = false;
 }
 
@@ -405,7 +404,6 @@  static void pc_init_isa(MachineState *machine)
     has_acpi_build = false;
     smbios_defaults = false;
     gigabyte_align = false;
-    smbios_legacy_mode = true;
     has_reserved_memory = false;
     option_rom_has_mr = true;
     rom_file_has_mr = false;
@@ -466,6 +464,7 @@  static const TypeInfo pc_i440fx_machine_v2_1_type_info = {
 static void pc_i440fx_machine_v2_0_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
     static GlobalProperty compat_props[] = {
         PC_COMPAT_2_0,
         { /* end of list */ }
@@ -476,6 +475,7 @@  static void pc_i440fx_machine_v2_0_class_init(ObjectClass *oc, void *data)
     mc->init = pc_init_pci_2_0;
     mc->name = "pc-i440fx-2.0";
     machine_class_add_compat_props(mc, compat_props);
+    pcmc->smbios_legacy_mode = true;
 }
 
 static const TypeInfo pc_i440fx_machine_v2_0_type_info = {
@@ -966,6 +966,7 @@  static void isapc_machine_class_init(ObjectClass *oc, void *data)
         { /* end of list */ }
     };
     pcmc->pci_enabled = false;
+    pcmc->smbios_legacy_mode = true;
     mc->desc = "ISA-only PC";
     mc->init = pc_init_isa;
     mc->max_cpus = 1;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index d50dd89..ad4ff5a 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -52,7 +52,6 @@ 
 static bool has_pci_info;
 static bool has_acpi_build = true;
 static bool smbios_defaults = true;
-static bool smbios_legacy_mode;
 /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
  * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
  * pages in the host.
@@ -158,9 +157,10 @@  static void pc_q35_init(MachineState *machine)
 
     if (smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
+        PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine);
         /* These values are guest ABI, do not change */
         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
-                            mc->name, smbios_legacy_mode);
+                            mc->name, pcmc->smbios_legacy_mode);
     }
 
     /* allocate ram and load rom/bios */
@@ -276,7 +276,6 @@  static void pc_q35_init(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    smbios_legacy_mode = true;
     has_reserved_memory = false;
 }
 
@@ -375,6 +374,7 @@  static TypeInfo pc_q35_machine_v2_1_type_info = {
 static void pc_q35_machine_v2_0_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(oc);
     static GlobalProperty compat_props[] = {
         PC_COMPAT_2_0,
         { /* end of list */ }
@@ -384,6 +384,7 @@  static void pc_q35_machine_v2_0_class_init(ObjectClass *oc, void *data)
     mc->init = pc_q35_init_2_0;
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-2.0";
+    pcmc->smbios_legacy_mode = true;
 }
 
 static TypeInfo pc_q35_machine_v2_0_type_info = {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c08ab37..65ba51e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -55,6 +55,7 @@  struct PCMachineClass {
                                            DeviceState *dev);
     bool pci_enabled;
     bool kvmclock_enabled;
+    bool smbios_legacy_mode;
 };
 
 typedef struct PCMachineState PCMachineState;