qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/4] Expose fw_cfg


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 2/4] Expose fw_cfg
Date: Wed, 17 Jun 2009 16:56:42 +0200

Multiboot passes options to the option rom using the fw_cfg device.
Right now, that device is local to the bochs_bios_init function.

Let's change that and expose it to env, so everyone may put data
in there.

Signed-off-by: Alexander Graf <address@hidden>
---
 hw/pc.c           |    8 +++++---
 target-i386/cpu.h |    3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index f0df669..171447e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -448,7 +448,7 @@ static void bochs_bios_write(void *opaque, uint32_t addr, 
uint32_t val)
 
 extern uint64_t node_cpumask[MAX_NODES];
 
-static void bochs_bios_init(void)
+static void bochs_bios_init(CPUState *env)
 {
     void *fw_cfg;
     uint8_t *smbios_table;
@@ -468,6 +468,8 @@ static void bochs_bios_init(void)
     register_ioport_write(0x503, 1, 1, bochs_bios_write, NULL);
 
     fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
+    env->fw_cfg = fw_cfg;
+
     fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
     fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, (uint8_t *)acpi_tables,
@@ -849,7 +851,7 @@ static void pc_init1(ram_addr_t ram_size,
     int bios_size, isa_bios_size, oprom_area_size;
     PCIBus *pci_bus;
     int piix3_devfn = -1;
-    CPUState *env;
+    CPUState *env = NULL;
     qemu_irq *cpu_irq;
     qemu_irq *i8259;
     int index;
@@ -974,7 +976,7 @@ static void pc_init1(ram_addr_t ram_size,
     cpu_register_physical_memory((uint32_t)(-bios_size),
                                  bios_size, bios_offset | IO_MEM_ROM);
 
-    bochs_bios_init();
+    bochs_bios_init(env);
 
     if (linux_boot) {
         load_linux(0xc0000 + oprom_area_size,
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index d7b32d4..9fef0f7 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -676,6 +676,9 @@ typedef struct CPUX86State {
     /* in order to simplify APIC support, we leave this pointer to the
        user */
     struct APICState *apic_state;
+
+    /* Firmware configuration device */
+    void *fw_cfg;
 } CPUX86State;
 
 CPUX86State *cpu_x86_init(const char *cpu_model);
-- 
1.6.0.2





reply via email to

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