aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h64
1 files changed, 59 insertions, 5 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c446b5ca2d3..9fc01226055 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -49,7 +49,7 @@
49#include <linux/compiler.h> 49#include <linux/compiler.h>
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/kobject.h> 51#include <linux/kobject.h>
52#include <asm/atomic.h> 52#include <linux/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#include <linux/irqreturn.h>
@@ -251,7 +251,8 @@ struct pci_dev {
251 u8 revision; /* PCI revision, low byte of class word */ 251 u8 revision; /* PCI revision, low byte of class word */
252 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 252 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
253 u8 pcie_cap; /* PCI-E capability offset */ 253 u8 pcie_cap; /* PCI-E capability offset */
254 u8 pcie_type; /* PCI-E device/port type */ 254 u8 pcie_type:4; /* PCI-E device/port type */
255 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
255 u8 rom_base_reg; /* which config register controls the ROM */ 256 u8 rom_base_reg; /* which config register controls the ROM */
256 u8 pin; /* which interrupt pin this device uses */ 257 u8 pin; /* which interrupt pin this device uses */
257 258
@@ -617,6 +618,17 @@ struct pci_driver {
617/* these external functions are only available when PCI support is enabled */ 618/* these external functions are only available when PCI support is enabled */
618#ifdef CONFIG_PCI 619#ifdef CONFIG_PCI
619 620
621extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
622
623enum pcie_bus_config_types {
624 PCIE_BUS_TUNE_OFF,
625 PCIE_BUS_SAFE,
626 PCIE_BUS_PERFORMANCE,
627 PCIE_BUS_PEER2PEER,
628};
629
630extern enum pcie_bus_config_types pcie_bus_config;
631
620extern struct bus_type pci_bus_type; 632extern struct bus_type pci_bus_type;
621 633
622/* Do NOT directly access these two variables, unless you are arch specific pci 634/* Do NOT directly access these two variables, unless you are arch specific pci
@@ -796,10 +808,13 @@ int pcix_get_mmrbc(struct pci_dev *dev);
796int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 808int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
797int pcie_get_readrq(struct pci_dev *dev); 809int pcie_get_readrq(struct pci_dev *dev);
798int pcie_set_readrq(struct pci_dev *dev, int rq); 810int pcie_set_readrq(struct pci_dev *dev, int rq);
811int pcie_get_mps(struct pci_dev *dev);
812int pcie_set_mps(struct pci_dev *dev, int mps);
799int __pci_reset_function(struct pci_dev *dev); 813int __pci_reset_function(struct pci_dev *dev);
800int pci_reset_function(struct pci_dev *dev); 814int pci_reset_function(struct pci_dev *dev);
801void pci_update_resource(struct pci_dev *dev, int resno); 815void pci_update_resource(struct pci_dev *dev, int resno);
802int __must_check pci_assign_resource(struct pci_dev *dev, int i); 816int __must_check pci_assign_resource(struct pci_dev *dev, int i);
817int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
803int pci_select_bars(struct pci_dev *dev, unsigned long flags); 818int pci_select_bars(struct pci_dev *dev, unsigned long flags);
804 819
805/* ROM control related routines */ 820/* ROM control related routines */
@@ -843,8 +858,8 @@ void pci_enable_ido(struct pci_dev *dev, unsigned long type);
843void pci_disable_ido(struct pci_dev *dev, unsigned long type); 858void pci_disable_ido(struct pci_dev *dev, unsigned long type);
844 859
845enum pci_obff_signal_type { 860enum pci_obff_signal_type {
846 PCI_EXP_OBFF_SIGNAL_L0, 861 PCI_EXP_OBFF_SIGNAL_L0 = 0,
847 PCI_EXP_OBFF_SIGNAL_ALWAYS, 862 PCI_EXP_OBFF_SIGNAL_ALWAYS = 1,
848}; 863};
849int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); 864int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
850void pci_disable_obff(struct pci_dev *dev); 865void pci_disable_obff(struct pci_dev *dev);
@@ -879,7 +894,7 @@ void pdev_enable_device(struct pci_dev *);
879void pdev_sort_resources(struct pci_dev *, struct resource_list *); 894void pdev_sort_resources(struct pci_dev *, struct resource_list *);
880int pci_enable_resources(struct pci_dev *, int mask); 895int pci_enable_resources(struct pci_dev *, int mask);
881void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 896void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
882 int (*)(struct pci_dev *, u8, u8)); 897 int (*)(const struct pci_dev *, u8, u8));
883#define HAVE_PCI_REQ_REGIONS 2 898#define HAVE_PCI_REQ_REGIONS 2
884int __must_check pci_request_regions(struct pci_dev *, const char *); 899int __must_check pci_request_regions(struct pci_dev *, const char *);
885int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *); 900int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
@@ -1589,5 +1604,44 @@ int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt);
1589int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, 1604int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
1590 unsigned int len, const char *kw); 1605 unsigned int len, const char *kw);
1591 1606
1607/* PCI <-> OF binding helpers */
1608#ifdef CONFIG_OF
1609struct device_node;
1610extern void pci_set_of_node(struct pci_dev *dev);
1611extern void pci_release_of_node(struct pci_dev *dev);
1612extern void pci_set_bus_of_node(struct pci_bus *bus);
1613extern void pci_release_bus_of_node(struct pci_bus *bus);
1614
1615/* Arch may override this (weak) */
1616extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus);
1617
1618static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1619{
1620 return pdev ? pdev->dev.of_node : NULL;
1621}
1622
1623static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
1624{
1625 return bus ? bus->dev.of_node : NULL;
1626}
1627
1628#else /* CONFIG_OF */
1629static inline void pci_set_of_node(struct pci_dev *dev) { }
1630static inline void pci_release_of_node(struct pci_dev *dev) { }
1631static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
1632static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
1633#endif /* CONFIG_OF */
1634
1635/**
1636 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
1637 * @pdev: the PCI device
1638 *
1639 * if the device is PCIE, return NULL
1640 * if the device isn't connected to a PCIe bridge (that is its parent is a
1641 * legacy PCI bridge and the bridge is directly connected to bus 0), return its
1642 * parent
1643 */
1644struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
1645
1592#endif /* __KERNEL__ */ 1646#endif /* __KERNEL__ */
1593#endif /* LINUX_PCI_H */ 1647#endif /* LINUX_PCI_H */