Port-mips archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bus_space_mmap() for IO



Hello,
in sys/arch/mips/mips/bus_space_alignstride_chipdep.c, mmap() for I/O
space is not supported:
__BS(mmap)(void *v, bus_addr_t addr, off_t off, int prot, int flags)
{
#ifdef CHIP_IO

       /* Not supported for I/O space. */
       return (-1);

Is there any reason to not remove this limitation ? I need this for X11
on the lemote fuulong (which has a SIS 315Pro graphic controller).
With the attached patch (and some other changes :) I could get
xf86-video-sis working on the fuulong.

This patch also add PGC_NOCACHE unless BUS_SPACE_MAP_CACHEABLE is requested.
It's probably a bug to always map cacheable here.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: sys/arch/mips/mips/bus_space_alignstride_chipdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/bus_space_alignstride_chipdep.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 bus_space_alignstride_chipdep.c
--- sys/arch/mips/mips/bus_space_alignstride_chipdep.c  27 Jan 2012 18:52:58 
-0000      1.19
+++ sys/arch/mips/mips/bus_space_alignstride_chipdep.c  26 Jan 2014 21:04:34 
-0000
@@ -97,9 +97,10 @@ __KERNEL_RCSID(0, "$NetBSD: bus_space_al
 
 #ifdef CHIP_IO
 #define        __BS(A)         __C(__C(CHIP,_bus_io_),A)
-#endif
-#ifdef CHIP_MEM
+#elif defined(CHIP_MEM)
 #define        __BS(A)         __C(__C(CHIP,_bus_mem_),A)
+#else
+# error must define one of CHIP_IO or CHIP_MEM
 #endif
 
 #if defined(CHIP_LITTLE_ENDIAN)
@@ -612,11 +613,6 @@ __BS(vaddr)(void *v, bus_space_handle_t 
 static paddr_t
 __BS(mmap)(void *v, bus_addr_t addr, off_t off, int prot, int flags)
 {
-#ifdef CHIP_IO
-
-       /* Not supported for I/O space. */
-       return (-1);
-#elif defined(CHIP_MEM)
        paddr_t ret;
        struct mips_bus_space_translation mbst;
        int error;
@@ -633,12 +629,11 @@ __BS(mmap)(void *v, bus_addr_t addr, off
        if (flags & BUS_SPACE_MAP_PREFETCHABLE) {
                ret |= PGC_PREFETCH;
        }
+       if ((flags & BUS_SPACE_MAP_CACHEABLE) == 0)
+               ret |= PGC_NOCACHE;
 #endif 
 
        return (mips_btop(ret));
-#else
-# error must define one of CHIP_IO or CHIP_MEM
-#endif
 }
 
 static void


Home | Main Index | Thread Index | Old Index