diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 15:05:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 15:05:36 -0400 |
commit | fdb2f9c2ebd4f07d7b11a3bc86d8c669eb841697 (patch) | |
tree | d85824518fc13a8c84b7399019fc11ad77aaa120 /include | |
parent | 81f56e5375e84689b891e0e6c5a02ec12a1f18d9 (diff) | |
parent | 78c8f84302ce007aedcfa11912fd4aacf22727ab (diff) |
Merge tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas:
"Host bridge hotplug
- Protect acpi_pci_drivers and acpi_pci_roots (Taku Izumi)
- Clear host bridge resource info to avoid issue when releasing
(Yinghai Lu)
- Notify acpi_pci_drivers when hot-plugging host bridges (Jiang Liu)
- Use standard list ops for acpi_pci_drivers (Jiang Liu)
Device hotplug
- Use pci_get_domain_bus_and_slot() to close hotplug races (Jiang
Liu)
- Remove fakephp driver (Bjorn Helgaas)
- Fix VGA ref count in hotplug remove path (Yinghai Lu)
- Allow acpiphp to handle PCIe ports without native hotplug (Jiang
Liu)
- Implement resume regardless of pciehp_force param (Oliver Neukum)
- Make pci_fixup_irqs() work after init (Thierry Reding)
Miscellaneous
- Add pci_pcie_type(dev) and remove pci_dev.pcie_type (Yijing Wang)
- Factor out PCI Express Capability accessors (Jiang Liu)
- Add pcibios_window_alignment() so powerpc EEH can use generic
resource assignment (Gavin Shan)
- Make pci_error_handlers const (Stephen Hemminger)
- Cleanup drivers/pci/remove.c (Bjorn Helgaas)
- Improve Vendor-Specific Extended Capability support (Bjorn
Helgaas)
- Use standard list ops for bus->devices (Bjorn Helgaas)
- Avoid kmalloc in pci_get_subsys() and pci_get_class() (Feng Tang)
- Reassign invalid bus number ranges (Intel DP43BF workaround)
(Yinghai Lu)"
* tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (102 commits)
PCI: acpiphp: Handle PCIe ports without native hotplug capability
PCI/ACPI: Use acpi_driver_data() rather than searching acpi_pci_roots
PCI/ACPI: Protect acpi_pci_roots list with mutex
PCI/ACPI: Use acpi_pci_root info rather than looking it up again
PCI/ACPI: Pass acpi_pci_root to acpi_pci_drivers' add/remove interface
PCI/ACPI: Protect acpi_pci_drivers list with mutex
PCI/ACPI: Notify acpi_pci_drivers when hot-plugging PCI root bridges
PCI/ACPI: Use normal list for struct acpi_pci_driver
PCI/ACPI: Use DEVICE_ACPI_HANDLE rather than searching acpi_pci_roots
PCI: Fix default vga ref_count
ia64/PCI: Clear host bridge aperture struct resource
x86/PCI: Clear host bridge aperture struct resource
PCI: Stop all children first, before removing all children
Revert "PCI: Use hotplug-safe pci_get_domain_bus_and_slot()"
PCI: Provide a default pcibios_update_irq()
PCI: Discard __init annotations for pci_fixup_irqs() and related functions
PCI: Use correct type when freeing bus resource list
PCI: Check P2P bridge for invalid secondary/subordinate range
PCI: Convert "new_id"/"remove_id" into generic pci_bus driver attributes
xen-pcifront: Use hotplug-safe pci_get_domain_bus_and_slot()
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/acpi.h | 6 | ||||
-rw-r--r-- | include/linux/pci-acpi.h | 17 | ||||
-rw-r--r-- | include/linux/pci.h | 55 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 7 | ||||
-rw-r--r-- | include/linux/pcieport_if.h | 2 |
5 files changed, 70 insertions, 17 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4f2a76224509..90be98981102 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -138,9 +138,9 @@ void acpi_penalize_isa_irq(int irq, int active); | |||
138 | void acpi_pci_irq_disable (struct pci_dev *dev); | 138 | void acpi_pci_irq_disable (struct pci_dev *dev); |
139 | 139 | ||
140 | struct acpi_pci_driver { | 140 | struct acpi_pci_driver { |
141 | struct acpi_pci_driver *next; | 141 | struct list_head node; |
142 | int (*add)(acpi_handle handle); | 142 | int (*add)(struct acpi_pci_root *root); |
143 | void (*remove)(acpi_handle handle); | 143 | void (*remove)(struct acpi_pci_root *root); |
144 | }; | 144 | }; |
145 | 145 | ||
146 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | 146 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 248fba2af98a..9a22b5efb384 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -22,19 +22,24 @@ extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle); | |||
22 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 22 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) |
23 | { | 23 | { |
24 | struct pci_bus *pbus = pdev->bus; | 24 | struct pci_bus *pbus = pdev->bus; |
25 | |||
25 | /* Find a PCI root bus */ | 26 | /* Find a PCI root bus */ |
26 | while (!pci_is_root_bus(pbus)) | 27 | while (!pci_is_root_bus(pbus)) |
27 | pbus = pbus->parent; | 28 | pbus = pbus->parent; |
28 | return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), | 29 | |
29 | pbus->number); | 30 | return DEVICE_ACPI_HANDLE(pbus->bridge); |
30 | } | 31 | } |
31 | 32 | ||
32 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | 33 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) |
33 | { | 34 | { |
34 | if (!pci_is_root_bus(pbus)) | 35 | struct device *dev; |
35 | return DEVICE_ACPI_HANDLE(&(pbus->self->dev)); | 36 | |
36 | return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), | 37 | if (pci_is_root_bus(pbus)) |
37 | pbus->number); | 38 | dev = pbus->bridge; |
39 | else | ||
40 | dev = &pbus->self->dev; | ||
41 | |||
42 | return DEVICE_ACPI_HANDLE(dev); | ||
38 | } | 43 | } |
39 | #endif | 44 | #endif |
40 | 45 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 5faa8310eec9..be1de01de1c4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -254,10 +254,10 @@ struct pci_dev { | |||
254 | u8 revision; /* PCI revision, low byte of class word */ | 254 | u8 revision; /* PCI revision, low byte of class word */ |
255 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ | 255 | u8 hdr_type; /* PCI header type (`multi' flag masked out) */ |
256 | u8 pcie_cap; /* PCI-E capability offset */ | 256 | u8 pcie_cap; /* PCI-E capability offset */ |
257 | u8 pcie_type:4; /* PCI-E device/port type */ | ||
258 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ | 257 | u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ |
259 | u8 rom_base_reg; /* which config register controls the ROM */ | 258 | u8 rom_base_reg; /* which config register controls the ROM */ |
260 | u8 pin; /* which interrupt pin this device uses */ | 259 | u8 pin; /* which interrupt pin this device uses */ |
260 | u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ | ||
261 | 261 | ||
262 | struct pci_driver *driver; /* which driver has allocated this device */ | 262 | struct pci_driver *driver; /* which driver has allocated this device */ |
263 | u64 dma_mask; /* Mask of the bits of bus address this | 263 | u64 dma_mask; /* Mask of the bits of bus address this |
@@ -369,7 +369,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev) | |||
369 | 369 | ||
370 | extern struct pci_dev *alloc_pci_dev(void); | 370 | extern struct pci_dev *alloc_pci_dev(void); |
371 | 371 | ||
372 | #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) | ||
373 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) | 372 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
374 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) | 373 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
375 | 374 | ||
@@ -596,7 +595,7 @@ struct pci_driver { | |||
596 | int (*resume_early) (struct pci_dev *dev); | 595 | int (*resume_early) (struct pci_dev *dev); |
597 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 596 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
598 | void (*shutdown) (struct pci_dev *dev); | 597 | void (*shutdown) (struct pci_dev *dev); |
599 | struct pci_error_handlers *err_handler; | 598 | const struct pci_error_handlers *err_handler; |
600 | struct device_driver driver; | 599 | struct device_driver driver; |
601 | struct pci_dynids dynids; | 600 | struct pci_dynids dynids; |
602 | }; | 601 | }; |
@@ -734,9 +733,7 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); | |||
734 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | 733 | extern struct pci_dev *pci_dev_get(struct pci_dev *dev); |
735 | extern void pci_dev_put(struct pci_dev *dev); | 734 | extern void pci_dev_put(struct pci_dev *dev); |
736 | extern void pci_remove_bus(struct pci_bus *b); | 735 | extern void pci_remove_bus(struct pci_bus *b); |
737 | extern void __pci_remove_bus_device(struct pci_dev *dev); | ||
738 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); | 736 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); |
739 | extern void pci_stop_bus_device(struct pci_dev *dev); | ||
740 | void pci_setup_cardbus(struct pci_bus *bus); | 737 | void pci_setup_cardbus(struct pci_bus *bus); |
741 | extern void pci_sort_breadthfirst(void); | 738 | extern void pci_sort_breadthfirst(void); |
742 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | 739 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) |
@@ -755,6 +752,7 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | |||
755 | int pci_find_capability(struct pci_dev *dev, int cap); | 752 | int pci_find_capability(struct pci_dev *dev, int cap); |
756 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 753 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
757 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 754 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
755 | int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap); | ||
758 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); | 756 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); |
759 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); | 757 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
760 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 758 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
@@ -816,6 +814,39 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | |||
816 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 814 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
817 | } | 815 | } |
818 | 816 | ||
817 | int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); | ||
818 | int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); | ||
819 | int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val); | ||
820 | int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val); | ||
821 | int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos, | ||
822 | u16 clear, u16 set); | ||
823 | int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos, | ||
824 | u32 clear, u32 set); | ||
825 | |||
826 | static inline int pcie_capability_set_word(struct pci_dev *dev, int pos, | ||
827 | u16 set) | ||
828 | { | ||
829 | return pcie_capability_clear_and_set_word(dev, pos, 0, set); | ||
830 | } | ||
831 | |||
832 | static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos, | ||
833 | u32 set) | ||
834 | { | ||
835 | return pcie_capability_clear_and_set_dword(dev, pos, 0, set); | ||
836 | } | ||
837 | |||
838 | static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos, | ||
839 | u16 clear) | ||
840 | { | ||
841 | return pcie_capability_clear_and_set_word(dev, pos, clear, 0); | ||
842 | } | ||
843 | |||
844 | static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, | ||
845 | u32 clear) | ||
846 | { | ||
847 | return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); | ||
848 | } | ||
849 | |||
819 | /* user-space driven config access */ | 850 | /* user-space driven config access */ |
820 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | 851 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); |
821 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | 852 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); |
@@ -1013,7 +1044,6 @@ void pci_unregister_driver(struct pci_driver *dev); | |||
1013 | module_driver(__pci_driver, pci_register_driver, \ | 1044 | module_driver(__pci_driver, pci_register_driver, \ |
1014 | pci_unregister_driver) | 1045 | pci_unregister_driver) |
1015 | 1046 | ||
1016 | void pci_stop_and_remove_behind_bridge(struct pci_dev *dev); | ||
1017 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); | 1047 | struct pci_driver *pci_dev_driver(const struct pci_dev *dev); |
1018 | int pci_add_dynid(struct pci_driver *drv, | 1048 | int pci_add_dynid(struct pci_driver *drv, |
1019 | unsigned int vendor, unsigned int device, | 1049 | unsigned int vendor, unsigned int device, |
@@ -1031,6 +1061,8 @@ int pci_cfg_space_size_ext(struct pci_dev *dev); | |||
1031 | int pci_cfg_space_size(struct pci_dev *dev); | 1061 | int pci_cfg_space_size(struct pci_dev *dev); |
1032 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); | 1062 | unsigned char pci_bus_max_busnr(struct pci_bus *bus); |
1033 | void pci_setup_bridge(struct pci_bus *bus); | 1063 | void pci_setup_bridge(struct pci_bus *bus); |
1064 | resource_size_t pcibios_window_alignment(struct pci_bus *bus, | ||
1065 | unsigned long type); | ||
1034 | 1066 | ||
1035 | #define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) | 1067 | #define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) |
1036 | #define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) | 1068 | #define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) |
@@ -1472,7 +1504,7 @@ enum pci_fixup_pass { | |||
1472 | /* Anonymous variables would be nice... */ | 1504 | /* Anonymous variables would be nice... */ |
1473 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ | 1505 | #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ |
1474 | class_shift, hook) \ | 1506 | class_shift, hook) \ |
1475 | static const struct pci_fixup const __pci_fixup_##name __used \ | 1507 | static const struct pci_fixup __pci_fixup_##name __used \ |
1476 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ | 1508 | __attribute__((__section__(#section), aligned((sizeof(void *))))) \ |
1477 | = { vendor, device, class, class_shift, hook }; | 1509 | = { vendor, device, class, class_shift, hook }; |
1478 | 1510 | ||
@@ -1650,6 +1682,15 @@ static inline bool pci_is_pcie(struct pci_dev *dev) | |||
1650 | return !!pci_pcie_cap(dev); | 1682 | return !!pci_pcie_cap(dev); |
1651 | } | 1683 | } |
1652 | 1684 | ||
1685 | /** | ||
1686 | * pci_pcie_type - get the PCIe device/port type | ||
1687 | * @dev: PCI device | ||
1688 | */ | ||
1689 | static inline int pci_pcie_type(const struct pci_dev *dev) | ||
1690 | { | ||
1691 | return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4; | ||
1692 | } | ||
1693 | |||
1653 | void pci_request_acs(void); | 1694 | void pci_request_acs(void); |
1654 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | 1695 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); |
1655 | bool pci_acs_path_enabled(struct pci_dev *start, | 1696 | bool pci_acs_path_enabled(struct pci_dev *start, |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 7fb75b143755..20ae747ddf34 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -549,6 +549,7 @@ | |||
549 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */ | 549 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */ |
550 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ | 550 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ |
551 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | 551 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ |
552 | #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ | ||
552 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ | 553 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ |
553 | 554 | ||
554 | /* Extended Capabilities (PCI-X 2.0 and Express) */ | 555 | /* Extended Capabilities (PCI-X 2.0 and Express) */ |
@@ -677,6 +678,12 @@ | |||
677 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | 678 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ |
678 | #define PCI_EXT_CAP_PWR_SIZEOF 16 | 679 | #define PCI_EXT_CAP_PWR_SIZEOF 16 |
679 | 680 | ||
681 | /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */ | ||
682 | #define PCI_VNDR_HEADER 4 /* Vendor-Specific Header */ | ||
683 | #define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff) | ||
684 | #define PCI_VNDR_HEADER_REV(x) (((x) >> 16) & 0xf) | ||
685 | #define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff) | ||
686 | |||
680 | /* | 687 | /* |
681 | * Hypertransport sub capability types | 688 | * Hypertransport sub capability types |
682 | * | 689 | * |
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index 6775532b92a9..e6f91b1406d8 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h | |||
@@ -49,7 +49,7 @@ struct pcie_port_service_driver { | |||
49 | int (*resume) (struct pcie_device *dev); | 49 | int (*resume) (struct pcie_device *dev); |
50 | 50 | ||
51 | /* Service Error Recovery Handler */ | 51 | /* Service Error Recovery Handler */ |
52 | struct pci_error_handlers *err_handler; | 52 | const struct pci_error_handlers *err_handler; |
53 | 53 | ||
54 | /* Link Reset Capability - AER service driver specific */ | 54 | /* Link Reset Capability - AER service driver specific */ |
55 | pci_ers_result_t (*reset_link) (struct pci_dev *dev); | 55 | pci_ers_result_t (*reset_link) (struct pci_dev *dev); |