diff options
61 files changed, 841 insertions, 426 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 14bc7071f9df..28b4679d8c75 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5195,7 +5195,7 @@ PCI SUBSYSTEM | |||
5195 | M: Bjorn Helgaas <bhelgaas@google.com> | 5195 | M: Bjorn Helgaas <bhelgaas@google.com> |
5196 | L: linux-pci@vger.kernel.org | 5196 | L: linux-pci@vger.kernel.org |
5197 | Q: http://patchwork.ozlabs.org/project/linux-pci/list/ | 5197 | Q: http://patchwork.ozlabs.org/project/linux-pci/list/ |
5198 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/linux.git | 5198 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git |
5199 | S: Supported | 5199 | S: Supported |
5200 | F: Documentation/PCI/ | 5200 | F: Documentation/PCI/ |
5201 | F: drivers/pci/ | 5201 | F: drivers/pci/ |
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 1a629636cc16..71efc1a5de7e 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -59,15 +59,13 @@ struct pci_controller *pci_isa_hose; | |||
59 | * Quirks. | 59 | * Quirks. |
60 | */ | 60 | */ |
61 | 61 | ||
62 | static void __init | 62 | static void __devinit quirk_isa_bridge(struct pci_dev *dev) |
63 | quirk_isa_bridge(struct pci_dev *dev) | ||
64 | { | 63 | { |
65 | dev->class = PCI_CLASS_BRIDGE_ISA << 8; | 64 | dev->class = PCI_CLASS_BRIDGE_ISA << 8; |
66 | } | 65 | } |
67 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge); | 66 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge); |
68 | 67 | ||
69 | static void __init | 68 | static void __devinit quirk_cypress(struct pci_dev *dev) |
70 | quirk_cypress(struct pci_dev *dev) | ||
71 | { | 69 | { |
72 | /* The Notorious Cy82C693 chip. */ | 70 | /* The Notorious Cy82C693 chip. */ |
73 | 71 | ||
@@ -106,8 +104,7 @@ quirk_cypress(struct pci_dev *dev) | |||
106 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress); | 104 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress); |
107 | 105 | ||
108 | /* Called for each device after PCI setup is done. */ | 106 | /* Called for each device after PCI setup is done. */ |
109 | static void __init | 107 | static void __devinit pcibios_fixup_final(struct pci_dev *dev) |
110 | pcibios_fixup_final(struct pci_dev *dev) | ||
111 | { | 108 | { |
112 | unsigned int class = dev->class >> 8; | 109 | unsigned int class = dev->class >> 8; |
113 | 110 | ||
@@ -359,7 +356,7 @@ common_init_pci(void) | |||
359 | hose, &resources); | 356 | hose, &resources); |
360 | hose->bus = bus; | 357 | hose->bus = bus; |
361 | hose->need_domain_info = need_domain_info; | 358 | hose->need_domain_info = need_domain_info; |
362 | next_busno = bus->subordinate + 1; | 359 | next_busno = bus->busn_res.end + 1; |
363 | /* Don't allow 8-bit bus number overflow inside the hose - | 360 | /* Don't allow 8-bit bus number overflow inside the hose - |
364 | reserve some space for bridges. */ | 361 | reserve some space for bridges. */ |
365 | if (next_busno > 224) { | 362 | if (next_busno > 224) { |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 25552508c3fd..2b2f25e7fef5 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -253,7 +253,7 @@ static void __devinit pci_fixup_cy82c693(struct pci_dev *dev) | |||
253 | } | 253 | } |
254 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693); | 254 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693); |
255 | 255 | ||
256 | static void __init pci_fixup_it8152(struct pci_dev *dev) | 256 | static void __devinit pci_fixup_it8152(struct pci_dev *dev) |
257 | { | 257 | { |
258 | int i; | 258 | int i; |
259 | /* fixup for ITE 8152 devices */ | 259 | /* fixup for ITE 8152 devices */ |
@@ -461,7 +461,7 @@ static void __init pcibios_init_hw(struct hw_pci *hw, struct list_head *head) | |||
461 | if (!sys->bus) | 461 | if (!sys->bus) |
462 | panic("PCI: unable to scan bus!"); | 462 | panic("PCI: unable to scan bus!"); |
463 | 463 | ||
464 | busnr = sys->bus->subordinate + 1; | 464 | busnr = sys->bus->busn_res.end + 1; |
465 | 465 | ||
466 | list_add(&sys->node, head); | 466 | list_add(&sys->node, head); |
467 | } else { | 467 | } else { |
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c index 6b0b82ff4419..d04ed14bbf0c 100644 --- a/arch/frv/mb93090-mb00/pci-vdk.c +++ b/arch/frv/mb93090-mb00/pci-vdk.c | |||
@@ -268,7 +268,7 @@ static void __init pci_fixup_umc_ide(struct pci_dev *d) | |||
268 | d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO; | 268 | d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO; |
269 | } | 269 | } |
270 | 270 | ||
271 | static void __init pci_fixup_ide_bases(struct pci_dev *d) | 271 | static void __devinit pci_fixup_ide_bases(struct pci_dev *d) |
272 | { | 272 | { |
273 | int i; | 273 | int i; |
274 | 274 | ||
@@ -287,7 +287,7 @@ static void __init pci_fixup_ide_bases(struct pci_dev *d) | |||
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | static void __init pci_fixup_ide_trash(struct pci_dev *d) | 290 | static void __devinit pci_fixup_ide_trash(struct pci_dev *d) |
291 | { | 291 | { |
292 | int i; | 292 | int i; |
293 | 293 | ||
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 524df4295c90..d173a88d744a 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -351,6 +351,8 @@ pci_acpi_scan_root(struct acpi_pci_root *root) | |||
351 | #endif | 351 | #endif |
352 | 352 | ||
353 | INIT_LIST_HEAD(&info.resources); | 353 | INIT_LIST_HEAD(&info.resources); |
354 | /* insert busn resource at first */ | ||
355 | pci_add_resource(&info.resources, &root->secondary); | ||
354 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, | 356 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, |
355 | &windows); | 357 | &windows); |
356 | if (windows) { | 358 | if (windows) { |
@@ -384,7 +386,7 @@ pci_acpi_scan_root(struct acpi_pci_root *root) | |||
384 | return NULL; | 386 | return NULL; |
385 | } | 387 | } |
386 | 388 | ||
387 | pbus->subordinate = pci_scan_child_bus(pbus); | 389 | pci_scan_child_bus(pbus); |
388 | return pbus; | 390 | return pbus; |
389 | 391 | ||
390 | out3: | 392 | out3: |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index ed22bfc5db14..9b32483cd0c0 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -1506,10 +1506,10 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1506 | pci_free_resource_list(&resources); | 1506 | pci_free_resource_list(&resources); |
1507 | return; | 1507 | return; |
1508 | } | 1508 | } |
1509 | bus->secondary = hose->first_busno; | 1509 | bus->busn_res.start = hose->first_busno; |
1510 | hose->bus = bus; | 1510 | hose->bus = bus; |
1511 | 1511 | ||
1512 | hose->last_busno = bus->subordinate; | 1512 | hose->last_busno = bus->busn_res.end; |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | static int __init pcibios_init(void) | 1515 | static int __init pcibios_init(void) |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 271e8c4a54c7..0a9bf778edb5 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -102,7 +102,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose) | |||
102 | need_domain_info = need_domain_info || hose->index; | 102 | need_domain_info = need_domain_info || hose->index; |
103 | hose->need_domain_info = need_domain_info; | 103 | hose->need_domain_info = need_domain_info; |
104 | if (bus) { | 104 | if (bus) { |
105 | next_busno = bus->subordinate + 1; | 105 | next_busno = bus->busn_res.end + 1; |
106 | /* Don't allow 8-bit bus number overflow inside the hose - | 106 | /* Don't allow 8-bit bus number overflow inside the hose - |
107 | reserve some space for bridges. */ | 107 | reserve some space for bridges. */ |
108 | if (next_busno > 224) { | 108 | if (next_busno > 224) { |
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index ac39e6a3b25a..8cccbee61519 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -30,6 +30,7 @@ struct pci_controller { | |||
30 | int first_busno; | 30 | int first_busno; |
31 | int last_busno; | 31 | int last_busno; |
32 | int self_busno; | 32 | int self_busno; |
33 | struct resource busn; | ||
33 | 34 | ||
34 | void __iomem *io_base_virt; | 35 | void __iomem *io_base_virt; |
35 | #ifdef CONFIG_PPC64 | 36 | #ifdef CONFIG_PPC64 |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 8e78e93c8185..7320f3685523 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1637,6 +1637,11 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1637 | /* Wire up PHB bus resources */ | 1637 | /* Wire up PHB bus resources */ |
1638 | pcibios_setup_phb_resources(hose, &resources); | 1638 | pcibios_setup_phb_resources(hose, &resources); |
1639 | 1639 | ||
1640 | hose->busn.start = hose->first_busno; | ||
1641 | hose->busn.end = hose->last_busno; | ||
1642 | hose->busn.flags = IORESOURCE_BUS; | ||
1643 | pci_add_resource(&resources, &hose->busn); | ||
1644 | |||
1640 | /* Create an empty bus for the toplevel */ | 1645 | /* Create an empty bus for the toplevel */ |
1641 | bus = pci_create_root_bus(hose->parent, hose->first_busno, | 1646 | bus = pci_create_root_bus(hose->parent, hose->first_busno, |
1642 | hose->ops, hose, &resources); | 1647 | hose->ops, hose, &resources); |
@@ -1646,7 +1651,6 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1646 | pci_free_resource_list(&resources); | 1651 | pci_free_resource_list(&resources); |
1647 | return; | 1652 | return; |
1648 | } | 1653 | } |
1649 | bus->secondary = hose->first_busno; | ||
1650 | hose->bus = bus; | 1654 | hose->bus = bus; |
1651 | 1655 | ||
1652 | /* Get probe mode and perform scan */ | 1656 | /* Get probe mode and perform scan */ |
@@ -1654,13 +1658,14 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose) | |||
1654 | if (node && ppc_md.pci_probe_mode) | 1658 | if (node && ppc_md.pci_probe_mode) |
1655 | mode = ppc_md.pci_probe_mode(bus); | 1659 | mode = ppc_md.pci_probe_mode(bus); |
1656 | pr_debug(" probe mode: %d\n", mode); | 1660 | pr_debug(" probe mode: %d\n", mode); |
1657 | if (mode == PCI_PROBE_DEVTREE) { | 1661 | if (mode == PCI_PROBE_DEVTREE) |
1658 | bus->subordinate = hose->last_busno; | ||
1659 | of_scan_bus(node, bus); | 1662 | of_scan_bus(node, bus); |
1660 | } | ||
1661 | 1663 | ||
1662 | if (mode == PCI_PROBE_NORMAL) | 1664 | if (mode == PCI_PROBE_NORMAL) { |
1663 | hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); | 1665 | pci_bus_update_busn_res_end(bus, 255); |
1666 | hose->last_busno = pci_scan_child_bus(bus); | ||
1667 | pci_bus_update_busn_res_end(bus, hose->last_busno); | ||
1668 | } | ||
1664 | 1669 | ||
1665 | /* Platform gets a chance to do some global fixups before | 1670 | /* Platform gets a chance to do some global fixups before |
1666 | * we proceed to resource allocation | 1671 | * we proceed to resource allocation |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 94a54f61d341..4ff190ff24a0 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -236,7 +236,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
236 | 236 | ||
237 | for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { | 237 | for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { |
238 | bus = pci_bus_b(ln); | 238 | bus = pci_bus_b(ln); |
239 | if (in_bus >= bus->number && in_bus <= bus->subordinate) | 239 | if (in_bus >= bus->number && in_bus <= bus->busn_res.end) |
240 | break; | 240 | break; |
241 | bus = NULL; | 241 | bus = NULL; |
242 | } | 242 | } |
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index 89dde171a6fa..ae5ea5e04d65 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c | |||
@@ -240,7 +240,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | bus->primary = dev->bus->number; | 242 | bus->primary = dev->bus->number; |
243 | bus->subordinate = busrange[1]; | 243 | pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); |
244 | bus->bridge_ctl = 0; | 244 | bus->bridge_ctl = 0; |
245 | 245 | ||
246 | /* parse ranges property */ | 246 | /* parse ranges property */ |
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c index 4d786c25d3e5..3e70a2035e53 100644 --- a/arch/powerpc/platforms/85xx/tqm85xx.c +++ b/arch/powerpc/platforms/85xx/tqm85xx.c | |||
@@ -102,7 +102,7 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m) | |||
102 | seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); | 102 | seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); |
103 | } | 103 | } |
104 | 104 | ||
105 | static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev) | 105 | static void __devinit tqm85xx_ti1520_fixup(struct pci_dev *pdev) |
106 | { | 106 | { |
107 | unsigned int val; | 107 | unsigned int val; |
108 | 108 | ||
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c index 1fca663f1b25..563aafa8629c 100644 --- a/arch/powerpc/platforms/86xx/gef_ppc9a.c +++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c | |||
@@ -164,7 +164,7 @@ static void gef_ppc9a_show_cpuinfo(struct seq_file *m) | |||
164 | gef_ppc9a_get_vme_is_syscon() ? "yes" : "no"); | 164 | gef_ppc9a_get_vme_is_syscon() ? "yes" : "no"); |
165 | } | 165 | } |
166 | 166 | ||
167 | static void __init gef_ppc9a_nec_fixup(struct pci_dev *pdev) | 167 | static void __devinit gef_ppc9a_nec_fixup(struct pci_dev *pdev) |
168 | { | 168 | { |
169 | unsigned int val; | 169 | unsigned int val; |
170 | 170 | ||
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c index 14e0e576bcbd..cc6a91ae0889 100644 --- a/arch/powerpc/platforms/86xx/gef_sbc310.c +++ b/arch/powerpc/platforms/86xx/gef_sbc310.c | |||
@@ -152,7 +152,7 @@ static void gef_sbc310_show_cpuinfo(struct seq_file *m) | |||
152 | 152 | ||
153 | } | 153 | } |
154 | 154 | ||
155 | static void __init gef_sbc310_nec_fixup(struct pci_dev *pdev) | 155 | static void __devinit gef_sbc310_nec_fixup(struct pci_dev *pdev) |
156 | { | 156 | { |
157 | unsigned int val; | 157 | unsigned int val; |
158 | 158 | ||
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c index 1638f43599f0..aead6b337f4a 100644 --- a/arch/powerpc/platforms/86xx/gef_sbc610.c +++ b/arch/powerpc/platforms/86xx/gef_sbc610.c | |||
@@ -141,7 +141,7 @@ static void gef_sbc610_show_cpuinfo(struct seq_file *m) | |||
141 | seq_printf(m, "SVR\t\t: 0x%x\n", svid); | 141 | seq_printf(m, "SVR\t\t: 0x%x\n", svid); |
142 | } | 142 | } |
143 | 143 | ||
144 | static void __init gef_sbc610_nec_fixup(struct pci_dev *pdev) | 144 | static void __devinit gef_sbc610_nec_fixup(struct pci_dev *pdev) |
145 | { | 145 | { |
146 | unsigned int val; | 146 | unsigned int val; |
147 | 147 | ||
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index fbdd74dac3ac..9cda6a1ad0cf 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -589,7 +589,7 @@ static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb, | |||
589 | dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER; | 589 | dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER; |
590 | fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER; | 590 | fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER; |
591 | parent = pe->pbus->self; | 591 | parent = pe->pbus->self; |
592 | count = pe->pbus->subordinate - pe->pbus->secondary + 1; | 592 | count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1; |
593 | switch(count) { | 593 | switch(count) { |
594 | case 1: bcomp = OpalPciBusAll; break; | 594 | case 1: bcomp = OpalPciBusAll; break; |
595 | case 2: bcomp = OpalPciBus7Bits; break; | 595 | case 2: bcomp = OpalPciBus7Bits; break; |
@@ -816,11 +816,11 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev, | |||
816 | pe->pdev = NULL; | 816 | pe->pdev = NULL; |
817 | pe->tce32_seg = -1; | 817 | pe->tce32_seg = -1; |
818 | pe->mve_number = -1; | 818 | pe->mve_number = -1; |
819 | pe->rid = bus->secondary << 8; | 819 | pe->rid = bus->busn_res.start << 8; |
820 | pe->dma_weight = 0; | 820 | pe->dma_weight = 0; |
821 | 821 | ||
822 | pe_info(pe, "Secondary busses %d..%d associated with PE\n", | 822 | pe_info(pe, "Secondary busses %pR associated with PE\n", |
823 | bus->secondary, bus->subordinate); | 823 | &bus->busn_res); |
824 | 824 | ||
825 | if (pnv_ioda_configure_pe(phb, pe)) { | 825 | if (pnv_ioda_configure_pe(phb, pe)) { |
826 | /* XXX What do we do here ? */ | 826 | /* XXX What do we do here ? */ |
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index 8b7bafa489c2..3ccebc83dc02 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c | |||
@@ -121,7 +121,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus) | |||
121 | if (!num) | 121 | if (!num) |
122 | return; | 122 | return; |
123 | pcibios_setup_bus_devices(bus); | 123 | pcibios_setup_bus_devices(bus); |
124 | max = bus->secondary; | 124 | max = bus->busn_res.start; |
125 | for (pass=0; pass < 2; pass++) | 125 | for (pass=0; pass < 2; pass++) |
126 | list_for_each_entry(dev, &bus->devices, bus_list) { | 126 | list_for_each_entry(dev, &bus->devices, bus_list) { |
127 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 127 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 6073288fed29..edbf79465d50 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | static int fsl_pcie_bus_fixup, is_mpc83xx_pci; | 37 | static int fsl_pcie_bus_fixup, is_mpc83xx_pci; |
38 | 38 | ||
39 | static void __init quirk_fsl_pcie_header(struct pci_dev *dev) | 39 | static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev) |
40 | { | 40 | { |
41 | u8 progif; | 41 | u8 progif; |
42 | 42 | ||
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c index b0037cefaada..364b14d4754b 100644 --- a/arch/powerpc/sysdev/mv64x60_pci.c +++ b/arch/powerpc/sysdev/mv64x60_pci.c | |||
@@ -104,7 +104,7 @@ subsys_initcall(mv64x60_sysfs_init); | |||
104 | 104 | ||
105 | #endif /* CONFIG_SYSFS */ | 105 | #endif /* CONFIG_SYSFS */ |
106 | 106 | ||
107 | static void __init mv64x60_pci_fixup_early(struct pci_dev *dev) | 107 | static void __devinit mv64x60_pci_fixup_early(struct pci_dev *dev) |
108 | { | 108 | { |
109 | /* | 109 | /* |
110 | * Set the host bridge hdr_type to an invalid value so that | 110 | * Set the host bridge hdr_type to an invalid value so that |
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c index edeea8960c30..a5fe1b54c952 100644 --- a/arch/sh/drivers/pci/fixups-dreamcast.c +++ b/arch/sh/drivers/pci/fixups-dreamcast.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
29 | #include <mach/pci.h> | 29 | #include <mach/pci.h> |
30 | 30 | ||
31 | static void __init gapspci_fixup_resources(struct pci_dev *dev) | 31 | static void __devinit gapspci_fixup_resources(struct pci_dev *dev) |
32 | { | 32 | { |
33 | struct pci_channel *p = dev->sysdata; | 33 | struct pci_channel *p = dev->sysdata; |
34 | 34 | ||
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 9d10a3cb8797..43068dcb451c 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -59,7 +59,7 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose) | |||
59 | need_domain_info = need_domain_info || hose->index; | 59 | need_domain_info = need_domain_info || hose->index; |
60 | hose->need_domain_info = need_domain_info; | 60 | hose->need_domain_info = need_domain_info; |
61 | if (bus) { | 61 | if (bus) { |
62 | next_busno = bus->subordinate + 1; | 62 | next_busno = bus->busn_res.end + 1; |
63 | /* Don't allow 8-bit bus number overflow inside the hose - | 63 | /* Don't allow 8-bit bus number overflow inside the hose - |
64 | reserve some space for bridges. */ | 64 | reserve some space for bridges. */ |
65 | if (next_busno > 224) { | 65 | if (next_busno > 224) { |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index fdaf21811670..4f92a9aba358 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -535,7 +535,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
535 | } | 535 | } |
536 | 536 | ||
537 | bus->primary = dev->bus->number; | 537 | bus->primary = dev->bus->number; |
538 | bus->subordinate = busrange[1]; | 538 | pci_bus_insert_busn_res(bus, busrange[0], busrange[1]); |
539 | bus->bridge_ctl = 0; | 539 | bus->bridge_ctl = 0; |
540 | 540 | ||
541 | /* parse ranges property, or cook one up by hand for Simba */ | 541 | /* parse ranges property, or cook one up by hand for Simba */ |
@@ -685,6 +685,10 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, | |||
685 | pbm->io_space.start); | 685 | pbm->io_space.start); |
686 | pci_add_resource_offset(&resources, &pbm->mem_space, | 686 | pci_add_resource_offset(&resources, &pbm->mem_space, |
687 | pbm->mem_space.start); | 687 | pbm->mem_space.start); |
688 | pbm->busn.start = pbm->pci_first_busno; | ||
689 | pbm->busn.end = pbm->pci_last_busno; | ||
690 | pbm->busn.flags = IORESOURCE_BUS; | ||
691 | pci_add_resource(&resources, &pbm->busn); | ||
688 | bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, | 692 | bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops, |
689 | pbm, &resources); | 693 | pbm, &resources); |
690 | if (!bus) { | 694 | if (!bus) { |
@@ -693,8 +697,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, | |||
693 | pci_free_resource_list(&resources); | 697 | pci_free_resource_list(&resources); |
694 | return NULL; | 698 | return NULL; |
695 | } | 699 | } |
696 | bus->secondary = pbm->pci_first_busno; | ||
697 | bus->subordinate = pbm->pci_last_busno; | ||
698 | 700 | ||
699 | pci_of_scan_bus(pbm, node, bus); | 701 | pci_of_scan_bus(pbm, node, bus); |
700 | pci_bus_add_devices(bus); | 702 | pci_bus_add_devices(bus); |
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 6beb60df31d0..918a2031c8bb 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h | |||
@@ -97,6 +97,7 @@ struct pci_pbm_info { | |||
97 | /* PBM I/O and Memory space resources. */ | 97 | /* PBM I/O and Memory space resources. */ |
98 | struct resource io_space; | 98 | struct resource io_space; |
99 | struct resource mem_space; | 99 | struct resource mem_space; |
100 | struct resource busn; | ||
100 | 101 | ||
101 | /* Base of PCI Config space, can be per-PBM or shared. */ | 102 | /* Base of PCI Config space, can be per-PBM or shared. */ |
102 | unsigned long config_space; | 103 | unsigned long config_space; |
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index b56d12bf5900..87422ed7b834 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -310,6 +310,7 @@ int __init pcibios_init(void) | |||
310 | if (pci_scan_flags[i] == 0 && controllers[i].ops != NULL) { | 310 | if (pci_scan_flags[i] == 0 && controllers[i].ops != NULL) { |
311 | struct pci_controller *controller = &controllers[i]; | 311 | struct pci_controller *controller = &controllers[i]; |
312 | struct pci_bus *bus; | 312 | struct pci_bus *bus; |
313 | LIST_HEAD(resources); | ||
313 | 314 | ||
314 | if (tile_init_irqs(i, controller)) { | 315 | if (tile_init_irqs(i, controller)) { |
315 | pr_err("PCI: Could not initialize IRQs\n"); | 316 | pr_err("PCI: Could not initialize IRQs\n"); |
@@ -327,9 +328,11 @@ int __init pcibios_init(void) | |||
327 | * This is inlined in linux/pci.h and calls into | 328 | * This is inlined in linux/pci.h and calls into |
328 | * pci_scan_bus_parented() in probe.c. | 329 | * pci_scan_bus_parented() in probe.c. |
329 | */ | 330 | */ |
330 | bus = pci_scan_bus(0, controller->ops, controller); | 331 | pci_add_resource(&resources, &ioport_resource); |
332 | pci_add_resource(&resources, &iomem_resource); | ||
333 | bus = pci_scan_root_bus(NULL, 0, controller->ops, controller, &resources); | ||
331 | controller->root_bus = bus; | 334 | controller->root_bus = bus; |
332 | controller->last_busno = bus->subordinate; | 335 | controller->last_busno = bus->busn_res.end; |
333 | } | 336 | } |
334 | } | 337 | } |
335 | 338 | ||
@@ -366,7 +369,7 @@ int __init pcibios_init(void) | |||
366 | */ | 369 | */ |
367 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && | 370 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI && |
368 | (PCI_SLOT(dev->devfn) == 0)) { | 371 | (PCI_SLOT(dev->devfn) == 0)) { |
369 | next_bus = dev->subordinate; | 372 | next_bus = dev->busn_res.end; |
370 | controllers[i].mem_resources[0] = | 373 | controllers[i].mem_resources[0] = |
371 | *next_bus->resource[0]; | 374 | *next_bus->resource[0]; |
372 | controllers[i].mem_resources[1] = | 375 | controllers[i].mem_resources[1] = |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index 03920a15a632..1b27de563561 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -512,7 +512,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, | |||
512 | 512 | ||
513 | #if defined(CONFIG_PCI) && defined(CONFIG_NUMA) | 513 | #if defined(CONFIG_PCI) && defined(CONFIG_NUMA) |
514 | /* Set correct numa_node information for AMD NB functions */ | 514 | /* Set correct numa_node information for AMD NB functions */ |
515 | static void __init quirk_amd_nb_node(struct pci_dev *dev) | 515 | static void __devinit quirk_amd_nb_node(struct pci_dev *dev) |
516 | { | 516 | { |
517 | struct pci_dev *nb_ht; | 517 | struct pci_dev *nb_ht; |
518 | unsigned int devfn; | 518 | unsigned int devfn; |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index fc09c2754e08..2bb885afe103 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -12,7 +12,6 @@ struct pci_root_info { | |||
12 | char name[16]; | 12 | char name[16]; |
13 | unsigned int res_num; | 13 | unsigned int res_num; |
14 | struct resource *res; | 14 | struct resource *res; |
15 | int busnum; | ||
16 | struct pci_sysdata sd; | 15 | struct pci_sysdata sd; |
17 | }; | 16 | }; |
18 | 17 | ||
@@ -347,7 +346,9 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, | |||
347 | { | 346 | { |
348 | size_t size; | 347 | size_t size; |
349 | 348 | ||
349 | sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum); | ||
350 | info->bridge = device; | 350 | info->bridge = device; |
351 | |||
351 | info->res_num = 0; | 352 | info->res_num = 0; |
352 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, | 353 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, |
353 | info); | 354 | info); |
@@ -360,8 +361,6 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, | |||
360 | if (!info->res) | 361 | if (!info->res) |
361 | return; | 362 | return; |
362 | 363 | ||
363 | sprintf(info->name, "PCI Bus %04x:%02x", domain, busnum); | ||
364 | |||
365 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, | 364 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, |
366 | info); | 365 | info); |
367 | } | 366 | } |
@@ -426,6 +425,8 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | |||
426 | } else { | 425 | } else { |
427 | probe_pci_root_info(info, device, busnum, domain); | 426 | probe_pci_root_info(info, device, busnum, domain); |
428 | 427 | ||
428 | /* insert busn res at first */ | ||
429 | pci_add_resource(&resources, &root->secondary); | ||
429 | /* | 430 | /* |
430 | * _CRS with no apertures is normal, so only fall back to | 431 | * _CRS with no apertures is normal, so only fall back to |
431 | * defaults or native bridge info if we're ignoring _CRS. | 432 | * defaults or native bridge info if we're ignoring _CRS. |
@@ -440,7 +441,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | |||
440 | bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, | 441 | bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, |
441 | &resources); | 442 | &resources); |
442 | if (bus) { | 443 | if (bus) { |
443 | bus->subordinate = pci_scan_child_bus(bus); | 444 | pci_scan_child_bus(bus); |
444 | pci_set_host_bridge_release( | 445 | pci_set_host_bridge_release( |
445 | to_pci_host_bridge(bus->bridge), | 446 | to_pci_host_bridge(bus->bridge), |
446 | release_pci_root_info, info); | 447 | release_pci_root_info, info); |
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index 5aed49bff058..e9e6ed5cdf94 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -121,7 +121,6 @@ static int __init early_fill_mp_bus_info(void) | |||
121 | link = (reg >> 8) & 0x03; | 121 | link = (reg >> 8) & 0x03; |
122 | 122 | ||
123 | info = alloc_pci_root_info(min_bus, max_bus, node, link); | 123 | info = alloc_pci_root_info(min_bus, max_bus, node, link); |
124 | sprintf(info->name, "PCI Bus #%02x", min_bus); | ||
125 | } | 124 | } |
126 | 125 | ||
127 | /* get the default node and link for left over res */ | 126 | /* get the default node and link for left over res */ |
@@ -300,9 +299,9 @@ static int __init early_fill_mp_bus_info(void) | |||
300 | int busnum; | 299 | int busnum; |
301 | struct pci_root_res *root_res; | 300 | struct pci_root_res *root_res; |
302 | 301 | ||
303 | busnum = info->bus_min; | 302 | busnum = info->busn.start; |
304 | printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n", | 303 | printk(KERN_DEBUG "bus: %pR on node %x link %x\n", |
305 | info->bus_min, info->bus_max, info->node, info->link); | 304 | &info->busn, info->node, info->link); |
306 | list_for_each_entry(root_res, &info->resources, list) | 305 | list_for_each_entry(root_res, &info->resources, list) |
307 | printk(KERN_DEBUG "bus: %02x %pR\n", | 306 | printk(KERN_DEBUG "bus: %02x %pR\n", |
308 | busnum, &root_res->res); | 307 | busnum, &root_res->res); |
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c index 306579f7d0fd..d37e2fec97e5 100644 --- a/arch/x86/pci/bus_numa.c +++ b/arch/x86/pci/bus_numa.c | |||
@@ -14,7 +14,7 @@ static struct pci_root_info *x86_find_pci_root_info(int bus) | |||
14 | return NULL; | 14 | return NULL; |
15 | 15 | ||
16 | list_for_each_entry(info, &pci_root_infos, list) | 16 | list_for_each_entry(info, &pci_root_infos, list) |
17 | if (info->bus_min == bus) | 17 | if (info->busn.start == bus) |
18 | return info; | 18 | return info; |
19 | 19 | ||
20 | return NULL; | 20 | return NULL; |
@@ -24,6 +24,8 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources) | |||
24 | { | 24 | { |
25 | struct pci_root_info *info = x86_find_pci_root_info(bus); | 25 | struct pci_root_info *info = x86_find_pci_root_info(bus); |
26 | struct pci_root_res *root_res; | 26 | struct pci_root_res *root_res; |
27 | struct pci_host_bridge_window *window; | ||
28 | bool found = false; | ||
27 | 29 | ||
28 | if (!info) | 30 | if (!info) |
29 | goto default_resources; | 31 | goto default_resources; |
@@ -31,6 +33,16 @@ void x86_pci_root_bus_resources(int bus, struct list_head *resources) | |||
31 | printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", | 33 | printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", |
32 | bus); | 34 | bus); |
33 | 35 | ||
36 | /* already added by acpi ? */ | ||
37 | list_for_each_entry(window, resources, list) | ||
38 | if (window->res->flags & IORESOURCE_BUS) { | ||
39 | found = true; | ||
40 | break; | ||
41 | } | ||
42 | |||
43 | if (!found) | ||
44 | pci_add_resource(resources, &info->busn); | ||
45 | |||
34 | list_for_each_entry(root_res, &info->resources, list) { | 46 | list_for_each_entry(root_res, &info->resources, list) { |
35 | struct resource *res; | 47 | struct resource *res; |
36 | struct resource *root; | 48 | struct resource *root; |
@@ -66,9 +78,13 @@ struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max, | |||
66 | if (!info) | 78 | if (!info) |
67 | return info; | 79 | return info; |
68 | 80 | ||
81 | sprintf(info->name, "PCI Bus #%02x", bus_min); | ||
82 | |||
69 | INIT_LIST_HEAD(&info->resources); | 83 | INIT_LIST_HEAD(&info->resources); |
70 | info->bus_min = bus_min; | 84 | info->busn.name = info->name; |
71 | info->bus_max = bus_max; | 85 | info->busn.start = bus_min; |
86 | info->busn.end = bus_max; | ||
87 | info->busn.flags = IORESOURCE_BUS; | ||
72 | info->node = node; | 88 | info->node = node; |
73 | info->link = link; | 89 | info->link = link; |
74 | 90 | ||
diff --git a/arch/x86/pci/bus_numa.h b/arch/x86/pci/bus_numa.h index 226a466b2b2b..ff8f65b04574 100644 --- a/arch/x86/pci/bus_numa.h +++ b/arch/x86/pci/bus_numa.h | |||
@@ -13,8 +13,7 @@ struct pci_root_info { | |||
13 | struct list_head list; | 13 | struct list_head list; |
14 | char name[12]; | 14 | char name[12]; |
15 | struct list_head resources; | 15 | struct list_head resources; |
16 | int bus_min; | 16 | struct resource busn; |
17 | int bus_max; | ||
18 | int node; | 17 | int node; |
19 | int link; | 18 | int link; |
20 | }; | 19 | }; |
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index eb30e356f5be..9c57c1e6870c 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -187,7 +187,7 @@ static int __init pcibios_init(void) | |||
187 | bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno, | 187 | bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno, |
188 | pci_ctrl->ops, pci_ctrl, &resources); | 188 | pci_ctrl->ops, pci_ctrl, &resources); |
189 | pci_ctrl->bus = bus; | 189 | pci_ctrl->bus = bus; |
190 | pci_ctrl->last_busno = bus->subordinate; | 190 | pci_ctrl->last_busno = bus->busn_res.end; |
191 | if (next_busno <= pci_ctrl->last_busno) | 191 | if (next_busno <= pci_ctrl->last_busno) |
192 | next_busno = pci_ctrl->last_busno+1; | 192 | next_busno = pci_ctrl->last_busno+1; |
193 | } | 193 | } |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index b12af2ff8c54..2fb7d1598a68 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -661,7 +661,7 @@ static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn) | |||
661 | if (drhd->devices[i] && | 661 | if (drhd->devices[i] && |
662 | drhd->devices[i]->subordinate && | 662 | drhd->devices[i]->subordinate && |
663 | drhd->devices[i]->subordinate->number <= bus && | 663 | drhd->devices[i]->subordinate->number <= bus && |
664 | drhd->devices[i]->subordinate->subordinate >= bus) | 664 | drhd->devices[i]->subordinate->busn_res.end >= bus) |
665 | return drhd->iommu; | 665 | return drhd->iommu; |
666 | } | 666 | } |
667 | 667 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index edeeb516807a..09fa3c687a1f 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -14168,7 +14168,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
14168 | if (bridge->subordinate && | 14168 | if (bridge->subordinate && |
14169 | (bridge->subordinate->number <= | 14169 | (bridge->subordinate->number <= |
14170 | tp->pdev->bus->number) && | 14170 | tp->pdev->bus->number) && |
14171 | (bridge->subordinate->subordinate >= | 14171 | (bridge->subordinate->busn_res.end >= |
14172 | tp->pdev->bus->number)) { | 14172 | tp->pdev->bus->number)) { |
14173 | tg3_flag_set(tp, 5701_DMA_BUG); | 14173 | tg3_flag_set(tp, 5701_DMA_BUG); |
14174 | pci_dev_put(bridge); | 14174 | pci_dev_put(bridge); |
@@ -14196,7 +14196,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
14196 | if (bridge && bridge->subordinate && | 14196 | if (bridge && bridge->subordinate && |
14197 | (bridge->subordinate->number <= | 14197 | (bridge->subordinate->number <= |
14198 | tp->pdev->bus->number) && | 14198 | tp->pdev->bus->number) && |
14199 | (bridge->subordinate->subordinate >= | 14199 | (bridge->subordinate->busn_res.end >= |
14200 | tp->pdev->bus->number)) { | 14200 | tp->pdev->bus->number)) { |
14201 | tg3_flag_set(tp, 40BIT_DMA_BUG); | 14201 | tg3_flag_set(tp, 40BIT_DMA_BUG); |
14202 | pci_dev_put(bridge); | 14202 | pci_dev_put(bridge); |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 432d4bbcc62a..ffddc4f64268 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -174,7 +174,7 @@ static int dino_cfg_read(struct pci_bus *bus, unsigned int devfn, int where, | |||
174 | int size, u32 *val) | 174 | int size, u32 *val) |
175 | { | 175 | { |
176 | struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); | 176 | struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); |
177 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 177 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
178 | u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); | 178 | u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); |
179 | void __iomem *base_addr = d->hba.base_addr; | 179 | void __iomem *base_addr = d->hba.base_addr; |
180 | unsigned long flags; | 180 | unsigned long flags; |
@@ -209,7 +209,7 @@ static int dino_cfg_write(struct pci_bus *bus, unsigned int devfn, int where, | |||
209 | int size, u32 val) | 209 | int size, u32 val) |
210 | { | 210 | { |
211 | struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); | 211 | struct dino_device *d = DINO_DEV(parisc_walk_tree(bus->bridge)); |
212 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 212 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
213 | u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); | 213 | u32 v = DINO_CFG_TOK(local_bus, devfn, where & ~3); |
214 | void __iomem *base_addr = d->hba.base_addr; | 214 | void __iomem *base_addr = d->hba.base_addr; |
215 | unsigned long flags; | 215 | unsigned long flags; |
@@ -554,7 +554,7 @@ dino_fixup_bus(struct pci_bus *bus) | |||
554 | struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge)); | 554 | struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge)); |
555 | 555 | ||
556 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", | 556 | DBG(KERN_WARNING "%s(0x%p) bus %d platform_data 0x%p\n", |
557 | __func__, bus, bus->secondary, | 557 | __func__, bus, bus->busn_res.start, |
558 | bus->bridge->platform_data); | 558 | bus->bridge->platform_data); |
559 | 559 | ||
560 | /* Firmware doesn't set up card-mode dino, so we have to */ | 560 | /* Firmware doesn't set up card-mode dino, so we have to */ |
@@ -898,6 +898,7 @@ static int __init dino_probe(struct parisc_device *dev) | |||
898 | LIST_HEAD(resources); | 898 | LIST_HEAD(resources); |
899 | struct pci_bus *bus; | 899 | struct pci_bus *bus; |
900 | unsigned long hpa = dev->hpa.start; | 900 | unsigned long hpa = dev->hpa.start; |
901 | int max; | ||
901 | 902 | ||
902 | name = "Dino"; | 903 | name = "Dino"; |
903 | if (is_card_dino(&dev->id)) { | 904 | if (is_card_dino(&dev->id)) { |
@@ -983,6 +984,10 @@ static int __init dino_probe(struct parisc_device *dev) | |||
983 | if (dino_dev->hba.gmmio_space.flags) | 984 | if (dino_dev->hba.gmmio_space.flags) |
984 | pci_add_resource(&resources, &dino_dev->hba.gmmio_space); | 985 | pci_add_resource(&resources, &dino_dev->hba.gmmio_space); |
985 | 986 | ||
987 | dino_dev->hba.bus_num.start = dino_current_bus; | ||
988 | dino_dev->hba.bus_num.end = 255; | ||
989 | dino_dev->hba.bus_num.flags = IORESOURCE_BUS; | ||
990 | pci_add_resource(&resources, &dino_dev->hba.bus_num); | ||
986 | /* | 991 | /* |
987 | ** It's not used to avoid chicken/egg problems | 992 | ** It's not used to avoid chicken/egg problems |
988 | ** with configuration accessor functions. | 993 | ** with configuration accessor functions. |
@@ -998,12 +1003,13 @@ static int __init dino_probe(struct parisc_device *dev) | |||
998 | return 0; | 1003 | return 0; |
999 | } | 1004 | } |
1000 | 1005 | ||
1001 | bus->subordinate = pci_scan_child_bus(bus); | 1006 | max = pci_scan_child_bus(bus); |
1007 | pci_bus_update_busn_res_end(bus, max); | ||
1002 | 1008 | ||
1003 | /* This code *depends* on scanning being single threaded | 1009 | /* This code *depends* on scanning being single threaded |
1004 | * if it isn't, this global bus number count will fail | 1010 | * if it isn't, this global bus number count will fail |
1005 | */ | 1011 | */ |
1006 | dino_current_bus = bus->subordinate + 1; | 1012 | dino_current_bus = max + 1; |
1007 | pci_bus_assign_resources(bus); | 1013 | pci_bus_assign_resources(bus); |
1008 | pci_bus_add_devices(bus); | 1014 | pci_bus_add_devices(bus); |
1009 | return 0; | 1015 | return 0; |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 1f9e9fefb8e7..83380c8fcb6b 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -532,7 +532,7 @@ iosapic_xlate_pin(struct iosapic_info *isi, struct pci_dev *pcidev) | |||
532 | intr_slot = PCI_SLOT(pcidev->devfn); | 532 | intr_slot = PCI_SLOT(pcidev->devfn); |
533 | } | 533 | } |
534 | DBG_IRT("iosapic_xlate_pin: bus %d slot %d pin %d\n", | 534 | DBG_IRT("iosapic_xlate_pin: bus %d slot %d pin %d\n", |
535 | pcidev->bus->secondary, intr_slot, intr_pin); | 535 | pcidev->bus->busn_res.start, intr_slot, intr_pin); |
536 | 536 | ||
537 | return irt_find_irqline(isi, intr_slot, intr_pin); | 537 | return irt_find_irqline(isi, intr_slot, intr_pin); |
538 | } | 538 | } |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 052fa230bc77..4f9cf2456f4e 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -189,8 +189,8 @@ lba_dump_res(struct resource *r, int d) | |||
189 | 189 | ||
190 | static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d) | 190 | static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d) |
191 | { | 191 | { |
192 | u8 first_bus = d->hba.hba_bus->secondary; | 192 | u8 first_bus = d->hba.hba_bus->busn_res.start; |
193 | u8 last_sub_bus = d->hba.hba_bus->subordinate; | 193 | u8 last_sub_bus = d->hba.hba_bus->busn_res.end; |
194 | 194 | ||
195 | if ((bus < first_bus) || | 195 | if ((bus < first_bus) || |
196 | (bus > last_sub_bus) || | 196 | (bus > last_sub_bus) || |
@@ -364,7 +364,7 @@ lba_rd_cfg(struct lba_device *d, u32 tok, u8 reg, u32 size) | |||
364 | static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) | 364 | static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) |
365 | { | 365 | { |
366 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); | 366 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); |
367 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 367 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
368 | u32 tok = LBA_CFG_TOK(local_bus, devfn); | 368 | u32 tok = LBA_CFG_TOK(local_bus, devfn); |
369 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; | 369 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; |
370 | 370 | ||
@@ -380,7 +380,7 @@ static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
380 | return 0; | 380 | return 0; |
381 | } | 381 | } |
382 | 382 | ||
383 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) { | 383 | if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->busn_res.start, devfn, d)) { |
384 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos); | 384 | DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __func__, tok, pos); |
385 | /* either don't want to look or know device isn't present. */ | 385 | /* either don't want to look or know device isn't present. */ |
386 | *data = ~0U; | 386 | *data = ~0U; |
@@ -431,7 +431,7 @@ lba_wr_cfg(struct lba_device *d, u32 tok, u8 reg, u32 data, u32 size) | |||
431 | static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data) | 431 | static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data) |
432 | { | 432 | { |
433 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); | 433 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); |
434 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 434 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
435 | u32 tok = LBA_CFG_TOK(local_bus,devfn); | 435 | u32 tok = LBA_CFG_TOK(local_bus,devfn); |
436 | 436 | ||
437 | if ((pos > 255) || (devfn > 255)) | 437 | if ((pos > 255) || (devfn > 255)) |
@@ -444,7 +444,7 @@ static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int | |||
444 | return 0; | 444 | return 0; |
445 | } | 445 | } |
446 | 446 | ||
447 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d))) { | 447 | if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->busn_res.start, devfn, d))) { |
448 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data); | 448 | DBG_CFG("%s(%x+%2x) = 0x%x (b)\n", __func__, tok, pos,data); |
449 | return 1; /* New Workaround */ | 449 | return 1; /* New Workaround */ |
450 | } | 450 | } |
@@ -481,7 +481,7 @@ static struct pci_ops elroy_cfg_ops = { | |||
481 | static int mercury_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) | 481 | static int mercury_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data) |
482 | { | 482 | { |
483 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); | 483 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); |
484 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 484 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
485 | u32 tok = LBA_CFG_TOK(local_bus, devfn); | 485 | u32 tok = LBA_CFG_TOK(local_bus, devfn); |
486 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; | 486 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; |
487 | 487 | ||
@@ -514,7 +514,7 @@ static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, i | |||
514 | { | 514 | { |
515 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); | 515 | struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge)); |
516 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; | 516 | void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA; |
517 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary; | 517 | u32 local_bus = (bus->parent == NULL) ? 0 : bus->busn_res.start; |
518 | u32 tok = LBA_CFG_TOK(local_bus,devfn); | 518 | u32 tok = LBA_CFG_TOK(local_bus,devfn); |
519 | 519 | ||
520 | if ((pos > 255) || (devfn > 255)) | 520 | if ((pos > 255) || (devfn > 255)) |
@@ -636,7 +636,7 @@ lba_fixup_bus(struct pci_bus *bus) | |||
636 | struct lba_device *ldev = LBA_DEV(parisc_walk_tree(bus->bridge)); | 636 | struct lba_device *ldev = LBA_DEV(parisc_walk_tree(bus->bridge)); |
637 | 637 | ||
638 | DBG("lba_fixup_bus(0x%p) bus %d platform_data 0x%p\n", | 638 | DBG("lba_fixup_bus(0x%p) bus %d platform_data 0x%p\n", |
639 | bus, bus->secondary, bus->bridge->platform_data); | 639 | bus, (int)bus->busn_res.start, bus->bridge->platform_data); |
640 | 640 | ||
641 | /* | 641 | /* |
642 | ** Properly Setup MMIO resources for this bus. | 642 | ** Properly Setup MMIO resources for this bus. |
@@ -989,6 +989,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev) | |||
989 | case PAT_PBNUM: | 989 | case PAT_PBNUM: |
990 | lba_dev->hba.bus_num.start = p->start; | 990 | lba_dev->hba.bus_num.start = p->start; |
991 | lba_dev->hba.bus_num.end = p->end; | 991 | lba_dev->hba.bus_num.end = p->end; |
992 | lba_dev->hba.bus_num.flags = IORESOURCE_BUS; | ||
992 | break; | 993 | break; |
993 | 994 | ||
994 | case PAT_LMMIO: | 995 | case PAT_LMMIO: |
@@ -1366,6 +1367,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
1366 | void *tmp_obj; | 1367 | void *tmp_obj; |
1367 | char *version; | 1368 | char *version; |
1368 | void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096); | 1369 | void __iomem *addr = ioremap_nocache(dev->hpa.start, 4096); |
1370 | int max; | ||
1369 | 1371 | ||
1370 | /* Read HW Rev First */ | 1372 | /* Read HW Rev First */ |
1371 | func_class = READ_REG32(addr + LBA_FCLASS); | 1373 | func_class = READ_REG32(addr + LBA_FCLASS); |
@@ -1502,6 +1504,8 @@ lba_driver_probe(struct parisc_device *dev) | |||
1502 | if (lba_dev->hba.gmmio_space.flags) | 1504 | if (lba_dev->hba.gmmio_space.flags) |
1503 | pci_add_resource(&resources, &lba_dev->hba.gmmio_space); | 1505 | pci_add_resource(&resources, &lba_dev->hba.gmmio_space); |
1504 | 1506 | ||
1507 | pci_add_resource(&resources, &lba_dev->hba.bus_num); | ||
1508 | |||
1505 | dev->dev.platform_data = lba_dev; | 1509 | dev->dev.platform_data = lba_dev; |
1506 | lba_bus = lba_dev->hba.hba_bus = | 1510 | lba_bus = lba_dev->hba.hba_bus = |
1507 | pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start, | 1511 | pci_create_root_bus(&dev->dev, lba_dev->hba.bus_num.start, |
@@ -1511,7 +1515,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
1511 | return 0; | 1515 | return 0; |
1512 | } | 1516 | } |
1513 | 1517 | ||
1514 | lba_bus->subordinate = pci_scan_child_bus(lba_bus); | 1518 | max = pci_scan_child_bus(lba_bus); |
1515 | 1519 | ||
1516 | /* This is in lieu of calling pci_assign_unassigned_resources() */ | 1520 | /* This is in lieu of calling pci_assign_unassigned_resources() */ |
1517 | if (is_pdc_pat()) { | 1521 | if (is_pdc_pat()) { |
@@ -1541,7 +1545,7 @@ lba_driver_probe(struct parisc_device *dev) | |||
1541 | lba_dev->flags |= LBA_FLAG_SKIP_PROBE; | 1545 | lba_dev->flags |= LBA_FLAG_SKIP_PROBE; |
1542 | } | 1546 | } |
1543 | 1547 | ||
1544 | lba_next_bus = lba_bus->subordinate + 1; | 1548 | lba_next_bus = max + 1; |
1545 | pci_bus_add_devices(lba_bus); | 1549 | pci_bus_add_devices(lba_bus); |
1546 | 1550 | ||
1547 | /* Whew! Finally done! Tell services we got this one covered. */ | 1551 | /* Whew! Finally done! Tell services we got this one covered. */ |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index 2a581642c237..ba91a7e17519 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -162,7 +162,8 @@ int pci_user_read_config_##size \ | |||
162 | if (ret > 0) \ | 162 | if (ret > 0) \ |
163 | ret = -EINVAL; \ | 163 | ret = -EINVAL; \ |
164 | return ret; \ | 164 | return ret; \ |
165 | } | 165 | } \ |
166 | EXPORT_SYMBOL_GPL(pci_user_read_config_##size); | ||
166 | 167 | ||
167 | /* Returns 0 on success, negative values indicate error. */ | 168 | /* Returns 0 on success, negative values indicate error. */ |
168 | #define PCI_USER_WRITE_CONFIG(size,type) \ | 169 | #define PCI_USER_WRITE_CONFIG(size,type) \ |
@@ -181,7 +182,8 @@ int pci_user_write_config_##size \ | |||
181 | if (ret > 0) \ | 182 | if (ret > 0) \ |
182 | ret = -EINVAL; \ | 183 | ret = -EINVAL; \ |
183 | return ret; \ | 184 | return ret; \ |
184 | } | 185 | } \ |
186 | EXPORT_SYMBOL_GPL(pci_user_write_config_##size); | ||
185 | 187 | ||
186 | PCI_USER_READ_CONFIG(byte, u8) | 188 | PCI_USER_READ_CONFIG(byte, u8) |
187 | PCI_USER_READ_CONFIG(word, u16) | 189 | PCI_USER_READ_CONFIG(word, u16) |
diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c index d3509cdeb554..6258dc260d9f 100644 --- a/drivers/pci/hotplug-pci.c +++ b/drivers/pci/hotplug-pci.c | |||
@@ -4,18 +4,26 @@ | |||
4 | #include <linux/export.h> | 4 | #include <linux/export.h> |
5 | #include "pci.h" | 5 | #include "pci.h" |
6 | 6 | ||
7 | 7 | int __ref pci_hp_add_bridge(struct pci_dev *dev) | |
8 | unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) | ||
9 | { | 8 | { |
10 | unsigned int max; | 9 | struct pci_bus *parent = dev->bus; |
11 | 10 | int pass, busnr, start = parent->busn_res.start; | |
12 | max = pci_scan_child_bus(bus); | 11 | int end = parent->busn_res.end; |
13 | 12 | ||
14 | /* | 13 | for (busnr = start; busnr <= end; busnr++) { |
15 | * Make the discovered devices available. | 14 | if (!pci_find_bus(pci_domain_nr(parent), busnr)) |
16 | */ | 15 | break; |
17 | pci_bus_add_devices(bus); | 16 | } |
17 | if (busnr-- > end) { | ||
18 | printk(KERN_ERR "No bus number available for hot-added bridge %s\n", | ||
19 | pci_name(dev)); | ||
20 | return -1; | ||
21 | } | ||
22 | for (pass = 0; pass < 2; pass++) | ||
23 | busnr = pci_scan_bridge(parent, dev, busnr, pass); | ||
24 | if (!dev->subordinate) | ||
25 | return -1; | ||
18 | 26 | ||
19 | return max; | 27 | return 0; |
20 | } | 28 | } |
21 | EXPORT_SYMBOL(pci_do_scan_bus); | 29 | EXPORT_SYMBOL_GPL(pci_hp_add_bridge); |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 09bf37721842..395c67d3d296 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -100,11 +100,11 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val, | |||
100 | PCI_PRIMARY_BUS, | 100 | PCI_PRIMARY_BUS, |
101 | &buses); | 101 | &buses); |
102 | 102 | ||
103 | if (((buses >> 8) & 0xff) != bus->secondary) { | 103 | if (((buses >> 8) & 0xff) != bus->busn_res.start) { |
104 | buses = (buses & 0xff000000) | 104 | buses = (buses & 0xff000000) |
105 | | ((unsigned int)(bus->primary) << 0) | 105 | | ((unsigned int)(bus->primary) << 0) |
106 | | ((unsigned int)(bus->secondary) << 8) | 106 | | ((unsigned int)(bus->busn_res.start) << 8) |
107 | | ((unsigned int)(bus->subordinate) << 16); | 107 | | ((unsigned int)(bus->busn_res.end) << 16); |
108 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); | 108 | pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); |
109 | } | 109 | } |
110 | return NOTIFY_OK; | 110 | return NOTIFY_OK; |
@@ -697,7 +697,7 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
697 | * bus->subordinate value because it could have | 697 | * bus->subordinate value because it could have |
698 | * padding in it. | 698 | * padding in it. |
699 | */ | 699 | */ |
700 | max = bus->secondary; | 700 | max = bus->busn_res.start; |
701 | 701 | ||
702 | list_for_each(tmp, &bus->children) { | 702 | list_for_each(tmp, &bus->children) { |
703 | n = pci_bus_max_busnr(pci_bus_b(tmp)); | 703 | n = pci_bus_max_busnr(pci_bus_b(tmp)); |
@@ -883,6 +883,24 @@ static void disable_bridges(struct pci_bus *bus) | |||
883 | } | 883 | } |
884 | } | 884 | } |
885 | 885 | ||
886 | /* return first device in slot, acquiring a reference on it */ | ||
887 | static struct pci_dev *dev_in_slot(struct acpiphp_slot *slot) | ||
888 | { | ||
889 | struct pci_bus *bus = slot->bridge->pci_bus; | ||
890 | struct pci_dev *dev; | ||
891 | struct pci_dev *ret = NULL; | ||
892 | |||
893 | down_read(&pci_bus_sem); | ||
894 | list_for_each_entry(dev, &bus->devices, bus_list) | ||
895 | if (PCI_SLOT(dev->devfn) == slot->device) { | ||
896 | ret = pci_dev_get(dev); | ||
897 | break; | ||
898 | } | ||
899 | up_read(&pci_bus_sem); | ||
900 | |||
901 | return ret; | ||
902 | } | ||
903 | |||
886 | /** | 904 | /** |
887 | * disable_device - disable a slot | 905 | * disable_device - disable a slot |
888 | * @slot: ACPI PHP slot | 906 | * @slot: ACPI PHP slot |
@@ -898,6 +916,7 @@ static int disable_device(struct acpiphp_slot *slot) | |||
898 | pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0)); | 916 | pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0)); |
899 | if (!pdev) | 917 | if (!pdev) |
900 | goto err_exit; | 918 | goto err_exit; |
919 | pci_dev_put(pdev); | ||
901 | 920 | ||
902 | list_for_each_entry(func, &slot->funcs, sibling) { | 921 | list_for_each_entry(func, &slot->funcs, sibling) { |
903 | if (func->bridge) { | 922 | if (func->bridge) { |
@@ -906,18 +925,22 @@ static int disable_device(struct acpiphp_slot *slot) | |||
906 | (u32)1, NULL, NULL); | 925 | (u32)1, NULL, NULL); |
907 | func->bridge = NULL; | 926 | func->bridge = NULL; |
908 | } | 927 | } |
928 | } | ||
909 | 929 | ||
910 | pdev = pci_get_slot(slot->bridge->pci_bus, | 930 | /* |
911 | PCI_DEVFN(slot->device, func->function)); | 931 | * enable_device() enumerates all functions in this device via |
912 | if (pdev) { | 932 | * pci_scan_slot(), whether they have associated ACPI hotplug |
913 | pci_stop_bus_device(pdev); | 933 | * methods (_EJ0, etc.) or not. Therefore, we remove all functions |
914 | if (pdev->subordinate) { | 934 | * here. |
915 | disable_bridges(pdev->subordinate); | 935 | */ |
916 | pci_disable_device(pdev); | 936 | while ((pdev = dev_in_slot(slot))) { |
917 | } | 937 | pci_stop_bus_device(pdev); |
918 | __pci_remove_bus_device(pdev); | 938 | if (pdev->subordinate) { |
919 | pci_dev_put(pdev); | 939 | disable_bridges(pdev->subordinate); |
940 | pci_disable_device(pdev); | ||
920 | } | 941 | } |
942 | __pci_remove_bus_device(pdev); | ||
943 | pci_dev_put(pdev); | ||
921 | } | 944 | } |
922 | 945 | ||
923 | list_for_each_entry(func, &slot->funcs, sibling) { | 946 | list_for_each_entry(func, &slot->funcs, sibling) { |
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index ae853ccd0cd5..dcc75c785443 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
@@ -285,42 +285,19 @@ int __ref cpci_configure_slot(struct slot *slot) | |||
285 | for (fn = 0; fn < 8; fn++) { | 285 | for (fn = 0; fn < 8; fn++) { |
286 | struct pci_dev *dev; | 286 | struct pci_dev *dev; |
287 | 287 | ||
288 | dev = pci_get_slot(parent, PCI_DEVFN(PCI_SLOT(slot->devfn), fn)); | 288 | dev = pci_get_slot(parent, |
289 | PCI_DEVFN(PCI_SLOT(slot->devfn), fn)); | ||
289 | if (!dev) | 290 | if (!dev) |
290 | continue; | 291 | continue; |
291 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | 292 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || |
292 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { | 293 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) |
293 | /* Find an unused bus number for the new bridge */ | 294 | pci_hp_add_bridge(dev); |
294 | struct pci_bus *child; | ||
295 | unsigned char busnr, start = parent->secondary; | ||
296 | unsigned char end = parent->subordinate; | ||
297 | |||
298 | for (busnr = start; busnr <= end; busnr++) { | ||
299 | if (!pci_find_bus(pci_domain_nr(parent), | ||
300 | busnr)) | ||
301 | break; | ||
302 | } | ||
303 | if (busnr >= end) { | ||
304 | err("No free bus for hot-added bridge\n"); | ||
305 | pci_dev_put(dev); | ||
306 | continue; | ||
307 | } | ||
308 | child = pci_add_new_bus(parent, dev, busnr); | ||
309 | if (!child) { | ||
310 | err("Cannot add new bus for %s\n", | ||
311 | pci_name(dev)); | ||
312 | pci_dev_put(dev); | ||
313 | continue; | ||
314 | } | ||
315 | child->subordinate = pci_do_scan_bus(child); | ||
316 | pci_bus_size_bridges(child); | ||
317 | } | ||
318 | pci_dev_put(dev); | 295 | pci_dev_put(dev); |
319 | } | 296 | } |
320 | 297 | ||
321 | pci_bus_assign_resources(parent); | 298 | pci_assign_unassigned_bridge_resources(parent->self); |
299 | |||
322 | pci_bus_add_devices(parent); | 300 | pci_bus_add_devices(parent); |
323 | pci_enable_bridges(parent); | ||
324 | 301 | ||
325 | dbg("%s - exit", __func__); | 302 | dbg("%s - exit", __func__); |
326 | return 0; | 303 | return 0; |
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 1c8494021a42..09801c6945ce 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c | |||
@@ -83,7 +83,6 @@ static void __iomem *detect_HRT_floating_pointer(void __iomem *begin, void __iom | |||
83 | 83 | ||
84 | int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | 84 | int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) |
85 | { | 85 | { |
86 | unsigned char bus; | ||
87 | struct pci_bus *child; | 86 | struct pci_bus *child; |
88 | int num; | 87 | int num; |
89 | 88 | ||
@@ -106,9 +105,10 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | |||
106 | } | 105 | } |
107 | 106 | ||
108 | if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 107 | if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
109 | pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus); | 108 | pci_hp_add_bridge(func->pci_dev); |
110 | child = (struct pci_bus*) pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus); | 109 | child = func->pci_dev->subordinate; |
111 | pci_do_scan_bus(child); | 110 | if (child) |
111 | pci_bus_add_devices(child); | ||
112 | } | 112 | } |
113 | 113 | ||
114 | pci_dev_put(func->pci_dev); | 114 | pci_dev_put(func->pci_dev); |
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 4fda7e6a86a7..7dccad5fc891 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -775,7 +775,6 @@ static u8 bus_structure_fixup(u8 busno) | |||
775 | 775 | ||
776 | static int ibm_configure_device(struct pci_func *func) | 776 | static int ibm_configure_device(struct pci_func *func) |
777 | { | 777 | { |
778 | unsigned char bus; | ||
779 | struct pci_bus *child; | 778 | struct pci_bus *child; |
780 | int num; | 779 | int num; |
781 | int flag = 0; /* this is to make sure we don't double scan the bus, | 780 | int flag = 0; /* this is to make sure we don't double scan the bus, |
@@ -805,9 +804,10 @@ static int ibm_configure_device(struct pci_func *func) | |||
805 | } | 804 | } |
806 | } | 805 | } |
807 | if (!(flag) && (func->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)) { | 806 | if (!(flag) && (func->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)) { |
808 | pci_read_config_byte(func->dev, PCI_SECONDARY_BUS, &bus); | 807 | pci_hp_add_bridge(func->dev); |
809 | child = pci_add_new_bus(func->dev->bus, func->dev, bus); | 808 | child = func->dev->subordinate; |
810 | pci_do_scan_bus(child); | 809 | if (child) |
810 | pci_bus_add_devices(child); | ||
811 | } | 811 | } |
812 | 812 | ||
813 | return 0; | 813 | return 0; |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 47d9dc06b109..09cecaf450c5 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -34,29 +34,6 @@ | |||
34 | #include "../pci.h" | 34 | #include "../pci.h" |
35 | #include "pciehp.h" | 35 | #include "pciehp.h" |
36 | 36 | ||
37 | static int __ref pciehp_add_bridge(struct pci_dev *dev) | ||
38 | { | ||
39 | struct pci_bus *parent = dev->bus; | ||
40 | int pass, busnr, start = parent->secondary; | ||
41 | int end = parent->subordinate; | ||
42 | |||
43 | for (busnr = start; busnr <= end; busnr++) { | ||
44 | if (!pci_find_bus(pci_domain_nr(parent), busnr)) | ||
45 | break; | ||
46 | } | ||
47 | if (busnr-- > end) { | ||
48 | err("No bus number available for hot-added bridge %s\n", | ||
49 | pci_name(dev)); | ||
50 | return -1; | ||
51 | } | ||
52 | for (pass = 0; pass < 2; pass++) | ||
53 | busnr = pci_scan_bridge(parent, dev, busnr, pass); | ||
54 | if (!dev->subordinate) | ||
55 | return -1; | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | int pciehp_configure_device(struct slot *p_slot) | 37 | int pciehp_configure_device(struct slot *p_slot) |
61 | { | 38 | { |
62 | struct pci_dev *dev; | 39 | struct pci_dev *dev; |
@@ -85,9 +62,8 @@ int pciehp_configure_device(struct slot *p_slot) | |||
85 | if (!dev) | 62 | if (!dev) |
86 | continue; | 63 | continue; |
87 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | 64 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || |
88 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { | 65 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) |
89 | pciehp_add_bridge(dev); | 66 | pci_hp_add_bridge(dev); |
90 | } | ||
91 | pci_dev_put(dev); | 67 | pci_dev_put(dev); |
92 | } | 68 | } |
93 | 69 | ||
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index de573113c102..f64ca92253da 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -397,13 +397,11 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
397 | else | 397 | else |
398 | sn_io_slot_fixup(dev); | 398 | sn_io_slot_fixup(dev); |
399 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 399 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
400 | unsigned char sec_bus; | 400 | pci_hp_add_bridge(dev); |
401 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, | 401 | if (dev->subordinate) { |
402 | &sec_bus); | 402 | new_bus = dev->subordinate; |
403 | new_bus = pci_add_new_bus(dev->bus, dev, | 403 | new_ppb = 1; |
404 | sec_bus); | 404 | } |
405 | pci_scan_child_bus(new_bus); | ||
406 | new_ppb = 1; | ||
407 | } | 405 | } |
408 | pci_dev_put(dev); | 406 | pci_dev_put(dev); |
409 | } | 407 | } |
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index df7e4bfadae3..c627ed9957d1 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
@@ -37,9 +37,10 @@ | |||
37 | int __ref shpchp_configure_device(struct slot *p_slot) | 37 | int __ref shpchp_configure_device(struct slot *p_slot) |
38 | { | 38 | { |
39 | struct pci_dev *dev; | 39 | struct pci_dev *dev; |
40 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | ||
41 | int num, fn; | ||
42 | struct controller *ctrl = p_slot->ctrl; | 40 | struct controller *ctrl = p_slot->ctrl; |
41 | struct pci_dev *bridge = ctrl->pci_dev; | ||
42 | struct pci_bus *parent = bridge->subordinate; | ||
43 | int num, fn; | ||
43 | 44 | ||
44 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); | 45 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); |
45 | if (dev) { | 46 | if (dev) { |
@@ -61,39 +62,23 @@ int __ref shpchp_configure_device(struct slot *p_slot) | |||
61 | if (!dev) | 62 | if (!dev) |
62 | continue; | 63 | continue; |
63 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || | 64 | if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || |
64 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { | 65 | (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) |
65 | /* Find an unused bus number for the new bridge */ | 66 | pci_hp_add_bridge(dev); |
66 | struct pci_bus *child; | 67 | pci_dev_put(dev); |
67 | unsigned char busnr, start = parent->secondary; | 68 | } |
68 | unsigned char end = parent->subordinate; | 69 | |
69 | for (busnr = start; busnr <= end; busnr++) { | 70 | pci_assign_unassigned_bridge_resources(bridge); |
70 | if (!pci_find_bus(pci_domain_nr(parent), | 71 | |
71 | busnr)) | 72 | for (fn = 0; fn < 8; fn++) { |
72 | break; | 73 | dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); |
73 | } | 74 | if (!dev) |
74 | if (busnr > end) { | 75 | continue; |
75 | ctrl_err(ctrl, | ||
76 | "No free bus for hot-added bridge\n"); | ||
77 | pci_dev_put(dev); | ||
78 | continue; | ||
79 | } | ||
80 | child = pci_add_new_bus(parent, dev, busnr); | ||
81 | if (!child) { | ||
82 | ctrl_err(ctrl, "Cannot add new bus for %s\n", | ||
83 | pci_name(dev)); | ||
84 | pci_dev_put(dev); | ||
85 | continue; | ||
86 | } | ||
87 | child->subordinate = pci_do_scan_bus(child); | ||
88 | pci_bus_size_bridges(child); | ||
89 | } | ||
90 | pci_configure_slot(dev); | 76 | pci_configure_slot(dev); |
91 | pci_dev_put(dev); | 77 | pci_dev_put(dev); |
92 | } | 78 | } |
93 | 79 | ||
94 | pci_bus_assign_resources(parent); | ||
95 | pci_bus_add_devices(parent); | 80 | pci_bus_add_devices(parent); |
96 | pci_enable_bridges(parent); | 81 | |
97 | return 0; | 82 | return 0; |
98 | } | 83 | } |
99 | 84 | ||
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index efa30da1ae8f..eeb23ceae4a8 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c | |||
@@ -73,13 +73,13 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | out += sprintf(out, "Free resources: bus numbers\n"); | 75 | out += sprintf(out, "Free resources: bus numbers\n"); |
76 | for (busnr = bus->secondary; busnr <= bus->subordinate; busnr++) { | 76 | for (busnr = bus->busn_res.start; busnr <= bus->busn_res.end; busnr++) { |
77 | if (!pci_find_bus(pci_domain_nr(bus), busnr)) | 77 | if (!pci_find_bus(pci_domain_nr(bus), busnr)) |
78 | break; | 78 | break; |
79 | } | 79 | } |
80 | if (busnr < bus->subordinate) | 80 | if (busnr < bus->busn_res.end) |
81 | out += sprintf(out, "start = %8.8x, length = %8.8x\n", | 81 | out += sprintf(out, "start = %8.8x, length = %8.8x\n", |
82 | busnr, (bus->subordinate - busnr)); | 82 | busnr, (int)(bus->busn_res.end - busnr)); |
83 | 83 | ||
84 | return out - buf; | 84 | return out - buf; |
85 | } | 85 | } |
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 6554e1a0f634..74bbaf82638d 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
@@ -47,7 +47,7 @@ static struct pci_bus *virtfn_add_bus(struct pci_bus *bus, int busnr) | |||
47 | if (!child) | 47 | if (!child) |
48 | return NULL; | 48 | return NULL; |
49 | 49 | ||
50 | child->subordinate = busnr; | 50 | pci_bus_insert_busn_res(child, busnr, busnr); |
51 | child->dev.parent = bus->bridge; | 51 | child->dev.parent = bus->bridge; |
52 | rc = pci_bus_add_child(child); | 52 | rc = pci_bus_add_child(child); |
53 | if (rc) { | 53 | if (rc) { |
@@ -327,7 +327,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
327 | iov->offset = offset; | 327 | iov->offset = offset; |
328 | iov->stride = stride; | 328 | iov->stride = stride; |
329 | 329 | ||
330 | if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->subordinate) { | 330 | if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) { |
331 | dev_err(&dev->dev, "SR-IOV: bus number out of range\n"); | 331 | dev_err(&dev->dev, "SR-IOV: bus number out of range\n"); |
332 | return -ENOMEM; | 332 | return -ENOMEM; |
333 | } | 333 | } |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7f1310e58534..87928fde77b0 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -110,7 +110,7 @@ unsigned char pci_bus_max_busnr(struct pci_bus* bus) | |||
110 | struct list_head *tmp; | 110 | struct list_head *tmp; |
111 | unsigned char max, n; | 111 | unsigned char max, n; |
112 | 112 | ||
113 | max = bus->subordinate; | 113 | max = bus->busn_res.end; |
114 | list_for_each(tmp, &bus->children) { | 114 | list_for_each(tmp, &bus->children) { |
115 | n = pci_bus_max_busnr(pci_bus_b(tmp)); | 115 | n = pci_bus_max_busnr(pci_bus_b(tmp)); |
116 | if(n > max) | 116 | if(n > max) |
@@ -136,30 +136,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) | |||
136 | EXPORT_SYMBOL_GPL(pci_ioremap_bar); | 136 | EXPORT_SYMBOL_GPL(pci_ioremap_bar); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | #if 0 | ||
140 | /** | ||
141 | * pci_max_busnr - returns maximum PCI bus number | ||
142 | * | ||
143 | * Returns the highest PCI bus number present in the system global list of | ||
144 | * PCI buses. | ||
145 | */ | ||
146 | unsigned char __devinit | ||
147 | pci_max_busnr(void) | ||
148 | { | ||
149 | struct pci_bus *bus = NULL; | ||
150 | unsigned char max, n; | ||
151 | |||
152 | max = 0; | ||
153 | while ((bus = pci_find_next_bus(bus)) != NULL) { | ||
154 | n = pci_bus_max_busnr(bus); | ||
155 | if(n > max) | ||
156 | max = n; | ||
157 | } | ||
158 | return max; | ||
159 | } | ||
160 | |||
161 | #endif /* 0 */ | ||
162 | |||
163 | #define PCI_FIND_CAP_TTL 48 | 139 | #define PCI_FIND_CAP_TTL 48 |
164 | 140 | ||
165 | static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, | 141 | static int __pci_find_next_cap_ttl(struct pci_bus *bus, unsigned int devfn, |
@@ -278,6 +254,38 @@ int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap) | |||
278 | } | 254 | } |
279 | 255 | ||
280 | /** | 256 | /** |
257 | * pci_pcie_cap2 - query for devices' PCI_CAP_ID_EXP v2 capability structure | ||
258 | * @dev: PCI device to check | ||
259 | * | ||
260 | * Like pci_pcie_cap() but also checks that the PCIe capability version is | ||
261 | * >= 2. Note that v1 capability structures could be sparse in that not | ||
262 | * all register fields were required. v2 requires the entire structure to | ||
263 | * be present size wise, while still allowing for non-implemented registers | ||
264 | * to exist but they must be hardwired to 0. | ||
265 | * | ||
266 | * Due to the differences in the versions of capability structures, one | ||
267 | * must be careful not to try and access non-existant registers that may | ||
268 | * exist in early versions - v1 - of Express devices. | ||
269 | * | ||
270 | * Returns the offset of the PCIe capability structure as long as the | ||
271 | * capability version is >= 2; otherwise 0 is returned. | ||
272 | */ | ||
273 | static int pci_pcie_cap2(struct pci_dev *dev) | ||
274 | { | ||
275 | u16 flags; | ||
276 | int pos; | ||
277 | |||
278 | pos = pci_pcie_cap(dev); | ||
279 | if (pos) { | ||
280 | pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags); | ||
281 | if ((flags & PCI_EXP_FLAGS_VERS) < 2) | ||
282 | pos = 0; | ||
283 | } | ||
284 | |||
285 | return pos; | ||
286 | } | ||
287 | |||
288 | /** | ||
281 | * pci_find_ext_capability - Find an extended capability | 289 | * pci_find_ext_capability - Find an extended capability |
282 | * @dev: PCI device to query | 290 | * @dev: PCI device to query |
283 | * @cap: capability code | 291 | * @cap: capability code |
@@ -329,49 +337,6 @@ int pci_find_ext_capability(struct pci_dev *dev, int cap) | |||
329 | } | 337 | } |
330 | EXPORT_SYMBOL_GPL(pci_find_ext_capability); | 338 | EXPORT_SYMBOL_GPL(pci_find_ext_capability); |
331 | 339 | ||
332 | /** | ||
333 | * pci_bus_find_ext_capability - find an extended capability | ||
334 | * @bus: the PCI bus to query | ||
335 | * @devfn: PCI device to query | ||
336 | * @cap: capability code | ||
337 | * | ||
338 | * Like pci_find_ext_capability() but works for pci devices that do not have a | ||
339 | * pci_dev structure set up yet. | ||
340 | * | ||
341 | * Returns the address of the requested capability structure within the | ||
342 | * device's PCI configuration space or 0 in case the device does not | ||
343 | * support it. | ||
344 | */ | ||
345 | int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn, | ||
346 | int cap) | ||
347 | { | ||
348 | u32 header; | ||
349 | int ttl; | ||
350 | int pos = PCI_CFG_SPACE_SIZE; | ||
351 | |||
352 | /* minimum 8 bytes per capability */ | ||
353 | ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8; | ||
354 | |||
355 | if (!pci_bus_read_config_dword(bus, devfn, pos, &header)) | ||
356 | return 0; | ||
357 | if (header == 0xffffffff || header == 0) | ||
358 | return 0; | ||
359 | |||
360 | while (ttl-- > 0) { | ||
361 | if (PCI_EXT_CAP_ID(header) == cap) | ||
362 | return pos; | ||
363 | |||
364 | pos = PCI_EXT_CAP_NEXT(header); | ||
365 | if (pos < PCI_CFG_SPACE_SIZE) | ||
366 | break; | ||
367 | |||
368 | if (!pci_bus_read_config_dword(bus, devfn, pos, &header)) | ||
369 | break; | ||
370 | } | ||
371 | |||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | static int __pci_find_next_ht_cap(struct pci_dev *dev, int pos, int ht_cap) | 340 | static int __pci_find_next_ht_cap(struct pci_dev *dev, int pos, int ht_cap) |
376 | { | 341 | { |
377 | int rc, ttl = PCI_FIND_CAP_TTL; | 342 | int rc, ttl = PCI_FIND_CAP_TTL; |
@@ -822,12 +787,6 @@ EXPORT_SYMBOL(pci_choose_state); | |||
822 | ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ | 787 | ((flags & PCI_EXP_FLAGS_VERS) > 1 || \ |
823 | (type == PCI_EXP_TYPE_ROOT_PORT || \ | 788 | (type == PCI_EXP_TYPE_ROOT_PORT || \ |
824 | type == PCI_EXP_TYPE_RC_EC)) | 789 | type == PCI_EXP_TYPE_RC_EC)) |
825 | #define pcie_cap_has_devctl2(type, flags) \ | ||
826 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
827 | #define pcie_cap_has_lnkctl2(type, flags) \ | ||
828 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
829 | #define pcie_cap_has_sltctl2(type, flags) \ | ||
830 | ((flags & PCI_EXP_FLAGS_VERS) > 1) | ||
831 | 790 | ||
832 | static struct pci_cap_saved_state *pci_find_saved_cap( | 791 | static struct pci_cap_saved_state *pci_find_saved_cap( |
833 | struct pci_dev *pci_dev, char cap) | 792 | struct pci_dev *pci_dev, char cap) |
@@ -870,13 +829,14 @@ static int pci_save_pcie_state(struct pci_dev *dev) | |||
870 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); | 829 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); |
871 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) | 830 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) |
872 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); | 831 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); |
873 | if (pcie_cap_has_devctl2(dev->pcie_type, flags)) | ||
874 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); | ||
875 | if (pcie_cap_has_lnkctl2(dev->pcie_type, flags)) | ||
876 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); | ||
877 | if (pcie_cap_has_sltctl2(dev->pcie_type, flags)) | ||
878 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); | ||
879 | 832 | ||
833 | pos = pci_pcie_cap2(dev); | ||
834 | if (!pos) | ||
835 | return 0; | ||
836 | |||
837 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); | ||
838 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); | ||
839 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); | ||
880 | return 0; | 840 | return 0; |
881 | } | 841 | } |
882 | 842 | ||
@@ -903,12 +863,14 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
903 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); | 863 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); |
904 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) | 864 | if (pcie_cap_has_rtctl(dev->pcie_type, flags)) |
905 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); | 865 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); |
906 | if (pcie_cap_has_devctl2(dev->pcie_type, flags)) | 866 | |
907 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); | 867 | pos = pci_pcie_cap2(dev); |
908 | if (pcie_cap_has_lnkctl2(dev->pcie_type, flags)) | 868 | if (!pos) |
909 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); | 869 | return; |
910 | if (pcie_cap_has_sltctl2(dev->pcie_type, flags)) | 870 | |
911 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); | 871 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); |
872 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); | ||
873 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); | ||
912 | } | 874 | } |
913 | 875 | ||
914 | 876 | ||
@@ -1983,7 +1945,7 @@ void pci_enable_ari(struct pci_dev *dev) | |||
1983 | { | 1945 | { |
1984 | int pos; | 1946 | int pos; |
1985 | u32 cap; | 1947 | u32 cap; |
1986 | u16 flags, ctrl; | 1948 | u16 ctrl; |
1987 | struct pci_dev *bridge; | 1949 | struct pci_dev *bridge; |
1988 | 1950 | ||
1989 | if (pcie_ari_disabled || !pci_is_pcie(dev) || dev->devfn) | 1951 | if (pcie_ari_disabled || !pci_is_pcie(dev) || dev->devfn) |
@@ -1994,18 +1956,14 @@ void pci_enable_ari(struct pci_dev *dev) | |||
1994 | return; | 1956 | return; |
1995 | 1957 | ||
1996 | bridge = dev->bus->self; | 1958 | bridge = dev->bus->self; |
1997 | if (!bridge || !pci_is_pcie(bridge)) | 1959 | if (!bridge) |
1998 | return; | 1960 | return; |
1999 | 1961 | ||
2000 | pos = pci_pcie_cap(bridge); | 1962 | /* ARI is a PCIe cap v2 feature */ |
1963 | pos = pci_pcie_cap2(bridge); | ||
2001 | if (!pos) | 1964 | if (!pos) |
2002 | return; | 1965 | return; |
2003 | 1966 | ||
2004 | /* ARI is a PCIe v2 feature */ | ||
2005 | pci_read_config_word(bridge, pos + PCI_EXP_FLAGS, &flags); | ||
2006 | if ((flags & PCI_EXP_FLAGS_VERS) < 2) | ||
2007 | return; | ||
2008 | |||
2009 | pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap); | 1967 | pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap); |
2010 | if (!(cap & PCI_EXP_DEVCAP2_ARI)) | 1968 | if (!(cap & PCI_EXP_DEVCAP2_ARI)) |
2011 | return; | 1969 | return; |
@@ -2018,7 +1976,7 @@ void pci_enable_ari(struct pci_dev *dev) | |||
2018 | } | 1976 | } |
2019 | 1977 | ||
2020 | /** | 1978 | /** |
2021 | * pci_enable_ido - enable ID-based ordering on a device | 1979 | * pci_enable_ido - enable ID-based Ordering on a device |
2022 | * @dev: the PCI device | 1980 | * @dev: the PCI device |
2023 | * @type: which types of IDO to enable | 1981 | * @type: which types of IDO to enable |
2024 | * | 1982 | * |
@@ -2031,7 +1989,8 @@ void pci_enable_ido(struct pci_dev *dev, unsigned long type) | |||
2031 | int pos; | 1989 | int pos; |
2032 | u16 ctrl; | 1990 | u16 ctrl; |
2033 | 1991 | ||
2034 | pos = pci_pcie_cap(dev); | 1992 | /* ID-based Ordering is a PCIe cap v2 feature */ |
1993 | pos = pci_pcie_cap2(dev); | ||
2035 | if (!pos) | 1994 | if (!pos) |
2036 | return; | 1995 | return; |
2037 | 1996 | ||
@@ -2054,10 +2013,8 @@ void pci_disable_ido(struct pci_dev *dev, unsigned long type) | |||
2054 | int pos; | 2013 | int pos; |
2055 | u16 ctrl; | 2014 | u16 ctrl; |
2056 | 2015 | ||
2057 | if (!pci_is_pcie(dev)) | 2016 | /* ID-based Ordering is a PCIe cap v2 feature */ |
2058 | return; | 2017 | pos = pci_pcie_cap2(dev); |
2059 | |||
2060 | pos = pci_pcie_cap(dev); | ||
2061 | if (!pos) | 2018 | if (!pos) |
2062 | return; | 2019 | return; |
2063 | 2020 | ||
@@ -2096,10 +2053,8 @@ int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type) | |||
2096 | u16 ctrl; | 2053 | u16 ctrl; |
2097 | int ret; | 2054 | int ret; |
2098 | 2055 | ||
2099 | if (!pci_is_pcie(dev)) | 2056 | /* OBFF is a PCIe cap v2 feature */ |
2100 | return -ENOTSUPP; | 2057 | pos = pci_pcie_cap2(dev); |
2101 | |||
2102 | pos = pci_pcie_cap(dev); | ||
2103 | if (!pos) | 2058 | if (!pos) |
2104 | return -ENOTSUPP; | 2059 | return -ENOTSUPP; |
2105 | 2060 | ||
@@ -2149,10 +2104,8 @@ void pci_disable_obff(struct pci_dev *dev) | |||
2149 | int pos; | 2104 | int pos; |
2150 | u16 ctrl; | 2105 | u16 ctrl; |
2151 | 2106 | ||
2152 | if (!pci_is_pcie(dev)) | 2107 | /* OBFF is a PCIe cap v2 feature */ |
2153 | return; | 2108 | pos = pci_pcie_cap2(dev); |
2154 | |||
2155 | pos = pci_pcie_cap(dev); | ||
2156 | if (!pos) | 2109 | if (!pos) |
2157 | return; | 2110 | return; |
2158 | 2111 | ||
@@ -2169,15 +2122,13 @@ EXPORT_SYMBOL(pci_disable_obff); | |||
2169 | * RETURNS: | 2122 | * RETURNS: |
2170 | * True if @dev supports latency tolerance reporting, false otherwise. | 2123 | * True if @dev supports latency tolerance reporting, false otherwise. |
2171 | */ | 2124 | */ |
2172 | bool pci_ltr_supported(struct pci_dev *dev) | 2125 | static bool pci_ltr_supported(struct pci_dev *dev) |
2173 | { | 2126 | { |
2174 | int pos; | 2127 | int pos; |
2175 | u32 cap; | 2128 | u32 cap; |
2176 | 2129 | ||
2177 | if (!pci_is_pcie(dev)) | 2130 | /* LTR is a PCIe cap v2 feature */ |
2178 | return false; | 2131 | pos = pci_pcie_cap2(dev); |
2179 | |||
2180 | pos = pci_pcie_cap(dev); | ||
2181 | if (!pos) | 2132 | if (!pos) |
2182 | return false; | 2133 | return false; |
2183 | 2134 | ||
@@ -2185,7 +2136,6 @@ bool pci_ltr_supported(struct pci_dev *dev) | |||
2185 | 2136 | ||
2186 | return cap & PCI_EXP_DEVCAP2_LTR; | 2137 | return cap & PCI_EXP_DEVCAP2_LTR; |
2187 | } | 2138 | } |
2188 | EXPORT_SYMBOL(pci_ltr_supported); | ||
2189 | 2139 | ||
2190 | /** | 2140 | /** |
2191 | * pci_enable_ltr - enable latency tolerance reporting | 2141 | * pci_enable_ltr - enable latency tolerance reporting |
@@ -2206,7 +2156,8 @@ int pci_enable_ltr(struct pci_dev *dev) | |||
2206 | if (!pci_ltr_supported(dev)) | 2156 | if (!pci_ltr_supported(dev)) |
2207 | return -ENOTSUPP; | 2157 | return -ENOTSUPP; |
2208 | 2158 | ||
2209 | pos = pci_pcie_cap(dev); | 2159 | /* LTR is a PCIe cap v2 feature */ |
2160 | pos = pci_pcie_cap2(dev); | ||
2210 | if (!pos) | 2161 | if (!pos) |
2211 | return -ENOTSUPP; | 2162 | return -ENOTSUPP; |
2212 | 2163 | ||
@@ -2241,7 +2192,8 @@ void pci_disable_ltr(struct pci_dev *dev) | |||
2241 | if (!pci_ltr_supported(dev)) | 2192 | if (!pci_ltr_supported(dev)) |
2242 | return; | 2193 | return; |
2243 | 2194 | ||
2244 | pos = pci_pcie_cap(dev); | 2195 | /* LTR is a PCIe cap v2 feature */ |
2196 | pos = pci_pcie_cap2(dev); | ||
2245 | if (!pos) | 2197 | if (!pos) |
2246 | return; | 2198 | return; |
2247 | 2199 | ||
@@ -2360,6 +2312,75 @@ void pci_enable_acs(struct pci_dev *dev) | |||
2360 | } | 2312 | } |
2361 | 2313 | ||
2362 | /** | 2314 | /** |
2315 | * pci_acs_enabled - test ACS against required flags for a given device | ||
2316 | * @pdev: device to test | ||
2317 | * @acs_flags: required PCI ACS flags | ||
2318 | * | ||
2319 | * Return true if the device supports the provided flags. Automatically | ||
2320 | * filters out flags that are not implemented on multifunction devices. | ||
2321 | */ | ||
2322 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags) | ||
2323 | { | ||
2324 | int pos, ret; | ||
2325 | u16 ctrl; | ||
2326 | |||
2327 | ret = pci_dev_specific_acs_enabled(pdev, acs_flags); | ||
2328 | if (ret >= 0) | ||
2329 | return ret > 0; | ||
2330 | |||
2331 | if (!pci_is_pcie(pdev)) | ||
2332 | return false; | ||
2333 | |||
2334 | /* Filter out flags not applicable to multifunction */ | ||
2335 | if (pdev->multifunction) | ||
2336 | acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | | ||
2337 | PCI_ACS_EC | PCI_ACS_DT); | ||
2338 | |||
2339 | if (pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM || | ||
2340 | pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || | ||
2341 | pdev->multifunction) { | ||
2342 | pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS); | ||
2343 | if (!pos) | ||
2344 | return false; | ||
2345 | |||
2346 | pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl); | ||
2347 | if ((ctrl & acs_flags) != acs_flags) | ||
2348 | return false; | ||
2349 | } | ||
2350 | |||
2351 | return true; | ||
2352 | } | ||
2353 | |||
2354 | /** | ||
2355 | * pci_acs_path_enable - test ACS flags from start to end in a hierarchy | ||
2356 | * @start: starting downstream device | ||
2357 | * @end: ending upstream device or NULL to search to the root bus | ||
2358 | * @acs_flags: required flags | ||
2359 | * | ||
2360 | * Walk up a device tree from start to end testing PCI ACS support. If | ||
2361 | * any step along the way does not support the required flags, return false. | ||
2362 | */ | ||
2363 | bool pci_acs_path_enabled(struct pci_dev *start, | ||
2364 | struct pci_dev *end, u16 acs_flags) | ||
2365 | { | ||
2366 | struct pci_dev *pdev, *parent = start; | ||
2367 | |||
2368 | do { | ||
2369 | pdev = parent; | ||
2370 | |||
2371 | if (!pci_acs_enabled(pdev, acs_flags)) | ||
2372 | return false; | ||
2373 | |||
2374 | if (pci_is_root_bus(pdev->bus)) | ||
2375 | return (end == NULL); | ||
2376 | |||
2377 | parent = pdev->bus->self; | ||
2378 | } while (pdev != end); | ||
2379 | |||
2380 | return true; | ||
2381 | } | ||
2382 | |||
2383 | /** | ||
2363 | * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge | 2384 | * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge |
2364 | * @dev: the PCI device | 2385 | * @dev: the PCI device |
2365 | * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD) | 2386 | * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTD, 4=INTD) |
@@ -2876,6 +2897,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev) | |||
2876 | bool mask_supported = false; | 2897 | bool mask_supported = false; |
2877 | u16 orig, new; | 2898 | u16 orig, new; |
2878 | 2899 | ||
2900 | if (dev->broken_intx_masking) | ||
2901 | return false; | ||
2902 | |||
2879 | pci_cfg_access_lock(dev); | 2903 | pci_cfg_access_lock(dev); |
2880 | 2904 | ||
2881 | pci_read_config_word(dev, PCI_COMMAND, &orig); | 2905 | pci_read_config_word(dev, PCI_COMMAND, &orig); |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index e4943479b234..4884d77d33b6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -86,13 +86,6 @@ static inline bool pci_is_bridge(struct pci_dev *pci_dev) | |||
86 | return !!(pci_dev->subordinate); | 86 | return !!(pci_dev->subordinate); |
87 | } | 87 | } |
88 | 88 | ||
89 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
90 | extern int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
91 | extern int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
92 | extern int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
93 | extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
94 | extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
95 | |||
96 | struct pci_vpd_ops { | 89 | struct pci_vpd_ops { |
97 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 90 | ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf); |
98 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); | 91 | ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); |
@@ -124,7 +117,7 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; } | |||
124 | #endif | 117 | #endif |
125 | 118 | ||
126 | /* Functions for PCI Hotplug drivers to use */ | 119 | /* Functions for PCI Hotplug drivers to use */ |
127 | extern unsigned int pci_do_scan_bus(struct pci_bus *bus); | 120 | int pci_hp_add_bridge(struct pci_dev *dev); |
128 | 121 | ||
129 | #ifdef HAVE_PCI_LEGACY | 122 | #ifdef HAVE_PCI_LEGACY |
130 | extern void pci_create_legacy_files(struct pci_bus *bus); | 123 | extern void pci_create_legacy_files(struct pci_bus *bus); |
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index 275bf158ffa7..124f20ff11b2 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
@@ -59,7 +59,7 @@ static int aer_hest_parse(struct acpi_hest_header *hest_hdr, void *data) | |||
59 | 59 | ||
60 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); | 60 | p = (struct acpi_hest_aer_common *)(hest_hdr + 1); |
61 | if (p->flags & ACPI_HEST_GLOBAL) { | 61 | if (p->flags & ACPI_HEST_GLOBAL) { |
62 | if ((info->pci_dev->is_pcie && | 62 | if ((pci_is_pcie(info->pci_dev) && |
63 | info->pci_dev->pcie_type == pcie_type) || bridge) | 63 | info->pci_dev->pcie_type == pcie_type) || bridge) |
64 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); | 64 | ff = !!(p->flags & ACPI_HEST_FIRMWARE_FIRST); |
65 | } else | 65 | } else |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a7a504fc82b9..cd06c8478267 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -16,10 +16,47 @@ | |||
16 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ | 16 | #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ |
17 | #define CARDBUS_RESERVE_BUSNR 3 | 17 | #define CARDBUS_RESERVE_BUSNR 3 |
18 | 18 | ||
19 | struct resource busn_resource = { | ||
20 | .name = "PCI busn", | ||
21 | .start = 0, | ||
22 | .end = 255, | ||
23 | .flags = IORESOURCE_BUS, | ||
24 | }; | ||
25 | |||
19 | /* Ugh. Need to stop exporting this to modules. */ | 26 | /* Ugh. Need to stop exporting this to modules. */ |
20 | LIST_HEAD(pci_root_buses); | 27 | LIST_HEAD(pci_root_buses); |
21 | EXPORT_SYMBOL(pci_root_buses); | 28 | EXPORT_SYMBOL(pci_root_buses); |
22 | 29 | ||
30 | static LIST_HEAD(pci_domain_busn_res_list); | ||
31 | |||
32 | struct pci_domain_busn_res { | ||
33 | struct list_head list; | ||
34 | struct resource res; | ||
35 | int domain_nr; | ||
36 | }; | ||
37 | |||
38 | static struct resource *get_pci_domain_busn_res(int domain_nr) | ||
39 | { | ||
40 | struct pci_domain_busn_res *r; | ||
41 | |||
42 | list_for_each_entry(r, &pci_domain_busn_res_list, list) | ||
43 | if (r->domain_nr == domain_nr) | ||
44 | return &r->res; | ||
45 | |||
46 | r = kzalloc(sizeof(*r), GFP_KERNEL); | ||
47 | if (!r) | ||
48 | return NULL; | ||
49 | |||
50 | r->domain_nr = domain_nr; | ||
51 | r->res.start = 0; | ||
52 | r->res.end = 0xff; | ||
53 | r->res.flags = IORESOURCE_BUS | IORESOURCE_PCI_FIXED; | ||
54 | |||
55 | list_add_tail(&r->list, &pci_domain_busn_res_list); | ||
56 | |||
57 | return &r->res; | ||
58 | } | ||
59 | |||
23 | static int find_anything(struct device *dev, void *data) | 60 | static int find_anything(struct device *dev, void *data) |
24 | { | 61 | { |
25 | return 1; | 62 | return 1; |
@@ -383,8 +420,8 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child) | |||
383 | if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ | 420 | if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ |
384 | return; | 421 | return; |
385 | 422 | ||
386 | dev_info(&dev->dev, "PCI bridge to [bus %02x-%02x]%s\n", | 423 | dev_info(&dev->dev, "PCI bridge to %pR%s\n", |
387 | child->secondary, child->subordinate, | 424 | &child->busn_res, |
388 | dev->transparent ? " (subtractive decode)" : ""); | 425 | dev->transparent ? " (subtractive decode)" : ""); |
389 | 426 | ||
390 | pci_bus_remove_resources(child); | 427 | pci_bus_remove_resources(child); |
@@ -601,9 +638,9 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, | |||
601 | * Set up the primary, secondary and subordinate | 638 | * Set up the primary, secondary and subordinate |
602 | * bus numbers. | 639 | * bus numbers. |
603 | */ | 640 | */ |
604 | child->number = child->secondary = busnr; | 641 | child->number = child->busn_res.start = busnr; |
605 | child->primary = parent->secondary; | 642 | child->primary = parent->busn_res.start; |
606 | child->subordinate = 0xff; | 643 | child->busn_res.end = 0xff; |
607 | 644 | ||
608 | if (!bridge) | 645 | if (!bridge) |
609 | return child; | 646 | return child; |
@@ -645,8 +682,8 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) | |||
645 | if (!pcibios_assign_all_busses()) | 682 | if (!pcibios_assign_all_busses()) |
646 | return; | 683 | return; |
647 | 684 | ||
648 | while (parent->parent && parent->subordinate < max) { | 685 | while (parent->parent && parent->busn_res.end < max) { |
649 | parent->subordinate = max; | 686 | parent->busn_res.end = max; |
650 | pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, max); | 687 | pci_write_config_byte(parent->self, PCI_SUBORDINATE_BUS, max); |
651 | parent = parent->parent; | 688 | parent = parent->parent; |
652 | } | 689 | } |
@@ -720,15 +757,15 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
720 | if (!child) | 757 | if (!child) |
721 | goto out; | 758 | goto out; |
722 | child->primary = primary; | 759 | child->primary = primary; |
723 | child->subordinate = subordinate; | 760 | pci_bus_insert_busn_res(child, secondary, subordinate); |
724 | child->bridge_ctl = bctl; | 761 | child->bridge_ctl = bctl; |
725 | } | 762 | } |
726 | 763 | ||
727 | cmax = pci_scan_child_bus(child); | 764 | cmax = pci_scan_child_bus(child); |
728 | if (cmax > max) | 765 | if (cmax > max) |
729 | max = cmax; | 766 | max = cmax; |
730 | if (child->subordinate > max) | 767 | if (child->busn_res.end > max) |
731 | max = child->subordinate; | 768 | max = child->busn_res.end; |
732 | } else { | 769 | } else { |
733 | /* | 770 | /* |
734 | * We need to assign a number to this bus which we always | 771 | * We need to assign a number to this bus which we always |
@@ -758,11 +795,12 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
758 | child = pci_add_new_bus(bus, dev, ++max); | 795 | child = pci_add_new_bus(bus, dev, ++max); |
759 | if (!child) | 796 | if (!child) |
760 | goto out; | 797 | goto out; |
798 | pci_bus_insert_busn_res(child, max, 0xff); | ||
761 | } | 799 | } |
762 | buses = (buses & 0xff000000) | 800 | buses = (buses & 0xff000000) |
763 | | ((unsigned int)(child->primary) << 0) | 801 | | ((unsigned int)(child->primary) << 0) |
764 | | ((unsigned int)(child->secondary) << 8) | 802 | | ((unsigned int)(child->busn_res.start) << 8) |
765 | | ((unsigned int)(child->subordinate) << 16); | 803 | | ((unsigned int)(child->busn_res.end) << 16); |
766 | 804 | ||
767 | /* | 805 | /* |
768 | * yenta.c forces a secondary latency timer of 176. | 806 | * yenta.c forces a secondary latency timer of 176. |
@@ -807,8 +845,8 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
807 | break; | 845 | break; |
808 | while (parent->parent) { | 846 | while (parent->parent) { |
809 | if ((!pcibios_assign_all_busses()) && | 847 | if ((!pcibios_assign_all_busses()) && |
810 | (parent->subordinate > max) && | 848 | (parent->busn_res.end > max) && |
811 | (parent->subordinate <= max+i)) { | 849 | (parent->busn_res.end <= max+i)) { |
812 | j = 1; | 850 | j = 1; |
813 | } | 851 | } |
814 | parent = parent->parent; | 852 | parent = parent->parent; |
@@ -829,7 +867,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
829 | /* | 867 | /* |
830 | * Set the subordinate bus number to its real value. | 868 | * Set the subordinate bus number to its real value. |
831 | */ | 869 | */ |
832 | child->subordinate = max; | 870 | pci_bus_update_busn_res_end(child, max); |
833 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); | 871 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); |
834 | } | 872 | } |
835 | 873 | ||
@@ -839,19 +877,19 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
839 | 877 | ||
840 | /* Has only triggered on CardBus, fixup is in yenta_socket */ | 878 | /* Has only triggered on CardBus, fixup is in yenta_socket */ |
841 | while (bus->parent) { | 879 | while (bus->parent) { |
842 | if ((child->subordinate > bus->subordinate) || | 880 | if ((child->busn_res.end > bus->busn_res.end) || |
843 | (child->number > bus->subordinate) || | 881 | (child->number > bus->busn_res.end) || |
844 | (child->number < bus->number) || | 882 | (child->number < bus->number) || |
845 | (child->subordinate < bus->number)) { | 883 | (child->busn_res.end < bus->number)) { |
846 | dev_info(&child->dev, "[bus %02x-%02x] %s " | 884 | dev_info(&child->dev, "%pR %s " |
847 | "hidden behind%s bridge %s [bus %02x-%02x]\n", | 885 | "hidden behind%s bridge %s %pR\n", |
848 | child->number, child->subordinate, | 886 | &child->busn_res, |
849 | (bus->number > child->subordinate && | 887 | (bus->number > child->busn_res.end && |
850 | bus->subordinate < child->number) ? | 888 | bus->busn_res.end < child->number) ? |
851 | "wholly" : "partially", | 889 | "wholly" : "partially", |
852 | bus->self->transparent ? " transparent" : "", | 890 | bus->self->transparent ? " transparent" : "", |
853 | dev_name(&bus->dev), | 891 | dev_name(&bus->dev), |
854 | bus->number, bus->subordinate); | 892 | &bus->busn_res); |
855 | } | 893 | } |
856 | bus = bus->parent; | 894 | bus = bus->parent; |
857 | } | 895 | } |
@@ -1550,7 +1588,7 @@ EXPORT_SYMBOL_GPL(pcie_bus_configure_settings); | |||
1550 | 1588 | ||
1551 | unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) | 1589 | unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) |
1552 | { | 1590 | { |
1553 | unsigned int devfn, pass, max = bus->secondary; | 1591 | unsigned int devfn, pass, max = bus->busn_res.start; |
1554 | struct pci_dev *dev; | 1592 | struct pci_dev *dev; |
1555 | 1593 | ||
1556 | dev_dbg(&bus->dev, "scanning bus\n"); | 1594 | dev_dbg(&bus->dev, "scanning bus\n"); |
@@ -1644,7 +1682,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, | |||
1644 | /* Create legacy_io and legacy_mem files for this bus */ | 1682 | /* Create legacy_io and legacy_mem files for this bus */ |
1645 | pci_create_legacy_files(b); | 1683 | pci_create_legacy_files(b); |
1646 | 1684 | ||
1647 | b->number = b->secondary = bus; | 1685 | b->number = b->busn_res.start = bus; |
1648 | 1686 | ||
1649 | if (parent) | 1687 | if (parent) |
1650 | dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev)); | 1688 | dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev)); |
@@ -1656,7 +1694,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, | |||
1656 | list_move_tail(&window->list, &bridge->windows); | 1694 | list_move_tail(&window->list, &bridge->windows); |
1657 | res = window->res; | 1695 | res = window->res; |
1658 | offset = window->offset; | 1696 | offset = window->offset; |
1659 | pci_bus_add_resource(b, res, 0); | 1697 | if (res->flags & IORESOURCE_BUS) |
1698 | pci_bus_insert_busn_res(b, bus, res->end); | ||
1699 | else | ||
1700 | pci_bus_add_resource(b, res, 0); | ||
1660 | if (offset) { | 1701 | if (offset) { |
1661 | if (resource_type(res) == IORESOURCE_IO) | 1702 | if (resource_type(res) == IORESOURCE_IO) |
1662 | fmt = " (bus address [%#06llx-%#06llx])"; | 1703 | fmt = " (bus address [%#06llx-%#06llx])"; |
@@ -1686,16 +1727,104 @@ err_out: | |||
1686 | return NULL; | 1727 | return NULL; |
1687 | } | 1728 | } |
1688 | 1729 | ||
1730 | int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max) | ||
1731 | { | ||
1732 | struct resource *res = &b->busn_res; | ||
1733 | struct resource *parent_res, *conflict; | ||
1734 | |||
1735 | res->start = bus; | ||
1736 | res->end = bus_max; | ||
1737 | res->flags = IORESOURCE_BUS; | ||
1738 | |||
1739 | if (!pci_is_root_bus(b)) | ||
1740 | parent_res = &b->parent->busn_res; | ||
1741 | else { | ||
1742 | parent_res = get_pci_domain_busn_res(pci_domain_nr(b)); | ||
1743 | res->flags |= IORESOURCE_PCI_FIXED; | ||
1744 | } | ||
1745 | |||
1746 | conflict = insert_resource_conflict(parent_res, res); | ||
1747 | |||
1748 | if (conflict) | ||
1749 | dev_printk(KERN_DEBUG, &b->dev, | ||
1750 | "busn_res: can not insert %pR under %s%pR (conflicts with %s %pR)\n", | ||
1751 | res, pci_is_root_bus(b) ? "domain " : "", | ||
1752 | parent_res, conflict->name, conflict); | ||
1753 | else | ||
1754 | dev_printk(KERN_DEBUG, &b->dev, | ||
1755 | "busn_res: %pR is inserted under %s%pR\n", | ||
1756 | res, pci_is_root_bus(b) ? "domain " : "", | ||
1757 | parent_res); | ||
1758 | |||
1759 | return conflict == NULL; | ||
1760 | } | ||
1761 | |||
1762 | int pci_bus_update_busn_res_end(struct pci_bus *b, int bus_max) | ||
1763 | { | ||
1764 | struct resource *res = &b->busn_res; | ||
1765 | struct resource old_res = *res; | ||
1766 | resource_size_t size; | ||
1767 | int ret; | ||
1768 | |||
1769 | if (res->start > bus_max) | ||
1770 | return -EINVAL; | ||
1771 | |||
1772 | size = bus_max - res->start + 1; | ||
1773 | ret = adjust_resource(res, res->start, size); | ||
1774 | dev_printk(KERN_DEBUG, &b->dev, | ||
1775 | "busn_res: %pR end %s updated to %02x\n", | ||
1776 | &old_res, ret ? "can not be" : "is", bus_max); | ||
1777 | |||
1778 | if (!ret && !res->parent) | ||
1779 | pci_bus_insert_busn_res(b, res->start, res->end); | ||
1780 | |||
1781 | return ret; | ||
1782 | } | ||
1783 | |||
1784 | void pci_bus_release_busn_res(struct pci_bus *b) | ||
1785 | { | ||
1786 | struct resource *res = &b->busn_res; | ||
1787 | int ret; | ||
1788 | |||
1789 | if (!res->flags || !res->parent) | ||
1790 | return; | ||
1791 | |||
1792 | ret = release_resource(res); | ||
1793 | dev_printk(KERN_DEBUG, &b->dev, | ||
1794 | "busn_res: %pR %s released\n", | ||
1795 | res, ret ? "can not be" : "is"); | ||
1796 | } | ||
1797 | |||
1689 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, | 1798 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, |
1690 | struct pci_ops *ops, void *sysdata, struct list_head *resources) | 1799 | struct pci_ops *ops, void *sysdata, struct list_head *resources) |
1691 | { | 1800 | { |
1801 | struct pci_host_bridge_window *window; | ||
1802 | bool found = false; | ||
1692 | struct pci_bus *b; | 1803 | struct pci_bus *b; |
1804 | int max; | ||
1805 | |||
1806 | list_for_each_entry(window, resources, list) | ||
1807 | if (window->res->flags & IORESOURCE_BUS) { | ||
1808 | found = true; | ||
1809 | break; | ||
1810 | } | ||
1693 | 1811 | ||
1694 | b = pci_create_root_bus(parent, bus, ops, sysdata, resources); | 1812 | b = pci_create_root_bus(parent, bus, ops, sysdata, resources); |
1695 | if (!b) | 1813 | if (!b) |
1696 | return NULL; | 1814 | return NULL; |
1697 | 1815 | ||
1698 | b->subordinate = pci_scan_child_bus(b); | 1816 | if (!found) { |
1817 | dev_info(&b->dev, | ||
1818 | "No busn resource found for root bus, will use [bus %02x-ff]\n", | ||
1819 | bus); | ||
1820 | pci_bus_insert_busn_res(b, bus, 255); | ||
1821 | } | ||
1822 | |||
1823 | max = pci_scan_child_bus(b); | ||
1824 | |||
1825 | if (!found) | ||
1826 | pci_bus_update_busn_res_end(b, max); | ||
1827 | |||
1699 | pci_bus_add_devices(b); | 1828 | pci_bus_add_devices(b); |
1700 | return b; | 1829 | return b; |
1701 | } | 1830 | } |
@@ -1710,9 +1839,10 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, | |||
1710 | 1839 | ||
1711 | pci_add_resource(&resources, &ioport_resource); | 1840 | pci_add_resource(&resources, &ioport_resource); |
1712 | pci_add_resource(&resources, &iomem_resource); | 1841 | pci_add_resource(&resources, &iomem_resource); |
1842 | pci_add_resource(&resources, &busn_resource); | ||
1713 | b = pci_create_root_bus(parent, bus, ops, sysdata, &resources); | 1843 | b = pci_create_root_bus(parent, bus, ops, sysdata, &resources); |
1714 | if (b) | 1844 | if (b) |
1715 | b->subordinate = pci_scan_child_bus(b); | 1845 | pci_scan_child_bus(b); |
1716 | else | 1846 | else |
1717 | pci_free_resource_list(&resources); | 1847 | pci_free_resource_list(&resources); |
1718 | return b; | 1848 | return b; |
@@ -1727,9 +1857,10 @@ struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, | |||
1727 | 1857 | ||
1728 | pci_add_resource(&resources, &ioport_resource); | 1858 | pci_add_resource(&resources, &ioport_resource); |
1729 | pci_add_resource(&resources, &iomem_resource); | 1859 | pci_add_resource(&resources, &iomem_resource); |
1860 | pci_add_resource(&resources, &busn_resource); | ||
1730 | b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); | 1861 | b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); |
1731 | if (b) { | 1862 | if (b) { |
1732 | b->subordinate = pci_scan_child_bus(b); | 1863 | pci_scan_child_bus(b); |
1733 | pci_bus_add_devices(b); | 1864 | pci_bus_add_devices(b); |
1734 | } else { | 1865 | } else { |
1735 | pci_free_resource_list(&resources); | 1866 | pci_free_resource_list(&resources); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 2a7521677541..a2d9d330a01e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -253,7 +253,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576, quirk_vsfx) | |||
253 | * workaround applied too | 253 | * workaround applied too |
254 | * [Info kindly provided by ALi] | 254 | * [Info kindly provided by ALi] |
255 | */ | 255 | */ |
256 | static void __init quirk_alimagik(struct pci_dev *dev) | 256 | static void __devinit quirk_alimagik(struct pci_dev *dev) |
257 | { | 257 | { |
258 | if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) { | 258 | if ((pci_pci_problems&PCIPCI_ALIMAGIK)==0) { |
259 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); | 259 | dev_info(&dev->dev, "Limiting direct PCI/PCI transfers\n"); |
@@ -789,7 +789,7 @@ static void __devinit quirk_amd_ioapic(struct pci_dev *dev) | |||
789 | } | 789 | } |
790 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410, quirk_amd_ioapic); | 790 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410, quirk_amd_ioapic); |
791 | 791 | ||
792 | static void __init quirk_ioapic_rmw(struct pci_dev *dev) | 792 | static void __devinit quirk_ioapic_rmw(struct pci_dev *dev) |
793 | { | 793 | { |
794 | if (dev->devfn == 0 && dev->bus->number == 0) | 794 | if (dev->devfn == 0 && dev->bus->number == 0) |
795 | sis_apic_bug = 1; | 795 | sis_apic_bug = 1; |
@@ -801,7 +801,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw); | |||
801 | * Some settings of MMRBC can lead to data corruption so block changes. | 801 | * Some settings of MMRBC can lead to data corruption so block changes. |
802 | * See AMD 8131 HyperTransport PCI-X Tunnel Revision Guide | 802 | * See AMD 8131 HyperTransport PCI-X Tunnel Revision Guide |
803 | */ | 803 | */ |
804 | static void __init quirk_amd_8131_mmrbc(struct pci_dev *dev) | 804 | static void __devinit quirk_amd_8131_mmrbc(struct pci_dev *dev) |
805 | { | 805 | { |
806 | if (dev->subordinate && dev->revision <= 0x12) { | 806 | if (dev->subordinate && dev->revision <= 0x12) { |
807 | dev_info(&dev->dev, "AMD8131 rev %x detected; " | 807 | dev_info(&dev->dev, "AMD8131 rev %x detected; " |
@@ -1082,7 +1082,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB | |||
1082 | /* | 1082 | /* |
1083 | * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same | 1083 | * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same |
1084 | */ | 1084 | */ |
1085 | static void __init quirk_ide_samemode(struct pci_dev *pdev) | 1085 | static void __devinit quirk_ide_samemode(struct pci_dev *pdev) |
1086 | { | 1086 | { |
1087 | u8 prog; | 1087 | u8 prog; |
1088 | 1088 | ||
@@ -1121,7 +1121,7 @@ DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, | |||
1121 | /* This was originally an Alpha specific thing, but it really fits here. | 1121 | /* This was originally an Alpha specific thing, but it really fits here. |
1122 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. | 1122 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. |
1123 | */ | 1123 | */ |
1124 | static void __init quirk_eisa_bridge(struct pci_dev *dev) | 1124 | static void __devinit quirk_eisa_bridge(struct pci_dev *dev) |
1125 | { | 1125 | { |
1126 | dev->class = PCI_CLASS_BRIDGE_EISA << 8; | 1126 | dev->class = PCI_CLASS_BRIDGE_EISA << 8; |
1127 | } | 1127 | } |
@@ -1155,7 +1155,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82375, quirk_e | |||
1155 | */ | 1155 | */ |
1156 | static int asus_hides_smbus; | 1156 | static int asus_hides_smbus; |
1157 | 1157 | ||
1158 | static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | 1158 | static void __devinit asus_hides_smbus_hostbridge(struct pci_dev *dev) |
1159 | { | 1159 | { |
1160 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { | 1160 | if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) { |
1161 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) | 1161 | if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB) |
@@ -1538,7 +1538,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB3 | |||
1538 | #endif | 1538 | #endif |
1539 | 1539 | ||
1540 | #ifdef CONFIG_X86_IO_APIC | 1540 | #ifdef CONFIG_X86_IO_APIC |
1541 | static void __init quirk_alder_ioapic(struct pci_dev *pdev) | 1541 | static void __devinit quirk_alder_ioapic(struct pci_dev *pdev) |
1542 | { | 1542 | { |
1543 | int i; | 1543 | int i; |
1544 | 1544 | ||
@@ -1777,7 +1777,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_SMBUS, qui | |||
1777 | * but the PIO transfers won't work if BAR0 falls at the odd 8 bytes. | 1777 | * but the PIO transfers won't work if BAR0 falls at the odd 8 bytes. |
1778 | * Re-allocate the region if needed... | 1778 | * Re-allocate the region if needed... |
1779 | */ | 1779 | */ |
1780 | static void __init quirk_tc86c001_ide(struct pci_dev *dev) | 1780 | static void __devinit quirk_tc86c001_ide(struct pci_dev *dev) |
1781 | { | 1781 | { |
1782 | struct resource *r = &dev->resource[0]; | 1782 | struct resource *r = &dev->resource[0]; |
1783 | 1783 | ||
@@ -2169,7 +2169,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8624, quirk_tile_plx_gen1); | |||
2169 | * aware of it. Instead of setting the flag on all busses in the | 2169 | * aware of it. Instead of setting the flag on all busses in the |
2170 | * machine, simply disable MSI globally. | 2170 | * machine, simply disable MSI globally. |
2171 | */ | 2171 | */ |
2172 | static void __init quirk_disable_all_msi(struct pci_dev *dev) | 2172 | static void __devinit quirk_disable_all_msi(struct pci_dev *dev) |
2173 | { | 2173 | { |
2174 | pci_no_msi(); | 2174 | pci_no_msi(); |
2175 | dev_warn(&dev->dev, "MSI quirk detected; MSI disabled\n"); | 2175 | dev_warn(&dev->dev, "MSI quirk detected; MSI disabled\n"); |
@@ -2929,6 +2929,20 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev) | |||
2929 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); | 2929 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq); |
2930 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); | 2930 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq); |
2931 | 2931 | ||
2932 | /* | ||
2933 | * Some devices may pass our check in pci_intx_mask_supported if | ||
2934 | * PCI_COMMAND_INTX_DISABLE works though they actually do not properly | ||
2935 | * support this feature. | ||
2936 | */ | ||
2937 | static void __devinit quirk_broken_intx_masking(struct pci_dev *dev) | ||
2938 | { | ||
2939 | dev->broken_intx_masking = 1; | ||
2940 | } | ||
2941 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CHELSIO, 0x0030, | ||
2942 | quirk_broken_intx_masking); | ||
2943 | DECLARE_PCI_FIXUP_HEADER(0x1814, 0x0601, /* Ralink RT2800 802.11n PCI */ | ||
2944 | quirk_broken_intx_masking); | ||
2945 | |||
2932 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, | 2946 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, |
2933 | struct pci_fixup *end) | 2947 | struct pci_fixup *end) |
2934 | { | 2948 | { |
@@ -3179,3 +3193,87 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe) | |||
3179 | 3193 | ||
3180 | return -ENOTTY; | 3194 | return -ENOTTY; |
3181 | } | 3195 | } |
3196 | |||
3197 | static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev) | ||
3198 | { | ||
3199 | if (!PCI_FUNC(dev->devfn)) | ||
3200 | return pci_dev_get(dev); | ||
3201 | |||
3202 | return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); | ||
3203 | } | ||
3204 | |||
3205 | static const struct pci_dev_dma_source { | ||
3206 | u16 vendor; | ||
3207 | u16 device; | ||
3208 | struct pci_dev *(*dma_source)(struct pci_dev *dev); | ||
3209 | } pci_dev_dma_source[] = { | ||
3210 | /* | ||
3211 | * https://bugzilla.redhat.com/show_bug.cgi?id=605888 | ||
3212 | * | ||
3213 | * Some Ricoh devices use the function 0 source ID for DMA on | ||
3214 | * other functions of a multifunction device. The DMA devices | ||
3215 | * is therefore function 0, which will have implications of the | ||
3216 | * iommu grouping of these devices. | ||
3217 | */ | ||
3218 | { PCI_VENDOR_ID_RICOH, 0xe822, pci_func_0_dma_source }, | ||
3219 | { PCI_VENDOR_ID_RICOH, 0xe230, pci_func_0_dma_source }, | ||
3220 | { PCI_VENDOR_ID_RICOH, 0xe832, pci_func_0_dma_source }, | ||
3221 | { PCI_VENDOR_ID_RICOH, 0xe476, pci_func_0_dma_source }, | ||
3222 | { 0 } | ||
3223 | }; | ||
3224 | |||
3225 | /* | ||
3226 | * IOMMUs with isolation capabilities need to be programmed with the | ||
3227 | * correct source ID of a device. In most cases, the source ID matches | ||
3228 | * the device doing the DMA, but sometimes hardware is broken and will | ||
3229 | * tag the DMA as being sourced from a different device. This function | ||
3230 | * allows that translation. Note that the reference count of the | ||
3231 | * returned device is incremented on all paths. | ||
3232 | */ | ||
3233 | struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | ||
3234 | { | ||
3235 | const struct pci_dev_dma_source *i; | ||
3236 | |||
3237 | for (i = pci_dev_dma_source; i->dma_source; i++) { | ||
3238 | if ((i->vendor == dev->vendor || | ||
3239 | i->vendor == (u16)PCI_ANY_ID) && | ||
3240 | (i->device == dev->device || | ||
3241 | i->device == (u16)PCI_ANY_ID)) | ||
3242 | return i->dma_source(dev); | ||
3243 | } | ||
3244 | |||
3245 | return pci_dev_get(dev); | ||
3246 | } | ||
3247 | |||
3248 | static const struct pci_dev_acs_enabled { | ||
3249 | u16 vendor; | ||
3250 | u16 device; | ||
3251 | int (*acs_enabled)(struct pci_dev *dev, u16 acs_flags); | ||
3252 | } pci_dev_acs_enabled[] = { | ||
3253 | { 0 } | ||
3254 | }; | ||
3255 | |||
3256 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags) | ||
3257 | { | ||
3258 | const struct pci_dev_acs_enabled *i; | ||
3259 | int ret; | ||
3260 | |||
3261 | /* | ||
3262 | * Allow devices that do not expose standard PCIe ACS capabilities | ||
3263 | * or control to indicate their support here. Multi-function express | ||
3264 | * devices which do not allow internal peer-to-peer between functions, | ||
3265 | * but do not implement PCIe ACS may wish to return true here. | ||
3266 | */ | ||
3267 | for (i = pci_dev_acs_enabled; i->acs_enabled; i++) { | ||
3268 | if ((i->vendor == dev->vendor || | ||
3269 | i->vendor == (u16)PCI_ANY_ID) && | ||
3270 | (i->device == dev->device || | ||
3271 | i->device == (u16)PCI_ANY_ID)) { | ||
3272 | ret = i->acs_enabled(dev, acs_flags); | ||
3273 | if (ret >= 0) | ||
3274 | return ret; | ||
3275 | } | ||
3276 | } | ||
3277 | |||
3278 | return -ENOTTY; | ||
3279 | } | ||
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index fd77e2bde2e8..04a4861b4749 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -68,6 +68,7 @@ void pci_remove_bus(struct pci_bus *pci_bus) | |||
68 | 68 | ||
69 | down_write(&pci_bus_sem); | 69 | down_write(&pci_bus_sem); |
70 | list_del(&pci_bus->node); | 70 | list_del(&pci_bus->node); |
71 | pci_bus_release_busn_res(pci_bus); | ||
71 | up_write(&pci_bus_sem); | 72 | up_write(&pci_bus_sem); |
72 | if (!pci_bus->is_added) | 73 | if (!pci_bus->is_added) |
73 | return; | 74 | return; |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 9d75dc8ca602..993d4a0a2469 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include "pci.h" | 15 | #include "pci.h" |
16 | 16 | ||
17 | DECLARE_RWSEM(pci_bus_sem); | 17 | DECLARE_RWSEM(pci_bus_sem); |
18 | EXPORT_SYMBOL_GPL(pci_bus_sem); | ||
19 | |||
18 | /* | 20 | /* |
19 | * find the upstream PCIe-to-PCI bridge of a PCI device | 21 | * find the upstream PCIe-to-PCI bridge of a PCI device |
20 | * if the device is PCIE, return NULL | 22 | * if the device is PCIE, return NULL |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 9165d25cc792..561e41cf102d 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -404,8 +404,8 @@ void pci_setup_cardbus(struct pci_bus *bus) | |||
404 | struct resource *res; | 404 | struct resource *res; |
405 | struct pci_bus_region region; | 405 | struct pci_bus_region region; |
406 | 406 | ||
407 | dev_info(&bridge->dev, "CardBus bridge to [bus %02x-%02x]\n", | 407 | dev_info(&bridge->dev, "CardBus bridge to %pR\n", |
408 | bus->secondary, bus->subordinate); | 408 | &bus->busn_res); |
409 | 409 | ||
410 | res = bus->resource[0]; | 410 | res = bus->resource[0]; |
411 | pcibios_resource_to_bus(bridge, ®ion, res); | 411 | pcibios_resource_to_bus(bridge, ®ion, res); |
@@ -553,8 +553,8 @@ static void __pci_setup_bridge(struct pci_bus *bus, unsigned long type) | |||
553 | { | 553 | { |
554 | struct pci_dev *bridge = bus->self; | 554 | struct pci_dev *bridge = bus->self; |
555 | 555 | ||
556 | dev_info(&bridge->dev, "PCI bridge to [bus %02x-%02x]\n", | 556 | dev_info(&bridge->dev, "PCI bridge to %pR\n", |
557 | bus->secondary, bus->subordinate); | 557 | &bus->busn_res); |
558 | 558 | ||
559 | if (type & IORESOURCE_IO) | 559 | if (type & IORESOURCE_IO) |
560 | pci_setup_bridge_io(bus); | 560 | pci_setup_bridge_io(bus); |
@@ -745,8 +745,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
745 | if (!size0 && !size1) { | 745 | if (!size0 && !size1) { |
746 | if (b_res->start || b_res->end) | 746 | if (b_res->start || b_res->end) |
747 | dev_info(&bus->self->dev, "disabling bridge window " | 747 | dev_info(&bus->self->dev, "disabling bridge window " |
748 | "%pR to [bus %02x-%02x] (unused)\n", b_res, | 748 | "%pR to %pR (unused)\n", b_res, |
749 | bus->secondary, bus->subordinate); | 749 | &bus->busn_res); |
750 | b_res->flags = 0; | 750 | b_res->flags = 0; |
751 | return; | 751 | return; |
752 | } | 752 | } |
@@ -757,8 +757,8 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
757 | if (size1 > size0 && realloc_head) { | 757 | if (size1 > size0 && realloc_head) { |
758 | add_to_list(realloc_head, bus->self, b_res, size1-size0, 4096); | 758 | add_to_list(realloc_head, bus->self, b_res, size1-size0, 4096); |
759 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " | 759 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " |
760 | "%pR to [bus %02x-%02x] add_size %lx\n", b_res, | 760 | "%pR to %pR add_size %lx\n", b_res, |
761 | bus->secondary, bus->subordinate, size1-size0); | 761 | &bus->busn_res, size1-size0); |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
@@ -863,8 +863,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
863 | if (!size0 && !size1) { | 863 | if (!size0 && !size1) { |
864 | if (b_res->start || b_res->end) | 864 | if (b_res->start || b_res->end) |
865 | dev_info(&bus->self->dev, "disabling bridge window " | 865 | dev_info(&bus->self->dev, "disabling bridge window " |
866 | "%pR to [bus %02x-%02x] (unused)\n", b_res, | 866 | "%pR to %pR (unused)\n", b_res, |
867 | bus->secondary, bus->subordinate); | 867 | &bus->busn_res); |
868 | b_res->flags = 0; | 868 | b_res->flags = 0; |
869 | return 1; | 869 | return 1; |
870 | } | 870 | } |
@@ -874,8 +874,8 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
874 | if (size1 > size0 && realloc_head) { | 874 | if (size1 > size0 && realloc_head) { |
875 | add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); | 875 | add_to_list(realloc_head, bus->self, b_res, size1-size0, min_align); |
876 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " | 876 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " |
877 | "%pR to [bus %02x-%02x] add_size %llx\n", b_res, | 877 | "%pR to %pR add_size %llx\n", b_res, |
878 | bus->secondary, bus->subordinate, (unsigned long long)size1-size0); | 878 | &bus->busn_res, (unsigned long long)size1-size0); |
879 | } | 879 | } |
880 | return 1; | 880 | return 1; |
881 | } | 881 | } |
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 6e75153c5b4f..24caeaf50529 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c | |||
@@ -73,7 +73,7 @@ int __ref cb_alloc(struct pcmcia_socket *s) | |||
73 | s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); | 73 | s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); |
74 | pci_fixup_cardbus(bus); | 74 | pci_fixup_cardbus(bus); |
75 | 75 | ||
76 | max = bus->secondary; | 76 | max = bus->busn_res.start; |
77 | for (pass = 0; pass < 2; pass++) | 77 | for (pass = 0; pass < 2; pass++) |
78 | list_for_each_entry(dev, &bus->devices, bus_list) | 78 | list_for_each_entry(dev, &bus->devices, bus_list) |
79 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 79 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index d07f9ac8c41d..667678db1153 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -1048,8 +1048,8 @@ static void yenta_config_init(struct yenta_socket *socket) | |||
1048 | config_writeb(socket, PCI_LATENCY_TIMER, 168); | 1048 | config_writeb(socket, PCI_LATENCY_TIMER, 168); |
1049 | config_writel(socket, PCI_PRIMARY_BUS, | 1049 | config_writel(socket, PCI_PRIMARY_BUS, |
1050 | (176 << 24) | /* sec. latency timer */ | 1050 | (176 << 24) | /* sec. latency timer */ |
1051 | (dev->subordinate->subordinate << 16) | /* subordinate bus */ | 1051 | ((unsigned int)dev->subordinate->busn_res.end << 16) | /* subordinate bus */ |
1052 | (dev->subordinate->secondary << 8) | /* secondary bus */ | 1052 | ((unsigned int)dev->subordinate->busn_res.start << 8) | /* secondary bus */ |
1053 | dev->subordinate->primary); /* primary bus */ | 1053 | dev->subordinate->primary); /* primary bus */ |
1054 | 1054 | ||
1055 | /* | 1055 | /* |
@@ -1086,14 +1086,14 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | |||
1086 | struct pci_bus *bridge_to_fix = cardbus_bridge->parent; | 1086 | struct pci_bus *bridge_to_fix = cardbus_bridge->parent; |
1087 | 1087 | ||
1088 | /* Check bus numbers are already set up correctly: */ | 1088 | /* Check bus numbers are already set up correctly: */ |
1089 | if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate) | 1089 | if (bridge_to_fix->busn_res.end >= cardbus_bridge->busn_res.end) |
1090 | return; /* The subordinate number is ok, nothing to do */ | 1090 | return; /* The subordinate number is ok, nothing to do */ |
1091 | 1091 | ||
1092 | if (!bridge_to_fix->parent) | 1092 | if (!bridge_to_fix->parent) |
1093 | return; /* Root bridges are ok */ | 1093 | return; /* Root bridges are ok */ |
1094 | 1094 | ||
1095 | /* stay within the limits of the bus range of the parent: */ | 1095 | /* stay within the limits of the bus range of the parent: */ |
1096 | upper_limit = bridge_to_fix->parent->subordinate; | 1096 | upper_limit = bridge_to_fix->parent->busn_res.end; |
1097 | 1097 | ||
1098 | /* check the bus ranges of all silbling bridges to prevent overlap */ | 1098 | /* check the bus ranges of all silbling bridges to prevent overlap */ |
1099 | list_for_each(tmp, &bridge_to_fix->parent->children) { | 1099 | list_for_each(tmp, &bridge_to_fix->parent->children) { |
@@ -1104,36 +1104,36 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | |||
1104 | * current upper limit, set the new upper limit to | 1104 | * current upper limit, set the new upper limit to |
1105 | * the bus number below the silbling's range: | 1105 | * the bus number below the silbling's range: |
1106 | */ | 1106 | */ |
1107 | if (silbling->secondary > bridge_to_fix->subordinate | 1107 | if (silbling->busn_res.start > bridge_to_fix->busn_res.end |
1108 | && silbling->secondary <= upper_limit) | 1108 | && silbling->busn_res.start <= upper_limit) |
1109 | upper_limit = silbling->secondary - 1; | 1109 | upper_limit = silbling->busn_res.start - 1; |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | /* Show that the wanted subordinate number is not possible: */ | 1112 | /* Show that the wanted subordinate number is not possible: */ |
1113 | if (cardbus_bridge->subordinate > upper_limit) | 1113 | if (cardbus_bridge->busn_res.end > upper_limit) |
1114 | dev_printk(KERN_WARNING, &cardbus_bridge->dev, | 1114 | dev_printk(KERN_WARNING, &cardbus_bridge->dev, |
1115 | "Upper limit for fixing this " | 1115 | "Upper limit for fixing this " |
1116 | "bridge's parent bridge: #%02x\n", upper_limit); | 1116 | "bridge's parent bridge: #%02x\n", upper_limit); |
1117 | 1117 | ||
1118 | /* If we have room to increase the bridge's subordinate number, */ | 1118 | /* If we have room to increase the bridge's subordinate number, */ |
1119 | if (bridge_to_fix->subordinate < upper_limit) { | 1119 | if (bridge_to_fix->busn_res.end < upper_limit) { |
1120 | 1120 | ||
1121 | /* use the highest number of the hidden bus, within limits */ | 1121 | /* use the highest number of the hidden bus, within limits */ |
1122 | unsigned char subordinate_to_assign = | 1122 | unsigned char subordinate_to_assign = |
1123 | min(cardbus_bridge->subordinate, upper_limit); | 1123 | min_t(int, cardbus_bridge->busn_res.end, upper_limit); |
1124 | 1124 | ||
1125 | dev_printk(KERN_INFO, &bridge_to_fix->dev, | 1125 | dev_printk(KERN_INFO, &bridge_to_fix->dev, |
1126 | "Raising subordinate bus# of parent " | 1126 | "Raising subordinate bus# of parent " |
1127 | "bus (#%02x) from #%02x to #%02x\n", | 1127 | "bus (#%02x) from #%02x to #%02x\n", |
1128 | bridge_to_fix->number, | 1128 | bridge_to_fix->number, |
1129 | bridge_to_fix->subordinate, subordinate_to_assign); | 1129 | (int)bridge_to_fix->busn_res.end, subordinate_to_assign); |
1130 | 1130 | ||
1131 | /* Save the new subordinate in the bus struct of the bridge */ | 1131 | /* Save the new subordinate in the bus struct of the bridge */ |
1132 | bridge_to_fix->subordinate = subordinate_to_assign; | 1132 | bridge_to_fix->busn_res.end = subordinate_to_assign; |
1133 | 1133 | ||
1134 | /* and update the PCI config space with the new subordinate */ | 1134 | /* and update the PCI config space with the new subordinate */ |
1135 | pci_write_config_byte(bridge_to_fix->self, | 1135 | pci_write_config_byte(bridge_to_fix->self, |
1136 | PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate); | 1136 | PCI_SUBORDINATE_BUS, bridge_to_fix->busn_res.end); |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | 1139 | ||
diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c index 30d7be026c18..46ae0f9f02ad 100644 --- a/drivers/xen/xen-pciback/conf_space.c +++ b/drivers/xen/xen-pciback/conf_space.c | |||
@@ -124,7 +124,7 @@ static inline u32 merge_value(u32 val, u32 new_val, u32 new_val_mask, | |||
124 | return val; | 124 | return val; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int pcibios_err_to_errno(int err) | 127 | static int xen_pcibios_err_to_errno(int err) |
128 | { | 128 | { |
129 | switch (err) { | 129 | switch (err) { |
130 | case PCIBIOS_SUCCESSFUL: | 130 | case PCIBIOS_SUCCESSFUL: |
@@ -202,7 +202,7 @@ out: | |||
202 | pci_name(dev), size, offset, value); | 202 | pci_name(dev), size, offset, value); |
203 | 203 | ||
204 | *ret_val = value; | 204 | *ret_val = value; |
205 | return pcibios_err_to_errno(err); | 205 | return xen_pcibios_err_to_errno(err); |
206 | } | 206 | } |
207 | 207 | ||
208 | int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | 208 | int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) |
@@ -290,7 +290,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | |||
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | return pcibios_err_to_errno(err); | 293 | return xen_pcibios_err_to_errno(err); |
294 | } | 294 | } |
295 | 295 | ||
296 | void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev) | 296 | void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index d8c379dba6ad..c739df91bac9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -324,6 +324,7 @@ struct pci_dev { | |||
324 | unsigned int is_hotplug_bridge:1; | 324 | unsigned int is_hotplug_bridge:1; |
325 | unsigned int __aer_firmware_first_valid:1; | 325 | unsigned int __aer_firmware_first_valid:1; |
326 | unsigned int __aer_firmware_first:1; | 326 | unsigned int __aer_firmware_first:1; |
327 | unsigned int broken_intx_masking:1; | ||
327 | pci_dev_flags_t dev_flags; | 328 | pci_dev_flags_t dev_flags; |
328 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 329 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
329 | 330 | ||
@@ -368,6 +369,8 @@ static inline int pci_channel_offline(struct pci_dev *pdev) | |||
368 | return (pdev->error_state != pci_channel_io_normal); | 369 | return (pdev->error_state != pci_channel_io_normal); |
369 | } | 370 | } |
370 | 371 | ||
372 | extern struct resource busn_resource; | ||
373 | |||
371 | struct pci_host_bridge_window { | 374 | struct pci_host_bridge_window { |
372 | struct list_head list; | 375 | struct list_head list; |
373 | struct resource *res; /* host bridge aperture (CPU address) */ | 376 | struct resource *res; /* host bridge aperture (CPU address) */ |
@@ -419,6 +422,7 @@ struct pci_bus { | |||
419 | struct list_head slots; /* list of slots on this bus */ | 422 | struct list_head slots; /* list of slots on this bus */ |
420 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; | 423 | struct resource *resource[PCI_BRIDGE_RESOURCE_NUM]; |
421 | struct list_head resources; /* address space routed to this bus */ | 424 | struct list_head resources; /* address space routed to this bus */ |
425 | struct resource busn_res; /* bus numbers routed to this bus */ | ||
422 | 426 | ||
423 | struct pci_ops *ops; /* configuration access functions */ | 427 | struct pci_ops *ops; /* configuration access functions */ |
424 | void *sysdata; /* hook for sys-specific extension */ | 428 | void *sysdata; /* hook for sys-specific extension */ |
@@ -426,8 +430,6 @@ struct pci_bus { | |||
426 | 430 | ||
427 | unsigned char number; /* bus number */ | 431 | unsigned char number; /* bus number */ |
428 | unsigned char primary; /* number of primary bridge */ | 432 | unsigned char primary; /* number of primary bridge */ |
429 | unsigned char secondary; /* number of secondary bridge */ | ||
430 | unsigned char subordinate; /* max number of subordinate buses */ | ||
431 | unsigned char max_bus_speed; /* enum pci_bus_speed */ | 433 | unsigned char max_bus_speed; /* enum pci_bus_speed */ |
432 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ | 434 | unsigned char cur_bus_speed; /* enum pci_bus_speed */ |
433 | 435 | ||
@@ -474,6 +476,32 @@ static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; | |||
474 | #define PCIBIOS_SET_FAILED 0x88 | 476 | #define PCIBIOS_SET_FAILED 0x88 |
475 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 | 477 | #define PCIBIOS_BUFFER_TOO_SMALL 0x89 |
476 | 478 | ||
479 | /* | ||
480 | * Translate above to generic errno for passing back through non-pci. | ||
481 | */ | ||
482 | static inline int pcibios_err_to_errno(int err) | ||
483 | { | ||
484 | if (err <= PCIBIOS_SUCCESSFUL) | ||
485 | return err; /* Assume already errno */ | ||
486 | |||
487 | switch (err) { | ||
488 | case PCIBIOS_FUNC_NOT_SUPPORTED: | ||
489 | return -ENOENT; | ||
490 | case PCIBIOS_BAD_VENDOR_ID: | ||
491 | return -EINVAL; | ||
492 | case PCIBIOS_DEVICE_NOT_FOUND: | ||
493 | return -ENODEV; | ||
494 | case PCIBIOS_BAD_REGISTER_NUMBER: | ||
495 | return -EFAULT; | ||
496 | case PCIBIOS_SET_FAILED: | ||
497 | return -EIO; | ||
498 | case PCIBIOS_BUFFER_TOO_SMALL: | ||
499 | return -ENOSPC; | ||
500 | } | ||
501 | |||
502 | return -ENOTTY; | ||
503 | } | ||
504 | |||
477 | /* Low-level architecture-dependent routines */ | 505 | /* Low-level architecture-dependent routines */ |
478 | 506 | ||
479 | struct pci_ops { | 507 | struct pci_ops { |
@@ -668,6 +696,9 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); | |||
668 | struct pci_bus *pci_create_root_bus(struct device *parent, int bus, | 696 | struct pci_bus *pci_create_root_bus(struct device *parent, int bus, |
669 | struct pci_ops *ops, void *sysdata, | 697 | struct pci_ops *ops, void *sysdata, |
670 | struct list_head *resources); | 698 | struct list_head *resources); |
699 | int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int busmax); | ||
700 | int pci_bus_update_busn_res_end(struct pci_bus *b, int busmax); | ||
701 | void pci_bus_release_busn_res(struct pci_bus *b); | ||
671 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, | 702 | struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus, |
672 | struct pci_ops *ops, void *sysdata, | 703 | struct pci_ops *ops, void *sysdata, |
673 | struct list_head *resources); | 704 | struct list_head *resources); |
@@ -714,8 +745,6 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); | |||
714 | int pci_find_capability(struct pci_dev *dev, int cap); | 745 | int pci_find_capability(struct pci_dev *dev, int cap); |
715 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); | 746 | int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); |
716 | int pci_find_ext_capability(struct pci_dev *dev, int cap); | 747 | int pci_find_ext_capability(struct pci_dev *dev, int cap); |
717 | int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn, | ||
718 | int cap); | ||
719 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); | 748 | int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); |
720 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); | 749 | int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); |
721 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); | 750 | struct pci_bus *pci_find_next_bus(const struct pci_bus *from); |
@@ -777,6 +806,14 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, | |||
777 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); | 806 | return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); |
778 | } | 807 | } |
779 | 808 | ||
809 | /* user-space driven config access */ | ||
810 | int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | ||
811 | int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); | ||
812 | int pci_user_read_config_dword(struct pci_dev *dev, int where, u32 *val); | ||
813 | int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val); | ||
814 | int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); | ||
815 | int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); | ||
816 | |||
780 | int __must_check pci_enable_device(struct pci_dev *dev); | 817 | int __must_check pci_enable_device(struct pci_dev *dev); |
781 | int __must_check pci_enable_device_io(struct pci_dev *dev); | 818 | int __must_check pci_enable_device_io(struct pci_dev *dev); |
782 | int __must_check pci_enable_device_mem(struct pci_dev *dev); | 819 | int __must_check pci_enable_device_mem(struct pci_dev *dev); |
@@ -875,7 +912,6 @@ enum pci_obff_signal_type { | |||
875 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); | 912 | int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); |
876 | void pci_disable_obff(struct pci_dev *dev); | 913 | void pci_disable_obff(struct pci_dev *dev); |
877 | 914 | ||
878 | bool pci_ltr_supported(struct pci_dev *dev); | ||
879 | int pci_enable_ltr(struct pci_dev *dev); | 915 | int pci_enable_ltr(struct pci_dev *dev); |
880 | void pci_disable_ltr(struct pci_dev *dev); | 916 | void pci_disable_ltr(struct pci_dev *dev); |
881 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); | 917 | int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); |
@@ -1332,6 +1368,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1332 | static inline int pci_domain_nr(struct pci_bus *bus) | 1368 | static inline int pci_domain_nr(struct pci_bus *bus) |
1333 | { return 0; } | 1369 | { return 0; } |
1334 | 1370 | ||
1371 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) | ||
1372 | { return NULL; } | ||
1373 | |||
1335 | #define dev_is_pci(d) (false) | 1374 | #define dev_is_pci(d) (false) |
1336 | #define dev_is_pf(d) (false) | 1375 | #define dev_is_pf(d) (false) |
1337 | #define dev_num_vf(d) (0) | 1376 | #define dev_num_vf(d) (0) |
@@ -1486,9 +1525,20 @@ enum pci_fixup_pass { | |||
1486 | 1525 | ||
1487 | #ifdef CONFIG_PCI_QUIRKS | 1526 | #ifdef CONFIG_PCI_QUIRKS |
1488 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); | 1527 | void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); |
1528 | struct pci_dev *pci_get_dma_source(struct pci_dev *dev); | ||
1529 | int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); | ||
1489 | #else | 1530 | #else |
1490 | static inline void pci_fixup_device(enum pci_fixup_pass pass, | 1531 | static inline void pci_fixup_device(enum pci_fixup_pass pass, |
1491 | struct pci_dev *dev) {} | 1532 | struct pci_dev *dev) {} |
1533 | static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev) | ||
1534 | { | ||
1535 | return pci_dev_get(dev); | ||
1536 | } | ||
1537 | static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, | ||
1538 | u16 acs_flags) | ||
1539 | { | ||
1540 | return -ENOTTY; | ||
1541 | } | ||
1492 | #endif | 1542 | #endif |
1493 | 1543 | ||
1494 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); | 1544 | void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); |
@@ -1591,7 +1641,9 @@ static inline bool pci_is_pcie(struct pci_dev *dev) | |||
1591 | } | 1641 | } |
1592 | 1642 | ||
1593 | void pci_request_acs(void); | 1643 | void pci_request_acs(void); |
1594 | 1644 | bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); | |
1645 | bool pci_acs_path_enabled(struct pci_dev *start, | ||
1646 | struct pci_dev *end, u16 acs_flags); | ||
1595 | 1647 | ||
1596 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ | 1648 | #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ |
1597 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) | 1649 | #define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 4b608f543412..80e8605b5f93 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -26,6 +26,7 @@ | |||
26 | * Under PCI, each device has 256 bytes of configuration address space, | 26 | * Under PCI, each device has 256 bytes of configuration address space, |
27 | * of which the first 64 bytes are standardized as follows: | 27 | * of which the first 64 bytes are standardized as follows: |
28 | */ | 28 | */ |
29 | #define PCI_STD_HEADER_SIZEOF 64 | ||
29 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ | 30 | #define PCI_VENDOR_ID 0x00 /* 16 bits */ |
30 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ | 31 | #define PCI_DEVICE_ID 0x02 /* 16 bits */ |
31 | #define PCI_COMMAND 0x04 /* 16 bits */ | 32 | #define PCI_COMMAND 0x04 /* 16 bits */ |
@@ -209,9 +210,12 @@ | |||
209 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ | 210 | #define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ |
210 | #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ | 211 | #define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ |
211 | #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ | 212 | #define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ |
213 | #define PCI_CAP_ID_SECDEV 0x0F /* Secure Device */ | ||
212 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ | 214 | #define PCI_CAP_ID_EXP 0x10 /* PCI Express */ |
213 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ | 215 | #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ |
216 | #define PCI_CAP_ID_SATA 0x12 /* SATA Data/Index Conf. */ | ||
214 | #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ | 217 | #define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */ |
218 | #define PCI_CAP_ID_MAX PCI_CAP_ID_AF | ||
215 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ | 219 | #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ |
216 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ | 220 | #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ |
217 | #define PCI_CAP_SIZEOF 4 | 221 | #define PCI_CAP_SIZEOF 4 |
@@ -276,6 +280,7 @@ | |||
276 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ | 280 | #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ |
277 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ | 281 | #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ |
278 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ | 282 | #define PCI_VPD_DATA 4 /* 32-bits of data returned here */ |
283 | #define PCI_CAP_VPD_SIZEOF 8 | ||
279 | 284 | ||
280 | /* Slot Identification */ | 285 | /* Slot Identification */ |
281 | 286 | ||
@@ -297,8 +302,10 @@ | |||
297 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ | 302 | #define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ |
298 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ | 303 | #define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ |
299 | #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ | 304 | #define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */ |
305 | #define PCI_MSI_PENDING_32 16 /* Pending intrs for 32-bit devices */ | ||
300 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ | 306 | #define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ |
301 | #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ | 307 | #define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */ |
308 | #define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */ | ||
302 | 309 | ||
303 | /* MSI-X registers */ | 310 | /* MSI-X registers */ |
304 | #define PCI_MSIX_FLAGS 2 | 311 | #define PCI_MSIX_FLAGS 2 |
@@ -308,6 +315,7 @@ | |||
308 | #define PCI_MSIX_TABLE 4 | 315 | #define PCI_MSIX_TABLE 4 |
309 | #define PCI_MSIX_PBA 8 | 316 | #define PCI_MSIX_PBA 8 |
310 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | 317 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) |
318 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ | ||
311 | 319 | ||
312 | /* MSI-X entry's format */ | 320 | /* MSI-X entry's format */ |
313 | #define PCI_MSIX_ENTRY_SIZE 16 | 321 | #define PCI_MSIX_ENTRY_SIZE 16 |
@@ -338,6 +346,7 @@ | |||
338 | #define PCI_AF_CTRL_FLR 0x01 | 346 | #define PCI_AF_CTRL_FLR 0x01 |
339 | #define PCI_AF_STATUS 5 | 347 | #define PCI_AF_STATUS 5 |
340 | #define PCI_AF_STATUS_TP 0x01 | 348 | #define PCI_AF_STATUS_TP 0x01 |
349 | #define PCI_CAP_AF_SIZEOF 6 /* size of AF registers */ | ||
341 | 350 | ||
342 | /* PCI-X registers */ | 351 | /* PCI-X registers */ |
343 | 352 | ||
@@ -374,6 +383,10 @@ | |||
374 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ | 383 | #define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ |
375 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ | 384 | #define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ |
376 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ | 385 | #define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ |
386 | #define PCI_X_ECC_CSR 8 /* ECC control and status */ | ||
387 | #define PCI_CAP_PCIX_SIZEOF_V0 8 /* size of registers for Version 0 */ | ||
388 | #define PCI_CAP_PCIX_SIZEOF_V1 24 /* size for Version 1 */ | ||
389 | #define PCI_CAP_PCIX_SIZEOF_V2 PCI_CAP_PCIX_SIZEOF_V1 /* Same for v2 */ | ||
377 | 390 | ||
378 | /* PCI Bridge Subsystem ID registers */ | 391 | /* PCI Bridge Subsystem ID registers */ |
379 | 392 | ||
@@ -462,6 +475,7 @@ | |||
462 | #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ | 475 | #define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ |
463 | #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ | 476 | #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */ |
464 | #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ | 477 | #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */ |
478 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V1 20 /* v1 endpoints end here */ | ||
465 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ | 479 | #define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ |
466 | #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ | 480 | #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */ |
467 | #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ | 481 | #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */ |
@@ -507,6 +521,12 @@ | |||
507 | #define PCI_EXP_RTSTA 32 /* Root Status */ | 521 | #define PCI_EXP_RTSTA 32 /* Root Status */ |
508 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ | 522 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ |
509 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ | 523 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ |
524 | /* | ||
525 | * Note that the following PCI Express 'Capability Structure' registers | ||
526 | * were introduced with 'Capability Version' 0x2 (v2). These registers | ||
527 | * do not exist on devices with Capability Version 1. Use pci_pcie_cap2() | ||
528 | * to use these fields safely. | ||
529 | */ | ||
510 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ | 530 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ |
511 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ | 531 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ |
512 | #define PCI_EXP_DEVCAP2_LTR 0x800 /* Latency tolerance reporting */ | 532 | #define PCI_EXP_DEVCAP2_LTR 0x800 /* Latency tolerance reporting */ |
@@ -521,6 +541,7 @@ | |||
521 | #define PCI_EXP_OBFF_MSGA_EN 0x2000 /* OBFF enable with Message type A */ | 541 | #define PCI_EXP_OBFF_MSGA_EN 0x2000 /* OBFF enable with Message type A */ |
522 | #define PCI_EXP_OBFF_MSGB_EN 0x4000 /* OBFF enable with Message type B */ | 542 | #define PCI_EXP_OBFF_MSGB_EN 0x4000 /* OBFF enable with Message type B */ |
523 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ | 543 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ |
544 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */ | ||
524 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | 545 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ |
525 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ | 546 | #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ |
526 | 547 | ||
@@ -529,23 +550,43 @@ | |||
529 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) | 550 | #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) |
530 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) | 551 | #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) |
531 | 552 | ||
532 | #define PCI_EXT_CAP_ID_ERR 1 | 553 | #define PCI_EXT_CAP_ID_ERR 0x01 /* Advanced Error Reporting */ |
533 | #define PCI_EXT_CAP_ID_VC 2 | 554 | #define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel Capability */ |
534 | #define PCI_EXT_CAP_ID_DSN 3 | 555 | #define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ |
535 | #define PCI_EXT_CAP_ID_PWR 4 | 556 | #define PCI_EXT_CAP_ID_PWR 0x04 /* Power Budgeting */ |
536 | #define PCI_EXT_CAP_ID_VNDR 11 | 557 | #define PCI_EXT_CAP_ID_RCLD 0x05 /* Root Complex Link Declaration */ |
537 | #define PCI_EXT_CAP_ID_ACS 13 | 558 | #define PCI_EXT_CAP_ID_RCILC 0x06 /* Root Complex Internal Link Control */ |
538 | #define PCI_EXT_CAP_ID_ARI 14 | 559 | #define PCI_EXT_CAP_ID_RCEC 0x07 /* Root Complex Event Collector */ |
539 | #define PCI_EXT_CAP_ID_ATS 15 | 560 | #define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function VC Capability */ |
540 | #define PCI_EXT_CAP_ID_SRIOV 16 | 561 | #define PCI_EXT_CAP_ID_VC9 0x09 /* same as _VC */ |
541 | #define PCI_EXT_CAP_ID_PRI 19 | 562 | #define PCI_EXT_CAP_ID_RCRB 0x0A /* Root Complex RB? */ |
542 | #define PCI_EXT_CAP_ID_LTR 24 | 563 | #define PCI_EXT_CAP_ID_VNDR 0x0B /* Vendor Specific */ |
543 | #define PCI_EXT_CAP_ID_PASID 27 | 564 | #define PCI_EXT_CAP_ID_CAC 0x0C /* Config Access - obsolete */ |
565 | #define PCI_EXT_CAP_ID_ACS 0x0D /* Access Control Services */ | ||
566 | #define PCI_EXT_CAP_ID_ARI 0x0E /* Alternate Routing ID */ | ||
567 | #define PCI_EXT_CAP_ID_ATS 0x0F /* Address Translation Services */ | ||
568 | #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ | ||
569 | #define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi Root I/O Virtualization */ | ||
570 | #define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ | ||
571 | #define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ | ||
572 | #define PCI_EXT_CAP_ID_AMD_XXX 0x14 /* reserved for AMD */ | ||
573 | #define PCI_EXT_CAP_ID_REBAR 0x15 /* resizable BAR */ | ||
574 | #define PCI_EXT_CAP_ID_DPA 0x16 /* dynamic power alloc */ | ||
575 | #define PCI_EXT_CAP_ID_TPH 0x17 /* TPH request */ | ||
576 | #define PCI_EXT_CAP_ID_LTR 0x18 /* latency tolerance reporting */ | ||
577 | #define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCIe */ | ||
578 | #define PCI_EXT_CAP_ID_PMUX 0x1A /* Protocol Multiplexing */ | ||
579 | #define PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */ | ||
580 | #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PASID | ||
581 | |||
582 | #define PCI_EXT_CAP_DSN_SIZEOF 12 | ||
583 | #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40 | ||
544 | 584 | ||
545 | /* Advanced Error Reporting */ | 585 | /* Advanced Error Reporting */ |
546 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ | 586 | #define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ |
547 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ | 587 | #define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ |
548 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ | 588 | #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ |
589 | #define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */ | ||
549 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ | 590 | #define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ |
550 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ | 591 | #define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ |
551 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ | 592 | #define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ |
@@ -555,6 +596,11 @@ | |||
555 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ | 596 | #define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ |
556 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ | 597 | #define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ |
557 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ | 598 | #define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ |
599 | #define PCI_ERR_UNC_ACSV 0x00200000 /* ACS Violation */ | ||
600 | #define PCI_ERR_UNC_INTN 0x00400000 /* internal error */ | ||
601 | #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */ | ||
602 | #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */ | ||
603 | #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */ | ||
558 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ | 604 | #define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ |
559 | /* Same bits as above */ | 605 | /* Same bits as above */ |
560 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ | 606 | #define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ |
@@ -565,6 +611,9 @@ | |||
565 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ | 611 | #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ |
566 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ | 612 | #define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ |
567 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ | 613 | #define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ |
614 | #define PCI_ERR_COR_ADV_NFAT 0x00002000 /* Advisory Non-Fatal */ | ||
615 | #define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal */ | ||
616 | #define PCI_ERR_COR_LOG_OVER 0x00008000 /* Header Log Overflow */ | ||
568 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ | 617 | #define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ |
569 | /* Same bits as above */ | 618 | /* Same bits as above */ |
570 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ | 619 | #define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ |
@@ -596,12 +645,18 @@ | |||
596 | 645 | ||
597 | /* Virtual Channel */ | 646 | /* Virtual Channel */ |
598 | #define PCI_VC_PORT_REG1 4 | 647 | #define PCI_VC_PORT_REG1 4 |
648 | #define PCI_VC_REG1_EVCC 0x7 /* extended vc count */ | ||
599 | #define PCI_VC_PORT_REG2 8 | 649 | #define PCI_VC_PORT_REG2 8 |
650 | #define PCI_VC_REG2_32_PHASE 0x2 | ||
651 | #define PCI_VC_REG2_64_PHASE 0x4 | ||
652 | #define PCI_VC_REG2_128_PHASE 0x8 | ||
600 | #define PCI_VC_PORT_CTRL 12 | 653 | #define PCI_VC_PORT_CTRL 12 |
601 | #define PCI_VC_PORT_STATUS 14 | 654 | #define PCI_VC_PORT_STATUS 14 |
602 | #define PCI_VC_RES_CAP 16 | 655 | #define PCI_VC_RES_CAP 16 |
603 | #define PCI_VC_RES_CTRL 20 | 656 | #define PCI_VC_RES_CTRL 20 |
604 | #define PCI_VC_RES_STATUS 26 | 657 | #define PCI_VC_RES_STATUS 26 |
658 | #define PCI_CAP_VC_BASE_SIZEOF 0x10 | ||
659 | #define PCI_CAP_VC_PER_VC_SIZEOF 0x0C | ||
605 | 660 | ||
606 | /* Power Budgeting */ | 661 | /* Power Budgeting */ |
607 | #define PCI_PWR_DSR 4 /* Data Select Register */ | 662 | #define PCI_PWR_DSR 4 /* Data Select Register */ |
@@ -614,6 +669,7 @@ | |||
614 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ | 669 | #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ |
615 | #define PCI_PWR_CAP 12 /* Capability */ | 670 | #define PCI_PWR_CAP 12 /* Capability */ |
616 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ | 671 | #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ |
672 | #define PCI_EXT_CAP_PWR_SIZEOF 16 | ||
617 | 673 | ||
618 | /* | 674 | /* |
619 | * Hypertransport sub capability types | 675 | * Hypertransport sub capability types |
@@ -646,6 +702,8 @@ | |||
646 | #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ | 702 | #define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ |
647 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ | 703 | #define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ |
648 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ | 704 | #define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ |
705 | #define HT_CAP_SIZEOF_LONG 28 /* slave & primary */ | ||
706 | #define HT_CAP_SIZEOF_SHORT 24 /* host & secondary */ | ||
649 | 707 | ||
650 | /* Alternative Routing-ID Interpretation */ | 708 | /* Alternative Routing-ID Interpretation */ |
651 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ | 709 | #define PCI_ARI_CAP 0x04 /* ARI Capability Register */ |
@@ -656,6 +714,7 @@ | |||
656 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ | 714 | #define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */ |
657 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ | 715 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ |
658 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ | 716 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ |
717 | #define PCI_EXT_CAP_ARI_SIZEOF 8 | ||
659 | 718 | ||
660 | /* Address Translation Service */ | 719 | /* Address Translation Service */ |
661 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ | 720 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ |
@@ -665,6 +724,7 @@ | |||
665 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ | 724 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ |
666 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ | 725 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ |
667 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ | 726 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ |
727 | #define PCI_EXT_CAP_ATS_SIZEOF 8 | ||
668 | 728 | ||
669 | /* Page Request Interface */ | 729 | /* Page Request Interface */ |
670 | #define PCI_PRI_CTRL 0x04 /* PRI control register */ | 730 | #define PCI_PRI_CTRL 0x04 /* PRI control register */ |
@@ -676,6 +736,7 @@ | |||
676 | #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ | 736 | #define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */ |
677 | #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ | 737 | #define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */ |
678 | #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ | 738 | #define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */ |
739 | #define PCI_EXT_CAP_PRI_SIZEOF 16 | ||
679 | 740 | ||
680 | /* PASID capability */ | 741 | /* PASID capability */ |
681 | #define PCI_PASID_CAP 0x04 /* PASID feature register */ | 742 | #define PCI_PASID_CAP 0x04 /* PASID feature register */ |
@@ -685,6 +746,7 @@ | |||
685 | #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ | 746 | #define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */ |
686 | #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ | 747 | #define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */ |
687 | #define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ | 748 | #define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */ |
749 | #define PCI_EXT_CAP_PASID_SIZEOF 8 | ||
688 | 750 | ||
689 | /* Single Root I/O Virtualization */ | 751 | /* Single Root I/O Virtualization */ |
690 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ | 752 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ |
@@ -716,12 +778,14 @@ | |||
716 | #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ | 778 | #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */ |
717 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ | 779 | #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */ |
718 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ | 780 | #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */ |
781 | #define PCI_EXT_CAP_SRIOV_SIZEOF 64 | ||
719 | 782 | ||
720 | #define PCI_LTR_MAX_SNOOP_LAT 0x4 | 783 | #define PCI_LTR_MAX_SNOOP_LAT 0x4 |
721 | #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 | 784 | #define PCI_LTR_MAX_NOSNOOP_LAT 0x6 |
722 | #define PCI_LTR_VALUE_MASK 0x000003ff | 785 | #define PCI_LTR_VALUE_MASK 0x000003ff |
723 | #define PCI_LTR_SCALE_MASK 0x00001c00 | 786 | #define PCI_LTR_SCALE_MASK 0x00001c00 |
724 | #define PCI_LTR_SCALE_SHIFT 10 | 787 | #define PCI_LTR_SCALE_SHIFT 10 |
788 | #define PCI_EXT_CAP_LTR_SIZEOF 8 | ||
725 | 789 | ||
726 | /* Access Control Service */ | 790 | /* Access Control Service */ |
727 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ | 791 | #define PCI_ACS_CAP 0x04 /* ACS Capability Register */ |
@@ -732,7 +796,38 @@ | |||
732 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ | 796 | #define PCI_ACS_UF 0x10 /* Upstream Forwarding */ |
733 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ | 797 | #define PCI_ACS_EC 0x20 /* P2P Egress Control */ |
734 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ | 798 | #define PCI_ACS_DT 0x40 /* Direct Translated P2P */ |
799 | #define PCI_ACS_EGRESS_BITS 0x05 /* ACS Egress Control Vector Size */ | ||
735 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ | 800 | #define PCI_ACS_CTRL 0x06 /* ACS Control Register */ |
736 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ | 801 | #define PCI_ACS_EGRESS_CTL_V 0x08 /* ACS Egress Control Vector */ |
737 | 802 | ||
803 | #define PCI_VSEC_HDR 4 /* extended cap - vendor specific */ | ||
804 | #define PCI_VSEC_HDR_LEN_SHIFT 20 /* shift for length field */ | ||
805 | |||
806 | /* sata capability */ | ||
807 | #define PCI_SATA_REGS 4 /* SATA REGs specifier */ | ||
808 | #define PCI_SATA_REGS_MASK 0xF /* location - BAR#/inline */ | ||
809 | #define PCI_SATA_REGS_INLINE 0xF /* REGS in config space */ | ||
810 | #define PCI_SATA_SIZEOF_SHORT 8 | ||
811 | #define PCI_SATA_SIZEOF_LONG 16 | ||
812 | |||
813 | /* resizable BARs */ | ||
814 | #define PCI_REBAR_CTRL 8 /* control register */ | ||
815 | #define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ | ||
816 | #define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ | ||
817 | |||
818 | /* dynamic power allocation */ | ||
819 | #define PCI_DPA_CAP 4 /* capability register */ | ||
820 | #define PCI_DPA_CAP_SUBSTATE_MASK 0x1F /* # substates - 1 */ | ||
821 | #define PCI_DPA_BASE_SIZEOF 16 /* size with 0 substates */ | ||
822 | |||
823 | /* TPH Requester */ | ||
824 | #define PCI_TPH_CAP 4 /* capability register */ | ||
825 | #define PCI_TPH_CAP_LOC_MASK 0x600 /* location mask */ | ||
826 | #define PCI_TPH_LOC_NONE 0x000 /* no location */ | ||
827 | #define PCI_TPH_LOC_CAP 0x200 /* in capability */ | ||
828 | #define PCI_TPH_LOC_MSIX 0x400 /* in MSI-X */ | ||
829 | #define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* st table mask */ | ||
830 | #define PCI_TPH_CAP_ST_SHIFT 16 /* st table shift */ | ||
831 | #define PCI_TPH_BASE_SIZEOF 12 /* size with no st table */ | ||
832 | |||
738 | #endif /* LINUX_PCI_REGS_H */ | 833 | #endif /* LINUX_PCI_REGS_H */ |
diff --git a/kernel/resource.c b/kernel/resource.c index e1d2b8ee76d5..dc8b47764443 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -722,14 +722,12 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t | |||
722 | 722 | ||
723 | write_lock(&resource_lock); | 723 | write_lock(&resource_lock); |
724 | 724 | ||
725 | if (!parent) | ||
726 | goto skip; | ||
727 | |||
725 | if ((start < parent->start) || (end > parent->end)) | 728 | if ((start < parent->start) || (end > parent->end)) |
726 | goto out; | 729 | goto out; |
727 | 730 | ||
728 | for (tmp = res->child; tmp; tmp = tmp->sibling) { | ||
729 | if ((tmp->start < start) || (tmp->end > end)) | ||
730 | goto out; | ||
731 | } | ||
732 | |||
733 | if (res->sibling && (res->sibling->start <= end)) | 731 | if (res->sibling && (res->sibling->start <= end)) |
734 | goto out; | 732 | goto out; |
735 | 733 | ||
@@ -741,6 +739,11 @@ int adjust_resource(struct resource *res, resource_size_t start, resource_size_t | |||
741 | goto out; | 739 | goto out; |
742 | } | 740 | } |
743 | 741 | ||
742 | skip: | ||
743 | for (tmp = res->child; tmp; tmp = tmp->sibling) | ||
744 | if ((tmp->start < start) || (tmp->end > end)) | ||
745 | goto out; | ||
746 | |||
744 | res->start = start; | 747 | res->start = start; |
745 | res->end = end; | 748 | res->end = end; |
746 | result = 0; | 749 | result = 0; |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0f84bb38eb0d..68e9f5ed0a6f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -865,6 +865,11 @@ static void check_section(const char *modname, struct elf_info *elf, | |||
865 | #define ALL_EXIT_TEXT_SECTIONS \ | 865 | #define ALL_EXIT_TEXT_SECTIONS \ |
866 | ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" | 866 | ".exit.text$", ".devexit.text$", ".cpuexit.text$", ".memexit.text$" |
867 | 867 | ||
868 | #define ALL_PCI_INIT_SECTIONS \ | ||
869 | ".pci_fixup_early$", ".pci_fixup_header$", ".pci_fixup_final$", \ | ||
870 | ".pci_fixup_enable$", ".pci_fixup_resume$", \ | ||
871 | ".pci_fixup_resume_early$", ".pci_fixup_suspend$" | ||
872 | |||
868 | #define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ | 873 | #define ALL_XXXINIT_SECTIONS DEV_INIT_SECTIONS, CPU_INIT_SECTIONS, \ |
869 | MEM_INIT_SECTIONS | 874 | MEM_INIT_SECTIONS |
870 | #define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ | 875 | #define ALL_XXXEXIT_SECTIONS DEV_EXIT_SECTIONS, CPU_EXIT_SECTIONS, \ |
@@ -1027,6 +1032,12 @@ const struct sectioncheck sectioncheck[] = { | |||
1027 | .mismatch = ANY_EXIT_TO_ANY_INIT, | 1032 | .mismatch = ANY_EXIT_TO_ANY_INIT, |
1028 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, | 1033 | .symbol_white_list = { DEFAULT_SYMBOL_WHITE_LIST, NULL }, |
1029 | }, | 1034 | }, |
1035 | { | ||
1036 | .fromsec = { ALL_PCI_INIT_SECTIONS, NULL }, | ||
1037 | .tosec = { INIT_SECTIONS, NULL }, | ||
1038 | .mismatch = ANY_INIT_TO_ANY_EXIT, | ||
1039 | .symbol_white_list = { NULL }, | ||
1040 | }, | ||
1030 | /* Do not export init/exit functions or data */ | 1041 | /* Do not export init/exit functions or data */ |
1031 | { | 1042 | { |
1032 | .fromsec = { "__ksymtab*", NULL }, | 1043 | .fromsec = { "__ksymtab*", NULL }, |