aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorWilliams, Mitch A <mitch.a.williams@intel.com>2010-02-09 20:43:04 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-12 19:56:07 -0500
commitfb8a0d9d1bfd1e4355f307e86a6da7209eefd5f3 (patch)
tree99f23a4bc7c51343619f63970e5d017d75b5a66f /include/linux/pci.h
parent81d54ec8479a2c695760da81f05b5a9fb2dbe40a (diff)
pci: Add SR-IOV convenience functions and macros
Add and export pci_num_vf to allow other subsystems to determine how many virtual function devices are associated with an SR-IOV physical function device. Add macros dev_is_pci, dev_is_ps, and dev_num_vf to make it easier for non-PCI specific code to determine SR-IOV capabilities. Signed-off-by: Mitch Williams <mitch.a.williams@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 174e5392e51e..59a98e2ee2c6 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -612,6 +612,9 @@ extern void pci_remove_bus_device(struct pci_dev *dev);
612extern void pci_stop_bus_device(struct pci_dev *dev); 612extern void pci_stop_bus_device(struct pci_dev *dev);
613void pci_setup_cardbus(struct pci_bus *bus); 613void pci_setup_cardbus(struct pci_bus *bus);
614extern void pci_sort_breadthfirst(void); 614extern void pci_sort_breadthfirst(void);
615#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
616#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
617#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0))
615 618
616/* Generic PCI functions exported to card drivers */ 619/* Generic PCI functions exported to card drivers */
617 620
@@ -1129,6 +1132,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1129 unsigned int devfn) 1132 unsigned int devfn)
1130{ return NULL; } 1133{ return NULL; }
1131 1134
1135#define dev_is_pci(d) (false)
1136#define dev_is_pf(d) (false)
1137#define dev_num_vf(d) (0)
1132#endif /* CONFIG_PCI */ 1138#endif /* CONFIG_PCI */
1133 1139
1134/* Include architecture-dependent settings and functions */ 1140/* Include architecture-dependent settings and functions */
@@ -1286,6 +1292,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1286extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1292extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1287extern void pci_disable_sriov(struct pci_dev *dev); 1293extern void pci_disable_sriov(struct pci_dev *dev);
1288extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1294extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1295extern int pci_num_vf(struct pci_dev *dev);
1289#else 1296#else
1290static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1297static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1291{ 1298{
@@ -1298,6 +1305,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1298{ 1305{
1299 return IRQ_NONE; 1306 return IRQ_NONE;
1300} 1307}
1308static inline int pci_num_vf(struct pci_dev *dev)
1309{
1310 return 0;
1311}
1301#endif 1312#endif
1302 1313
1303#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1314#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)