diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-15 09:56:28 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-03-15 09:56:28 -0400 |
commit | 6e6f498b039aa5558c7377fbbe65f7421d34cea4 (patch) | |
tree | 7425c95a17f779b1ecb03810bbfe24cab6387f48 /arch/ia64 | |
parent | cfeb8139a1fbbbae3f1e986133f4e9e7833eeac4 (diff) | |
parent | bd5174dfb6f171fa06e638664ec6ee54692cf7b2 (diff) |
Merge branch 'pci/resource' into next
* pci/resource:
PCI: Simplify pci_create_attr() control flow
PCI: Don't leak memory if sysfs_create_bin_file() fails
PCI: Simplify sysfs ROM cleanup
PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY
MIPS: Loongson 3: Keep CPU physical (not virtual) addresses in shadow ROM resource
MIPS: Loongson 3: Use temporary struct resource * to avoid repetition
ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource
ia64/PCI: Use ioremap() instead of open-coded equivalent
ia64/PCI: Use temporary struct resource * to avoid repetition
PCI: Clean up pci_map_rom() whitespace
PCI: Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs
PCI: Set ROM shadow location in arch code, not in PCI core
PCI: Don't enable/disable ROM BAR if we're using a RAM shadow copy
PCI: Don't assign or reassign immutable resources
PCI: Mark shadow copy of VGA ROM as IORESOURCE_PCI_FIXED
x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs
PCI: Disable IO/MEM decoding for devices with non-compliant BARs
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/pci/fixup.c | 21 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_acpi_init.c | 22 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 51 |
3 files changed, 48 insertions, 46 deletions
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c index fc505d58f078..41caa99add51 100644 --- a/arch/ia64/pci/fixup.c +++ b/arch/ia64/pci/fixup.c | |||
@@ -17,14 +17,14 @@ | |||
17 | * | 17 | * |
18 | * The standard boot ROM sequence for an x86 machine uses the BIOS | 18 | * The standard boot ROM sequence for an x86 machine uses the BIOS |
19 | * to select an initial video card for boot display. This boot video | 19 | * to select an initial video card for boot display. This boot video |
20 | * card will have it's BIOS copied to C0000 in system RAM. | 20 | * card will have its BIOS copied to 0xC0000 in system RAM. |
21 | * IORESOURCE_ROM_SHADOW is used to associate the boot video | 21 | * IORESOURCE_ROM_SHADOW is used to associate the boot video |
22 | * card with this copy. On laptops this copy has to be used since | 22 | * card with this copy. On laptops this copy has to be used since |
23 | * the main ROM may be compressed or combined with another image. | 23 | * the main ROM may be compressed or combined with another image. |
24 | * See pci_map_rom() for use of this flag. Before marking the device | 24 | * See pci_map_rom() for use of this flag. Before marking the device |
25 | * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set | 25 | * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set |
26 | * by either arch cde or vga-arbitration, if so only apply the fixup to this | 26 | * by either arch code or vga-arbitration; if so only apply the fixup to this |
27 | * already determined primary video card. | 27 | * already-determined primary video card. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | static void pci_fixup_video(struct pci_dev *pdev) | 30 | static void pci_fixup_video(struct pci_dev *pdev) |
@@ -32,6 +32,7 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
32 | struct pci_dev *bridge; | 32 | struct pci_dev *bridge; |
33 | struct pci_bus *bus; | 33 | struct pci_bus *bus; |
34 | u16 config; | 34 | u16 config; |
35 | struct resource *res; | ||
35 | 36 | ||
36 | if ((strcmp(ia64_platform_name, "dig") != 0) | 37 | if ((strcmp(ia64_platform_name, "dig") != 0) |
37 | && (strcmp(ia64_platform_name, "hpzx1") != 0)) | 38 | && (strcmp(ia64_platform_name, "hpzx1") != 0)) |
@@ -61,8 +62,18 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
61 | if (!vga_default_device() || pdev == vga_default_device()) { | 62 | if (!vga_default_device() || pdev == vga_default_device()) { |
62 | pci_read_config_word(pdev, PCI_COMMAND, &config); | 63 | pci_read_config_word(pdev, PCI_COMMAND, &config); |
63 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | 64 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { |
64 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; | 65 | res = &pdev->resource[PCI_ROM_RESOURCE]; |
65 | dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); | 66 | |
67 | pci_disable_rom(pdev); | ||
68 | if (res->parent) | ||
69 | release_resource(res); | ||
70 | |||
71 | res->start = 0xC0000; | ||
72 | res->end = res->start + 0x20000 - 1; | ||
73 | res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | | ||
74 | IORESOURCE_PCI_FIXED; | ||
75 | dev_info(&pdev->dev, "Video device with shadowed ROM at %pR\n", | ||
76 | res); | ||
66 | } | 77 | } |
67 | } | 78 | } |
68 | } | 79 | } |
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c index 0640739cc20c..231234c8d113 100644 --- a/arch/ia64/sn/kernel/io_acpi_init.c +++ b/arch/ia64/sn/kernel/io_acpi_init.c | |||
@@ -429,7 +429,8 @@ sn_acpi_slot_fixup(struct pci_dev *dev) | |||
429 | void __iomem *addr; | 429 | void __iomem *addr; |
430 | struct pcidev_info *pcidev_info = NULL; | 430 | struct pcidev_info *pcidev_info = NULL; |
431 | struct sn_irq_info *sn_irq_info = NULL; | 431 | struct sn_irq_info *sn_irq_info = NULL; |
432 | size_t image_size, size; | 432 | struct resource *res; |
433 | size_t size; | ||
433 | 434 | ||
434 | if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { | 435 | if (sn_acpi_get_pcidev_info(dev, &pcidev_info, &sn_irq_info)) { |
435 | panic("%s: Failure obtaining pcidev_info for %s\n", | 436 | panic("%s: Failure obtaining pcidev_info for %s\n", |
@@ -443,17 +444,20 @@ sn_acpi_slot_fixup(struct pci_dev *dev) | |||
443 | * of the shadowed copy, and the actual length of the ROM image. | 444 | * of the shadowed copy, and the actual length of the ROM image. |
444 | */ | 445 | */ |
445 | size = pci_resource_len(dev, PCI_ROM_RESOURCE); | 446 | size = pci_resource_len(dev, PCI_ROM_RESOURCE); |
446 | addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE], | 447 | |
447 | size); | 448 | res = &dev->resource[PCI_ROM_RESOURCE]; |
448 | image_size = pci_get_rom_size(dev, addr, size); | 449 | |
449 | dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr; | 450 | pci_disable_rom(dev); |
450 | dev->resource[PCI_ROM_RESOURCE].end = | 451 | if (res->parent) |
451 | (unsigned long) addr + image_size - 1; | 452 | release_resource(res); |
452 | dev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_BIOS_COPY; | 453 | |
454 | res->start = pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE]; | ||
455 | res->end = res->start + size - 1; | ||
456 | res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | | ||
457 | IORESOURCE_PCI_FIXED; | ||
453 | } | 458 | } |
454 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | 459 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); |
455 | } | 460 | } |
456 | |||
457 | EXPORT_SYMBOL(sn_acpi_slot_fixup); | 461 | EXPORT_SYMBOL(sn_acpi_slot_fixup); |
458 | 462 | ||
459 | 463 | ||
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 1be65eb074ec..c15a41e2d1f2 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -150,7 +150,8 @@ void | |||
150 | sn_io_slot_fixup(struct pci_dev *dev) | 150 | sn_io_slot_fixup(struct pci_dev *dev) |
151 | { | 151 | { |
152 | int idx; | 152 | int idx; |
153 | unsigned long addr, end, size, start; | 153 | struct resource *res; |
154 | unsigned long addr, size; | ||
154 | struct pcidev_info *pcidev_info; | 155 | struct pcidev_info *pcidev_info; |
155 | struct sn_irq_info *sn_irq_info; | 156 | struct sn_irq_info *sn_irq_info; |
156 | int status; | 157 | int status; |
@@ -175,55 +176,41 @@ sn_io_slot_fixup(struct pci_dev *dev) | |||
175 | 176 | ||
176 | /* Copy over PIO Mapped Addresses */ | 177 | /* Copy over PIO Mapped Addresses */ |
177 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { | 178 | for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { |
178 | 179 | if (!pcidev_info->pdi_pio_mapped_addr[idx]) | |
179 | if (!pcidev_info->pdi_pio_mapped_addr[idx]) { | ||
180 | continue; | 180 | continue; |
181 | } | ||
182 | 181 | ||
183 | start = dev->resource[idx].start; | 182 | res = &dev->resource[idx]; |
184 | end = dev->resource[idx].end; | 183 | |
185 | size = end - start; | 184 | size = res->end - res->start; |
186 | if (size == 0) { | 185 | if (size == 0) |
187 | continue; | 186 | continue; |
188 | } | 187 | |
189 | addr = pcidev_info->pdi_pio_mapped_addr[idx]; | 188 | res->start = pcidev_info->pdi_pio_mapped_addr[idx]; |
190 | addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; | 189 | res->end = addr + size; |
191 | dev->resource[idx].start = addr; | ||
192 | dev->resource[idx].end = addr + size; | ||
193 | 190 | ||
194 | /* | 191 | /* |
195 | * if it's already in the device structure, remove it before | 192 | * if it's already in the device structure, remove it before |
196 | * inserting | 193 | * inserting |
197 | */ | 194 | */ |
198 | if (dev->resource[idx].parent && dev->resource[idx].parent->child) | 195 | if (res->parent && res->parent->child) |
199 | release_resource(&dev->resource[idx]); | 196 | release_resource(res); |
200 | 197 | ||
201 | if (dev->resource[idx].flags & IORESOURCE_IO) | 198 | if (res->flags & IORESOURCE_IO) |
202 | insert_resource(&ioport_resource, &dev->resource[idx]); | 199 | insert_resource(&ioport_resource, res); |
203 | else | 200 | else |
204 | insert_resource(&iomem_resource, &dev->resource[idx]); | 201 | insert_resource(&iomem_resource, res); |
205 | /* | 202 | /* |
206 | * If ROM, set the actual ROM image size, and mark as | 203 | * If ROM, mark as shadowed in PROM. |
207 | * shadowed in PROM. | ||
208 | */ | 204 | */ |
209 | if (idx == PCI_ROM_RESOURCE) { | 205 | if (idx == PCI_ROM_RESOURCE) { |
210 | size_t image_size; | 206 | pci_disable_rom(dev); |
211 | void __iomem *rom; | 207 | res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW | |
212 | 208 | IORESOURCE_PCI_FIXED; | |
213 | rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE), | ||
214 | size + 1); | ||
215 | image_size = pci_get_rom_size(dev, rom, size + 1); | ||
216 | dev->resource[PCI_ROM_RESOURCE].end = | ||
217 | dev->resource[PCI_ROM_RESOURCE].start + | ||
218 | image_size - 1; | ||
219 | dev->resource[PCI_ROM_RESOURCE].flags |= | ||
220 | IORESOURCE_ROM_BIOS_COPY; | ||
221 | } | 209 | } |
222 | } | 210 | } |
223 | 211 | ||
224 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); | 212 | sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); |
225 | } | 213 | } |
226 | |||
227 | EXPORT_SYMBOL(sn_io_slot_fixup); | 214 | EXPORT_SYMBOL(sn_io_slot_fixup); |
228 | 215 | ||
229 | /* | 216 | /* |