Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / kernel / bios32.c
index ab29858..de606df 100644 (file)
@@ -447,9 +447,26 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
        region->end   = res->end - offset;
 }
 
+void __devinit
+pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+                       struct pci_bus_region *region)
+{
+       struct pci_sys_data *root = dev->sysdata;
+       unsigned long offset = 0;
+
+       if (res->flags & IORESOURCE_IO)
+               offset = root->io_offset;
+       if (res->flags & IORESOURCE_MEM)
+               offset = root->mem_offset;
+
+       res->start = region->start + offset;
+       res->end   = region->end + offset;
+}
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_fixup_bus);
 EXPORT_SYMBOL(pcibios_resource_to_bus);
+EXPORT_SYMBOL(pcibios_bus_to_resource);
 #endif
 
 /*
@@ -523,12 +540,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
        int nr, busnr;
 
        for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
-               sys = kmalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
+               sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
                if (!sys)
                        panic("PCI: unable to allocate sys data!");
 
-               memset(sys, 0, sizeof(struct pci_sys_data));
-
                sys->hw      = hw;
                sys->busnr   = busnr;
                sys->swizzle = hw->swizzle;
@@ -574,13 +589,13 @@ void __init pci_common_init(struct hw_pci *hw)
 
                if (!use_firmware) {
                        /*
-                        * Size the bridge windows.
-                        */
+                        * Size the bridge windows.
+                        */
                        pci_bus_size_bridges(bus);
 
                        /*
-                        * Assign resources.
-                        */
+                        * Assign resources.
+                        */
                        pci_bus_assign_resources(bus);
                }
 
@@ -681,7 +696,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        if (mmap_state == pci_mmap_io) {
                return -EINVAL;
        } else {
-               phys = root->mem_offset + (vma->vm_pgoff << PAGE_SHIFT);
+               phys = vma->vm_pgoff + (root->mem_offset >> PAGE_SHIFT);
        }
 
        /*
@@ -690,7 +705,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 
-       if (remap_page_range(vma, vma->vm_start, phys,
+       if (remap_pfn_range(vma, vma->vm_start, phys,
                             vma->vm_end - vma->vm_start,
                             vma->vm_page_prot))
                return -EAGAIN;