]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/sn/kernel/io_init.c
sn_pci_controller_fixup() should be __init
[linux-2.6-omap-h63xx.git] / arch / ia64 / sn / kernel / io_init.c
index 6b10e5d284883380a284a1d2616e1aa2ec834fd2..4e1801bad83a7fdc171a90af0ff3c2df4277f62f 100644 (file)
@@ -209,11 +209,11 @@ sn_io_slot_fixup(struct pci_dev *dev)
 
        pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
        if (!pcidev_info)
-               panic("%s: Unable to alloc memory for pcidev_info", __FUNCTION__);
+               panic("%s: Unable to alloc memory for pcidev_info", __func__);
 
        sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
        if (!sn_irq_info)
-               panic("%s: Unable to alloc memory for sn_irq_info", __FUNCTION__);
+               panic("%s: Unable to alloc memory for sn_irq_info", __func__);
 
        /* Call to retrieve pci device information needed by kernel. */
        status = sal_get_pcidev_info((u64) pci_domain_nr(dev),
@@ -259,9 +259,23 @@ sn_io_slot_fixup(struct pci_dev *dev)
                        insert_resource(&ioport_resource, &dev->resource[idx]);
                else
                        insert_resource(&iomem_resource, &dev->resource[idx]);
-               /* If ROM, mark as shadowed in PROM */
-               if (idx == PCI_ROM_RESOURCE)
-                       dev->resource[idx].flags |= IORESOURCE_ROM_BIOS_COPY;
+               /*
+                * If ROM, set the actual ROM image size, and mark as
+                * shadowed in PROM.
+                */
+               if (idx == PCI_ROM_RESOURCE) {
+                       size_t image_size;
+                       void __iomem *rom;
+
+                       rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
+                                     size + 1);
+                       image_size = pci_get_rom_size(rom, size + 1);
+                       dev->resource[PCI_ROM_RESOURCE].end =
+                               dev->resource[PCI_ROM_RESOURCE].start +
+                               image_size - 1;
+                       dev->resource[PCI_ROM_RESOURCE].flags |=
+                                                IORESOURCE_ROM_BIOS_COPY;
+               }
        }
        /* Create a pci_window in the pci_controller struct for
         * each device resource.
@@ -278,7 +292,7 @@ EXPORT_SYMBOL(sn_io_slot_fixup);
  * sn_pci_controller_fixup() - This routine sets up a bus's resources
  *                            consistent with the Linux PCI abstraction layer.
  */
-static void
+static void __init
 sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
 {
        s64 status = 0;