aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 12:30:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 12:30:25 -0400
commit96a3e8af5a54c324535472ca946215d5bafe6539 (patch)
treee59b48aa3fa2b8c6c1f59f76b7b4c71f9c694093 /include
parenta87451052fb914744571fc3ab39fcbf4fa4ef944 (diff)
parentd4f09c5d7fbabd1389a5f03f5c9329d790f544e3 (diff)
Merge tag 'pci-v3.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas: "PCI changes for the v3.10 merge window: PCI device hotplug - Remove ACPI PCI subdrivers (Jiang Liu, Myron Stowe) - Make acpiphp builtin only, not modular (Jiang Liu) - Add acpiphp mutual exclusion (Jiang Liu) Power management - Skip "PME enabled/disabled" messages when not supported (Rafael Wysocki) - Fix fallback to PCI_D0 (Rafael Wysocki) Miscellaneous - Factor quirk_io_region (Yinghai Lu) - Cache MSI capability offsets & cleanup (Gavin Shan, Bjorn Helgaas) - Clean up EISA resource initialization and logging (Bjorn Helgaas) - Fix prototype warnings (Andy Shevchenko, Bjorn Helgaas) - MIPS: Initialize of_node before scanning bus (Gabor Juhos) - Fix pcibios_get_phb_of_node() declaration "weak" annotation (Gabor Juhos) - Add MSI INTX_DISABLE quirks for AR8161/AR8162/etc (Xiong Huang) - Fix aer_inject return values (Prarit Bhargava) - Remove PME/ACPI dependency (Andrew Murray) - Use shared PCI_BUS_NUM() and PCI_DEVID() (Shuah Khan)" * tag 'pci-v3.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (63 commits) vfio-pci: Use cached MSI/MSI-X capabilities vfio-pci: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK PCI: Remove "extern" from function declarations PCI: Use PCI_MSIX_TABLE_BIR, not PCI_MSIX_FLAGS_BIRMASK PCI: Drop msi_mask_reg() and remove drivers/pci/msi.h PCI: Use msix_table_size() directly, drop multi_msix_capable() PCI: Drop msix_table_offset_reg() and msix_pba_offset_reg() macros PCI: Drop is_64bit_address() and is_mask_bit_support() macros PCI: Drop msi_data_reg() macro PCI: Drop msi_lower_address_reg() and msi_upper_address_reg() macros PCI: Drop msi_control_reg() macro and use PCI_MSI_FLAGS directly PCI: Use cached MSI/MSI-X offsets from dev, not from msi_desc PCI: Clean up MSI/MSI-X capability #defines PCI: Use cached MSI-X cap while enabling MSI-X PCI: Use cached MSI cap while enabling MSI interrupts PCI: Remove MSI/MSI-X cap check in pci_msi_check_device() PCI: Cache MSI/MSI-X capability offsets in struct pci_dev PCI: Use u8, not int, for PM capability offset [SCSI] megaraid_sas: Use correct #define for MSI-X capability PCI: Remove "extern" from function declarations ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/acpi.h9
-rw-r--r--include/linux/msi.h23
-rw-r--r--include/linux/pci-acpi.h29
-rw-r--r--include/linux/pci-aspm.h20
-rw-r--r--include/linux/pci-ats.h26
-rw-r--r--include/linux/pci.h117
-rw-r--r--include/linux/pci_hotplug.h12
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pcieport_if.h4
-rw-r--r--include/uapi/linux/pci_regs.h30
10 files changed, 156 insertions, 115 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index bcbdd7484e58..03053aca5b32 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -152,15 +152,6 @@ void acpi_penalize_isa_irq(int irq, int active);
152 152
153void acpi_pci_irq_disable (struct pci_dev *dev); 153void acpi_pci_irq_disable (struct pci_dev *dev);
154 154
155struct acpi_pci_driver {
156 struct list_head node;
157 int (*add)(struct acpi_pci_root *root);
158 void (*remove)(struct acpi_pci_root *root);
159};
160
161int acpi_pci_register_driver(struct acpi_pci_driver *driver);
162void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
163
164extern int ec_read(u8 addr, u8 *val); 155extern int ec_read(u8 addr, u8 *val);
165extern int ec_write(u8 addr, u8 val); 156extern int ec_write(u8 addr, u8 val);
166extern int ec_transaction(u8 command, 157extern int ec_transaction(u8 command,
diff --git a/include/linux/msi.h b/include/linux/msi.h
index ce93a341337d..20c2d6dd5d25 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -13,14 +13,14 @@ struct msi_msg {
13/* Helper functions */ 13/* Helper functions */
14struct irq_data; 14struct irq_data;
15struct msi_desc; 15struct msi_desc;
16extern void mask_msi_irq(struct irq_data *data); 16void mask_msi_irq(struct irq_data *data);
17extern void unmask_msi_irq(struct irq_data *data); 17void unmask_msi_irq(struct irq_data *data);
18extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 18void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
19extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 19void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
20extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); 20void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
21extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 21void read_msi_msg(unsigned int irq, struct msi_msg *msg);
22extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); 22void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
23extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); 23void write_msi_msg(unsigned int irq, struct msi_msg *msg);
24 24
25struct msi_desc { 25struct msi_desc {
26 struct { 26 struct {
@@ -54,9 +54,8 @@ struct msi_desc {
54 */ 54 */
55int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc); 55int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
56void arch_teardown_msi_irq(unsigned int irq); 56void arch_teardown_msi_irq(unsigned int irq);
57extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 57int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
58extern void arch_teardown_msi_irqs(struct pci_dev *dev); 58void arch_teardown_msi_irqs(struct pci_dev *dev);
59extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); 59int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
60
61 60
62#endif /* LINUX_MSI_H */ 61#endif /* LINUX_MSI_H */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 9a22b5efb384..81b31613eb25 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -41,8 +41,37 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
41 41
42 return DEVICE_ACPI_HANDLE(dev); 42 return DEVICE_ACPI_HANDLE(dev);
43} 43}
44
45void acpi_pci_add_bus(struct pci_bus *bus);
46void acpi_pci_remove_bus(struct pci_bus *bus);
47
48#ifdef CONFIG_ACPI_PCI_SLOT
49void acpi_pci_slot_init(void);
50void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle);
51void acpi_pci_slot_remove(struct pci_bus *bus);
52#else
53static inline void acpi_pci_slot_init(void) { }
54static inline void acpi_pci_slot_enumerate(struct pci_bus *bus,
55 acpi_handle handle) { }
56static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
44#endif 57#endif
45 58
59#ifdef CONFIG_HOTPLUG_PCI_ACPI
60void acpiphp_init(void);
61void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle);
62void acpiphp_remove_slots(struct pci_bus *bus);
63#else
64static inline void acpiphp_init(void) { }
65static inline void acpiphp_enumerate_slots(struct pci_bus *bus,
66 acpi_handle handle) { }
67static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
68#endif
69
70#else /* CONFIG_ACPI */
71static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
72static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
73#endif /* CONFIG_ACPI */
74
46#ifdef CONFIG_ACPI_APEI 75#ifdef CONFIG_ACPI_APEI
47extern bool aer_acpi_firmware_first(void); 76extern bool aer_acpi_firmware_first(void);
48#else 77#else
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index c8320144fe79..8af4610c2e41 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -23,14 +23,14 @@
23#define PCIE_LINK_STATE_CLKPM 4 23#define PCIE_LINK_STATE_CLKPM 4
24 24
25#ifdef CONFIG_PCIEASPM 25#ifdef CONFIG_PCIEASPM
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev); 26void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32extern void pcie_clear_aspm(struct pci_bus *bus); 32void pcie_clear_aspm(struct pci_bus *bus);
33extern void pcie_no_aspm(void); 33void pcie_no_aspm(void);
34#else 34#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
36{ 36{
@@ -56,8 +56,8 @@ static inline void pcie_no_aspm(void)
56#endif 56#endif
57 57
58#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ 58#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
59extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); 59void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
60extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); 60void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
61#else 61#else
62static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) 62static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
63{ 63{
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 7ef68724f0f0..68bcefd7fca0 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -14,9 +14,9 @@ struct pci_ats {
14 14
15#ifdef CONFIG_PCI_ATS 15#ifdef CONFIG_PCI_ATS
16 16
17extern int pci_enable_ats(struct pci_dev *dev, int ps); 17int pci_enable_ats(struct pci_dev *dev, int ps);
18extern void pci_disable_ats(struct pci_dev *dev); 18void pci_disable_ats(struct pci_dev *dev);
19extern int pci_ats_queue_depth(struct pci_dev *dev); 19int pci_ats_queue_depth(struct pci_dev *dev);
20 20
21/** 21/**
22 * pci_ats_enabled - query the ATS status 22 * pci_ats_enabled - query the ATS status
@@ -54,12 +54,12 @@ static inline int pci_ats_enabled(struct pci_dev *dev)
54 54
55#ifdef CONFIG_PCI_PRI 55#ifdef CONFIG_PCI_PRI
56 56
57extern int pci_enable_pri(struct pci_dev *pdev, u32 reqs); 57int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
58extern void pci_disable_pri(struct pci_dev *pdev); 58void pci_disable_pri(struct pci_dev *pdev);
59extern bool pci_pri_enabled(struct pci_dev *pdev); 59bool pci_pri_enabled(struct pci_dev *pdev);
60extern int pci_reset_pri(struct pci_dev *pdev); 60int pci_reset_pri(struct pci_dev *pdev);
61extern bool pci_pri_stopped(struct pci_dev *pdev); 61bool pci_pri_stopped(struct pci_dev *pdev);
62extern int pci_pri_status(struct pci_dev *pdev); 62int pci_pri_status(struct pci_dev *pdev);
63 63
64#else /* CONFIG_PCI_PRI */ 64#else /* CONFIG_PCI_PRI */
65 65
@@ -95,10 +95,10 @@ static inline int pci_pri_status(struct pci_dev *pdev)
95 95
96#ifdef CONFIG_PCI_PASID 96#ifdef CONFIG_PCI_PASID
97 97
98extern int pci_enable_pasid(struct pci_dev *pdev, int features); 98int pci_enable_pasid(struct pci_dev *pdev, int features);
99extern void pci_disable_pasid(struct pci_dev *pdev); 99void pci_disable_pasid(struct pci_dev *pdev);
100extern int pci_pasid_features(struct pci_dev *pdev); 100int pci_pasid_features(struct pci_dev *pdev);
101extern int pci_max_pasids(struct pci_dev *pdev); 101int pci_max_pasids(struct pci_dev *pdev);
102 102
103#else /* CONFIG_PCI_PASID */ 103#else /* CONFIG_PCI_PASID */
104 104
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 710067f3618c..e73dfa308b87 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -35,6 +35,21 @@
35/* Include the ID list */ 35/* Include the ID list */
36#include <linux/pci_ids.h> 36#include <linux/pci_ids.h>
37 37
38/*
39 * The PCI interface treats multi-function devices as independent
40 * devices. The slot/function address of each device is encoded
41 * in a single byte as follows:
42 *
43 * 7:3 = slot
44 * 2:0 = function
45 * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h
46 * In the interest of not exposing interfaces to user-space unnecessarily,
47 * the following kernel only defines are being added here.
48 */
49#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn)
50/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */
51#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff)
52
38/* pci_slot represents a physical slot */ 53/* pci_slot represents a physical slot */
39struct pci_slot { 54struct pci_slot {
40 struct pci_bus *bus; /* The bus this slot is on */ 55 struct pci_bus *bus; /* The bus this slot is on */
@@ -232,6 +247,8 @@ struct pci_dev {
232 u8 revision; /* PCI revision, low byte of class word */ 247 u8 revision; /* PCI revision, low byte of class word */
233 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 248 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
234 u8 pcie_cap; /* PCI-E capability offset */ 249 u8 pcie_cap; /* PCI-E capability offset */
250 u8 msi_cap; /* MSI capability offset */
251 u8 msix_cap; /* MSI-X capability offset */
235 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 252 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
236 u8 rom_base_reg; /* which config register controls the ROM */ 253 u8 rom_base_reg; /* which config register controls the ROM */
237 u8 pin; /* which interrupt pin this device uses */ 254 u8 pin; /* which interrupt pin this device uses */
@@ -249,8 +266,7 @@ struct pci_dev {
249 pci_power_t current_state; /* Current operating state. In ACPI-speak, 266 pci_power_t current_state; /* Current operating state. In ACPI-speak,
250 this is D0-D3, D0 being fully functional, 267 this is D0-D3, D0 being fully functional,
251 and D3 being off. */ 268 and D3 being off. */
252 int pm_cap; /* PM capability offset in the 269 u8 pm_cap; /* PM capability offset */
253 configuration space */
254 unsigned int pme_support:5; /* Bitmask of states from which PME# 270 unsigned int pme_support:5; /* Bitmask of states from which PME#
255 can be generated */ 271 can be generated */
256 unsigned int pme_interrupt:1; 272 unsigned int pme_interrupt:1;
@@ -348,7 +364,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
348 return dev; 364 return dev;
349} 365}
350 366
351extern struct pci_dev *alloc_pci_dev(void); 367struct pci_dev *alloc_pci_dev(void);
352 368
353#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 369#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
354#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 370#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -504,10 +520,10 @@ struct pci_ops {
504 * ACPI needs to be able to access PCI config space before we've done a 520 * ACPI needs to be able to access PCI config space before we've done a
505 * PCI bus scan and created pci_bus structures. 521 * PCI bus scan and created pci_bus structures.
506 */ 522 */
507extern int raw_pci_read(unsigned int domain, unsigned int bus, 523int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
508 unsigned int devfn, int reg, int len, u32 *val); 524 int reg, int len, u32 *val);
509extern int raw_pci_write(unsigned int domain, unsigned int bus, 525int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
510 unsigned int devfn, int reg, int len, u32 val); 526 int reg, int len, u32 val);
511 527
512struct pci_bus_region { 528struct pci_bus_region {
513 resource_size_t start; 529 resource_size_t start;
@@ -658,7 +674,7 @@ struct pci_driver {
658/* these external functions are only available when PCI support is enabled */ 674/* these external functions are only available when PCI support is enabled */
659#ifdef CONFIG_PCI 675#ifdef CONFIG_PCI
660 676
661extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); 677void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
662 678
663enum pcie_bus_config_types { 679enum pcie_bus_config_types {
664 PCIE_BUS_TUNE_OFF, 680 PCIE_BUS_TUNE_OFF,
@@ -675,9 +691,11 @@ extern struct bus_type pci_bus_type;
675 * code, or pci core code. */ 691 * code, or pci core code. */
676extern struct list_head pci_root_buses; /* list of all known PCI buses */ 692extern struct list_head pci_root_buses; /* list of all known PCI buses */
677/* Some device drivers need know if pci is initiated */ 693/* Some device drivers need know if pci is initiated */
678extern int no_pci_devices(void); 694int no_pci_devices(void);
679 695
680void pcibios_resource_survey_bus(struct pci_bus *bus); 696void pcibios_resource_survey_bus(struct pci_bus *bus);
697void pcibios_add_bus(struct pci_bus *bus);
698void pcibios_remove_bus(struct pci_bus *bus);
681void pcibios_fixup_bus(struct pci_bus *); 699void pcibios_fixup_bus(struct pci_bus *);
682int __must_check pcibios_enable_device(struct pci_dev *, int mask); 700int __must_check pcibios_enable_device(struct pci_dev *, int mask);
683/* Architecture specific versions may override this (weak) */ 701/* Architecture specific versions may override this (weak) */
@@ -699,7 +717,7 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
699void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 717void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
700 struct pci_bus_region *region); 718 struct pci_bus_region *region);
701void pcibios_scan_specific_bus(int busn); 719void pcibios_scan_specific_bus(int busn);
702extern struct pci_bus *pci_find_bus(int domain, int busnr); 720struct pci_bus *pci_find_bus(int domain, int busnr);
703void pci_bus_add_devices(const struct pci_bus *bus); 721void pci_bus_add_devices(const struct pci_bus *bus);
704struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 722struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
705 struct pci_ops *ops, void *sysdata); 723 struct pci_ops *ops, void *sysdata);
@@ -732,14 +750,14 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,
732u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin); 750u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin);
733int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 751int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
734u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); 752u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
735extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 753struct pci_dev *pci_dev_get(struct pci_dev *dev);
736extern void pci_dev_put(struct pci_dev *dev); 754void pci_dev_put(struct pci_dev *dev);
737extern void pci_remove_bus(struct pci_bus *b); 755void pci_remove_bus(struct pci_bus *b);
738extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); 756void pci_stop_and_remove_bus_device(struct pci_dev *dev);
739void pci_stop_root_bus(struct pci_bus *bus); 757void pci_stop_root_bus(struct pci_bus *bus);
740void pci_remove_root_bus(struct pci_bus *bus); 758void pci_remove_root_bus(struct pci_bus *bus);
741void pci_setup_cardbus(struct pci_bus *bus); 759void pci_setup_cardbus(struct pci_bus *bus);
742extern void pci_sort_breadthfirst(void); 760void pci_sort_breadthfirst(void);
743#define dev_is_pci(d) ((d)->bus == &pci_bus_type) 761#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
744#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false)) 762#define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
745#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) 763#define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0))
@@ -1142,18 +1160,17 @@ static inline int pci_msi_enabled(void)
1142 return 0; 1160 return 0;
1143} 1161}
1144#else 1162#else
1145extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); 1163int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
1146extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); 1164int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec);
1147extern void pci_msi_shutdown(struct pci_dev *dev); 1165void pci_msi_shutdown(struct pci_dev *dev);
1148extern void pci_disable_msi(struct pci_dev *dev); 1166void pci_disable_msi(struct pci_dev *dev);
1149extern int pci_msix_table_size(struct pci_dev *dev); 1167int pci_msix_table_size(struct pci_dev *dev);
1150extern int pci_enable_msix(struct pci_dev *dev, 1168int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1151 struct msix_entry *entries, int nvec); 1169void pci_msix_shutdown(struct pci_dev *dev);
1152extern void pci_msix_shutdown(struct pci_dev *dev); 1170void pci_disable_msix(struct pci_dev *dev);
1153extern void pci_disable_msix(struct pci_dev *dev); 1171void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1154extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 1172void pci_restore_msi_state(struct pci_dev *dev);
1155extern void pci_restore_msi_state(struct pci_dev *dev); 1173int pci_msi_enabled(void);
1156extern int pci_msi_enabled(void);
1157#endif 1174#endif
1158 1175
1159#ifdef CONFIG_PCIEPORTBUS 1176#ifdef CONFIG_PCIEPORTBUS
@@ -1168,8 +1185,8 @@ extern bool pcie_ports_auto;
1168static inline int pcie_aspm_enabled(void) { return 0; } 1185static inline int pcie_aspm_enabled(void) { return 0; }
1169static inline bool pcie_aspm_support_enabled(void) { return false; } 1186static inline bool pcie_aspm_support_enabled(void) { return false; }
1170#else 1187#else
1171extern int pcie_aspm_enabled(void); 1188int pcie_aspm_enabled(void);
1172extern bool pcie_aspm_support_enabled(void); 1189bool pcie_aspm_support_enabled(void);
1173#endif 1190#endif
1174 1191
1175#ifdef CONFIG_PCIEAER 1192#ifdef CONFIG_PCIEAER
@@ -1187,8 +1204,8 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
1187} 1204}
1188static inline void pcie_ecrc_get_policy(char *str) {}; 1205static inline void pcie_ecrc_get_policy(char *str) {};
1189#else 1206#else
1190extern void pcie_set_ecrc_checking(struct pci_dev *dev); 1207void pcie_set_ecrc_checking(struct pci_dev *dev);
1191extern void pcie_ecrc_get_policy(char *str); 1208void pcie_ecrc_get_policy(char *str);
1192#endif 1209#endif
1193 1210
1194#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 1211#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
@@ -1199,9 +1216,9 @@ int ht_create_irq(struct pci_dev *dev, int idx);
1199void ht_destroy_irq(unsigned int irq); 1216void ht_destroy_irq(unsigned int irq);
1200#endif /* CONFIG_HT_IRQ */ 1217#endif /* CONFIG_HT_IRQ */
1201 1218
1202extern void pci_cfg_access_lock(struct pci_dev *dev); 1219void pci_cfg_access_lock(struct pci_dev *dev);
1203extern bool pci_cfg_access_trylock(struct pci_dev *dev); 1220bool pci_cfg_access_trylock(struct pci_dev *dev);
1204extern void pci_cfg_access_unlock(struct pci_dev *dev); 1221void pci_cfg_access_unlock(struct pci_dev *dev);
1205 1222
1206/* 1223/*
1207 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1224 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
@@ -1226,7 +1243,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)
1226/* some architectures require additional setup to direct VGA traffic */ 1243/* some architectures require additional setup to direct VGA traffic */
1227typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode, 1244typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
1228 unsigned int command_bits, u32 flags); 1245 unsigned int command_bits, u32 flags);
1229extern void pci_register_set_vga_state(arch_set_vga_state_t func); 1246void pci_register_set_vga_state(arch_set_vga_state_t func);
1230 1247
1231#else /* CONFIG_PCI is not enabled */ 1248#else /* CONFIG_PCI is not enabled */
1232 1249
@@ -1628,8 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1628int pcibios_add_device(struct pci_dev *dev); 1645int pcibios_add_device(struct pci_dev *dev);
1629 1646
1630#ifdef CONFIG_PCI_MMCONFIG 1647#ifdef CONFIG_PCI_MMCONFIG
1631extern void __init pci_mmcfg_early_init(void); 1648void __init pci_mmcfg_early_init(void);
1632extern void __init pci_mmcfg_late_init(void); 1649void __init pci_mmcfg_late_init(void);
1633#else 1650#else
1634static inline void pci_mmcfg_early_init(void) { } 1651static inline void pci_mmcfg_early_init(void) { }
1635static inline void pci_mmcfg_late_init(void) { } 1652static inline void pci_mmcfg_late_init(void) { }
@@ -1640,12 +1657,12 @@ int pci_ext_cfg_avail(void);
1640void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1657void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1641 1658
1642#ifdef CONFIG_PCI_IOV 1659#ifdef CONFIG_PCI_IOV
1643extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1660int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1644extern void pci_disable_sriov(struct pci_dev *dev); 1661void pci_disable_sriov(struct pci_dev *dev);
1645extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); 1662irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1646extern int pci_num_vf(struct pci_dev *dev); 1663int pci_num_vf(struct pci_dev *dev);
1647extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1664int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
1648extern int pci_sriov_get_totalvfs(struct pci_dev *dev); 1665int pci_sriov_get_totalvfs(struct pci_dev *dev);
1649#else 1666#else
1650static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1667static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1651{ 1668{
@@ -1673,8 +1690,8 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
1673#endif 1690#endif
1674 1691
1675#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) 1692#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
1676extern void pci_hp_create_module_link(struct pci_slot *pci_slot); 1693void pci_hp_create_module_link(struct pci_slot *pci_slot);
1677extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); 1694void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1678#endif 1695#endif
1679 1696
1680/** 1697/**
@@ -1818,13 +1835,13 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
1818/* PCI <-> OF binding helpers */ 1835/* PCI <-> OF binding helpers */
1819#ifdef CONFIG_OF 1836#ifdef CONFIG_OF
1820struct device_node; 1837struct device_node;
1821extern void pci_set_of_node(struct pci_dev *dev); 1838void pci_set_of_node(struct pci_dev *dev);
1822extern void pci_release_of_node(struct pci_dev *dev); 1839void pci_release_of_node(struct pci_dev *dev);
1823extern void pci_set_bus_of_node(struct pci_bus *bus); 1840void pci_set_bus_of_node(struct pci_bus *bus);
1824extern void pci_release_bus_of_node(struct pci_bus *bus); 1841void pci_release_bus_of_node(struct pci_bus *bus);
1825 1842
1826/* Arch may override this (weak) */ 1843/* Arch may override this (weak) */
1827extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus); 1844struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
1828 1845
1829static inline struct device_node * 1846static inline struct device_node *
1830pci_device_to_OF_node(const struct pci_dev *pdev) 1847pci_device_to_OF_node(const struct pci_dev *pdev)
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 45fc162cbdc0..8db71dcd6337 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -125,12 +125,12 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
125 return pci_slot_name(slot->pci_slot); 125 return pci_slot_name(slot->pci_slot);
126} 126}
127 127
128extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, 128int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr,
129 int nr, const char *name, 129 const char *name, struct module *owner,
130 struct module *owner, const char *mod_name); 130 const char *mod_name);
131extern int pci_hp_deregister(struct hotplug_slot *slot); 131int pci_hp_deregister(struct hotplug_slot *slot);
132extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 132int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
133 struct hotplug_slot_info *info); 133 struct hotplug_slot_info *info);
134 134
135/* use a define to avoid include chaining to get THIS_MODULE & friends */ 135/* use a define to avoid include chaining to get THIS_MODULE & friends */
136#define pci_hp_register(slot, pbus, devnr, name) \ 136#define pci_hp_register(slot, pbus, devnr, name) \
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f11c1c2609d5..a80f9e6ce9e5 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1604,6 +1604,7 @@
1604#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 1604#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334
1605 1605
1606#define PCI_VENDOR_ID_MARVELL 0x11ab 1606#define PCI_VENDOR_ID_MARVELL 0x11ab
1607#define PCI_VENDOR_ID_MARVELL_EXT 0x1b4b
1607#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 1608#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146
1608#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1609#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1609#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1610#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index e6f91b1406d8..9572669eea97 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -62,7 +62,7 @@ struct pcie_port_service_driver {
62#define to_service_driver(d) \ 62#define to_service_driver(d) \
63 container_of(d, struct pcie_port_service_driver, driver) 63 container_of(d, struct pcie_port_service_driver, driver)
64 64
65extern int pcie_port_service_register(struct pcie_port_service_driver *new); 65int pcie_port_service_register(struct pcie_port_service_driver *new);
66extern void pcie_port_service_unregister(struct pcie_port_service_driver *new); 66void pcie_port_service_unregister(struct pcie_port_service_driver *new);
67 67
68#endif /* _PCIEPORT_IF_H_ */ 68#endif /* _PCIEPORT_IF_H_ */
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index ebfadc56d1b4..864e324da80d 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -292,12 +292,12 @@
292 292
293/* Message Signalled Interrupts registers */ 293/* Message Signalled Interrupts registers */
294 294
295#define PCI_MSI_FLAGS 2 /* Various flags */ 295#define PCI_MSI_FLAGS 2 /* Message Control */
296#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ 296#define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */
297#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ 297#define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */
298#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ 298#define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */
299#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ 299#define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */
300#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ 300#define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */
301#define PCI_MSI_RFU 3 /* Rest of capability flags */ 301#define PCI_MSI_RFU 3 /* Rest of capability flags */
302#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ 302#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
303#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ 303#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
@@ -309,13 +309,17 @@
309#define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ 309#define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */
310 310
311/* MSI-X registers */ 311/* MSI-X registers */
312#define PCI_MSIX_FLAGS 2 312#define PCI_MSIX_FLAGS 2 /* Message Control */
313#define PCI_MSIX_FLAGS_QSIZE 0x7FF 313#define PCI_MSIX_FLAGS_QSIZE 0x07FF /* Table size */
314#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 314#define PCI_MSIX_FLAGS_MASKALL 0x4000 /* Mask all vectors for this function */
315#define PCI_MSIX_FLAGS_MASKALL (1 << 14) 315#define PCI_MSIX_FLAGS_ENABLE 0x8000 /* MSI-X enable */
316#define PCI_MSIX_TABLE 4 316#define PCI_MSIX_TABLE 4 /* Table offset */
317#define PCI_MSIX_PBA 8 317#define PCI_MSIX_TABLE_BIR 0x00000007 /* BAR index */
318#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 318#define PCI_MSIX_TABLE_OFFSET 0xfffffff8 /* Offset into specified BAR */
319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */
320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */
321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) /* deprecated */
319#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ 323#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
320 324
321/* MSI-X entry's format */ 325/* MSI-X entry's format */