]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
MIPS: Better than nothing implementation of PCI mmap to fix X.
authorRalf Baechle <ralf@linux-mips.org>
Tue, 9 Dec 2008 17:58:46 +0000 (17:58 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 9 Dec 2008 21:55:43 +0000 (21:55 +0000)
Certain X11 servers such as the SIS server will only work if PCI mmap is
implemented.  This patch implements PCI mmap but to be on the same side
so close to a release it only supports uncached mappings so performance
will not be optimal for some uses such as framebuffers.

Thanks to Zhang Le <r0bertz@gentoo.org> for the original report and
testing.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/pci.h
arch/mips/pci/pci.c

index 5510c53b7feb7f5b7d2e721b70c763d055f8ef0d..053e4634acee61b78ca8e3d4cd2fded4c4e2aa06 100644 (file)
@@ -79,6 +79,11 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
        /* We don't do dynamic PCI IRQ allocation */
 }
 
+#define HAVE_PCI_MMAP
+
+extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+       enum pci_mmap_state mmap_state, int write_combine);
+
 /*
  * Dynamic DMA mapping stuff.
  * MIPS has everything mapped statically.
index a377e9d2d029be681072a265908ba7f0f9a2dd17..62cae740e250f9d6d42df81897bf3dabe735ede9 100644 (file)
@@ -354,6 +354,30 @@ EXPORT_SYMBOL(PCIBIOS_MIN_IO);
 EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
 #endif
 
+int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+                       enum pci_mmap_state mmap_state, int write_combine)
+{
+       unsigned long prot;
+
+       /*
+        * I/O space can be accessed via normal processor loads and stores on
+        * this platform but for now we elect not to do this and portable
+        * drivers should not do this anyway.
+        */
+       if (mmap_state == pci_mmap_io)
+               return -EINVAL;
+
+       /*
+        * Ignore write-combine; for now only return uncached mappings.
+        */
+       prot = pgprot_val(vma->vm_page_prot);
+       prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
+       vma->vm_page_prot = __pgprot(prot);
+
+       return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+               vma->vm_end - vma->vm_start, vma->vm_page_prot);
+}
+
 char * (*pcibios_plat_setup)(char *str) __devinitdata;
 
 char *__devinit pcibios_setup(char *str)