aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/pci.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-07-04 17:51:42 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-07-04 17:51:42 +0100
commitf800030ddb9dc9b85bf5ab28af612d85b4638c71 (patch)
tree30a8aedf7ebbabca1a590152351b29198645f1fe /xen/include/xen/pci.h
parent8644e176dc6edb9073dacd730035666b36faca74 (diff)
downloadxen-f800030ddb9dc9b85bf5ab28af612d85b4638c71.tar.gz
xen-f800030ddb9dc9b85bf5ab28af612d85b4638c71.tar.bz2
xen-f800030ddb9dc9b85bf5ab28af612d85b4638c71.zip
Restructure VT-d device scope and PCI bridge handling
Create a bitmap for each device scope indicating which buses are covered by the scope. Upon mapping PCI-PCI bridges we now detect whether we have a bridge to a non-PCIe bus. If so, all devices mapped on that bus are squashed to the requester-id of the bridge. Bridges to PCIe busses are ignored. The requester-id squashing also determines the iommu device group id for the device. Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>
Diffstat (limited to 'xen/include/xen/pci.h')
-rw-r--r--xen/include/xen/pci.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 95a87c9301..5c3ad42ef7 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -20,9 +20,13 @@
* 7:3 = slot
* 2:0 = function
*/
-#define PCI_DEVFN(slot,func) (((slot & 0x1f) << 3) | (func & 0x07))
-#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
-#define PCI_FUNC(devfn) ((devfn) & 0x07)
+#define PCI_BUS(bdf) (((bdf) >> 8) & 0xff)
+#define PCI_SLOT(bdf) (((bdf) >> 3) & 0x1f)
+#define PCI_FUNC(bdf) ((bdf) & 0x07)
+#define PCI_DEVFN(d,f) (((d & 0x1f) << 3) | (f & 0x07))
+#define PCI_DEVFN2(bdf) ((bdf) & 0xff)
+#define PCI_BDF(b,d,f) (((b * 0xff) << 8) | PCI_DEVFN(d,f))
+#define PCI_BDF2(b,df) (((b & 0xff) << 8) | (df & 0xff))
struct pci_dev {
struct list_head domain_list;
@@ -32,6 +36,10 @@ struct pci_dev {
struct list_head msi_list;
};
+#define for_each_pdev(domain, pdev) \
+ list_for_each_entry(pdev, &(domain->arch.pdev_list), domain_list)
+
+
uint8_t pci_conf_read8(
unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
uint16_t pci_conf_read16(
@@ -50,9 +58,4 @@ void pci_conf_write32(
int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap);
int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap);
-
-#define for_each_pdev(domain, pdev) \
- list_for_each_entry(pdev, &(domain->arch.pdev_list), domain_list)
-
-
#endif /* __XEN_PCI_H__ */