CVS commit: src/sys/dev/sbus

2023-07-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 19 10:22:15 UTC 2023

Modified Files:
src/sys/dev/sbus: files.sbus mgx.c

Log Message:
- make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/mgx.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/sbus/files.sbus
diff -u src/sys/dev/sbus/files.sbus:1.44 src/sys/dev/sbus/files.sbus:1.45
--- src/sys/dev/sbus/files.sbus:1.44	Wed May  8 13:40:19 2019
+++ src/sys/dev/sbus/files.sbus	Wed Jul 19 10:22:15 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sbus,v 1.44 2019/05/08 13:40:19 isaki Exp $
+#	$NetBSD: files.sbus,v 1.45 2023/07/19 10:22:15 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -153,6 +153,7 @@ file	dev/sbus/cgtwelve.c		cgtwelve
 # SSB MGX
 defflag 	opt_mgx.h	MGX_DEBUG
 defparam	opt_mgx.h	MGX_DEPTH=8
+defparam	opt_mgx.h	MGX_X_DEPTH=8
 device	mgx: fb, rasops8, rasops32, wsemuldisplaydev, vcons, glyphcache
 attach	mgx at sbus
 file	dev/sbus/mgx.c			mgx

Index: src/sys/dev/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.23 src/sys/dev/sbus/mgx.c:1.24
--- src/sys/dev/sbus/mgx.c:1.23	Wed Jun 28 11:08:47 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jul 19 10:22:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $");
 
 #include 
 #include 
@@ -1055,7 +1055,7 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 	mgx_init_palette(sc);
 	vcons_redraw_screen(ms);
 } else {
-	mgx_setup(sc, 32);
+	mgx_setup(sc, MGX_X_DEPTH);
 	mgx_init_palette(sc);
 }
 			}
@@ -1068,6 +1068,32 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		return mgx_putcmap(sc, (struct wsdisplay_cmap *)data);
 
