From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 5/6] pci: allow loading roms via fw_cfg.
Date: Fri, 8 Jan 2010 15:25:41 +0100 [thread overview]
Message-ID: <1262960742-18267-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1262960742-18267-1-git-send-email-kraxel@redhat.com>
This patch adds a pci bus property 'rombar' which specifies whenever
the pci rom should be loaded via pci rom bar (default) or via fw_cfg.
The later can be used for compatibility with older qemu versions where
no pci rom bar is present.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pci.c | 15 +++++++++++++++
hw/pci.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 0814383..c584dba 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -65,6 +65,7 @@ static struct BusInfo pci_bus_info = {
.props = (Property[]) {
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
+ DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
DEFINE_PROP_END_OF_LIST()
}
};
@@ -1477,6 +1478,20 @@ static int pci_add_option_rom(PCIDevice *pdev)
if (strlen(pdev->romfile) == 0)
return 0;
+ if (!pdev->rom_bar) {
+ /*
+ * Load rom via fw_cfg instead of creating a rom bar,
+ * for 0.11 compatibility.
+ */
+ int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
+ if (class == 0x0300) {
+ rom_add_vga(pdev->romfile);
+ } else {
+ rom_add_option(pdev->romfile);
+ }
+ return 0;
+ }
+
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = qemu_strdup(pdev->romfile);
diff --git a/hw/pci.h b/hw/pci.h
index fd16460..5d8bf97 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -244,6 +244,7 @@ struct PCIDevice {
/* Location of option rom */
char *romfile;
ram_addr_t rom_offset;
+ uint32_t rom_bar;
};
PCIDevice *pci_register_device(PCIBus *bus, const char *name,
--
1.6.5.2
next prev parent reply other threads:[~2010-01-08 14:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12 Gerd Hoffmann
2010-01-11 19:50 ` Anthony Liguori
2010-01-12 17:10 ` Gerd Hoffmann
2010-01-12 19:18 ` Anthony Liguori
2010-01-12 19:36 ` Anthony Liguori
2010-01-12 20:43 ` Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 2/6] roms: minor fixes and cleanups Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 3/6] fw_cfg: rom loader tweaks Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 4/6] roms: rework rom loading via fw Gerd Hoffmann
2010-01-08 14:25 ` Gerd Hoffmann [this message]
2010-01-08 14:25 ` [Qemu-devel] [PATCH 6/6] pc: add rombar to compat properties for pc-0.10 and pc-0.11 Gerd Hoffmann
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=1262960742-18267-6-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).