aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-10-31 16:12:40 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-10-31 16:12:40 -0400
commit33de1b8bf6e11a3bc69faf2f7ffb3692c723bdf5 (patch)
tree5e92465442ad3166ba1c9bd423c20d67b018d1e0
parentcc17a67c0762a6030b43e98d775a12a99e5ff247 (diff)
parent0394cb192db4397753046775a8caa736397737b5 (diff)
Merge branch 'pci/misc' into next
* pci/misc: PCI: Report pci_pme_active() kmalloc failure mn10300/PCI: Remove useless pcibios_last_bus frv/PCI: Remove pcibios_last_bus PCI: Fail MSI/MSI-X initialization if device is not in PCI_D0 x86/PCI: Coalesce multiple overlapping host bridge windows MAINTAINERS: Add arch/x86/pci to PCI file patterns PCI/PM: Remove pci_pm_complete() PCI: Add pci_dev_show_local_cpu() to simplify code mn10300/PCI: Remove unused pci_mem_start cris/PCI: Remove unused pci_mem_start PCI: Make pci_dev_pm_ops static Conflicts: drivers/pci/pci-sysfs.c
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/cris/include/asm/pci.h1
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.h1
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c36
-rw-r--r--arch/mn10300/include/asm/pci.h1
-rw-r--r--arch/mn10300/kernel/setup.c3
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.h1
-rw-r--r--arch/mn10300/unit-asb2305/pci.c5
-rw-r--r--arch/x86/pci/acpi.c8
-rw-r--r--drivers/pci/msi.c6
-rw-r--r--drivers/pci/pci-driver.c11
-rw-r--r--drivers/pci/pci-sysfs.c33
-rw-r--r--drivers/pci/pci.c7
13 files changed, 29 insertions, 85 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index bc6d82162ebe..906d440f1afe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6338,6 +6338,7 @@ S: Supported
6338F: Documentation/PCI/ 6338F: Documentation/PCI/
6339F: drivers/pci/ 6339F: drivers/pci/
6340F: include/linux/pci* 6340F: include/linux/pci*
6341F: arch/x86/pci/
6341 6342
6342PCI DRIVER FOR NVIDIA TEGRA 6343PCI DRIVER FOR NVIDIA TEGRA
6343M: Thierry Reding <thierry.reding@gmail.com> 6344M: Thierry Reding <thierry.reding@gmail.com>
diff --git a/arch/cris/include/asm/pci.h b/arch/cris/include/asm/pci.h
index 146da904cdd8..f666734926d5 100644
--- a/arch/cris/include/asm/pci.h
+++ b/arch/cris/include/asm/pci.h
@@ -11,7 +11,6 @@
11 11
12#define pcibios_assign_all_busses(void) 1 12#define pcibios_assign_all_busses(void) 1
13 13
14extern unsigned long pci_mem_start;
15#define PCIBIOS_MIN_IO 0x1000 14#define PCIBIOS_MIN_IO 0x1000
16#define PCIBIOS_MIN_MEM 0x10000000 15#define PCIBIOS_MIN_MEM 0x10000000
17 16
diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h
index 76c4e73d643d..a7e487fe76ed 100644
--- a/arch/frv/mb93090-mb00/pci-frv.h
+++ b/arch/frv/mb93090-mb00/pci-frv.h
@@ -30,7 +30,6 @@ void pcibios_resource_survey(void);
30 30
31/* pci-vdk.c */ 31/* pci-vdk.c */
32 32
33extern int __nongpreldata pcibios_last_bus;
34extern struct pci_ops *__nongpreldata pci_root_ops; 33extern struct pci_ops *__nongpreldata pci_root_ops;
35 34
36/* pci-irq.c */ 35/* pci-irq.c */
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index deb67843693c..efa5d65b0007 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -25,7 +25,6 @@
25 25
26unsigned int __nongpreldata pci_probe = 1; 26unsigned int __nongpreldata pci_probe = 1;
27 27
28int __nongpreldata pcibios_last_bus = -1;
29struct pci_ops *__nongpreldata pci_root_ops; 28struct pci_ops *__nongpreldata pci_root_ops;
30 29
31/* 30/*
@@ -220,37 +219,6 @@ static struct pci_ops * __init pci_check_direct(void)
220} 219}
221 220
222/* 221/*
223 * Discover remaining PCI buses in case there are peer host bridges.
224 * We use the number of last PCI bus provided by the PCI BIOS.
225 */
226static void __init pcibios_fixup_peer_bridges(void)
227{
228 struct pci_bus bus;
229 struct pci_dev dev;
230 int n;
231 u16 l;
232
233 if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
234 return;
235 printk("PCI: Peer bridge fixup\n");
236 for (n=0; n <= pcibios_last_bus; n++) {
237 if (pci_find_bus(0, n))
238 continue;
239 bus.number = n;
240 bus.ops = pci_root_ops;
241 dev.bus = &bus;
242 for(dev.devfn=0; dev.devfn<256; dev.devfn += 8)
243 if (!pci_read_config_word(&dev, PCI_VENDOR_ID, &l) &&
244 l != 0x0000 && l != 0xffff) {
245 printk("Found device at %02x:%02x [%04x]\n", n, dev.devfn, l);
246 printk("PCI: Discovered peer bus %02x\n", n);
247 pci_scan_bus(n, pci_root_ops, NULL);
248 break;
249 }
250 }
251}
252
253/*
254 * Exceptions for specific devices. Usually work-arounds for fatal design flaws. 222 * Exceptions for specific devices. Usually work-arounds for fatal design flaws.
255 */ 223 */
256 224
@@ -418,7 +386,6 @@ int __init pcibios_init(void)
418 pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); 386 pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources);
419 387
420 pcibios_irq_init(); 388 pcibios_irq_init();
421 pcibios_fixup_peer_bridges();
422 pcibios_fixup_irqs(); 389 pcibios_fixup_irqs();
423 pcibios_resource_survey(); 390 pcibios_resource_survey();
424 391
@@ -432,9 +399,6 @@ char * __init pcibios_setup(char *str)
432 if (!strcmp(str, "off")) { 399 if (!strcmp(str, "off")) {
433 pci_probe = 0; 400 pci_probe = 0;
434 return NULL; 401 return NULL;
435 } else if (!strncmp(str, "lastbus=", 8)) {
436 pcibios_last_bus = simple_strtol(str+8, NULL, 0);
437 return NULL;
438 } 402 }
439 return str; 403 return str;
440} 404}
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h
index 6f31cc0f1a87..166323824683 100644
--- a/arch/mn10300/include/asm/pci.h
+++ b/arch/mn10300/include/asm/pci.h
@@ -44,7 +44,6 @@ extern void unit_pci_init(void);
44#define pcibios_assign_all_busses() 0 44#define pcibios_assign_all_busses() 0
45#endif 45#endif
46 46
47extern unsigned long pci_mem_start;
48#define PCIBIOS_MIN_IO 0xBE000004 47#define PCIBIOS_MIN_IO 0xBE000004
49#define PCIBIOS_MIN_MEM 0xB8000000 48#define PCIBIOS_MIN_MEM 0xB8000000
50 49
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index ebac9c11f796..2ad7f32fa122 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -35,9 +35,6 @@
35 35
36struct mn10300_cpuinfo boot_cpu_data; 36struct mn10300_cpuinfo boot_cpu_data;
37 37
38/* For PCI or other memory-mapped resources */
39unsigned long pci_mem_start = 0x18000000;
40
41static char __initdata cmd_line[COMMAND_LINE_SIZE]; 38static char __initdata cmd_line[COMMAND_LINE_SIZE];
42char redboot_command_line[COMMAND_LINE_SIZE] = 39char redboot_command_line[COMMAND_LINE_SIZE] =
43 "console=ttyS0,115200 root=/dev/mtdblock3 rw"; 40 "console=ttyS0,115200 root=/dev/mtdblock3 rw";
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h
index 7fa66a0e4624..9e17aca5a2a1 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.h
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.h
@@ -35,7 +35,6 @@ extern void pcibios_resource_survey(void);
35 35
36/* pci.c */ 36/* pci.c */
37 37
38extern int pcibios_last_bus;
39extern struct pci_ops *pci_root_ops; 38extern struct pci_ops *pci_root_ops;
40 39
41extern struct irq_routing_table *pcibios_get_irq_routing_table(void); 40extern struct irq_routing_table *pcibios_get_irq_routing_table(void);
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index e37fac0461f3..6b4339f8c9c2 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -24,7 +24,6 @@
24 24
25unsigned int pci_probe = 1; 25unsigned int pci_probe = 1;
26 26
27int pcibios_last_bus = -1;
28struct pci_ops *pci_root_ops; 27struct pci_ops *pci_root_ops;
29 28
30/* 29/*
@@ -392,10 +391,6 @@ char *__init pcibios_setup(char *str)
392 if (!strcmp(str, "off")) { 391 if (!strcmp(str, "off")) {
393 pci_probe = 0; 392 pci_probe = 0;
394 return NULL; 393 return NULL;
395
396 } else if (!strncmp(str, "lastbus=", 8)) {
397 pcibios_last_bus = simple_strtol(str+8, NULL, 0);
398 return NULL;
399 } 394 }
400 395
401 return str; 396 return str;
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index b30e937689d6..7fb24e53d4c8 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -354,12 +354,12 @@ static void coalesce_windows(struct pci_root_info *info, unsigned long type)
354 * the kernel resource tree doesn't allow overlaps. 354 * the kernel resource tree doesn't allow overlaps.
355 */ 355 */
356 if (resource_overlaps(res1, res2)) { 356 if (resource_overlaps(res1, res2)) {
357 res1->start = min(res1->start, res2->start); 357 res2->start = min(res1->start, res2->start);
358 res1->end = max(res1->end, res2->end); 358 res2->end = max(res1->end, res2->end);
359 dev_info(&info->bridge->dev, 359 dev_info(&info->bridge->dev,
360 "host bridge window expanded to %pR; %pR ignored\n", 360 "host bridge window expanded to %pR; %pR ignored\n",
361 res1, res2); 361 res2, res1);
362 res2->flags = 0; 362 res1->flags = 0;
363 } 363 }
364 } 364 }
365 } 365 }
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d5f90d6383bc..604265c40853 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -831,7 +831,7 @@ int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
831 int status, maxvec; 831 int status, maxvec;
832 u16 msgctl; 832 u16 msgctl;
833 833
834 if (!dev->msi_cap) 834 if (!dev->msi_cap || dev->current_state != PCI_D0)
835 return -EINVAL; 835 return -EINVAL;
836 836
837 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); 837 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl);
@@ -862,7 +862,7 @@ int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec)
862 int ret, nvec; 862 int ret, nvec;
863 u16 msgctl; 863 u16 msgctl;
864 864
865 if (!dev->msi_cap) 865 if (!dev->msi_cap || dev->current_state != PCI_D0)
866 return -EINVAL; 866 return -EINVAL;
867 867
868 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl); 868 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl);
@@ -955,7 +955,7 @@ int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec)
955 int status, nr_entries; 955 int status, nr_entries;
956 int i, j; 956 int i, j;
957 957
958 if (!entries || !dev->msix_cap) 958 if (!entries || !dev->msix_cap || dev->current_state != PCI_D0)
959 return -EINVAL; 959 return -EINVAL;
960 960
961 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX); 961 status = pci_msi_check_device(dev, nvec, PCI_CAP_ID_MSIX);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 9f85960a62ed..840fdc5ba0d8 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -602,18 +602,10 @@ static int pci_pm_prepare(struct device *dev)
602 return error; 602 return error;
603} 603}
604 604
605static void pci_pm_complete(struct device *dev)
606{
607 struct device_driver *drv = dev->driver;
608
609 if (drv && drv->pm && drv->pm->complete)
610 drv->pm->complete(dev);
611}
612 605
613#else /* !CONFIG_PM_SLEEP */ 606#else /* !CONFIG_PM_SLEEP */
614 607
615#define pci_pm_prepare NULL 608#define pci_pm_prepare NULL
616#define pci_pm_complete NULL
617 609
618#endif /* !CONFIG_PM_SLEEP */ 610#endif /* !CONFIG_PM_SLEEP */
619 611
@@ -1124,9 +1116,8 @@ static int pci_pm_runtime_idle(struct device *dev)
1124 1116
1125#ifdef CONFIG_PM 1117#ifdef CONFIG_PM
1126 1118
1127const struct dev_pm_ops pci_dev_pm_ops = { 1119static const struct dev_pm_ops pci_dev_pm_ops = {
1128 .prepare = pci_pm_prepare, 1120 .prepare = pci_pm_prepare,
1129 .complete = pci_pm_complete,
1130 .suspend = pci_pm_suspend, 1121 .suspend = pci_pm_suspend,
1131 .resume = pci_pm_resume, 1122 .resume = pci_pm_resume,
1132 .freeze = pci_pm_freeze, 1123 .freeze = pci_pm_freeze,
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 82cc45867eaa..2aaa83c85a4e 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -76,9 +76,11 @@ static ssize_t broken_parity_status_store(struct device *dev,
76} 76}
77static DEVICE_ATTR_RW(broken_parity_status); 77static DEVICE_ATTR_RW(broken_parity_status);
78 78
79static ssize_t local_cpus_show(struct device *dev, 79static ssize_t pci_dev_show_local_cpu(struct device *dev,
80 struct device_attribute *attr, char *buf) 80 int type,
81{ 81 struct device_attribute *attr,
82 char *buf)
83{
82 const struct cpumask *mask; 84 const struct cpumask *mask;
83 int len; 85 int len;
84 86
@@ -88,29 +90,26 @@ static ssize_t local_cpus_show(struct device *dev,
88#else 90#else
89 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus); 91 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
90#endif 92#endif
91 len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); 93 len = type ?
94 cpumask_scnprintf(buf, PAGE_SIZE-2, mask) :
95 cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
96
92 buf[len++] = '\n'; 97 buf[len++] = '\n';
93 buf[len] = '\0'; 98 buf[len] = '\0';
94 return len; 99 return len;
95} 100}
101
102static ssize_t local_cpus_show(struct device *dev,
103 struct device_attribute *attr, char *buf)
104{
105 return pci_dev_show_local_cpu(dev, 1, attr, buf);
106}
96static DEVICE_ATTR_RO(local_cpus); 107static DEVICE_ATTR_RO(local_cpus);
97 108
98static ssize_t local_cpulist_show(struct device *dev, 109static ssize_t local_cpulist_show(struct device *dev,
99 struct device_attribute *attr, char *buf) 110 struct device_attribute *attr, char *buf)
100{ 111{
101 const struct cpumask *mask; 112 return pci_dev_show_local_cpu(dev, 0, attr, buf);
102 int len;
103
104#ifdef CONFIG_NUMA
105 mask = (dev_to_node(dev) == -1) ? cpu_online_mask :
106 cpumask_of_node(dev_to_node(dev));
107#else
108 mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
109#endif
110 len = cpulist_scnprintf(buf, PAGE_SIZE-2, mask);
111 buf[len++] = '\n';
112 buf[len] = '\0';
113 return len;
114} 113}
115static DEVICE_ATTR_RO(local_cpulist); 114static DEVICE_ATTR_RO(local_cpulist);
116 115
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c0805f26f339..457f801fc49d 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1638,8 +1638,10 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
1638 if (enable) { 1638 if (enable) {
1639 pme_dev = kmalloc(sizeof(struct pci_pme_device), 1639 pme_dev = kmalloc(sizeof(struct pci_pme_device),
1640 GFP_KERNEL); 1640 GFP_KERNEL);
1641 if (!pme_dev) 1641 if (!pme_dev) {
1642 goto out; 1642 dev_warn(&dev->dev, "can't enable PME#\n");
1643 return;
1644 }
1643 pme_dev->dev = dev; 1645 pme_dev->dev = dev;
1644 mutex_lock(&pci_pme_list_mutex); 1646 mutex_lock(&pci_pme_list_mutex);
1645 list_add(&pme_dev->list, &pci_pme_list); 1647 list_add(&pme_dev->list, &pci_pme_list);
@@ -1660,7 +1662,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
1660 } 1662 }
1661 } 1663 }
1662 1664
1663out:
1664 dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled"); 1665 dev_dbg(&dev->dev, "PME# %s\n", enable ? "enabled" : "disabled");
1665} 1666}
1666 1667