From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [RFC v5 23/86] pci: add API to get a BAR's mapped address Date: Wed, 20 Jul 2011 19:49:33 +0300 Message-ID: <1311180636-17012-24-git-send-email-avi@redhat.com> References: <1311180636-17012-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48944 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003Ab1GTQur (ORCPT ); Wed, 20 Jul 2011 12:50:47 -0400 In-Reply-To: <1311180636-17012-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This is a hack, for devices that have a back-channel to read this address back outside the normal configuration mechanisms, such as VMware svga. Signed-off-by: Avi Kivity --- hw/pci.c | 5 +++++ hw/pci.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 36db58b..912f849 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 c51156d..64282ad 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); -- 1.7.5.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjaAK-00086L-AG for qemu-devel@nongnu.org; Wed, 20 Jul 2011 13:02:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QjZyx-0004yq-TD for qemu-devel@nongnu.org; Wed, 20 Jul 2011 12:50:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QjZyu-0004uW-7k for qemu-devel@nongnu.org; Wed, 20 Jul 2011 12:50:45 -0400 From: Avi Kivity Date: Wed, 20 Jul 2011 19:49:33 +0300 Message-Id: <1311180636-17012-24-git-send-email-avi@redhat.com> In-Reply-To: <1311180636-17012-1-git-send-email-avi@redhat.com> References: <1311180636-17012-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [RFC v5 23/86] pci: add API to get a BAR's mapped address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org This is a hack, for devices that have a back-channel to read this address back outside the normal configuration mechanisms, such as VMware svga. Signed-off-by: Avi Kivity --- hw/pci.c | 5 +++++ hw/pci.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 36db58b..912f849 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 c51156d..64282ad 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); -- 1.7.5.3