From: Avi Kivity Date: Mon, 8 Aug 2011 13:08:55 +0000 (+0300) Subject: pci: add API to get a BAR's mapped address X-Git-Tag: qemu-xen-4.3.0-rc1~2624 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=16a96f288adccdd84c17c7d1696042a2a2009bfc;p=qemu-upstream-4.4-testing.git pci: add API to get a BAR's mapped address Some (hacky) devices that have a back-channel to read this address back outside the normal configuration mechanisms, such as VMware svga. Reviewed-by: Richard Henderson Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori --- diff --git a/hw/pci.c b/hw/pci.c index 8621d3d2b..c2c269936 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -952,6 +952,11 @@ void pci_register_bar_region(PCIDevice *pci_dev, int region_num, pci_dev->io_regions[region_num].memory = memory; } +pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num) +{ + return pci_dev->io_regions[region_num].addr; +} + static void pci_bridge_filter(PCIDevice *d, pcibus_t *addr, pcibus_t *size, uint8_t type) { diff --git a/hw/pci.h b/hw/pci.h index c51156d21..64282ad18 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -207,6 +207,7 @@ void pci_register_bar_simple(PCIDevice *pci_dev, int region_num, pcibus_t size, uint8_t attr, ram_addr_t ram_addr); void pci_register_bar_region(PCIDevice *pci_dev, int region_num, uint8_t attr, MemoryRegion *memory); +pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num); int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, uint8_t offset, uint8_t size);