Patchwork [v10,8/8] pc: enable system flash for pc-1.1

login
register
mail settings
Submitter jordan.l.justen@intel.com
Date Jan. 8, 2012, 7:51 p.m.
Message ID <1326052300-1172-9-git-send-email-jordan.l.justen@intel.com>
Download mbox | patch
Permalink /patch/134931/
State New
Headers show

Comments

jordan.l.justen@intel.com - Jan. 8, 2012, 7:51 p.m.
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 hw/pc.c      |    5 +++--
 hw/pc.h      |    3 ++-
 hw/pc_piix.c |   33 +++++++++++++++++++++++++--------
 3 files changed, 30 insertions(+), 11 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 7a7af90..4af9974 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -967,7 +967,8 @@  void pc_memory_init(MemoryRegion *system_memory,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
                     MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory)
+                    MemoryRegion **ram_memory,
+                    int system_flash_enabled)
 {
     int linux_boot, i;
     MemoryRegion *ram, *option_rom_mr;
@@ -999,7 +1000,7 @@  void pc_memory_init(MemoryRegion *system_memory,
 
 
     /* Initialize PC system firmware */
-    pc_system_firmware_init(rom_memory, 0);
+    pc_system_firmware_init(rom_memory, system_flash_enabled);
 
     option_rom_mr = g_malloc(sizeof(*option_rom_mr));
     memory_region_init_ram(option_rom_mr, "pc.rom", PC_ROM_SIZE);
diff --git a/hw/pc.h b/hw/pc.h
index ca5e76b..c32def1 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -139,7 +139,8 @@  void pc_memory_init(MemoryRegion *system_memory,
                     ram_addr_t below_4g_mem_size,
                     ram_addr_t above_4g_mem_size,
                     MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory);
+                    MemoryRegion **ram_memory,
+                    int system_flash_enabled);
 qemu_irq *pc_allocate_cpu_irq(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index aea95e4..c9ace4f 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -79,7 +79,8 @@  static void pc_init1(MemoryRegion *system_memory,
                      const char *initrd_filename,
                      const char *cpu_model,
                      int pci_enabled,
-                     int kvmclock_enabled)
+                     int kvmclock_enabled,
+                     int system_flash_enabled)
 {
     int i;
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
@@ -130,7 +131,8 @@  static void pc_init1(MemoryRegion *system_memory,
         pc_memory_init(system_memory,
                        kernel_filename, kernel_cmdline, initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
-                       pci_enabled ? rom_memory : system_memory, &ram_memory);
+                       pci_enabled ? rom_memory : system_memory, &ram_memory,
+                       system_flash_enabled);
     }
 
     gsi_state = g_malloc0(sizeof(*gsi_state));
@@ -263,7 +265,21 @@  static void pc_init_pci(ram_addr_t ram_size,
              get_system_io(),
              ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 1, 1);
+             initrd_filename, cpu_model, 1, 1, 1);
+}
+
+static void pc_init_pci_system_rom_only(ram_addr_t ram_size,
+                                        const char *boot_device,
+                                        const char *kernel_filename,
+                                        const char *kernel_cmdline,
+                                        const char *initrd_filename,
+                                        const char *cpu_model)
+{
+    pc_init1(get_system_memory(),
+             get_system_io(),
+             ram_size, boot_device,
+             kernel_filename, kernel_cmdline,
+             initrd_filename, cpu_model, 1, 1, 0);
 }
 
 static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
@@ -277,7 +293,7 @@  static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
              get_system_io(),
              ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 1, 0);
+             initrd_filename, cpu_model, 1, 0, 0);
 }
 
 static void pc_init_isa(ram_addr_t ram_size,
@@ -293,7 +309,7 @@  static void pc_init_isa(ram_addr_t ram_size,
              get_system_io(),
              ram_size, boot_device,
              kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 0, 1);
+             initrd_filename, cpu_model, 0, 1, 0);
 }
 
 #ifdef CONFIG_XEN
@@ -326,21 +342,21 @@  static QEMUMachine pc_machine_v1_1 = {
 static QEMUMachine pc_machine_v1_0 = {
     .name = "pc-1.0",
     .desc = "Standard PC",
-    .init = pc_init_pci,
+    .init = pc_init_pci_system_rom_only,
     .max_cpus = 255,
 };
 
 static QEMUMachine pc_machine_v0_15 = {
     .name = "pc-0.15",
     .desc = "Standard PC",
-    .init = pc_init_pci,
+    .init = pc_init_pci_system_rom_only,
     .max_cpus = 255,
 };
 
 static QEMUMachine pc_machine_v0_14 = {
     .name = "pc-0.14",
     .desc = "Standard PC",
-    .init = pc_init_pci,
+    .init = pc_init_pci_system_rom_only,
     .max_cpus = 255,
     .compat_props = (GlobalProperty[]) {
         {
@@ -619,6 +635,7 @@  static QEMUMachine xenfv_machine = {
 
 static void pc_machine_init(void)
 {
+    qemu_register_machine(&pc_machine_v1_1);
     qemu_register_machine(&pc_machine_v1_0);
     qemu_register_machine(&pc_machine_v0_15);
     qemu_register_machine(&pc_machine_v0_14);