qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC v2 20/39] pc: Move smbios_legacy_mode to PCMachineClas


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC v2 20/39] pc: Move smbios_legacy_mode to PCMachineClass
Date: Fri, 13 Jun 2014 16:43:59 -0300

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/i386/pc_piix.c    | 7 ++++---
 hw/i386/pc_q35.c     | 7 ++++---
 include/hw/i386/pc.h | 1 +
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index a1f285d..422656e 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -61,7 +61,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.
@@ -150,9 +149,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 */
@@ -279,7 +279,6 @@ static void pc_init_pci(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    smbios_legacy_mode = true;
     has_reserved_memory = false;
 }
 
@@ -443,6 +442,7 @@ static 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 */ }
@@ -453,6 +453,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 TypeInfo pc_i440fx_machine_v2_0_type_info = {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 8c0fe64..65e4cc4 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -51,7 +51,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.
@@ -137,9 +136,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 */
@@ -257,7 +257,6 @@ static void pc_q35_init(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    smbios_legacy_mode = true;
     has_reserved_memory = false;
 }
 
@@ -356,6 +355,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_Q35_COMPAT_2_0,
         { /* end of list */ }
@@ -365,6 +365,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 4715b72..b767b79 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -51,6 +51,7 @@ struct PCMachineClass {
                                            DeviceState *dev);
     bool pci_enabled;
     bool kvmclock_enabled;
+    bool smbios_legacy_mode;
 };
 
 typedef struct PCMachineState PCMachineState;
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]