aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/pci/fixup.c22
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/x86/include/asm/vga.h6
-rw-r--r--arch/x86/kernel/resource.c8
-rw-r--r--arch/x86/pci/fixup.c21
-rw-r--r--arch/x86/pci/i386.c4
-rw-r--r--drivers/pci/host/pci-host-generic.c2
-rw-r--r--drivers/pci/host/pci-mvebu.c2
-rw-r--r--drivers/pci/host/pci-tegra.c2
-rw-r--r--drivers/pci/host/pcie-rcar.c2
-rw-r--r--drivers/pci/msi.c84
-rw-r--r--drivers/pci/pci.c19
-rw-r--r--drivers/pci/setup-bus.c2
-rw-r--r--drivers/pci/setup-res.c75
-rw-r--r--drivers/video/fbdev/efifb.c39
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/pci_ids.h4
17 files changed, 151 insertions, 156 deletions
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 1fe9aa5068ea..ec73b2cf912a 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -6,6 +6,7 @@
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/vgaarb.h> 8#include <linux/vgaarb.h>
9#include <linux/screen_info.h>
9 10
10#include <asm/machvec.h> 11#include <asm/machvec.h>
11 12
@@ -37,6 +38,27 @@ static void pci_fixup_video(struct pci_dev *pdev)
37 return; 38 return;
38 /* Maybe, this machine supports legacy memory map. */ 39 /* Maybe, this machine supports legacy memory map. */
39 40
41 if (!vga_default_device()) {
42 resource_size_t start, end;
43 int i;
44
45 /* Does firmware framebuffer belong to us? */
46 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
47 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
48 continue;
49
50 start = pci_resource_start(pdev, i);
51 end = pci_resource_end(pdev, i);
52
53 if (!start || !end)
54 continue;
55
56 if (screen_info.lfb_base >= start &&
57 (screen_info.lfb_base + screen_info.lfb_size) < end)
58 vga_set_default_device(pdev);
59 }
60 }
61
40 /* Is VGA routed to us? */ 62 /* Is VGA routed to us? */
41 bus = pdev->bus; 63 bus = pdev->bus;
42 while (bus) { 64 while (bus) {
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index b49c72fd7f16..b2814e23e1ed 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -123,21 +123,12 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,
123 123
124void pcibios_reset_secondary_bus(struct pci_dev *dev) 124void pcibios_reset_secondary_bus(struct pci_dev *dev)
125{ 125{
126 u16 ctrl;
127
128 if (ppc_md.pcibios_reset_secondary_bus) { 126 if (ppc_md.pcibios_reset_secondary_bus) {
129 ppc_md.pcibios_reset_secondary_bus(dev); 127 ppc_md.pcibios_reset_secondary_bus(dev);
130 return; 128 return;
131 } 129 }
132 130
133 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl); 131 pci_reset_secondary_bus(dev);
134 ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
135 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
136 msleep(2);
137
138 ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
139 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
140 ssleep(1);
141} 132}
142 133
143static resource_size_t pcibios_io_size(const struct pci_controller *hose) 134static resource_size_t pcibios_io_size(const struct pci_controller *hose)
diff --git a/arch/x86/include/asm/vga.h b/arch/x86/include/asm/vga.h
index 44282fbf7bf9..c4b9dc2f67c5 100644
--- a/arch/x86/include/asm/vga.h
+++ b/arch/x86/include/asm/vga.h
@@ -17,10 +17,4 @@
17#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
18#define vga_writeb(x, y) (*(y) = (x)) 18#define vga_writeb(x, y) (*(y) = (x))
19 19
20#ifdef CONFIG_FB_EFI
21#define __ARCH_HAS_VGA_DEFAULT_DEVICE
22extern struct pci_dev *vga_default_device(void);
23extern void vga_set_default_device(struct pci_dev *pdev);
24#endif
25
26#endif /* _ASM_X86_VGA_H */ 20#endif /* _ASM_X86_VGA_H */
diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c
index 2a26819bb6a8..80eab01c1a68 100644
--- a/arch/x86/kernel/resource.c
+++ b/arch/x86/kernel/resource.c
@@ -37,10 +37,12 @@ static void remove_e820_regions(struct resource *avail)
37 37
38void arch_remove_reservations(struct resource *avail) 38void arch_remove_reservations(struct resource *avail)
39{ 39{
40 /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ 40 /*
41 * Trim out BIOS area (high 2MB) and E820 regions. We do not remove
42 * the low 1MB unconditionally, as this area is needed for some ISA
43 * cards requiring a memory range, e.g. the i82365 PCMCIA controller.
44 */
41 if (avail->flags & IORESOURCE_MEM) { 45 if (avail->flags & IORESOURCE_MEM) {
42 if (avail->start < BIOS_END)
43 avail->start = BIOS_END;
44 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); 46 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END);
45 47
46 remove_e820_regions(avail); 48 remove_e820_regions(avail);
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index b5e60268d93f..c61ea57d1ba1 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,6 +326,27 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
329 /* Is VGA routed to us? */ 350 /* Is VGA routed to us? */
330 bus = pdev->bus; 351 bus = pdev->bus;
331 while (bus) { 352 while (bus) {
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index a19ed92e74e4..2ae525e0d8ba 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const struct resource *res,
162 return start; 162 return start;
163 if (start & 0x300) 163 if (start & 0x300)
164 start = (start + 0x3ff) & ~0x3ff; 164 start = (start + 0x3ff) & ~0x3ff;
165 } else if (res->flags & IORESOURCE_MEM) {
166 /* The low 1MB range is reserved for ISA cards */
167 if (start < BIOS_END)
168 start = BIOS_END;
165 } 169 }
166 return start; 170 return start;
167} 171}
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
index 44fe6aa6a43f..3d2076f59911 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -385,4 +385,4 @@ module_platform_driver(gen_pci_driver);
385 385
386MODULE_DESCRIPTION("Generic PCI host driver"); 386MODULE_DESCRIPTION("Generic PCI host driver");
387MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>"); 387MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
388MODULE_LICENSE("GPLv2"); 388MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index ce23e0f076b6..a8c6f1a92e0f 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -1094,4 +1094,4 @@ module_platform_driver(mvebu_pcie_driver);
1094 1094
1095MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>"); 1095MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
1096MODULE_DESCRIPTION("Marvell EBU PCIe driver"); 1096MODULE_DESCRIPTION("Marvell EBU PCIe driver");
1097MODULE_LICENSE("GPLv2"); 1097MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 083cf37ca047..c284e841e3ea 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -1716,4 +1716,4 @@ module_platform_driver(tegra_pcie_driver);
1716 1716
1717MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>"); 1717MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1718MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver"); 1718MODULE_DESCRIPTION("NVIDIA Tegra PCIe driver");
1719MODULE_LICENSE("GPLv2"); 1719MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index f033972da9b9..4884ee5e07d4 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -989,4 +989,4 @@ module_platform_driver(rcar_pcie_driver);
989 989
990MODULE_AUTHOR("Phil Edworthy <phil.edworthy@renesas.com>"); 990MODULE_AUTHOR("Phil Edworthy <phil.edworthy@renesas.com>");
991MODULE_DESCRIPTION("Renesas R-Car PCIe driver"); 991MODULE_DESCRIPTION("Renesas R-Car PCIe driver");
992MODULE_LICENSE("GPLv2"); 992MODULE_LICENSE("GPL v2");
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 50a7e4e96da7..5a40516444f3 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -235,7 +235,7 @@ static void msi_set_mask_bit(struct irq_data *data, u32 flag)
235 msix_mask_irq(desc, flag); 235 msix_mask_irq(desc, flag);
236 readl(desc->mask_base); /* Flush write to device */ 236 readl(desc->mask_base); /* Flush write to device */
237 } else { 237 } else {
238 unsigned offset = data->irq - desc->dev->irq; 238 unsigned offset = data->irq - desc->irq;
239 msi_mask_irq(desc, 1 << offset, flag << offset); 239 msi_mask_irq(desc, 1 << offset, flag << offset);
240 } 240 }
241} 241}
@@ -463,7 +463,6 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
463 if (!dev->msix_enabled) 463 if (!dev->msix_enabled)
464 return; 464 return;
465 BUG_ON(list_empty(&dev->msi_list)); 465 BUG_ON(list_empty(&dev->msi_list));
466 entry = list_first_entry(&dev->msi_list, struct msi_desc, list);
467 466
468 /* route the table */ 467 /* route the table */
469 pci_intx_for_msi(dev, 0); 468 pci_intx_for_msi(dev, 0);
@@ -488,7 +487,6 @@ EXPORT_SYMBOL_GPL(pci_restore_msi_state);
488static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr, 487static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
489 char *buf) 488 char *buf)
490{ 489{
491 struct pci_dev *pdev = to_pci_dev(dev);
492 struct msi_desc *entry; 490 struct msi_desc *entry;
493 unsigned long irq; 491 unsigned long irq;
494 int retval; 492 int retval;
@@ -497,12 +495,11 @@ static ssize_t msi_mode_show(struct device *dev, struct device_attribute *attr,
497 if (retval) 495 if (retval)
498 return retval; 496 return retval;
499 497
500 list_for_each_entry(entry, &pdev->msi_list, list) { 498 entry = irq_get_msi_desc(irq);
501 if (entry->irq == irq) { 499 if (entry)
502 return sprintf(buf, "%s\n", 500 return sprintf(buf, "%s\n",
503 entry->msi_attrib.is_msix ? "msix" : "msi"); 501 entry->msi_attrib.is_msix ? "msix" : "msi");
504 } 502
505 }
506 return -ENODEV; 503 return -ENODEV;
507} 504}
508 505
@@ -581,6 +578,38 @@ error_attrs:
581 return ret; 578 return ret;
582} 579}
583 580
581static struct msi_desc *msi_setup_entry(struct pci_dev *dev)
582{
583 u16 control;
584 struct msi_desc *entry;
585
586 /* MSI Entry Initialization */
587 entry = alloc_msi_entry(dev);
588 if (!entry)
589 return NULL;
590
591 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
592
593 entry->msi_attrib.is_msix = 0;
594 entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
595 entry->msi_attrib.entry_nr = 0;
596 entry->msi_attrib.maskbit = !!(control & PCI_MSI_FLAGS_MASKBIT);
597 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
598 entry->msi_attrib.pos = dev->msi_cap;
599 entry->msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1;
600
601 if (control & PCI_MSI_FLAGS_64BIT)
602 entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_64;
603 else
604 entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_32;
605
606 /* Save the initial mask status */
607 if (entry->msi_attrib.maskbit)
608 pci_read_config_dword(dev, entry->mask_pos, &entry->masked);
609
610 return entry;
611}
612
584/** 613/**
585 * msi_capability_init - configure device's MSI capability structure 614 * msi_capability_init - configure device's MSI capability structure
586 * @dev: pointer to the pci_dev data structure of MSI device function 615 * @dev: pointer to the pci_dev data structure of MSI device function
@@ -596,32 +625,15 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
596{ 625{
597 struct msi_desc *entry; 626 struct msi_desc *entry;
598 int ret; 627 int ret;
599 u16 control;
600 unsigned mask; 628 unsigned mask;
601 629
602 msi_set_enable(dev, 0); /* Disable MSI during set up */ 630 msi_set_enable(dev, 0); /* Disable MSI during set up */
603 631
604 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); 632 entry = msi_setup_entry(dev);
605 /* MSI Entry Initialization */
606 entry = alloc_msi_entry(dev);
607 if (!entry) 633 if (!entry)
608 return -ENOMEM; 634 return -ENOMEM;
609 635
610 entry->msi_attrib.is_msix = 0;
611 entry->msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
612 entry->msi_attrib.entry_nr = 0;
613 entry->msi_attrib.maskbit = !!(control & PCI_MSI_FLAGS_MASKBIT);
614 entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
615 entry->msi_attrib.pos = dev->msi_cap;
616 entry->msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1;
617
618 if (control & PCI_MSI_FLAGS_64BIT)
619 entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_64;
620 else
621 entry->mask_pos = dev->msi_cap + PCI_MSI_MASK_32;
622 /* All MSIs are unmasked by default, Mask them all */ 636 /* All MSIs are unmasked by default, Mask them all */
623 if (entry->msi_attrib.maskbit)
624 pci_read_config_dword(dev, entry->mask_pos, &entry->masked);
625 mask = msi_mask(entry->msi_attrib.multi_cap); 637 mask = msi_mask(entry->msi_attrib.multi_cap);
626 msi_mask_irq(entry, mask, mask); 638 msi_mask_irq(entry, mask, mask);
627 639
@@ -999,24 +1011,6 @@ void pci_disable_msix(struct pci_dev *dev)
999} 1011}
1000EXPORT_SYMBOL(pci_disable_msix); 1012EXPORT_SYMBOL(pci_disable_msix);
1001 1013
1002/**
1003 * msi_remove_pci_irq_vectors - reclaim MSI(X) irqs to unused state
1004 * @dev: pointer to the pci_dev data structure of MSI(X) device function
1005 *
1006 * Being called during hotplug remove, from which the device function
1007 * is hot-removed. All previous assigned MSI/MSI-X irqs, if
1008 * allocated for this device function, are reclaimed to unused state,
1009 * which may be used later on.
1010 **/
1011void msi_remove_pci_irq_vectors(struct pci_dev *dev)
1012{
1013 if (!pci_msi_enable || !dev)
1014 return;
1015
1016 if (dev->msi_enabled || dev->msix_enabled)
1017 free_msi_irqs(dev);
1018}
1019
1020void pci_no_msi(void) 1014void pci_no_msi(void)
1021{ 1015{
1022 pci_msi_enable = 0; 1016 pci_msi_enable = 0;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 63a54a340863..74043a2a2da8 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -839,12 +839,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
839 839
840 if (!__pci_complete_power_transition(dev, state)) 840 if (!__pci_complete_power_transition(dev, state))
841 error = 0; 841 error = 0;
842 /*
843 * When aspm_policy is "powersave" this call ensures
844 * that ASPM is configured.
845 */
846 if (!error && dev->bus->self)
847 pcie_aspm_powersave_config_link(dev->bus->self);
848 842
849 return error; 843 return error;
850} 844}
@@ -1195,12 +1189,18 @@ int __weak pcibios_enable_device(struct pci_dev *dev, int bars)
1195static int do_pci_enable_device(struct pci_dev *dev, int bars) 1189static int do_pci_enable_device(struct pci_dev *dev, int bars)
1196{ 1190{
1197 int err; 1191 int err;
1192 struct pci_dev *bridge;
1198 u16 cmd; 1193 u16 cmd;
1199 u8 pin; 1194 u8 pin;
1200 1195
1201 err = pci_set_power_state(dev, PCI_D0); 1196 err = pci_set_power_state(dev, PCI_D0);
1202 if (err < 0 && err != -EIO) 1197 if (err < 0 && err != -EIO)
1203 return err; 1198 return err;
1199
1200 bridge = pci_upstream_bridge(dev);
1201 if (bridge)
1202 pcie_aspm_powersave_config_link(bridge);
1203
1204 err = pcibios_enable_device(dev, bars); 1204 err = pcibios_enable_device(dev, bars);
1205 if (err < 0) 1205 if (err < 0)
1206 return err; 1206 return err;
@@ -3193,7 +3193,7 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
3193 return 0; 3193 return 0;
3194} 3194}
3195 3195
3196void __weak pcibios_reset_secondary_bus(struct pci_dev *dev) 3196void pci_reset_secondary_bus(struct pci_dev *dev)
3197{ 3197{
3198 u16 ctrl; 3198 u16 ctrl;
3199 3199
@@ -3219,6 +3219,11 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
3219 ssleep(1); 3219 ssleep(1);
3220} 3220}
3221 3221
3222void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
3223{
3224 pci_reset_secondary_bus(dev);
3225}
3226
3222/** 3227/**
3223 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge. 3228 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge.
3224 * @dev: Bridge device 3229 * @dev: Bridge device
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index a5a63ecfb628..6373985ad3f7 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -925,7 +925,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
925{ 925{
926 struct pci_dev *dev; 926 struct pci_dev *dev;
927 resource_size_t min_align, align, size, size0, size1; 927 resource_size_t min_align, align, size, size0, size1;
928 resource_size_t aligns[14]; /* Alignments from 1Mb to 8Gb */ 928 resource_size_t aligns[18]; /* Alignments from 1Mb to 128Gb */
929 int order, max_order; 929 int order, max_order;
930 struct resource *b_res = find_free_bus_resource(bus, 930 struct resource *b_res = find_free_bus_resource(bus,
931 mask | IORESOURCE_PREFETCH, type); 931 mask | IORESOURCE_PREFETCH, type);
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index caed1ce6facd..b7c3a5ea1fca 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -166,11 +166,10 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
166{ 166{
167 struct resource *root, *conflict; 167 struct resource *root, *conflict;
168 resource_size_t fw_addr, start, end; 168 resource_size_t fw_addr, start, end;
169 int ret = 0;
170 169
171 fw_addr = pcibios_retrieve_fw_addr(dev, resno); 170 fw_addr = pcibios_retrieve_fw_addr(dev, resno);
172 if (!fw_addr) 171 if (!fw_addr)
173 return 1; 172 return -ENOMEM;
174 173
175 start = res->start; 174 start = res->start;
176 end = res->end; 175 end = res->end;
@@ -189,14 +188,13 @@ static int pci_revert_fw_address(struct resource *res, struct pci_dev *dev,
189 resno, res); 188 resno, res);
190 conflict = request_resource_conflict(root, res); 189 conflict = request_resource_conflict(root, res);
191 if (conflict) { 190 if (conflict) {
192 dev_info(&dev->dev, 191 dev_info(&dev->dev, "BAR %d: %pR conflicts with %s %pR\n",
193 "BAR %d: %pR conflicts with %s %pR\n", resno, 192 resno, res, conflict->name, conflict);
194 res, conflict->name, conflict);
195 res->start = start; 193 res->start = start;
196 res->end = end; 194 res->end = end;
197 ret = 1; 195 return -EBUSY;
198 } 196 }
199 return ret; 197 return 0;
200} 198}
201 199
202static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev, 200static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
@@ -250,10 +248,8 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
250static int _pci_assign_resource(struct pci_dev *dev, int resno, 248static int _pci_assign_resource(struct pci_dev *dev, int resno,
251 resource_size_t size, resource_size_t min_align) 249 resource_size_t size, resource_size_t min_align)
252{ 250{
253 struct resource *res = dev->resource + resno;
254 struct pci_bus *bus; 251 struct pci_bus *bus;
255 int ret; 252 int ret;
256 char *type;
257 253
258 bus = dev->bus; 254 bus = dev->bus;
259 while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) { 255 while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) {
@@ -262,21 +258,6 @@ static int _pci_assign_resource(struct pci_dev *dev, int resno,
262 bus = bus->parent; 258 bus = bus->parent;
263 } 259 }
264 260
265 if (ret) {
266 if (res->flags & IORESOURCE_MEM)
267 if (res->flags & IORESOURCE_PREFETCH)
268 type = "mem pref";
269 else
270 type = "mem";
271 else if (res->flags & IORESOURCE_IO)
272 type = "io";
273 else
274 type = "unknown";
275 dev_info(&dev->dev,
276 "BAR %d: can't assign %s (size %#llx)\n",
277 resno, type, (unsigned long long) resource_size(res));
278 }
279
280 return ret; 261 return ret;
281} 262}
282 263
@@ -302,17 +283,24 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
302 * where firmware left it. That at least has a chance of 283 * where firmware left it. That at least has a chance of
303 * working, which is better than just leaving it disabled. 284 * working, which is better than just leaving it disabled.
304 */ 285 */
305 if (ret < 0) 286 if (ret < 0) {
287 dev_info(&dev->dev, "BAR %d: no space for %pR\n", resno, res);
306 ret = pci_revert_fw_address(res, dev, resno, size); 288 ret = pci_revert_fw_address(res, dev, resno, size);
289 }
307 290
308 if (!ret) { 291 if (ret < 0) {
309 res->flags &= ~IORESOURCE_UNSET; 292 dev_info(&dev->dev, "BAR %d: failed to assign %pR\n", resno,
310 res->flags &= ~IORESOURCE_STARTALIGN; 293 res);
311 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 294 return ret;
312 if (resno < PCI_BRIDGE_RESOURCES)
313 pci_update_resource(dev, resno);
314 } 295 }
315 return ret; 296
297 res->flags &= ~IORESOURCE_UNSET;
298 res->flags &= ~IORESOURCE_STARTALIGN;
299 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
300 if (resno < PCI_BRIDGE_RESOURCES)
301 pci_update_resource(dev, resno);
302
303 return 0;
316} 304}
317EXPORT_SYMBOL(pci_assign_resource); 305EXPORT_SYMBOL(pci_assign_resource);
318 306
@@ -320,9 +308,11 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
320 resource_size_t min_align) 308 resource_size_t min_align)
321{ 309{
322 struct resource *res = dev->resource + resno; 310 struct resource *res = dev->resource + resno;
311 unsigned long flags;
323 resource_size_t new_size; 312 resource_size_t new_size;
324 int ret; 313 int ret;
325 314
315 flags = res->flags;
326 res->flags |= IORESOURCE_UNSET; 316 res->flags |= IORESOURCE_UNSET;
327 if (!res->parent) { 317 if (!res->parent) {
328 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n", 318 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n",
@@ -333,14 +323,21 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
333 /* already aligned with min_align */ 323 /* already aligned with min_align */
334 new_size = resource_size(res) + addsize; 324 new_size = resource_size(res) + addsize;
335 ret = _pci_assign_resource(dev, resno, new_size, min_align); 325 ret = _pci_assign_resource(dev, resno, new_size, min_align);
336 if (!ret) { 326 if (ret) {
337 res->flags &= ~IORESOURCE_UNSET; 327 res->flags = flags;
338 res->flags &= ~IORESOURCE_STARTALIGN; 328 dev_info(&dev->dev, "BAR %d: %pR (failed to expand by %#llx)\n",
339 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); 329 resno, res, (unsigned long long) addsize);
340 if (resno < PCI_BRIDGE_RESOURCES) 330 return ret;
341 pci_update_resource(dev, resno);
342 } 331 }
343 return ret; 332
333 res->flags &= ~IORESOURCE_UNSET;
334 res->flags &= ~IORESOURCE_STARTALIGN;
335 dev_info(&dev->dev, "BAR %d: reassigned %pR (expanded by %#llx)\n",
336 resno, res, (unsigned long long) addsize);
337 if (resno < PCI_BRIDGE_RESOURCES)
338 pci_update_resource(dev, resno);
339
340 return 0;
344} 341}
345 342
346int pci_enable_resources(struct pci_dev *dev, int mask) 343int pci_enable_resources(struct pci_dev *dev, int mask)
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index ae9618ff6735..982f6abe6faf 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -19,8 +19,6 @@
19 19
20static bool request_mem_succeeded = false; 20static bool request_mem_succeeded = false;
21 21
22static struct pci_dev *default_vga;
23
24static struct fb_var_screeninfo efifb_defined = { 22static struct fb_var_screeninfo efifb_defined = {
25 .activate = FB_ACTIVATE_NOW, 23 .activate = FB_ACTIVATE_NOW,
26 .height = -1, 24 .height = -1,
@@ -84,23 +82,10 @@ static struct fb_ops efifb_ops = {
84 .fb_imageblit = cfb_imageblit, 82 .fb_imageblit = cfb_imageblit,
85}; 83};
86 84
87struct pci_dev *vga_default_device(void)
88{
89 return default_vga;
90}
91
92EXPORT_SYMBOL_GPL(vga_default_device);
93
94void vga_set_default_device(struct pci_dev *pdev)
95{
96 default_vga = pdev;
97}
98
99static int efifb_setup(char *options) 85static int efifb_setup(char *options)
100{ 86{
101 char *this_opt; 87 char *this_opt;
102 int i; 88 int i;
103 struct pci_dev *dev = NULL;
104 89
105 if (options && *options) { 90 if (options && *options) {
106 while ((this_opt = strsep(&options, ",")) != NULL) { 91 while ((this_opt = strsep(&options, ",")) != NULL) {
@@ -126,30 +111,6 @@ static int efifb_setup(char *options)
126 } 111 }
127 } 112 }
128 113
129 for_each_pci_dev(dev) {
130 int i;
131
132 if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
133 continue;
134
135 for (i=0; i < DEVICE_COUNT_RESOURCE; i++) {
136 resource_size_t start, end;
137
138 if (!(pci_resource_flags(dev, i) & IORESOURCE_MEM))
139 continue;
140
141 start = pci_resource_start(dev, i);
142 end = pci_resource_end(dev, i);
143
144 if (!start || !end)
145 continue;
146
147 if (screen_info.lfb_base >= start &&
148 (screen_info.lfb_base + screen_info.lfb_size) < end)
149 default_vga = dev;
150 }
151 }
152
153 return 0; 114 return 0;
154} 115}
155 116
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 466bcd111d85..6ed3647b38df 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -978,6 +978,8 @@ int pci_try_reset_slot(struct pci_slot *slot);
978int pci_probe_reset_bus(struct pci_bus *bus); 978int pci_probe_reset_bus(struct pci_bus *bus);
979int pci_reset_bus(struct pci_bus *bus); 979int pci_reset_bus(struct pci_bus *bus);
980int pci_try_reset_bus(struct pci_bus *bus); 980int pci_try_reset_bus(struct pci_bus *bus);
981void pci_reset_secondary_bus(struct pci_dev *dev);
982void pcibios_reset_secondary_bus(struct pci_dev *dev);
981void pci_reset_bridge_secondary_bus(struct pci_dev *dev); 983void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
982void pci_update_resource(struct pci_dev *dev, int resno); 984void pci_update_resource(struct pci_dev *dev, int resno);
983int __must_check pci_assign_resource(struct pci_dev *dev, int i); 985int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -1186,7 +1188,6 @@ int pci_msix_vec_count(struct pci_dev *dev);
1186int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); 1188int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec);
1187void pci_msix_shutdown(struct pci_dev *dev); 1189void pci_msix_shutdown(struct pci_dev *dev);
1188void pci_disable_msix(struct pci_dev *dev); 1190void pci_disable_msix(struct pci_dev *dev);
1189void msi_remove_pci_irq_vectors(struct pci_dev *dev);
1190void pci_restore_msi_state(struct pci_dev *dev); 1191void pci_restore_msi_state(struct pci_dev *dev);
1191int pci_msi_enabled(void); 1192int pci_msi_enabled(void);
1192int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec); 1193int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);
@@ -1217,7 +1218,6 @@ static inline int pci_enable_msix(struct pci_dev *dev,
1217{ return -ENOSYS; } 1218{ return -ENOSYS; }
1218static inline void pci_msix_shutdown(struct pci_dev *dev) { } 1219static inline void pci_msix_shutdown(struct pci_dev *dev) { }
1219static inline void pci_disable_msix(struct pci_dev *dev) { } 1220static inline void pci_disable_msix(struct pci_dev *dev) { }
1220static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) { }
1221static inline void pci_restore_msi_state(struct pci_dev *dev) { } 1221static inline void pci_restore_msi_state(struct pci_dev *dev) { }
1222static inline int pci_msi_enabled(void) { return 0; } 1222static inline int pci_msi_enabled(void) { return 0; }
1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec, 1223static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fa31731c854..6ed0bb73a864 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -6,6 +6,8 @@
6 * Do not add new entries to this file unless the definitions 6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers. 7 * are shared between multiple drivers.
8 */ 8 */
9#ifndef _LINUX_PCI_IDS_H
10#define _LINUX_PCI_IDS_H
9 11
10/* Device classes and subclasses */ 12/* Device classes and subclasses */
11 13
@@ -2968,3 +2970,5 @@
2968#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 2970#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
2969 2971
2970#define PCI_VENDOR_ID_OCZ 0x1b85 2972#define PCI_VENDOR_ID_OCZ 0x1b85
2973
2974#endif /* _LINUX_PCI_IDS_H */