Module Name: src
Committed By: macallan
Date: Sat Oct 30 05:37:39 UTC 2021
Modified Files:
src/sys/dev/sbus: mgx.c mgxreg.h
Log Message:
actually mmap() the blitter registers when asked to, while there do some
magic number reduction
To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/sbus/mgx.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/sbus/mgxreg.h
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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.17 src/sys/dev/sbus/mgx.c:1.18
--- src/sys/dev/sbus/mgx.c:1.17 Fri Oct 22 19:21:12 2021
+++ src/sys/dev/sbus/mgx.c Sat Oct 30 05:37:39 2021
@@ -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 @@ mgx_putchar_aa(void *cookie, int row, in
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 @@ mgx_putchar_mono(void *cookie, int row,
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 @@ mgx_mmap(void *v, void *vs, off_t offset
}
/*
- * 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 @@ mgx_mmap(void *v, void *vs, off_t offset
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 @@ mgxmmap(dev_t dev, off_t offset, int pro
}
/*
- * 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 @@ mgxmmap(dev_t dev, off_t offset, int pro
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;
}
Index: src/sys/dev/sbus/mgxreg.h
diff -u src/sys/dev/sbus/mgxreg.h:1.5 src/sys/dev/sbus/mgxreg.h:1.6
--- src/sys/dev/sbus/mgxreg.h:1.5 Sat Jul 29 03:29:49 2017
+++ src/sys/dev/sbus/mgxreg.h Sat Oct 30 05:37:39 2021
@@ -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