]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
fix invisibility of PCI Option ROM
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 4 Dec 2008 10:40:03 +0000 (10:40 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 4 Dec 2008 10:40:03 +0000 (10:40 +0000)
If 'lspci -v' command on Dom0 shows '[virtual]' as follows,
the option ROM can't be read by the guest.

$ lspci -v -s 0:1
...
        [virtual] Expansion ROM at fdb00000 [disabled] [size=256K]

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
hw/pass-through.c

index f07608770f36b63059199bf3416e37f5ba41c91d..d280ff6b64e04d084983a56005cadde600fb05dd 100644 (file)
@@ -1405,6 +1405,15 @@ static int pt_register_regions(struct pt_dev *assigned_device)
     /* Register expansion ROM address */
     if ( pci_dev->rom_base_addr && pci_dev->rom_size )
     {
+
+        /* Re-set BAR reported by OS, otherwise ROM can't be read. */
+        bar_data = pci_read_long(pci_dev, PCI_ROM_ADDRESS);
+        if ( (bar_data & PCI_ROM_ADDRESS_MASK) == 0 )
+        {
+            bar_data |= (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK);
+            pci_write_long(pci_dev, PCI_ROM_ADDRESS, bar_data);
+        }
+
         assigned_device->bases[PCI_ROM_SLOT].e_physbase =
             pci_dev->rom_base_addr;
         assigned_device->bases[PCI_ROM_SLOT].access.maddr =