summaryrefslogtreecommitdiffstats
path: root/hw/pci.h
diff options
context:
space:
mode:
authoraliguori2009-02-11 16:19:46 +0100
committeraliguori2009-02-11 16:19:46 +0100
commit3ae806189842c70cf47e041b3c498c65683e5a21 (patch)
treed4edd33a1e03aef31b8b061f01e5c3ed563f8e43 /hw/pci.h
parentAdd a description for the set_link monitor command. (diff)
downloadqemu-3ae806189842c70cf47e041b3c498c65683e5a21.tar.gz
qemu-3ae806189842c70cf47e041b3c498c65683e5a21.tar.xz
qemu-3ae806189842c70cf47e041b3c498c65683e5a21.zip
qemu: add pci helper functions (Marcelo Tosatti)
Add pci_find_bus/pci_find_device to be used by PCI hotplug. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6592 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pci.h')
-rw-r--r--hw/pci.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/pci.h b/hw/pci.h
index edb0594924..255ba30818 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -8,6 +8,10 @@
extern target_phys_addr_t pci_mem_base;
+#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
+#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
+#define PCI_FUNC(devfn) ((devfn) & 0x07)
+
/* Device classes and subclasses */
#define PCI_CLASS_STORAGE_SCSI 0x0100
@@ -222,6 +226,8 @@ void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len);
uint32_t pci_data_read(void *opaque, uint32_t addr, int len);
int pci_bus_num(PCIBus *s);
void pci_for_each_device(int bus_num, void (*fn)(PCIDevice *d));
+PCIBus *pci_find_bus(int bus_num);
+PCIDevice *pci_find_device(int bus_num, int slot, int function);
void pci_info(void);
PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,