]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/pci/i386.c
Merge branch 'for_rmk' of git://git.mnementh.co.uk/linux-2.6-im
[linux-2.6-omap-h63xx.git] / arch / x86 / pci / i386.c
index 94f6c73a53d0aae6ac048668ea6b06a0a1f370d0..8791fc55e7154484700cbd2253de3026053b96ae 100644 (file)
@@ -128,10 +128,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
                                pr = pci_find_parent_resource(dev, r);
                                if (!r->start || !pr ||
                                    request_resource(pr, r) < 0) {
-                                       printk(KERN_ERR "PCI: Cannot allocate "
-                                               "resource region %d "
-                                               "of bridge %s\n",
-                                               idx, pci_name(dev));
+                                       dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx);
                                        /*
                                         * Something is wrong with the region.
                                         * Invalidate the resource to prevent
@@ -166,15 +163,13 @@ static void __init pcibios_allocate_resources(int pass)
                        else
                                disabled = !(command & PCI_COMMAND_MEMORY);
                        if (pass == disabled) {
-                               DBG("PCI: Resource %08lx-%08lx "
-                                   "(f=%lx, d=%d, p=%d)\n",
-                                   r->start, r->end, r->flags, disabled, pass);
+                               dev_dbg(&dev->dev, "resource %#08llx-%#08llx (f=%lx, d=%d, p=%d)\n",
+                                       (unsigned long long) r->start,
+                                       (unsigned long long) r->end,
+                                       r->flags, disabled, pass);
                                pr = pci_find_parent_resource(dev, r);
                                if (!pr || request_resource(pr, r) < 0) {
-                                       printk(KERN_ERR "PCI: Cannot allocate "
-                                               "resource region %d "
-                                               "of device %s\n",
-                                               idx, pci_name(dev));
+                                       dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx);
                                        /* We'll assign a new address later */
                                        r->end -= r->start;
                                        r->start = 0;
@@ -187,8 +182,7 @@ static void __init pcibios_allocate_resources(int pass)
                                /* Turn the ROM off, leave the resource region,
                                 * but keep it unregistered. */
                                u32 reg;
-                               DBG("PCI: Switching off ROM of %s\n",
-                                       pci_name(dev));
+                               dev_dbg(&dev->dev, "disabling ROM\n");
                                r->flags &= ~IORESOURCE_ROM_ENABLE;
                                pci_read_config_dword(dev,
                                                dev->rom_base_reg, &reg);
@@ -257,8 +251,7 @@ void pcibios_set_master(struct pci_dev *dev)
                lat = pcibios_max_latency;
        else
                return;
-       printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n",
-               pci_name(dev), lat);
+       dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
        pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
 }
 
@@ -280,6 +273,7 @@ static void pci_track_mmap_page_range(struct vm_area_struct *vma)
 static struct vm_operations_struct pci_mmap_ops = {
        .open  = pci_track_mmap_page_range,
        .close = pci_unmap_page_range,
+       .access = generic_access_phys,
 };
 
 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
@@ -299,10 +293,15 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                return -EINVAL;
 
        prot = pgprot_val(vma->vm_page_prot);
-       if (pat_wc_enabled && write_combine)
+       if (pat_enabled && write_combine)
                prot |= _PAGE_CACHE_WC;
-       else if (boot_cpu_data.x86 > 3)
-               prot |= _PAGE_CACHE_UC;
+       else if (pat_enabled || boot_cpu_data.x86 > 3)
+               /*
+                * ioremap() and ioremap_nocache() defaults to UC MINUS for now.
+                * To avoid attribute conflicts, request UC MINUS here
+                * aswell.
+                */
+               prot |= _PAGE_CACHE_UC_MINUS;
 
        vma->vm_page_prot = __pgprot(prot);
 
@@ -319,9 +318,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                 * - request is uncached, return cannot be write-combine
                 * - request is write-combine, return cannot be write-back
                 */
-               if ((flags == _PAGE_CACHE_UC &&
-                    (new_flags == _PAGE_CACHE_WB ||
-                     new_flags == _PAGE_CACHE_WC)) ||
+               if ((flags == _PAGE_CACHE_UC_MINUS &&
+                    (new_flags == _PAGE_CACHE_WB)) ||
                    (flags == _PAGE_CACHE_WC &&
                     new_flags == _PAGE_CACHE_WB)) {
                        free_memtype(addr, addr+len);
@@ -330,7 +328,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
                flags = new_flags;
        }
 
-       if (vma->vm_pgoff <= max_pfn_mapped &&
+       if (((vma->vm_pgoff < max_low_pfn_mapped) ||
+            (vma->vm_pgoff >= (1UL<<(32 - PAGE_SHIFT)) &&
+             vma->vm_pgoff < max_pfn_mapped)) &&
            ioremap_change_attr((unsigned long)__va(addr), len, flags)) {
                free_memtype(addr, addr + len);
                return -EINVAL;