CVS commit: src/sys/arch/hppa/dev

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.9 src/sys/arch/hppa/dev/hyperfb.c:1.10
--- src/sys/arch/hppa/dev/hyperfb.c:1.9	Mon Aug  5 09:45:05 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Tue Aug  6 07:34:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -220,10 +220,12 @@ hyperfb_setup_fb(struct hyperfb_softc *s
 	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
-		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrByte, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
@@ -237,7 +239,8 @@ hyperfb_setup_fb24(struct hyperfb_softc 
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_10, 
+	BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
@@ -852,7 +855,8 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	if (sc->sc_24bit) {
 		/* overlay transparency */
 		hyperfb_wait_fifo(sc, 7);
-		hyperfb_write4(sc, NGLE_REG_11, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_11, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
 		hyperfb_write4(sc, NGLE_REG_3, 0x17f0);
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
@@ -992,7 +996,8 @@ hyperfb_rectfill(struct hyperfb_softc *s
 		 */
 		if (sc->sc_hwmode != HW_SFILL) {
 			hyperfb_wait(sc);
-			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			hyperfb_write4(sc, NGLE_REG_10, 
+		 	 BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 			sc->sc_hwmode = HW_SFILL;
 		}
 		bg &= 0xff;
@@ -1051,7 +1056,8 @@ hyperfb_bitblt(void *cookie, int xs, int
 
 	if (sc->sc_hwmode != HW_BLIT) {
 		hyperfb_wait(sc);
-		hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 		sc->sc_hwmode = HW_BLIT;
 	}



CVS commit: src/sys/arch/hppa/dev

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.11 src/sys/dev/ic/stireg.h:1.12
--- src/sys/dev/ic/stireg.h:1.11	Mon Aug  5 09:43:37 2024
+++ src/sys/dev/ic/stireg.h	Tue Aug  6 07:26:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.12 2024/08/06 07:26:56 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -644,23 +644,28 @@ STI_DEP(util);
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
+	/* FCCC CSSS AAAJ      */
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSD??BF */
+	/* LSSD       ??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	FractDcd	1	/* Pixel data is Fractional 8-8-8 */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
 #define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Otc24	7	/* NGLE uses this for 24bit blits */
 #define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
 #define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrByte	3	/* byte access? Used by NGLE for direct fb */
 #define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
 #define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINcursor	0x7	/* cursor bitmap on EG */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	BINcmap	0xf	/* colour map(s) */
 #define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc



CVS commit: src/sys/dev/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/dev

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.8 src/sys/arch/hppa/dev/hyperfb.c:1.9
--- src/sys/arch/hppa/dev/hyperfb.c:1.8	Thu Aug  1 00:20:22 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Aug  5 09:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -1268,7 +1268,8 @@ hyperfb_move_cursor(struct hyperfb_softc
 	if (y < 0) y = 0x1000 - y;
 	pos = (x << 16) | y;
 	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
-	hyperfb_wait(sc);
+	hyperfb_wait_fifo(sc, 2);
+	hyperfb_write4(sc, NGLE_REG_28, 0);
 	hyperfb_write4(sc, NGLE_REG_29, pos);
 }
 



CVS commit: src/sys/arch/hppa/dev

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.10 src/sys/dev/ic/stireg.h:1.11
--- src/sys/dev/ic/stireg.h:1.10	Wed Jul 31 09:54:13 2024
+++ src/sys/dev/ic/stireg.h	Mon Aug  5 09:43:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -672,11 +672,11 @@ STI_DEP(util);
 #define	MaskOtc	0	/* Mask contains Object Count valid bits */
 
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
-#define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480	/* LUT blt src? */
-#define	NGLE_REG_3		0x0004a0	/* palette index */
-#define	NGLE_REG_22		0x0005a0
-#define	NGLE_REG_23		0x0005c0
+#define	NGLE_REG_28		0x000420	/* HCRX video bus access */
+#define	NGLE_REG_2		0x000480	/* BINC src */
+#define	NGLE_REG_3		0x0004a0	/* BINC dst */
+#define	NGLE_REG_22		0x0005a0	/* BINC dst mask */
+#define	NGLE_REG_23		0x0005c0	/* BINC data */
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
 #define	NGLE_REG_6		0x000800	/* rectfill XY */
@@ -691,19 +691,20 @@ STI_DEP(util);
 #define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
-#define	NGLE_REG_36		0x018014
+#define	NGLE_REG_36		0x018014	/* bg colour? */
 #define	NGLE_REG_13		0x018018	/* image planemask */
 #define	NGLE_REG_14		0x01801c	/* raster op */
-#define	NGLE_REG_15		0x20
+#define	NGLE_REG_15		0x20	/* 'busy dodger' idle */
+	#define DODGER_IDLE	0x1000	/* or 0x1, likely tpyo */
 #define	NGLE_REG_15b0		0x20	/* busy register */
 #define	NGLE_REG_16		0x24
-#define	NGLE_REG_16b1		0x25
-#define	NGLE_REG_16b3		0x27
+#define	NGLE_REG_16b1		0x25	/* setup copyarea */
+#define	NGLE_REG_16b3		0x27	/* ROM table index on CRX */
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
 #define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
-#define	NGLE_REG_19		0x200200
+#define	NGLE_REG_19		0x200200	/* artist sprite size */
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
@@ -722,11 +723,11 @@ STI_DEP(util);
 	#define LBC_TYPE_OVERLAY	0xc000
 	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
-#define	NGLE_REG_42		0x210028
-#define	NGLE_REG_43		0x21002c
-#define	NGLE_REG_44		0x210030
-#define	NGLE_REG_45		0x210034
-#define	NGLE_REG_32		0x21003c
+#define	NGLE_REG_42		0x210028	/* these seem to control */
+#define	NGLE_REG_43		0x21002c	/* how the 24bit planes */
+#define	NGLE_REG_44		0x210030	/* are displayed on HCRX - */
+#define	NGLE_REG_45		0x210034	/* no info on bits */
+#define	NGLE_REG_32		0x21003c	/* HCRX plane enable */ 
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
 	#define HCRX_VIDEO_ENABLE	0x0A00
 #define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */



CVS commit: src/sys/dev/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.16 src/sys/arch/hppa/dev/gftfb.c:1.17
--- src/sys/arch/hppa/dev/gftfb.c:1.16	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.17 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -868,7 +868,7 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < sc->sc_scr.fblen) {
+	if (offset >= 0 && offset < sc->sc_scr.fblen) {
 		/* framebuffer */
 		pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset,
 		prot, BUS_SPACE_MAP_LINEAR);

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.7 src/sys/arch/hppa/dev/hyperfb.c:1.8
--- src/sys/arch/hppa/dev/hyperfb.c:1.7	Wed Jul 31 16:38:00 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -659,7 +659,8 @@ hyperfb_mmap(void *v, void *vs, off_t of
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < 2048 * 1024) {
+	/* GSC framebuffer space is 16MB */
+	if (offset >= 0 && offset < 0x100) {
 		/* framebuffer */
 		pa = bus_space_mmap(sc->sc_iot, sc->sc_base + HCRX_FBOFFSET,
 		offset, prot,



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.5 src/sys/arch/hppa/dev/hyperfb.c:1.6
--- src/sys/arch/hppa/dev/hyperfb.c:1.5	Wed Jul 24 08:34:03 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 31 09:56:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -98,9 +98,10 @@ struct	hyperfb_softc {
 	u_char sc_cmap_blue[256];
 	kmutex_t sc_hwlock;
 	uint32_t sc_hwmode;
-#define HW_FB	0
-#define HW_FILL	1
-#define HW_BLIT	2
+#define HW_FB		0
+#define HW_FILL		1
+#define HW_BLIT		2
+#define HW_SFILL	3
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -210,12 +211,18 @@ static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
+	/*
+	 * turns out the plane mask is applied to everything, including
+	 * direct framebuffer writes, so make sure we always set it
+	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
 		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
-	} else
+	} else {
 		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0xff);
+	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
@@ -479,7 +486,6 @@ hyperfb_attach(device_t parent, device_t
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
 
 	hyperfb_setup_fb(sc);
-
 }
 
 static void
@@ -957,6 +963,7 @@ hyperfb_rectfill(struct hyperfb_softc *s
 	 * less than 32 pixels wide
 	 */
 	if (wi < 32) {
+#if 0
 		int i;
 		uint8_t *ptr = (uint8_t *)sc->sc_fb + (y << 11) + x;
 
@@ -967,6 +974,37 @@ hyperfb_rectfill(struct hyperfb_softc *s
 			memset(ptr, bg, wi);
 			ptr += 2048;
 		}
+#else
+		/*
+		 * instead of memset() we abuse the blitter - set / clear the
+		 * planes we want, select colour by planemask, do two passes
+		 * where necessary ( as in, anything not black or white )
+		 */ 
+		if (sc->sc_hwmode != HW_SFILL) {
+			hyperfb_wait(sc);
+			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			sc->sc_hwmode = HW_SFILL;
+		}
+		bg &= 0xff;
+		hyperfb_wait_fifo(sc, 2);
+		hyperfb_write4(sc, NGLE_REG_24, (x << 16) | y);
+		if (bg != 0) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopSet, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+		if (bg != 0xff) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopClr, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg ^ 0xff);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+#endif
 		return;
 	}
 	if (sc->sc_hwmode != HW_FILL) {



CVS commit: src/sys/arch/hppa/dev

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.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/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.9 src/sys/dev/ic/stireg.h:1.10
--- src/sys/dev/ic/stireg.h:1.9	Wed Jul 17 08:28:22 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 31 09:54:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -648,7 +648,7 @@ STI_DEP(util);
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
+	/* LSSD??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
@@ -661,8 +661,10 @@ STI_DEP(util);
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc
+#define	RopSet 	0xf
 #define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
 #define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
 #define	DataDynamic	0	/* Data register reloaded by direct access */



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.52
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51	Mon Jul 22 23:10:46 2024
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Mon Jul 29 05:32:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $");
 #endif /* not lint */
 
 #include 
@@ -625,6 +625,9 @@ _rtld_relocate_plt_lazy(Obj_Entry *obj)
 		Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 		Elf_Addr func_pc, func_sl;
 
+		/* skip R_PARISC_NONE entries */
+		if (ELF_R_TYPE(rela->r_info) == R_TYPE(NONE)) continue;
+			
 		assert(ELF_R_TYPE(rela->r_info) == R_TYPE(IPLT));
 
 		/*



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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



CVS commit: src/sys/arch/hppa/dev

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/arch/hppa/dev

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.4 src/sys/arch/hppa/dev/hyperfb.c:1.5
--- src/sys/arch/hppa/dev/hyperfb.c:1.4	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 24 08:34:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -113,7 +113,8 @@ extern struct cfdriver hyperfb_cd;
 CFATTACH_DECL_NEW(hyperfb, sizeof(struct hyperfb_softc), hyperfb_match,
 hyperfb_attach, NULL, NULL);
 
-void 		hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb24(struct hyperfb_softc *);
 static void 	hyperfb_init_screen(void *, struct vcons_screen *,
 			int, long *);
 static int	hyperfb_ioctl(void *, void *, u_long, void *, int,
@@ -205,13 +206,31 @@ hyperfb_wait_fifo(struct hyperfb_softc *
 	} while (reg < slots);
 }
 
-void
+static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+	} else
+		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	hyperfb_wait(sc);
+	hyperfb_write1(sc, NGLE_REG_16b1, 1);
+	sc->sc_hwmode = HW_FB;
+}
+
+static inline void
+hyperfb_setup_fb24(struct hyperfb_softc *sc)
+{
+
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
 	sc->sc_hwmode = HW_FB;
@@ -367,6 +386,9 @@ hyperfb_attach(device_t parent, device_t
 		eaio_l2(PCXL2_ACCEL_IO_ADDR2MASK(ca->ca_hpa));
 #endif /* HP7300LC_CPU */
 
+	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
+	sc->sc_locked = 0;
+
 	hyperfb_setup(sc);
 	hyperfb_setup_fb(sc);
 
@@ -382,8 +404,6 @@ hyperfb_attach(device_t parent, device_t
 
 	sc->sc_screens[0] = >sc_defaultscreen_descr;
 	sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
-	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
-	sc->sc_locked = 0;
 
 	vcons_init(>vd, sc, >sc_defaultscreen_descr,
 	_accessops);
@@ -458,6 +478,8 @@ hyperfb_attach(device_t parent, device_t
 
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
 
+	hyperfb_setup_fb(sc);
+
 }
 
 static void
@@ -513,7 +535,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ENODEV;
 		wdf = (void *)data;
 		wdf->height = ms->scr_ri.ri_height;
-		wdf->width = ms->scr_ri.ri_width;
+		wdf->width = sc->sc_24bit ? ms->scr_ri.ri_width << 2 : ms->scr_ri.ri_width;
 		wdf->depth = ms->scr_ri.ri_depth;
 		wdf->cmsize = 256;
 		return 0;
@@ -526,7 +548,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 		return hyperfb_putcmap(sc,
 		(struct wsdisplay_cmap *)data);
 	case WSDISPLAYIO_LINEBYTES:
-		*(u_int *)data = 2048;
+		*(u_int *)data = sc->sc_24bit ? 8192 : 2048;
 		return 0;
 
 	case WSDISPLAYIO_SMODE: {
@@ -544,6 +566,11 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 (ms->scr_defattr >> 16) & 0xff]);
 vcons_redraw_screen(ms);
 hyperfb_set_video(sc, 1);
+			} else {
+hyperfb_setup(sc);
+hyperfb_rectfill(sc, 0, 0, sc->sc_width,
+sc->sc_height, 0xff);
+hyperfb_setup_fb24(sc);
 			}
 		}
 		}
@@ -556,6 +583,19 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			ret = wsdisplayio_get_fbinfo(>scr_ri, fbi);
 			fbi->fbi_fbsize = sc->sc_height * 2048;
+			if (sc->sc_24bit) {
+fbi->fbi_stride = 8192;
+fbi->fbi_bitsperpixel = 32;
+fbi->fbi_pixeltype = WSFB_RGB;
+fbi->fbi_subtype.fbi_rgbmasks.red_offset = 16;
+fbi->fbi_subtype.fbi_rgbmasks.red_size = 8;
+fbi->fbi_subtype.fbi_rgbmasks.green_offset = 8;
+fbi->fbi_subtype.fbi_rgbmasks.green_size = 8;
+		

CVS commit: src/sys/dev/pckbport

2024-07-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jul 19 04:48:13 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
hw.synaptics.aux_mid_button_scroll translates vertical movements
of an aux device (like a trackpoint) into a scroll event when
the middle mouse button is pressed.

Make this work with either the middle mouse button of the main
device (buttonmask 0x02) or the middle mouse button of the aux
device (buttonmask 0x40).

Fixes PR 58435.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pckbport/synaptics.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/pckbport

2024-07-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jul 19 04:48:13 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
hw.synaptics.aux_mid_button_scroll translates vertical movements
of an aux device (like a trackpoint) into a scroll event when
the middle mouse button is pressed.

Make this work with either the middle mouse button of the main
device (buttonmask 0x02) or the middle mouse button of the aux
device (buttonmask 0x40).

Fixes PR 58435.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.83 src/sys/dev/pckbport/synaptics.c:1.84
--- src/sys/dev/pckbport/synaptics.c:1.83	Thu Apr 18 17:35:53 2024
+++ src/sys/dev/pckbport/synaptics.c	Fri Jul 19 04:48:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.84 2024/07/19 04:48:13 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.84 2024/07/19 04:48:13 mlelstv Exp $");
 
 #include 
 #include 
@@ -1701,7 +1701,7 @@ pms_synaptics_passthrough(struct pms_sof
 		 * scrolling.
 		 */
 		if (synaptics_aux_mid_button_scroll &&
-		dy && (psc->buttons & 0x2)) {
+		dy && (psc->buttons & 0x42)) {
 			wsmouse_precision_scroll(psc->sc_wsmousedev, dx, dy);
 		} else {
 			buttons = (psc->buttons & 0x1f) | ((psc->buttons >> 5) & 0x7);



CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.15 src/sys/arch/hppa/dev/gftfb.c:1.16
--- src/sys/arch/hppa/dev/gftfb.c:1.15	Fri Jul 12 08:45:05 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -159,31 +159,6 @@ struct wsdisplay_accessops gftfb_accesso
 	NULL	/* scroll */
 };
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
-#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
-#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
-#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
-#define	BINattr	0xd	/* Attribute Bitmap */
-#define	RopSrc 	0x3
-#define	RopInv 	0xc
-#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
-#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
-#define	DataDynamic	0	/* Data register reloaded by direct access */
-#define	MaskDynamic	1	/* Mask register reloaded by direct access */
-#define	MaskOtc	0	/* Mask contains Object Count valid bits */
-
 static inline void gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
 
 int

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.3 src/sys/arch/hppa/dev/hyperfb.c:1.4
--- src/sys/arch/hppa/dev/hyperfb.c:1.3	Wed Jul 17 07:11:01 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -28,10 +28,11 @@
  
 /*
  * a native driver for HCRX / hyperdrive cards
+ * tested on a HCRX24Z in a C360 only so far
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -73,11 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 
 
 #define HCRX_CONFIG_24BIT	0x100
 
-#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
-#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
-#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
-#define HYPERBOWL_MODE2_8_24	15
-
 int hyperfb_match(device_t, cfdata_t, void *);
 void hyperfb_attach(device_t, device_t, void *);
 
@@ -105,7 +101,6 @@ struct	hyperfb_softc {
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
-	uint32_t sc_rect_colour, sc_rect_height;
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -148,33 +143,6 @@ static void	hyperfb_eraserows(void *, in
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB

CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.8 src/sys/dev/ic/stireg.h:1.9
--- src/sys/dev/ic/stireg.h:1.8	Wed Jul 17 07:06:21 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 08:28:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,6 +641,34 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
 #define	NGLE_REG_2		0x000480	/* LUT blt src? */



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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

Modified files:

Index: src/sys/arch/hppa/conf/GENERIC
diff -u src/sys/arch/hppa/conf/GENERIC:1.44 src/sys/arch/hppa/conf/GENERIC:1.45
--- src/sys/arch/hppa/conf/GENERIC:1.44	Thu Mar 14 13:18:35 2024
+++ src/sys/arch/hppa/conf/GENERIC	Wed Jul 17 08:19:56 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.44 2024/03/14 13:18:35 macallan Exp $
+# $NetBSD: GENERIC,v 1.45 2024/07/17 08:19:56 macallan Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	"arch/hppa/conf/std.hppa"
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		"GENERIC-$Revision: 1.44 $"
+#ident 		"GENERIC-$Revision: 1.45 $"
 
 maxusers	32		# estimated number of users
 
@@ -283,7 +283,10 @@ sti*	at mainbus0		# [H]CRX-{8,24,48}[Z] 
 sti*	at phantomas?		# [H]CRX-{8,24,48}[Z] and Visualize graphics
 sti*	at uturn?
 sti*	at pci?			# EG-PCI, FX*
-gftfb* 	at pci?			# PCI Visualize EG
+
+# graphics with native drivers
+hyperfb* 	at uturn?	# hyperdrive / HCRX
+gftfb* 		at pci?		# PCI Visualize EG
 
 # Human Interface Loop
 hil*		at gsc? irq 1	# Human Interface Loop, kbd and mouse



CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.2 src/sys/arch/hppa/dev/hyperfb.c:1.3
--- src/sys/arch/hppa/dev/hyperfb.c:1.2	Mon Jul 15 10:26:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 07:11:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -145,10 +145,8 @@ static void	hyperfb_erasecols(void *, in
 static void	hyperfb_copyrows(void *, int, int, int);
 static void	hyperfb_eraserows(void *, int, int, long);
 
-#if 0
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
-#endif
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
@@ -593,7 +591,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ret;
 		}
 
-#if 0
 	case WSDISPLAYIO_GCURPOS:
 		{
 			struct wsdisplay_curpos *cp = (void *)data;
@@ -626,7 +623,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			return hyperfb_do_cursor(sc, cursor);
 		}
-#endif
 
 	case WSDISPLAYIO_SVIDEO:
 		hyperfb_set_video(sc, *(int *)data);
@@ -860,18 +856,14 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_3, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* BG */
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* FG */
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_2, 0);
-	hyperfb_write4(sc, NGLE_REG_1, 0x80008004);
+	hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
 	hyperfb_setup_fb(sc);	
 
-	//hyperfb_write4(sc, NGLE_REG_29, 0x80200020);
-
-	//hyperfb_move_cursor(sc, 100, 100);
+	hyperfb_move_cursor(sc, 100, 100);
 
 }
 
@@ -889,9 +881,9 @@ hyperfb_set_video(struct hyperfb_softc *
 	reg = hyperfb_read4(sc, NGLE_REG_33);
 	
 	if (on) {
-		hyperfb_write4(sc, NGLE_REG_33, reg | 0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg | HCRX_VIDEO_ENABLE);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_33, reg & ~0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg & ~HCRX_VIDEO_ENABLE);
 	}
 }
 
@@ -1151,3 +1143,158 @@ hyperfb_eraserows(void *cookie, int row,
 			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
+
+static void
+hyperfb_move_cursor(struct hyperfb_softc *sc, int x, int y)
+{
+	uint32_t pos;
+
+	sc->sc_cursor_x = x;
+	x -= sc->sc_hot_x;
+	sc->sc_cursor_y = y;
+	y -= sc->sc_hot_y;
+
+	if (x < 0) x = 0x1000 - x;
+	if (y < 0) y = 0x1000 - y;
+	pos = (x << 16) | y;
+	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_29, pos);
+}
+
+static int
+hyperfb_do_cursor(struct hyperfb_softc *sc, struct wsdisplay_cursor *cur)
+{
+
+	if (cur->which & WSDISPLAY_CURSOR_DOCUR) {
+
+		sc->sc_enabled = cur->enable;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOHOT) {
+
+		sc->sc_hot_x = cur->hot.x;
+		sc->sc_hot_y = cur->hot.y;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOPOS) {
+
+		hyperfb_move_cursor(sc, cur->pos.x, cur->pos.y);
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
+		uint32_t rgb;
+		uint8_t r[2], g[2], b[2];
+
+		copyin(cur->cmap.blue, b, 2);
+		copyin(cur->cmap.green, g, 2);
+		copyin(cur->cmap.red, r, 2);
+		mutex_enter(>sc_hwlock);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBE0F000);
+		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_3, 0);
+		rgb = (r[0] << 16) | (g[0] << 8) | b[0];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* BG */
+		rgb = (r[1] << 16) | (g[1] << 8) | b[1];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* FG */
+		hyperfb_write4(sc, NGLE_REG_2, 0);
+		hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
+
+		hyperfb_setup_fb(sc);	
+		mutex_exit(>sc_hwlock);
+
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOSHAPE) {
+		

CVS commit: src/sys/arch/hppa/dev

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.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/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.7 src/sys/dev/ic/stireg.h:1.8
--- src/sys/dev/ic/stireg.h:1.7	Mon Jul 15 10:30:42 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 07:06:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,9 +641,9 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
-#define	NGLE_REG_1		0x000118
+#define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480
+#define	NGLE_REG_2		0x000480	/* LUT blt src? */
 #define	NGLE_REG_3		0x0004a0	/* palette index */
 #define	NGLE_REG_22		0x0005a0
 #define	NGLE_REG_23		0x0005c0
@@ -672,15 +672,25 @@ STI_DEP(util);
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
-#define	NGLE_REG_26		0x200118
+#define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
 #define	NGLE_REG_19		0x200200
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
 #define	NGLE_REG_29		0x21	/* HCRX cursor coord & enable */
+	#define HCRX_ENABLE_CURSOR	0x8000
 #define	NGLE_REG_30		0x210004	/* HCRX cursor address */
 #define	NGLE_REG_31		0x210008	/* HCRX cursor data */
-#define	NGLE_REG_38		0x210020	/* colormap data */
+#define	NGLE_REG_38		0x210020	/* HCRX LUT blt ctrl */
+	/* EWOO  TTLL  */
+	#define LBC_ENABLE	0x8000
+	#define LBC_WAIT_BLANK	0x4000
+	#define LBS_OFFSET_SHIFT	16
+	#define LBC_TYPE_MASK		0xc000
+	#define LBC_TYPE_CMAP		0
+	#define LBC_TYPE_CURSOR		0x8000
+	#define LBC_TYPE_OVERLAY	0xc000
+	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
 #define	NGLE_REG_42		0x210028
 #define	NGLE_REG_43		0x21002c
@@ -688,8 +698,13 @@ STI_DEP(util);
 #define	NGLE_REG_45		0x210034
 #define	NGLE_REG_32		0x21003c
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
-#define	NGLE_REG_39		0x210120
-#define	NGLE_REG_40		0x210130
+	#define HCRX_VIDEO_ENABLE	0x0A00
+#define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */
+	#define HYPERBOWL_MODE2_8_24	15
+#define	NGLE_REG_40		0x210130	/* HCRX 'hyperbowl' */
+	#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+	#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+	#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
 
 #define	NGLE_BUFF0_CMAP0	0x1e02
 #define	NGLE_BUFF1_CMAP0	0x02001e02



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.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/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.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/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.6 src/sys/dev/ic/stireg.h:1.7
--- src/sys/dev/ic/stireg.h:1.6	Wed Sep  9 11:56:53 2015
+++ src/sys/dev/ic/stireg.h	Mon Jul 15 10:30:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.6 2015/09/09 11:56:53 skrll Exp $	*/
+/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -649,16 +649,16 @@ STI_DEP(util);
 #define	NGLE_REG_23		0x0005c0
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
-#define	NGLE_REG_6		0x000800
-#define	NGLE_REG_7		0x000804
-#define	NGLE_REG_24		0x000808
-#define	NGLE_REG_8		0x000820
-#define	NGLE_REG_73		0x000944
-#define	NGLE_REG_9		0x000a04
-#define	NGLE_REG_25		0x000b00
+#define	NGLE_REG_6		0x000800	/* rectfill XY */
+#define	NGLE_REG_7		0x000804	/* bitblt size WH */
+#define	NGLE_REG_24		0x000808	/* bitblt src XY */
+#define	NGLE_REG_8		0x000820	/* transfer data */
+#define	NGLE_REG_37		0x000944	/* HCRX fast rect fill, size */
+#define	NGLE_REG_9		0x000a04	/* rect fill size, start */
+#define	NGLE_REG_25		0x000b00	/* bitblt dst XY, start */
 #define	NGLE_REG_RAMDAC		0x001000
-#define	NGLE_REG_10		0x018000
-#define	NGLE_REG_11		0x018004	/* dest coords */
+#define	NGLE_REG_10		0x018000	/* buffer ctl */
+#define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
 #define	NGLE_REG_36		0x018014



CVS commit: src/sys/dev/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/dev

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.1 src/sys/arch/hppa/dev/hyperfb.c:1.2
--- src/sys/arch/hppa/dev/hyperfb.c:1.1	Fri Jul 12 08:43:08 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Jul 15 10:26:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -133,6 +133,52 @@ static int 	hyperfb_putpalreg(struct hyp
 void 	hyperfb_setup(struct hyperfb_softc *);
 static void	hyperfb_set_video(struct hyperfb_softc *, int);
 
+static void	hyperfb_rectfill(struct hyperfb_softc *, int, int, int, int,
+			uint32_t);
+static void	hyperfb_bitblt(void *, int, int, int, int, int,
+			int, int);
+
+static void	hyperfb_cursor(void *, int, int, int);
+static void	hyperfb_putchar(void *, int, int, u_int, long);
+static void	hyperfb_copycols(void *, int, int, int, int);
+static void	hyperfb_erasecols(void *, int, int, int, long);
+static void	hyperfb_copyrows(void *, int, int, int);
+static void	hyperfb_eraserows(void *, int, int, long);
+
+#if 0
+static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
+static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
+#endif
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
+static inline void hyperfb_wait_fifo(struct hyperfb_softc *, uint32_t);
+
 #define	ngle_bt458_write(sc, r, v) \
 	hyperfb_write4(sc, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
@@ -183,6 +229,16 @@ hyperfb_wait(struct hyperfb_softc *sc)
 	} while (stat != 0);
 }
 
+static inline void
+hyperfb_wait_fifo(struct hyperfb_softc *sc, uint32_t slots)
+{
+	uint32_t reg;
+
+	do {
+		reg = hyperfb_read4(sc, NGLE_REG_34);
+	} while (reg < slots);
+}
+
 void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
@@ -395,10 +451,10 @@ hyperfb_attach(device_t parent, device_t
 #endif
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
-#if 0
+
 		hyperfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
 		ri->ri_devcmap[(defattr >> 16) & 0xff]);
-#endif
+
 		vcons_replay_msgbuf(>sc_console_screen);
 	} else {
 		/*
@@ -456,21 +512,20 @@ hyperfb_init_screen(void *cookie, struct
 	rasops_init(ri, 0, 0);
 	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
 		  WSSCREEN_RESIZE;
-	scr->scr_flags |= VCONS_LOADFONT | VCONS_DONT_READ;
+	scr->scr_flags |= VCONS_LOADFONT;
 
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 		sc->sc_width / ri->ri_font->fontwidth);
 
 	ri->ri_hw = scr;
-#if 0
+
 	sc->sc_putchar = ri->ri_ops.putchar;
-	ri->ri_ops.copyrows = gftfb_copyrows;
-	ri->ri_ops.copycols = gftfb_copycols;
-	ri->ri_ops.eraserows = gftfb_eraserows;
-	r

CVS commit: src/sys/arch/hppa/dev

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sbin/iscsid

2024-07-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 13 23:51:19 UTC 2024

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Abort operation when a target address cannot be resolved.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/iscsid/iscsid_driverif.c

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

Modified files:

Index: src/sbin/iscsid/iscsid_driverif.c
diff -u src/sbin/iscsid/iscsid_driverif.c:1.10 src/sbin/iscsid/iscsid_driverif.c:1.11
--- src/sbin/iscsid/iscsid_driverif.c:1.10	Wed Dec 27 18:07:30 2023
+++ src/sbin/iscsid/iscsid_driverif.c	Sat Jul 13 23:51:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsid_driverif.c,v 1.10 2023/12/27 18:07:30 mlelstv Exp $	*/
+/*	$NetBSD: iscsid_driverif.c,v 1.11 2024/07/13 23:51:19 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -293,13 +293,13 @@ make_connection(session_t * sess, iscsid
 		break;
 	case EAI_NODATA:
 		res->status = ISCSID_STATUS_HOST_NOT_FOUND;
-		break;
+		return NULL;
 	case EAI_AGAIN:
 		res->status = ISCSID_STATUS_HOST_TRY_AGAIN;
-		break;
+		return NULL;
 	default:
 		res->status = ISCSID_STATUS_HOST_ERROR;
-		break;
+		return NULL;
 	}
 
 	/* alloc the connection structure */



CVS commit: src/sbin/iscsid

2024-07-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul 13 23:51:19 UTC 2024

Modified Files:
src/sbin/iscsid: iscsid_driverif.c

Log Message:
Abort operation when a target address cannot be resolved.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sbin/iscsid/iscsid_driverif.c

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



CVS commit: src/sys/arch/hppa/dev

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/gftfb.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/arch/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.14 src/sys/arch/hppa/dev/gftfb.c:1.15
--- src/sys/arch/hppa/dev/gftfb.c:1.14	Thu Apr 18 04:52:43 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Fri Jul 12 08:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.14 2024/04/18 04:52:43 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -47,15 +47,12 @@
 #include 
 #include 
 
-#ifdef STIDEBUG
-#define	DPRINTF(s)	do {	\
-	if (stidebug)		\
-		printf s;	\
-} while(0)
+#include "opt_gftfb.h"
 
-extern int stidebug;
+#ifdef GFTFB_DEBUG
+#define	DPRINTF(s) printf(s)
 #else
-#define	DPRINTF(s)	/* */
+#define	DPRINTF(s) /* */
 #endif
 
 int	gftfb_match(device_t, cfdata_t, void *);
@@ -425,7 +422,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 		offs + 0x0c);
 		subsize <<= 9;
 
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 		gftfb_disable_rom_internal(spc);
 		DPRINTF(("ROM offset %08x size %08x type %08x",
 		(u_int)offs, (u_int)subsize, tmp));
@@ -473,7 +470,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 			break;
 #endif
 		default:
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 			DPRINTF((" (wrong architecture)"));
 #endif
 			break;



CVS commit: src/sys/arch/hppa/dev

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/gftfb.c

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



CVS commit: src/sys/arch/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.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/arch/hppa/conf/files.hppa
diff -u src/sys/arch/hppa/conf/files.hppa:1.25 src/sys/arch/hppa/conf/files.hppa:1.26
--- src/sys/arch/hppa/conf/files.hppa:1.25	Tue Feb 13 13:40:13 2024
+++ src/sys/arch/hppa/conf/files.hppa	Fri Jul 12 08:43:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hppa,v 1.25 2024/02/13 13:40:13 macallan Exp $
+#	$NetBSD: files.hppa,v 1.26 2024/07/12 08:43:08 macallan Exp $
 #
 #	$OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -275,6 +275,13 @@ file	arch/hppa/gsc/com_harmony.c	com_har
 device	gftfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti_pci, sti
 attach	gftfb at pci
 file	arch/hppa/dev/gftfb.c		gftfb
+defflag opt_gftfb.h GFTFB_DEBUG
+
+# hyperdrive, aka HCRX
+device	hyperfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti
+attach	hyperfb at gedoens
+file	arch/hppa/dev/hyperfb.c		hyperfb
+defflag opt_hyperfb.h HYPERFB_DEBUG
 
 # Memory Disk
 file dev/md_root.c			memory_disk_hooks

Added files:

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u /dev/null src/sys/arch/hppa/dev/hyperfb.c:1.1
--- /dev/null	Fri Jul 12 08:43:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Fri Jul 12 08:43:08 2024
@@ -0,0 +1,843 @@
+/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2024 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+/*
+ * a native driver for HCRX / hyperdrive cards
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+
+#include "opt_cputype.h"
+#include "opt_hyperfb.h"
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef HYPERFB_DEBUG
+#define	DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
+#define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
+
+#define HCRX_FBOFFSET	0x0100
+#define HCRX_FBLEN	0x0100
+#define HCRX_REGOFFSET	0x0010
+#define HCRX_REGLEN	0x0028
+
+#define HCRX_CONFIG_24BIT	0x100
+
+#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
+#define HYPERBOWL_MODE2_8_24	15
+
+int hyperfb_match(device_t, cfdata_t, void *);
+void hyperfb_attach(device_t, device_t, void *);
+
+struct	hyperfb_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_iot;
+	bus_addr_t		sc_base;
+	bus_space_handle_t	sc_hfb, sc_hreg;
+	void 			*sc_fb;
+
+	int sc_width, sc_height;
+	int sc_locked, sc_is_console, sc_24bit;
+	struct vcons_screen sc_console_screen;
+	struct wsscreen_descr sc_defaultscreen_descr;
+	const struct wsscreen_descr *sc_screens[1];
+	struct wsscreen_list sc_screenlist;
+	struct vcons_data vd;
+	int sc_mode;
+	void (*sc_putchar)(void *, int, int, u_int, long);
+	u_char sc_cmap_red[256];
+	u_char sc_cmap_green[256];
+	u_char sc_cmap_blue[256];
+	kmutex_t sc_hwlock;
+	uint32

CVS commit: src/sys/arch/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.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/usb

2024-07-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul  6 07:09:22 UTC 2024

Modified Files:
src/sys/dev/usb: if_cdce.c

Log Message:
There is no link state for CDCE. Pretend that the link is always up so that
programs like dhcpcd will handle the interface.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/if_cdce.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/usb

2024-07-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jul  6 07:09:22 UTC 2024

Modified Files:
src/sys/dev/usb: if_cdce.c

Log Message:
There is no link state for CDCE. Pretend that the link is always up so that
programs like dhcpcd will handle the interface.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/if_cdce.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/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.81 src/sys/dev/usb/if_cdce.c:1.82
--- src/sys/dev/usb/if_cdce.c:1.81	Thu Mar  3 05:56:28 2022
+++ src/sys/dev/usb/if_cdce.c	Sat Jul  6 07:09:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.82 2024/07/06 07:09:22 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.81 2022/03/03 05:56:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.82 2024/07/06 07:09:22 mlelstv Exp $");
 
 #include 
 
@@ -251,6 +251,9 @@ cdce_attach(device_t parent, device_t se
 	usbnet_attach(un);
 	usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
 0, NULL);
+
+	/* XXX There is no link state, pretend we are always on */
+	if_link_state_change(usbnet_ifp(un), LINK_STATE_UP);
 }
 
 static void



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

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

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/dev/ic/sti.c:1.37
--- src/sys/dev/ic/sti.c:1.36	Tue Jun 25 11:52:11 2024
+++ src/sys/dev/ic/sti.c	Wed Jul  3 13:08:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -133,6 +133,7 @@ void	ngle_artist_setupfb(struct sti_scre
 void	ngle_elk_setupfb(struct sti_screen *);
 void	ngle_timber_setupfb(struct sti_screen *);
 int	ngle_putcmap(struct sti_screen *, u_int, u_int);
+int	ngle_hcrx_putcmap(struct sti_screen *, u_int, u_int);
 #endif
 
 #define	STI_ENABLE_ROM(sc) \
@@ -685,7 +686,7 @@ sti_screen_setup(struct sti_screen *scr,
 
 	case STI_DD_HCRX:
 		scr->setupfb = ngle_elk_setupfb;
-		scr->putcmap = ngle_putcmap;
+		scr->putcmap = ngle_hcrx_putcmap;
 
 		if (scr->scr_bpp > 8) {
 			scr->reg12_value = NGLE_BUFF1_CMAP3;
@@ -694,7 +695,7 @@ sti_screen_setup(struct sti_screen *scr,
 			scr->reg12_value = NGLE_BUFF1_CMAP0;
 			scr->reg10_value = 0x13602000;
 		}
-		scr->cmap_finish_register = NGLE_REG_1;
+		scr->cmap_finish_register = NGLE_REG_38;
 		break;
 
 	case STI_DD_GRX:
@@ -1649,6 +1650,7 @@ ngle_putcmap(struct sti_screen *scr, u_i
 		r++, g++, b++;
 	}
 
+
 	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
 	bus_space_write_stream_4(memt, memh, scr->cmap_finish_register,
 	cmap_finish);
@@ -1658,6 +1660,49 @@ ngle_putcmap(struct sti_screen *scr, u_i
 	return 0;
 }
 
+int
+ngle_hcrx_putcmap(struct sti_screen *scr, u_int idx, u_int count)
+{
+	struct sti_rom *rom = scr->scr_rom;
+	bus_space_tag_t memt = rom->memt;
+	bus_space_handle_t memh = rom->regh[2];
+	uint8_t *r, *g, *b;
+	uint32_t cmap_finish;
+
+	if (scr->scr_bpp > 8)
+		cmap_finish = 0x8100;
+	else
+		cmap_finish = 0x82000100;
+
+	r = scr->scr_rcmap + idx;
+	g = scr->scr_gcmap + idx;
+	b = scr->scr_bcmap + idx;
+
+	ngle_setup_hw(memt, memh);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0xbbe0f000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x03000300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+
+	while (count-- != 0) {
+		ngle_setup_hw(memt, memh);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_3,
+		0x400 | (idx << 2));
+		bus_space_write_stream_4(memt, memh, NGLE_REG_4,
+		(*r << 16) | (*g << 8) | *b);
+
+		idx++;
+		r++, g++, b++;
+	}
+
+
+	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_38, cmap_finish);
+	ngle_setup_fb(memt, memh, scr->reg10_value);
+
+
+	return 0;
+}
+
 void
 ngle_setup_hw(bus_space_tag_t memt, bus_space_handle_t memh)
 {



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

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

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.



CVS commit: src/sys/dev/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

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

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/dev/ic/sti.c:1.36
--- src/sys/dev/ic/sti.c:1.35	Tue Feb 13 13:17:51 2024
+++ src/sys/dev/ic/sti.c	Tue Jun 25 11:52:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -683,12 +683,25 @@ sti_screen_setup(struct sti_screen *scr,
 		}
 		break;
 
+	case STI_DD_HCRX:
+		scr->setupfb = ngle_elk_setupfb;
+		scr->putcmap = ngle_putcmap;
+
+		if (scr->scr_bpp > 8) {
+			scr->reg12_value = NGLE_BUFF1_CMAP3;
+			scr->reg10_value = 0xBBA0A000;
+		} else {
+			scr->reg12_value = NGLE_BUFF1_CMAP0;
+			scr->reg10_value = 0x13602000;
+		}
+		scr->cmap_finish_register = NGLE_REG_1;
+		break;
+
 	case STI_DD_GRX:
 	case STI_DD_CRX24:
 	case STI_DD_EVRX:
 	case STI_DD_3X2V:
 	case STI_DD_DUAL_CRX:
-	case STI_DD_HCRX:
 	case STI_DD_LEGO:
 	case STI_DD_SUMMIT:
 	case STI_DD_PINNACLE:



CVS commit: src/sys/dev/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

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

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8 xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c	Mon Jun 10 22:51:01 2024
@@ -818,6 +818,7 @@ xf86CVTMode(int HDisplay, int VDisplay, 
 Mode->VTotal = libxcvt_mode_info->vtotal;
 Mode->VRefresh   = libxcvt_mode_info->vrefresh;
 Mode->Flags  = libxcvt_mode_info->mode_flags;
+xf86SetModeDefaultName(Mode);
 
 free(libxcvt_mode_info);
 



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c

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



CVS commit: src/sys/arch/arm/broadcom

2024-06-10 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_pmwdog.c

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c

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



CVS commit: src/sys/arch/arm/broadcom

2024-06-10 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 10 06:03:49 UTC 2024

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_pmwdog.c

Log Message:
Add support for poweroff.

There is no circuitry to actually remove power from RPI, but you can reboot
into a low power state. Depending on model/firmware release you need a power
cycle or a GPIO signal to leave the low power state again. Add-on hardware
is usually unaffected.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_pmwdog.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/arch/arm/broadcom/bcm2835_pmwdog.c
diff -u src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2 src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.3
--- src/sys/arch/arm/broadcom/bcm2835_pmwdog.c:1.2	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/broadcom/bcm2835_pmwdog.c	Mon Jun 10 06:03:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $	*/
+/*	$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.2 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwdog.c,v 1.3 2024/06/10 06:03:48 mlelstv Exp $");
 
 
 #include 
@@ -54,12 +54,19 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_pmwd
 #endif
 
 #define	 BCM2835_PM_PASSWORD		0x5a00
+#define	 BCM2835_PM_PASSWORD_MASK	0xff00
 
 #define	BCM2835_PM_RSTC		0x1c
 #define	 BCM2835_PM_RSTC_CONFIGMASK	0x0030
 #define	 BCM2835_PM_RSTC_FULL_RESET	0x0020
 #define	 BCM2835_PM_RSTC_RESET		0x0102
 
+#define	BCM2835_PM_RSTS		0x20
+#define  BCM2835_PM_RSTS_PART(x) \
+		((uint16_t)((x) & 0x01) << 0 | (uint16_t)((x) & 0x02) << 1 | \
+		 (uint16_t)((x) & 0x04) << 2 | (uint16_t)((x) & 0x08) << 3 | \
+		 (uint16_t)((x) & 0x10) << 4 | (uint16_t)((x) & 0x20) << 5)
+
 #define	BCM2835_PM_WDOG		0x24
 #define	 BCM2835_PM_WDOG_TIMEMASK	0x000f
 
@@ -82,6 +89,10 @@ static void bcmpmwdog_set_timeout(struct
 static int bcmpmwdog_setmode(struct sysmon_wdog *);
 static int bcmpmwdog_tickle(struct sysmon_wdog *);
 
+/* fdt power controller */
+static void bcm2835_power_reset(device_t);
+static void bcm2835_power_poweroff(device_t);
+
 CFATTACH_DECL_NEW(bcmpmwdog_fdt, sizeof(struct bcm2835pmwdog_softc),
 bcmpmwdog_match, bcmpmwdog_attach, NULL, NULL);
 
@@ -90,6 +101,11 @@ static const struct device_compatible_en
 	DEVICE_COMPAT_EOL
 };
 
+static struct fdtbus_power_controller_func bcmpmwdog_power_funcs = {
+	.reset = bcm2835_power_reset,
+	.poweroff = bcm2835_power_poweroff
+};
+
 /* ARGSUSED */
 static int
 bcmpmwdog_match(device_t parent, cfdata_t match, void *aux)
@@ -136,6 +152,9 @@ bcmpmwdog_attach(device_t parent, device
 	sc->sc_smw.smw_period = BCM2835_PM_DEFAULT_PERIOD;
 	if (sysmon_wdog_register(>sc_smw) != 0)
 		aprint_error_dev(self, "couldn't register watchdog\n");
+
+	fdtbus_register_power_controller(self, phandle,
+	_power_funcs);
 }
 
 static void
@@ -176,6 +195,17 @@ bcmpmwdog_setmode(struct sysmon_wdog *sm
 	return error;
 }
 
+static void
+bcmpmwdog_set_partition(struct bcm2835pmwdog_softc *sc, uint8_t part)
+{
+	uint32_t tmp;
+
+	tmp = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS);
+	tmp &= ~(BCM2835_PM_PASSWORD_MASK | BCM2835_PM_RSTS_PART(~0));
+	tmp |= BCM2835_PM_PASSWORD | BCM2835_PM_RSTS_PART(part);
+	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_PM_RSTS, tmp);
+}
+
 static int
 bcmpmwdog_tickle(struct sysmon_wdog *smw)
 {
@@ -187,11 +217,43 @@ bcmpmwdog_tickle(struct sysmon_wdog *smw
 	return 0;
 }
 
+static void
+bcm2835_restart(struct bcm2835pmwdog_softc *sc, int partition)
+{
+	uint32_t timeout = 10;
+
+	bcmpmwdog_set_partition(sc, partition);
+	bcmpmwdog_set_timeout(sc, timeout);
+}
+
 void
 bcm2835_system_reset(void)
 {
 	struct bcm2835pmwdog_softc *sc = bcm2835pmwdog_sc;
-	uint32_t timeout = 10;
 
-	bcmpmwdog_set_timeout(sc, timeout);
+	bcm2835_restart(sc, 0);
+}
+
+static void
+bcm2835_power_reset(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	bcm2835_restart(sc, 0);
+
+	for (;;) continue;
+	/* NOTREACHED */
 }
+
+static void
+bcm2835_power_poweroff(device_t self)
+{
+	struct bcm2835pmwdog_softc *sc = device_private(self);
+
+	/* Boot from partition 63 is magic to halt boot process */
+	bcm2835_restart(sc, 63);
+
+	for (;;) continue;
+	/* NOTREACHED */
+}
+



CVS commit: src/sys/arch/amiga/stand/bootblock

2024-06-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  8 06:39:57 UTC 2024

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/elf2bb: Makefile

Log Message:
Enable and use debug printfs to get some output into the build log.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/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/arch/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.62 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.63
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.62	Fri Apr 29 07:45:20 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Sat Jun  8 06:39:57 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.62 2022/04/29 07:45:20 rin Exp $
+#	$NetBSD: Makefile,v 1.63 2024/06/08 06:39:57 mlelstv Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -53,6 +53,7 @@ OBJS+=	$(SOBJS) $(COBJS)
 DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE
 DEFS += -D__INTERNAL_LIBSA_CREAD
 DEFS += -DSERCONSOLE
+DEFS += -DLIBSA_NO_RAW_ACCESS
 SOBJS += cread.o
 
 #XX#SOBJS += adler32.o crc32.o inflate.o trees.o \
@@ -109,7 +110,7 @@ CFLAGS+= -Wall -Wmissing-prototypes -Wst
 
 boot.amiga: x.out
 	${_MKTARGET_CREATE}
-	${RELOC2BB} -S x.out $@ || (${NM} -u x.out && false)
+	${RELOC2BB} -d -S x.out $@ || (${NM} -u x.out && false)
 
 x.out: xxstart.o libboot.a ${LIBZ}
 	${_MKTARGET_LINK}

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.5
--- src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile:1.4	Sat Sep 17 17:09:10 2016
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile	Sat Jun  8 06:39:57 2024
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.4 2016/09/17 17:09:10 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2024/06/08 06:39:57 mlelstv Exp $
 #
 
 .include 
 
-CPPFLAGS+= -I.
+CPPFLAGS+= -I. -DDEBUG
 PROG=	elf2bb
 MKMAN=	no
 SRCS=	elf2bb.c chksum.c



CVS commit: src/sys/arch/amiga/stand/bootblock

2024-06-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Jun  8 06:39:57 UTC 2024

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/elf2bb: Makefile

Log Message:
Enable and use debug printfs to get some output into the build log.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/Makefile

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



CVS commit: src/sys/modules/compat_100

2024-05-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 06:47:23 UTC 2024

Modified Files:
src/sys/modules/compat_100: Makefile

Log Message:
The module also needs the syscall for old dup3.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/compat_100/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/modules/compat_100/Makefile
diff -u src/sys/modules/compat_100/Makefile:1.2 src/sys/modules/compat_100/Makefile:1.3
--- src/sys/modules/compat_100/Makefile:1.2	Tue Sep  5 14:49:46 2023
+++ src/sys/modules/compat_100/Makefile	Wed May 29 06:47:23 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2023/09/05 14:49:46 christos Exp $
+#	$NetBSD: Makefile,v 1.3 2024/05/29 06:47:23 mlelstv Exp $
 
 .include "../Makefile.inc"
 
@@ -8,6 +8,6 @@ KMOD=	compat_100
 
 CPPFLAGS+=	-DCOMPAT_100
 
-SRCS+=	compat_100_mod.c kern_event_100.c
+SRCS+=	compat_100_mod.c kern_event_100.c sys_descrip_100.c
 
 .include 



CVS commit: src/sys/modules/compat_100

2024-05-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May 29 06:47:23 UTC 2024

Modified Files:
src/sys/modules/compat_100: Makefile

Log Message:
The module also needs the syscall for old dup3.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/compat_100/Makefile

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



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.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/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63	Sat Sep 23 21:26:16 2023
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May 28 11:06:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -113,7 +113,7 @@ struct OF_translation ofw_translations[O
 struct pmap ofw_pmap;
 struct bat ofw_battable[BAT_VA2IDX(0x)+1];
 
-char bootpath[256];
+char bootpath[256] = "";
 char model_name[64];
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 void *startsym, *endsym;
@@ -165,7 +165,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
-	} else {
+	}
+
+	/* if bootpath is still empty, get it from /chosen */
+	if (bootpath[0] == 0) {
 		int chs = OF_finddevice("/chosen");
 		int len;
 



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-05-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon May 13 10:13:11 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_driver.c

Log Message:
support 16bit colour
This requires kernel support, which was committed yesterday.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.21 -r1.22 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.32 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.33
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.32	Wed May 11 21:13:13 2022
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Mon May 13 10:13:10 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.32 2022/05/11 21:13:13 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.33 2024/05/13 10:13:10 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -68,6 +68,7 @@ int src_formats[] = {PICT_a8r8g8b8, PICT
 int tex_formats[] = {PICT_a8r8g8b8, PICT_a8b8g8r8, PICT_a8};
 
 static void CG14Copy32(PixmapPtr, int, int, int, int, int, int);
+static void CG14Copy16(PixmapPtr, int, int, int, int, int, int);
 static void CG14Copy8(PixmapPtr, int, int, int, int, int, int);
 
 static inline void
@@ -121,6 +122,9 @@ CG14PrepareCopy(PixmapPtr pSrcPixmap, Pi
 		case 8:
 			p->pExa->Copy = CG14Copy8;
 			break;
+		case 16:
+			p->pExa->Copy = CG14Copy16;
+			break;
 		case 32:
 			p->pExa->Copy = CG14Copy32;
 			break;
@@ -610,6 +614,13 @@ CG14Copy8_short_norop(Cg14Ptr p, int src
 }
 
 static void
+CG14Copy16(PixmapPtr pDstPixmap,
+ int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+	CG14Copy8(pDstPixmap, srcX << 1, srcY, dstX << 1, dstY, w << 1, h);
+}
+
+static void
 CG14Copy8(PixmapPtr pDstPixmap,
  int srcX, int srcY, int dstX, int dstY, int w, int h)
 {
@@ -896,10 +907,12 @@ CG14PrepareSolid(PixmapPtr pPixmap, int 
 			fg = 0x;
 			break;
 	}
-	/* repeat the colour in every sub byte if we're in 8 bit */
+	/* repeat the colour in every sub byte if we're in 8 or 16 bit */
 	if (pPixmap->drawable.bitsPerPixel == 8) {
 		fg |= fg << 8;
 		fg |= fg << 16;
+	} else if (pPixmap->drawable.bitsPerPixel == 16) {
+		fg |= fg << 16;
 	}
 	write_sx_reg(p, SX_QUEUED(8), fg);
 	write_sx_reg(p, SX_QUEUED(9), fg);
@@ -974,6 +987,90 @@ CG14Solid32(Cg14Ptr p, uint32_t start, u
 }
 
 static void
+CG14Solid16(Cg14Ptr p, uint32_t start, uint32_t pitch, int w, int h)
+{
+	int line, num, pre, cnt;
+	uint32_t ptr;
+
+	ENTER;
+	pre = start & 2;
+	if (pre != 0) pre = 1;
+
+	if (p->last_rop == 0xcc) {
+		/* simple fill */
+		for (line = 0; line < h; line++) {
+			ptr = start;
+			cnt = w;
+			if (pre) {
+sxm(SX_STW, ptr, 8, 0);
+ptr += 2;
+cnt -= 1;
+if (cnt == 0) goto next;
+			}
+			/* now do the aligned pixels in 32bit chunks */
+			if (ptr & 3) xf86Msg(X_ERROR, "%s %x\n", __func__, ptr);
+			while(cnt > 1) {
+num = min(32, cnt >> 1);
+sxm(SX_STS, ptr, 8, num - 1);
+ptr += num << 2;
+cnt -= num << 1;
+			}
+			if (cnt > 1) xf86Msg(X_ERROR, "%s cnt %d\n", __func__, cnt);
+			if (cnt > 0) {
+sxm(SX_STW, ptr, 8, 0);
+			}
+next:
+			start += pitch;
+		}
+	} else if (p->last_rop == 0xaa) {
+		/* nothing to do here */
+		return;
+	} else {
+		/* alright, let's do actual ROP stuff */
+
+		/* first repeat the fill colour into 16 registers */
+		sxi(SX_SELECT_S, 8, 8, 10, 15);
+
+		for (line = 0; line < h; line++) {
+			ptr = start;
+			cnt = w;
+			pre = min(pre, cnt);
+			if (pre) {
+sxm(SX_LDW, ptr, 26, 0);
+sxi(SX_ROP, 10, 26, 42, 0);
+sxm(SX_STW, ptr, 42, 0);
+ptr += 2;
+cnt -= 1;
+if (cnt == 0) goto next2;
+			}
+			/* now do the aligned pixels in 32bit chunks */
+			if (ptr & 3) xf86Msg(X_ERROR, "%s %x\n", __func__, ptr);
+			while(cnt > 1) {
+num = min(32, cnt >> 1);
+sxm(SX_LD, ptr, 26, num - 1);
+if (num <= 16) {
+	sxi(SX_ROP, 10, 26, 58, num - 1);
+} else {
+	sxi(SX_ROP, 10, 26, 58, 15);
+	sxi(SX_ROP, 10, 42, 74, num - 17);
+}
+sxm(SX_ST, ptr, 58, num - 1);
+ptr += num << 2;
+cnt -= num << 1;
+			}
+			if (cnt > 1) xf86Msg(X_ERROR, "%s cnt %d\n", __func__, cnt);
+			if (cnt > 0) {
+sxm(SX_LDW, ptr, 26, 0);
+sxi(SX_ROP, 10, 26, 42, 0);
+sxm(SX_STW, ptr, 42, 0);
+			}
+next2:
+			start += pitch;
+		}
+	}
+}
+
+static void
 CG14Solid8(Cg14Ptr p, uint32_t start, uint32_t pitch, int w, int h)
 {
 	int line, num, pre, cnt;
@@ -1078

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-05-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon May 13 10:13:11 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_driver.c

Log Message:
support 16bit colour
This requires kernel support, which was committed yesterday.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.21 -r1.22 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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



CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 13:43:27 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add simple 16bit load and store ops


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/dev/sxreg.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/arch/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.21 src/sys/arch/sparc/dev/sxreg.h:1.22
--- src/sys/arch/sparc/dev/sxreg.h:1.21	Fri Dec 10 20:36:03 2021
+++ src/sys/arch/sparc/dev/sxreg.h	Sun May 12 13:43:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.21 2021/12/10 20:36:03 andvar Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.22 2024/05/12 13:43:27 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -195,6 +195,8 @@
 SX_LONG | (dreg << 7) | (o))
 #define SX_LDB(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_UBYTE_0 | (dreg << 7) | (o))
+#define SX_LDW(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_USHORT_0 | (dreg << 7) | (o))
 #define SX_LDP(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_PACKED | (dreg << 7) | (o))
 #define SX_LDUQ0(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
@@ -223,6 +225,8 @@
 SX_UBYTE_0 | (sreg << 7) | (o))
 #define SX_STBC(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_CLAMP | \
 SX_UBYTE_0 | (sreg << 7) | (o))
+#define SX_STW(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_USHORT_0 | (sreg << 7) | (o))
 #define SX_STP(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_PACKED | (sreg << 7) | (o))
 #define SX_STPS(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_SELECT | \



CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 13:43:27 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add simple 16bit load and store ops


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/dev/sxreg.h

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



CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 11:48:05 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support 16bit / RGB565 colour


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sparc/dev/cgfourteen.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/arch/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.97 src/sys/arch/sparc/dev/cgfourteen.c:1.98
--- src/sys/arch/sparc/dev/cgfourteen.c:1.97	Wed Apr 24 11:49:58 2024
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sun May 12 11:48:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.97 2024/04/24 11:49:58 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.98 2024/05/12 11:48:05 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -385,6 +385,7 @@ cgfourteenattach(device_t parent, device
 
 	/* Attach to /dev/fb */
 	fb_attach(>sc_fb, isconsole);
+
 }
 
 /*
@@ -493,6 +494,7 @@ cgfourteenioctl(dev_t dev, u_long cmd, v
 			return EINVAL;
 
 		cg14_set_depth(sc, depth);
+		cg14_init_cmap(sc);
 		}
 		break;
 	default:
@@ -608,7 +610,8 @@ cgfourteenpoll(dev_t dev, int events, st
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
-	cg14_set_depth(sc, 32);
+	cg14_set_depth(sc, 32);	
+	cg14_init_cmap(sc);
 }
 
 static void
@@ -616,6 +619,7 @@ static void
 cg14_reset(struct cgfourteen_softc *sc)
 {
 	cg14_set_depth(sc, 8);
+	cg14_init_cmap(sc);
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -736,7 +740,9 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		WSSCREEN_RESIZE,
 		NULL
 	};
+
 	cg14_set_depth(sc, 8);
+
 	sc->sc_screens[0] = >sc_defaultscreen_descr;
 	sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
 	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
@@ -753,45 +759,50 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
 
-		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
-		);
+	vcons_init_screen(>sc_vd, >sc_console_screen, 1,
+	);
+
+	/* clear the screen with the default background colour */
+	if (sc->sc_sx != NULL) {
+		cg14_rectfill(sc, 0, 0, ri->ri_width, ri->ri_height,
+			ri->ri_devcmap[(defattr >> 16) & 0xf]);
+	} else {
+		memset(sc->sc_fb.fb_pixels,
+		   ri->ri_devcmap[(defattr >> 16) & 0xf],
+		   ri->ri_stride * ri->ri_height);
+	}
+	sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
+
+	sc->sc_defaultscreen_descr.textops = >ri_ops;
+	sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
+	sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
+	sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
+	glyphcache_init_align(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
+		(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) - 
+		 sc->sc_fb.fb_type.fb_height - 5,
+		sc->sc_fb.fb_type.fb_width,
+		ri->ri_font->fontwidth,
+		ri->ri_font->fontheight,
+		defattr, 4);
 
-		/* clear the screen with the default background colour */
-		if (sc->sc_sx != NULL) {
-			cg14_rectfill(sc, 0, 0, ri->ri_width, ri->ri_height,
-ri->ri_devcmap[(defattr >> 16) & 0xf]);
-		} else {
-			memset(sc->sc_fb.fb_pixels,
-			   ri->ri_devcmap[(defattr >> 16) & 0xf],
-			   ri->ri_stride * ri->ri_height);
-		}
-		sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
-
-		sc->sc_defaultscreen_descr.textops = >ri_ops;
-		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
-		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
-		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
-		glyphcache_init_align(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
-			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) - 
-			 sc->sc_fb.fb_type.fb_height - 5,
-			sc->sc_fb.fb_type.fb_width,
-			ri->ri_font->fontwidth,
-			ri->ri_font->fontheight,
-			defattr, 4);
 	if (is_cons) {
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 		vcons_replay_msgbuf(>sc_console_screen);
 	}
 
-	cg14_init_cmap(sc);
-
 	aa.console = is_cons;
 	aa.scrdata = >sc_screenlist;
 	aa.accessops = _accessops;
 	aa.accesscookie = >sc_vd;
 
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
+
+	/*
+	 * do this here since any output through firmware calls will mess
+	 * with XLUT settings
+	 */
+	cg14_init_cmap(sc);
 }
 
 static void
@@ -799,18 +810,74 @@ cg14_init_cmap(struct cgfourteen_softc *
 {
 	struct rasops_info *ri = >sc_console_screen.scr_ri;
 	int i, j = 0;
+	uint32_t r, g, b, c;
 	uint8_t cmap[768];
 
-	rasops_get_cmap(ri, cmap, sizeof(cmap));
-
-	for (i = 0; i < 256; i++) {
-
-		sc->sc_cmap.cm_map[i][3] = cmap[j];
-		sc->sc_cmap.cm_map[i][2] = cmap[j + 1];
-		sc->sc_cmap.cm_map[i][1] = cmap[j + 2];
-		j += 3;
+	if (sc->sc_depth == 16) {
+		/* construct an R5G6B5 palette in CLUT1/2 */
+		for (i = 0; i < 0x100; i++) {
+			/* upper byte first */
+			r = (i & 0xf8);	/* red component */
+			r |= r >> 5;		/* fill lower bits so 0xf8 */
+			c = 0x4000 | r;	/* becomes 0xff */
+			g = i 

CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 11:48:05 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support 16bit / RGB565 colour


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sparc/dev/cgfourteen.c

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



CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 07:22:13 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteenreg.h

Log Message:
moar registers
in particular, document XLUT bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/cgfourteenreg.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/arch/sparc/dev/cgfourteenreg.h
diff -u src/sys/arch/sparc/dev/cgfourteenreg.h:1.7 src/sys/arch/sparc/dev/cgfourteenreg.h:1.8
--- src/sys/arch/sparc/dev/cgfourteenreg.h:1.7	Sat Jun 12 21:25:56 2010
+++ src/sys/arch/sparc/dev/cgfourteenreg.h	Sun May 12 07:22:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenreg.h,v 1.7 2010/06/12 21:25:56 macallan Exp $ */
+/*	$NetBSD: cgfourteenreg.h,v 1.8 2024/05/12 07:22:13 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -91,6 +91,39 @@ struct cg14ctl {
 #define CG14_RSR_REVMASK	0xf0 		/*  mask to get revision */
 #define CG14_RSR_IMPLMASK	0x0f		/*  mask to get impl. code */
 	volatile uint8_t	ctl_ccr;	/* clock control register */
+#define CCR_SCL		0x01
+#define CCR_SDA		0x02
+#define CCR_SDA_DIR	0x04
+#define CCR_ASXSEL	0x08	/* the ICS1562 has 4 data/address lines and a */
+#define CCR_DATA	0xf0	/* toggle input - I suspect this is it */
+	volatile uint32_t	ctl_tmr;	/* test mode readback */
+	volatile uint8_t	ctl_mod;	/* monitor data register */
+	/* reads 0x4 on mine, other bits in the lower half can be written with
+	   no obvious effect ( I suspect monitor ID ), upper half is hard zero 
+	 */
+	volatile uint8_t	ctl_acr;	/* aux control register */	
+#define ACR_BYTE_PIXEL	0x01	/* if unset pixels are 32bit */
+/* other bits are hard zero */	
+uint8_t 	m_pad0[6];  /* Reserved */
+uint16_t	m_hct;  /* Horizontal Counter   */
+uint16_t	m_vct;  /* Vertical Counter */
+uint16_t	m_hbs;  /* Horizontal Blank Start   */
+uint16_t	m_hbc;  /* Horizontal Blank Clear   */
+uint16_t	m_hss;  /* Horizontal Sync Set  */
+uint16_t	m_hsc;  /* Horizontal Sync Set  */
+uint16_t	m_csc;  /* Composite sync clear */
+uint16_t	m_vbs;  /* Vertical blank start */
+uint16_t	m_vbc;  /* Vertical Blank Clear */
+uint16_t	m_vss;  /* Verical Sync Set */
+uint16_t	m_vsc;  /* Verical Sync Clear   */
+uint16_t	m_xcs;  /* XXX Gone in VSIMM 2 */
+uint16_t	m_xcc;  /* XXX Gone in VSIMM 2 */
+uint16_t	m_fsa;  /* Fault status address */
+uint16_t	m_adr;  /* Address register (autoincrements) */
+uint8_t		m_pad2[0xce];   /* Reserved */
+
+/* PCG registers */
+uint8_t		m_pcg[0x100];   /* Pixel Clock generator regs   */
 	/* XXX etc. */
 };
 
@@ -134,6 +167,35 @@ struct cg14xlut {
 	volatile uint8_t	xlut_lutincd[CG14_CLUT_SIZE];
 };
 
+/* 
+ * The XLUT and ctl_ppr bits are the same - in 8bit ppr is used, in 16bit and
+ * 24bit XLUT
+ * here we select two colours, either RGB or a component passed through a
+ * CLUT, and blend them together. The alpha value is taken from the right 
+ * source's CLUT's upper byte, with 0x80 being 1.0 and 0x00 being 0.0
+*/
+
+#define CG14_LEFT_PASSTHROUGH	0x00
+#define CG14_LEFT_CLUT1		0x40
+#define CG14_LEFT_CLUT2		0x80
+#define CG14_LEFT_CLUT3		0xc0
+
+#define CG14_RIGHT_PASSTHROUGH	0x00
+#define CG14_RIGHT_CLUT1	0x10
+#define CG14_RIGHT_CLUT2	0x20
+#define CG14_RIGHT_CLUT3	0x30
+
+/* 0 is passthrough again */
+#define CG14_LEFT_B   0x04
+#define CG14_LEFT_G   0x08
+#define CG14_LEFT_R   0x0c
+
+/* except here 0 selects the X channel */
+#define CG14_RIGHT_X  0x00
+#define CG14_RIGHT_B  0x01
+#define CG14_RIGHT_G  0x02
+#define CG14_RIGHT_R  0x03
+
 /* Color Look-Up Table (CLUT) */
 struct cg14clut {
 	volatile uint32_t	clut_lut[CG14_CLUT_SIZE];	/* the LUT */



CVS commit: src/sys/arch/sparc/dev

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 07:22:13 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteenreg.h

Log Message:
moar registers
in particular, document XLUT bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/cgfourteenreg.h

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



CVS commit: src/distrib/sets/lists/debug

2024-05-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 11 07:34:34 UTC 2024

Modified Files:
src/distrib/sets/lists/debug: module.ad.aarch64

Log Message:
Fix aarch64 build


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/debug/module.ad.aarch64

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

Modified files:

Index: src/distrib/sets/lists/debug/module.ad.aarch64
diff -u src/distrib/sets/lists/debug/module.ad.aarch64:1.6 src/distrib/sets/lists/debug/module.ad.aarch64:1.7
--- src/distrib/sets/lists/debug/module.ad.aarch64:1.6	Tue Apr 11 10:30:41 2023
+++ src/distrib/sets/lists/debug/module.ad.aarch64	Sat May 11 07:34:33 2024
@@ -1,4 +1,4 @@
-# $NetBSD: module.ad.aarch64,v 1.6 2023/04/11 10:30:41 riastradh Exp $
+# $NetBSD: module.ad.aarch64,v 1.7 2024/05/11 07:34:33 mlelstv Exp $
 ./usr/libdata/debug/@MODULEDIR@/amdgpumodules-base-kernel kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/amdgpu/amdgpu.kmod.debug	modules-base-kernel kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/bpfjitmodules-base-kernel	kmod,sljit,debug
@@ -73,3 +73,5 @@
 ./usr/libdata/debug/@MODULEDIR@/exec_elf64/exec_elf64.kmod.debug	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/sljitmodules-base-kernel	kmod,sljit,debug
 ./usr/libdata/debug/@MODULEDIR@/sljit/sljit.kmod.debug			modules-base-kernel	kmod,sljit,debug
+./usr/libdata/debug/@MODULEDIR@/vmtmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/vmt/vmt.kmod.debug			modules-base-kernel	kmod,debug



CVS commit: src/distrib/sets/lists/debug

2024-05-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May 11 07:34:34 UTC 2024

Modified Files:
src/distrib/sets/lists/debug: module.ad.aarch64

Log Message:
Fix aarch64 build


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/debug/module.ad.aarch64

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



CVS commit: src/distrib/sets/lists/base32

2024-05-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon May  6 06:06:41 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.sparc64

Log Message:
sprinkle rump, gcc=12 etc.
Now sparc64 with HAVE_GCC=12 and MKRUMP=no builds again


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/base32/md.sparc64

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

Modified files:

Index: src/distrib/sets/lists/base32/md.sparc64
diff -u src/distrib/sets/lists/base32/md.sparc64:1.3 src/distrib/sets/lists/base32/md.sparc64:1.4
--- src/distrib/sets/lists/base32/md.sparc64:1.3	Tue Apr 16 19:15:36 2024
+++ src/distrib/sets/lists/base32/md.sparc64	Mon May  6 06:06:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.3 2024/04/16 19:15:36 christos Exp $
+# $NetBSD: md.sparc64,v 1.4 2024/05/06 06:06:40 macallan Exp $
 ./lib/sparc	base-compat-shlib	compat
 ./lib/sparc/npf	base-compat-shlib	compat,npf
 ./lib/sparc/npf/ext_log.so			base-compat-shlib	compat,npf
@@ -88,8 +88,10 @@
 ./usr/lib/sparc/libarchive.so.5			base-compat-shlib	compat
 ./usr/lib/sparc/libarchive.so.5.0		base-compat-shlib	compat
 ./usr/lib/sparc/libasan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libasan.so.5			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libasan.so.5.0			base-compat-shlib	compat,gcc,cxx
+./usr/lib/sparc/libasan.so.5			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/sparc/libasan.so.5.0			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/sparc/libasan.so.6			base-compat-shlib	compat,gcc=12,cxx
+./usr/lib/sparc/libasan.so.6.0			base-compat-shlib	compat,gcc=12,cxx
 ./usr/lib/sparc/libasn1.so			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libasn1.so.10			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libasn1.so.10.0			base-compat-shlib	compat,kerberos
@@ -199,7 +201,8 @@
 ./usr/lib/sparc/libgnumalloc.so.1.0		base-compat-shlib	compat
 ./usr/lib/sparc/libgomp.so			base-compat-shlib	compat,gcc
 ./usr/lib/sparc/libgomp.so.2			base-compat-shlib	compat,gcc
-./usr/lib/sparc/libgomp.so.2.1			base-compat-shlib	compat,gcc
+./usr/lib/sparc/libgomp.so.2.1			base-compat-shlib	compat,gcc=10
+./usr/lib/sparc/libgomp.so.2.2			base-compat-shlib	compat,gcc=12
 ./usr/lib/sparc/libgssapi.so			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libgssapi.so.12			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libgssapi.so.12.0		base-compat-shlib	compat,kerberos
@@ -270,8 +273,10 @@
 ./usr/lib/sparc/libldap_r.so.6			base-compat-shlib	compat,ldap
 ./usr/lib/sparc/libldap_r.so.6.0		base-compat-shlib	compat,ldap
 ./usr/lib/sparc/liblsan.so			base-compat-shlib	compat,cxx,gcc
-./usr/lib/sparc/liblsan.so.2			base-compat-shlib	compat,cxx,gcc
-./usr/lib/sparc/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc
+./usr/lib/sparc/liblsan.so.2			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/sparc/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/sparc/liblsan.so.3			base-compat-shlib	compat,cxx,gcc=12
+./usr/lib/sparc/liblsan.so.3.0			base-compat-shlib	compat,cxx,gcc=12
 ./usr/lib/sparc/liblua.so			base-compat-shlib	compat
 ./usr/lib/sparc/liblua.so.6			base-compat-shlib	compat
 ./usr/lib/sparc/liblua.so.6.1			base-compat-shlib	compat
@@ -314,9 +319,9 @@
 ./usr/lib/sparc/libossaudio.so			base-compat-shlib	compat
 ./usr/lib/sparc/libossaudio.so.1		base-compat-shlib	compat
 ./usr/lib/sparc/libossaudio.so.1.1		base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so			base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so.2			base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so.2.0			base-compat-shlib	compat
+./usr/lib/sparc/libp2k.so			base-compat-shlib	compat,rump
+./usr/lib/sparc/libp2k.so.2			base-compat-shlib	compat,rump
+./usr/lib/sparc/libp2k.so.2.0			base-compat-shlib	compat,rump
 ./usr/lib/sparc/libpam.so			base-compat-shlib	compat
 ./usr/lib/sparc/libpam.so.4			base-compat-shlib	compat
 ./usr/lib/sparc/libpam.so.4.1			base-compat-shlib	compat
@@ -418,7 +423,8 @@
 ./usr/lib/sparc/libssl.so.15.0			base-compat-shlib	compat
 ./usr/lib/sparc/libstdc++.so			base-compat-shlib	compat,gcc,cxx,libstdcxx
 ./usr/lib/sparc/libstdc++.so.9			base-compat-shlib	compat,gcc,cxx,libstdcxx
-./usr/lib/sparc/libstdc++.so.9.0		base-compat-shlib	compat,gcc,cxx,libstdcxx
+./usr/lib/sparc/libstdc++.so.9.0		base-compat-shlib	compat,gcc=10,cxx,libstdcxx
+./usr/lib/sparc/libstdc++.so.9.1		base-compat-shlib	compat,gcc=12,cxx,libstdcxx
 ./usr/lib/sparc/libtermcap.so			base-compat-shlib	compat
 ./usr/lib/sparc/libtermcap.so.0			base-compat-shlib	compat
 ./usr/lib/sparc/libtermcap.so.0.6		base-compat-shlib	compat
@@ -432,11 +438,13 @@
 ./usr/lib/sparc/libtre.so.0			base-compat-shlib	compat
 ./usr/lib/sparc/libtre.so.0.8			base-compat-shlib	compat
 ./usr/lib/sparc/libubsan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libubsan.so.4			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libubsan.so.4.0			base-compat-shlib	compat,gcc,cxx

CVS commit: src/distrib/sets/lists/base32

2024-05-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon May  6 06:06:41 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.sparc64

Log Message:
sprinkle rump, gcc=12 etc.
Now sparc64 with HAVE_GCC=12 and MKRUMP=no builds again


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/base32/md.sparc64

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



CVS commit: src/sys/arch/amiga/amiga

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:45:10 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: trap.c

Log Message:
Don't panic on NULL pointer dereference when done by copyin, ...


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/amiga/amiga/trap.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/arch/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.142 src/sys/arch/amiga/amiga/trap.c:1.143
--- src/sys/arch/amiga/amiga/trap.c:1.142	Sat Jan 20 00:15:30 2024
+++ src/sys/arch/amiga/amiga/trap.c	Sat May  4 13:45:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $	*/
+/*	$NetBSD: trap.c,v 1.143 2024/05/04 13:45:10 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.142 2024/01/20 00:15:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.143 2024/05/04 13:45:10 mlelstv Exp $");
 
 #include 
 #include 
@@ -364,7 +364,7 @@ trapmmufault(int type, u_int code, u_int
 		ftype = VM_PROT_READ;
 	va = trunc_page((vaddr_t)v);
 #ifdef DEBUG
-	if (map == kernel_map && va == 0) {
+	if (map == kernel_map && va == 0 && onfault == 0) {
 		printf("trap: bad kernel access at %x pc %x\n", v, fp->f_pc);
 		panictrap(type, code, v, fp);
 	}



CVS commit: src/sys/arch/amiga/amiga

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:45:10 UTC 2024

Modified Files:
src/sys/arch/amiga/amiga: trap.c

Log Message:
Don't panic on NULL pointer dereference when done by copyin, ...


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/amiga/amiga/trap.c

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



CVS commit: src/sys/kern

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:33:18 UTC 2024

Modified Files:
src/sys/kern: subr_iostat.c

Log Message:
Account for trailing NUL bytes when calculating userland buffer size.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/subr_iostat.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/kern/subr_iostat.c
diff -u src/sys/kern/subr_iostat.c:1.25 src/sys/kern/subr_iostat.c:1.26
--- src/sys/kern/subr_iostat.c:1.25	Wed May 22 08:47:02 2019
+++ src/sys/kern/subr_iostat.c	Sat May  4 13:33:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_iostat.c,v 1.25 2019/05/22 08:47:02 hannken Exp $	*/
+/*	$NetBSD: subr_iostat.c,v 1.26 2024/05/04 13:33:18 mlelstv Exp $	*/
 /*	NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp	*/
 
 /*-
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.25 2019/05/22 08:47:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.26 2024/05/04 13:33:18 mlelstv Exp $");
 
 #include 
 #include 
@@ -370,6 +370,8 @@ iostati_getnames(int disk_only, char *ol
 			memset(bf, 0, sizeof(bf));
 			if (first) {
 strncpy(bf, stats->io_name, sizeof(bf));
+/* account for trailing NUL byte */
+needed += 1;
 first = 0;
 			} else {
 bf[0] = ' ';



CVS commit: src/sys/kern

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:33:18 UTC 2024

Modified Files:
src/sys/kern: subr_iostat.c

Log Message:
Account for trailing NUL bytes when calculating userland buffer size.


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

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



CVS commit: src/usr.bin/seq

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:29:41 UTC 2024

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
Bail if increment is too small for the precision to avoid an infinite loop.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/seq/seq.c

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

Modified files:

Index: src/usr.bin/seq/seq.c
diff -u src/usr.bin/seq/seq.c:1.13 src/usr.bin/seq/seq.c:1.14
--- src/usr.bin/seq/seq.c:1.13	Sat Feb 24 10:10:04 2024
+++ src/usr.bin/seq/seq.c	Sat May  4 13:29:41 2024
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2005\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: seq.c,v 1.13 2024/02/24 10:10:04 mlelstv Exp $");
+__RCSID("$NetBSD: seq.c,v 1.14 2024/05/04 13:29:41 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -105,6 +105,7 @@ main(int argc, char *argv[])
 	double first = 1.0;
 	double last = 0.0;
 	double incr = 0.0;
+	double prev;
 	struct lconv *locale;
 	char *fmt = NULL;
 	const char *sep = "\n";
@@ -208,15 +209,23 @@ main(int argc, char *argv[])
 
 	if (incr > 0) {
 		printf(fmt, first);
+		prev = first;
 		for (first += incr; first <= last; first += incr) {
+			if (first <= prev)
+errx(1, "increment too small\n");
 			fputs(sep, stdout);
 			printf(fmt, first);
+			prev = first;
 		}
 	} else {
 		printf(fmt, first);
+		prev = first;
 		for (first += incr; first >= last; first += incr) {
+			if (first >= prev)
+errx(1, "increment too small\n");
 			fputs(sep, stdout);
 			printf(fmt, first);
+			prev = first;
 		}
 	}
 	if (term != NULL)



CVS commit: src/usr.bin/seq

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 13:29:41 UTC 2024

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
Bail if increment is too small for the precision to avoid an infinite loop.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/seq/seq.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/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:49:16 UTC 2024

Modified Files:
src/sys/dev/usb: uhub.c

Log Message:
Use device_printf instead of autoconf messages for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/usb/uhub.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/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:49:16 UTC 2024

Modified Files:
src/sys/dev/usb: uhub.c

Log Message:
Use device_printf instead of autoconf messages for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/usb/uhub.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/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.161 src/sys/dev/usb/uhub.c:1.162
--- src/sys/dev/usb/uhub.c:1.161	Wed Apr  6 22:01:45 2022
+++ src/sys/dev/usb/uhub.c	Sat May  4 12:49:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.161 2022/04/06 22:01:45 mlelstv Exp $	*/
+/*	$NetBSD: uhub.c,v 1.162 2024/05/04 12:49:15 mlelstv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 /*	$OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */
 
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.161 2022/04/06 22:01:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.162 2024/05/04 12:49:15 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -864,7 +864,7 @@ uhub_explore(struct usbd_device *dev)
 			 * some other serious problem.  Since we cannot leave
 			 * at 0 we have to disable the port instead.
 			 */
-			aprint_error_dev(sc->sc_dev,
+			device_printf(sc->sc_dev,
 			"device problem, disabling port %d\n", port);
 			usbd_clear_port_feature(dev, port, UHF_PORT_ENABLE);
 		} else {



CVS commit: src/sys/dev/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:45:14 UTC 2024

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Make usb address and hub topology available to drvctl.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/dev/usb/usb_subr.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/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.278 src/sys/dev/usb/usb_subr.c:1.279
--- src/sys/dev/usb/usb_subr.c:1.278	Tue Apr 11 08:50:07 2023
+++ src/sys/dev/usb/usb_subr.c	Sat May  4 12:45:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.278 2023/04/11 08:50:07 riastradh Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.279 2024/05/04 12:45:13 mlelstv Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.278 2023/04/11 08:50:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.279 2024/05/04 12:45:13 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1083,6 +1083,24 @@ usbd_properties(device_t dv, struct usbd
 	vendor = UGETW(dd->idVendor);
 	product = UGETW(dd->idProduct);
 
+	prop_dictionary_set_uint8(dict, "address", dev->ud_addr);
+
+	if (dev->ud_myhub) {
+		struct usbd_device *hdev = dev->ud_myhub;
+		struct usbd_hub *hub = hdev->ud_hub;
+		int p;
+
+		KASSERT(hub != NULL);
+
+		prop_dictionary_set_uint8(dict, "hub-address", hdev->ud_addr);
+		for (p=1; p <= hub->uh_hubdesc.bNbrPorts; ++p) {
+			if (hub->uh_ports[p-1].up_dev == dev) {
+prop_dictionary_set_uint8(dict, "hub-port", p);
+break;
+			}
+		}
+	}
+
 	prop_dictionary_set_uint8(dict, "class", class);
 	prop_dictionary_set_uint8(dict, "subclass", subclass);
 	prop_dictionary_set_uint16(dict, "release", release);



CVS commit: src/sys/dev/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:45:14 UTC 2024

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Make usb address and hub topology available to drvctl.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/dev/usb/usb_subr.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/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:41:03 UTC 2024

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
Use device_printf instead of autoconf messages for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/usb/usbnet.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/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.119 src/sys/dev/usb/usbnet.c:1.120
--- src/sys/dev/usb/usbnet.c:1.119	Fri Feb  2 22:00:33 2024
+++ src/sys/dev/usb/usbnet.c	Sat May  4 12:41:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.119 2024/02/02 22:00:33 andvar Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.120 2024/05/04 12:41:03 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.119 2024/02/02 22:00:33 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.120 2024/05/04 12:41:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -377,7 +377,7 @@ usbnet_rxeof(struct usbd_xfer *xfer, voi
 	usbd_get_xfer_status(xfer, NULL, NULL, _len, NULL);
 
 	if (total_len > un->un_rx_bufsz) {
-		aprint_error_dev(un->un_dev,
+		device_printf(un->un_dev,
 		"rxeof: too large transfer (%u > %u)\n",
 		total_len, un->un_rx_bufsz);
 		goto done;
@@ -471,7 +471,7 @@ usbnet_pipe_intr(struct usbd_xfer *xfer,
 
 	if (status != USBD_NORMAL_COMPLETION) {
 		if (usbd_ratecheck(>unp_intr_notice)) {
-			aprint_error_dev(un->un_dev, "usb error on intr: %s\n",
+			device_printf(un->un_dev, "usb error on intr: %s\n",
 			usbd_errstr(status));
 		}
 		if (status == USBD_STALLED)



CVS commit: src/sys/dev/usb

2024-05-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 12:41:03 UTC 2024

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
Use device_printf instead of autoconf messages for errors.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/usb/usbnet.c

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



CVS commit: src/sys/fs/msdosfs

2024-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 05:49:39 UTC 2024

Modified Files:
src/sys/fs/msdosfs: msdosfs_rename.c

Log Message:
>From genfs_rename.c:

 * XXX Want a better equality test.  `tcnp->cn_cred == cred'
 * hoses p2k because puffs transmits the creds separately and
 * allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/msdosfs/msdosfs_rename.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/fs/msdosfs/msdosfs_rename.c
diff -u src/sys/fs/msdosfs/msdosfs_rename.c:1.3 src/sys/fs/msdosfs/msdosfs_rename.c:1.4
--- src/sys/fs/msdosfs/msdosfs_rename.c:1.3	Sat Oct 23 16:58:17 2021
+++ src/sys/fs/msdosfs/msdosfs_rename.c	Sat May  4 05:49:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $	*/
+/*	$NetBSD: msdosfs_rename.c,v 1.4 2024/05/04 05:49:39 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.3 2021/10/23 16:58:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_rename.c,v 1.4 2024/05/04 05:49:39 mlelstv Exp $");
 
 #include 
 #include 
@@ -127,7 +127,7 @@ msdosfs_rename(void *v)
 	KASSERT(tdvp->v_type == VDIR);
 
 	cred = fcnp->cn_cred;
-	KASSERT(tcnp->cn_cred == cred);
+	KASSERT(kauth_cred_uidmatch(cred, tcnp->cn_cred));
 
 	/*
 	 * Sanitize our world from the VFS insanity.  Unlock the target



CVS commit: src/sys/fs/msdosfs

2024-05-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat May  4 05:49:39 UTC 2024

Modified Files:
src/sys/fs/msdosfs: msdosfs_rename.c

Log Message:
>From genfs_rename.c:

 * XXX Want a better equality test.  `tcnp->cn_cred == cred'
 * hoses p2k because puffs transmits the creds separately and
 * allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/msdosfs/msdosfs_rename.c

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



CVS commit: src/sys/compat/netbsd32

2024-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May  1 11:32:29 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_16.c

Log Message:
Enable compat sigreturn system call.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/netbsd32/netbsd32_compat_16.c

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



CVS commit: src/sys/compat/netbsd32

2024-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May  1 11:32:29 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_16.c

Log Message:
Enable compat sigreturn system call.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/netbsd32/netbsd32_compat_16.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/compat/netbsd32/netbsd32_compat_16.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_16.c:1.4 src/sys/compat/netbsd32/netbsd32_compat_16.c:1.5
--- src/sys/compat/netbsd32/netbsd32_compat_16.c:1.4	Fri Nov 26 08:06:11 2021
+++ src/sys/compat/netbsd32/netbsd32_compat_16.c	Wed May  1 11:32:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_16.c,v 1.4 2021/11/26 08:06:11 ryo Exp $	*/
+/*	$NetBSD: netbsd32_compat_16.c,v 1.5 2024/05/01 11:32:29 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_16.c,v 1.4 2021/11/26 08:06:11 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_16.c,v 1.5 2024/05/01 11:32:29 mlelstv Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,40 +48,87 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com
 
 struct uvm_object *emul_netbsd32_object;
 
-MODULE(MODULE_CLASS_EXEC, compat_netbsd32_16, "compat_netbsd32_20,compat_16");
+static const struct syscall_package netbsd32_kern_sig_16_syscalls[] = {
+/* compat_16_netbs32___sigreturn14 is in MD code! */
+{ NETBSD32_SYS_compat_16_netbsd32___sigreturn14, 0,
+(sy_call_t *)compat_16_netbsd32___sigreturn14 },
+{ 0, 0, NULL }
+};
 
 static int
-compat_netbsd32_16_modcmd(modcmd_t cmd, void *arg)
+compat_netbsd32_16_init(void)
+{
+	int error;
+
+	error = syscall_establish(_netbsd32, netbsd32_kern_sig_16_syscalls);
+	if (error)
+		return error;
+
+	rw_enter(_lock, RW_WRITER);
+	emul_netbsd32.e_sigcode = netbsd32_sigcode;
+	emul_netbsd32.e_esigcode = netbsd32_esigcode;
+	emul_netbsd32.e_sigobject = _netbsd32_object;
+	error = exec_sigcode_alloc(_netbsd);
+	if (error) {
+		emul_netbsd32.e_sigcode = NULL;
+		emul_netbsd32.e_esigcode = NULL;
+		emul_netbsd32.e_sigobject = NULL;
+	}
+	rw_exit(_lock);
+	if (error)
+		return error;
+	netbsd32_machdep_md_16_init();
+	return 0;
+}
+
+static int
+compat_netbsd32_16_fini(void)
 {
+	proc_t *p;
 	int error;
 
+	error = syscall_disestablish(_netbsd32, netbsd32_kern_sig_16_syscalls);
+if (error)
+return error;
+/*
+ * Ensure sendsig_sigcontext() is not being used.
+ * module_lock prevents the flag being set on any
+ * further processes while we are here.  See
+ * sigaction1() for the opposing half.
+ */
+mutex_enter(_lock);
+PROCLIST_FOREACH(p, ) {
+if ((p->p_lflag & PL_SIGCOMPAT) != 0) {
+break;
+}
+}
+mutex_exit(_lock);
+if (p != NULL) {
+syscall_establish(_netbsd32, netbsd32_kern_sig_16_syscalls);
+return EBUSY;
+}
+
+	rw_enter(_lock, RW_WRITER);
+	exec_sigcode_free(_netbsd);
+	emul_netbsd32.e_sigcode = NULL;
+   	emul_netbsd32.e_esigcode = NULL;
+   	emul_netbsd32.e_sigobject = NULL;
+	rw_exit(_lock);
+	netbsd32_machdep_md_16_fini();
+	return 0;
+}
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_16, "compat_netbsd32_20,compat_16");
+
+static int
+compat_netbsd32_16_modcmd(modcmd_t cmd, void *arg)
+{
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		rw_enter(_lock, RW_WRITER);
-		emul_netbsd32.e_sigcode = netbsd32_sigcode;
-	emul_netbsd32.e_esigcode = netbsd32_esigcode;
-	emul_netbsd32.e_sigobject = _netbsd32_object;
-		error = exec_sigcode_alloc(_netbsd);
-		if (error) {
-			emul_netbsd32.e_sigcode = NULL;
-			emul_netbsd32.e_esigcode = NULL;
-			emul_netbsd32.e_sigobject = NULL;
-		}
-		rw_exit(_lock);
-		if (error)
-			return error;
-		netbsd32_machdep_md_16_init();
-		return 0;
+		return compat_netbsd32_16_init();
 
 	case MODULE_CMD_FINI:
-		rw_enter(_lock, RW_WRITER);
-		exec_sigcode_free(_netbsd);
-		emul_netbsd32.e_sigcode = NULL;
-	emul_netbsd32.e_esigcode = NULL;
-	emul_netbsd32.e_sigobject = NULL;
-		rw_exit(_lock);
-		netbsd32_machdep_md_16_fini();
-		return 0;
+		return compat_netbsd32_16_fini();
 
 	default:
 		return ENOTTY;



CVS commit: src/sys/compat/netbsd32

2024-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May  1 07:22:43 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysent.c

Log Message:
Revert previous, the syscall needs to be enabled at runtime.

The compat_16 module just enables it for the "netbsd" emulation, but
nothing enables it yet for "netbsd32".


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/compat/netbsd32/netbsd32_sysent.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/compat/netbsd32/netbsd32_sysent.c
diff -u src/sys/compat/netbsd32/netbsd32_sysent.c:1.159 src/sys/compat/netbsd32/netbsd32_sysent.c:1.160
--- src/sys/compat/netbsd32/netbsd32_sysent.c:1.159	Tue Apr 30 17:10:22 2024
+++ src/sys/compat/netbsd32/netbsd32_sysent.c	Wed May  1 07:22:43 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_sysent.c,v 1.159 2024/04/30 17:10:22 mlelstv Exp $ */
+/* $NetBSD: netbsd32_sysent.c,v 1.160 2024/05/01 07:22:43 mlelstv Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.159 2024/04/30 17:10:22 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.160 2024/05/01 07:22:43 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1280,7 +1280,7 @@ struct sysent netbsd32_sysent[] = {
 	},		/* 294 = netbsd32___sigsuspend14 */
 	{
 		ns(struct compat_16_netbsd32___sigreturn14_args),
-		.sy_call = (sy_call_t *)compat_16_netbsd32___sigreturn14
+		.sy_call = (sy_call_t *)sys_nomodule
 	},		/* 295 = compat_16_netbsd32___sigreturn14 */
 	{
 		ns(struct netbsd32___getcwd_args),



CVS commit: src/sys/compat/netbsd32

2024-05-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed May  1 07:22:43 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysent.c

Log Message:
Revert previous, the syscall needs to be enabled at runtime.

The compat_16 module just enables it for the "netbsd" emulation, but
nothing enables it yet for "netbsd32".


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/compat/netbsd32/netbsd32_sysent.c

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



CVS commit: src/sys/compat/netbsd32

2024-04-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Apr 30 17:10:22 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysent.c

Log Message:
Enable compat sigreturn system call.

The previous bug in netbsd32___sigaction_sigtramp hid the problem,
as it failed all but the first installation of a signal handler.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/compat/netbsd32/netbsd32_sysent.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/compat/netbsd32/netbsd32_sysent.c
diff -u src/sys/compat/netbsd32/netbsd32_sysent.c:1.158 src/sys/compat/netbsd32/netbsd32_sysent.c:1.159
--- src/sys/compat/netbsd32/netbsd32_sysent.c:1.158	Sun Jul 30 06:53:13 2023
+++ src/sys/compat/netbsd32/netbsd32_sysent.c	Tue Apr 30 17:10:22 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_sysent.c,v 1.158 2023/07/30 06:53:13 rin Exp $ */
+/* $NetBSD: netbsd32_sysent.c,v 1.159 2024/04/30 17:10:22 mlelstv Exp $ */
 
 /*
  * System call switch table.
@@ -8,7 +8,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.158 2023/07/30 06:53:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysent.c,v 1.159 2024/04/30 17:10:22 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1280,7 +1280,7 @@ struct sysent netbsd32_sysent[] = {
 	},		/* 294 = netbsd32___sigsuspend14 */
 	{
 		ns(struct compat_16_netbsd32___sigreturn14_args),
-		.sy_call = (sy_call_t *)sys_nomodule
+		.sy_call = (sy_call_t *)compat_16_netbsd32___sigreturn14
 	},		/* 295 = compat_16_netbsd32___sigreturn14 */
 	{
 		ns(struct netbsd32___getcwd_args),



CVS commit: src/sys/compat/netbsd32

2024-04-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Apr 30 17:10:22 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysent.c

Log Message:
Enable compat sigreturn system call.

The previous bug in netbsd32___sigaction_sigtramp hid the problem,
as it failed all but the first installation of a signal handler.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/compat/netbsd32/netbsd32_sysent.c

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



CVS commit: src/distrib/sets/lists/base32

2024-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 30 01:18:40 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.amd64

Log Message:
sprinkle gcc=12 and rump attributes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/base32/md.amd64

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

Modified files:

Index: src/distrib/sets/lists/base32/md.amd64
diff -u src/distrib/sets/lists/base32/md.amd64:1.5 src/distrib/sets/lists/base32/md.amd64:1.6
--- src/distrib/sets/lists/base32/md.amd64:1.5	Tue Apr 16 19:15:36 2024
+++ src/distrib/sets/lists/base32/md.amd64	Tue Apr 30 01:18:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.5 2024/04/16 19:15:36 christos Exp $
+# $NetBSD: md.amd64,v 1.6 2024/04/30 01:18:40 macallan Exp $
 ./lib/i386	base-compat-shlib	compat
 ./lib/i386/npf	base-compat-shlib	compat,npf
 ./lib/i386/npf/ext_log.so			base-compat-shlib	compat,npf
@@ -88,8 +88,10 @@
 ./usr/lib/i386/libarchive.so.5			base-compat-shlib	compat
 ./usr/lib/i386/libarchive.so.5.0		base-compat-shlib	compat
 ./usr/lib/i386/libasan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libasan.so.5			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libasan.so.5.0			base-compat-shlib	compat,gcc,cxx
+./usr/lib/i386/libasan.so.5			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/i386/libasan.so.5.0			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/i386/libasan.so.6			base-compat-shlib	compat,gcc=12,cxx
+./usr/lib/i386/libasan.so.6.0			base-compat-shlib	compat,gcc=12,cxx
 ./usr/lib/i386/libasn1.so			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libasn1.so.10			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libasn1.so.10.0			base-compat-shlib	compat,kerberos
@@ -205,7 +207,8 @@
 ./usr/lib/i386/libgnumalloc.so.1.0		base-compat-shlib	compat
 ./usr/lib/i386/libgomp.so			base-compat-shlib	compat,gcc
 ./usr/lib/i386/libgomp.so.2			base-compat-shlib	compat,gcc
-./usr/lib/i386/libgomp.so.2.1			base-compat-shlib	compat,gcc
+./usr/lib/i386/libgomp.so.2.1			base-compat-shlib	compat,gcc=10
+./usr/lib/i386/libgomp.so.2.2			base-compat-shlib	compat,gcc=12
 ./usr/lib/i386/libgssapi.so			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libgssapi.so.12			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libgssapi.so.12.0		base-compat-shlib	compat,kerberos
@@ -280,8 +283,10 @@
 ./usr/lib/i386/libldap_r.so.6			base-compat-shlib	compat,ldap
 ./usr/lib/i386/libldap_r.so.6.0			base-compat-shlib	compat,ldap
 ./usr/lib/i386/liblsan.so			base-compat-shlib	compat,cxx,gcc
-./usr/lib/i386/liblsan.so.2			base-compat-shlib	compat,cxx,gcc
-./usr/lib/i386/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc
+./usr/lib/i386/liblsan.so.2			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/i386/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/i386/liblsan.so.3			base-compat-shlib	compat,cxx,gcc=12
+./usr/lib/i386/liblsan.so.3.0			base-compat-shlib	compat,cxx,gcc=12
 ./usr/lib/i386/liblua.so			base-compat-shlib	compat
 ./usr/lib/i386/liblua.so.6			base-compat-shlib	compat
 ./usr/lib/i386/liblua.so.6.1			base-compat-shlib	compat
@@ -324,9 +329,9 @@
 ./usr/lib/i386/libossaudio.so			base-compat-shlib	compat
 ./usr/lib/i386/libossaudio.so.1			base-compat-shlib	compat
 ./usr/lib/i386/libossaudio.so.1.1		base-compat-shlib	compat
-./usr/lib/i386/libp2k.so			base-compat-shlib	compat
-./usr/lib/i386/libp2k.so.2			base-compat-shlib	compat
-./usr/lib/i386/libp2k.so.2.0			base-compat-shlib	compat
+./usr/lib/i386/libp2k.so			base-compat-shlib	compat,rump
+./usr/lib/i386/libp2k.so.2			base-compat-shlib	compat,rump
+./usr/lib/i386/libp2k.so.2.0			base-compat-shlib	compat,rump
 ./usr/lib/i386/libpam.so			base-compat-shlib	compat
 ./usr/lib/i386/libpam.so.4			base-compat-shlib	compat
 ./usr/lib/i386/libpam.so.4.1			base-compat-shlib	compat
@@ -428,7 +433,8 @@
 ./usr/lib/i386/libssl.so.15.0			base-compat-shlib	compat
 ./usr/lib/i386/libstdc++.so			base-compat-shlib	compat,gcc,cxx,libstdcxx
 ./usr/lib/i386/libstdc++.so.9			base-compat-shlib	compat,gcc,cxx,libstdcxx
-./usr/lib/i386/libstdc++.so.9.0			base-compat-shlib	compat,gcc,cxx,libstdcxx
+./usr/lib/i386/libstdc++.so.9.0			base-compat-shlib	compat,gcc=10,cxx,libstdcxx
+./usr/lib/i386/libstdc++.so.9.1			base-compat-shlib	compat,gcc=12,cxx,libstdcxx
 ./usr/lib/i386/libtermcap.so			base-compat-shlib	compat
 ./usr/lib/i386/libtermcap.so.0			base-compat-shlib	compat
 ./usr/lib/i386/libtermcap.so.0.6		base-compat-shlib	compat
@@ -442,11 +448,13 @@
 ./usr/lib/i386/libtre.so.0			base-compat-shlib	compat
 ./usr/lib/i386/libtre.so.0.8			base-compat-shlib	compat
 ./usr/lib/i386/libubsan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libubsan.so.4			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libubsan.so.4.0			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libukfs.so			base-compat-shlib	compat
-./usr/lib/i386/libukfs.so.1			base-compat-shlib	compat
-./usr/lib/i386/libukfs.so.1.0		

CVS commit: src/distrib/sets/lists/base32

2024-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 30 01:18:40 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.amd64

Log Message:
sprinkle gcc=12 and rump attributes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/base32/md.amd64

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



CVS commit: src/sys/compat/netbsd32

2024-04-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Apr 29 14:56:01 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_signal.c

Log Message:
In netbsd32___sigaction_sigtramp continue to use the compat module when
already locked for this process.

Needs pullup to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/netbsd32/netbsd32_signal.c

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



CVS commit: src/sys/compat/netbsd32

2024-04-29 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Apr 29 14:56:01 UTC 2024

Modified Files:
src/sys/compat/netbsd32: netbsd32_signal.c

Log Message:
In netbsd32___sigaction_sigtramp continue to use the compat module when
already locked for this process.

Needs pullup to netbsd-10.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/compat/netbsd32/netbsd32_signal.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/compat/netbsd32/netbsd32_signal.c
diff -u src/sys/compat/netbsd32/netbsd32_signal.c:1.53 src/sys/compat/netbsd32/netbsd32_signal.c:1.54
--- src/sys/compat/netbsd32/netbsd32_signal.c:1.53	Sat Nov  6 20:42:56 2021
+++ src/sys/compat/netbsd32/netbsd32_signal.c	Mon Apr 29 14:56:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_signal.c,v 1.53 2021/11/06 20:42:56 thorpej Exp $	*/
+/*	$NetBSD: netbsd32_signal.c,v 1.54 2024/04/29 14:56:01 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.53 2021/11/06 20:42:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_signal.c,v 1.54 2024/04/29 14:56:01 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT) 
 #include "opt_ktrace.h"
@@ -184,7 +184,7 @@ netbsd32___sigaction_sigtramp(struct lwp
 		 */
 #ifdef __HAVE_STRUCT_SIGCONTEXT
 		struct proc *p = l->l_proc;
-		bool sigcontext_valid = false;
+		bool sigcontext_valid;
 
 		/*
 		 * We need to ensure the compat_netbsd32_16 module
@@ -196,9 +196,7 @@ netbsd32___sigaction_sigtramp(struct lwp
 			kernconfig_lock();
 			(void)module_autoload("compat_netbsd32_16",
 			MODULE_CLASS_ANY);
-			if (netbsd32_sendsig_sigcontext_16_hook.hooked) {
-sigcontext_valid = true;
-			}
+			sigcontext_valid = netbsd32_sendsig_sigcontext_16_hook.hooked;
 			mutex_enter(_lock);
 			/*
 			 * Prevent unload of compat module while
@@ -207,6 +205,11 @@ netbsd32___sigaction_sigtramp(struct lwp
 			p->p_lflag |= PL_SIGCOMPAT;
 			mutex_exit(_lock);
 			kernconfig_unlock();
+		} else {
+			/*
+			 * Module is already loaded and locked in memory
+			 */
+			sigcontext_valid = netbsd32_sendsig_sigcontext_16_hook.hooked;
 		}
 		if (!sigcontext_valid) {
 			return EINVAL;



CVS commit: src/sys/arch/sparc/dev

2024-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 24 11:49:58 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
allow userland to switch to 16bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/dev/cgfourteen.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/arch/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.96 src/sys/arch/sparc/dev/cgfourteen.c:1.97
--- src/sys/arch/sparc/dev/cgfourteen.c:1.96	Wed Dec 20 05:33:18 2023
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Apr 24 11:49:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.96 2023/12/20 05:33:18 thorpej Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.97 2024/04/24 11:49:58 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1072,22 +1072,28 @@ cg14_set_depth(struct cgfourteen_softc *
 			CG14_MCTL, CG14_MCTL_ENABLEVID | 
 			CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
 			sc->sc_depth = 8;
-			/* everything is CLUT1 */
-			for (i = 0; i < CG14_CLUT_SIZE; i++)
-			 sc->sc_xlut->xlut_lut[i] = 0;
+			break;
+		case 16:
+			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
+			CG14_MCTL, CG14_MCTL_ENABLEVID | 
+			CG14_MCTL_PIXMODE_16 | CG14_MCTL_POWERCTL);
+			sc->sc_depth = 16;
 			break;
 		case 32:
 			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
 			CG14_MCTL, CG14_MCTL_ENABLEVID | 
 			CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
 			sc->sc_depth = 32;
-			for (i = 0; i < CG14_CLUT_SIZE; i++)
-			 sc->sc_xlut->xlut_lut[i] = 0;
 			break;
 		default:
 			printf("%s: can't change to depth %d\n",
 			device_xname(sc->sc_dev), depth);
+			return;
 	}
+	/* everything is CLUT1 */
+	for (i = 0; i < CG14_CLUT_SIZE; i++)
+	 sc->sc_xlut->xlut_lut[i] = 0;
+
 }
 
 static void
@@ -1432,7 +1438,7 @@ cg14_bitblt_gc(void *cookie, int xs, int
 
 	saddr = sc->sc_fb_paddr + xs + stride * ys;
 	daddr = sc->sc_fb_paddr + xd + stride * yd;
-
+		
 	if (saddr & 3) {
 		swi += saddr & 3;
 		dreg += saddr & 3;



CVS commit: src/sys/arch/sparc/dev

2024-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 24 11:49:58 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
allow userland to switch to 16bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/dev/cgfourteen.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-04-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 24 11:42:06 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
don't enable xrender support unless we have 24bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.20 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.21
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.20	Sun Jan  8 22:03:02 2023
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Wed Apr 24 11:42:06 2024
@@ -395,6 +395,12 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 pCg14->use_xrender = xf86ReturnOptValBool(pCg14->Options, OPTION_XRENDER,
 FALSE);
 
+if (pScrn->depth < 24) {
+	if (pCg14->use_xrender)
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling xrender on depth < 24\n");
+	pCg14->use_xrender = FALSE;
+}
+
 /*
  * This must happen after pScrn->display has been set because
  * xf86SetWeight references it.



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-04-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 24 11:42:06 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
don't enable xrender support unless we have 24bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.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/pckbport

2024-04-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Apr 18 17:35:53 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
Renamed border/boundary variables to better describe their use.
Fix edge default values, factor out percentage calculation for more consistent
values. Use device_printf/DPRINTF to show errors instead of aprint variants.
Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them unusuable.

Fixes PR 57874.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.82 src/sys/dev/pckbport/synaptics.c:1.83
--- src/sys/dev/pckbport/synaptics.c:1.82	Tue Sep  5 05:55:12 2023
+++ src/sys/dev/pckbport/synaptics.c	Thu Apr 18 17:35:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.82 2023/09/05 05:55:12 mrg Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.82 2023/09/05 05:55:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.83 2024/04/18 17:35:53 mlelstv Exp $");
 
 #include 
 #include 
@@ -112,10 +112,10 @@ static int synaptics_edge_bottom = SYNAP
 static int synaptics_edge_motion_delta = 32;
 static u_int synaptics_finger_high = SYNAPTICS_FINGER_LIGHT + 5;
 static u_int synaptics_finger_low = SYNAPTICS_FINGER_LIGHT - 10;
-static int synaptics_horiz_pct = 0;
-static int synaptics_vert_pct = 0;
-static int synaptics_button_pct = 30;
-static int synaptics_button_boundary;
+static int synaptics_hscroll_pct = 0;
+static int synaptics_vscroll_pct = 0;
+static int synaptics_button_pct = 0;
+static int synaptics_button_boundary = SYNAPTICS_EDGE_BOTTOM;
 static int synaptics_button2;
 static int synaptics_button3;
 static int synaptics_two_fingers_emul = 0;
@@ -166,23 +166,26 @@ static int synaptics_movement_threshold_
 static int synaptics_movement_enable_nodenum;
 static int synaptics_button_region_movement_nodenum;
 static int synaptics_aux_mid_button_scroll_nodenum;
-static int synaptics_horiz_pct_nodenum;
-static int synaptics_vert_pct_nodenum;
+static int synaptics_hscroll_pct_nodenum;
+static int synaptics_vscroll_pct_nodenum;
 static int synaptics_button_pct_nodenum;
 
 /*
  * copy of edges so we can recalculate edge limit if there is 
  * vertical scroll region
  */
-static int synaptics_actual_edge_right;
-static int synaptics_actual_edge_bottom;
+static int synaptics_true_edge_right;
+static int synaptics_true_edge_bottom;
 
-static int synaptics_old_vert_pct = 0;
-static int synaptics_old_horiz_pct = 0;
-static int synaptics_old_button_pct = 0;
-static int synaptics_old_button_boundary = SYNAPTICS_EDGE_BOTTOM;
-static int synaptics_old_horiz_edge = SYNAPTICS_EDGE_BOTTOM;
-static int synaptics_old_vert_edge = SYNAPTICS_EDGE_RIGHT;
+/*
+ * invalid old values, recalculate everything
+ */
+static int synaptics_old_vscroll_pct = -1;
+static int synaptics_old_hscroll_pct = -1;
+static int synaptics_old_button_pct = -1;
+static int synaptics_old_button_boundary = -1;
+static int synaptics_old_edge_right = -1;
+static int synaptics_old_edge_bottom = -1;
 
 /*
  * This holds the processed packet data, it is global because multiple
@@ -208,7 +211,7 @@ synaptics_poll_cmd(struct pms_softc *psc
 	int res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd, i, 0,
 	NULL, 0);
 	if (res)
-		aprint_error_dev(psc->sc_dev, "command error %#x\n", cmd[0]);
+		device_printf(psc->sc_dev, "command error %#x\n", cmd[0]);
 	return res;
 }
 
@@ -221,7 +224,7 @@ synaptics_poll_reset(struct pms_softc *p
 	u_char cmd[1] = { PMS_RESET };
 	res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot, cmd, 1, 2,
 	resp, 1);
-	aprint_debug_dev(psc->sc_dev, "reset %d 0x%02x 0x%02x\n",
+	DPRINTF(10, >u.synaptics, "reset %d 0x%02x 0x%02x\n",
 	res, resp[0], resp[1]);
 	return res;
 }
@@ -251,80 +254,90 @@ synaptics_special_write(struct pms_softc
 	return res;
 }
 
+static int
+synaptics_value(int pct, int low, int high)
+{
+	return low + pct * (high - low) / 100UL;
+}
+
+static int
+synaptics_percentage(int val, int low, int high)
+{
+	return ((val - low) * 100UL + high - low - 1) / (high - low);
+}
+
 static void
 pms_synaptics_set_boundaries(void)
 {
-	if (synaptics_vert_pct != synaptics_old_vert_pct ) {
-		synaptics_edge_right = synaptics_actual_edge_right -
-		((unsigned long) synaptics_vert_pct *
-		(synaptics_actual_edge_right - synaptics_edge_left)) / 100;
-		synaptics_old_vert_pct = synaptics_vert_pct;
-		synaptics_old_vert_edge = synaptics_edge_right;
+	if (synaptics_vscroll_pct != synaptics_old_vscroll_pct ) {
+		

CVS commit: src/sys/dev/pckbport

2024-04-18 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Apr 18 17:35:53 UTC 2024

Modified Files:
src/sys/dev/pckbport: synaptics.c

Log Message:
Renamed border/boundary variables to better describe their use.
Fix edge default values, factor out percentage calculation for more consistent
values. Use device_printf/DPRINTF to show errors instead of aprint variants.
Print raw input for debugging.

Correct capability parsing. Old devices were probed with nonexistent
commands and then used undefined boundary values that made them unusuable.

Fixes PR 57874.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pckbport/synaptics.c

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



CVS commit: src/sys/arch/hppa/dev

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 18 04:52:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
allow mapping of blitter registers


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/dev/gftfb.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/arch/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.13 src/sys/arch/hppa/dev/gftfb.c:1.14
--- src/sys/arch/hppa/dev/gftfb.c:1.13	Mon Apr  1 09:48:58 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Apr 18 04:52:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.13 2024/04/01 09:48:58 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.14 2024/04/18 04:52:43 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -237,7 +237,8 @@ gftfb_attach(device_t parent, device_t s
 	}
 	rom = (struct sti_rom *)kmem_zalloc(sizeof(*rom), KM_SLEEP);
 	rom->rom_softc = >sc_base;
-	ret = sti_rom_setup(rom, paa->pa_iot, paa->pa_memt, sc->sc_romh, sc->sc_base.bases, STI_CODEBASE_MAIN);
+	ret = sti_rom_setup(rom, paa->pa_iot, paa->pa_memt, sc->sc_romh,
+	sc->sc_base.bases, STI_CODEBASE_MAIN);
 	if (ret != 0) {
 		kmem_free(rom, sizeof(*rom));
 		return;
@@ -889,16 +890,22 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	struct vcons_data *vd = v;
 	struct gftfb_softc *sc = vd->cookie;
 	struct sti_rom *rom = sc->sc_base.sc_rom;
-	paddr_t pa;
+	paddr_t pa = -1;
 
-	if (offset < 0 || offset >= sc->sc_scr.fblen)
-		return -1;
 
-	if (sc->sc_mode != WSDISPLAYIO_MODE_DUMBFB)
+	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset, prot,
-	BUS_SPACE_MAP_LINEAR);
+	if (offset >= 0 || offset < sc->sc_scr.fblen) {
+		/* framebuffer */
+		pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset,
+		prot, BUS_SPACE_MAP_LINEAR);
+	} else if (offset >= 0x8000 && offset < 0x804) {
+		/* blitter registers etc. */
+		pa = bus_space_mmap(rom->memt, rom->regh[2],
+		offset - 0x8000, prot, BUS_SPACE_MAP_LINEAR);
+	}
+
 	return pa;
 }
 



CVS commit: src/sys/arch/hppa/dev

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 18 04:52:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
allow mapping of blitter registers


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/dev/gftfb.c

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



  1   2   3   4   5   6   7   8   9   10   >