diff options
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index f27be8432e82..33c2b0b77429 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/kobject.h> | 28 | #include <linux/kobject.h> |
29 | #include <linux/atomic.h> | 29 | #include <linux/atomic.h> |
30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
31 | #include <linux/interrupt.h> | ||
31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
32 | #include <linux/resource_ext.h> | 33 | #include <linux/resource_ext.h> |
33 | #include <uapi/linux/pci.h> | 34 | #include <uapi/linux/pci.h> |
@@ -178,6 +179,10 @@ enum pci_dev_flags { | |||
178 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), | 179 | PCI_DEV_FLAGS_NO_PM_RESET = (__force pci_dev_flags_t) (1 << 7), |
179 | /* Get VPD from function 0 VPD */ | 180 | /* Get VPD from function 0 VPD */ |
180 | PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), | 181 | PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), |
182 | /* a non-root bridge where translation occurs, stop alias search here */ | ||
183 | PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = (__force pci_dev_flags_t) (1 << 9), | ||
184 | /* Do not use FLR even if device advertises PCI_AF_CAP */ | ||
185 | PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), | ||
181 | }; | 186 | }; |
182 | 187 | ||
183 | enum pci_irq_reroute_variant { | 188 | enum pci_irq_reroute_variant { |
@@ -397,6 +402,8 @@ struct pci_dev { | |||
397 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ | 402 | phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ |
398 | size_t romlen; /* Length of ROM if it's not from the BAR */ | 403 | size_t romlen; /* Length of ROM if it's not from the BAR */ |
399 | char *driver_override; /* Driver name to force a match */ | 404 | char *driver_override; /* Driver name to force a match */ |
405 | |||
406 | unsigned long priv_flags; /* Private flags for the pci driver */ | ||
400 | }; | 407 | }; |
401 | 408 | ||
402 | static inline struct pci_dev *pci_physfn(struct pci_dev *dev) | 409 | static inline struct pci_dev *pci_physfn(struct pci_dev *dev) |
@@ -941,32 +948,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn, | |||
941 | 948 | ||
942 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); | 949 | struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops); |
943 | 950 | ||
944 | static inline int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val) | 951 | int pci_read_config_byte(const struct pci_dev *dev, int where, u8 *val); |
945 | { | 952 | int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val); |
946 | return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val); | 953 | int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val); |
947 | } | 954 | int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val); |
948 | static inline int pci_read_config_word(const struct pci_dev *dev, int where, u16 *val) | 955 | int pci_write_config_word(const struct pci_dev *dev, int where, u16 val); |
949 | { | 956 | int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val); |
950 | return pci_bus_read_config_word(dev->bus, dev->devfn, where, val); | ||
951 | } | ||
952 | static inline int pci_read_config_dword(const struct pci_dev *dev, int where, | ||
953 | u32 *val) | ||
954 | { | ||
955 | return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val); | ||
956 | } | ||
957 | static inline int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val) | ||
958 | { | ||
959 | return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val); | ||
960 | } | ||
961 | static inline int pci_write_config_word(const struct pci_dev *dev, int where, u16 val) | ||
962 | { | ||
963 | return pci_bus_write_config_word(dev->bus, dev->devfn, where, val); | ||
964 | } | ||
965 | static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | ||
966 | u32 val) | ||
967 | { | ||
968 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | ||
969 | } | ||
970 | 957 | ||
971 | int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); | 958 | int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); |
972 | int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); | 959 | int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); |
@@ -1053,6 +1040,7 @@ int pcie_get_mps(struct pci_dev *dev); | |||
1053 | int pcie_set_mps(struct pci_dev *dev, int mps); | 1040 | int pcie_set_mps(struct pci_dev *dev, int mps); |
1054 | int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, | 1041 | int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed, |
1055 | enum pcie_link_width *width); | 1042 | enum pcie_link_width *width); |
1043 | void pcie_flr(struct pci_dev *dev); | ||
1056 | int __pci_reset_function(struct pci_dev *dev); | 1044 | int __pci_reset_function(struct pci_dev *dev); |
1057 | int __pci_reset_function_locked(struct pci_dev *dev); | 1045 | int __pci_reset_function_locked(struct pci_dev *dev); |
1058 | int pci_reset_function(struct pci_dev *dev); | 1046 | int pci_reset_function(struct pci_dev *dev); |
@@ -1073,6 +1061,11 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags); | |||
1073 | bool pci_device_is_present(struct pci_dev *pdev); | 1061 | bool pci_device_is_present(struct pci_dev *pdev); |
1074 | void pci_ignore_hotplug(struct pci_dev *dev); | 1062 | void pci_ignore_hotplug(struct pci_dev *dev); |
1075 | 1063 | ||
1064 | int __printf(6, 7) pci_request_irq(struct pci_dev *dev, unsigned int nr, | ||
1065 | irq_handler_t handler, irq_handler_t thread_fn, void *dev_id, | ||
1066 | const char *fmt, ...); | ||
1067 | void pci_free_irq(struct pci_dev *dev, unsigned int nr, void *dev_id); | ||
1068 | |||
1076 | /* ROM control related routines */ | 1069 | /* ROM control related routines */ |
1077 | int pci_enable_rom(struct pci_dev *pdev); | 1070 | int pci_enable_rom(struct pci_dev *pdev); |
1078 | void pci_disable_rom(struct pci_dev *pdev); | 1071 | void pci_disable_rom(struct pci_dev *pdev); |
@@ -1200,6 +1193,11 @@ unsigned long pci_address_to_pio(phys_addr_t addr); | |||
1200 | phys_addr_t pci_pio_to_address(unsigned long pio); | 1193 | phys_addr_t pci_pio_to_address(unsigned long pio); |
1201 | int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr); | 1194 | int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr); |
1202 | void pci_unmap_iospace(struct resource *res); | 1195 | void pci_unmap_iospace(struct resource *res); |
1196 | void __iomem *devm_pci_remap_cfgspace(struct device *dev, | ||
1197 | resource_size_t offset, | ||
1198 | resource_size_t size); | ||
1199 | void __iomem *devm_pci_remap_cfg_resource(struct device *dev, | ||
1200 | struct resource *res); | ||
1203 | 1201 | ||
1204 | static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar) | 1202 | static inline pci_bus_addr_t pci_bus_address(struct pci_dev *pdev, int bar) |
1205 | { | 1203 | { |
@@ -1298,10 +1296,8 @@ struct msix_entry { | |||
1298 | 1296 | ||
1299 | #ifdef CONFIG_PCI_MSI | 1297 | #ifdef CONFIG_PCI_MSI |
1300 | int pci_msi_vec_count(struct pci_dev *dev); | 1298 | int pci_msi_vec_count(struct pci_dev *dev); |
1301 | void pci_msi_shutdown(struct pci_dev *dev); | ||
1302 | void pci_disable_msi(struct pci_dev *dev); | 1299 | void pci_disable_msi(struct pci_dev *dev); |
1303 | int pci_msix_vec_count(struct pci_dev *dev); | 1300 | int pci_msix_vec_count(struct pci_dev *dev); |
1304 | void pci_msix_shutdown(struct pci_dev *dev); | ||
1305 | void pci_disable_msix(struct pci_dev *dev); | 1301 | void pci_disable_msix(struct pci_dev *dev); |
1306 | void pci_restore_msi_state(struct pci_dev *dev); | 1302 | void pci_restore_msi_state(struct pci_dev *dev); |
1307 | int pci_msi_enabled(void); | 1303 | int pci_msi_enabled(void); |
@@ -1327,10 +1323,8 @@ int pci_irq_get_node(struct pci_dev *pdev, int vec); | |||
1327 | 1323 | ||
1328 | #else | 1324 | #else |
1329 | static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } | 1325 | static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } |
1330 | static inline void pci_msi_shutdown(struct pci_dev *dev) { } | ||
1331 | static inline void pci_disable_msi(struct pci_dev *dev) { } | 1326 | static inline void pci_disable_msi(struct pci_dev *dev) { } |
1332 | static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } | 1327 | static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } |
1333 | static inline void pci_msix_shutdown(struct pci_dev *dev) { } | ||
1334 | static inline void pci_disable_msix(struct pci_dev *dev) { } | 1328 | static inline void pci_disable_msix(struct pci_dev *dev) { } |
1335 | static inline void pci_restore_msi_state(struct pci_dev *dev) { } | 1329 | static inline void pci_restore_msi_state(struct pci_dev *dev) { } |
1336 | static inline int pci_msi_enabled(void) { return 0; } | 1330 | static inline int pci_msi_enabled(void) { return 0; } |
@@ -1623,6 +1617,36 @@ static inline int pci_get_new_domain_nr(void) { return -ENOSYS; } | |||
1623 | 1617 | ||
1624 | #include <asm/pci.h> | 1618 | #include <asm/pci.h> |
1625 | 1619 | ||
1620 | /* These two functions provide almost identical functionality. Depennding | ||
1621 | * on the architecture, one will be implemented as a wrapper around the | ||
1622 | * other (in drivers/pci/mmap.c). | ||
1623 | * | ||
1624 | * pci_mmap_resource_range() maps a specific BAR, and vm->vm_pgoff | ||
1625 | * is expected to be an offset within that region. | ||
1626 | * | ||
1627 | * pci_mmap_page_range() is the legacy architecture-specific interface, | ||
1628 | * which accepts a "user visible" resource address converted by | ||
1629 | * pci_resource_to_user(), as used in the legacy mmap() interface in | ||
1630 | * /proc/bus/pci/. | ||
1631 | */ | ||
1632 | int pci_mmap_resource_range(struct pci_dev *dev, int bar, | ||
1633 | struct vm_area_struct *vma, | ||
1634 | enum pci_mmap_state mmap_state, int write_combine); | ||
1635 | int pci_mmap_page_range(struct pci_dev *pdev, int bar, | ||
1636 | struct vm_area_struct *vma, | ||
1637 | enum pci_mmap_state mmap_state, int write_combine); | ||
1638 | |||
1639 | #ifndef arch_can_pci_mmap_wc | ||
1640 | #define arch_can_pci_mmap_wc() 0 | ||
1641 | #endif | ||
1642 | |||
1643 | #ifndef arch_can_pci_mmap_io | ||
1644 | #define arch_can_pci_mmap_io() 0 | ||
1645 | #define pci_iobar_pfn(pdev, bar, vma) (-EINVAL) | ||
1646 | #else | ||
1647 | int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); | ||
1648 | #endif | ||
1649 | |||
1626 | #ifndef pci_root_bus_fwnode | 1650 | #ifndef pci_root_bus_fwnode |
1627 | #define pci_root_bus_fwnode(bus) NULL | 1651 | #define pci_root_bus_fwnode(bus) NULL |
1628 | #endif | 1652 | #endif |