From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, rene@exactcode.de
Subject: [Qemu-devel] [PATCH 2/4] Expose fw_cfg
Date: Wed, 17 Jun 2009 16:56:42 +0200 [thread overview]
Message-ID: <1245250604-6291-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1245250604-6291-2-git-send-email-agraf@suse.de>
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 <agraf@suse.de>
---
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
next prev parent reply other threads:[~2009-06-17 14:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-17 14:56 [Qemu-devel] [PATCH 0/4] Add multiboot support (x86) Alexander Graf
2009-06-17 14:56 ` [Qemu-devel] [PATCH 1/4] Change bochs bios init order Alexander Graf
2009-06-17 14:56 ` Alexander Graf [this message]
2009-06-17 14:56 ` [Qemu-devel] [PATCH 3/4] Multiboot support Alexander Graf
2009-06-17 14:56 ` [Qemu-devel] [PATCH 4/4] Multiboot build system Alexander Graf
2009-06-17 15:16 ` Paul Brook
2009-06-17 15:23 ` Alexander Graf
2009-06-18 7:57 ` [Qemu-devel] " Paolo Bonzini
2009-06-18 10:16 ` Alexander Graf
2009-06-18 10:19 ` Paolo Bonzini
2009-06-17 15:30 ` [Qemu-devel] [PATCH 2/4] Expose fw_cfg Blue Swirl
2009-06-17 15:32 ` Alexander Graf
2009-06-17 15:59 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245250604-6291-3-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rene@exactcode.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).