diff mbox

[RFC,v3,28/35] pc: Move has_reserved_memory to PCMachineClass

Message ID 1404519002-10224-29-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.c         | 1 +
 hw/i386/pc_piix.c    | 8 +++-----
 hw/i386/pc_q35.c     | 6 ++----
 include/hw/i386/pc.h | 1 +
 4 files changed, 7 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3fe5764..571d47b 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1667,6 +1667,7 @@  static void pc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->smbios_defaults = true;
     pcmc->has_acpi_build = true;
     pcmc->gigabyte_align = true;
+    pcmc->has_reserved_memory = true;
     mc->get_hotplug_handler = pc_get_hotpug_handler;
     mc->default_boot_order = "cad";
     mc->hot_add_cpu = pc_hot_add_cpu;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 1d58798..a9fb9dd 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -59,8 +59,6 @@  static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
 
-static bool has_reserved_memory = true;
-
 /* PC hardware initialisation */
 static void pc_init1(MachineState *machine)
 {
@@ -157,7 +155,7 @@  static void pc_init1(MachineState *machine)
 
     guest_info->has_pci_info = pcmc->has_pci_info;
     guest_info->isapc_ram_fw = !pci_enabled;
-    guest_info->has_reserved_memory = has_reserved_memory;
+    guest_info->has_reserved_memory = pcmc->has_reserved_memory;
 
     if (pcmc->smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -288,7 +286,6 @@  static void pc_init_pci(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    has_reserved_memory = false;
 }
 
 static void pc_compat_1_7(MachineState *machine)
@@ -387,7 +384,6 @@  static void pc_init_pci_no_kvmclock(MachineState *machine)
 
 static void pc_init_isa(MachineState *machine)
 {
-    has_reserved_memory = false;
     option_rom_has_mr = true;
     rom_file_has_mr = false;
     if (!machine->cpu_model) {
@@ -459,6 +455,7 @@  static void pc_i440fx_machine_v2_0_class_init(ObjectClass *oc, void *data)
     mc->name = "pc-i440fx-2.0";
     machine_class_add_compat_props(mc, compat_props);
     pcmc->smbios_legacy_mode = true;
+    pcmc->has_reserved_memory = false;
 }
 
 static const TypeInfo pc_i440fx_machine_v2_0_type_info = {
@@ -965,6 +962,7 @@  static void isapc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->has_acpi_build = false;
     pcmc->has_pci_info = false;
     pcmc->gigabyte_align = false;
+    pcmc->has_reserved_memory = false;
 }
 
 static const TypeInfo isapc_machine_type_info = {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 9b67a67..3f5b0c3 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -49,8 +49,6 @@ 
 /* ICH9 AHCI has 6 ports */
 #define MAX_SATA_PORTS     6
 
-static bool has_reserved_memory = true;
-
 /* PC hardware initialisation */
 static void pc_q35_init(MachineState *machine)
 {
@@ -145,7 +143,7 @@  static void pc_q35_init(MachineState *machine)
     guest_info->has_pci_info = pcmc->has_pci_info;
     guest_info->isapc_ram_fw = false;
     guest_info->has_acpi_build = pcmc->has_acpi_build;
-    guest_info->has_reserved_memory = has_reserved_memory;
+    guest_info->has_reserved_memory = pcmc->has_reserved_memory;
 
     if (pcmc->smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);
@@ -267,7 +265,6 @@  static void pc_q35_init(MachineState *machine)
 
 static void pc_compat_2_0(MachineState *machine)
 {
-    has_reserved_memory = false;
 }
 
 static void pc_compat_1_7(MachineState *machine)
@@ -372,6 +369,7 @@  static void pc_q35_machine_v2_0_class_init(ObjectClass *oc, void *data)
     machine_class_add_compat_props(mc, compat_props);
     mc->name = "pc-q35-2.0";
     pcmc->smbios_legacy_mode = true;
+    pcmc->has_reserved_memory = false;
 }
 
 static TypeInfo pc_q35_machine_v2_0_type_info = {
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c31c1bc..fd7ce10 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -64,6 +64,7 @@  struct PCMachineClass {
      * pages in the host.
      */
     bool gigabyte_align;
+    bool has_reserved_memory;
 };
 
 typedef struct PCMachineState PCMachineState;