aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-03-02 17:06:32 -0500
committerBjorn Helgaas <bhelgaas@google.com>2016-03-12 07:00:29 -0500
commit240504adaf0798a5ab18fac46ae782d3b004859f (patch)
treeddb0599d3fba6ab5cb995b55bbc17d295bc28d78 /arch/ia64
parentf976721e826e06ba1cdfce701495b49e2e25289d (diff)
ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource
A struct resource contains CPU physical addresses, not virtual addresses. But sn_acpi_slot_fixup() and sn_io_slot_fixup() stored the virtual address of a shadow ROM copy in the resource. To compensate, pci_map_rom() had a special case that returned the resource address directly rather than calling ioremap() on it. When we're using a shadow copy in RAM or PROM, disable the ROM BAR and release the address space it was consuming. Store the CPU physical (not virtual) address in the shadow ROM resource, and mark the resource as IORESOURCE_ROM_SHADOW so we use the normal pci_map_rom() path that ioremaps the copy. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c18
-rw-r--r--arch/ia64/sn/kernel/io_init.c17
2 files changed, 16 insertions, 19 deletions
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index 815c29163e1d..231234c8d113 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -430,7 +430,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
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 struct resource *res; 432 struct resource *res;
433 size_t image_size, size; 433 size_t size;
434 434
435 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)) {
436 panic("%s: Failure obtaining pcidev_info for %s\n", 436 panic("%s: Failure obtaining pcidev_info for %s\n",
@@ -444,13 +444,17 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
444 * 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.
445 */ 445 */
446 size = pci_resource_len(dev, PCI_ROM_RESOURCE); 446 size = pci_resource_len(dev, PCI_ROM_RESOURCE);
447 addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE], 447
448 size);
449 image_size = pci_get_rom_size(dev, addr, size);
450 res = &dev->resource[PCI_ROM_RESOURCE]; 448 res = &dev->resource[PCI_ROM_RESOURCE];
451 res->start = (unsigned long) addr; 449
452 res->end = (unsigned long) addr + image_size - 1; 450 pci_disable_rom(dev);
453 res->flags |= IORESOURCE_ROM_BIOS_COPY; 451 if (res->parent)
452 release_resource(res);
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;
454 } 458 }
455 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); 459 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
456} 460}
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 0227e202b6bb..c15a41e2d1f2 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -185,8 +185,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
185 if (size == 0) 185 if (size == 0)
186 continue; 186 continue;
187 187
188 res->start = ioremap(pcidev_info->pdi_pio_mapped_addr[idx], 188 res->start = pcidev_info->pdi_pio_mapped_addr[idx];
189 size + 1);
190 res->end = addr + size; 189 res->end = addr + size;
191 190
192 /* 191 /*
@@ -201,18 +200,12 @@ sn_io_slot_fixup(struct pci_dev *dev)
201 else 200 else
202 insert_resource(&iomem_resource, res); 201 insert_resource(&iomem_resource, res);
203 /* 202 /*
204 * If ROM, set the actual ROM image size, and mark as 203 * If ROM, mark as shadowed in PROM.
205 * shadowed in PROM.
206 */ 204 */
207 if (idx == PCI_ROM_RESOURCE) { 205 if (idx == PCI_ROM_RESOURCE) {
208 size_t image_size; 206 pci_disable_rom(dev);
209 void __iomem *rom; 207 res->flags = IORESOURCE_MEM | IORESOURCE_ROM_SHADOW |
210 208 IORESOURCE_PCI_FIXED;
211 rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
212 size + 1);
213 image_size = pci_get_rom_size(dev, rom, size + 1);
214 res->end = res->start + image_size - 1;
215 res->flags |= IORESOURCE_ROM_BIOS_COPY;
216 } 209 }
217 } 210 }
218 211