Module Name:    src
Committed By:   skrll
Date:           Sun Mar  7 10:02:34 UTC 2021

Modified Files:
        src/sys/dev/ic: sti.c

Log Message:
Use bus_space_mmap in sti_mmap.  This makes X on sti for my B160L nearly
work (the colour map is somewhat wrong), but at least the machine doesn't
wedge.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/ic/sti.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.26 src/sys/dev/ic/sti.c:1.27
--- src/sys/dev/ic/sti.c:1.26	Thu Mar  4 20:30:39 2021
+++ src/sys/dev/ic/sti.c	Sun Mar  7 10:02:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.26 2021/03/04 20:30:39 skrll Exp $	*/
+/*	$NetBSD: sti.c,v 1.27 2021/03/07 10:02:33 skrll Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.26 2021/03/04 20:30:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.27 2021/03/07 10:02:33 skrll Exp $");
 
 #include "wsdisplay.h"
 
@@ -1171,9 +1171,7 @@ paddr_t
 sti_mmap(void *v, void *vs, off_t offset, int prot)
 {
 	struct sti_screen *scr = (struct sti_screen *)v;
-#if 0
 	struct sti_rom *rom = scr->scr_rom;
-#endif
 	paddr_t pa;
 
 	if ((offset & PAGE_MASK) != 0)
@@ -1182,12 +1180,14 @@ sti_mmap(void *v, void *vs, off_t offset
 	if (offset < 0 || offset >= scr->fblen)
 		return -1;
 
-#if 0 /* XXX not all platforms provide bus_space_mmap() yet */
+	if (scr->scr_wsmode != WSDISPLAYIO_MODE_DUMBFB)
+		return -1;
+
 	pa = bus_space_mmap(rom->memt, scr->fbaddr, offset, prot,
 	    BUS_SPACE_MAP_LINEAR);
-#else
-	pa = scr->fbaddr + offset;
-#endif
+
+	if (pa == -1)
+		pa = scr->fbaddr + offset;
 
 	return pa;
 }

Reply via email to