summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/memremap.h1
-rw-r--r--include/linux/pci-aspm.h36
-rw-r--r--include/linux/pci-p2pdma.h28
-rw-r--r--include/linux/pci.h129
-rw-r--r--include/linux/pci_hotplug.h100
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/uapi/linux/pci_regs.h15
7 files changed, 88 insertions, 224 deletions
diff --git a/include/linux/memremap.h b/include/linux/memremap.h
index f8a5b2a19945..b459518ce475 100644
--- a/include/linux/memremap.h
+++ b/include/linux/memremap.h
@@ -112,7 +112,6 @@ struct dev_pagemap {
112 struct device *dev; 112 struct device *dev;
113 enum memory_type type; 113 enum memory_type type;
114 unsigned int flags; 114 unsigned int flags;
115 u64 pci_p2pdma_bus_offset;
116 const struct dev_pagemap_ops *ops; 115 const struct dev_pagemap_ops *ops;
117}; 116};
118 117
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
deleted file mode 100644
index 67064145d76e..000000000000
--- a/include/linux/pci-aspm.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * aspm.h
4 *
5 * PCI Express ASPM defines and function prototypes
6 *
7 * Copyright (C) 2007 Intel Corp.
8 * Zhang Yanmin (yanmin.zhang@intel.com)
9 * Shaohua Li (shaohua.li@intel.com)
10 *
11 * For more information, please consult the following manuals (look at
12 * http://www.pcisig.com/ for how to get them):
13 *
14 * PCI Express Specification
15 */
16
17#ifndef LINUX_ASPM_H
18#define LINUX_ASPM_H
19
20#include <linux/pci.h>
21
22#define PCIE_LINK_STATE_L0S 1
23#define PCIE_LINK_STATE_L1 2
24#define PCIE_LINK_STATE_CLKPM 4
25
26#ifdef CONFIG_PCIEASPM
27int pci_disable_link_state(struct pci_dev *pdev, int state);
28int pci_disable_link_state_locked(struct pci_dev *pdev, int state);
29void pcie_no_aspm(void);
30#else
31static inline int pci_disable_link_state(struct pci_dev *pdev, int state)
32{ return 0; }
33static inline void pcie_no_aspm(void) { }
34#endif
35
36#endif /* LINUX_ASPM_H */
diff --git a/include/linux/pci-p2pdma.h b/include/linux/pci-p2pdma.h
index bca9bc3e5be7..8318a97c9c61 100644
--- a/include/linux/pci-p2pdma.h
+++ b/include/linux/pci-p2pdma.h
@@ -30,8 +30,10 @@ struct scatterlist *pci_p2pmem_alloc_sgl(struct pci_dev *pdev,
30 unsigned int *nents, u32 length); 30 unsigned int *nents, u32 length);
31void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl); 31void pci_p2pmem_free_sgl(struct pci_dev *pdev, struct scatterlist *sgl);
32void pci_p2pmem_publish(struct pci_dev *pdev, bool publish); 32void pci_p2pmem_publish(struct pci_dev *pdev, bool publish);
33int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 33int pci_p2pdma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
34 enum dma_data_direction dir); 34 int nents, enum dma_data_direction dir, unsigned long attrs);
35void pci_p2pdma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
36 int nents, enum dma_data_direction dir, unsigned long attrs);
35int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev, 37int pci_p2pdma_enable_store(const char *page, struct pci_dev **p2p_dev,
36 bool *use_p2pdma); 38 bool *use_p2pdma);
37ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev, 39ssize_t pci_p2pdma_enable_show(char *page, struct pci_dev *p2p_dev,
@@ -81,11 +83,17 @@ static inline void pci_p2pmem_free_sgl(struct pci_dev *pdev,
81static inline void pci_p2pmem_publish(struct pci_dev *pdev, bool publish) 83static inline void pci_p2pmem_publish(struct pci_dev *pdev, bool publish)
82{ 84{
83} 85}
84static inline int pci_p2pdma_map_sg(struct device *dev, 86static inline int pci_p2pdma_map_sg_attrs(struct device *dev,
85 struct scatterlist *sg, int nents, enum dma_data_direction dir) 87 struct scatterlist *sg, int nents, enum dma_data_direction dir,
88 unsigned long attrs)
86{ 89{
87 return 0; 90 return 0;
88} 91}
92static inline void pci_p2pdma_unmap_sg_attrs(struct device *dev,
93 struct scatterlist *sg, int nents, enum dma_data_direction dir,
94 unsigned long attrs)
95{
96}
89static inline int pci_p2pdma_enable_store(const char *page, 97static inline int pci_p2pdma_enable_store(const char *page,
90 struct pci_dev **p2p_dev, bool *use_p2pdma) 98 struct pci_dev **p2p_dev, bool *use_p2pdma)
91{ 99{
@@ -111,4 +119,16 @@ static inline struct pci_dev *pci_p2pmem_find(struct device *client)
111 return pci_p2pmem_find_many(&client, 1); 119 return pci_p2pmem_find_many(&client, 1);
112} 120}
113 121
122static inline int pci_p2pdma_map_sg(struct device *dev, struct scatterlist *sg,
123 int nents, enum dma_data_direction dir)
124{
125 return pci_p2pdma_map_sg_attrs(dev, sg, nents, dir, 0);
126}
127
128static inline void pci_p2pdma_unmap_sg(struct device *dev,
129 struct scatterlist *sg, int nents, enum dma_data_direction dir)
130{
131 pci_p2pdma_unmap_sg_attrs(dev, sg, nents, dir, 0);
132}
133
114#endif /* _LINUX_PCI_P2P_H */ 134#endif /* _LINUX_PCI_P2P_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c133579c01fa..deecf3cc17b1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -6,12 +6,18 @@
6 * Copyright 1994, Drew Eckhardt 6 * Copyright 1994, Drew Eckhardt
7 * Copyright 1997--1999 Martin Mares <mj@ucw.cz> 7 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
8 * 8 *
9 * PCI Express ASPM defines and function prototypes
10 * Copyright (c) 2007 Intel Corp.
11 * Zhang Yanmin (yanmin.zhang@intel.com)
12 * Shaohua Li (shaohua.li@intel.com)
13 *
9 * For more information, please consult the following manuals (look at 14 * For more information, please consult the following manuals (look at
10 * http://www.pcisig.com/ for how to get them): 15 * http://www.pcisig.com/ for how to get them):
11 * 16 *
12 * PCI BIOS Specification 17 * PCI BIOS Specification
13 * PCI Local Bus Specification 18 * PCI Local Bus Specification
14 * PCI to PCI Bridge Specification 19 * PCI to PCI Bridge Specification
20 * PCI Express Specification
15 * PCI System Design Guide 21 * PCI System Design Guide
16 */ 22 */
17#ifndef LINUX_PCI_H 23#ifndef LINUX_PCI_H
@@ -145,11 +151,6 @@ static inline const char *pci_power_name(pci_power_t state)
145 return pci_power_names[1 + (__force int) state]; 151 return pci_power_names[1 + (__force int) state];
146} 152}
147 153
148#define PCI_PM_D2_DELAY 200
149#define PCI_PM_D3_WAIT 10
150#define PCI_PM_D3COLD_WAIT 100
151#define PCI_PM_BUS_WAIT 50
152
153/** 154/**
154 * typedef pci_channel_state_t 155 * typedef pci_channel_state_t
155 * 156 *
@@ -418,7 +419,6 @@ struct pci_dev {
418 unsigned int broken_intx_masking:1; /* INTx masking can't be used */ 419 unsigned int broken_intx_masking:1; /* INTx masking can't be used */
419 unsigned int io_window_1k:1; /* Intel bridge 1K I/O windows */ 420 unsigned int io_window_1k:1; /* Intel bridge 1K I/O windows */
420 unsigned int irq_managed:1; 421 unsigned int irq_managed:1;
421 unsigned int has_secondary_link:1;
422 unsigned int non_compliant_bars:1; /* Broken BARs; ignore them */ 422 unsigned int non_compliant_bars:1; /* Broken BARs; ignore them */
423 unsigned int is_probed:1; /* Device probing in progress */ 423 unsigned int is_probed:1; /* Device probing in progress */
424 unsigned int link_active_reporting:1;/* Device capable of reporting link active */ 424 unsigned int link_active_reporting:1;/* Device capable of reporting link active */
@@ -649,9 +649,6 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
649 return dev->bus->self; 649 return dev->bus->self;
650} 650}
651 651
652struct device *pci_get_host_bridge_device(struct pci_dev *dev);
653void pci_put_host_bridge_device(struct device *dev);
654
655#ifdef CONFIG_PCI_MSI 652#ifdef CONFIG_PCI_MSI
656static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 653static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
657{ 654{
@@ -925,6 +922,11 @@ enum {
925 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* Scan all, not just dev 0 */ 922 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040, /* Scan all, not just dev 0 */
926}; 923};
927 924
925#define PCI_IRQ_LEGACY (1 << 0) /* Allow legacy interrupts */
926#define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */
927#define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */
928#define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */
929
928/* These external functions are only available when PCI support is enabled */ 930/* These external functions are only available when PCI support is enabled */
929#ifdef CONFIG_PCI 931#ifdef CONFIG_PCI
930 932
@@ -995,7 +997,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
995int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge); 997int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge);
996struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 998struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
997 int busnr); 999 int busnr);
998void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
999struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 1000struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
1000 const char *name, 1001 const char *name,
1001 struct hotplug_slot *hotplug); 1002 struct hotplug_slot *hotplug);
@@ -1241,19 +1242,12 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable);
1241int pci_prepare_to_sleep(struct pci_dev *dev); 1242int pci_prepare_to_sleep(struct pci_dev *dev);
1242int pci_back_from_sleep(struct pci_dev *dev); 1243int pci_back_from_sleep(struct pci_dev *dev);
1243bool pci_dev_run_wake(struct pci_dev *dev); 1244bool pci_dev_run_wake(struct pci_dev *dev);
1244bool pci_check_pme_status(struct pci_dev *dev);
1245void pci_pme_wakeup_bus(struct pci_bus *bus);
1246void pci_d3cold_enable(struct pci_dev *dev); 1245void pci_d3cold_enable(struct pci_dev *dev);
1247void pci_d3cold_disable(struct pci_dev *dev); 1246void pci_d3cold_disable(struct pci_dev *dev);
1248bool pcie_relaxed_ordering_enabled(struct pci_dev *dev); 1247bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
1249void pci_wakeup_bus(struct pci_bus *bus); 1248void pci_wakeup_bus(struct pci_bus *bus);
1250void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state); 1249void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state);
1251 1250
1252/* PCI Virtual Channel */
1253int pci_save_vc_state(struct pci_dev *dev);
1254void pci_restore_vc_state(struct pci_dev *dev);
1255void pci_allocate_vc_save_buffers(struct pci_dev *dev);
1256
1257/* For use by arch with custom probe code */ 1251/* For use by arch with custom probe code */
1258void set_pcie_port_type(struct pci_dev *pdev); 1252void set_pcie_port_type(struct pci_dev *pdev);
1259void set_pcie_hotplug_bridge(struct pci_dev *pdev); 1253void set_pcie_hotplug_bridge(struct pci_dev *pdev);
@@ -1297,8 +1291,6 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
1297void pci_release_selected_regions(struct pci_dev *, int); 1291void pci_release_selected_regions(struct pci_dev *, int);
1298 1292
1299/* drivers/pci/bus.c */ 1293/* drivers/pci/bus.c */
1300struct pci_bus *pci_bus_get(struct pci_bus *bus);
1301void pci_bus_put(struct pci_bus *bus);
1302void pci_add_resource(struct list_head *resources, struct resource *res); 1294void pci_add_resource(struct list_head *resources, struct resource *res);
1303void pci_add_resource_offset(struct list_head *resources, struct resource *res, 1295void pci_add_resource_offset(struct list_head *resources, struct resource *res,
1304 resource_size_t offset); 1296 resource_size_t offset);
@@ -1408,11 +1400,6 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
1408int pci_set_vga_state(struct pci_dev *pdev, bool decode, 1400int pci_set_vga_state(struct pci_dev *pdev, bool decode,
1409 unsigned int command_bits, u32 flags); 1401 unsigned int command_bits, u32 flags);
1410 1402
1411#define PCI_IRQ_LEGACY (1 << 0) /* Allow legacy interrupts */
1412#define PCI_IRQ_MSI (1 << 1) /* Allow MSI interrupts */
1413#define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */
1414#define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */
1415
1416/* 1403/*
1417 * Virtual interrupts allow for more interrupts to be allocated 1404 * Virtual interrupts allow for more interrupts to be allocated
1418 * than the device has interrupts for. These are not programmed 1405 * than the device has interrupts for. These are not programmed
@@ -1517,14 +1504,6 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)
1517} 1504}
1518#endif 1505#endif
1519 1506
1520static inline int
1521pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
1522 unsigned int max_vecs, unsigned int flags)
1523{
1524 return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
1525 NULL);
1526}
1527
1528/** 1507/**
1529 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq 1508 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
1530 * @d: the INTx IRQ domain 1509 * @d: the INTx IRQ domain
@@ -1565,9 +1544,21 @@ extern bool pcie_ports_native;
1565#define pcie_ports_native false 1544#define pcie_ports_native false
1566#endif 1545#endif
1567 1546
1547#define PCIE_LINK_STATE_L0S 1
1548#define PCIE_LINK_STATE_L1 2
1549#define PCIE_LINK_STATE_CLKPM 4
1550
1568#ifdef CONFIG_PCIEASPM 1551#ifdef CONFIG_PCIEASPM
1552int pci_disable_link_state(struct pci_dev *pdev, int state);
1553int pci_disable_link_state_locked(struct pci_dev *pdev, int state);
1554void pcie_no_aspm(void);
1569bool pcie_aspm_support_enabled(void); 1555bool pcie_aspm_support_enabled(void);
1570#else 1556#else
1557static inline int pci_disable_link_state(struct pci_dev *pdev, int state)
1558{ return 0; }
1559static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
1560{ return 0; }
1561static inline void pcie_no_aspm(void) { }
1571static inline bool pcie_aspm_support_enabled(void) { return false; } 1562static inline bool pcie_aspm_support_enabled(void) { return false; }
1572#endif 1563#endif
1573 1564
@@ -1577,23 +1568,8 @@ bool pci_aer_available(void);
1577static inline bool pci_aer_available(void) { return false; } 1568static inline bool pci_aer_available(void) { return false; }
1578#endif 1569#endif
1579 1570
1580#ifdef CONFIG_PCIE_ECRC
1581void pcie_set_ecrc_checking(struct pci_dev *dev);
1582void pcie_ecrc_get_policy(char *str);
1583#else
1584static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
1585static inline void pcie_ecrc_get_policy(char *str) { }
1586#endif
1587
1588bool pci_ats_disabled(void); 1571bool pci_ats_disabled(void);
1589 1572
1590#ifdef CONFIG_PCIE_PTM
1591int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
1592#else
1593static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
1594{ return -EINVAL; }
1595#endif
1596
1597void pci_cfg_access_lock(struct pci_dev *dev); 1573void pci_cfg_access_lock(struct pci_dev *dev);
1598bool pci_cfg_access_trylock(struct pci_dev *dev); 1574bool pci_cfg_access_trylock(struct pci_dev *dev);
1599void pci_cfg_access_unlock(struct pci_dev *dev); 1575void pci_cfg_access_unlock(struct pci_dev *dev);
@@ -1747,11 +1723,6 @@ static inline void pci_release_regions(struct pci_dev *dev) { }
1747 1723
1748static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } 1724static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
1749 1725
1750static inline void pci_block_cfg_access(struct pci_dev *dev) { }
1751static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev)
1752{ return 0; }
1753static inline void pci_unblock_cfg_access(struct pci_dev *dev) { }
1754
1755static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 1726static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
1756{ return NULL; } 1727{ return NULL; }
1757static inline struct pci_dev *pci_get_slot(struct pci_bus *bus, 1728static inline struct pci_dev *pci_get_slot(struct pci_bus *bus,
@@ -1780,17 +1751,36 @@ static inline const struct pci_device_id *pci_match_id(const struct pci_device_i
1780 struct pci_dev *dev) 1751 struct pci_dev *dev)
1781{ return NULL; } 1752{ return NULL; }
1782static inline bool pci_ats_disabled(void) { return true; } 1753static inline bool pci_ats_disabled(void) { return true; }
1754
1755static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
1756{
1757 return -EINVAL;
1758}
1759
1760static inline int
1761pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
1762 unsigned int max_vecs, unsigned int flags,
1763 struct irq_affinity *aff_desc)
1764{
1765 return -ENOSPC;
1766}
1783#endif /* CONFIG_PCI */ 1767#endif /* CONFIG_PCI */
1784 1768
1769static inline int
1770pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
1771 unsigned int max_vecs, unsigned int flags)
1772{
1773 return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags,
1774 NULL);
1775}
1776
1785#ifdef CONFIG_PCI_ATS 1777#ifdef CONFIG_PCI_ATS
1786/* Address Translation Service */ 1778/* Address Translation Service */
1787void pci_ats_init(struct pci_dev *dev);
1788int pci_enable_ats(struct pci_dev *dev, int ps); 1779int pci_enable_ats(struct pci_dev *dev, int ps);
1789void pci_disable_ats(struct pci_dev *dev); 1780void pci_disable_ats(struct pci_dev *dev);
1790int pci_ats_queue_depth(struct pci_dev *dev); 1781int pci_ats_queue_depth(struct pci_dev *dev);
1791int pci_ats_page_aligned(struct pci_dev *dev); 1782int pci_ats_page_aligned(struct pci_dev *dev);
1792#else 1783#else
1793static inline void pci_ats_init(struct pci_dev *d) { }
1794static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; } 1784static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
1795static inline void pci_disable_ats(struct pci_dev *d) { } 1785static inline void pci_disable_ats(struct pci_dev *d) { }
1796static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } 1786static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
@@ -1870,25 +1860,9 @@ static inline const char *pci_name(const struct pci_dev *pdev)
1870 return dev_name(&pdev->dev); 1860 return dev_name(&pdev->dev);
1871} 1861}
1872 1862
1873
1874/*
1875 * Some archs don't want to expose struct resource to userland as-is
1876 * in sysfs and /proc
1877 */
1878#ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER
1879void pci_resource_to_user(const struct pci_dev *dev, int bar, 1863void pci_resource_to_user(const struct pci_dev *dev, int bar,
1880 const struct resource *rsrc, 1864 const struct resource *rsrc,
1881 resource_size_t *start, resource_size_t *end); 1865 resource_size_t *start, resource_size_t *end);
1882#else
1883static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
1884 const struct resource *rsrc, resource_size_t *start,
1885 resource_size_t *end)
1886{
1887 *start = rsrc->start;
1888 *end = rsrc->end;
1889}
1890#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */
1891
1892 1866
1893/* 1867/*
1894 * The world is not perfect and supplies us with broken PCI devices. 1868 * The world is not perfect and supplies us with broken PCI devices.
@@ -2030,10 +2004,6 @@ extern unsigned long pci_cardbus_mem_size;
2030extern u8 pci_dfl_cache_line_size; 2004extern u8 pci_dfl_cache_line_size;
2031extern u8 pci_cache_line_size; 2005extern u8 pci_cache_line_size;
2032 2006
2033extern unsigned long pci_hotplug_io_size;
2034extern unsigned long pci_hotplug_mem_size;
2035extern unsigned long pci_hotplug_bus_size;
2036
2037/* Architecture-specific versions may override these (weak) */ 2007/* Architecture-specific versions may override these (weak) */
2038void pcibios_disable_device(struct pci_dev *dev); 2008void pcibios_disable_device(struct pci_dev *dev);
2039void pcibios_set_master(struct pci_dev *dev); 2009void pcibios_set_master(struct pci_dev *dev);
@@ -2303,10 +2273,6 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
2303#ifdef CONFIG_OF 2273#ifdef CONFIG_OF
2304struct device_node; 2274struct device_node;
2305struct irq_domain; 2275struct irq_domain;
2306void pci_set_of_node(struct pci_dev *dev);
2307void pci_release_of_node(struct pci_dev *dev);
2308void pci_set_bus_of_node(struct pci_bus *bus);
2309void pci_release_bus_of_node(struct pci_bus *bus);
2310struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus); 2276struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);
2311int pci_parse_request_of_pci_ranges(struct device *dev, 2277int pci_parse_request_of_pci_ranges(struct device *dev,
2312 struct list_head *resources, 2278 struct list_head *resources,
@@ -2316,10 +2282,6 @@ int pci_parse_request_of_pci_ranges(struct device *dev,
2316struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); 2282struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
2317 2283
2318#else /* CONFIG_OF */ 2284#else /* CONFIG_OF */
2319static inline void pci_set_of_node(struct pci_dev *dev) { }
2320static inline void pci_release_of_node(struct pci_dev *dev) { }
2321static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
2322static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
2323static inline struct irq_domain * 2285static inline struct irq_domain *
2324pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; } 2286pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }
2325static inline int pci_parse_request_of_pci_ranges(struct device *dev, 2287static inline int pci_parse_request_of_pci_ranges(struct device *dev,
@@ -2433,4 +2395,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type);
2433#define pci_notice_ratelimited(pdev, fmt, arg...) \ 2395#define pci_notice_ratelimited(pdev, fmt, arg...) \
2434 dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg) 2396 dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg)
2435 2397
2398#define pci_info_ratelimited(pdev, fmt, arg...) \
2399 dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
2400
2436#endif /* LINUX_PCI_H */ 2401#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index f694eb2ca978..b482e42d7153 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -86,114 +86,14 @@ void pci_hp_deregister(struct hotplug_slot *slot);
86#define pci_hp_initialize(slot, bus, nr, name) \ 86#define pci_hp_initialize(slot, bus, nr, name) \
87 __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME) 87 __pci_hp_initialize(slot, bus, nr, name, THIS_MODULE, KBUILD_MODNAME)
88 88
89/* PCI Setting Record (Type 0) */
90struct hpp_type0 {
91 u32 revision;
92 u8 cache_line_size;
93 u8 latency_timer;
94 u8 enable_serr;
95 u8 enable_perr;
96};
97
98/* PCI-X Setting Record (Type 1) */
99struct hpp_type1 {
100 u32 revision;
101 u8 max_mem_read;
102 u8 avg_max_split;
103 u16 tot_max_split;
104};
105
106/* PCI Express Setting Record (Type 2) */
107struct hpp_type2 {
108 u32 revision;
109 u32 unc_err_mask_and;
110 u32 unc_err_mask_or;
111 u32 unc_err_sever_and;
112 u32 unc_err_sever_or;
113 u32 cor_err_mask_and;
114 u32 cor_err_mask_or;
115 u32 adv_err_cap_and;
116 u32 adv_err_cap_or;
117 u16 pci_exp_devctl_and;
118 u16 pci_exp_devctl_or;
119 u16 pci_exp_lnkctl_and;
120 u16 pci_exp_lnkctl_or;
121 u32 sec_unc_err_sever_and;
122 u32 sec_unc_err_sever_or;
123 u32 sec_unc_err_mask_and;
124 u32 sec_unc_err_mask_or;
125};
126
127/*
128 * _HPX PCI Express Setting Record (Type 3)
129 */
130struct hpx_type3 {
131 u16 device_type;
132 u16 function_type;
133 u16 config_space_location;
134 u16 pci_exp_cap_id;
135 u16 pci_exp_cap_ver;
136 u16 pci_exp_vendor_id;
137 u16 dvsec_id;
138 u16 dvsec_rev;
139 u16 match_offset;
140 u32 match_mask_and;
141 u32 match_value;
142 u16 reg_offset;
143 u32 reg_mask_and;
144 u32 reg_mask_or;
145};
146
147struct hotplug_program_ops {
148 void (*program_type0)(struct pci_dev *dev, struct hpp_type0 *hpp);
149 void (*program_type1)(struct pci_dev *dev, struct hpp_type1 *hpp);
150 void (*program_type2)(struct pci_dev *dev, struct hpp_type2 *hpp);
151 void (*program_type3)(struct pci_dev *dev, struct hpx_type3 *hpp);
152};
153
154enum hpx_type3_dev_type {
155 HPX_TYPE_ENDPOINT = BIT(0),
156 HPX_TYPE_LEG_END = BIT(1),
157 HPX_TYPE_RC_END = BIT(2),
158 HPX_TYPE_RC_EC = BIT(3),
159 HPX_TYPE_ROOT_PORT = BIT(4),
160 HPX_TYPE_UPSTREAM = BIT(5),
161 HPX_TYPE_DOWNSTREAM = BIT(6),
162 HPX_TYPE_PCI_BRIDGE = BIT(7),
163 HPX_TYPE_PCIE_BRIDGE = BIT(8),
164};
165
166enum hpx_type3_fn_type {
167 HPX_FN_NORMAL = BIT(0),
168 HPX_FN_SRIOV_PHYS = BIT(1),
169 HPX_FN_SRIOV_VIRT = BIT(2),
170};
171
172enum hpx_type3_cfg_loc {
173 HPX_CFG_PCICFG = 0,
174 HPX_CFG_PCIE_CAP = 1,
175 HPX_CFG_PCIE_CAP_EXT = 2,
176 HPX_CFG_VEND_CAP = 3,
177 HPX_CFG_DVSEC = 4,
178 HPX_CFG_MAX,
179};
180
181#ifdef CONFIG_ACPI 89#ifdef CONFIG_ACPI
182#include <linux/acpi.h> 90#include <linux/acpi.h>
183int pci_acpi_program_hp_params(struct pci_dev *dev,
184 const struct hotplug_program_ops *hp_ops);
185bool pciehp_is_native(struct pci_dev *bridge); 91bool pciehp_is_native(struct pci_dev *bridge);
186int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge); 92int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge);
187bool shpchp_is_native(struct pci_dev *bridge); 93bool shpchp_is_native(struct pci_dev *bridge);
188int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 94int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
189int acpi_pci_detect_ejectable(acpi_handle handle); 95int acpi_pci_detect_ejectable(acpi_handle handle);
190#else 96#else
191static inline int pci_acpi_program_hp_params(struct pci_dev *dev,
192 const struct hotplug_program_ops *hp_ops)
193{
194 return -ENODEV;
195}
196
197static inline int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge) 97static inline int acpi_get_hp_hw_control_from_firmware(struct pci_dev *bridge)
198{ 98{
199 return 0; 99 return 0;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c842735a4f45..f3130542c752 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2132,6 +2132,7 @@
2132#define PCI_VENDOR_ID_MYRICOM 0x14c1 2132#define PCI_VENDOR_ID_MYRICOM 0x14c1
2133 2133
2134#define PCI_VENDOR_ID_MEDIATEK 0x14c3 2134#define PCI_VENDOR_ID_MEDIATEK 0x14c3
2135#define PCI_DEVICE_ID_MEDIATEK_7629 0x7629
2135 2136
2136#define PCI_VENDOR_ID_TITAN 0x14D2 2137#define PCI_VENDOR_ID_TITAN 0x14D2
2137#define PCI_DEVICE_ID_TITAN_010L 0x8001 2138#define PCI_DEVICE_ID_TITAN_010L 0x8001
@@ -2570,6 +2571,8 @@
2570 2571
2571#define PCI_VENDOR_ID_ASMEDIA 0x1b21 2572#define PCI_VENDOR_ID_ASMEDIA 0x1b21
2572 2573
2574#define PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS 0x1c36
2575
2573#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8 2576#define PCI_VENDOR_ID_CIRCUITCO 0x1cc8
2574#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001 2577#define PCI_SUBSYSTEM_ID_CIRCUITCO_MINNOWBOARD 0x0001
2575 2578
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index f28e562d7ca8..29d6e93fd15e 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -591,6 +591,7 @@
591#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ 591#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
592#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ 592#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
593#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ 593#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
594#define PCI_EXP_SLTCTL_ATTN_IND_SHIFT 6 /* Attention Indicator shift */
594#define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */ 595#define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */
595#define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */ 596#define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */
596#define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */ 597#define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */
@@ -713,7 +714,9 @@
713#define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */ 714#define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */
714#define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */ 715#define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */
715#define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */ 716#define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */
716#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PTM 717#define PCI_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */
718#define PCI_EXT_CAP_ID_PL_16GT 0x26 /* Physical Layer 16.0 GT/s */
719#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
717 720
718#define PCI_EXT_CAP_DSN_SIZEOF 12 721#define PCI_EXT_CAP_DSN_SIZEOF 12
719#define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40 722#define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
@@ -1053,4 +1056,14 @@
1053#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000 /* LTR_L1.2_THRESHOLD_Scale */ 1056#define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000 /* LTR_L1.2_THRESHOLD_Scale */
1054#define PCI_L1SS_CTL2 0x0c /* Control 2 Register */ 1057#define PCI_L1SS_CTL2 0x0c /* Control 2 Register */
1055 1058
1059/* Data Link Feature */
1060#define PCI_DLF_CAP 0x04 /* Capabilities Register */
1061#define PCI_DLF_EXCHANGE_ENABLE 0x80000000 /* Data Link Feature Exchange Enable */
1062
1063/* Physical Layer 16.0 GT/s */
1064#define PCI_PL_16GT_LE_CTRL 0x20 /* Lane Equalization Control Register */
1065#define PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK 0x0000000F
1066#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK 0x000000F0
1067#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT 4
1068
1056#endif /* LINUX_PCI_REGS_H */ 1069#endif /* LINUX_PCI_REGS_H */