diff options
author | Yu Zhao <yu.zhao@intel.com> | 2009-03-19 23:25:11 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-03-20 13:48:22 -0400 |
commit | d1b054da8f599905f3c18a218961dcf17f9d5f13 (patch) | |
tree | 99b62e6771c3b73142dd0622463bed0e19724342 /drivers/pci/pci.h | |
parent | 8293b0f629095efbe7c7e3f9b437f8c040c19eb5 (diff) |
PCI: initialize and release SR-IOV capability
If a device has the SR-IOV capability, initialize it (set the ARI
Capable Hierarchy in the lowest numbered PF if necessary; calculate
the System Page Size for the VF MMIO, probe the VF Offset, Stride
and BARs). A lock for the VF bus allocation is also initialized if
a PF is the lowest numbered PF.
Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r-- | drivers/pci/pci.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 2cd1cba7236f..7d5327c986f5 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -201,4 +201,41 @@ resource_size_t pci_specified_resource_alignment(struct pci_dev *dev); | |||
201 | extern void pci_disable_bridge_window(struct pci_dev *dev); | 201 | extern void pci_disable_bridge_window(struct pci_dev *dev); |
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | /* Single Root I/O Virtualization */ | ||
205 | struct pci_sriov { | ||
206 | int pos; /* capability position */ | ||
207 | int nres; /* number of resources */ | ||
208 | u32 cap; /* SR-IOV Capabilities */ | ||
209 | u16 ctrl; /* SR-IOV Control */ | ||
210 | u16 total; /* total VFs associated with the PF */ | ||
211 | u16 offset; /* first VF Routing ID offset */ | ||
212 | u16 stride; /* following VF stride */ | ||
213 | u32 pgsz; /* page size for BAR alignment */ | ||
214 | u8 link; /* Function Dependency Link */ | ||
215 | struct pci_dev *dev; /* lowest numbered PF */ | ||
216 | struct pci_dev *self; /* this PF */ | ||
217 | struct mutex lock; /* lock for VF bus */ | ||
218 | }; | ||
219 | |||
220 | #ifdef CONFIG_PCI_IOV | ||
221 | extern int pci_iov_init(struct pci_dev *dev); | ||
222 | extern void pci_iov_release(struct pci_dev *dev); | ||
223 | extern int pci_iov_resource_bar(struct pci_dev *dev, int resno, | ||
224 | enum pci_bar_type *type); | ||
225 | #else | ||
226 | static inline int pci_iov_init(struct pci_dev *dev) | ||
227 | { | ||
228 | return -ENODEV; | ||
229 | } | ||
230 | static inline void pci_iov_release(struct pci_dev *dev) | ||
231 | |||
232 | { | ||
233 | } | ||
234 | static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno, | ||
235 | enum pci_bar_type *type) | ||
236 | { | ||
237 | return 0; | ||
238 | } | ||
239 | #endif /* CONFIG_PCI_IOV */ | ||
240 | |||
204 | #endif /* DRIVERS_PCI_H */ | 241 | #endif /* DRIVERS_PCI_H */ |