MIPS: Better than nothing implementation of PCI mmap to fix X.

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>

+29
+5
arch/mips/include/asm/pci.h
··· 79 79 /* We don't do dynamic PCI IRQ allocation */ 80 80 } 81 81 82 + #define HAVE_PCI_MMAP 83 + 84 + extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 85 + enum pci_mmap_state mmap_state, int write_combine); 86 + 82 87 /* 83 88 * Dynamic DMA mapping stuff. 84 89 * MIPS has everything mapped statically.
+24
arch/mips/pci/pci.c
··· 354 354 EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 355 355 #endif 356 356 357 + int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 358 + enum pci_mmap_state mmap_state, int write_combine) 359 + { 360 + unsigned long prot; 361 + 362 + /* 363 + * I/O space can be accessed via normal processor loads and stores on 364 + * this platform but for now we elect not to do this and portable 365 + * drivers should not do this anyway. 366 + */ 367 + if (mmap_state == pci_mmap_io) 368 + return -EINVAL; 369 + 370 + /* 371 + * Ignore write-combine; for now only return uncached mappings. 372 + */ 373 + prot = pgprot_val(vma->vm_page_prot); 374 + prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED; 375 + vma->vm_page_prot = __pgprot(prot); 376 + 377 + return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 378 + vma->vm_end - vma->vm_start, vma->vm_page_prot); 379 + } 380 + 357 381 char * (*pcibios_plat_setup)(char *str) __devinitdata; 358 382 359 383 char *__devinit pcibios_setup(char *str)