qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 03/18] pc: add PC object argument to some init functio


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 03/18] pc: add PC object argument to some init functions
Date: Wed, 3 Oct 2012 10:28:59 -0300

Add an extra argument to:
 - pc_memory_init()
 - bochs_bios_init()
 - pc_cpus_init()
 - pc_new_cpu()

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/pc.c      | 13 +++++++------
 hw/pc.h      |  5 +++--
 hw/pc_piix.c |  4 ++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 9b68282..3cf56de 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -585,7 +585,7 @@ int e820_add_entry(uint64_t address, uint64_t length, 
uint32_t type)
     return index;
 }
 
-static void *bochs_bios_init(void)
+static void *bochs_bios_init(PC *pc)
 {
     void *fw_cfg;
     uint8_t *smbios_table;
@@ -903,7 +903,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
     }
 }
 
-static X86CPU *pc_new_cpu(const char *cpu_model)
+static X86CPU *pc_new_cpu(PC *pc, const char *cpu_model)
 {
     X86CPU *cpu;
     CPUX86State *env;
@@ -921,7 +921,7 @@ static X86CPU *pc_new_cpu(const char *cpu_model)
     return cpu;
 }
 
-void pc_cpus_init(const char *cpu_model)
+void pc_cpus_init(PC *pc, const char *cpu_model)
 {
     int i;
 
@@ -935,11 +935,12 @@ void pc_cpus_init(const char *cpu_model)
     }
 
     for(i = 0; i < smp_cpus; i++) {
-        pc_new_cpu(cpu_model);
+        pc_new_cpu(pc, cpu_model);
     }
 }
 
-void *pc_memory_init(MemoryRegion *system_memory,
+void *pc_memory_init(PC *pc,
+                    MemoryRegion *system_memory,
                     const char *kernel_filename,
                     const char *kernel_cmdline,
                     const char *initrd_filename,
@@ -988,7 +989,7 @@ void *pc_memory_init(MemoryRegion *system_memory,
                                         option_rom_mr,
                                         1);
 
-    fw_cfg = bochs_bios_init();
+    fw_cfg = bochs_bios_init(pc);
     rom_set_fw(fw_cfg);
 
     if (linux_boot) {
diff --git a/hw/pc.h b/hw/pc.h
index 77e898f..f1ca54e 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -111,8 +111,9 @@ typedef struct PC PC;
 void pc_register_ferr_irq(qemu_irq irq);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
-void pc_cpus_init(const char *cpu_model);
-void *pc_memory_init(MemoryRegion *system_memory,
+void pc_cpus_init(PC *pc, const char *cpu_model);
+void *pc_memory_init(PC *pc,
+                    MemoryRegion *system_memory,
                     const char *kernel_filename,
                     const char *kernel_cmdline,
                     const char *initrd_filename,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 28b5f8a..f861907 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -150,7 +150,7 @@ static void pc_init1(MemoryRegion *system_memory,
     void *fw_cfg = NULL;
     PC *pc = PC(object_new(TYPE_PC_MACHINE));
 
-    pc_cpus_init(cpu_model);
+    pc_cpus_init(pc, cpu_model);
 
     if (kvmclock_enabled) {
         kvmclock_create();
@@ -175,7 +175,7 @@ static void pc_init1(MemoryRegion *system_memory,
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        fw_cfg = pc_memory_init(system_memory,
+        fw_cfg = pc_memory_init(pc, system_memory,
                        kernel_filename, kernel_cmdline, initrd_filename,
                        below_4g_mem_size, above_4g_mem_size,
                        pci_enabled ? rom_memory : system_memory, &ram_memory);
-- 
1.7.11.4




reply via email to

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