mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
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>
This commit is contained in:
parent
81d54ec847
commit
fb8a0d9d1b
2 changed files with 26 additions and 0 deletions
|
@ -612,6 +612,9 @@ extern void pci_remove_bus_device(struct pci_dev *dev);
|
|||
extern void pci_stop_bus_device(struct pci_dev *dev);
|
||||
void pci_setup_cardbus(struct pci_bus *bus);
|
||||
extern void pci_sort_breadthfirst(void);
|
||||
#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
|
||||
#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
|
||||
#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0))
|
||||
|
||||
/* Generic PCI functions exported to card drivers */
|
||||
|
||||
|
@ -1129,6 +1132,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
|
|||
unsigned int devfn)
|
||||
{ return NULL; }
|
||||
|
||||
#define dev_is_pci(d) (false)
|
||||
#define dev_is_pf(d) (false)
|
||||
#define dev_num_vf(d) (0)
|
||||
#endif /* CONFIG_PCI */
|
||||
|
||||
/* Include architecture-dependent settings and functions */
|
||||
|
@ -1286,6 +1292,7 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
|
|||
extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
|
||||
extern void pci_disable_sriov(struct pci_dev *dev);
|
||||
extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
|
||||
extern int pci_num_vf(struct pci_dev *dev);
|
||||
#else
|
||||
static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
|
||||
{
|
||||
|
@ -1298,6 +1305,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
|
|||
{
|
||||
return IRQ_NONE;
|
||||
}
|
||||
static inline int pci_num_vf(struct pci_dev *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue