aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/pci.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-19 08:45:20 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-19 08:45:20 +0100
commit575dd4a3efc5becee027bd17d0777d421f5e6e4f (patch)
treea0e8160f809cfd2a6cf9541f59d35841afb8ff07 /xen/include/xen/pci.h
parentfaefc018df83806c3135b318425fe6c66ffda1b8 (diff)
downloadxen-575dd4a3efc5becee027bd17d0777d421f5e6e4f.tar.gz
xen-575dd4a3efc5becee027bd17d0777d421f5e6e4f.tar.bz2
xen-575dd4a3efc5becee027bd17d0777d421f5e6e4f.zip
VT-d: pci code cleanup
This patch moves the pci code from iommu.c to pci.c. Instead of setup pci hierarchy in array bus2bridge in iommu_context_mapping, use scan_pci_devices once to add all existed PCI devices in system to alldevs_list and setup pci hierarchy in array bus2bridge. In addition, implement find_upstream_bridge to find the upstream PCIe-to-PCI/PCIX bridge or PCI legacy bridge for a PCI device, therefore it's cleanly to handle context map/unmap for PCI device, even for source-id setting. Signed-off-by: Weidong Han <weidong.han@intel.com>
Diffstat (limited to 'xen/include/xen/pci.h')
-rw-r--r--xen/include/xen/pci.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 86abf2e85f..32ec850a1c 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -66,6 +66,17 @@ struct pci_dev {
extern spinlock_t pcidevs_lock;
+enum {
+ DEV_TYPE_PCIe_ENDPOINT,
+ DEV_TYPE_PCIe_BRIDGE, // PCIe root port, switch
+ DEV_TYPE_PCIe2PCI_BRIDGE, // PCIe-to-PCI/PCIx bridge
+ DEV_TYPE_LEGACY_PCI_BRIDGE, // Legacy PCI bridge
+ DEV_TYPE_PCI,
+};
+
+int scan_pci_devices(void);
+int pdev_type(u8 bus, u8 devfn);
+int find_upstream_bridge(u8 *bus, u8 *devfn, u8 *secbus);
struct pci_dev *alloc_pdev(u8 bus, u8 devfn);
void free_pdev(struct pci_dev *pdev);
struct pci_dev *pci_lock_pdev(int bus, int devfn);