summaryrefslogtreecommitdiff
path: root/hw/pci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-01-08 15:25:41 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-11 13:41:00 -0600
commit88169ddf82853ca892ce7bee279579c8a0ac03e5 (patch)
tree23fe323569c5d948ccc6dea7b2e12261942957a1 /hw/pci.c
parent8832cb805dcb65009b979cd8e17d75ac4b03c7e4 (diff)
downloadqemu-88169ddf82853ca892ce7bee279579c8a0ac03e5.tar.gz
qemu-88169ddf82853ca892ce7bee279579c8a0ac03e5.tar.bz2
qemu-88169ddf82853ca892ce7bee279579c8a0ac03e5.zip
pci: allow loading roms via fw_cfg.
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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/pci.c b/hw/pci.c
index 08e51f8d6c..2bdf27e04d 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -64,6 +64,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()
}
};
@@ -1501,6 +1502,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);