+	case FBIOGETCMAP:
+#define	p ((struct fbcmap *)data)
+		{
+			struct wsdisplay_cmap c = {
+.index = p->index,
+.count = p->count,
+.red = p->red,
+.green = p->green,
+.blue = p->blue
+			};
+			return mgx_getcmap(sc, );
+		}
+		break;
+	case FBIOPUTCMAP:
+		{
+			struct wsdisplay_cmap c = {
+.index = p->index,
+.count = p->count,
+.red = p->red,
+.green = p->green,
+.blue = p->blue
+			};
+			return mgx_putcmap(sc, );
+		}
+		break;
+#undef p		
 	case WSDISPLAYIO_GCURPOS:
 		{
 			struct wsdisplay_curpos *cp = (void *)data;
@@ -1336,7 +1362,7 @@ mgxopen(dev_t dev, int flags, int mode, 
 	if (sc->sc_mode == WSDISPLAYIO_MODE_MAPPED)
 		return 0;
 	sc->sc_mode = WSDISPLAYIO_MODE_MAPPED;
-	mgx_setup(sc, 32);
+	mgx_setup(sc, MGX_X_DEPTH);
 	mgx_init_palette(sc);
 	return 0;
 }



CVS commit: src/sys/dev/sbus

2023-07-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 19 10:22:15 UTC 2023

Modified Files:
src/sys/dev/sbus: files.sbus mgx.c

Log Message:
- make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/mgx.c

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



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 11:08:47 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.22 src/sys/dev/sbus/mgx.c:1.23
--- src/sys/dev/sbus/mgx.c:1.22	Wed Jun 28 08:53:43 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 11:08:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@ struct mgx_softc {
 	int		sc_fbsize;
 	int		sc_mode;
 	char		sc_name[8];
-	uint32_t	sc_dec;
+	uint32_t	sc_dec, sc_r_dec, sc_r_fg;
 	u_char		sc_cmap_red[256];
 	u_char		sc_cmap_green[256];
 	u_char		sc_cmap_blue[256];
@@ -216,6 +216,24 @@ mgx_write_4(struct mgx_softc *sc, uint32
 	bus_space_write_4(sc->sc_tag, sc->sc_blith, reg, val);
 }
 
+static inline void
+mgx_set_dec(struct mgx_softc *sc, uint32_t dec)
+{
+	if (dec == sc->sc_r_dec) return;
+	sc->sc_r_dec = dec;
+	mgx_wait_engine(sc);
+	mgx_write_4(sc, ATR_DEC, dec);
+}
+
+static inline void
+mgx_set_fg(struct mgx_softc *sc, uint32_t fg)
+{
+	if (fg == sc->sc_r_fg) return;
+	sc->sc_r_fg = fg;
+	mgx_wait_fifo(sc, 1);	
+	mgx_write_4(sc, ATR_FG, fg);
+}
+
 static int
 mgx_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -531,6 +549,8 @@ mgx_setup(struct mgx_softc *sc, int dept
 	int i;
 	uint8_t reg;
 
+	sc->sc_r_dec = 0x;
+	sc->sc_r_fg = 0x12345678;
 	/* wait for everything to go idle */
 	if (mgx_wait_engine(sc) == 0)
 		return;
@@ -643,9 +663,9 @@ mgx_bitblt(void *cookie, int xs, int ys,
 		yd += he - 1;
 		dec |= DEC_DIR_Y_REVERSE;
 	}
-	mgx_wait_fifo(sc, 5);
+	mgx_set_dec(sc, dec);
+	mgx_wait_fifo(sc, 4);
 	mgx_write_1(sc, ATR_ROP, rop);
-	mgx_write_4(sc, ATR_DEC, dec);
 	mgx_write_4(sc, ATR_SRC_XY, (ys << 16) | xs);
 	mgx_write_4(sc, ATR_DST_XY, (yd << 16) | xd);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);
@@ -666,11 +686,10 @@ mgx_rectfill(void *cookie, int x, int y,
 	dec = sc->sc_dec;
 	dec |= (DEC_COMMAND_RECT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT);
-	//mgx_wait_fifo(sc, 5);
-	mgx_wait_engine(sc);
+	mgx_set_dec(sc, dec);
+	mgx_set_fg(sc, col);
+	mgx_wait_fifo(sc, 3);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
-	mgx_write_4(sc, ATR_FG, col);
-	mgx_write_4(sc, ATR_DEC, dec);
 	mgx_write_4(sc, ATR_DST_XY, (y << 16) | x);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);
 }
@@ -754,8 +773,8 @@ mgx_putchar_mono(void *cookie, int row, 
 		return;
 	}
 
-	mgx_wait_fifo(sc, 3);
-	mgx_write_4(sc, ATR_FG, ri->ri_devcmap[fg]);
+	mgx_set_fg(sc, ri->ri_devcmap[fg]);
+	mgx_wait_fifo(sc, 2);
 	mgx_write_4(sc, ATR_BG, ri->ri_devcmap[bg]);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
 
@@ -790,10 +809,10 @@ mgx_putchar_mono(void *cookie, int row, 
 		for (i = 0; i < ri->ri_fontscale; i++)
 			d[i] = s[i];
 	}
-	mgx_wait_fifo(sc, 5);
-	mgx_write_4(sc, ATR_DEC, sc->sc_dec | (DEC_COMMAND_BLT << DEC_COMMAND_SHIFT) |
+	mgx_set_dec(sc, sc->sc_dec | (DEC_COMMAND_BLT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT) |
 	   DEC_SRC_LINEAR | DEC_SRC_CONTIGUOUS | DEC_MONOCHROME);
+	mgx_wait_fifo(sc, 3);
 	mgx_write_4(sc, ATR_SRC_XY, ((scratch & 0xfff000) << 4) | (scratch & 0xfff));
 	mgx_write_4(sc, ATR_DST_XY, (y << 16) | x);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 11:08:47 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/mgx.c

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



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:53:43 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.21 src/sys/dev/sbus/mgx.c:1.22
--- src/sys/dev/sbus/mgx.c:1.21	Wed Jun 28 08:11:52 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 08:53:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $");
 
 #include 
 #include 
@@ -666,7 +666,8 @@ mgx_rectfill(void *cookie, int x, int y,
 	dec = sc->sc_dec;
 	dec |= (DEC_COMMAND_RECT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT);
-	mgx_wait_fifo(sc, 5);
+	//mgx_wait_fifo(sc, 5);
+	mgx_wait_engine(sc);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
 	mgx_write_4(sc, ATR_FG, col);
 	mgx_write_4(sc, ATR_DEC, dec);



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:53:43 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sbus/mgx.c

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



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:11:52 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
fix tpyo - now the glyph cache can actually work...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.20 src/sys/dev/sbus/mgx.c:1.21
--- src/sys/dev/sbus/mgx.c:1.20	Thu Nov 11 19:37:30 2021
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 08:11:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $");
 
 #include 
 #include 
@@ -342,7 +342,7 @@ mgx_attach(device_t parent, device_t sel
 	 * leave some room between visible screen and glyph cache for upload
 	 * buffers used by putchar_mono()
 	 */
-	bsize = (32 * 1024 * sc->sc_stride - 1) / sc->sc_stride;
+	bsize = (32 * 1024 + sc->sc_stride - 1) / sc->sc_stride;
 	glyphcache_init(>sc_gc,
 	sc->sc_height + bsize,
 	(0x40 / sc->sc_stride) - (sc->sc_height + bsize),



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:11:52 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
fix tpyo - now the glyph cache can actually work...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sbus/mgx.c

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



CVS commit: src/sys/dev/sbus

2022-10-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 26 23:46:50 UTC 2022

Modified Files:
src/sys/dev/sbus: spif.c

Log Message:
spif(4): Convert to ttylock/ttyunlock.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/spif.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/sbus/spif.c
diff -u src/sys/dev/sbus/spif.c:1.34 src/sys/dev/sbus/spif.c:1.35
--- src/sys/dev/sbus/spif.c:1.34	Sat Aug  7 16:19:15 2021
+++ src/sys/dev/sbus/spif.c	Wed Oct 26 23:46:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spif.c,v 1.34 2021/08/07 16:19:15 thorpej Exp $	*/
+/*	$NetBSD: spif.c,v 1.35 2022/10/26 23:46:50 riastradh Exp $	*/
 /*	$OpenBSD: spif.c,v 1.12 2003/10/03 16:44:51 miod Exp $	*/
 
 /*
@@ -41,7 +41,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.34 2021/08/07 16:19:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spif.c,v 1.35 2022/10/26 23:46:50 riastradh Exp $");
 
 #include "spif.h"
 #if NSPIF > 0
@@ -354,7 +354,7 @@ stty_open(dev_t dev, int flags, int mode
 	if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
 		return (EBUSY);
 
-	mutex_spin_enter(_lock);
+	ttylock(tp);
 	if (!ISSET(tp->t_state, TS_ISOPEN) && tp->t_wopen == 0) {
 		ttychars(tp);
 		tp->t_iflag = TTYDEF_IFLAG;
@@ -393,12 +393,12 @@ stty_open(dev_t dev, int flags, int mode
 			int error;
 			error = ttysleep(tp, >t_rawcv, true, 0);
 			if (error != 0) {
-mutex_spin_exit(_lock);
+ttyunlock(tp);
 return (error);
 			}
 		}
 	}
-	mutex_spin_exit(_lock);
+	ttyunlock(tp);
 
 	return ((*tp->t_linesw->l_open)(dev, tp));
 }



CVS commit: src/sys/dev/sbus

2022-10-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Oct 26 23:46:50 UTC 2022

Modified Files:
src/sys/dev/sbus: spif.c

Log Message:
spif(4): Convert to ttylock/ttyunlock.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/spif.c

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



CVS commit: src/sys/dev/sbus

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:03:04 UTC 2022

Modified Files:
src/sys/dev/sbus: be.c bwtwo_sbus.c cgsix_sbus.c cgthree_sbus.c
dma_sbus.c if_gem_sbus.c if_hme_sbus.c if_le.c if_le_lebuffer.c
if_le_ledma.c lebuffer.c p9100.c qe.c qec.c tcx.c xbox.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/sbus/be.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/bwtwo_sbus.c \
src/sys/dev/sbus/if_le_lebuffer.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sbus/cgsix_sbus.c \
src/sys/dev/sbus/cgthree_sbus.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/dma_sbus.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/sbus/if_gem_sbus.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sbus/if_hme_sbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/if_le.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/if_le_ledma.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sbus/lebuffer.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/sbus/p9100.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/sbus/qec.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/sbus/tcx.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/xbox.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/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.97 src/sys/dev/sbus/be.c:1.98
--- src/sys/dev/sbus/be.c:1.97	Fri Sep  2 23:48:10 2022
+++ src/sys/dev/sbus/be.c	Sun Sep 25 18:03:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.97 2022/09/02 23:48:10 thorpej Exp $	*/
+/*	$NetBSD: be.c,v 1.98 2022/09/25 18:03:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.97 2022/09/02 23:48:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.98 2022/09/25 18:03:04 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -72,7 +72,6 @@ __KERNEL_RCSID(0, "$NetBSD: be.c,v 1.97 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Index: src/sys/dev/sbus/bwtwo_sbus.c
diff -u src/sys/dev/sbus/bwtwo_sbus.c:1.29 src/sys/dev/sbus/bwtwo_sbus.c:1.30
--- src/sys/dev/sbus/bwtwo_sbus.c:1.29	Sat Sep 19 04:52:44 2009
+++ src/sys/dev/sbus/bwtwo_sbus.c	Sun Sep 25 18:03:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwtwo_sbus.c,v 1.29 2009/09/19 04:52:44 tsutsui Exp $ */
+/*	$NetBSD: bwtwo_sbus.c,v 1.30 2022/09/25 18:03:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,13 +79,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.29 2009/09/19 04:52:44 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.30 2022/09/25 18:03:04 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
Index: src/sys/dev/sbus/if_le_lebuffer.c
diff -u src/sys/dev/sbus/if_le_lebuffer.c:1.29 src/sys/dev/sbus/if_le_lebuffer.c:1.30
--- src/sys/dev/sbus/if_le_lebuffer.c:1.29	Wed May 29 06:21:58 2019
+++ src/sys/dev/sbus/if_le_lebuffer.c	Sun Sep 25 18:03:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_lebuffer.c,v 1.29 2019/05/29 06:21:58 msaitoh Exp $	*/
+/*	$NetBSD: if_le_lebuffer.c,v 1.30 2022/09/25 18:03:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.29 2019/05/29 06:21:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.30 2022/09/25 18:03:04 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_lebuff
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 

Index: src/sys/dev/sbus/cgsix_sbus.c
diff -u src/sys/dev/sbus/cgsix_sbus.c:1.31 src/sys/dev/sbus/cgsix_sbus.c:1.32
--- src/sys/dev/sbus/cgsix_sbus.c:1.31	Wed Mar  9 17:53:39 2022
+++ src/sys/dev/sbus/cgsix_sbus.c	Sun Sep 25 18:03:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $ */
+/*	$NetBSD: cgsix_sbus.c,v 1.32 2022/09/25 18:03:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,14 +34,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.32 2022/09/25 18:03:04 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
Index: src/sys/dev/sbus/cgthree_sbus.c
diff -u src/sys/dev/sbus/cgthree_sbus.c:1.31 src/sys/dev/sbus/cgthree_sbus.c:1.32
--- src/sys/dev/sbus/cgthree_sbus.c:1.31	Thu Apr 21 18:10:57 2016
+++ src/sys/dev/sbus/cgthree_sbus.c	Sun Sep 25 18:03:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgthree_sbus.c,v 1.31 2016/04/21 18:10:57 macallan Exp $ */
+/*	$NetBSD: cgthree_sbus.c,v 1.32 2022/09/25 18:03:04 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,14 +78,13 @@
  

CVS commit: src/sys/dev/sbus

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:03:04 UTC 2022

Modified Files:
src/sys/dev/sbus: be.c bwtwo_sbus.c cgsix_sbus.c cgthree_sbus.c
dma_sbus.c if_gem_sbus.c if_hme_sbus.c if_le.c if_le_lebuffer.c
if_le_ledma.c lebuffer.c p9100.c qe.c qec.c tcx.c xbox.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/sbus/be.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/bwtwo_sbus.c \
src/sys/dev/sbus/if_le_lebuffer.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sbus/cgsix_sbus.c \
src/sys/dev/sbus/cgthree_sbus.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sbus/dma_sbus.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/sbus/if_gem_sbus.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sbus/if_hme_sbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/sbus/if_le.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sbus/if_le_ledma.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/sbus/lebuffer.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/sbus/p9100.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/sbus/qec.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/sbus/tcx.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/xbox.c

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



CVS commit: src/sys/dev/sbus

2022-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  9 17:53:40 UTC 2022

Modified Files:
src/sys/dev/sbus: cgsix_sbus.c

Log Message:
turns out we can map the full amount of VRAM on a 4MB board even when in
double buffer mode

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sbus/cgsix_sbus.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/sbus/cgsix_sbus.c
diff -u src/sys/dev/sbus/cgsix_sbus.c:1.30 src/sys/dev/sbus/cgsix_sbus.c:1.31
--- src/sys/dev/sbus/cgsix_sbus.c:1.30	Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/cgsix_sbus.c	Wed Mar  9 17:53:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgsix_sbus.c,v 1.30 2009/09/17 16:28:12 tsutsui Exp $ */
+/*	$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.30 2009/09/17 16:28:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.31 2022/03/09 17:53:39 macallan Exp $");
 
 #include 
 #include 
@@ -172,7 +172,7 @@ cgsixattach(device_t parent, device_t se
 	 * we need the address of the framebuffer, no matter if we're console or
 	 * not.
 	 */
-	sc->sc_ramsize = prom_getpropint(node, "fbmapped", 1024 * 1024);
+	sc->sc_ramsize = prom_getpropint(node, "vmsize", 1) * 1024 * 1024;
 	if (sbus_bus_map(sa->sa_bustag,
 			sa->sa_slot,
 			sa->sa_offset + CGSIX_RAM_OFFSET,



CVS commit: src/sys/dev/sbus

2022-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  9 17:53:40 UTC 2022

Modified Files:
src/sys/dev/sbus: cgsix_sbus.c

Log Message:
turns out we can map the full amount of VRAM on a 4MB board even when in
double buffer mode

thanks foo bar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/sbus/cgsix_sbus.c

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



CVS commit: src/sys/dev/sbus

2021-11-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 11 19:37:30 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c mgxreg.h

Log Message:
provide an endian-flipped view of the framebuffer via mmap() if we know how
for now this is sparc64 only


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sbus/mgx.c
cvs rdiff -u -r1.6 -r1.7 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.19 src/sys/dev/sbus/mgx.c:1.20
--- src/sys/dev/sbus/mgx.c:1.19	Sun Oct 31 05:31:12 2021
+++ src/sys/dev/sbus/mgx.c	Thu Nov 11 19:37:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.19 2021/10/31 05:31:12 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.19 2021/10/31 05:31:12 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $");
 
 #include 
 #include 
@@ -1112,11 +1112,19 @@ mgx_mmap(void *v, void *vs, off_t offset
 {
 	struct vcons_data *vd = v;
 	struct mgx_softc *sc = vd->cookie;
+	uint32_t flags = BUS_SPACE_MAP_LINEAR;
+
+#ifdef BUS_SPACE_MAP_LITTLE
+	if (offset & MGX_FLIPOFFSET) {
+		offset &= ~MGX_FLIPOFFSET;
+		flags |= BUS_SPACE_MAP_LITTLE;
+	}
+#endif
 
 	/* regular fb mapping at 0 */
 	if ((offset >= 0) && (offset < sc->sc_fbsize)) {
 		return bus_space_mmap(sc->sc_tag, sc->sc_paddr,
-		offset, prot, BUS_SPACE_MAP_LINEAR);
+		offset, prot, flags);
 	}
 
 	/*
@@ -1262,11 +1270,19 @@ paddr_t
 mgxmmap(dev_t dev, off_t offset, int prot)
 {
 	struct mgx_softc *sc = device_lookup_private(_cd, minor(dev));
+	uint32_t flags = BUS_SPACE_MAP_LINEAR;
+
+#ifdef BUS_SPACE_MAP_LITTLE
+	if (offset & MGX_FLIPOFFSET) {
+		offset &= ~MGX_FLIPOFFSET;
+		flags |= BUS_SPACE_MAP_LITTLE;
+	}
+#endif
 
 	/* regular fb mapping at 0 */
 	if ((offset >= 0) && (offset < sc->sc_fbsize)) {
 		return bus_space_mmap(sc->sc_tag, sc->sc_paddr,
-		offset, prot, BUS_SPACE_MAP_LINEAR);
+		offset, prot, flags);
 	}
 
 	/*

Index: src/sys/dev/sbus/mgxreg.h
diff -u src/sys/dev/sbus/mgxreg.h:1.6 src/sys/dev/sbus/mgxreg.h:1.7
--- src/sys/dev/sbus/mgxreg.h:1.6	Sat Oct 30 05:37:39 2021
+++ src/sys/dev/sbus/mgxreg.h	Thu Nov 11 19:37:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgxreg.h,v 1.6 2021/10/30 05:37:39 macallan Exp $ */
+/*	$NetBSD: mgxreg.h,v 1.7 2021/11/11 19:37:30 macallan Exp $ */
 
 /* register definitions based on OpenBSD's atxxreg.h: */
 
@@ -30,8 +30,9 @@
 #ifndef MGX_REG_H
 #define MGX_REG_H
 
-#define MGX_FBOFFSET  0x
-#define MGX_BLTOFFSET 0x0080
+#define MGX_FBOFFSET 	0x
+#define MGX_BLTOFFSET 	0x0080
+#define MGX_FLIPOFFSET	0x0100
 
 #define VGA_BASE 0x3c0
 #define CRTC_INDEX	0x3d4



CVS commit: src/sys/dev/sbus

2021-11-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 11 19:37:30 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c mgxreg.h

Log Message:
provide an endian-flipped view of the framebuffer via mmap() if we know how
for now this is sparc64 only


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sbus/mgx.c
cvs rdiff -u -r1.6 -r1.7 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.



CVS commit: src/sys/dev/sbus

2021-10-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Oct 31 05:31:12 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
remove accidentially committed debug goop
thanks ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.18 src/sys/dev/sbus/mgx.c:1.19
--- src/sys/dev/sbus/mgx.c:1.18	Sat Oct 30 05:37:39 2021
+++ src/sys/dev/sbus/mgx.c	Sun Oct 31 05:31:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.18 2021/10/30 05:37:39 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.19 2021/10/31 05:31:12 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.18 2021/10/30 05:37:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.19 2021/10/31 05:31:12 macallan Exp $");
 
 #include 
 #include 
@@ -684,8 +684,6 @@ 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;
 
@@ -733,8 +731,6 @@ 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;
 



CVS commit: src/sys/dev/sbus

2021-10-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Oct 31 05:31:12 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
remove accidentially committed debug goop
thanks ryo@


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/sbus/mgx.c

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



Re: CVS commit: src/sys/dev/sbus

2021-10-30 Thread Ryo Shimizu


>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

@@ -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;
 

This seems to be a strange indent.
Or debugging code mixed in?

-- 
ryo shimizu


CVS commit: src/sys/dev/sbus

2021-10-29 Thread Michael Lorenz
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.



CVS commit: src/sys/dev/sbus

2021-10-29 Thread Michael Lorenz
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 
-__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 
 #include 
@@ -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 0x8000, only in mapped mode.
+	 * Blitter registers at 0x0080, 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 >= 0x8000) && (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 0x8000, only in mapped mode.
+	 * Blitter registers at 0x0080, 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 >= 0x8000) && (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  0x
+#define MGX_BLTOFFSET 0x0080
+
 #define VGA_BASE 0x3c0
 #define CRTC_INDEX	0x3d4
 #define CRTC_DATA	0x3d5



CVS commit: src/sys/dev/sbus

2021-10-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 29 19:10:14 UTC 2021

Modified Files:
src/sys/dev/sbus: Makefile

Log Message:
install mgxreg.h so we can use it from Xorg


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sbus/Makefile

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/Makefile
diff -u src/sys/dev/sbus/Makefile:1.4 src/sys/dev/sbus/Makefile:1.5
--- src/sys/dev/sbus/Makefile:1.4	Wed Apr 11 19:07:37 2001
+++ src/sys/dev/sbus/Makefile	Fri Oct 29 19:10:14 2021
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.4 2001/04/11 19:07:37 jdolecek Exp $
+#	$NetBSD: Makefile,v 1.5 2021/10/29 19:10:14 macallan Exp $
 
 INCSDIR= /usr/include/dev/sbus
 
 # Only install includes which are used by userland
-INCS=	mbppio.h
+INCS=	mbppio.h mgxreg.h
 
 .include 



CVS commit: src/sys/dev/sbus

2021-10-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 29 19:10:14 UTC 2021

Modified Files:
src/sys/dev/sbus: Makefile

Log Message:
install mgxreg.h so we can use it from Xorg


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sbus/Makefile

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



CVS commit: src/sys/dev/sbus

2021-10-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 22 19:21:13 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
return 0 in mgx_ioctl()::FBIOG*
now Xorg can find us


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sbus/mgx.c

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



CVS commit: src/sys/dev/sbus

2021-10-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 22 19:21:13 UTC 2021

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
return 0 in mgx_ioctl()::FBIOG*
now Xorg can find us


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.16 src/sys/dev/sbus/mgx.c:1.17
--- src/sys/dev/sbus/mgx.c:1.16	Sat Aug  7 16:19:15 2021
+++ src/sys/dev/sbus/mgx.c	Fri Oct 22 19:21:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.16 2021/08/07 16:19:15 thorpej Exp $ */
+/*	$NetBSD: mgx.c,v 1.17 2021/10/22 19:21:12 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.16 2021/08/07 16:19:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.17 2021/10/22 19:21:12 macallan Exp $");
 
 #include 
 #include 
@@ -977,21 +977,21 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 	struct vcons_screen *ms = vd->active;
 
 	switch (cmd) {
-		case WSDISPLAYIO_GTYPE:
-			*(u_int *)data = WSDISPLAY_TYPE_MGX;
-			return 0;
+	case WSDISPLAYIO_GTYPE:
+		*(u_int *)data = WSDISPLAY_TYPE_MGX;
+		return 0;
 
-		case WSDISPLAYIO_GINFO:
-			wdf = (void *)data;
-			wdf->height = sc->sc_height;
-			wdf->width = sc->sc_width;
-			wdf->depth = 8;
-			wdf->cmsize = 256;
-			return 0;
+	case WSDISPLAYIO_GINFO:
+		wdf = (void *)data;
+		wdf->height = sc->sc_height;
+		wdf->width = sc->sc_width;
+		wdf->depth = 8;
+		wdf->cmsize = 256;
+		return 0;
 
 	case FBIOGTYPE:
 		*(struct fbtype *)data = sc->sc_fb.fb_type;
-		break;
+		return 0;
 
 	case FBIOGATTR:
 #define fba ((struct fbgattr *)data)
@@ -1004,104 +1004,105 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 		fba->emu_types[0] = sc->sc_fb.fb_type.fb_type;
 		fba->emu_types[1] = -1;
 #undef fba
-		break;
-		case FBIOGVIDEO:
-		case WSDISPLAYIO_GVIDEO:
-			*(int *)data = sc->sc_video;
-			return 0;
+		return 0;
+	case FBIOGVIDEO:
+	case WSDISPLAYIO_GVIDEO:
+		*(int *)data = sc->sc_video;
+		return 0;
 
-		case WSDISPLAYIO_SVIDEO:
-		case FBIOSVIDEO:
-			mgx_set_video(sc, *(int *)data);
-			return 0;
+	case WSDISPLAYIO_SVIDEO:
+	case FBIOSVIDEO:
+		mgx_set_video(sc, *(int *)data);
+		return 0;
 
-		case WSDISPLAYIO_LINEBYTES:
-			{
-int *ret = (int *)data;
-*ret = sc->sc_stride;
-			}
-			return 0;
+	case WSDISPLAYIO_LINEBYTES:
+		{
+			int *ret = (int *)data;
+			*ret = sc->sc_stride;
+		}
+		return 0;
 
-		case WSDISPLAYIO_SMODE:
+	case WSDISPLAYIO_SMODE:
+		{
+			int new_mode = *(int*)data;
+			if (new_mode != sc->sc_mode)
 			{
-int new_mode = *(int*)data;
-if (new_mode != sc->sc_mode)
+sc->sc_mode = new_mode;
+if (new_mode == WSDISPLAYIO_MODE_EMUL)
 {
-	sc->sc_mode = new_mode;
-	if (new_mode == WSDISPLAYIO_MODE_EMUL)
-	{
-		mgx_setup(sc, MGX_DEPTH);
-		glyphcache_wipe(>sc_gc);
-		mgx_init_palette(sc);
-		vcons_redraw_screen(ms);
-	} else {
-		mgx_setup(sc, 32);
-		mgx_init_palette(sc);
-	}
+	mgx_setup(sc, MGX_DEPTH);
+	glyphcache_wipe(>sc_gc);
+	mgx_init_palette(sc);
+	vcons_redraw_screen(ms);
+} else {
+	mgx_setup(sc, 32);
+	mgx_init_palette(sc);
 }
 			}
-			return 0;
+		}
+		return 0;
 
-		case WSDISPLAYIO_GETCMAP:
-			return mgx_getcmap(sc, (struct wsdisplay_cmap *)data);
+	case WSDISPLAYIO_GETCMAP:
+		return mgx_getcmap(sc, (struct wsdisplay_cmap *)data);
 
-		case WSDISPLAYIO_PUTCMAP:
-			return mgx_putcmap(sc, (struct wsdisplay_cmap *)data);
+	case WSDISPLAYIO_PUTCMAP:
+		return mgx_putcmap(sc, (struct wsdisplay_cmap *)data);
 
-		case WSDISPLAYIO_GCURPOS:
-			{
-struct wsdisplay_curpos *cp = (void *)data;
+	case WSDISPLAYIO_GCURPOS:
+		{
+			struct wsdisplay_curpos *cp = (void *)data;
 
-cp->x = sc->sc_cursor_x;
-cp->y = sc->sc_cursor_y;
-			}
-			return 0;
+			cp->x = sc->sc_cursor_x;
+			cp->y = sc->sc_cursor_y;
+		}
+		return 0;
 
-		case WSDISPLAYIO_SCURPOS:
-			{
-struct wsdisplay_curpos *cp = (void *)data;
+	case WSDISPLAYIO_SCURPOS:
+		{
+			struct wsdisplay_curpos *cp = (void *)data;
 
-sc->sc_cursor_x = cp->x;
-sc->sc_cursor_y = cp->y;
-mgx_set_cursor(sc);
-			}
-			return 0;
+			sc->sc_cursor_x = cp->x;
+			sc->sc_cursor_y = cp->y;
+			mgx_set_cursor(sc);
+		}
+		return 0;
 
-		case WSDISPLAYIO_GCURMAX:
-			{
-struct wsdisplay_curpos *cp = (void *)data;
+	case WSDISPLAYIO_GCURMAX:
+		{
+			struct wsdisplay_curpos *cp = (void *)data;
 
-cp->x = 64;
-cp->y = 64;
-			}
-			return 0;
+			cp->x = 64;
+			cp->y = 64;
+		}
+		return 0;
 
-		case WSDISPLAYIO_SCURSOR:
-			{
-struct wsdisplay_cursor *cursor = (void *)data;
+	case WSDISPLAYIO_SCURSOR:
+		{
+			struct wsdisplay_cursor *cursor = (void *)data;
 
-return mgx_do_cursor(sc, cursor);
-			}
-		case 

CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:26:53 UTC 2010

Modified Files:
src/sys/dev/sbus: p9100.c

Log Message:
fix ancient typo, noticed by mouse@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/p9100.c

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



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:26:53 UTC 2010

Modified Files:
src/sys/dev/sbus: p9100.c

Log Message:
fix ancient typo, noticed by mouse@


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/sbus/p9100.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/sbus/p9100.c
diff -u src/sys/dev/sbus/p9100.c:1.52 src/sys/dev/sbus/p9100.c:1.53
--- src/sys/dev/sbus/p9100.c:1.52	Wed Feb 24 22:38:08 2010
+++ src/sys/dev/sbus/p9100.c	Mon Mar  1 05:26:53 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p9100.c,v 1.52 2010/02/24 22:38:08 dyoung Exp $ */
+/*	$NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.52 2010/02/24 22:38:08 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -256,7 +256,7 @@
 };
 #endif
 
-#define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset == (off  0xff80)) { \
+#define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset != (off  0xff80)) { \
 		sc-sc_junk = bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, \
 		off); \
 		sc-sc_last_offset = off  0xff80; }



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:42:08 UTC 2010

Modified Files:
src/sys/dev/sbus: files.sbus p9100.c

Log Message:
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/p9100.c

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



CVS commit: src/sys/dev/sbus

2010-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  1 05:42:08 UTC 2010

Modified Files:
src/sys/dev/sbus: files.sbus p9100.c

Log Message:
make latching optional.
The SPARCbook docs claim it's necessary but my 3GX happily works without.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/sbus/p9100.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/sbus/files.sbus
diff -u src/sys/dev/sbus/files.sbus:1.34 src/sys/dev/sbus/files.sbus:1.35
--- src/sys/dev/sbus/files.sbus:1.34	Wed Jan 27 21:01:33 2010
+++ src/sys/dev/sbus/files.sbus	Mon Mar  1 05:42:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sbus,v 1.34 2010/01/27 21:01:33 macallan Exp $
+#	$NetBSD: files.sbus,v 1.35 2010/03/01 05:42:08 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -126,6 +126,7 @@
 # Tadpole 3GX/3GS (P9100 -- P Nine One Zero Zero - pnozz)
 defflag	opt_pnozz.h	PNOZZ_DEBUG
 defflag opt_pnozz.h	PNOZZ_EMUL_CG3
+defflag opt_pnozz.h	PNOZZ_USE_LATCH
 device	pnozz: fb, rasops8, bt_dac, wsemuldisplaydev, vcons
 attach	pnozz at sbus
 file	dev/sbus/p9100.c		pnozz needs-flag

Index: src/sys/dev/sbus/p9100.c
diff -u src/sys/dev/sbus/p9100.c:1.53 src/sys/dev/sbus/p9100.c:1.54
--- src/sys/dev/sbus/p9100.c:1.53	Mon Mar  1 05:26:53 2010
+++ src/sys/dev/sbus/p9100.c	Mon Mar  1 05:42:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $ */
+/*	$NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.53 2010/03/01 05:26:53 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -110,8 +110,9 @@
 
 	bus_addr_t	sc_fb_paddr;	/* phys address description */
 	bus_size_t	sc_fb_psize;	/*   for device mmap() */
+#ifdef PNOZZ_USE_LATCH
 	bus_space_handle_t sc_fb_memh;	/*   bus space handle */
-
+#endif
 	volatile uint32_t sc_junk;
 	uint32_t 	sc_mono_width;	/* for setup_mono */
 
@@ -256,10 +257,14 @@
 };
 #endif
 
+#ifdef PNOZZ_USE_LATCH
 #define PNOZZ_LATCH(sc, off) if(sc-sc_last_offset != (off  0xff80)) { \
 		sc-sc_junk = bus_space_read_4(sc-sc_bustag, sc-sc_fb_memh, \
 		off); \
 		sc-sc_last_offset = off  0xff80; }
+#else
+#define PNOZZ_LATCH(a, b)
+#endif
 
 /*
  * Match a p9100.
@@ -338,7 +343,9 @@
 	 * P9100 - all register accesses need to be 'latched in' whenever we
 	 * go to another 0x80 aligned 'page' by reading the framebuffer at the
 	 * same offset
+	 * XXX apparently the latter isn't true - my SP3GX works fine without
 	 */
+#ifdef PNOZZ_USE_LATCH
 	if (fb-fb_pixels == NULL) {
 		if (sbus_bus_map(sc-sc_bustag,
 		sa-sa_reg[2].oa_space,
@@ -354,6 +361,7 @@
 	} else {
 		sc-sc_fb_memh = (bus_space_handle_t) fb-fb_pixels;
 	}
+#endif
 	sc-sc_width = prom_getpropint(node, width, 800);
 	sc-sc_height = prom_getpropint(node, height, 600);
 	sc-sc_depth = prom_getpropint(node, depth, 8)  3;
@@ -1217,9 +1225,10 @@
 	ri-ri_stride = sc-sc_stride;
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
+#ifdef PNOZZ_USE_LATCH
 	ri-ri_bits = bus_space_vaddr(sc-sc_bustag, sc-sc_fb_memh);
-
 	DPRINTF(addr: %08lx\n,(ulong)ri-ri_bits);
+#endif
 
 	rasops_init(ri, sc-sc_height/8, sc-sc_width/8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;



CVS commit: src/sys/dev/sbus

2010-02-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 18 02:21:39 UTC 2010

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
Abort setup when we find no audio codec to avoid crashing later on with
ISDN-only cards.
Should fix PR41055


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sbus/dbri.c

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



CVS commit: src/sys/dev/sbus

2010-01-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 27 21:01:33 UTC 2010

Modified Files:
src/sys/dev/sbus: files.sbus

Log Message:
tcx doesn't use bt_dac


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sbus/files.sbus

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



CVS commit: src/sys/dev/sbus

2010-01-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 14 02:20:08 UTC 2010

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
set a delta value for the master channel so volume control via PMF works


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/sbus/dbri.c

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



CVS commit: src/sys/dev/sbus

2010-01-08 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Jan  8 20:01:21 UTC 2010

Modified Files:
src/sys/dev/sbus: dbri.c p9100.c

Log Message:
Expand PMF_FN_* macros.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sbus/p9100.c

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



CVS commit: src/sys/dev/sbus

2010-01-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jan  5 04:17:49 UTC 2010

Modified Files:
src/sys/dev/sbus: zx.c

Log Message:
fix off by one error in zx_fillrect()
while there, use vcons_replay_msgbuf()


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/sbus/zx.c

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



CVS commit: src/sys/dev/sbus

2010-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  2 01:43:42 UTC 2010

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
convert to pmf


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sbus/dbri.c

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



Re: CVS commit: src/sys/dev/sbus

2009-09-08 Thread Izumi Tsutsui
sbus_establish() should take device_t self for the device itself,
not device_t parent even if sbus is grandparent of the device,
otherwise (*sd_reset)() callbacks will be called with an wrong device_t.
Even in such case, sbus_establish() looks for an sbus though device tree.
XXX: (*sd_reset)() isn't called anyway, and these stuff seems really bogus.

 i think you're right.  can you just delete all this sbusreset() code?

I wonder why sbus_establish() and struct sbus_dev were implemented.

I guess we can remove sbusreset() and (*sd_reset)() stuff safely,
but other members in struct sbusdev are used only in
sbus/if_le.c to see unattached lebuffer (I don't think it worked
as expected due to the bug mentioned in the log, though), so
it might be better to remove whole sbus_establish() stuff if possible.

Anyway, I'll leave them for now since they are harmless.
---
Izumi Tsutsui


Re: CVS commit: src/sys/dev/sbus

2009-03-27 Thread Andrew Doran
On Fri, Mar 27, 2009 at 12:25:41PM +, Izumi Tsutsui wrote:

 Log Message:
 Use bus_space(9) to access registers.  SETREG() macro using bogus casts
 against packed structures doesn't work on gcc4. (no character on screen)
 See also:
 http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html

It has been a long time, but from what I remember SETREG() was an invention
of mine to work around either a compiler or code bug. Maybe bus_space does
the same.



Re: CVS commit: src/sys/dev/sbus

2009-03-27 Thread Michael

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello,

On Mar 27, 2009, at 9:07 AM, Izumi Tsutsui wrote:


a...@netbsd.org wrote:


On Fri, Mar 27, 2009 at 12:25:41PM +, Izumi Tsutsui wrote:


Log Message:
Use bus_space(9) to access registers.  SETREG() macro using bogus  
casts
against packed structures doesn't work on gcc4. (no character on  
screen)

See also:
http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html


It has been a long time, but from what I remember SETREG() was an  
invention
of mine to work around either a compiler or code bug. Maybe  
bus_space does

the same.


I'm not sure if it's a compiler bug or not, but SETREG() doesn't work
on gcc4 while it's confirmed working on gcc3.
(as the noted in the above mail, it looks generating byte access code)

Removing __packed might also help, but bus_space(9) just works
and it's a right way to go, I think.


I strongly agree - I've been trying to get our zx driver to work for a  
while but got sidetracked by other stuff ( mostly sgimips-related ) -  
thanks for doing this. Writing an accelerated Xorg driver is next on  
my todo list ( after adding wscons support to zx )


have fun
Michael

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBSc03pspnzkX8Yg2nAQKKxQf/YUc7aXT66Jd1Vfe4l3eli7+j3IM1DDmY
qPmTLfEMNXfEsSnNAG3P3pWGSLPtRuq/miQDNe8VRhT9SEuiULTt30VX/BzNEg73
PxrQ1gd+59UzeETijZd+dK5ggvGvXuHoSqOB65J6f/eqxvOcZwL26FdrIDQ0OPqg
eOj7AzgyJZ4Z9NmqTDit8PsgTLxNoG1BQbuhqDynw8e4y0IKYZ52yoNRuLDwoUzl
Y7xURm+BXLhQuRTrjWs8UFw6Y+dIikLihOSAh0f0T3qXQcnrXc1fNGh+eHJOzEmG
OWsYS6Dx3j1QB+BDEixzg5/2yFoD8YZhgbqy5lpP7scLZjhzahWUQg==
=xXJG
-END PGP SIGNATURE-


Re: CVS commit: src/sys/dev/sbus

2009-03-27 Thread Andrew Doran
On Fri, Mar 27, 2009 at 04:31:33PM -0400, Michael wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hello,
 
 On Mar 27, 2009, at 9:07 AM, Izumi Tsutsui wrote:
 
 a...@netbsd.org wrote:
 
 On Fri, Mar 27, 2009 at 12:25:41PM +, Izumi Tsutsui wrote:
 
 Log Message:
 Use bus_space(9) to access registers.  SETREG() macro using bogus  
 casts
 against packed structures doesn't work on gcc4. (no character on  
 screen)
 See also:
 http://mail-index.NetBSD.org/port-sparc/2003/11/11/0002.html
 
 It has been a long time, but from what I remember SETREG() was an  
 invention
 of mine to work around either a compiler or code bug. Maybe  
 bus_space does
 the same.
 
 I'm not sure if it's a compiler bug or not, but SETREG() doesn't work
 on gcc4 while it's confirmed working on gcc3.
 (as the noted in the above mail, it looks generating byte access code)
 
 Removing __packed might also help, but bus_space(9) just works
 and it's a right way to go, I think.
 
 I strongly agree - I've been trying to get our zx driver to work for a  
 while but got sidetracked by other stuff ( mostly sgimips-related ) -  
 thanks for doing this. Writing an accelerated Xorg driver is next on  
 my todo list ( after adding wscons support to zx )

It worked for the console when I checked it in (haven't touched it since).
I think I remember now what SETREG() might have been about. The compiler
was generating sub-word writes, or something along those lines.