From: Kouya Shimura Subject: [PATCH][IOEMU] fix invisibility of PCI Option ROM Date: Fri, 28 Nov 2008 14:29:28 +0900 Message-ID: <7kd4ggctaf.fsf@pingu.sky.yk.fujitsu.co.jp> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wuB22k7vQI" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --wuB22k7vQI Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit 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 --wuB22k7vQI Content-Type: text/x-patch Content-Disposition: inline; filename="pt_pci_rom.patch" Content-Transfer-Encoding: 7bit diff --git a/hw/pass-through.c b/hw/pass-through.c index 77ab759..c5d2ead 100644 --- a/hw/pass-through.c +++ b/hw/pass-through.c @@ -1088,6 +1088,13 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val, break; case 4: read_val = pci_read_long(pci_dev, address); + + /* use the address reported by OS but not by the device */ + if ((address == PCI_ROM_ADDRESS) && + (read_val & PCI_ROM_ADDRESS_MASK) == 0 && + (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) != 0) + read_val = (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) | + (read_val & (~PCI_ROM_ADDRESS_MASK)); break; } @@ -1265,6 +1272,13 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len) break; case 4: val = pci_read_long(pci_dev, address); + + /* use the address reported by OS but not by the device */ + if ((address == PCI_ROM_ADDRESS) && + (val & PCI_ROM_ADDRESS_MASK) == 0 && + (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) != 0) + val = (pci_dev->rom_base_addr & PCI_ROM_ADDRESS_MASK) | + (val & (~PCI_ROM_ADDRESS_MASK)); break; } --wuB22k7vQI Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --wuB22k7vQI--