aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2017-09-07 14:24:19 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-09-07 14:24:19 -0400
commit9198407e23ec89f0e1562f439771aeea83345d0d (patch)
treec6a53b71b48c49d7713539eb035e7b2fcec69d2a
parentd872694bac212f76ca13fd20a85e5c1bdb53a945 (diff)
parentc775697b713b70293507573355aa8c8c177db35b (diff)
Merge branch 'pci/resource' into next
* pci/resource: microblaze/PCI: Remove pcibios_setup_bus_{self/devices} dead code ARC: Remove empty kernel/pcibios.c PCI: Add a generic weak pcibios_align_resource() PCI: Add a generic weak pcibios_fixup_bus()
-rw-r--r--arch/arc/kernel/Makefile1
-rw-r--r--arch/arc/kernel/pcibios.c22
-rw-r--r--arch/arm64/kernel/pci.c17
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c4
-rw-r--r--arch/ia64/pci/pci.c7
-rw-r--r--arch/microblaze/include/asm/pci.h3
-rw-r--r--arch/microblaze/pci/pci-common.c145
-rw-r--r--arch/s390/pci/pci.c4
-rw-r--r--arch/sh/drivers/pci/pci.c8
-rw-r--r--arch/sparc/kernel/leon_pci.c6
-rw-r--r--arch/sparc/kernel/pci.c10
-rw-r--r--arch/sparc/kernel/pcic.c6
-rw-r--r--arch/tile/kernel/pci.c18
-rw-r--r--arch/tile/kernel/pci_gx.c14
-rw-r--r--drivers/pci/probe.c9
-rw-r--r--drivers/pci/setup-res.c13
16 files changed, 22 insertions, 265 deletions
diff --git a/arch/arc/kernel/Makefile b/arch/arc/kernel/Makefile
index 8942c5c3b4c5..2dc5f4296d44 100644
--- a/arch/arc/kernel/Makefile
+++ b/arch/arc/kernel/Makefile
@@ -12,7 +12,6 @@ obj-y := arcksyms.o setup.o irq.o reset.o ptrace.o process.o devtree.o
12obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o 12obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o
13obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o 13obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o
14obj-$(CONFIG_ISA_ARCV2) += entry-arcv2.o intc-arcv2.o 14obj-$(CONFIG_ISA_ARCV2) += entry-arcv2.o intc-arcv2.o
15obj-$(CONFIG_PCI) += pcibios.o
16 15
17obj-$(CONFIG_MODULES) += arcksyms.o module.o 16obj-$(CONFIG_MODULES) += arcksyms.o module.o
18obj-$(CONFIG_SMP) += smp.o 17obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/arc/kernel/pcibios.c b/arch/arc/kernel/pcibios.c
deleted file mode 100644
index 72e1d73d0bd6..000000000000
--- a/arch/arc/kernel/pcibios.c
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2014-2015 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/pci.h>
10
11/*
12 * We don't have to worry about legacy ISA devices, so nothing to do here
13 */
14resource_size_t pcibios_align_resource(void *data, const struct resource *res,
15 resource_size_t size, resource_size_t align)
16{
17 return res->start;
18}
19
20void pcibios_fixup_bus(struct pci_bus *bus)
21{
22}
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index e2b7e4f9cc31..0e2ea1c78542 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -22,23 +22,6 @@
22#include <linux/pci-ecam.h> 22#include <linux/pci-ecam.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24 24
25/*
26 * Called after each bus is probed, but before its children are examined
27 */
28void pcibios_fixup_bus(struct pci_bus *bus)
29{
30 /* nothing to do, expected to be removed in the future */
31}
32
33/*
34 * We don't have to worry about legacy ISA devices, so nothing to do here
35 */
36resource_size_t pcibios_align_resource(void *data, const struct resource *res,
37 resource_size_t size, resource_size_t align)
38{
39 return res->start;
40}
41
42#ifdef CONFIG_ACPI 25#ifdef CONFIG_ACPI
43/* 26/*
44 * Try to assign the IRQ number when probing a new device 27 * Try to assign the IRQ number when probing a new device
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index 394c2a73d5e2..5cc622c0225e 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -2,10 +2,6 @@
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <hwregs/intr_vect.h> 3#include <hwregs/intr_vect.h>
4 4
5void pcibios_fixup_bus(struct pci_bus *b)
6{
7}
8
9void pcibios_set_master(struct pci_dev *dev) 5void pcibios_set_master(struct pci_dev *dev)
10{ 6{
11 u8 lat; 7 u8 lat;
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 4068bde623dc..f5ec736100ee 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -411,13 +411,6 @@ pcibios_disable_device (struct pci_dev *dev)
411 acpi_pci_irq_disable(dev); 411 acpi_pci_irq_disable(dev);
412} 412}
413 413
414resource_size_t
415pcibios_align_resource (void *data, const struct resource *res,
416 resource_size_t size, resource_size_t align)
417{
418 return res->start;
419}
420
421/** 414/**
422 * ia64_pci_get_legacy_mem - generic legacy mem routine 415 * ia64_pci_get_legacy_mem - generic legacy mem routine
423 * @bus: bus to get legacy memory base address for 416 * @bus: bus to get legacy memory base address for
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index efd4983cb697..114b93488193 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -81,9 +81,6 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
81 81
82#define HAVE_ARCH_PCI_RESOURCE_TO_USER 82#define HAVE_ARCH_PCI_RESOURCE_TO_USER
83 83
84extern void pcibios_setup_bus_devices(struct pci_bus *bus);
85extern void pcibios_setup_bus_self(struct pci_bus *bus);
86
87/* This part of code was originally in xilinx-pci.h */ 84/* This part of code was originally in xilinx-pci.h */
88#ifdef CONFIG_PCI_XILINX 85#ifdef CONFIG_PCI_XILINX
89extern void __init xilinx_pci_init(void); 86extern void __init xilinx_pci_init(void);
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 404fb38d06b7..2b32c454a22e 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -678,144 +678,6 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
678} 678}
679DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); 679DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
680 680
681/* This function tries to figure out if a bridge resource has been initialized
682 * by the firmware or not. It doesn't have to be absolutely bullet proof, but
683 * things go more smoothly when it gets it right. It should covers cases such
684 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges
685 */
686static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
687 struct resource *res)
688{
689 struct pci_controller *hose = pci_bus_to_host(bus);
690 struct pci_dev *dev = bus->self;
691 resource_size_t offset;
692 u16 command;
693 int i;
694
695 /* Job is a bit different between memory and IO */
696 if (res->flags & IORESOURCE_MEM) {
697 /* If the BAR is non-0 (res != pci_mem_offset) then it's
698 * probably been initialized by somebody
699 */
700 if (res->start != hose->pci_mem_offset)
701 return 0;
702
703 /* The BAR is 0, let's check if memory decoding is enabled on
704 * the bridge. If not, we consider it unassigned
705 */
706 pci_read_config_word(dev, PCI_COMMAND, &command);
707 if ((command & PCI_COMMAND_MEMORY) == 0)
708 return 1;
709
710 /* Memory decoding is enabled and the BAR is 0. If any of
711 * the bridge resources covers that starting address (0 then
712 * it's good enough for us for memory
713 */
714 for (i = 0; i < 3; i++) {
715 if ((hose->mem_resources[i].flags & IORESOURCE_MEM) &&
716 hose->mem_resources[i].start == hose->pci_mem_offset)
717 return 0;
718 }
719
720 /* Well, it starts at 0 and we know it will collide so we may as
721 * well consider it as unassigned. That covers the Apple case.
722 */
723 return 1;
724 } else {
725 /* If the BAR is non-0, then we consider it assigned */
726 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
727 if (((res->start - offset) & 0xfffffffful) != 0)
728 return 0;
729
730 /* Here, we are a bit different than memory as typically IO
731 * space starting at low addresses -is- valid. What we do
732 * instead if that we consider as unassigned anything that
733 * doesn't have IO enabled in the PCI command register,
734 * and that's it.
735 */
736 pci_read_config_word(dev, PCI_COMMAND, &command);
737 if (command & PCI_COMMAND_IO)
738 return 0;
739
740 /* It's starting at 0 and IO is disabled in the bridge, consider
741 * it unassigned
742 */
743 return 1;
744 }
745}
746
747/* Fixup resources of a PCI<->PCI bridge */
748static void pcibios_fixup_bridge(struct pci_bus *bus)
749{
750 struct resource *res;
751 int i;
752
753 struct pci_dev *dev = bus->self;
754
755 pci_bus_for_each_resource(bus, res, i) {
756 if (!res)
757 continue;
758 if (!res->flags)
759 continue;
760 if (i >= 3 && bus->self->transparent)
761 continue;
762
763 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n",
764 pci_name(dev), i,
765 (unsigned long long)res->start,
766 (unsigned long long)res->end,
767 (unsigned int)res->flags);
768
769 /* Try to detect uninitialized P2P bridge resources,
770 * and clear them out so they get re-assigned later
771 */
772 if (pcibios_uninitialized_bridge_resource(bus, res)) {
773 res->flags = 0;
774 pr_debug("PCI:%s (unassigned)\n",
775 pci_name(dev));
776 } else {
777 pr_debug("PCI:%s %016llx-%016llx\n",
778 pci_name(dev),
779 (unsigned long long)res->start,
780 (unsigned long long)res->end);
781 }
782 }
783}
784
785void pcibios_setup_bus_self(struct pci_bus *bus)
786{
787 /* Fix up the bus resources for P2P bridges */
788 if (bus->self != NULL)
789 pcibios_fixup_bridge(bus);
790}
791
792void pcibios_setup_bus_devices(struct pci_bus *bus)
793{
794 struct pci_dev *dev;
795
796 pr_debug("PCI: Fixup bus devices %d (%s)\n",
797 bus->number, bus->self ? pci_name(bus->self) : "PHB");
798
799 list_for_each_entry(dev, &bus->devices, bus_list) {
800 /* Setup OF node pointer in archdata */
801 dev->dev.of_node = pci_device_to_OF_node(dev);
802
803 /* Fixup NUMA node as it may not be setup yet by the generic
804 * code and is needed by the DMA init
805 */
806 set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
807
808 /* Read default IRQs and fixup if necessary */
809 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
810 }
811}
812
813void pcibios_fixup_bus(struct pci_bus *bus)
814{
815 /* nothing to do */
816}
817EXPORT_SYMBOL(pcibios_fixup_bus);
818
819/* 681/*
820 * We need to avoid collisions with `mirrored' VGA ports 682 * We need to avoid collisions with `mirrored' VGA ports
821 * and other strange ISA hardware, so we always want the 683 * and other strange ISA hardware, so we always want the
@@ -829,13 +691,6 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
829 * but we want to try to avoid allocating at 0x2900-0x2bff 691 * but we want to try to avoid allocating at 0x2900-0x2bff
830 * which might have be mirrored at 0x0100-0x03ff.. 692 * which might have be mirrored at 0x0100-0x03ff..
831 */ 693 */
832resource_size_t pcibios_align_resource(void *data, const struct resource *res,
833 resource_size_t size, resource_size_t align)
834{
835 return res->start;
836}
837EXPORT_SYMBOL(pcibios_align_resource);
838
839int pcibios_add_device(struct pci_dev *dev) 694int pcibios_add_device(struct pci_dev *dev)
840{ 695{
841 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); 696 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 7b30af5da222..ddb9923fb45d 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -262,10 +262,6 @@ static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len)
262 return rc; 262 return rc;
263} 263}
264 264
265void pcibios_fixup_bus(struct pci_bus *bus)
266{
267}
268
269resource_size_t pcibios_align_resource(void *data, const struct resource *res, 265resource_size_t pcibios_align_resource(void *data, const struct resource *res,
270 resource_size_t size, 266 resource_size_t size,
271 resource_size_t align) 267 resource_size_t align)
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 357278c88e98..5976a2c8a3e3 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -164,14 +164,6 @@ static int __init pcibios_init(void)
164subsys_initcall(pcibios_init); 164subsys_initcall(pcibios_init);
165 165
166/* 166/*
167 * Called after each bus is probed, but before its children
168 * are examined.
169 */
170void pcibios_fixup_bus(struct pci_bus *bus)
171{
172}
173
174/*
175 * We need to avoid collisions with `mirrored' VGA ports 167 * We need to avoid collisions with `mirrored' VGA ports
176 * and other strange ISA hardware, so we always want the 168 * and other strange ISA hardware, so we always want the
177 * addresses to be allocated in the 0x000-0x0ff region 169 * addresses to be allocated in the 0x000-0x0ff region
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 7b5c7072b006..98c223edac84 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -106,9 +106,3 @@ void pcibios_fixup_bus(struct pci_bus *pbus)
106 } 106 }
107 } 107 }
108} 108}
109
110resource_size_t pcibios_align_resource(void *data, const struct resource *res,
111 resource_size_t size, resource_size_t align)
112{
113 return res->start;
114}
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 7eceaa10836f..3f8670c92951 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -690,16 +690,6 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
690 return bus; 690 return bus;
691} 691}
692 692
693void pcibios_fixup_bus(struct pci_bus *pbus)
694{
695}
696
697resource_size_t pcibios_align_resource(void *data, const struct resource *res,
698 resource_size_t size, resource_size_t align)
699{
700 return res->start;
701}
702
703int pcibios_enable_device(struct pci_dev *dev, int mask) 693int pcibios_enable_device(struct pci_dev *dev, int mask)
704{ 694{
705 u16 cmd, oldcmd; 695 u16 cmd, oldcmd;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index a38787b84322..e038e343f2c1 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -746,12 +746,6 @@ static void watchdog_reset() {
746} 746}
747#endif 747#endif
748 748
749resource_size_t pcibios_align_resource(void *data, const struct resource *res,
750 resource_size_t size, resource_size_t align)
751{
752 return res->start;
753}
754
755int pcibios_enable_device(struct pci_dev *pdev, int mask) 749int pcibios_enable_device(struct pci_dev *pdev, int mask)
756{ 750{
757 return 0; 751 return 0;
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index 884826157765..bbf81579b1f8 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -67,16 +67,6 @@ static struct pci_ops tile_cfg_ops;
67 67
68 68
69/* 69/*
70 * We don't need to worry about the alignment of resources.
71 */
72resource_size_t pcibios_align_resource(void *data, const struct resource *res,
73 resource_size_t size, resource_size_t align)
74{
75 return res->start;
76}
77EXPORT_SYMBOL(pcibios_align_resource);
78
79/*
80 * Open a FD to the hypervisor PCI device. 70 * Open a FD to the hypervisor PCI device.
81 * 71 *
82 * controller_id is the controller number, config type is 0 or 1 for 72 * controller_id is the controller number, config type is 0 or 1 for
@@ -380,14 +370,6 @@ int __init pcibios_init(void)
380} 370}
381subsys_initcall(pcibios_init); 371subsys_initcall(pcibios_init);
382 372
383/*
384 * No bus fixups needed.
385 */
386void pcibios_fixup_bus(struct pci_bus *bus)
387{
388 /* Nothing needs to be done. */
389}
390
391void pcibios_set_master(struct pci_dev *dev) 373void pcibios_set_master(struct pci_dev *dev)
392{ 374{
393 /* No special bus mastering setup handling. */ 375 /* No special bus mastering setup handling. */
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index e68317083ac7..9aa238ac7b35 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -108,15 +108,6 @@ static struct pci_ops tile_cfg_ops;
108/* Mask of CPUs that should receive PCIe interrupts. */ 108/* Mask of CPUs that should receive PCIe interrupts. */
109static struct cpumask intr_cpus_map; 109static struct cpumask intr_cpus_map;
110 110
111/* We don't need to worry about the alignment of resources. */
112resource_size_t pcibios_align_resource(void *data, const struct resource *res,
113 resource_size_t size,
114 resource_size_t align)
115{
116 return res->start;
117}
118EXPORT_SYMBOL(pcibios_align_resource);
119
120/* 111/*
121 * Pick a CPU to receive and handle the PCIe interrupts, based on the IRQ #. 112 * Pick a CPU to receive and handle the PCIe interrupts, based on the IRQ #.
122 * For now, we simply send interrupts to non-dataplane CPUs. 113 * For now, we simply send interrupts to non-dataplane CPUs.
@@ -1049,11 +1040,6 @@ alloc_mem_map_failed:
1049} 1040}
1050subsys_initcall(pcibios_init); 1041subsys_initcall(pcibios_init);
1051 1042
1052/* No bus fixups needed. */
1053void pcibios_fixup_bus(struct pci_bus *bus)
1054{
1055}
1056
1057/* Process any "pci=" kernel boot arguments. */ 1043/* Process any "pci=" kernel boot arguments. */
1058char *__init pcibios_setup(char *str) 1044char *__init pcibios_setup(char *str)
1059{ 1045{
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 9b8a445b9294..e03f95bd1b59 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2344,6 +2344,15 @@ void pcie_bus_configure_settings(struct pci_bus *bus)
2344} 2344}
2345EXPORT_SYMBOL_GPL(pcie_bus_configure_settings); 2345EXPORT_SYMBOL_GPL(pcie_bus_configure_settings);
2346 2346
2347/*
2348 * Called after each bus is probed, but before its children are examined. This
2349 * is marked as __weak because multiple architectures define it.
2350 */
2351void __weak pcibios_fixup_bus(struct pci_bus *bus)
2352{
2353 /* nothing to do, expected to be removed in the future */
2354}
2355
2347unsigned int pci_scan_child_bus(struct pci_bus *bus) 2356unsigned int pci_scan_child_bus(struct pci_bus *bus)
2348{ 2357{
2349 unsigned int devfn, pass, max = bus->busn_res.start; 2358 unsigned int devfn, pass, max = bus->busn_res.start;
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 85774b7a316a..e576e1a8d978 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -234,6 +234,19 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
234 return 0; 234 return 0;
235} 235}
236 236
237/*
238 * We don't have to worry about legacy ISA devices, so nothing to do here.
239 * This is marked as __weak because multiple architectures define it; it should
240 * eventually go away.
241 */
242resource_size_t __weak pcibios_align_resource(void *data,
243 const struct resource *res,
244 resource_size_t size,
245 resource_size_t align)
246{
247 return res->start;
248}
249
237static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, 250static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
238 int resno, resource_size_t size, resource_size_t align) 251 int resno, resource_size_t size, resource_size_t align)
239{ 252{