aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 12:47:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 12:47:12 -0400
commite76e5b2c663ac74ae6a542ac20795c625e36a5cd (patch)
tree2e7271be1f3a26832f4b121839fc4044fbbf27a6 /include/linux/pci.h
parent32527bc0e4b4fa7711ad1c923cf64ae72a7ffd9d (diff)
parenteeafda70bf2807544e96fa4e52b2433cd470ff46 (diff)
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (88 commits) PCI: fix HT MSI mapping fix PCI: don't enable too much HT MSI mapping x86/PCI: make pci=lastbus=255 work when acpi is on PCI: save and restore PCIe 2.0 registers PCI: update fakephp for bus_id removal PCI: fix kernel oops on bridge removal PCI: fix conflict between SR-IOV and config space sizing powerpc/PCI: include pci.h in powerpc MSI implementation PCI Hotplug: schedule fakephp for feature removal PCI Hotplug: rename legacy_fakephp to fakephp PCI Hotplug: restore fakephp interface with complete reimplementation PCI: Introduce /sys/bus/pci/devices/.../rescan PCI: Introduce /sys/bus/pci/devices/.../remove PCI: Introduce /sys/bus/pci/rescan PCI: Introduce pci_rescan_bus() PCI: do not enable bridges more than once PCI: do not initialize bridges more than once PCI: always scan child buses PCI: pci_scan_slot() returns newly found devices PCI: don't scan existing devices ... Fix trivial append-only conflict in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h61
1 files changed, 57 insertions, 4 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index df3644132617..a7fe4bbd7ff1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -52,6 +52,7 @@
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/irqreturn.h>
55 56
56/* Include the ID list */ 57/* Include the ID list */
57#include <linux/pci_ids.h> 58#include <linux/pci_ids.h>
@@ -93,6 +94,12 @@ enum {
93 /* #6: expansion ROM resource */ 94 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE, 95 PCI_ROM_RESOURCE,
95 96
97 /* device specific resources */
98#ifdef CONFIG_PCI_IOV
99 PCI_IOV_RESOURCES,
100 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
101#endif
102
96 /* resources assigned to buses behind the bridge */ 103 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4 104#define PCI_BRIDGE_RESOURCE_NUM 4
98 105
@@ -180,6 +187,7 @@ struct pci_cap_saved_state {
180 187
181struct pcie_link_state; 188struct pcie_link_state;
182struct pci_vpd; 189struct pci_vpd;
190struct pci_sriov;
183 191
184/* 192/*
185 * The pci_dev structure is used to describe PCI devices. 193 * The pci_dev structure is used to describe PCI devices.
@@ -257,6 +265,8 @@ struct pci_dev {
257 unsigned int is_managed:1; 265 unsigned int is_managed:1;
258 unsigned int is_pcie:1; 266 unsigned int is_pcie:1;
259 unsigned int state_saved:1; 267 unsigned int state_saved:1;
268 unsigned int is_physfn:1;
269 unsigned int is_virtfn:1;
260 pci_dev_flags_t dev_flags; 270 pci_dev_flags_t dev_flags;
261 atomic_t enable_cnt; /* pci_enable_device has been called */ 271 atomic_t enable_cnt; /* pci_enable_device has been called */
262 272
@@ -270,6 +280,12 @@ struct pci_dev {
270 struct list_head msi_list; 280 struct list_head msi_list;
271#endif 281#endif
272 struct pci_vpd *vpd; 282 struct pci_vpd *vpd;
283#ifdef CONFIG_PCI_IOV
284 union {
285 struct pci_sriov *sriov; /* SR-IOV capability related */
286 struct pci_dev *physfn; /* the PF this VF is associated with */
287 };
288#endif
273}; 289};
274 290
275extern struct pci_dev *alloc_pci_dev(void); 291extern struct pci_dev *alloc_pci_dev(void);
@@ -341,6 +357,15 @@ struct pci_bus {
341#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 357#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
342#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 358#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
343 359
360/*
361 * Returns true if the pci bus is root (behind host-pci bridge),
362 * false otherwise
363 */
364static inline bool pci_is_root_bus(struct pci_bus *pbus)
365{
366 return !(pbus->parent);
367}
368
344#ifdef CONFIG_PCI_MSI 369#ifdef CONFIG_PCI_MSI
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 370static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
346{ 371{
@@ -528,7 +553,7 @@ void pcibios_update_irq(struct pci_dev *, int irq);
528/* Generic PCI functions used internally */ 553/* Generic PCI functions used internally */
529 554
530extern struct pci_bus *pci_find_bus(int domain, int busnr); 555extern struct pci_bus *pci_find_bus(int domain, int busnr);
531void pci_bus_add_devices(struct pci_bus *bus); 556void pci_bus_add_devices(const struct pci_bus *bus);
532struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 557struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
533 struct pci_ops *ops, void *sysdata); 558 struct pci_ops *ops, void *sysdata);
534static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 559static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
@@ -702,6 +727,9 @@ int pci_back_from_sleep(struct pci_dev *dev);
702 727
703/* Functions for PCI Hotplug drivers to use */ 728/* Functions for PCI Hotplug drivers to use */
704int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 729int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
730#ifdef CONFIG_HOTPLUG
731unsigned int pci_rescan_bus(struct pci_bus *bus);
732#endif
705 733
706/* Vital product data routines */ 734/* Vital product data routines */
707ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 735ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -709,7 +737,7 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
709int pci_vpd_truncate(struct pci_dev *dev, size_t size); 737int pci_vpd_truncate(struct pci_dev *dev, size_t size);
710 738
711/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 739/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
712void pci_bus_assign_resources(struct pci_bus *bus); 740void pci_bus_assign_resources(const struct pci_bus *bus);
713void pci_bus_size_bridges(struct pci_bus *bus); 741void pci_bus_size_bridges(struct pci_bus *bus);
714int pci_claim_resource(struct pci_dev *, int); 742int pci_claim_resource(struct pci_dev *, int);
715void pci_assign_unassigned_resources(void); 743void pci_assign_unassigned_resources(void);
@@ -790,7 +818,7 @@ struct msix_entry {
790 818
791 819
792#ifndef CONFIG_PCI_MSI 820#ifndef CONFIG_PCI_MSI
793static inline int pci_enable_msi(struct pci_dev *dev) 821static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
794{ 822{
795 return -1; 823 return -1;
796} 824}
@@ -800,6 +828,10 @@ static inline void pci_msi_shutdown(struct pci_dev *dev)
800static inline void pci_disable_msi(struct pci_dev *dev) 828static inline void pci_disable_msi(struct pci_dev *dev)
801{ } 829{ }
802 830
831static inline int pci_msix_table_size(struct pci_dev *dev)
832{
833 return 0;
834}
803static inline int pci_enable_msix(struct pci_dev *dev, 835static inline int pci_enable_msix(struct pci_dev *dev,
804 struct msix_entry *entries, int nvec) 836 struct msix_entry *entries, int nvec)
805{ 837{
@@ -821,9 +853,10 @@ static inline int pci_msi_enabled(void)
821 return 0; 853 return 0;
822} 854}
823#else 855#else
824extern int pci_enable_msi(struct pci_dev *dev); 856extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
825extern void pci_msi_shutdown(struct pci_dev *dev); 857extern void pci_msi_shutdown(struct pci_dev *dev);
826extern void pci_disable_msi(struct pci_dev *dev); 858extern void pci_disable_msi(struct pci_dev *dev);
859extern int pci_msix_table_size(struct pci_dev *dev);
827extern int pci_enable_msix(struct pci_dev *dev, 860extern int pci_enable_msix(struct pci_dev *dev,
828 struct msix_entry *entries, int nvec); 861 struct msix_entry *entries, int nvec);
829extern void pci_msix_shutdown(struct pci_dev *dev); 862extern void pci_msix_shutdown(struct pci_dev *dev);
@@ -842,6 +875,8 @@ static inline int pcie_aspm_enabled(void)
842extern int pcie_aspm_enabled(void); 875extern int pcie_aspm_enabled(void);
843#endif 876#endif
844 877
878#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
879
845#ifdef CONFIG_HT_IRQ 880#ifdef CONFIG_HT_IRQ
846/* The functions a driver should call */ 881/* The functions a driver should call */
847int ht_create_irq(struct pci_dev *dev, int idx); 882int ht_create_irq(struct pci_dev *dev, int idx);
@@ -1195,5 +1230,23 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
1195 1230
1196void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1231void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1197 1232
1233#ifdef CONFIG_PCI_IOV
1234extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1235extern void pci_disable_sriov(struct pci_dev *dev);
1236extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1237#else
1238static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1239{
1240 return -ENODEV;
1241}
1242static inline void pci_disable_sriov(struct pci_dev *dev)
1243{
1244}
1245static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1246{
1247 return IRQ_NONE;
1248}
1249#endif
1250
1198#endif /* __KERNEL__ */ 1251#endif /* __KERNEL__ */
1199#endif /* LINUX_PCI_H */ 1252#endif /* LINUX_PCI_H */