Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus actually mmap() the blitter registers when aske...



details:   https://anonhg.NetBSD.org/src/rev/cf7171a18bae
branches:  trunk
changeset: 990536:cf7171a18bae
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Oct 30 05:37:39 2021 +0000

description:
actually mmap() the blitter registers when asked to, while there do some
magic number reduction

diffstat:

 sys/dev/sbus/mgx.c    |  20 ++++++++++++--------
 sys/dev/sbus/mgxreg.h |   5 ++++-
 2 files changed, 16 insertions(+), 9 deletions(-)

diffs (97 lines):

diff -r 05212caad84f -r cf7171a18bae sys/dev/sbus/mgx.c
--- a/sys/dev/sbus/mgx.c        Fri Oct 29 23:48:50 2021 +0000
+++ b/sys/dev/sbus/mgx.c        Sat Oct 30 05:37:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mgx.c,v 1.17 2021/10/22 19:21:12 macallan Exp $ */
+/*     $NetBSD: mgx.c,v 1.18 2021/10/30 05:37:39 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.17 2021/10/22 19:21:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.18 2021/10/30 05:37:39 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -684,6 +684,8 @@
        uint32_t fg, bg;
        int x, y, wi, he, rv;
 
+if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL) return;
+
        wi = font->fontwidth;
        he = font->fontheight;
 
@@ -731,6 +733,8 @@
        uint32_t fg, bg, scratch = ((sc->sc_stride * sc->sc_height) + 7) & ~7;
        int x, y, wi, he, len, i;
 
+if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL) return;
+
        wi = font->fontwidth;
        he = font->fontheight;
 
@@ -1120,7 +1124,7 @@
        }
 
        /*
-        * Blitter registers at 0x80000000, only in mapped mode.
+        * Blitter registers at 0x00800000, only in mapped mode.
         * Restrict to root, even though I'm fairly sure the DMA engine lives
         * elsewhere ( and isn't documented anyway )
         */
@@ -1132,9 +1136,9 @@
                return -1;
        }
        if ((sc->sc_mode == WSDISPLAYIO_MODE_MAPPED) &&
-           (offset >= 0x80000000) && (offset < 0x80001000)) {
+           (offset >= MGX_BLTOFFSET) && (offset < MGX_BLTOFFSET + 0x1000)) {
                return bus_space_mmap(sc->sc_tag, sc->sc_rpaddr,
-                   offset, prot, BUS_SPACE_MAP_LINEAR);
+                   offset - MGX_BLTOFFSET, prot, BUS_SPACE_MAP_LINEAR);
        }
        return -1;
 }
@@ -1270,7 +1274,7 @@
        }
 
        /*
-        * Blitter registers at 0x80000000, only in mapped mode.
+        * Blitter registers at 0x00800000, only in mapped mode.
         * Restrict to root, even though I'm fairly sure the DMA engine lives
         * elsewhere ( and isn't documented anyway )
         */
@@ -1282,9 +1286,9 @@
                return -1;
        }
        if ((sc->sc_mode == WSDISPLAYIO_MODE_MAPPED) &&
-           (offset >= 0x80000000) && (offset < 0x80001000)) {
+           (offset >= MGX_BLTOFFSET) && (offset < MGX_BLTOFFSET + 0x1000)) {
                return bus_space_mmap(sc->sc_tag, sc->sc_rpaddr,
-                   offset, prot, BUS_SPACE_MAP_LINEAR);
+                   offset - MGX_BLTOFFSET, prot, BUS_SPACE_MAP_LINEAR);
        }
        return -1;
 }
diff -r 05212caad84f -r cf7171a18bae sys/dev/sbus/mgxreg.h
--- a/sys/dev/sbus/mgxreg.h     Fri Oct 29 23:48:50 2021 +0000
+++ b/sys/dev/sbus/mgxreg.h     Sat Oct 30 05:37:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mgxreg.h,v 1.5 2017/07/29 03:29:49 macallan Exp $ */
+/*     $NetBSD: mgxreg.h,v 1.6 2021/10/30 05:37:39 macallan Exp $ */
 
 /* register definitions based on OpenBSD's atxxreg.h: */
 
@@ -30,6 +30,9 @@
 #ifndef MGX_REG_H
 #define MGX_REG_H
 
+#define MGX_FBOFFSET  0x00000000
+#define MGX_BLTOFFSET 0x00800000
+
 #define VGA_BASE 0x3c0
 #define CRTC_INDEX     0x3d4
 #define CRTC_DATA      0x3d5



Home | Main Index | Thread Index | Old Index