Patchwork [v9,1/3] pc: Add pc-1.1 machine type

login
register
mail settings
Submitter jordan.l.justen@intel.com
Date Dec. 15, 2011, 8:51 p.m.
Message ID <1323982273-13623-2-git-send-email-jordan.l.justen@intel.com>
Download mbox | patch
Permalink /patch/131731/
State New
Headers show

Comments

jordan.l.justen@intel.com - Dec. 15, 2011, 8:51 p.m.
This machine type adds a new system_firmware_enabled
parameter which is passed into pc_memory_init.

This will be used by the system firmware support which
enables a flash memory to be used with qemu.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Avi Kivity <avi@redhat.com>
---
 hw/pc.c      |    3 ++-
 hw/pc.h      |    3 ++-
 hw/pc_piix.c |   40 ++++++++++++++++++++++++++++++++--------
 3 files changed, 36 insertions(+), 10 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 33778fe..cc6cfad 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -971,7 +971,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_firmware_enabled)
 {
     char *filename;
     int ret, linux_boot, i;
diff --git a/hw/pc.h b/hw/pc.h
index b7b7e40..49471cb 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -138,7 +138,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_firmware_enabled);
 qemu_irq *pc_allocate_cpu_irq(void);
 void pc_vga_init(PCIBus *pci_bus);
 void pc_basic_device_init(qemu_irq *gsi,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 970f43c..007f10c 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_firmware_enabled)
 {
     int i;
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
@@ -128,7 +129,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_firmware_enabled);
     }
 
     gsi_state = g_malloc0(sizeof(*gsi_state));
@@ -246,7 +248,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,
@@ -260,7 +276,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,
@@ -276,7 +292,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
@@ -297,8 +313,8 @@  static void pc_xen_hvm_init(ram_addr_t ram_size,
 }
 #endif
 
-static QEMUMachine pc_machine_v1_0 = {
-    .name = "pc-1.0",
+static QEMUMachine pc_machine_v1_1 = {
+    .name = "pc-1.1",
     .alias = "pc",
     .desc = "Standard PC",
     .init = pc_init_pci,
@@ -306,10 +322,17 @@  static QEMUMachine pc_machine_v1_0 = {
     .is_default = 1,
 };
 
+static QEMUMachine pc_machine_v1_0 = {
+    .name = "pc-1.0",
+    .desc = "Standard PC",
+    .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[]) {
         {
@@ -556,6 +579,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_14);
     qemu_register_machine(&pc_machine_v0_13);