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

2022-12-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec  3 16:56:41 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Explicitly include  for hz(9) as man pages says.

XXX: it looks sys/param.h r1.615 and later also has extern int hz


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.123 src/sys/arch/hp300/dev/rd.c:1.124
--- src/sys/arch/hp300/dev/rd.c:1.123	Sat Dec  3 06:08:18 2022
+++ src/sys/arch/hp300/dev/rd.c	Sat Dec  3 16:56:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.123 2022/12/03 06:08:18 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.124 2022/12/03 16:56:40 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,12 +72,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.123 2022/12/03 06:08:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.124 2022/12/03 16:56:40 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



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

2022-12-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec  3 16:56:41 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Explicitly include  for hz(9) as man pages says.

XXX: it looks sys/param.h r1.615 and later also has extern int hz


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-12-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec  3 06:08:18 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Add empty DIOCCACHESYNC ioctl(2) for rd(4).

Without this raid(4) always complains on various raidctl(8) ops:
> raid0: cache flush[0] to component 0 failed (22)

RAID1 configured by raid(4) just works HP-IB disks on hp300.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.122 src/sys/arch/hp300/dev/rd.c:1.123
--- src/sys/arch/hp300/dev/rd.c:1.122	Thu Dec  1 15:02:11 2022
+++ src/sys/arch/hp300/dev/rd.c	Sat Dec  3 06:08:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.122 2022/12/01 15:02:11 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.123 2022/12/03 06:08:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.122 2022/12/01 15:02:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.123 2022/12/03 06:08:18 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -1363,6 +1363,10 @@ rdioctl(dev_t dev, u_long cmd, void *dat
 	case DIOCGDEFLABEL:
 		rdgetdefaultlabel(sc, (struct disklabel *)data);
 		return 0;
+
+	case DIOCCACHESYNC:
+		/* no cache to be flushed but required to appease raid(4) */
+		return 0;
 	}
 	return EINVAL;
 }



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

2022-12-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec  3 06:08:18 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Add empty DIOCCACHESYNC ioctl(2) for rd(4).

Without this raid(4) always complains on various raidctl(8) ops:
> raid0: cache flush[0] to component 0 failed (22)

RAID1 configured by raid(4) just works HP-IB disks on hp300.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-12-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec  1 15:02:11 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.121 src/sys/arch/hp300/dev/rd.c:1.122
--- src/sys/arch/hp300/dev/rd.c:1.121	Wed Nov 30 18:15:32 2022
+++ src/sys/arch/hp300/dev/rd.c	Thu Dec  1 15:02:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.122 2022/12/01 15:02:11 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.122 2022/12/01 15:02:11 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -102,7 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.121
 
 #include "ioconf.h"
 
-int	rderrthresh = RDRETRY-1;	/* when to start reporting errors */
+int	rderrthresh = RDRETRY - 1;	/* when to start reporting errors */
 
 #ifdef DEBUG
 /* error message tables */
@@ -547,7 +547,7 @@ rdattach(device_t parent, device_t self,
 	sc->sc_flags = RDF_ALIVE;
 #ifdef DEBUG
 	/* always report errors */
-	if (rddebug & RDB_ERROR)
+	if ((rddebug & RDB_ERROR) != 0)
 		rderrthresh = 0;
 #endif
 	/*
@@ -812,8 +812,8 @@ rdopen(dev_t dev, int flags, int mode, s
 	/*
 	 * Wait for any pending opens/closes to complete
 	 */
-	while (sc->sc_flags & (RDF_OPENING|RDF_CLOSING))
-		(void) tsleep(sc, PRIBIO, "rdopen", 0);
+	while ((sc->sc_flags & (RDF_OPENING | RDF_CLOSING)) != 0)
+		(void)tsleep(sc, PRIBIO, "rdopen", 0);
 
 	/*
 	 * On first open, get label and partition info.
@@ -878,10 +878,10 @@ rdclose(dev_t dev, int flag, int mode, s
 		s = splbio();
 		while (sc->sc_active) {
 			sc->sc_flags |= RDF_WANTED;
-			(void) tsleep(>sc_tab, PRIBIO, "rdclose", 0);
+			(void)tsleep(>sc_tab, PRIBIO, "rdclose", 0);
 		}
 		splx(s);
-		sc->sc_flags &= ~(RDF_CLOSING|RDF_WLABEL);
+		sc->sc_flags &= ~(RDF_CLOSING | RDF_WLABEL);
 		wakeup((void *)sc);
 	}
 	return 0;
@@ -897,10 +897,11 @@ rdstrategy(struct buf *bp)
 	int offset;
 
 #ifdef DEBUG
-	if (rddebug & RDB_FOLLOW)
-		printf("rdstrategy(%p): dev %"PRIx64", bn %llx, bcount %x, %c\n",
-		   bp, bp->b_dev, bp->b_blkno, bp->b_bcount,
-		   (bp->b_flags & B_READ) ? 'R' : 'W');
+	if ((rddebug & RDB_FOLLOW) != 0)
+		printf("rdstrategy(%p): dev %" PRIx64
+		", bn %llx, bcount %x, %c\n",
+		bp, bp->b_dev, bp->b_blkno, bp->b_bcount,
+		(bp->b_flags & B_READ) != 0 ? 'R' : 'W');
 #endif
 	bn = bp->b_blkno;
 	pinfo = >sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)];
@@ -926,7 +927,7 @@ rdstrategy(struct buf *bp)
 	}
 	splx(s);
 	return;
-done:
+ done:
 	biodone(bp);
 }
 
@@ -936,8 +937,11 @@ done:
 static void
 rdrestart(void *arg)
 {
-	int s = splbio();
-	rdustart((struct rd_softc *)arg);
+	struct rd_softc *sc = arg;
+	int s;
+
+	s = splbio();
+	rdustart(sc);
 	splx(s);
 }
 
@@ -965,7 +969,7 @@ rdfinish(struct rd_softc *sc, struct buf
 	if ((bp = bufq_peek(sc->sc_tab)) != NULL)
 		return bp;
 	sc->sc_active = 0;
-	if (sc->sc_flags & RDF_WANTED) {
+	if ((sc->sc_flags & RDF_WANTED) != 0) {
 		sc->sc_flags &= ~RDF_WANTED;
 		wakeup((void *)>sc_tab);
 	}
@@ -982,7 +986,7 @@ rdstart(void *arg)
 	ctlr = device_unit(device_parent(sc->sc_dev));
 	slave = sc->sc_slave;
 
-again:
+ again:
 #ifdef DEBUG
 	if (rddebug & RDB_FOLLOW)
 		printf("rdstart(%s): bp %p, %c\n", device_xname(sc->sc_dev), bp,
@@ -997,22 +1001,22 @@ again:
 	sc->sc_ioc.c_nop2 = C_NOP;
 	sc->sc_ioc.c_slen = C_SLEN;
 	sc->sc_ioc.c_len = sc->sc_resid;
-	sc->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE;
+	sc->sc_ioc.c_cmd = (bp->b_flags & B_READ) != 0 ? C_READ : C_WRITE;
 #ifdef DEBUG
-	if (rddebug & RDB_IO)
+	if ((rddebug & RDB_IO) != 0)
 		printf("rdstart: hpibsend(%x, %x, %x, %p, %x)\n",
-		   ctlr, slave, C_CMD,
-		   >sc_ioc.c_unit, sizeof(sc->sc_ioc) - 2);
+		ctlr, slave, C_CMD,
+		>sc_ioc.c_unit, sizeof(sc->sc_ioc) - 2);
 #endif
 	if (hpibsend(ctlr, slave, C_CMD, >sc_ioc.c_unit,
-		 sizeof(sc->sc_ioc) - 2) == sizeof(sc->sc_ioc) - 2) {
+	sizeof(sc->sc_ioc) - 2) == sizeof(sc->sc_ioc) - 2) {
 
 		/* Instrumentation. */
 		disk_busy(>sc_dkdev);
 		iostat_seek(sc->sc_dkdev.dk_stats);
 
 #ifdef DEBUG
-		if (rddebug & RDB_IO)
+		if ((rddebug & RDB_IO) != 0)
 			printf("rdstart: hpibawait(%x)\n", ctlr);
 #endif
 		hpibawait(ctlr);
@@ -1025,7 +1029,7 @@ again:
 	 * integrate this with the backoff code in rderror.
 	 */
 #ifdef DEBUG
-	if (rddebug & RDB_ERROR)
+	if ((rddebug & RDB_ERROR) != 0)
 		printf("%s: rdstart: cmd %x adr %x blk %lld len %d ecnt %d\n",
 		device_xname(sc->sc_dev),
 		sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
@@ 

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

2022-12-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec  1 15:02:11 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 18:15:32 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove more duplicated static function declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.120 src/sys/arch/hp300/dev/rd.c:1.121
--- src/sys/arch/hp300/dev/rd.c:1.120	Wed Nov 30 17:42:20 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 18:15:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -430,8 +430,6 @@ static void	rdreset(struct rd_softc *);
 static void	rdreset_unit(int, int, int);
 static void	rd_set_geom(struct rd_softc *);
 static int	rdgetinfo(dev_t);
-static void	rdrestart(void *);
-static struct buf *rdfinish(struct rd_softc *, struct buf *);
 
 static void	rdgetdefaultlabel(struct rd_softc *, struct disklabel *);
 static void	rdrestart(void *);



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 18:15:32 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove more duplicated static function declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:42:21 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Use proper RAW_PART macro rather than a magic number.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.119 src/sys/arch/hp300/dev/rd.c:1.120
--- src/sys/arch/hp300/dev/rd.c:1.119	Wed Nov 30 17:39:12 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 17:42:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -790,7 +790,7 @@ rdgetinfo(dev_t dev)
 	pi = lp->d_partitions;
 	printf("%s: WARNING: %s\n", device_xname(sc->sc_dev), msg);
 
-	pi[2].p_size = rdidentinfo[sc->sc_type].ri_nblocks;
+	pi[RAW_PART].p_size = rdidentinfo[sc->sc_type].ri_nblocks;
 	/* XXX reset other info since readdisklabel screws with it */
 	lp->d_npartitions = 3;
 	pi[0].p_size = 0;



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:42:21 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Use proper RAW_PART macro rather than a magic number.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:39:12 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().

With this change raid(4) no longer complains before mountroot:
> RAIDframe: can't get disk size for dev rd0 (22)

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:39:12 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl().

With this change raid(4) no longer complains before mountroot:
> RAIDframe: can't get disk size for dev rd0 (22)

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.118 src/sys/arch/hp300/dev/rd.c:1.119
--- src/sys/arch/hp300/dev/rd.c:1.118	Wed Nov 30 17:07:30 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 17:39:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -428,6 +428,7 @@ static int	rdident(device_t, struct rd_s
 		struct hpibbus_attach_args *);
 static void	rdreset(struct rd_softc *);
 static void	rdreset_unit(int, int, int);
+static void	rd_set_geom(struct rd_softc *);
 static int	rdgetinfo(dev_t);
 static void	rdrestart(void *);
 static struct buf *rdfinish(struct rd_softc *, struct buf *);
@@ -531,6 +532,7 @@ rdattach(device_t parent, device_t self,
 	memset(>sc_dkdev, 0, sizeof(sc->sc_dkdev));
 	disk_init(>sc_dkdev, device_xname(sc->sc_dev), NULL);
 	disk_attach(>sc_dkdev);
+	rd_set_geom(sc);
 
 	sc->sc_slave = ha->ha_slave;
 	sc->sc_punit = ha->ha_punit;
@@ -743,6 +745,23 @@ rdreset_unit(int ctlr, int slave, int pu
 	hpibrecv(ctlr, slave, C_QSTAT, , sizeof(stat));
 }
 
+static void
+rd_set_geom(struct rd_softc *sc)
+{
+	struct disk_geom *dg = >sc_dkdev.dk_geom;
+	const struct rdidentinfo *ri = [sc->sc_type];
+
+	memset(dg, 0, sizeof(*dg));
+
+	dg->dg_secsize = DEV_BSIZE;
+	dg->dg_nsectors = ri->ri_nbpt;
+	dg->dg_ntracks = ri->ri_ntpc;
+	dg->dg_ncylinders = ri->ri_ncyl;
+	dg->dg_secperunit = ri->ri_nblocks;
+
+	disk_set_info(sc->sc_dev, >sc_dkdev, ri->ri_desc);
+}
+
 /*
  * Read or construct a disklabel
  */



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:07:30 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove a duplicated static function declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.117 src/sys/arch/hp300/dev/rd.c:1.118
--- src/sys/arch/hp300/dev/rd.c:1.117	Wed Nov 30 17:01:56 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 17:07:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -428,7 +428,6 @@ static int	rdident(device_t, struct rd_s
 		struct hpibbus_attach_args *);
 static void	rdreset(struct rd_softc *);
 static void	rdreset_unit(int, int, int);
-static void	rdustart(struct rd_softc *);
 static int	rdgetinfo(dev_t);
 static void	rdrestart(void *);
 static struct buf *rdfinish(struct rd_softc *, struct buf *);



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:07:30 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove a duplicated static function declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:01:56 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Pass a correct dev_t arg to disk_ioctl().

Probably harmless.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 17:01:56 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Pass a correct dev_t arg to disk_ioctl().

Probably harmless.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.116 src/sys/arch/hp300/dev/rd.c:1.117
--- src/sys/arch/hp300/dev/rd.c:1.116	Wed Nov 30 16:37:44 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 17:01:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -1305,7 +1305,7 @@ rdioctl(dev_t dev, u_long cmd, void *dat
 	struct disklabel *lp = sc->sc_dkdev.dk_label;
 	int error, flags;
 
-	error = disk_ioctl(>sc_dkdev, rdpart(dev), cmd, data, flag, l);
+	error = disk_ioctl(>sc_dkdev, dev, cmd, data, flag, l);
 	if (error != EPASSTHROUGH)
 		return error;
 



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 16:37:44 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Check bounds of each partition by MI bounds_check_with_label(9).

The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.115 src/sys/arch/hp300/dev/rd.c:1.116
--- src/sys/arch/hp300/dev/rd.c:1.115	Wed Nov 30 15:59:01 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 16:37:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -877,7 +877,7 @@ rdstrategy(struct buf *bp)
 	struct rd_softc *sc = device_lookup_private(_cd, rdunit(bp->b_dev));
 	struct partition *pinfo;
 	daddr_t bn;
-	int sz, s;
+	int s;
 	int offset;
 
 #ifdef DEBUG
@@ -887,7 +887,6 @@ rdstrategy(struct buf *bp)
 		   (bp->b_flags & B_READ) ? 'R' : 'W');
 #endif
 	bn = bp->b_blkno;
-	sz = howmany(bp->b_bcount, DEV_BSIZE);
 	pinfo = >sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)];
 
 	/* Don't perform partition translation on RAW_PART. */
@@ -898,34 +897,9 @@ rdstrategy(struct buf *bp)
 		rdidentinfo[sc->sc_type].ri_nblocks) <= 0)
 			goto done;
 	} else {
-		/*
-		 * XXX This block of code belongs in
-		 * XXX bounds_check_with_label()
-		 */
-
-		if (bn < 0 || bn + sz > pinfo->p_size) {
-			sz = pinfo->p_size - bn;
-			if (sz == 0) {
-bp->b_resid = bp->b_bcount;
-goto done;
-			}
-			if (sz < 0) {
-bp->b_error = EINVAL;
-goto done;
-			}
-			bp->b_bcount = dbtob(sz);
-		}
-		/*
-		 * Check for write to write protected label
-		 */
-		if (bn + offset <= LABELSECTOR &&
-#if LABELSECTOR != 0
-		bn + offset + sz > LABELSECTOR &&
-#endif
-		!(bp->b_flags & B_READ) && !(sc->sc_flags & RDF_WLABEL)) {
-			bp->b_error = EROFS;
+		if (bounds_check_with_label(>sc_dkdev, bp,
+		(sc->sc_flags & RDF_WLABEL) != 0) <= 0)
 			goto done;
-		}
 	}
 	bp->b_rawblkno = bn + offset;
 	s = splbio();



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 16:37:44 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Check bounds of each partition by MI bounds_check_with_label(9).

The previous implementation was committed in rev 1.26 about 26 years ago
and it looks there is no quirk to use the old MD one.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 15:59:01 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.

With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media.  Tested on 425t and HPDisk.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.114 src/sys/arch/hp300/dev/rd.c:1.115
--- src/sys/arch/hp300/dev/rd.c:1.114	Fri Nov 25 16:12:32 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 30 15:59:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -893,7 +893,11 @@ rdstrategy(struct buf *bp)
 	/* Don't perform partition translation on RAW_PART. */
 	offset = (rdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset;
 
-	if (rdpart(bp->b_dev) != RAW_PART) {
+	if (rdpart(bp->b_dev) == RAW_PART) {
+		if (bounds_check_with_mediasize(bp, DEV_BSIZE,
+		rdidentinfo[sc->sc_type].ri_nblocks) <= 0)
+			goto done;
+	} else {
 		/*
 		 * XXX This block of code belongs in
 		 * XXX bounds_check_with_label()



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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 15:59:01 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers.

With this check, dd(1) without a count value against a raw partition
is terminated properly at the end of media.  Tested on 425t and HPDisk.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 11:36:50 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: topcat.c

Log Message:
Fix silent bus error panic on 98543A topcat framebuffer on HP320 and HP360.

It looks DELAY(100)s before checking cmap_busy in old pre-wscons grf_tc.c
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hp300/dev/Attic/grf_tc.c?rev=1.42
are actually necessary on 68020 (HP320) and 68030 (HP360) machines,
while it works without them on 68040 (HP380).

Should be pulled up to netbsd-9.


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

2022-11-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 30 11:36:50 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: topcat.c

Log Message:
Fix silent bus error panic on 98543A topcat framebuffer on HP320 and HP360.

It looks DELAY(100)s before checking cmap_busy in old pre-wscons grf_tc.c
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hp300/dev/Attic/grf_tc.c?rev=1.42
are actually necessary on 68020 (HP320) and 68030 (HP360) machines,
while it works without them on 68040 (HP380).

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/dev/topcat.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/hp300/dev/topcat.c
diff -u src/sys/arch/hp300/dev/topcat.c:1.5 src/sys/arch/hp300/dev/topcat.c:1.6
--- src/sys/arch/hp300/dev/topcat.c:1.5	Thu Apr 15 14:43:19 2021
+++ src/sys/arch/hp300/dev/topcat.c	Wed Nov 30 11:36:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: topcat.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $	*/
+/*	$NetBSD: topcat.c,v 1.6 2022/11/30 11:36:50 tsutsui Exp $	*/
 /*	$OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $	*/
 
 /*
@@ -448,6 +448,8 @@ topcat_setcolor(struct diofb *fb, u_int 
 		tc->gdata  = fb->cmap.g[index];
 		tc->bdata  = fb->cmap.b[index];
 		tc->strobe = 0xff;
+		/* XXX delay required on 68020/30 to avoid bus error */
+		DELAY(100);
 
 		tccm_waitbusy(tc);
 		tc->cindex = 0;
@@ -459,6 +461,8 @@ topcat_setcolor(struct diofb *fb, u_int 
 		tc->bdata  = fb->cmap.b[index];
 		tc->cindex = ~index;
 		tc->strobe = 0xff;
+		/* XXX delay required on 68020/30 to avoid bus error */
+		DELAY(100);
 
 		tccm_waitbusy(tc);
 		tc->rdata  = 0;



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

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov 26 00:25:36 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: mt.c mtreg.h

Log Message:
Misc KNF and cosmetics.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/hp300/dev/mt.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/dev/mtreg.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/hp300/dev/mt.c
diff -u src/sys/arch/hp300/dev/mt.c:1.55 src/sys/arch/hp300/dev/mt.c:1.56
--- src/sys/arch/hp300/dev/mt.c:1.55	Mon Jul  5 14:03:46 2021
+++ src/sys/arch/hp300/dev/mt.c	Sat Nov 26 00:25:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mt.c,v 1.55 2021/07/05 14:03:46 tsutsui Exp $	*/
+/*	$NetBSD: mt.c,v 1.56 2022/11/26 00:25:36 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.55 2021/07/05 14:03:46 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.56 2022/11/26 00:25:36 tsutsui Exp $");
 
 #include 
 #include 
@@ -86,7 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.55 
 #include "ioconf.h"
 
 static const struct mtinfo {
-	u_short	hwid;
+	uint16_t hwid;
 	const char *desc;
 } mtinfo[] = {
 	{ MT7978ID,	"7978"	},
@@ -103,8 +103,8 @@ struct	mt_softc {
 	int	sc_hpibno;	/* logical HPIB this slave it attached to */
 	int	sc_slave;	/* HPIB slave address (0-6) */
 	short	sc_flags;	/* see below */
-	u_char	sc_lastdsj;	/* place for DSJ in mtreaddsj() */
-	u_char	sc_lastecmd;	/* place for End Command in mtreaddsj() */
+	uint8_t	sc_lastdsj;	/* place for DSJ in mtreaddsj() */
+	uint8_t	sc_lastecmd;	/* place for End Command in mtreaddsj() */
 	short	sc_recvtimeo;	/* count of hpibsend timeouts to prevent hang */
 	short	sc_statindex;	/* index for next sc_stat when MTF_STATTIMEO */
 	struct	mt_stat sc_stat;/* status bytes last read from device */
@@ -247,10 +247,10 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
 {
 	int retval;
 
-	if (sc->sc_flags & MTF_STATTIMEO)
+	if ((sc->sc_flags & MTF_STATTIMEO) != 0)
 		goto getstats;
 	retval = hpibrecv(sc->sc_hpibno,
-	(sc->sc_flags & MTF_DSJTIMEO) ? -1 : sc->sc_slave,
+	(sc->sc_flags & MTF_DSJTIMEO) != 0 ? -1 : sc->sc_slave,
 	MTT_DSJ, &(sc->sc_lastdsj), 1);
 	sc->sc_flags &= ~MTF_DSJTIMEO;
 	if (retval != 1) {
@@ -270,24 +270,24 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
 	sc->sc_lastdsj);
 	sc->sc_lastecmd = ecmd;
 	switch (sc->sc_lastdsj) {
-	case 0:
+	case 0:
 		if (ecmd & MTE_DSJ_FORCE)
 			break;
 		return 0;
 
-	case 2:
+	case 2:
 		sc->sc_lastecmd = MTE_COMPLETE;
-	case 1:
+	case 1:
 		break;
 
-	default:
+	default:
 		log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", device_xname(sc->sc_dev),
 		sc->sc_lastdsj);
 		return -1;
 	}
  getstats:
 	retval = hpibrecv(sc->sc_hpibno,
-	(sc->sc_flags & MTF_STATCONT) ? -1 : sc->sc_slave,
+	(sc->sc_flags & MTF_STATCONT) != 0 ? -1 : sc->sc_slave,
 	MTT_STAT, ((char *)&(sc->sc_stat)) + sc->sc_statindex,
 	sizeof(sc->sc_stat) - sc->sc_statindex);
 	sc->sc_flags &= ~(MTF_STATTIMEO | MTF_STATCONT);
@@ -312,9 +312,9 @@ mtreaddsj(struct mt_softc *sc, int ecmd)
 	device_xname(sc->sc_dev),
 	sc->sc_stat1, sc->sc_stat2, sc->sc_stat3,
 	sc->sc_stat4, sc->sc_stat5, sc->sc_stat6);
-	if (sc->sc_lastecmd)
+	if (sc->sc_lastecmd != 0)
 		(void) hpibsend(sc->sc_hpibno, sc->sc_slave,
-		MTL_ECMD, &(sc->sc_lastecmd), 1);
+		MTL_ECMD, >sc_lastecmd, 1);
 	return (int)sc->sc_lastdsj;
 }
 
@@ -334,7 +334,7 @@ mtopen(dev_t dev, int flag, int mode, st
 
 	dlog(LOG_DEBUG, "%s open: flags 0x%x", device_xname(sc->sc_dev),
 	sc->sc_flags);
-	if (sc->sc_flags & MTF_OPEN)
+	if ((sc->sc_flags & MTF_OPEN) != 0)
 		return EBUSY;
 	sc->sc_flags |= MTF_OPEN;
 	sc->sc_ttyp = tprintf_open(l->l_proc);
@@ -348,7 +348,7 @@ mtopen(dev_t dev, int flag, int mode, st
 	for (;;) {
 		if ((error = mtcommand(dev, MTNOP, 0)) != 0)
 			goto errout;
-		if (!(sc->sc_flags & MTF_REW))
+		if ((sc->sc_flags & MTF_REW) == 0)
 			break;
 		error = kpause("mt", true, hz, NULL);
 		if (error != 0 && error != EWOULDBLOCK) {
@@ -356,11 +356,11 @@ mtopen(dev_t dev, int flag, int mode, st
 			goto errout;
 		}
 	}
-	if ((flag & FWRITE) && (sc->sc_stat1 & SR1_RO)) {
+	if ((flag & FWRITE) != 0 && (sc->sc_stat1 & SR1_RO) != 0) {
 		error = EROFS;
 		goto errout;
 	}
-	if (!(sc->sc_stat1 & SR1_ONLINE)) {
+	if ((sc->sc_stat1 & SR1_ONLINE) == 0) {
 		uprintf("%s: not online\n", device_xname(sc->sc_dev));
 		error = EIO;
 		goto errout;
@@ -395,16 +395,15 @@ mtopen(dev_t dev, int flag, int mode, st
 			 (sc->sc_stat3 & SR3_800) ? T_800BPI : -1));
 	req_den = (dev & T_DENSEL);
 
-	if (flag & FWRITE) {
-		if (!(sc->sc_stat1 & SR1_BOT)) {
+	if ((flag & FWRITE) != 0) {
+		if ((sc->sc_stat1 & SR1_BOT) == 0) {
 			if (sc->sc_density != req_den) {
 uprintf("%s: can't change density mid-tape\n",
 device_xname(sc->sc_dev));
 

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

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov 26 00:25:36 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: mt.c mtreg.h

Log Message:
Misc KNF and cosmetics.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/hp300/dev/mt.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/dev/mtreg.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/hp300/dev

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 16:12:32 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove unnecessary declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.113 src/sys/arch/hp300/dev/rd.c:1.114
--- src/sys/arch/hp300/dev/rd.c:1.113	Fri Nov 25 13:02:51 2022
+++ src/sys/arch/hp300/dev/rd.c	Fri Nov 25 16:12:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -1202,7 +1202,6 @@ rderror(int unit)
 	struct rd_stat *sp;
 	struct buf *bp;
 	daddr_t hwbn, pbn;
-	char *hexstr(int, int); /* XXX */
 
 	if (rdstatus(sc)) {
 #ifdef DEBUG
@@ -1226,7 +1225,6 @@ rderror(int unit)
 	 * RDRETRY as defined, the range is 1 to 32 seconds.
 	 */
 	if (sp->c_fef & FEF_IMR) {
-		extern int hz;
 		int rdtimo = RDWAITC << sc->sc_errcnt;
 #ifdef DEBUG
 		printf("%s: internal maintenance, %d second timeout\n",



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

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 16:12:32 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Remove unnecessary declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/hp300/dev/rd.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/hp300/dev

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:12:02 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: frodo.c

Log Message:
Service mode switch should not be treated as an error.

Use aprint_normal(9) to avoid confusing dmesg.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/hp300/dev/frodo.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/hp300/dev/frodo.c
diff -u src/sys/arch/hp300/dev/frodo.c:1.34 src/sys/arch/hp300/dev/frodo.c:1.35
--- src/sys/arch/hp300/dev/frodo.c:1.34	Sat Aug  7 16:18:53 2021
+++ src/sys/arch/hp300/dev/frodo.c	Fri Nov 25 13:12:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: frodo.c,v 1.34 2021/08/07 16:18:53 thorpej Exp $	*/
+/*	$NetBSD: frodo.c,v 1.35 2022/11/25 13:12:02 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: frodo.c,v 1.34 2021/08/07 16:18:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: frodo.c,v 1.35 2022/11/25 13:12:02 tsutsui Exp $");
 
 #define	_HP300_INTR_H_PRIVATE
 
@@ -155,7 +155,7 @@ frodoattach(device_t parent, device_t se
 	sc->sc_ipl = ia->ia_ipl;
 
 	if ((FRODO_READ(sc, FRODO_IISR) & FRODO_IISR_SERVICE) == 0)
-		aprint_error(": service mode enabled");
+		aprint_normal(": service mode enabled");
 	aprint_normal("\n");
 
 	/* Initialize bus_space_tag_t for frodo */



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

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:12:02 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: frodo.c

Log Message:
Service mode switch should not be treated as an error.

Use aprint_normal(9) to avoid confusing dmesg.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/hp300/dev/frodo.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/hp300/stand/common

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:06:27 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync with rdreg.h integer type changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common/rd.c
diff -u src/sys/arch/hp300/stand/common/rd.c:1.14 src/sys/arch/hp300/stand/common/rd.c:1.15
--- src/sys/arch/hp300/stand/common/rd.c:1.14	Mon Nov 21 16:22:37 2022
+++ src/sys/arch/hp300/stand/common/rd.c	Fri Nov 25 13:06:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.14 2022/11/21 16:22:37 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.15 2022/11/25 13:06:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -370,7 +370,7 @@ rderror(int ctlr, int unit, int part)
 	printf("rd(%d,%d,0,%d) err: vu 0x%x",
 	   ctlr, unit, part, rd_stat.c_vu);
 	if ((rd_stat.c_aef & AEF_UD) || (rd_stat.c_ief & (IEF_MD|IEF_RD)))
-		printf(", block %ld", rd_stat.c_blk);
+		printf(", block %d", rd_stat.c_blk);
 	printf(", R0x%x F0x%x A0x%x I0x%x\n",
 	   rd_stat.c_ref, rd_stat.c_fef, rd_stat.c_aef, rd_stat.c_ief);
 	return 1;



CVS commit: src/sys/arch/hp300/stand/common

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:06:27 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync with rdreg.h integer type changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hp300/stand/common/rd.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/hp300/dev

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:02:51 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c rdreg.h

Log Message:
Use proper integer types for HP-IB xfer parameters.

No visible regression on 425t and HPDisk.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp300/dev/rdreg.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/hp300/dev

2022-11-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov 25 13:02:51 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c rdreg.h

Log Message:
Use proper integer types for HP-IB xfer parameters.

No visible regression on 425t and HPDisk.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hp300/dev/rdreg.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.112 src/sys/arch/hp300/dev/rd.c:1.113
--- src/sys/arch/hp300/dev/rd.c:1.112	Wed Nov 23 18:53:22 2022
+++ src/sys/arch/hp300/dev/rd.c	Fri Nov 25 13:02:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.113 2022/11/25 13:02:51 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -562,7 +562,7 @@ static int
 rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
 {
 	struct cs80_describe desc;
-	u_char stat, cmd[3];
+	uint8_t stat, cmd[3];
 	char name[7];
 	int i, id, n, ctlr, slave;
 
@@ -717,7 +717,7 @@ rdreset_unit(int ctlr, int slave, int pu
 	struct rd_ssmcmd ssmc;
 	struct rd_srcmd src;
 	struct rd_clearcmd clear;
-	u_char stat;
+	uint8_t stat;
 
 	clear.c_unit = C_SUNIT(punit);
 	clear.c_cmd = C_CLEAR;
@@ -1032,7 +1032,7 @@ again:
 	 */
 #ifdef DEBUG
 	if (rddebug & RDB_ERROR)
-		printf("%s: rdstart: cmd %x adr %lx blk %lld len %d ecnt %d\n",
+		printf("%s: rdstart: cmd %x adr %x blk %lld len %d ecnt %d\n",
 		device_xname(sc->sc_dev),
 		sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
 		bp->b_blkno, sc->sc_resid, sc->sc_errcnt);
@@ -1042,7 +1042,7 @@ again:
 	rdreset(sc);
 	if (sc->sc_errcnt++ < RDRETRY)
 		goto again;
-	printf("%s: rdstart err: cmd 0x%x sect %ld blk %" PRId64 " len %d\n",
+	printf("%s: rdstart err: cmd 0x%x sect %u blk %" PRId64 " len %d\n",
 	device_xname(sc->sc_dev), sc->sc_ioc.c_cmd, sc->sc_ioc.c_addr,
 	bp->b_blkno, sc->sc_resid);
 	bp->b_error = EIO;
@@ -1083,7 +1083,7 @@ rdintr(void *arg)
 	struct rd_softc *sc = arg;
 	int unit = device_unit(sc->sc_dev);
 	struct buf *bp = bufq_peek(sc->sc_tab);
-	u_char stat = 13;	/* in case hpibrecv fails */
+	uint8_t stat = 13;	/* in case hpibrecv fails */
 	int rv, restart, ctlr, slave;
 
 	ctlr = device_unit(device_parent(sc->sc_dev));
@@ -1150,7 +1150,7 @@ static int
 rdstatus(struct rd_softc *sc)
 {
 	int c, s;
-	u_char stat;
+	uint8_t stat;
 	int rv;
 
 	c = device_unit(device_parent(sc->sc_dev));
@@ -1284,17 +1284,17 @@ rderror(int unit)
 		rdprinterr("access", sp->c_aef, err_access);
 		rdprinterr("info", sp->c_ief, err_info);
 		printf("block: %lld, P1-P10: ", hwbn);
-		printf("0x%x", *(u_int *)>c_raw[0]);
-		printf("0x%x", *(u_int *)>c_raw[4]);
-		printf("0x%x\n", *(u_short *)>c_raw[8]);
+		printf("0x%x", *(uint32_t *)>c_raw[0]);
+		printf("0x%x", *(uint32_t *)>c_raw[4]);
+		printf("0x%x\n", *(uint16_t *)>c_raw[8]);
 		/* command */
 		printf("ioc: ");
-		printf("0x%x", *(u_int *)>sc_ioc.c_pad);
-		printf("0x%x", *(u_short *)>sc_ioc.c_hiaddr);
-		printf("0x%x", *(u_int *)>sc_ioc.c_addr);
-		printf("0x%x", *(u_short *)>sc_ioc.c_nop2);
-		printf("0x%x", *(u_int *)>sc_ioc.c_len);
-		printf("0x%x\n", *(u_short *)>sc_ioc.c_cmd);
+		printf("0x%x", *(uint32_t *)>sc_ioc.c_pad);
+		printf("0x%x", *(uint16_t *)>sc_ioc.c_hiaddr);
+		printf("0x%x", *(uint32_t *)>sc_ioc.c_addr);
+		printf("0x%x", *(uint16_t *)>sc_ioc.c_nop2);
+		printf("0x%x", *(uint32_t *)>sc_ioc.c_len);
+		printf("0x%x\n", *(uint16_t *)>sc_ioc.c_cmd);
 		return 1;
 	}
 #endif
@@ -1302,9 +1302,9 @@ rderror(int unit)
 	(sp->c_vu>>4)&0xF, sp->c_vu&0xF,
 	sp->c_ref, sp->c_fef, sp->c_aef, sp->c_ief);
 	printf("P1-P10: ");
-	printf("0x%x", *(u_int *)>c_raw[0]);
-	printf("0x%x", *(u_int *)>c_raw[4]);
-	printf("0x%x\n", *(u_short *)>c_raw[8]);
+	printf("0x%x", *(uint32_t *)>c_raw[0]);
+	printf("0x%x", *(uint32_t *)>c_raw[4]);
+	printf("0x%x\n", *(uint16_t *)>c_raw[8]);
 	return 1;
 }
 

Index: src/sys/arch/hp300/dev/rdreg.h
diff -u src/sys/arch/hp300/dev/rdreg.h:1.19 src/sys/arch/hp300/dev/rdreg.h:1.20
--- src/sys/arch/hp300/dev/rdreg.h:1.19	Mon Nov 21 16:22:37 2022
+++ src/sys/arch/hp300/dev/rdreg.h	Fri Nov 25 13:02:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rdreg.h,v 1.19 2022/11/21 16:22:37 tsutsui Exp $	*/
+/*	$NetBSD: rdreg.h,v 1.20 2022/11/25 13:02:51 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,42 +39,42 @@
  */
 
 struct	rd_iocmd {
-	char	c_pad;
-	char	c_unit;
-	char	c_volume;
-	char	c_saddr;
-	short	c_hiaddr;
-	long	c_addr;
-	char	c_nop2;
-	char	c_slen;
-	long	c_len;
-	char	c_cmd;
-	char	c_pad2;

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

2022-11-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 23 18:55:06 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rdvar.h

Log Message:
Remove now unused buffer members from softc prepared only for rdreset().


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hp300/dev/rdvar.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/hp300/dev/rdvar.h
diff -u src/sys/arch/hp300/dev/rdvar.h:1.26 src/sys/arch/hp300/dev/rdvar.h:1.27
--- src/sys/arch/hp300/dev/rdvar.h:1.26	Fri Jul  9 17:05:33 2021
+++ src/sys/arch/hp300/dev/rdvar.h	Wed Nov 23 18:55:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rdvar.h,v 1.26 2021/07/09 17:05:33 tsutsui Exp $	*/
+/*	$NetBSD: rdvar.h,v 1.27 2022/11/23 18:55:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -72,9 +72,6 @@ struct	rd_softc {
 	struct	rd_iocmd sc_ioc;
 	struct	rd_rscmd sc_rsc;
 	struct	rd_stat sc_stat;
-	struct	rd_ssmcmd sc_ssmc;
-	struct	rd_srcmd sc_src;
-	struct	rd_clearcmd sc_clear;
 	struct	bufq_state *sc_tab;
 	int	sc_active;
 	int	sc_errcnt;



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

2022-11-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 23 18:55:06 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rdvar.h

Log Message:
Remove now unused buffer members from softc prepared only for rdreset().


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/hp300/dev/rdvar.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/hp300/dev

2022-11-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 23 18:53:22 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.

- check not only stat value returned by C_QSTAT command against
  each punit but also desc.d_name returned by C_DESC command
  because it looks HPDisk responds to commands against punits supported
  but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
  probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/hp300/dev/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.111 src/sys/arch/hp300/dev/rd.c:1.112
--- src/sys/arch/hp300/dev/rd.c:1.111	Mon Nov 21 16:22:37 2022
+++ src/sys/arch/hp300/dev/rd.c	Wed Nov 23 18:53:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.111 2022/11/21 16:22:37 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.111 2022/11/21 16:22:37 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.112 2022/11/23 18:53:22 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -427,6 +427,7 @@ static const int numrdname2id = __arrayc
 static int	rdident(device_t, struct rd_softc *,
 		struct hpibbus_attach_args *);
 static void	rdreset(struct rd_softc *);
+static void	rdreset_unit(int, int, int);
 static void	rdustart(struct rd_softc *);
 static int	rdgetinfo(dev_t);
 static void	rdrestart(void *);
@@ -490,36 +491,8 @@ static int
 rdmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct hpibbus_attach_args *ha = aux;
-	struct rd_clearcmd ccmd;
-	int ctlr, slave, punit;
-	int rv;
-	uint8_t stat;
-
-	rv = rdident(parent, NULL, ha);
-
-	if (rv == 0)
-		return 0;
-
-	/*
-	 * The supported device ID is probed.
-	 * Check if the specified physical unit is actually supported
-	 * by brandnew HP-IB emulator devices like HPDisk and HPDrive etc.
-	 */
-	ctlr  = device_unit(parent);
-	slave = ha->ha_slave;
-	punit = ha->ha_punit;
-	if (punit == 0)
-		return 1;
 
-	ccmd.c_unit = C_SUNIT(punit);
-	ccmd.c_cmd  = C_CLEAR;
-	hpibsend(ctlr, slave, C_TCMD, , sizeof(ccmd));
-	hpibswait(ctlr, slave);
-	hpibrecv(ctlr, slave, C_QSTAT, , sizeof(stat));
-	if (stat != 0)
-		return 0;
-
-	return 1;
+	return rdident(parent, NULL, ha);
 }
 
 static void
@@ -608,29 +581,45 @@ rdident(device_t parent, struct rd_softc
 		return 0;
 
 	/*
-	 * If we're just probing for the device, that's all the
-	 * work we need to do.
+	 * The supported dvice ID is probed.
+	 * Check if the specified physical unit is actually supported
+	 * by brandnew HP-IB emulator devices like HPDisk and HPDrive etc.
 	 */
-	if (sc == NULL)
-		return 1;
-
 	/*
 	 * Reset device and collect description
 	 */
-	rdreset(sc);
+	memset(, 0, sizeof(desc));
+	stat = 0;
+	rdreset_unit(ctlr, slave, ha->ha_punit);
 	cmd[0] = C_SUNIT(ha->ha_punit);
 	cmd[1] = C_SVOL(0);
 	cmd[2] = C_DESC;
 	hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd));
 	hpibrecv(ctlr, slave, C_EXEC, , sizeof(desc));
 	hpibrecv(ctlr, slave, C_QSTAT, , sizeof(stat));
+
+	if (stat != 0 || desc.d_name == 0) {
+		/*
+		 * No valid response from the specified punit.
+		 *
+		 * Note it looks HPDisk responds to commands against
+		 * supported but not-configured punits at 1 to 3.
+		 */
+		return 0;
+	}
+
+	/*
+	 * If we're just probing for the device, that's all the
+	 * work we need to do.
+	 */
+	if (sc == NULL)
+		return 1;
+
 	memset(name, 0, sizeof(name));
-	if (stat == 0) {
-		n = desc.d_name;
-		for (i = 5; i >= 0; i--) {
-			name[i] = (n & 0xf) + '0';
-			n >>= 4;
-		}
+	n = desc.d_name;
+	for (i = 5; i >= 0; i--) {
+		name[i] = (n & 0xf) + '0';
+		n >>= 4;
 	}
 
 #ifdef DEBUG
@@ -711,36 +700,48 @@ rdident(device_t parent, struct rd_softc
 static void
 rdreset(struct rd_softc *sc)
 {
-	int ctlr = device_unit(device_parent(sc->sc_dev));
-	int slave = sc->sc_slave;
+	int ctlr, slave, punit;
+
+	ctlr = device_unit(device_parent(sc->sc_dev));
+	slave = sc->sc_slave;
+	punit = sc->sc_punit;
+	rdreset_unit(ctlr, slave, punit);
+#ifdef DEBUG
+	sc->sc_stats.rdresets++;
+#endif
+}
+
+static void
+rdreset_unit(int ctlr, int slave, int punit)
+{
+	struct rd_ssmcmd ssmc;
+	struct rd_srcmd src;
+	struct rd_clearcmd clear;
 	u_char stat;
 
-	sc->sc_clear.c_unit = C_SUNIT(sc->sc_punit);
-	sc->sc_clear.c_cmd = C_CLEAR;
-	hpibsend(ctlr, slave, C_TCMD, >sc_clear, sizeof(sc->sc_clear));
+	clear.c_unit = C_SUNIT(punit);
+	clear.c_cmd = C_CLEAR;
+	hpibsend(ctlr, slave, C_TCMD, , sizeof(clear));
 	

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

2022-11-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 23 18:53:22 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c

Log Message:
Fix "rd(4) at punits not configured on HPDisk are misprobed" problem.

- check not only stat value returned by C_QSTAT command against
  each punit but also desc.d_name returned by C_DESC command
  because it looks HPDisk responds to commands against punits supported
  but not-configured punits at 1-3
- prepare rdreset_unit() function to manage reset punit ops during
  probe without valid softc

The stragety is taken from OpenBSD with several modification.
Tested on 425t with real 9122D and HPDisk emulating two 7937H drives.

Should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/hp300/dev/rd.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/luna68k/dev

2022-11-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Nov 22 16:17:29 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: siotty.c

Log Message:
Use explicit struct to represent RX queue buffer data structure.

No binary change.

Maybe the similar change should be applied to MI com(4) and zsc(4)?


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/luna68k/dev/siotty.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/luna68k/dev

2022-11-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Nov 22 16:17:29 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: siotty.c

Log Message:
Use explicit struct to represent RX queue buffer data structure.

No binary change.

Maybe the similar change should be applied to MI com(4) and zsc(4)?


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/luna68k/dev/siotty.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/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.51 src/sys/arch/luna68k/dev/siotty.c:1.52
--- src/sys/arch/luna68k/dev/siotty.c:1.51	Sat Sep 25 15:18:38 2021
+++ src/sys/arch/luna68k/dev/siotty.c	Tue Nov 22 16:17:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.51 2021/09/25 15:18:38 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.52 2022/11/22 16:17:29 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.51 2021/09/25 15:18:38 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.52 2022/11/22 16:17:29 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "siotty.h"
@@ -76,6 +76,13 @@ static const struct speedtab siospeedtab
 	{ -1,	0, },
 };
 
+struct siotty_rxqdata {
+	uint8_t data;
+	uint8_t stat;
+};
+
+typedef struct siotty_rxqdata rxqdata_t;
+
 struct siotty_softc {
 	device_t	sc_dev;
 	struct tty	*sc_tty;
@@ -86,10 +93,10 @@ struct siotty_softc {
 	u_int		sc_hwflags;
 #define	SIOTTY_HW_CONSOLE	0x0001
 
-	uint8_t		*sc_rbuf;
-	uint8_t		*sc_rbufend;
-	uint8_t	* volatile sc_rbget;
-	uint8_t	* volatile sc_rbput;
+	rxqdata_t	*sc_rbuf;
+	rxqdata_t	*sc_rbufend;
+	rxqdata_t * volatile sc_rbget;
+	rxqdata_t * volatile sc_rbput;
 	volatile u_int	sc_rbavail;
 
 	uint8_t		*sc_tba;
@@ -192,8 +199,9 @@ siotty_attach(device_t parent, device_t 
 
 	aprint_normal("\n");
 
-	sc->sc_rbuf = kmem_alloc(siotty_rbuf_size * 2, KM_SLEEP);
-	sc->sc_rbufend = sc->sc_rbuf + (siotty_rbuf_size * 2);
+	sc->sc_rbuf = kmem_alloc(siotty_rbuf_size * sizeof(rxqdata_t),
+	KM_SLEEP);
+	sc->sc_rbufend = sc->sc_rbuf + siotty_rbuf_size;
 	sc->sc_rbput = sc->sc_rbget = sc->sc_rbuf;
 	sc->sc_rbavail = siotty_rbuf_size;
 
@@ -217,7 +225,7 @@ siottyintr(void *arg)
 {
 	struct siotty_softc *sc;
 	struct sioreg *sio;
-	uint8_t *put, *end;
+	rxqdata_t *put, *end;
 	uint8_t c;
 	uint16_t rr;
 	int cc;
@@ -241,9 +249,9 @@ siottyintr(void *arg)
 c = sio->sio_data;
 cn_check_magic(sc->sc_tty->t_dev, c,
 siotty_cnm_state);
-put[0] = c;
-put[1] = rr & 0xff;
-put += 2;
+put->data = c;
+put->stat = rr & 0xff;
+put++;
 if (put >= end)
 	put = sc->sc_rbuf;
 cc--;
@@ -294,7 +302,7 @@ siottysoft(void *arg)
 static void
 siotty_rxsoft(struct siotty_softc *sc, struct tty *tp)
 {
-	uint8_t *get, *end;
+	rxqdata_t *get, *end;
 	u_int cc, scc;
 	unsigned int code;
 	uint8_t stat;
@@ -309,15 +317,15 @@ siotty_rxsoft(struct siotty_softc *sc, s
 	}
 
 	while (cc > 0) {
-		code = get[0];
-		stat = get[1];
+		code = get->data;
+		stat = get->stat;
 		if ((stat & RR_FRAMING) != 0)
 			code |= TTY_FE;
 		else if ((stat & RR_PARITY) != 0)
 			code |= TTY_PE;
 
 		(*tp->t_linesw->l_rint)(code, tp);
-		get += 2;
+		get++;
 		if (get >= end)
 			get = sc->sc_rbuf;
 		cc--;



CVS commit: src/sys/arch/hp300

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 16:22:37 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c rdreg.h
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Use common macro for numbers of cylinders and blocks for HP-IB disks.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/rd.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/hp300

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 16:22:37 UTC 2022

Modified Files:
src/sys/arch/hp300/dev: rd.c rdreg.h
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Use common macro for numbers of cylinders and blocks for HP-IB disks.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hp300/dev/rdreg.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/rd.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.110 src/sys/arch/hp300/dev/rd.c:1.111
--- src/sys/arch/hp300/dev/rd.c:1.110	Sat Jul 31 20:29:36 2021
+++ src/sys/arch/hp300/dev/rd.c	Mon Nov 21 16:22:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.110 2021/07/31 20:29:36 andvar Exp $	*/
+/*	$NetBSD: rd.c,v 1.111 2022/11/21 16:22:37 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.110 2021/07/31 20:29:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.111 2022/11/21 16:22:37 tsutsui Exp $");
 
 #include "opt_useleds.h"
 
@@ -191,8 +191,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7945A",
 		.ri_nbpt = NRD7945ABPT,
 		.ri_ntpc = NRD7945ATRK,
-		.ri_ncyl = 968,
-		.ri_nblocks = 108416
+		.ri_ncyl = NRD7945ACYL,
+		.ri_nblocks = NRD7945ABLK
 	},
 
 	[RD9134D] = {
@@ -200,8 +200,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "9134D",
 		.ri_nbpt = NRD9134DBPT,
 		.ri_ntpc = NRD9134DTRK,
-		.ri_ncyl = 303,
-		.ri_nblocks = 29088
+		.ri_ncyl = NRD9134DCYL,
+		.ri_nblocks = NRD9134DBLK
 	},
 
 	[RD9122S] = {
@@ -209,8 +209,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "9122S",
 		.ri_nbpt = NRD9122SBPT,
 		.ri_ntpc = NRD9122STRK,
-		.ri_ncyl = 77,
-		.ri_nblocks = 1232
+		.ri_ncyl = NRD9122SCYL,
+		.ri_nblocks = NRD9122SBLK
 	},
 
 	[RD7912P] = {
@@ -218,8 +218,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7912P",
 		.ri_nbpt = NRD7912PBPT,
 		.ri_ntpc = NRD7912PTRK,
-		.ri_ncyl = 572,
-		.ri_nblocks = 128128
+		.ri_ncyl = NRD7912PCYL,
+		.ri_nblocks = NRD7912PBLK
 	},
 
 	[RD7914P] = {
@@ -227,8 +227,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7914P",
 		.ri_nbpt = NRD7914PBPT,
 		.ri_ntpc = NRD7914PTRK,
-		.ri_ncyl = 1152,
-		.ri_nblocks = 258048
+		.ri_ncyl = NRD7914PCYL,
+		.ri_nblocks = NRD7914PBLK
 	},
 
 	[RD7958A] = {
@@ -236,8 +236,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7958A",
 		.ri_nbpt = NRD7958ABPT,
 		.ri_ntpc = NRD7958ATRK,
-		.ri_ncyl = 1013,
-		.ri_nblocks = 255276
+		.ri_ncyl = NRD7958ACYL,
+		.ri_nblocks = NRD7958ABLK
 	},
 
 	[RD7957A] = {
@@ -245,8 +245,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7957A",
 		.ri_nbpt = NRD7957ABPT,
 		.ri_ntpc = NRD7957ATRK,
-		.ri_ncyl = 1036,
-		.ri_nblocks = 159544
+		.ri_ncyl = NRD7957ACYL,
+		.ri_nblocks = NRD7957ABLK
 	},
 
 	[RD7933H] = {
@@ -254,8 +254,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7933H",
 		.ri_nbpt = NRD7933HBPT,
 		.ri_ntpc = NRD7933HTRK,
-		.ri_ncyl = 1321,
-		.ri_nblocks = 789958
+		.ri_ncyl = NRD7933HCYL,
+		.ri_nblocks = NRD7933HBLK
 	},
 
 	[RD9134L] = {
@@ -263,8 +263,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "9134L",
 		.ri_nbpt = NRD9134LBPT,
 		.ri_ntpc = NRD9134LTRK,
-		.ri_ncyl = 973,
-		.ri_nblocks = 77840
+		.ri_ncyl = NRD9134LCYL,
+		.ri_nblocks = NRD9134LBLK
 	},
 
 	[RD7936H] = {
@@ -272,8 +272,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7936H",
 		.ri_nbpt = NRD7936HBPT,
 		.ri_ntpc = NRD7936HTRK,
-		.ri_ncyl = 698,
-		.ri_nblocks = 600978
+		.ri_ncyl = NRD7936HCYL,
+		.ri_nblocks = NRD7936HBLK
 	},
 
 	[RD7937H] = {
@@ -281,8 +281,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7937H",
 		.ri_nbpt = NRD7937HBPT,
 		.ri_ntpc = NRD7937HTRK,
-		.ri_ncyl = 698,
-		.ri_nblocks = 1116102
+		.ri_ncyl = NRD7937HCYL,
+		.ri_nblocks = NRD7937HBLK
 	},
 
 	[RD7914CT] = {
@@ -290,8 +290,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7914CT",
 		.ri_nbpt = NRD7914PBPT,
 		.ri_ntpc = NRD7914PTRK,
-		.ri_ncyl = 1152,
-		.ri_nblocks = 258048
+		.ri_ncyl = NRD7914PCYL,
+		.ri_nblocks = NRD7914PBLK
 	},
 
 	[RD7946A] = {
@@ -299,8 +299,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "7946A",
 		.ri_nbpt = NRD7945ABPT,
 		.ri_ntpc = NRD7945ATRK,
-		.ri_ncyl = 968,
-		.ri_nblocks = 108416
+		.ri_ncyl = NRD7945ACYL,
+		.ri_nblocks = NRD7945ABLK
 	},
 
 	[RD9122D] = {
@@ -308,8 +308,8 @@ static const struct rdidentinfo rdidenti
 		.ri_desc = "9122D",
 		.ri_nbpt = NRD9122SBPT,
 		.ri_ntpc = NRD9122STRK,
-		.ri_ncyl = 77,
-		.ri_nblocks = 1232
+		.ri_ncyl = NRD9122SCYL,
+		.ri_nblocks = NRD9122SBLK
 	},
 
 	[RD7957B] = {
@@ -317,8 +317,8 @@ static const struct rdidentinfo 

CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:36:29 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Make local functions and variables static.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common/if_le.c
diff -u src/sys/arch/hp300/stand/common/if_le.c:1.13 src/sys/arch/hp300/stand/common/if_le.c:1.14
--- src/sys/arch/hp300/stand/common/if_le.c:1.13	Sat Jun 21 02:02:40 2014
+++ src/sys/arch/hp300/stand/common/if_le.c	Mon Nov 21 15:36:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.13 2014/06/21 02:02:40 tsutsui Exp $	*/
+/*	$NetBSD: if_le.c,v 1.14 2022/11/21 15:36:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1993 Adam Glass
@@ -72,12 +72,12 @@ struct le_sel {
 	int	le_bonus;
 };
 
-int le_probe(struct netif *, void *);
-int le_match(struct netif *, void *);
-void le_init(struct iodesc *, void *);
-int le_get(struct iodesc *, void *, size_t, saseconds_t);
-int le_put(struct iodesc *, void *, size_t);
-void le_end(struct netif *);
+static int le_probe(struct netif *, void *);
+static int le_match(struct netif *, void *);
+static void le_init(struct iodesc *, void *);
+static int le_get(struct iodesc *, void *, size_t, saseconds_t);
+static int le_put(struct iodesc *, void *, size_t);
+static void le_end(struct netif *);
 
 static inline void lewrcsr(struct le_softc *, uint16_t, uint16_t);
 static inline uint16_t lerdcsr(struct le_softc *, uint16_t);
@@ -92,7 +92,7 @@ static int le_poll(struct iodesc *, void
 int le_debug = 0;
 #endif
 
-struct le_sel le0conf[] = {
+static struct le_sel le0conf[] = {
 /* offsets for:	   ID   REGS MEM   NVRAM	le_heat	le_bonus*/
 {		0,	0x4000, 0x8000, 0xC008,	1,	10   }
 };
@@ -100,7 +100,7 @@ struct le_sel le0conf[] = {
 
 extern struct netif_stats	le_stats[];
 
-struct netif_dif le_ifs[] = {
+static struct netif_dif le_ifs[] = {
 /*	dif_unit	dif_nsel	dif_stats	dif_private	*/
 {	0,		NLE0CONF,	_stats[0],	le0conf,	},
 };
@@ -120,7 +120,7 @@ struct netif_driver le_driver = {
 	NLE_IFS			/* netif_nifs */
 };
 
-struct le_softc le_softc[NLE];
+static struct le_softc le_softc[NLE];
 
 static inline void
 lewrcsr(struct le_softc *sc, uint16_t port, uint16_t val)
@@ -211,7 +211,7 @@ leinit(void)
 	}
 }
 
-int
+static int
 le_match(struct netif *nif, void *machdep_hint)
 {
 	struct le_sel *sels;
@@ -232,7 +232,7 @@ le_match(struct netif *nif, void *machde
 	return rv;
 }
 
-int
+static int
 le_probe(struct netif *nif, void *machdep_hint)
 {
 #if 0
@@ -307,7 +307,7 @@ le_mem_summary(int unit)
 #define le_mem_summary(u)
 #endif
 
-void
+static void
 le_error(int unit, char *str, uint16_t stat)
 {
 
@@ -328,7 +328,7 @@ le_error(int unit, char *str, uint16_t s
 	((u_long)(a) - (u_long)sc->sc_mem)
 
 /* LANCE initialization block set up. */
-void
+static void
 lememinit(struct le_softc *sc)
 {
 	int i;
@@ -388,7 +388,7 @@ lememinit(struct le_softc *sc)
 	}
 }
 
-void
+static void
 le_reset(int unit, u_char *myea)
 {
 	struct le_softc *sc = _softc[unit];
@@ -450,7 +450,7 @@ le_reset(int unit, u_char *myea)
 	le_mem_summary(unit);
 }
 
-int
+static int
 le_poll(struct iodesc *desc, void *pkt, int len)
 {
 	int unit = /*nif->nif_unit*/0;
@@ -525,7 +525,7 @@ cleanup:
 	return length;
 }
 
-int
+static int
 le_put(struct iodesc *desc, void *pkt, size_t len)
 {
 	int unit = /*nif->nif_unit*/0;
@@ -627,7 +627,7 @@ le_put(struct iodesc *desc, void *pkt, s
 }
 
 
-int
+static int
 le_get(struct iodesc *desc, void *pkt, size_t len, saseconds_t timeout)
 {
 	satime_t t;
@@ -640,7 +640,7 @@ le_get(struct iodesc *desc, void *pkt, s
 	return cc;
 }
 
-void
+static void
 le_init(struct iodesc *desc, void *machdep_hint)
 {
 	struct netif *nif = desc->io_netif;
@@ -658,7 +658,7 @@ le_init(struct iodesc *desc, void *machd
 	le_reset(unit, desc->myea);
 }
 
-void
+static void
 le_end(struct netif *nif)
 {
 	int unit = nif->nif_unit;



CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:36:29 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: if_le.c

Log Message:
Make local functions and variables static.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/stand/common/if_le.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/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:05:44 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Make local variables static and read only ones const.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common/rd.c
diff -u src/sys/arch/hp300/stand/common/rd.c:1.12 src/sys/arch/hp300/stand/common/rd.c:1.13
--- src/sys/arch/hp300/stand/common/rd.c:1.12	Mon Nov 21 14:55:08 2022
+++ src/sys/arch/hp300/stand/common/rd.c	Mon Nov 21 15:05:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.12 2022/11/21 14:55:08 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.13 2022/11/21 15:05:44 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -52,12 +52,12 @@
 #include 
 #include 
 
-struct	rd_iocmd rd_ioc;
-struct	rd_rscmd rd_rsc;
-struct	rd_stat rd_stat;
-struct	rd_ssmcmd rd_ssmc;
+static struct	rd_iocmd rd_ioc;
+static struct	rd_rscmd rd_rsc;
+static struct	rd_stat rd_stat;
+static struct	rd_ssmcmd rd_ssmc;
 
-struct	disklabel rdlabel;
+static struct	disklabel rdlabel;
 
 struct	rdminilabel {
 	u_short	npart;
@@ -88,9 +88,9 @@ static void rdreset(int, int);
 static int rdgetinfo(struct rd_softc *);
 static int rderror(int, int, int);
 
-struct rd_softc rd_softc[NHPIB][NRD];
+static struct rd_softc rd_softc[NHPIB][NRD];
 
-struct rdidentinfo rdidentinfo[] = {
+static const struct rdidentinfo rdidentinfo[] = {
 	[RD7945A]  = { RD7946AID,	0,	 108416 },
 	[RD9134D]  = { RD9134DID,	1,	  29088 },
 	[RD9122S]  = { RD9134LID,	1,	   1232 },
@@ -115,9 +115,9 @@ struct rdidentinfo rdidentinfo[] = {
 	[RD7911A]  = { RD7911AID,	0,	  54912 },
 	[RD7941A]  = { RD7946AID,	0,	  46464 }
 };
-int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
+static const int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
 
-int
+static int
 rdinit(int ctlr, int unit)
 {
 	struct rd_softc *rs = _softc[ctlr][unit];
@@ -210,7 +210,7 @@ rdident(int ctlr, int unit)
 	return id;
 }
 
-char io_buf[MAXBSIZE];
+static char io_buf[MAXBSIZE];
 
 static int
 rdgetinfo(struct rd_softc *rs)



CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 15:05:44 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Make local variables static and read only ones const.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 14:55:08 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync a list of HP-IB disk IDs with kernel's one.

Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/common/rd.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/hp300/stand/common/rd.c
diff -u src/sys/arch/hp300/stand/common/rd.c:1.11 src/sys/arch/hp300/stand/common/rd.c:1.12
--- src/sys/arch/hp300/stand/common/rd.c:1.11	Mon Jul  5 14:51:23 2021
+++ src/sys/arch/hp300/stand/common/rd.c	Mon Nov 21 14:55:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.11 2021/07/05 14:51:23 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.12 2022/11/21 14:55:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -91,25 +91,29 @@ static int rderror(int, int, int);
 struct rd_softc rd_softc[NHPIB][NRD];
 
 struct rdidentinfo rdidentinfo[] = {
-	{ RD7946AID,	0,	 108416 },
-	{ RD9134DID,	1,	  29088 },
-	{ RD9134LID,	1,	   1232 },
-	{ RD7912PID,	0,	 128128 },
-	{ RD7914PID,	0,	 258048 },
-	{ RD7958AID,	0,	 255276 },
-	{ RD7957AID,	0,	 159544 },
-	{ RD7933HID,	0,	 789958 },
-	{ RD9134LID,	1,	  77840 },
-	{ RD7936HID,	0,	 600978 },
-	{ RD7937HID,	0,	1116102 },
-	{ RD7914CTID,	0,	 258048 },
-	{ RD7946AID,	0,	 108416 },
-	{ RD9134LID,	1,	   1232 },
-	{ RD7957BID,	0,	 159894 },
-	{ RD7958BID,	0,	 297108 },
-	{ RD7959BID,	0,	 594216 },
-	{ RD2200AID,	0,	 654948 },
-	{ RD2203AID,	0,	1309896 }
+	[RD7945A]  = { RD7946AID,	0,	 108416 },
+	[RD9134D]  = { RD9134DID,	1,	  29088 },
+	[RD9122S]  = { RD9134LID,	1,	   1232 },
+	[RD7912P]  = { RD7912PID,	0,	 128128 },
+	[RD7914P]  = { RD7914PID,	0,	 258048 },
+	[RD7958A]  = { RD7958AID,	0,	 255276 },
+	[RD7957A]  = { RD7957AID,	0,	 159544 },
+	[RD7933H]  = { RD7933HID,	0,	 789958 },
+	[RD9134L]  = { RD9134LID,	1,	  77840 },
+	[RD7936H]  = { RD7936HID,	0,	 600978 },
+	[RD7937H]  = { RD7937HID,	0,	1116102 },
+	[RD7914CT] = { RD7914CTID,	0,	 258048 },
+	[RD7946A]  = { RD7946AID,	0,	 108416 },
+	[RD9122D]  = { RD9134LID,	1,	   1232 },
+	[RD7957B]  = { RD7957BID,	0,	 159894 },
+	[RD7958B]  = { RD7958BID,	0,	 297108 },
+	[RD7959B]  = { RD7959BID,	0,	 594216 },
+	[RD2200A]  = { RD2200AID,	0,	 654948 },
+	[RD2203A]  = { RD2203AID,	0,	1309896 },
+	[RD2202A]  = { RD2202AID,	0,	1309896 },
+	[RD7908A]  = { RD7908AID,	0,	  32375 },
+	[RD7911A]  = { RD7911AID,	0,	  54912 },
+	[RD7941A]  = { RD7946AID,	0,	  46464 }
 };
 int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]);
 
@@ -183,6 +187,8 @@ rdident(int ctlr, int unit)
 	case RD7946AID:
 		if (memcmp(name, "079450", 6) == 0)
 			id = RD7945A;
+		else if (memcmp(name, "079410", 6) == 0)
+			id = RD7941A;
 		else
 			id = RD7946A;
 		break;



CVS commit: src/sys/arch/hp300/stand/common

2022-11-21 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Nov 21 14:55:08 UTC 2022

Modified Files:
src/sys/arch/hp300/stand/common: rd.c

Log Message:
Sync a list of HP-IB disk IDs with kernel's one.

Now bootloader can boot from 2202A, 7908A, 7911A, and 7941A.
Tested on 425t and HPDisk.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/common/rd.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/hp300/hp300

2022-10-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 16 15:21:00 UTC 2022

Modified Files:
src/sys/arch/hp300/hp300: machdep.c

Log Message:
Use complete cpu name strings for readability.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/sys/arch/hp300/hp300/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/hp300/hp300/machdep.c
diff -u src/sys/arch/hp300/hp300/machdep.c:1.236 src/sys/arch/hp300/hp300/machdep.c:1.237
--- src/sys/arch/hp300/hp300/machdep.c:1.236	Sat Oct  9 20:00:41 2021
+++ src/sys/arch/hp300/hp300/machdep.c	Sun Oct 16 15:20:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.236 2021/10/09 20:00:41 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.237 2022/10/16 15:20:59 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.236 2021/10/09 20:00:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.237 2022/10/16 15:20:59 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -370,7 +370,7 @@ static const struct hp300_model hp300_mo
 static void
 identifycpu(void)
 {
-	const char *t, *mc, *s, *mmu;
+	const char *t, *cpu, *s, *mmu;
 	int i; 
 	char fpu[64], cache[64];
 
@@ -397,13 +397,13 @@ identifycpu(void)
 	 */
 	switch (cputype) {
 	case CPU_68040:
-		mc = "40";
+		cpu = "MC68040";
 		break;
 	case CPU_68030:
-		mc = "30";
+		cpu = "MC68030";
 		break;
 	case CPU_68020:
-		mc = "20";
+		cpu = "MC68020";
 		break;
 	default:
 		printf("\nunknown cputype %d\n", cputype);
@@ -426,7 +426,7 @@ identifycpu(void)
 		mmu = ", HP MMU";
 		break;
 	default:
-		printf("MC680%s\nunknown MMU type %d\n", mc, mmutype);
+		printf("%s\nunknown MMU type %d\n", cpu, mmutype);
 		panic("startup");
 	}
 
@@ -478,7 +478,7 @@ identifycpu(void)
 		}
 	}
 
-	cpu_setmodel("HP 9000/%s (%sMHz MC680%s CPU%s%s%s)", t, s, mc,
+	cpu_setmodel("HP 9000/%s (%sMHz %s CPU%s%s%s)", t, s, cpu,
 	mmu, fpu, cache);
 	printf("%s\n", cpu_getmodel());
 #ifdef DIAGNOSTIC



CVS commit: src/sys/arch/hp300/hp300

2022-10-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 16 15:21:00 UTC 2022

Modified Files:
src/sys/arch/hp300/hp300: machdep.c

Log Message:
Use complete cpu name strings for readability.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/sys/arch/hp300/hp300/machdep.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/pci

2022-10-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 16 15:16:12 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Use a consistent pointer variable.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/pci/tga.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/pci/tga.c
diff -u src/sys/dev/pci/tga.c:1.91 src/sys/dev/pci/tga.c:1.92
--- src/sys/dev/pci/tga.c:1.91	Sat Sep 17 18:41:26 2022
+++ src/sys/dev/pci/tga.c	Sun Oct 16 15:16:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tga.c,v 1.91 2022/09/17 18:41:26 tsutsui Exp $ */
+/* $NetBSD: tga.c,v 1.92 2022/10/16 15:16:12 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.91 2022/09/17 18:41:26 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.92 2022/10/16 15:16:12 tsutsui Exp $");
 
 #include 
 #include 
@@ -357,11 +357,11 @@ tga_init(bus_space_tag_t memt, pci_chips
 	}
 
 	/* the accelerated tga_putchar() needs LSbit left */
-	if (wsfont_lock(cookie, >dc_rinfo.ri_font)) {
+	if (wsfont_lock(cookie, >ri_font)) {
 		printf("tga: couldn't lock font\n");
 		return;
 	}
-	dc->dc_rinfo.ri_wsfcookie = cookie;
+	rip->ri_wsfcookie = cookie;
 
 	rasops_init(rip, 34, 80);
 
@@ -369,16 +369,16 @@ tga_init(bus_space_tag_t memt, pci_chips
 	/* XXX shouldn't have to do this; rasops should leave non-NULL
 	 * XXX entries alone.
 	 */
-	dc->dc_rinfo.ri_ops.copyrows = tga_copyrows;
-	dc->dc_rinfo.ri_ops.eraserows = tga_eraserows;
-	dc->dc_rinfo.ri_ops.erasecols = tga_erasecols;
-	dc->dc_rinfo.ri_ops.copycols = tga_copycols;
-	dc->dc_rinfo.ri_ops.putchar = tga_putchar;
-
-	tga_stdscreen.nrows = dc->dc_rinfo.ri_rows;
-	tga_stdscreen.ncols = dc->dc_rinfo.ri_cols;
-	tga_stdscreen.textops = >dc_rinfo.ri_ops;
-	tga_stdscreen.capabilities = dc->dc_rinfo.ri_caps;
+	rip->ri_ops.copyrows = tga_copyrows;
+	rip->ri_ops.eraserows = tga_eraserows;
+	rip->ri_ops.erasecols = tga_erasecols;
+	rip->ri_ops.copycols = tga_copycols;
+	rip->ri_ops.putchar = tga_putchar;
+
+	tga_stdscreen.nrows = rip->ri_rows;
+	tga_stdscreen.ncols = rip->ri_cols;
+	tga_stdscreen.textops = >ri_ops;
+	tga_stdscreen.capabilities = rip->ri_caps;
 
 
 	dc->dc_intrenabled = 0;



CVS commit: src/sys/dev/pci

2022-10-16 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 16 15:16:12 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Use a consistent pointer variable.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/pci/tga.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/luna68k/dev

2022-10-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Oct  3 17:42:36 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: lunafb.c omrasops.c omrasopsvar.h

Log Message:
Remove global hwplanecount and use ri_depth in struct rasops instead.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/omrasopsvar.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/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.48 src/sys/arch/luna68k/dev/lunafb.c:1.49
--- src/sys/arch/luna68k/dev/lunafb.c:1.48	Sat Oct  1 14:02:08 2022
+++ src/sys/arch/luna68k/dev/lunafb.c	Mon Oct  3 17:42:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.49 2022/10/03 17:42:35 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.49 2022/10/03 17:42:35 tsutsui Exp $");
 
 #include 
 #include 
@@ -175,8 +175,6 @@ CFATTACH_DECL_NEW(fb, sizeof(struct omfb
 
 extern int hwplanemask;	/* hardware planemask; retrieved at boot */
 
-int hwplanecount;	/* for omrasops */
-
 static int omfb_console;
 int  omfb_cnattach(void);
 
@@ -460,7 +458,7 @@ omfb_resetcmap(struct om_hwdevconfig *dc
 static void
 omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
 {
-	int i;
+	int bpp, i;
 	struct rasops_info *ri;
 	union {
 		struct { short h, v; } p;
@@ -469,21 +467,21 @@ omfb_getdevconfig(paddr_t paddr, struct 
 
 	switch (hwplanemask) {
 	case 0xff:
-		hwplanecount = 8;	/* XXX check monochrome bit in DIPSW */
+		bpp = 8;	/* XXX check monochrome bit in DIPSW */
 		break;
 	default:
 	case 0x0f:
-		hwplanecount = 4;	/* XXX check monochrome bit in DIPSW */
+		bpp = 4;	/* XXX check monochrome bit in DIPSW */
 		break;
 	case 1:
-		hwplanecount = 1;
+		bpp = 1;
 		break;
 	}
 	dc->dc_wid = 1280;
 	dc->dc_ht = 1024;
-	dc->dc_depth = hwplanecount;
+	dc->dc_depth = bpp;
 	dc->dc_rowbytes = 2048 / 8;
-	dc->dc_cmsize = (hwplanecount == 1) ? 0 : 1 << hwplanecount;
+	dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
 	dc->dc_videobase = paddr;
 
 	omfb_resetcmap(dc);
@@ -513,7 +511,7 @@ omfb_getdevconfig(paddr_t paddr, struct 
 		ri->ri_flg |= RI_NO_AUTO;
 	ri->ri_hw = dc;
 
-	if (hwplanecount == 4 || hwplanecount == 8)
+	if (bpp == 4 || bpp == 8)
 		omrasops4_init(ri, 34, 80);
 	else
 		omrasops1_init(ri, 34, 80);

Index: src/sys/arch/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.24 src/sys/arch/luna68k/dev/omrasops.c:1.25
--- src/sys/arch/luna68k/dev/omrasops.c:1.24	Sat Oct  1 13:51:55 2022
+++ src/sys/arch/luna68k/dev/omrasops.c	Mon Oct  3 17:42:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $ */
+/* $NetBSD: omrasops.c,v 1.25 2022/10/03 17:42:35 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.25 2022/10/03 17:42:35 tsutsui Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -100,8 +100,8 @@ static void	om_eraserows(void *, int, in
 static int	om_allocattr(void *, int, int, int, long *);
 
 static void	om_fill(int, int, uint8_t *, int, int, uint32_t, int, int);
-static void	om_fill_color(int, uint8_t *, int, int, int, int);
-static void	om_rascopy_single(uint8_t *, uint8_t *, int16_t, int16_t,
+static void	om_fill_color(int, int, uint8_t *, int, int, int, int);
+static void	om_rascopy_single(int, uint8_t *, uint8_t *, int16_t, int16_t,
 uint8_t[]);
 static void	om4_rascopy_multi(uint8_t *, uint8_t *, int16_t, int16_t);
 static void	om_unpack_attr(long, uint8_t *, uint8_t *, int *);
@@ -330,8 +330,8 @@ om_fill(int planemask, int rop, uint8_t 
 }
 
 static void
-om_fill_color(int color, uint8_t *dstptr, int dstbitoffs, int dstspan,
-int width, int height)
+om_fill_color(int planecount, int color, uint8_t *dstptr, int dstbitoffs,
+int dstspan, int width, int height)
 {
 	uint32_t mask;
 	uint32_t prev_mask;
@@ -340,7 +340,7 @@ om_fill_color(int color, uint8_t *dstptr
 
 	ASSUME(width > 0);
 	ASSUME(height > 0);
-	ASSUME(omfb_planecount > 0);
+	ASSUME(planecount > 0);
 
 	/* select all planes */
 	om_set_planemask(hwplanemask);
@@ -364,7 +364,7 @@ om_fill_color(int color, uint8_t *dstptr
 		}
 
 		if (prev_mask != mask) {
-			for (plane = 0; plane < omfb_planecount; plane++) {
+			for (plane = 0; plane < planecount; plane++) {
 if ((color & (1U << plane)) != 0)
 	rop = 

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

2022-10-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Oct  3 17:42:36 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: lunafb.c omrasops.c omrasopsvar.h

Log Message:
Remove global hwplanecount and use ri_depth in struct rasops instead.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/omrasopsvar.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/luna68k/dev

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 14:02:08 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: lunafb.c

Log Message:
Set an actual framebuffer depth (bpp) to rasops ri_depth.

The previous value was derived from OpenBSD/luna88k but
it has not been referenced even via ioctl(2).


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/lunafb.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/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.47 src/sys/arch/luna68k/dev/lunafb.c:1.48
--- src/sys/arch/luna68k/dev/lunafb.c:1.47	Sun Sep 25 11:28:40 2022
+++ src/sys/arch/luna68k/dev/lunafb.c	Sat Oct  1 14:02:08 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.47 2022/09/25 11:28:40 isaki Exp $ */
+/* $NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.47 2022/09/25 11:28:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.48 2022/10/01 14:02:08 tsutsui Exp $");
 
 #include 
 #include 
@@ -505,7 +505,7 @@ omfb_getdevconfig(paddr_t paddr, struct 
 	ri = >dc_ri;
 	ri->ri_width = dc->dc_wid;
 	ri->ri_height = dc->dc_ht;
-	ri->ri_depth = 1;	/* since planes are independently addressed */
+	ri->ri_depth = dc->dc_depth;
 	ri->ri_stride = dc->dc_rowbytes;
 	ri->ri_bits = (void *)dc->dc_videobase;
 	ri->ri_flg = RI_CENTER;



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

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 14:02:08 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: lunafb.c

Log Message:
Set an actual framebuffer depth (bpp) to rasops ri_depth.

The previous value was derived from OpenBSD/luna88k but
it has not been referenced even via ioctl(2).


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/lunafb.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/luna68k/dev

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 13:51:55 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: omrasops.c

Log Message:
Explicitly limit a number of rasops rows per size of rowattr[].


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/dev/omrasops.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/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.23 src/sys/arch/luna68k/dev/omrasops.c:1.24
--- src/sys/arch/luna68k/dev/omrasops.c:1.23	Sun Sep 25 11:28:40 2022
+++ src/sys/arch/luna68k/dev/omrasops.c	Sat Oct  1 13:51:55 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.23 2022/09/25 11:28:40 isaki Exp $ */
+/* $NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.23 2022/09/25 11:28:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.24 2022/10/01 13:51:55 tsutsui Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -113,7 +113,8 @@ static int	omrasops_init(struct rasops_i
  * This number of elements is derived from howmany(1024, fontheight = 24).
  * But it is currently initialized with row = 34, so it is used only up to 34.
  */
-static rowattr_t rowattr[43];
+#define OMRASOPS_MAX_ROWS	43
+static rowattr_t rowattr[OMRASOPS_MAX_ROWS];
 
 #define	ALL1BITS	(~0U)
 #define	ALL0BITS	(0U)
@@ -1801,6 +1802,8 @@ omrasops_init(struct rasops_info *ri, in
 {
 	int wsfcookie, bpp;
 
+	if (wantrows > OMRASOPS_MAX_ROWS)
+		wantrows = OMRASOPS_MAX_ROWS;
 	if (wantrows == 0)
 		wantrows = 34;
 	if (wantrows < 10)



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

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 13:51:55 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: omrasops.c

Log Message:
Explicitly limit a number of rasops rows per size of rowattr[].


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/dev/omrasops.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/luna68k/dev

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 13:41:12 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: omrasopsvar.h psgpam_enc.c xplxfirm.c

Log Message:
Remove trailing whitespaces.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/dev/omrasopsvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/dev/psgpam_enc.c \
src/sys/arch/luna68k/dev/xplxfirm.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/luna68k/dev

2022-10-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  1 13:41:12 UTC 2022

Modified Files:
src/sys/arch/luna68k/dev: omrasopsvar.h psgpam_enc.c xplxfirm.c

Log Message:
Remove trailing whitespaces.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/dev/omrasopsvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/dev/psgpam_enc.c \
src/sys/arch/luna68k/dev/xplxfirm.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/luna68k/dev/omrasopsvar.h
diff -u src/sys/arch/luna68k/dev/omrasopsvar.h:1.6 src/sys/arch/luna68k/dev/omrasopsvar.h:1.7
--- src/sys/arch/luna68k/dev/omrasopsvar.h:1.6	Sun Sep 25 11:28:40 2022
+++ src/sys/arch/luna68k/dev/omrasopsvar.h	Sat Oct  1 13:41:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasopsvar.h,v 1.6 2022/09/25 11:28:40 isaki Exp $ */
+/* $NetBSD: omrasopsvar.h,v 1.7 2022/10/01 13:41:12 tsutsui Exp $ */
 /*
  * Copyright (c) 2013 Kenji Aoyama
  *
@@ -52,7 +52,7 @@ extern int hwplanecount;
 
 /* operation		index	the video RAM contents will be */
 #define ROP_ZERO	 0	/* all 0	*/
-#define ROP_AND1	 1	/* D & M	*/ 
+#define ROP_AND1	 1	/* D & M	*/
 #define ROP_AND2	 2	/* ~D & M	*/
 /* Not used on LUNA	 3			*/
 #define ROP_AND3	 4	/* D & ~M	*/

Index: src/sys/arch/luna68k/dev/psgpam_enc.c
diff -u src/sys/arch/luna68k/dev/psgpam_enc.c:1.1 src/sys/arch/luna68k/dev/psgpam_enc.c:1.2
--- src/sys/arch/luna68k/dev/psgpam_enc.c:1.1	Fri Jun 10 21:42:23 2022
+++ src/sys/arch/luna68k/dev/psgpam_enc.c	Sat Oct  1 13:41:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: psgpam_enc.c,v 1.1 2022/06/10 21:42:23 tsutsui Exp $	*/
+/*	$NetBSD: psgpam_enc.c,v 1.2 2022/10/01 13:41:12 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2018 Yosuke Sugahara. All rights reserved.
@@ -70,12 +70,12 @@ dynamic_offset(struct psgpam_codecvar *c
 	 * } else {
 	 *   increment offset
 	 * }
-	 */ 
+	 */
 	if (v <= ctx->offset) {
 		ctx->offset = v;
 	} else {
 		if (--ctx->expire < 0) {
-			ctx->offset += 1; 
+			ctx->offset += 1;
 			ctx->expire = ctx->expire_initial;
 		}
 	}
Index: src/sys/arch/luna68k/dev/xplxfirm.c
diff -u src/sys/arch/luna68k/dev/xplxfirm.c:1.1 src/sys/arch/luna68k/dev/xplxfirm.c:1.2
--- src/sys/arch/luna68k/dev/xplxfirm.c:1.1	Fri Jun 10 21:42:23 2022
+++ src/sys/arch/luna68k/dev/xplxfirm.c	Sat Oct  1 13:41:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: xplxfirm.c,v 1.1 2022/06/10 21:42:23 tsutsui Exp $	*/
+/*	$NetBSD: xplxfirm.c,v 1.2 2022/10/01 13:41:12 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2018 Yosuke Sugahara. All rights reserved.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 
-/* 
+/*
  * XXX TODO:
  * - consider how xplx.inc should be handled
  */



Re: CVS commit: src/distrib/notes/sparc64

2022-09-28 Thread Izumi Tsutsui
> Modified Files:
>   src/distrib/notes/sparc64: prep
> 
> Log Message:
> Avoid dead link to the NVRAM/Hostid FAQ

Maybe this mirror is better than archive.org:
 http://www.obsolyte.com/sunFAQ/faq_nvram.html

---
Izumi Tsutsui


CVS commit: src/sys/dev/pci

2022-09-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 17 18:41:26 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Use C99 designated initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pci/tga.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/pci/tga.c
diff -u src/sys/dev/pci/tga.c:1.90 src/sys/dev/pci/tga.c:1.91
--- src/sys/dev/pci/tga.c:1.90	Sat Sep 17 18:29:54 2022
+++ src/sys/dev/pci/tga.c	Sat Sep 17 18:41:26 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tga.c,v 1.90 2022/09/17 18:29:54 tsutsui Exp $ */
+/* $NetBSD: tga.c,v 1.91 2022/09/17 18:41:26 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.90 2022/09/17 18:29:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.91 2022/09/17 18:41:26 tsutsui Exp $");
 
 #include 
 #include 
@@ -112,24 +112,26 @@ struct tga_devconfig tga_console_dc;
  * XXX and the non-NULL ones will be overwritten; reset after calling it.
  */
 struct wsdisplay_emulops tga_emulops = {
-	NULL,
-	NULL,
-	tga_putchar,
-	tga_copycols,
-	tga_erasecols,
-	tga_copyrows,
-	tga_eraserows,
-	NULL,
+	.cursor= NULL,
+	.mapchar   = NULL,
+	.putchar   = tga_putchar,
+	.copycols  = tga_copycols,
+	.erasecols = tga_erasecols,
+	.copyrows  = tga_copyrows,
+	.eraserows = tga_eraserows,
+	.allocattr = NULL,
 	NULL,
 };
 
 struct wsscreen_descr tga_stdscreen = {
-	"std",
-	0, 0,	/* will be filled in -- XXX shouldn't, it's global */
-	_emulops,
-	0, 0,
-	WSSCREEN_REVERSE,
-	NULL,
+	.name = "std",
+	.ncols = 0,
+	.nrows = 0,	/* will be filled in -- XXX shouldn't, it's global */
+	.textops = _emulops,
+	.fontwidth = 0,
+	.fontheight = 0,
+	.capabilities = WSSCREEN_REVERSE,
+	.modecookie = NULL,
 };
 
 const struct wsscreen_descr *_tga_scrlist[] = {
@@ -142,14 +144,14 @@ struct wsscreen_list tga_screenlist = {
 };
 
 struct wsdisplay_accessops tga_accessops = {
-	tga_ioctl,
-	tga_mmap,
-	tga_alloc_screen,
-	tga_free_screen,
-	tga_show_screen,
-	NULL, /* load_font */
-	NULL,
-	NULL,
+	.ioctl= tga_ioctl,
+	.mmap = tga_mmap,
+	.alloc_screen = tga_alloc_screen,
+	.free_screen  = tga_free_screen,
+	.show_screen  = tga_show_screen,
+	.load_font= NULL,
+	.pollc= NULL,
+	.scroll   = NULL,
 };
 
 static void	tga_blank(struct tga_devconfig *);



CVS commit: src/sys/dev/pci

2022-09-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 17 18:41:26 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Use C99 designated initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pci/tga.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/pci

2022-09-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 17 18:29:54 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/tga.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/pci/tga.c
diff -u src/sys/dev/pci/tga.c:1.89 src/sys/dev/pci/tga.c:1.90
--- src/sys/dev/pci/tga.c:1.89	Thu Aug 19 20:56:36 2021
+++ src/sys/dev/pci/tga.c	Sat Sep 17 18:29:54 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tga.c,v 1.89 2021/08/19 20:56:36 andvar Exp $ */
+/* $NetBSD: tga.c,v 1.90 2022/09/17 18:29:54 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.89 2021/08/19 20:56:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.90 2022/09/17 18:29:54 tsutsui Exp $");
 
 #include 
 #include 
@@ -60,9 +60,8 @@ __KERNEL_RCSID(0, "$NetBSD: tga.c,v 1.89
 #include 
 #include 
 
-int	tgamatch(device_t, cfdata_t, void *);
-void	tgaattach(device_t, device_t, void *);
-int	tgaprint(void *, const char *);
+static int	tgamatch(device_t, cfdata_t, void *);
+static void	tgaattach(device_t, device_t, void *);
 
 CFATTACH_DECL_NEW(tga, sizeof(struct tga_softc),
 tgamatch, tgaattach, NULL, NULL);
@@ -73,10 +72,10 @@ static void tga_init(bus_space_tag_t mem
 static int tga_matchcommon(bus_space_tag_t, pci_chipset_tag_t, pcitag_t);
 static void tga_mapaddrs(bus_space_tag_t memt, pci_chipset_tag_t pc,
 pcitag_t, bus_size_t *pcisize, struct tga_devconfig *dc);
-unsigned int tga_getdotclock(struct tga_devconfig *dc);
+static unsigned int tga_getdotclock(struct tga_devconfig *dc);
 
-int tga_ioctl(void *, void *, u_long, void *, int, struct lwp *);
-paddr_t tga_mmap(void *, void *, off_t, int);
+static int tga_ioctl(void *, void *, u_long, void *, int, struct lwp *);
+static paddr_t tga_mmap(void *, void *, off_t, int);
 static void tga_copyrows(void *, int, int, int);
 static void tga_copycols(void *, int, int, int, int);
 static int tga_alloc_screen(void *, const struct wsscreen_descr *,
@@ -91,7 +90,7 @@ static int tga_rop_vtov(struct rasops_in
 static void tga_putchar(void *c, int row, int col, u_int uc, long attr);
 static void tga_eraserows(void *, int, int, long);
 static void tga_erasecols(void *, int, int, int, long);
-void tga2_init(struct tga_devconfig *);
+static void tga2_init(struct tga_devconfig *);
 
 static void tga_config_interrupts(device_t);
 
@@ -164,7 +163,7 @@ tga_cnmatch(bus_space_tag_t iot, bus_spa
 	return tga_matchcommon(memt, pc, tag);
 }
 
-int
+static int
 tgamatch(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
@@ -383,7 +382,7 @@ tga_init(bus_space_tag_t memt, pci_chips
 	dc->dc_intrenabled = 0;
 }
 
-void
+static void
 tgaattach(device_t parent, device_t self, void *aux)
 {
 	struct pci_attach_args *pa = aux;
@@ -522,7 +521,7 @@ tga_config_interrupts(device_t self)
 	sc->sc_dc->dc_intrenabled = 1;
 }
 
-int
+static int
 tga_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
 {
 	struct tga_softc *sc = v;
@@ -666,7 +665,7 @@ tga_intr(void *v)
 	return 1;
 }
 
-paddr_t
+static paddr_t
 tga_mmap(void *v, void *vs, off_t offset, int prot)
 {
 	struct tga_softc *sc = v;
@@ -1210,7 +1209,8 @@ tga_rop_vtov(struct rasops_info *dst, in
 }
 
 
-void tga_putchar(void *c, int row, int col, u_int uc, long attr)
+static void
+tga_putchar(void *c, int row, int col, u_int uc, long attr)
 {
 	struct rasops_info *ri = c;
 	struct tga_devconfig *dc = ri->ri_hw;
@@ -1481,11 +1481,11 @@ tga2_ramdac_rd(void *v, u_int btreg)
 }
 
 #include 
-void tga2_ics9110_wr(struct tga_devconfig *dc, int dotclock);
+static void tga2_ics9110_wr(struct tga_devconfig *dc, int dotclock);
 
-struct monitor *tga_getmonitor(struct tga_devconfig *dc);
+static struct monitor *tga_getmonitor(struct tga_devconfig *dc);
 
-void
+static void
 tga2_init(struct tga_devconfig *dc)
 {
 	struct	monitor *m = tga_getmonitor(dc);
@@ -1605,14 +1605,14 @@ tga2_ics9110_wr(struct tga_devconfig *dc
 	bus_space_barrier(dc->dc_memt, clock, 0, 0, BUS_SPACE_BARRIER_WRITE);
 }
 
-struct monitor *
+static struct monitor *
 tga_getmonitor(struct tga_devconfig *dc)
 {
 
 	return [(~TGARREG(dc, TGA_REG_GREV) >> 16) & 0x0f];
 }
 
-unsigned int
+static unsigned int
 tga_getdotclock(struct tga_devconfig *dc)
 {
 



CVS commit: src/sys/dev/pci

2022-09-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 17 18:29:54 UTC 2022

Modified Files:
src/sys/dev/pci: tga.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/tga.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-wsfb/dist/src

2022-09-10 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Sep 10 19:25:44 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: disable xf86DisableRandR() only on newer X.org Servers.

ABI_VIDEODRV_VERSION has been bumped to 24.0 since xorg-server-1.20.0:
 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/3f9507ed2f7246b2c8cf2bbc430cc99c5f35c92a
 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/dd00e5466a0e4ea313d1860824da4123692827ed


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.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-wsfb/dist/src

2022-09-10 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Sep 10 19:25:44 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: disable xf86DisableRandR() only on newer X.org Servers.

ABI_VIDEODRV_VERSION has been bumped to 24.0 since xorg-server-1.20.0:
 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/3f9507ed2f7246b2c8cf2bbc430cc99c5f35c92a
 
https://gitlab.freedesktop.org/xorg/xserver/-/commit/dd00e5466a0e4ea313d1860824da4123692827ed


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.46 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.47
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.46	Sat Sep 10 19:23:03 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Sat Sep 10 19:25:44 2022
@@ -1094,7 +1094,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	if (fPtr->rotate) {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"Enabling Driver Rotation, " "disabling RandR\n");
-#if 0
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 24
 		xf86DisableRandR();
 #endif
 		if (pScrn->bitsPerPixel == 24)



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

2022-09-10 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Sep 10 19:23:03 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
wsfb: reduce diffs from upstream.

Mostly pulled/merged from the following upstream changes:

- Fix for dlopen() -based module loader.
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/b77092858a178aa169ed4c1c7fe733d5cd355702

- Remove useless loader symbol lists.
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/bce9fd21483fbeddc84672a1ef01fdd9b58c88ed

- Add compat-api.h for compatibility with xserver 1.13
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/586b722fb17b3eb0ab776c170ee21e6a66fc7f22

- Use own thunk functions instead of shadow*Weak
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/fa9aabe95a65c4dd12008e16ad66d5c773a7993a

- Remove obsolete #ifdef HAVE_XF1BPP and #ifdef HAVE_XF4BPP blocks,
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/16ac29883cb80053fb0b973166a3f664cae1fa44

- Remove unused variables
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1c1bf30b612933a3303d414c75671c9a05ec450a

- Suppress a bunch of compiler warnings for using constant strings
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1ff2e87ea1c19d1417b11886d940e205be376d78

- Replace LoaderGetOS with ifdef
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/8069c6970c731c38e105f55ce83ba88b0773

- Fix spelling/wording issues
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/27c2d76404c7b440a6662446b189fa257c4cebfc

With minor adjustments:
- sync order of members in private struct WsfbRec
- add more const to avoid warning
- add newlines properly to xf86Msg() messages

No particular objection on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/06/thread1.html#002311


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.45 -r1.46 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb.h
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.9 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.10
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.9	Tue Aug 30 15:05:21 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h	Sat Sep 10 19:23:03 2022
@@ -65,12 +65,12 @@
 typedef struct {
 	int			fd; /* file descriptor of open device */
 	struct wsdisplayio_fbinfo fbi;
-	int			rotate;
 	unsigned char*		fbstart;
 	unsigned char*		fbmem;
 	size_t			fbmem_len;
-	void *			shadow;
+	int			rotate;
 	Bool			shadowFB;
+	void *			shadow;
 	Bool			HWCursor;
 	Bool			useSwap32;
 #ifdef HAVE_SHADOW_AFB

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.45 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.46
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.45	Tue Aug 30 15:09:51 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Sat Sep 10 19:23:03 2022
@@ -52,7 +52,6 @@
 /* All drivers need this. */
 #include "xf86.h"
 #include "xf86_OSproc.h"
-#include "xf86_OSlib.h"
 
 #include "mipointer.h"
 #include "micmap.h"
@@ -75,10 +74,6 @@
 
 #include "wsfb.h"
 
-/* #include "wsconsio.h" */
-
-#include 
-
 #ifdef X_PRIVSEP
 extern int priv_open_device(const char *);
 #else
@@ -91,12 +86,6 @@ extern int priv_open_device(const char *
 #define WSFB_DEFAULT_DEV "/dev/ttyC0"
 #endif
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 6
-#define xf86LoaderReqSymLists(...) do {} while (0)
-#define LoaderRefSymLists(...) do {} while (0)
-#define xf86LoaderReqSymbols(...) do {} while (0)
-#endif
-
 #define DEBUG 0
 
 #if DEBUG
@@ -165,13 +154,13 @@ enum { WSFB_ROTATE_NONE = 0,
  */
 static int pix24bpp = 0;
 
-#define WSFB_VERSION 		4000
+#define WSFB_VERSION		4000
 #define WSFB_NAME		"wsfb"
 #define WSFB_DRIVER_NAME	"wsfb"
 
 _X_EXPORT DriverRec WSFB = {
 	WSFB_VERSION,
-	WSFB_DRIVER_NAME,
+	(char *)WSFB_DRIVER_NAME,
 	WsfbIdentify,
 	WsfbProbe,
 	WsfbAvailableOptions,
@@ -201,34 +190,6 @@ static const OptionInfoRec WsfbOptions[]
 	{ -1, NULL, OPTV_NONE, {0}, FALSE}
 };
 
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) <= 6
-/* Symbols needed from other modules */
-static const char *fbSymbols[] = {
-	"fbPictureInit",
-	"fbScreenInit",
-	NULL
-};
-static const char *shadowSymbols[] = {
-	"shadowAdd",
-	"shadowSetup",
-	"shadowUpdatePacked",
-	"shadowUpdatePackedWeak",
-	"shadowUpdateRotatePacked",
-	"shadowUpdateRotatePackedWeak",
-#ifdef HAVE_SHADOW_AFB
-	"shadowUpdateAfb8",
-#endif
-	NULL
-};
-
-static const char *ramdacSymbols[] = {
-	"xf86CreateCursorInfoRec",
-	

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

2022-09-10 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Sep 10 19:23:03 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
wsfb: reduce diffs from upstream.

Mostly pulled/merged from the following upstream changes:

- Fix for dlopen() -based module loader.
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/b77092858a178aa169ed4c1c7fe733d5cd355702

- Remove useless loader symbol lists.
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/bce9fd21483fbeddc84672a1ef01fdd9b58c88ed

- Add compat-api.h for compatibility with xserver 1.13
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/586b722fb17b3eb0ab776c170ee21e6a66fc7f22

- Use own thunk functions instead of shadow*Weak
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/fa9aabe95a65c4dd12008e16ad66d5c773a7993a

- Remove obsolete #ifdef HAVE_XF1BPP and #ifdef HAVE_XF4BPP blocks,
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/16ac29883cb80053fb0b973166a3f664cae1fa44

- Remove unused variables
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1c1bf30b612933a3303d414c75671c9a05ec450a

- Suppress a bunch of compiler warnings for using constant strings
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/1ff2e87ea1c19d1417b11886d940e205be376d78

- Replace LoaderGetOS with ifdef
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/8069c6970c731c38e105f55ce83ba88b0773

- Fix spelling/wording issues
  
https://gitlab.freedesktop.org/xorg/driver/xf86-video-wsfb/-/commit/27c2d76404c7b440a6662446b189fa257c4cebfc

With minor adjustments:
- sync order of members in private struct WsfbRec
- add more const to avoid warning
- add newlines properly to xf86Msg() messages

No particular objection on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/06/thread1.html#002311


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.45 -r1.46 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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

2022-09-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep  5 14:14:42 UTC 2022

Modified Files:
src/sys/arch/evbarm/stand/board: epcom.c ns16550.c sscom.c
src/sys/arch/hpcmips/stand/lcboot: extern.h
src/sys/arch/i386/stand/lib: comio_direct.c
src/sys/compat/linux/arch/i386: linux_ptrace.c
src/sys/compat/linux/arch/powerpc: linux_ptrace.c

Log Message:
G/C ISSET() macro copies.  It has been defined in  since 2006.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/stand/board/epcom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/stand/board/ns16550.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/stand/board/sscom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hpcmips/stand/lcboot/extern.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/comio_direct.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/arch/i386/linux_ptrace.c
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/linux/arch/powerpc/linux_ptrace.c

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



CVS commit: src/sys

2022-09-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep  5 14:14:42 UTC 2022

Modified Files:
src/sys/arch/evbarm/stand/board: epcom.c ns16550.c sscom.c
src/sys/arch/hpcmips/stand/lcboot: extern.h
src/sys/arch/i386/stand/lib: comio_direct.c
src/sys/compat/linux/arch/i386: linux_ptrace.c
src/sys/compat/linux/arch/powerpc: linux_ptrace.c

Log Message:
G/C ISSET() macro copies.  It has been defined in  since 2006.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/stand/board/epcom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/stand/board/ns16550.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/stand/board/sscom.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hpcmips/stand/lcboot/extern.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/comio_direct.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/linux/arch/i386/linux_ptrace.c
cvs rdiff -u -r1.33 -r1.34 src/sys/compat/linux/arch/powerpc/linux_ptrace.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/evbarm/stand/board/epcom.c
diff -u src/sys/arch/evbarm/stand/board/epcom.c:1.5 src/sys/arch/evbarm/stand/board/epcom.c:1.6
--- src/sys/arch/evbarm/stand/board/epcom.c:1.5	Fri Oct 23 00:39:30 2009
+++ src/sys/arch/evbarm/stand/board/epcom.c	Mon Sep  5 14:14:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: epcom.c,v 1.5 2009/10/23 00:39:30 snj Exp $	*/
+/*	$NetBSD: epcom.c,v 1.6 2022/09/05 14:14:42 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2004 Jesse Off
@@ -47,8 +47,6 @@
 #define	SYSCON_WRITE(x, v)	*((volatile uint32_t *) \
 	(SCADDR + (EP93XX_SYSCON_ ## x))) = (v)
 
-#define	ISSET(t,f)	((t) & (f))
-
 void
 cons_init(void)
 {

Index: src/sys/arch/evbarm/stand/board/ns16550.c
diff -u src/sys/arch/evbarm/stand/board/ns16550.c:1.4 src/sys/arch/evbarm/stand/board/ns16550.c:1.5
--- src/sys/arch/evbarm/stand/board/ns16550.c:1.4	Thu Oct 30 06:23:13 2008
+++ src/sys/arch/evbarm/stand/board/ns16550.c	Mon Sep  5 14:14:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ns16550.c,v 1.4 2008/10/30 06:23:13 cliff Exp $	*/
+/*	$NetBSD: ns16550.c,v 1.5 2022/09/05 14:14:42 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -54,8 +54,6 @@
 #define	OUTB(x, v)	*((volatile uint8_t *) (CONADDR + (x))) = (v)
 #endif
 
-#define	ISSET(t,f)	((t) & (f))
-
 #ifndef NS16550_FREQ
 #define	NS16550_FREQ	COM_FREQ
 #endif

Index: src/sys/arch/evbarm/stand/board/sscom.c
diff -u src/sys/arch/evbarm/stand/board/sscom.c:1.6 src/sys/arch/evbarm/stand/board/sscom.c:1.7
--- src/sys/arch/evbarm/stand/board/sscom.c:1.6	Mon Nov  4 21:57:26 2013
+++ src/sys/arch/evbarm/stand/board/sscom.c	Mon Sep  5 14:14:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sscom.c,v 1.6 2013/11/04 21:57:26 christos Exp $ */
+/*	$NetBSD: sscom.c,v 1.7 2022/09/05 14:14:42 tsutsui Exp $ */
 
 
 /*
@@ -93,8 +93,6 @@
 #define	OUTB(x, v)	(*((volatile uint8_t *) ((CONADDR) + (x))) = (v))
 #define	OUTW(x, v)	(*((volatile uint32_t *) ((CONADDR) + (x))) = (v))
 
-#define	ISSET(t,f)	((t) & (f))
-
 static long get_com_freq(void);
 
 static int

Index: src/sys/arch/hpcmips/stand/lcboot/extern.h
diff -u src/sys/arch/hpcmips/stand/lcboot/extern.h:1.4 src/sys/arch/hpcmips/stand/lcboot/extern.h:1.5
--- src/sys/arch/hpcmips/stand/lcboot/extern.h:1.4	Sun Dec 11 12:17:34 2005
+++ src/sys/arch/hpcmips/stand/lcboot/extern.h	Mon Sep  5 14:14:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.4 2005/12/11 12:17:34 christos Exp $ */
+/* $NetBSD: extern.h,v 1.5 2022/09/05 14:14:42 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Naoto Shimazaki.
@@ -80,8 +80,6 @@ struct boot_option {
 #define __REG_2(reg)	*((volatile u_int16_t*) (reg))
 #define __REG_4(reg)	*((volatile u_int32_t*) (reg))
 
-#define ISSET(t, f)	((t) & (f))
-
 #define REGWRITE_1(base, off, val)	\
 		(__REG_1(MIPS_PHYS_TO_KSEG1((u_int32_t) (base) + (off))) \
 		 = (val))

Index: src/sys/arch/i386/stand/lib/comio_direct.c
diff -u src/sys/arch/i386/stand/lib/comio_direct.c:1.11 src/sys/arch/i386/stand/lib/comio_direct.c:1.12
--- src/sys/arch/i386/stand/lib/comio_direct.c:1.11	Sun Jan  5 20:49:20 2014
+++ src/sys/arch/i386/stand/lib/comio_direct.c	Mon Sep  5 14:14:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: comio_direct.c,v 1.11 2014/01/05 20:49:20 jakllsch Exp $	*/
+/*	$NetBSD: comio_direct.c,v 1.12 2022/09/05 14:14:42 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1996, 1997
@@ -80,8 +80,6 @@ static int serbuf_read = 0;
 static int serbuf_write = 0;
 static int stopped = 0;
 
-#define	ISSET(t,f)	((t) & (f))
-
 #define	divrnd(n, q)	(((n)*2/(q)+1)/2)	/* divide and round off */
 #define RATE_9600 divrnd((COM_FREQ / 16), 9600)
 

Index: src/sys/compat/linux/arch/i386/linux_ptrace.c
diff -u src/sys/compat/linux/arch/i386/linux_ptrace.c:1.35 src/sys/compat/linux/arch/i386/linux_ptrace.c:1.36
--- src/sys/compat/linux/arch/i386/linux_ptrace.c:1.35	Tue Sep  7 11:43:04 2021
+++ src/sys/compat/linux/arch/i386/linux_ptrace.c	Mon Sep  5 

CVS commit: src/usr.sbin/rbootd

2022-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  3 07:45:08 UTC 2022

Modified Files:
src/usr.sbin/rbootd: Makefile bpf.c parseconf.c utils.c

Log Message:
Make build with WARNS=5.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/rbootd/Makefile
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/rbootd/bpf.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rbootd/parseconf.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/rbootd/utils.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.sbin/rbootd/Makefile
diff -u src/usr.sbin/rbootd/Makefile:1.15 src/usr.sbin/rbootd/Makefile:1.16
--- src/usr.sbin/rbootd/Makefile:1.15	Sun Oct 13 07:28:20 2019
+++ src/usr.sbin/rbootd/Makefile	Sat Sep  3 07:45:08 2022
@@ -1,6 +1,7 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/4/93
-#	$NetBSD: Makefile,v 1.15 2019/10/13 07:28:20 mrg Exp $
+#	$NetBSD: Makefile,v 1.16 2022/09/03 07:45:08 tsutsui Exp $
 
+WARNS?=	5
 USE_FORT?= yes	# network server
 
 PROG=	rbootd

Index: src/usr.sbin/rbootd/bpf.c
diff -u src/usr.sbin/rbootd/bpf.c:1.21 src/usr.sbin/rbootd/bpf.c:1.22
--- src/usr.sbin/rbootd/bpf.c:1.21	Tue Jan 23 21:06:25 2018
+++ src/usr.sbin/rbootd/bpf.c	Sat Sep  3 07:45:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.21 2018/01/23 21:06:25 sevan Exp $	*/
+/*	$NetBSD: bpf.c,v 1.22 2022/09/03 07:45:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -47,7 +47,7 @@
 #if 0
 static char sccsid[] = "@(#)bpf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: bpf.c,v 1.21 2018/01/23 21:06:25 sevan Exp $");
+__RCSID("$NetBSD: bpf.c,v 1.22 2022/09/03 07:45:08 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,7 +88,7 @@ static u_int8_t *BpfPkt = NULL;
 **		If an error is encountered, the program terminates here.
 */
 int
-BpfOpen()
+BpfOpen(void)
 {
 	struct ifreq ifr;
 	u_int bufsize = 32768;
@@ -368,7 +368,7 @@ BpfWrite(RMPCONN *rconn)
 **		None.
 */
 void
-BpfClose()
+BpfClose(void)
 {
 	struct ifreq ifr;
 

Index: src/usr.sbin/rbootd/parseconf.c
diff -u src/usr.sbin/rbootd/parseconf.c:1.12 src/usr.sbin/rbootd/parseconf.c:1.13
--- src/usr.sbin/rbootd/parseconf.c:1.12	Tue Jan 23 21:06:25 2018
+++ src/usr.sbin/rbootd/parseconf.c	Sat Sep  3 07:45:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parseconf.c,v 1.12 2018/01/23 21:06:25 sevan Exp $	*/
+/*	$NetBSD: parseconf.c,v 1.13 2022/09/03 07:45:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -47,7 +47,7 @@
 #if 0
 static char sccsid[] = "@(#)parseconf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: parseconf.c,v 1.12 2018/01/23 21:06:25 sevan Exp $");
+__RCSID("$NetBSD: parseconf.c,v 1.13 2022/09/03 07:45:08 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,7 +81,7 @@ __RCSID("$NetBSD: parseconf.c,v 1.12 201
 **		  to create a linked list of default boot files.
 */
 int
-ParseConfig()
+ParseConfig(void)
 {
 	FILE *fp;
 	CLIENT *client;
@@ -309,7 +309,7 @@ ParseAddr(char *str)
 **		  called to re-order its list of boot file pointers.
 */
 int
-GetBootFiles()
+GetBootFiles(void)
 {
 	DIR *dfd;
 	struct stat statb;

Index: src/usr.sbin/rbootd/utils.c
diff -u src/usr.sbin/rbootd/utils.c:1.18 src/usr.sbin/rbootd/utils.c:1.19
--- src/usr.sbin/rbootd/utils.c:1.18	Tue Jan 23 21:06:25 2018
+++ src/usr.sbin/rbootd/utils.c	Sat Sep  3 07:45:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: utils.c,v 1.18 2018/01/23 21:06:25 sevan Exp $	*/
+/*	$NetBSD: utils.c,v 1.19 2022/09/03 07:45:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988, 1992 The University of Utah and the Center
@@ -47,7 +47,7 @@
 #if 0
 static char sccsid[] = "@(#)utils.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: utils.c,v 1.18 2018/01/23 21:06:25 sevan Exp $");
+__RCSID("$NetBSD: utils.c,v 1.19 2022/09/03 07:45:08 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -302,7 +302,7 @@ NewClient(u_int8_t *addr)
 **		- This routine must be called with SIGHUP blocked.
 */
 void
-FreeClients()
+FreeClients(void)
 {
 	CLIENT *ctmp;
 
@@ -434,7 +434,7 @@ FreeConn(RMPCONN *rtmp)
 **		- This routine must be called with SIGHUP blocked.
 */
 void
-FreeConns()
+FreeConns(void)
 {
 	RMPCONN *rtmp;
 



CVS commit: src/usr.sbin/rbootd

2022-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  3 07:45:08 UTC 2022

Modified Files:
src/usr.sbin/rbootd: Makefile bpf.c parseconf.c utils.c

Log Message:
Make build with WARNS=5.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/rbootd/Makefile
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/rbootd/bpf.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rbootd/parseconf.c
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/rbootd/utils.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-wsfb/dist/src

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:09:51 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: add 8bpp planar support for LUNA using amiga's Afb.

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

Confirmed on my LUNA-II with 8bpp board.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.44 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.45
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.44	Tue Aug 30 15:08:49 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Tue Aug 30 15:09:51 2022
@@ -568,17 +568,31 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 #if defined(__NetBSD__) && defined(WSDISPLAY_TYPE_LUNA)
 	if (wstype == WSDISPLAY_TYPE_LUNA) {
 		/*
-		 * XXX
 		 * LUNA's color framebuffers support 4bpp or 8bpp
 		 * but they have multiple 1bpp VRAM planes like ancient VGA.
-		 * For now, Xorg server supports only the first one plane
-		 * as 1bpp monochrome server.
-		 *
-		 * Note OpenBSD/luna88k workarounds this by switching depth
-		 * and palette settings by WSDISPLAYIO_SETGFXMODE ioctl.
 		 */
-		default_depth = 1;
-		bitsperpixel = 1;
+#ifdef HAVE_SHADOW_AFB
+		if (bitsperpixel == 8) {
+			/*
+			 * For 8bpp one, we can use the bitplane ops with
+			 * shadow update proc as amiga.
+			 */
+			fPtr->planarAfb = TRUE;
+		} else
+#endif
+		{
+			/*
+			 * For 4bpp one (or there is no planar support),
+			 * just use only the first one plane
+			 * as 1bpp monochrome server.
+			 *
+			 * Note OpenBSD/luna88k workarounds this by
+			 * switching depth and palette settings by
+			 * WSDISPLAYIO_SETGFXMODE ioctl.
+			 */
+			default_depth = 1;
+			bitsperpixel = 1;
+		}
 	}
 #endif
 #ifdef WSDISPLAY_TYPE_AMIGACC
@@ -1187,7 +1201,11 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 #if defined(__NetBSD__) && defined(WSDISPLAY_TYPE_LUNA)
 	if (wstype == WSDISPLAY_TYPE_LUNA) {
 		ncolors = fPtr->fbi.fbi_subtype.fbi_cmapinfo.cmap_entries;
-		if (ncolors > 0) {
+		if (ncolors > 0
+#ifdef HAVE_SHADOW_AFB
+		&& !fPtr->planarAfb
+#endif
+		) {
 			/*
 			 * Override palette to use 4bpp/8bpp framebuffers as
 			 * monochrome server by using only the first plane.



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

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:09:51 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: add 8bpp planar support for LUNA using amiga's Afb.

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

Confirmed on my LUNA-II with 8bpp board.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.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-wsfb/dist/src

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:08:49 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: fix mmap size in Afb planar case.

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

"Looks like good improvement" from jandberg@ and also confirmed by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.43 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.44
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.43	Tue Aug 30 15:05:21 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Tue Aug 30 15:08:49 2022
@@ -931,6 +931,16 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	case 4:
 	case 8:
 		len = fPtr->fbi.fbi_stride * fPtr->fbi.fbi_height;
+#ifdef HAVE_SHADOW_AFB
+		if (fPtr->planarAfb) {
+			/*
+			 * stride is "bytes per line" for each plane so
+			 * we need a number of planes to mmap in planar case.
+			 */
+			len *= fPtr->fbi.fbi_bitsperpixel;
+		}
+#endif
+
 		break;
 	case 15:
 	case 16:



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

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:08:49 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb_driver.c

Log Message:
wsfb: fix mmap size in Afb planar case.

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

"Looks like good improvement" from jandberg@ and also confirmed by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.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-wsfb/dist/src

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:05:21 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
wsfb: reorganize implementation of Afb support.

- use XORG_VERSION_NUMERIC() to check if Afb is avaiable and
  define and use explicit HAVE_SHADOW_AFB macro
- disable all Afb references if it is not available

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

"Looks like good improvement" from jandberg@ and also confirmed by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.42 -r1.43 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb.h
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.8 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.9
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.8	Fri Jul 15 04:13:16 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h	Tue Aug 30 15:05:21 2022
@@ -41,6 +41,8 @@
 #include 
 #include 
 
+#include "xorgVersion.h"
+
 #include "compat-api.h"
 
 #include "xf86.h"
@@ -55,6 +57,10 @@
 #ifndef WSFB_H
 #define WSFB_H
 
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0)
+#define HAVE_SHADOW_AFB
+#endif
+
 /* private data */
 typedef struct {
 	int			fd; /* file descriptor of open device */
@@ -67,7 +73,9 @@ typedef struct {
 	Bool			shadowFB;
 	Bool			HWCursor;
 	Bool			useSwap32;
+#ifdef HAVE_SHADOW_AFB
 	Bool			planarAfb;
+#endif
 	CloseScreenProcPtr	CloseScreen;
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	void(*PointerMoved)(SCRN_ARG_TYPE, int, int);

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.42 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.43
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.42	Thu Jul  7 13:51:06 2022
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Tue Aug 30 15:05:21 2022
@@ -121,8 +121,10 @@ static Bool WsfbScreenInit(SCREEN_INIT_A
 static Bool WsfbCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static void *WsfbWindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
 			  void *);
+#ifdef HAVE_SHADOW_AFB
 static void *WsfbWindowAfb(ScreenPtr, CARD32, CARD32, int, CARD32 *,
 			  void *);
+#endif
 static void WsfbPointerMoved(SCRN_ARG_TYPE, int, int);
 static Bool WsfbEnterVT(VT_FUNC_ARGS_DECL);
 static void WsfbLeaveVT(VT_FUNC_ARGS_DECL);
@@ -213,7 +215,7 @@ static const char *shadowSymbols[] = {
 	"shadowUpdatePackedWeak",
 	"shadowUpdateRotatePacked",
 	"shadowUpdateRotatePackedWeak",
-#if XORG_VERSION_CURRENT >= (1) * 1000 + (20) * 10
+#ifdef HAVE_SHADOW_AFB
 	"shadowUpdateAfb8",
 #endif
 	NULL
@@ -581,7 +583,6 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 #endif
 #ifdef WSDISPLAY_TYPE_AMIGACC
 	if (wstype == WSDISPLAY_TYPE_AMIGACC) {
-#  if XORG_VERSION_CURRENT >= (1) * 1000 + (20) * 10
 		/*
 		 * Video memory is organized in bitplanes.
 		 * 8bpp or 1bpp supported in this driver.
@@ -589,10 +590,11 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		 * is done in shadow update proc.
 		 * With 1bpp no conversion needed.
 		 */
+#ifdef HAVE_SHADOW_AFB
 		if (bitsperpixel == 8) {
 			fPtr->planarAfb = TRUE;
 		} else
-#  endif
+#endif
 		{
 			default_depth = 1;
 			bitsperpixel = 1;
@@ -869,17 +871,16 @@ WsfbCreateScreenResources(ScreenPtr pScr
 		shadowproc = WsfbShadowUpdateSwap32;
 	} else if (fPtr->rotate) {
 		shadowproc = shadowUpdateRotatePacked;
-	} else if (fPtr->planarAfb) {
-#if XORG_VERSION_CURRENT >= (1) * 1000 + (20) * 10
+	} else
+#ifdef HAVE_SHADOW_AFB
+	if (fPtr->planarAfb) {
 		shadowproc = shadowUpdateAfb8;
-#else
-		xf86Msg(X_ERROR,
-		"Planar fb requires xorg-server 1.20 or higher.");
-		return FALSE;
-#endif
 		windowproc = WsfbWindowAfb;
 	} else
+#endif
+	{
 		shadowproc = shadowUpdatePacked;
+	}
 	
 	if (!shadowAdd(pScreen, pPixmap, shadowproc,
 		windowproc, fPtr->rotate, NULL)) {
@@ -1024,10 +1025,14 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 			 */
 			len = pScrn->virtualX * pScrn->virtualY *
 			(pScrn->bitsPerPixel >> 3);
-		} else if (fPtr->planarAfb) {
+		} else
+#ifdef HAVE_SHADOW_AFB
+		if (fPtr->planarAfb) {
 			/* always 8bpp */
 			len = pScrn->virtualX * pScrn->virtualY;
-		} else {
+		} else
+#endif
+		{
 			len = fPtr->fbi.fbi_stride * pScrn->virtualY;
 		}
 		fPtr->shadow = calloc(1, len);
@@ -1046,9 +1051,13 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	 */
 	if (fPtr->rotate) {
 		width = pScrn->displayWidth;
-	} else if (fPtr->planarAfb) {
+	} else
+#ifdef HAVE_SHADOW_AFB
+	if (fPtr->planarAfb) {
 		width = pScrn->displayWidth;
-	} else {
+	} else
+#endif
+	{
 		if 

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

2022-08-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Tue Aug 30 15:05:21 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
wsfb: reorganize implementation of Afb support.

- use XORG_VERSION_NUMERIC() to check if Afb is avaiable and
  define and use explicit HAVE_SHADOW_AFB macro
- disable all Afb references if it is not available

Reviewed on tech-x11@:
 https://mail-index.netbsd.org/tech-x11/2022/08/23/msg002311.html

"Looks like good improvement" from jandberg@ and also confirmed by rin@.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.42 -r1.43 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

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



CVS commit: src/usr.sbin/sysinst/arch/atari

2022-08-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 28 13:56:56 UTC 2022

Modified Files:
src/usr.sbin/sysinst/arch/atari: md.c

Log Message:
Choose a proper kernel set per a running kernel during installation.

Mostly taken from sgimips.
This avoids users from overwriting by the default ATARITT kernel on
non TT machines like Falcon, Hades, and Milan etc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/atari/md.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.sbin/sysinst/arch/atari/md.c
diff -u src/usr.sbin/sysinst/arch/atari/md.c:1.8 src/usr.sbin/sysinst/arch/atari/md.c:1.9
--- src/usr.sbin/sysinst/arch/atari/md.c:1.8	Sat Jan 29 16:01:17 2022
+++ src/usr.sbin/sysinst/arch/atari/md.c	Sun Aug 28 13:56:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.8 2022/01/29 16:01:17 martin Exp $ */
+/*	$NetBSD: md.c,v 1.9 2022/08/28 13:56:56 tsutsui Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "defs.h"
 #include "md.h"
@@ -53,7 +54,27 @@ md_init(void)
 void
 md_init_set_status(int flags)
 {
+	struct utsname instsys;
+
 	(void)flags;
+
+	/*
+	 * Get the name of the kernel we are running under and
+	 * enable the installation of the corresponding GENERIC-like kernel.
+	 */
+	uname();
+	if (strstr(instsys.version, "(ATARITT"))
+		set_kernel_set(SET_KERNEL_1);
+	else if (strstr(instsys.version, "(FALCON"))
+		set_kernel_set(SET_KERNEL_2);
+	else if (strstr(instsys.version, "(SMALL030"))
+		set_kernel_set(SET_KERNEL_3);
+	else if (strstr(instsys.version, "(HADES"))
+		set_kernel_set(SET_KERNEL_4);
+	else if (strstr(instsys.version, "(MILAN-ISAIDE"))
+		set_kernel_set(SET_KERNEL_5);
+	else if (strstr(instsys.version, "(MILAN_PCIIDE"))
+		set_kernel_set(SET_KERNEL_6);
 }
 
 bool



CVS commit: src/usr.sbin/sysinst/arch/atari

2022-08-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 28 13:56:56 UTC 2022

Modified Files:
src/usr.sbin/sysinst/arch/atari: md.c

Log Message:
Choose a proper kernel set per a running kernel during installation.

Mostly taken from sgimips.
This avoids users from overwriting by the default ATARITT kernel on
non TT machines like Falcon, Hades, and Milan etc.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/arch/atari/md.c

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



CVS commit: src/distrib

2022-08-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 28 12:44:01 UTC 2022

Modified Files:
src/distrib/amiga/floppies/inst-common: dot.commonutils
src/distrib/amiga/miniroot: dot.profile
src/distrib/utils/script-installer: dot.commonutils
src/distrib/vax/inst-common: dot.commonutils

Log Message:
Avoid more obsolescent binary primaries not supported by crunched test(1).

See PR/54835 and PR/56983 for details.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/distrib/amiga/floppies/inst-common/dot.commonutils
cvs rdiff -u -r1.10 -r1.11 src/distrib/amiga/miniroot/dot.profile
cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/script-installer/dot.commonutils
cvs rdiff -u -r1.5 -r1.6 src/distrib/vax/inst-common/dot.commonutils

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

Modified files:

Index: src/distrib/amiga/floppies/inst-common/dot.commonutils
diff -u src/distrib/amiga/floppies/inst-common/dot.commonutils:1.8 src/distrib/amiga/floppies/inst-common/dot.commonutils:1.9
--- src/distrib/amiga/floppies/inst-common/dot.commonutils:1.8	Sat Jul 26 17:06:29 2003
+++ src/distrib/amiga/floppies/inst-common/dot.commonutils	Sun Aug 28 12:44:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: dot.commonutils,v 1.8 2003/07/26 17:06:29 salo Exp $
+# $NetBSD: dot.commonutils,v 1.9 2022/08/28 12:44:00 tsutsui Exp $
 #
 # Copyright (c) 1994 Christopher G. Demetriou
 # All rights reserved.
@@ -49,7 +49,7 @@ GUNZIP=/usr/bin/gunzip
 Set_tmp_dir()
 {
 	def_tmp_dir=`pwd`
-	if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
+	if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then
 		def_tmp_dir="$dest_dir"usr/distrib
 	fi
 
@@ -78,7 +78,7 @@ Load_fd()
 {
 	Tmp_dir
 	which=
-	while [ "$which" != "a" -a "$which" != "b" ]; do
+	while [ "$which" != "a" ] && [ "$which" != "b" ]; do
 		echo -n	"Read from which floppy drive ('a' or 'b')? [a] "
 		read which
 		if [ "X$which" = "X" ]; then

Index: src/distrib/amiga/miniroot/dot.profile
diff -u src/distrib/amiga/miniroot/dot.profile:1.10 src/distrib/amiga/miniroot/dot.profile:1.11
--- src/distrib/amiga/miniroot/dot.profile:1.10	Sun Jul 27 19:55:19 2008
+++ src/distrib/amiga/miniroot/dot.profile	Sun Aug 28 12:44:01 2022
@@ -1,4 +1,4 @@
-# $NetBSD: dot.profile,v 1.10 2008/07/27 19:55:19 mlelstv Exp $
+# $NetBSD: dot.profile,v 1.11 2022/08/28 12:44:01 tsutsui Exp $
 #
 # Copyright (c) 1995 Jason R. Thorpe
 # Copyright (c) 1994 Christopher G. Demetriou
@@ -71,7 +71,7 @@ if [ "X${DONEPROFILE}" = "X" ]; then
 		# Check if the answer is valid (in range). Note that an answer
 		# < 0 cannot happen because the sed(1) above also removes the
 		# sign.
-		if [ -z "$_ans" -o "$_ans" -ge $_num ]; then
+		if [ -z "$_ans" ] || [ "$_ans" -ge $_num ]; then
 		echo "You entered an invalid response, please try again."
 		continue
 		fi

Index: src/distrib/utils/script-installer/dot.commonutils
diff -u src/distrib/utils/script-installer/dot.commonutils:1.7 src/distrib/utils/script-installer/dot.commonutils:1.8
--- src/distrib/utils/script-installer/dot.commonutils:1.7	Sat Jul 26 17:07:37 2003
+++ src/distrib/utils/script-installer/dot.commonutils	Sun Aug 28 12:44:01 2022
@@ -1,4 +1,4 @@
-# $NetBSD: dot.commonutils,v 1.7 2003/07/26 17:07:37 salo Exp $
+# $NetBSD: dot.commonutils,v 1.8 2022/08/28 12:44:01 tsutsui Exp $
 #
 # Copyright (c) 1994 Christopher G. Demetriou
 # All rights reserved.
@@ -49,7 +49,7 @@ GUNZIP=/usr/bin/gunzip
 Set_tmp_dir()
 {
 	def_tmp_dir=`pwd`
-	if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
+	if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then
 		def_tmp_dir="$dest_dir"usr/distrib
 	fi
 
@@ -81,7 +81,7 @@ Load_fd()
 #	echo "Don't forget that you can't load from the drive you booted from."
 	echo ""
 
-	while [ "$which" != "0" -a "$which" != "1" ]; do
+	while [ "$which" != "0" ] && [ "$which" != "1" ]; do
 		echo -n	"Read from which floppy drive ('0' or '1')? [0] "
 		read which
 		if [ "X$which" = "X" ]; then

Index: src/distrib/vax/inst-common/dot.commonutils
diff -u src/distrib/vax/inst-common/dot.commonutils:1.5 src/distrib/vax/inst-common/dot.commonutils:1.6
--- src/distrib/vax/inst-common/dot.commonutils:1.5	Sat Jul 26 17:07:41 2003
+++ src/distrib/vax/inst-common/dot.commonutils	Sun Aug 28 12:44:01 2022
@@ -1,4 +1,4 @@
-# $NetBSD: dot.commonutils,v 1.5 2003/07/26 17:07:41 salo Exp $
+# $NetBSD: dot.commonutils,v 1.6 2022/08/28 12:44:01 tsutsui Exp $
 #
 # Copyright (c) 1994 Christopher G. Demetriou
 # All rights reserved.
@@ -39,7 +39,7 @@
 Set_tmp_dir()
 {
 	def_tmp_dir=`pwd`
-	if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
+	if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then
 		def_tmp_dir=/mnt/usr/distrib
 	fi
 
@@ -68,7 +68,7 @@ Load_fd()
 {
 	Tmp_dir
 	which=
-	while [ "$which" != "a" -a "$which" != "b" ]; do
+	while [ "$which" != "a" ] && [ "$which" != "b" ]; do
 		echo -n	"Read 

CVS commit: src/distrib

2022-08-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug 28 12:44:01 UTC 2022

Modified Files:
src/distrib/amiga/floppies/inst-common: dot.commonutils
src/distrib/amiga/miniroot: dot.profile
src/distrib/utils/script-installer: dot.commonutils
src/distrib/vax/inst-common: dot.commonutils

Log Message:
Avoid more obsolescent binary primaries not supported by crunched test(1).

See PR/54835 and PR/56983 for details.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/distrib/amiga/floppies/inst-common/dot.commonutils
cvs rdiff -u -r1.10 -r1.11 src/distrib/amiga/miniroot/dot.profile
cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/script-installer/dot.commonutils
cvs rdiff -u -r1.5 -r1.6 src/distrib/vax/inst-common/dot.commonutils

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



CVS commit: src/distrib/atari/floppies/common

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 20:50:41 UTC 2022

Modified Files:
src/distrib/atari/floppies/common: dot.profile

Log Message:
Fix yet another "[: SMALL test, no fallback usage" error on installation.

The same problem as PR/54835 of the miniroot scripts, i.e.
avoid and replace use of -o binary primary marked obsolescent
by POSIX.1-2017:
 https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_12
8_16

Noticed on installation of NetBSD 9.3 on TT030, and
maybe should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/atari/floppies/common/dot.profile

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

Modified files:

Index: src/distrib/atari/floppies/common/dot.profile
diff -u src/distrib/atari/floppies/common/dot.profile:1.8 src/distrib/atari/floppies/common/dot.profile:1.9
--- src/distrib/atari/floppies/common/dot.profile:1.8	Thu Jan  9 19:17:41 2020
+++ src/distrib/atari/floppies/common/dot.profile	Sat Aug 20 20:50:41 2022
@@ -1,4 +1,4 @@
-# $NetBSD: dot.profile,v 1.8 2020/01/09 19:17:41 martin Exp $
+# $NetBSD: dot.profile,v 1.9 2022/08/20 20:50:41 tsutsui Exp $
 #
 # Copyright (c) 1995 Jason R. Thorpe
 # Copyright (c) 1994 Christopher G. Demetriou
@@ -95,7 +95,7 @@ if [ "X${DONEPROFILE}" = "X" ]; then
 		# Check if the answer is valid (in range). Note that an answer
 		# < 0 cannot happen because the sed(1) above also removes the
 		# sign.
-		if [ -z "$_ans" -o "$_ans" -ge $_num ]; then
+		if [ -z "$_ans" ] || [ "$_ans" -ge $_num ]; then
 		echo "You entered an invalid response, please try again."
 		continue
 		fi



CVS commit: src/distrib/atari/floppies/common

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 20:50:41 UTC 2022

Modified Files:
src/distrib/atari/floppies/common: dot.profile

Log Message:
Fix yet another "[: SMALL test, no fallback usage" error on installation.

The same problem as PR/54835 of the miniroot scripts, i.e.
avoid and replace use of -o binary primary marked obsolescent
by POSIX.1-2017:
 https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_12
8_16

Noticed on installation of NetBSD 9.3 on TT030, and
maybe should be pulled up to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/atari/floppies/common/dot.profile

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



CVS commit: src/sys/arch/mac68k/obio

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 20:02:22 UTC 2022

Modified Files:
src/sys/arch/mac68k/obio: wdc_obio.c

Log Message:
Unmap resources and print error messages properly in error paths.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mac68k/obio/wdc_obio.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/mac68k/obio

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 20:02:22 UTC 2022

Modified Files:
src/sys/arch/mac68k/obio: wdc_obio.c

Log Message:
Unmap resources and print error messages properly in error paths.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mac68k/obio/wdc_obio.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/mac68k/obio/wdc_obio.c
diff -u src/sys/arch/mac68k/obio/wdc_obio.c:1.31 src/sys/arch/mac68k/obio/wdc_obio.c:1.32
--- src/sys/arch/mac68k/obio/wdc_obio.c:1.31	Sat Aug 20 19:05:07 2022
+++ src/sys/arch/mac68k/obio/wdc_obio.c	Sat Aug 20 20:02:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_obio.c,v 1.31 2022/08/20 19:05:07 tsutsui Exp $ */
+/*	$NetBSD: wdc_obio.c,v 1.32 2022/08/20 20:02:22 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2002 Takeshi Shibagaki  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.31 2022/08/20 19:05:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.32 2022/08/20 20:02:22 tsutsui Exp $");
 
 #include 
 #include 
@@ -110,21 +110,20 @@ wdc_obio_match(device_t parent, cfdata_t
 		for (i = 0; i < WDC_NREG; i++) {
 			if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
 			i * 4, 4, >cmd_iohs[i]) != 0)
-goto out;
+goto unmap;
 		}
 		wdc_init_shadow_regs(wdr);
 
 		if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
 		WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS,
 		>ctl_ioh))
-			goto out;
+			goto unmap;
 
 		result = wdcprobe(wdr);
 
+ unmap:
 		bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
 		WDC_OBIO_REG_NPORTS);
-
-		goto out;
 	}
  out:
 	kmem_free(wdr, sizeof(*wdr));
@@ -148,7 +147,7 @@ wdc_obio_attach(device_t parent, device_
 
 	if (bus_space_map(wdr->cmd_iot, oa->oa_addr, WDC_OBIO_REG_NPORTS, 0,
 	>cmd_baseioh)) {
-		aprint_error_dev(self, "couldn't map registers\n");
+		aprint_error(": couldn't map registers\n");
 		return;
 	}
 
@@ -157,24 +156,24 @@ wdc_obio_attach(device_t parent, device_
 	for (i = 0; i < WDC_NREG; i++) {
 		if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
 		i * 4, 4, >cmd_iohs[i]) != 0) {
-			aprint_error_dev(self,
-			"unable to subregion control register\n");
-			return;
+			aprint_error(
+			": unable to subregion control register\n");
+			goto err;
 		}
 	}
 
 	if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
 	WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS, >ctl_ioh)) {
-		aprint_error_dev(self, "unable to subregion aux register\n");
-		return;
+		aprint_error(": unable to subregion aux register\n");
+		goto err;
 	}
 
 	wdc_obio_isr_tag = oa->oa_tag;
 
 	if (bus_space_map(wdc_obio_isr_tag, oa->oa_addr + WDC_OBIO_ISR_OFFSET,
 	WDC_OBIO_ISR_NPORTS, 0, _obio_isr_hdl)) {
-		aprint_error_dev(self, " couldn't map intr status register\n");
-		return;
+		aprint_error(": couldn't map intr status register\n");
+		goto err;
 	}
 
 	switch (current_mac_model->machineid) {
@@ -218,6 +217,10 @@ wdc_obio_attach(device_t parent, device_
 	aprint_normal("\n");
 
 	wdcattach(chp);
+	return;
+
+ err:
+	bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, WDC_OBIO_REG_NPORTS);
 }
 
 void



CVS commit: src/sys/arch/mac68k/obio

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 19:05:07 UTC 2022

Modified Files:
src/sys/arch/mac68k/obio: wdc_obio.c

Log Message:
KNF and misc style fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mac68k/obio/wdc_obio.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/mac68k/obio/wdc_obio.c
diff -u src/sys/arch/mac68k/obio/wdc_obio.c:1.30 src/sys/arch/mac68k/obio/wdc_obio.c:1.31
--- src/sys/arch/mac68k/obio/wdc_obio.c:1.30	Sun May 31 08:59:40 2020
+++ src/sys/arch/mac68k/obio/wdc_obio.c	Sat Aug 20 19:05:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_obio.c,v 1.30 2020/05/31 08:59:40 rin Exp $ */
+/*	$NetBSD: wdc_obio.c,v 1.31 2022/08/20 19:05:07 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2002 Takeshi Shibagaki  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.30 2020/05/31 08:59:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.31 2022/08/20 19:05:07 tsutsui Exp $");
 
 #include 
 #include 
@@ -90,7 +90,7 @@ wdc_obio_match(device_t parent, cfdata_t
 	struct wdc_regs *wdr;
 	int i, result = 0;
 
-	wdr = kmem_alloc(sizeof(struct wdc_regs), KM_SLEEP);
+	wdr = kmem_alloc(sizeof(*wdr), KM_SLEEP);
 
 	switch (current_mac_model->machineid) {
 	case MACH_MACPB150:
@@ -101,7 +101,7 @@ wdc_obio_match(device_t parent, cfdata_t
 		wdr->cmd_iot = wdr->ctl_iot = oa->oa_tag;
 
 		if (bus_space_map(wdr->cmd_iot, IDEBase, WDC_OBIO_REG_NPORTS,
-0, >cmd_baseioh))
+		0, >cmd_baseioh))
 			goto out;
 
 		mac68k_bus_space_handle_swapped(wdr->cmd_iot,
@@ -109,16 +109,14 @@ wdc_obio_match(device_t parent, cfdata_t
 
 		for (i = 0; i < WDC_NREG; i++) {
 			if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
-	4 * i, 4, >cmd_iohs[i]) != 0)
+			i * 4, 4, >cmd_iohs[i]) != 0)
 goto out;
 		}
 		wdc_init_shadow_regs(wdr);
 
-
 		if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
-WDC_OBIO_AUXREG_OFFSET,
-	WDC_OBIO_AUXREG_NPORTS,
-	>ctl_ioh))
+		WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS,
+		>ctl_ioh))
 			goto out;
 
 		result = wdcprobe(wdr);
@@ -128,7 +126,8 @@ wdc_obio_match(device_t parent, cfdata_t
 
 		goto out;
 	}
-out:	kmem_free(wdr, sizeof(struct wdc_regs));
+ out:
+	kmem_free(wdr, sizeof(*wdr));
 	return result;
 }
 
@@ -147,38 +146,33 @@ wdc_obio_attach(device_t parent, device_
 	oa->oa_addr = IDEBase;
 	wdr->cmd_iot = wdr->ctl_iot = oa->oa_tag;
 
-	if (bus_space_map(wdr->cmd_iot, oa->oa_addr,
-		  WDC_OBIO_REG_NPORTS, 0, >cmd_baseioh)) {
+	if (bus_space_map(wdr->cmd_iot, oa->oa_addr, WDC_OBIO_REG_NPORTS, 0,
+	>cmd_baseioh)) {
 		aprint_error_dev(self, "couldn't map registers\n");
 		return;
 	}
 
-	mac68k_bus_space_handle_swapped(wdr->cmd_iot,
-  >cmd_baseioh);
+	mac68k_bus_space_handle_swapped(wdr->cmd_iot, >cmd_baseioh);
 
 	for (i = 0; i < WDC_NREG; i++) {
-		if (bus_space_subregion(wdr->cmd_iot,
-wdr->cmd_baseioh, 4 * i, 4,
->cmd_iohs[i]) != 0) {
+		if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
+		i * 4, 4, >cmd_iohs[i]) != 0) {
 			aprint_error_dev(self,
 			"unable to subregion control register\n");
 			return;
 		}
 	}
 
-	if (bus_space_subregion(wdr->cmd_iot,
-wdr->cmd_baseioh,
-WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS,
->ctl_ioh)) {
+	if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh,
+	WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS, >ctl_ioh)) {
 		aprint_error_dev(self, "unable to subregion aux register\n");
 		return;
 	}
 
-	wdc_obio_isr_tag = oa->oa_tag;
+	wdc_obio_isr_tag = oa->oa_tag;
 
-	if (bus_space_map(wdc_obio_isr_tag,
-			  oa->oa_addr+WDC_OBIO_ISR_OFFSET,
-			  WDC_OBIO_ISR_NPORTS, 0, _obio_isr_hdl)) {
+	if (bus_space_map(wdc_obio_isr_tag, oa->oa_addr + WDC_OBIO_ISR_OFFSET,
+	WDC_OBIO_ISR_NPORTS, 0, _obio_isr_hdl)) {
 		aprint_error_dev(self, " couldn't map intr status register\n");
 		return;
 	}
@@ -191,7 +185,7 @@ wdc_obio_attach(device_t parent, device_
 		 */
 		aprint_normal(" (Quadra/Performa series IDE interface)");
 
-		add_nubus_intr(0xf, (void (*)(void*))wdc_obio_intr, (void *)sc);
+		add_nubus_intr(0xf, wdc_obio_intr, sc);
 
 		break;
 	case MACH_MACPB150:
@@ -202,14 +196,13 @@ wdc_obio_attach(device_t parent, device_
 		 */
 		aprint_normal(" (PowerBook series IDE interface)");
 
-		add_nubus_intr(0xc, (void (*)(void*))wdc_obio_intr, (void *)sc);
+		add_nubus_intr(0xc, wdc_obio_intr, sc);
 
 		break;
 	}
 
 	ch_sc = chp;
-	if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags &
-	ATAC_CAP_NOIRQ)
+	if ((device_cfdata(self)->cf_flags & ATAC_CAP_NOIRQ) != 0)
 		sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_NOIRQ;
 	sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16;
 	sc->sc_wdcdev.sc_atac.atac_pio_cap = 0;
@@ -230,13 +223,12 @@ wdc_obio_attach(device_t parent, device_
 void
 wdc_obio_intr(void *arg)
 {
-	unsigned char 

CVS commit: src/sys/arch/mac68k/obio

2022-08-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 20 19:05:07 UTC 2022

Modified Files:
src/sys/arch/mac68k/obio: wdc_obio.c

Log Message:
KNF and misc style fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mac68k/obio/wdc_obio.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/sun3/conf

2022-08-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Aug 17 19:13:05 UTC 2022

Modified Files:
src/sys/arch/sun3/conf: GENERIC3X

Log Message:
Add bwtwo0 config on P4 cgfour overlay plane on 3/80, as 3/60 in bw2.sun3.

Note the ancient Xsun server supports multiple framebuffers with both
cgfour (at DISPLAY :0) and overlay bwtwo (at DISPLAY :0.1).


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/sun3/conf/GENERIC3X

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/sun3/conf/GENERIC3X
diff -u src/sys/arch/sun3/conf/GENERIC3X:1.140 src/sys/arch/sun3/conf/GENERIC3X:1.141
--- src/sys/arch/sun3/conf/GENERIC3X:1.140	Sun Aug  7 02:52:30 2022
+++ src/sys/arch/sun3/conf/GENERIC3X	Wed Aug 17 19:13:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC3X,v 1.140 2022/08/07 02:52:30 simonb Exp $
+# $NetBSD: GENERIC3X,v 1.141 2022/08/17 19:13:05 tsutsui Exp $
 
 # GENERIC Sun3X (3/80, 3/470)
 # Supports root on: ie0, le0, sd*, ...
@@ -7,7 +7,7 @@ include 	"arch/sun3/conf/std.sun3x"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC3X-$Revision: 1.140 $"
+#ident		"GENERIC3X-$Revision: 1.141 $"
 
 makeoptions	COPTS="-Os -fno-unwind-tables -fno-omit-frame-pointer"
 	# Bootloader has size limit (~2MB). -fno-omit-frame-pointer is
@@ -203,6 +203,11 @@ xd* at xdc? drive ?
 
 # P4 Monochrome frame buffer.
 bwtwo0	at obmem0 addr 0x5030
+# The bw2 driver can also run on a cg4 overlay plane,
+# and the 0x40 flag means "CG overlay plane" mode.
+# The low 4 bits of the flags (if set) are matched
+# against the same bits of the machine type ID code.
+bwtwo0	at obmem0 addr 0x5030 flags 0x42	# 3/80 (P4 cgfour overlay)
 
 # P4 8-bit color frame buffer
 cgfour0 at obmem0 addr 0x5030



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

2022-08-17 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Aug 17 19:13:05 UTC 2022

Modified Files:
src/sys/arch/sun3/conf: GENERIC3X

Log Message:
Add bwtwo0 config on P4 cgfour overlay plane on 3/80, as 3/60 in bw2.sun3.

Note the ancient Xsun server supports multiple framebuffers with both
cgfour (at DISPLAY :0) and overlay bwtwo (at DISPLAY :0.1).


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/sun3/conf/GENERIC3X

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



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

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:58:52 UTC 2022

Modified Files:
src/sys/arch/atari/conf: MILAN-ISAIDE MILAN-PCIIDE

Log Message:
Regen from MILAN.in rev 1.30.

> Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/atari/conf/MILAN-PCIIDE

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/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.98 src/sys/arch/atari/conf/MILAN-ISAIDE:1.99
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.98	Sun Aug  7 02:55:46 2022
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Mon Aug 15 04:58:52 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.98 2022/08/07 02:55:46 simonb Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.99 2022/08/15 04:58:52 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.30 2022/08/15 04:40:20 tsutsui Exp $
 #		NetBSD: GENERIC.in,v 1.124 2022/08/07 02:52:24 simonb Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -83,6 +83,7 @@ options WS_KERNEL_BG=WSCOL_BLACK
 options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
 options WSDISPLAY_DEFAULTSCREENS=4
 options PCDISPLAY_SOFTCURSOR
+options FONT_VT220L8x16
 isab0 at mainbus0 # ISA-bus
 isa0 at isab0
 pcib0 at mainbus0 # PCI-bus

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.102 src/sys/arch/atari/conf/MILAN-PCIIDE:1.103
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.102	Sun Aug  7 02:55:46 2022
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Mon Aug 15 04:58:52 2022
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.102 2022/08/07 02:55:46 simonb Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.103 2022/08/15 04:58:52 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.30 2022/08/15 04:40:20 tsutsui Exp $
 #		NetBSD: GENERIC.in,v 1.124 2022/08/07 02:52:24 simonb Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -83,6 +83,7 @@ options WS_KERNEL_BG=WSCOL_BLACK
 options WSDISPLAY_COMPAT_USL # wsconscfg VT handling
 options WSDISPLAY_DEFAULTSCREENS=4
 options PCDISPLAY_SOFTCURSOR
+options FONT_VT220L8x16
 isab0 at mainbus0 # ISA-bus
 isa0 at isab0
 pcib0 at mainbus0 # PCI-bus



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

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:58:52 UTC 2022

Modified Files:
src/sys/arch/atari/conf: MILAN-ISAIDE MILAN-PCIIDE

Log Message:
Regen from MILAN.in rev 1.30.

> Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/atari/conf/MILAN-PCIIDE

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



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

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:40:20 UTC 2022

Modified Files:
src/sys/arch/atari/conf: MILAN.in

Log Message:
Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/atari/conf/MILAN.in

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/atari/conf/MILAN.in
diff -u src/sys/arch/atari/conf/MILAN.in:1.29 src/sys/arch/atari/conf/MILAN.in:1.30
--- src/sys/arch/atari/conf/MILAN.in:1.29	Sat May  4 13:12:03 2019
+++ src/sys/arch/atari/conf/MILAN.in	Mon Aug 15 04:40:20 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: MILAN.in,v 1.29 2019/05/04 13:12:03 tsutsui Exp $
+#	$NetBSD: MILAN.in,v 1.30 2022/08/15 04:40:20 tsutsui Exp $
 #
 # Milan
 #
@@ -34,6 +34,8 @@ options 	WSDISPLAY_DEFAULTSCREENS=4
 options 	PCDISPLAY_SOFTCURSOR
 # modify the screen type of the console; defaults to "80x25"
 #options 	VGA_CONSOLE_SCREENTYPE="\"80x25\""
+# use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
+options 	FONT_VT220L8x16
 
 #
 # The following sections describe various hardware options.



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

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:40:20 UTC 2022

Modified Files:
src/sys/arch/atari/conf: MILAN.in

Log Message:
Specify options FONT_VT220L8x16 to get similar glyphs as past font_8x16.c.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/atari/conf/MILAN.in

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



CVS commit: src/sys/arch/atari/pci

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:37:47 UTC 2022

Modified Files:
src/sys/arch/atari/pci: pci_vga.c

Log Message:
Improve VGA console settings for Milan, especially for sysinst.

- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/pci/pci_vga.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/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.18 src/sys/arch/atari/pci/pci_vga.c:1.19
--- src/sys/arch/atari/pci/pci_vga.c:1.18	Sat Jul 31 20:51:32 2021
+++ src/sys/arch/atari/pci/pci_vga.c	Mon Aug 15 04:37:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_vga.c,v 1.18 2021/07/31 20:51:32 andvar Exp $	*/
+/*	$NetBSD: pci_vga.c,v 1.19 2022/08/15 04:37:46 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Leo Weppelman.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.18 2021/07/31 20:51:32 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.19 2022/08/15 04:37:46 tsutsui Exp $");
 
 #include 
 #include 
@@ -55,11 +55,51 @@ extern font_info	font_info_8x8;
 extern font_info	font_info_8x16;
 
 /* Console colors */
-static const uint8_t conscolors[3][3] = {
-	/* background, foreground, hilite */
-	{ 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x30 },
-	{ 0x3f, 0x3f, 0x3f }
+/* attribute controller registers */
+static const uint8_t vga_atc[] = {
+	0x00,	/* 00: internal palette  0 */
+	0x01,	/* 01: internal palette  1 */
+	0x02,	/* 02: internal palette  2 */
+	0x03,	/* 03: internal palette  3 */
+	0x04,	/* 04: internal palette  4 */
+	0x05,	/* 05: internal palette  5 */
+	0x14,	/* 06: internal palette  6 */
+	0x07,	/* 07: internal palette  7 */
+	0x38,	/* 08: internal palette  8 */
+	0x39,	/* 09: internal palette  9 */
+	0x3a,	/* 0A: internal palette 10 */
+	0x3b,	/* 0B: internal palette 11 */
+	0x3c,	/* 0C: internal palette 12 */
+	0x3d,	/* 0D: internal palette 13 */
+	0x3e,	/* 0E: internal palette 14 */
+	0x3f,	/* 0F: internal palette 15 */
+	0x0c,	/* 10: attribute mode control */
+	0x00,	/* 11: overscan color */
+	0x0f,	/* 12: color plane enable */
+	0x08,	/* 13: horizontal PEL panning */
+	0x00	/* 14: color select */
+};
+
+/* video DAC palette registers */
+/* XXX only set up 16 colors used by internal palette in ATC regsters */
+static const uint8_t vga_dacpal[] = {
+	/* R G B */
+	0x00, 0x00, 0x00,	/* BLACK*/
+	0x00, 0x00, 0x2a,	/* BLUE	*/
+	0x00, 0x2a, 0x00,	/* GREEN*/
+	0x00, 0x2a, 0x2a,	/* CYAN */
+	0x2a, 0x00, 0x00,	/* RED  */
+	0x2a, 0x00, 0x2a,	/* MAGENTA  */
+	0x2a, 0x15, 0x00,	/* BROWN*/
+	0x2a, 0x2a, 0x2a,	/* LIGHTGREY*/
+	0x15, 0x15, 0x15,	/* DARKGREY */
+	0x15, 0x15, 0x3f,	/* LIGHTBLUE*/
+	0x15, 0x3f, 0x15,	/* LIGHTGREEN   */
+	0x15, 0x3f, 0x3f,	/* LIGHTCYAN*/
+	0x3f, 0x15, 0x15,	/* LIGHTRED */
+	0x3f, 0x15, 0x3f,	/* LIGHTMAGENTA */
+	0x3f, 0x3f, 0x15,	/* YELLOW   */
+	0x3f, 0x3f, 0x3f	/* WHITE*/
 };
 
 static bus_space_tag_t	vga_iot, vga_memt;
@@ -79,7 +119,7 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	pci_chipset_tag_t	pc = NULL; /* XXX */
 	bus_space_handle_t	ioh_regs, memh_fb;
 	pcitag_t		tag;
-	int			device, found, maxndevs, i, j;
+	int			device, found, maxndevs, i;
 	int			got_ioh, got_memh, rv;
 	uint32_t		id, class;
 	volatile uint8_t	*regs;
@@ -176,16 +216,23 @@ check_for_vga(bus_space_tag_t iot, bus_s
 	 * Generic parts of the initialization...
 	 */
 	
-	/* B colors */
-	vgaw(regs, VDAC_ADDRESS_W, 0);
-	for (i = 0; i < 256; i++) {
-		j = (i & 1) ? ((i > 7) ? 2 : 1) : 0;
-		vgaw(regs, VDAC_DATA, conscolors[j][0]);
-		vgaw(regs, VDAC_DATA, conscolors[j][1]);
-		vgaw(regs, VDAC_DATA, conscolors[j][2]);
+	/* set ATC registers */
+	for (i = 0; i < 21; i++)
+		WAttr(regs, i, vga_atc[i]);
+
+	/* set DAC palette */
+	for (i = 0; i < 16; i++) {
+		vgaw(regs, VDAC_ADDRESS_W, vga_atc[i]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 0]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 1]);
+		vgaw(regs, VDAC_DATA, vga_dacpal[i * 3 + 2]);
 	}
 
 	loadfont(regs, fb);
+#if NVGA_PCI > 0
+	/* use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes */
+	vga_no_builtinfont = 1;
+#endif
 
 	/*
 	 * Clear the screen and print a message. The latter



CVS commit: src/sys/arch/atari/pci

2022-08-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Aug 15 04:37:47 UTC 2022

Modified Files:
src/sys/arch/atari/pci: pci_vga.c

Log Message:
Improve VGA console settings for Milan, especially for sysinst.

- use explicit WSDISPLAY_FONTENC_IBM font that MI vga(4) assumes
  (so that box drawing characters are rendered properly)
- set ATC and DAC palette settings for proper colors
  (copied from MI vga_subr.c for now because HADES doesn't use mi vga(4))

Tested on Milan with S3 Trio64.  (XXX: needs working HADES with ET4000)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/pci/pci_vga.c

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



CVS commit: src/sys

2022-08-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug  7 20:14:01 UTC 2022

Modified Files:
src/sys/compat/linux/arch/m68k: linux_machdep.c
src/sys/netinet6: ip6_mroute.h

Log Message:
Remove extra whitespaces added by an ancient stupid script.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/arch/m68k/linux_machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet6/ip6_mroute.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/compat/linux/arch/m68k/linux_machdep.c
diff -u src/sys/compat/linux/arch/m68k/linux_machdep.c:1.43 src/sys/compat/linux/arch/m68k/linux_machdep.c:1.44
--- src/sys/compat/linux/arch/m68k/linux_machdep.c:1.43	Tue Sep  7 11:43:04 2021
+++ src/sys/compat/linux/arch/m68k/linux_machdep.c	Sun Aug  7 20:14:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.43 2021/09/07 11:43:04 riastradh Exp $	*/
+/*	$NetBSD: linux_machdep.c,v 1.44 2022/08/07 20:14:01 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.43 2021/09/07 11:43:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.44 2022/08/07 20:14:01 tsutsui Exp $");
 
 #define COMPAT_LINUX 1
 
@@ -151,7 +151,7 @@ setup_linux_sigframe(struct frame *frame
 #endif
 		kf.sf_c.c_sc.sc_ss.ss_format = ft;
 		kf.sf_c.c_sc.sc_ss.ss_vector = frame->f_vector;
-		memcpy( _c.c_sc.sc_ss.ss_frame, >F_u,
+		memcpy(_c.c_sc.sc_ss.ss_frame, >F_u,
 			(size_t) exframesize[ft]);
 		/*
 		 * Leave an indicator that we need to clean up the kernel
@@ -307,7 +307,7 @@ setup_linux_rt_sigframe(struct frame *fr
 	kf.sf_uc.uc_mc.mc_version = LINUX_MCONTEXT_VERSION;
 
 	/* general registers and pc/sr */
-	memcpy( kf.sf_uc.uc_mc.mc_gregs.gr_regs, frame->f_regs, sizeof(u_int)*16);
+	memcpy(kf.sf_uc.uc_mc.mc_gregs.gr_regs, frame->f_regs, sizeof(u_int)*16);
 	kf.sf_uc.uc_mc.mc_gregs.gr_pc = frame->f_pc;
 	kf.sf_uc.uc_mc.mc_gregs.gr_sr = frame->f_sr;
 
@@ -318,7 +318,7 @@ setup_linux_rt_sigframe(struct frame *fr
 #endif
 		kf.sf_uc.uc_ss.ss_format = ft;
 		kf.sf_uc.uc_ss.ss_vector = frame->f_vector;
-		memcpy( _uc.uc_ss.ss_frame, >F_u,
+		memcpy(_uc.uc_ss.ss_frame, >F_u,
 			(size_t) exframesize[ft]);
 		/*
 		 * Leave an indicator that we need to clean up the kernel
@@ -596,7 +596,7 @@ bad:
 		if (frame->f_stackadj < sz)	/* just in case... */
 			goto bad;
 		frame->f_stackadj -= sz;
-		memcpy( >F_u, >sc_ss.ss_frame, sz);
+		memcpy(>F_u, >sc_ss.ss_frame, sz);
 #ifdef DEBUG
 		if (sigdebug & SDB_FOLLOW)
 			printf("linux_sys_sigreturn(%d): copy in %d of frame type %d\n",
@@ -726,7 +726,7 @@ bad:		
 	/*
 	 * Restore the user supplied information.
 	 */
-	memcpy( frame->f_regs, tuc.uc_mc.mc_gregs.gr_regs, sizeof(u_int)*16);
+	memcpy(frame->f_regs, tuc.uc_mc.mc_gregs.gr_regs, sizeof(u_int)*16);
 	frame->f_pc = tuc.uc_mc.mc_gregs.gr_pc;
 	/* Privileged bits of  sr  are silently ignored on Linux/m68k. */
 	frame->f_sr = tuc.uc_mc.mc_gregs.gr_sr & ~(PSL_MBZ|PSL_IPL|PSL_S);
@@ -742,7 +742,7 @@ bad:		
 		if (frame->f_stackadj < sz)	/* just in case... */
 			goto bad;
 		frame->f_stackadj -= sz;
-		memcpy( >F_u, _ss.ss_frame, sz);
+		memcpy(>F_u, _ss.ss_frame, sz);
 #ifdef DEBUG
 		if (sigdebug & SDB_FOLLOW)
 			printf("linux_sys_rt_sigreturn(%d): copy in %d of frame type %d\n",

Index: src/sys/netinet6/ip6_mroute.h
diff -u src/sys/netinet6/ip6_mroute.h:1.19 src/sys/netinet6/ip6_mroute.h:1.20
--- src/sys/netinet6/ip6_mroute.h:1.19	Sun May 20 06:29:43 2018
+++ src/sys/netinet6/ip6_mroute.h	Sun Aug  7 20:14:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_mroute.h,v 1.19 2018/05/20 06:29:43 maxv Exp $	*/
+/*	$NetBSD: ip6_mroute.h,v 1.20 2022/08/07 20:14:00 tsutsui Exp $	*/
 /*	$KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $	*/
 
 /*
@@ -93,7 +93,7 @@ typedef	struct if_set {
 #define	IF_SET(n, p)	((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
 #define	IF_CLR(n, p)	((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
 #define	IF_ISSET(n, p)	((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
-#define	IF_COPY(f, t)	memcpy( t, f, sizeof(*(f)))
+#define	IF_COPY(f, t)	memcpy(t, f, sizeof(*(f)))
 #define	IF_ZERO(p)	memset(p, 0, sizeof(*(p)))
 
 /*



CVS commit: src/sys

2022-08-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Aug  7 20:14:01 UTC 2022

Modified Files:
src/sys/compat/linux/arch/m68k: linux_machdep.c
src/sys/netinet6: ip6_mroute.h

Log Message:
Remove extra whitespaces added by an ancient stupid script.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/linux/arch/m68k/linux_machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet6/ip6_mroute.h

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

2022-07-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Jul 30 16:34:00 UTC 2022

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Crtc.h

Log Message:
Pull an upstream (post-21.1) fix for xf86CompatOutput().

https://gitlab.freedesktop.org/xorg/xserver/-/commit/75d70612888f18339703315549db781a22c0cb23
This is an additional fix against the previous revision that is
avaiable in 21.1 branch:
https://gitlab.freedesktop.org/xorg/xserver/-/commit/80eeff3ebac772e25c9107199989e677457dbe06
and may avoid a possible out of bounds access at least on dumb wsfb servers.

ok'ed by mrg@ on current-users@:
https://mail-index.netbsd.org/current-users/2022/07/24/msg042731.html


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

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/xf86Crtc.h
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Crtc.h:1.1.1.7 xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Crtc.h:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Crtc.h:1.1.1.7	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Crtc.h	Sat Jul 30 16:34:00 2022
@@ -837,11 +837,11 @@ extern _X_EXPORT int xf86CrtcConfigPriva
 static _X_INLINE xf86OutputPtr
 xf86CompatOutput(ScrnInfoPtr pScrn)
 {
-xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+xf86CrtcConfigPtr config;
 
 if (xf86CrtcConfigPrivateIndex == -1)
 return NULL;
-
+config = XF86_CRTC_CONFIG_PTR(pScrn);
 if (config->compat_output < 0)
 return NULL;
 return config->output[config->compat_output];



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

2022-07-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Jul 30 16:34:00 UTC 2022

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Crtc.h

Log Message:
Pull an upstream (post-21.1) fix for xf86CompatOutput().

https://gitlab.freedesktop.org/xorg/xserver/-/commit/75d70612888f18339703315549db781a22c0cb23
This is an additional fix against the previous revision that is
avaiable in 21.1 branch:
https://gitlab.freedesktop.org/xorg/xserver/-/commit/80eeff3ebac772e25c9107199989e677457dbe06
and may avoid a possible out of bounds access at least on dumb wsfb servers.

ok'ed by mrg@ on current-users@:
https://mail-index.netbsd.org/current-users/2022/07/24/msg042731.html


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

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

2022-07-30 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sat Jul 30 16:13:54 UTC 2022

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/common: xf86.h
xf86Globals.c xf86Helper.c xf86Init.c xf86Priv.h
xsrc/external/mit/xorg-server/dist/hw/xfree86/doc: ddxDesign.xml
xsrc/external/mit/xorg-server/dist/hw/xfree86/man: Xorg.man
xsrc/external/mit/xorg-server/dist/hw/xfree86/vgahw: vgaHW.c

Log Message:
Restore -flipPixels option removed in upstream server-21.1-branch.

https://gitlab.freedesktop.org/xorg/xserver/-/commit/d1c00c859c6676fbb540420c9055788bc19cb18f
Note ScrnInfoRec structure in hw/xfree86/common/xf86str.h isn't reverted
because it isn't used by -flipPixels option so that we can keep ABI
compatibility among xf86-video-foo drivers.

This -flipPixels is mandatory at least by Xorg server users with
xf86-video-wsfb driver on NetBSD/mac68k and SE/30 mono screen
that has "black=1 and white=0" VRAM.

"go for it" by mrg@ on current-users@:
https://mail-index.netbsd.org/current-users/2022/07/24/msg042731.html


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h
cvs rdiff -u -r1.1.1.7 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c
cvs rdiff -u -r1.1.1.10 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Init.c
cvs rdiff -u -r1.1.1.3 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/doc/ddxDesign.xml
cvs rdiff -u -r1.1.1.4 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/man/Xorg.man
cvs rdiff -u -r1.1.1.5 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/vgahw/vgaHW.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/common/xf86.h
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h:1.5 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h:1.6
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h:1.5	Fri Jul 15 02:18:59 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h	Sat Jul 30 16:13:53 2022
@@ -79,6 +79,14 @@ extern _X_EXPORT Bool xf86DRI2Enabled(vo
 
 #define XF86SCRNINFO(p) xf86ScreenToScrn(p)
 
+#define XF86FLIP_PIXELS() \
+	do { \
+	if (xf86GetFlipPixels()) { \
+		pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
+		pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
+	   } \
+	while (0)
+
 #define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
 
 /* Compatibility functions for pre-input-thread drivers */
@@ -278,6 +286,8 @@ xf86GetWeight(void);
 extern _X_EXPORT Gamma
 xf86GetGamma(void);
 extern _X_EXPORT Bool
+xf86GetFlipPixels(void);
+extern _X_EXPORT Bool
 xf86ServerIsExiting(void);
 extern _X_EXPORT Bool
 xf86ServerIsResetting(void);

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c:1.1.1.7 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c:1.1.1.7	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c	Sat Jul 30 16:13:53 2022
@@ -188,6 +188,7 @@ int xf86FbBpp = -1;
 int xf86Depth = -1;
 rgb xf86Weight = { 0, 0, 0 };
 
+Bool xf86FlipPixels = FALSE;
 Gamma xf86Gamma = { 0.0, 0.0, 0.0 };
 
 Bool xf86AllowMouseOpenFail = FALSE;
Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h:1.1.1.7 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h:1.1.1.7	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h	Sat Jul 30 16:13:53 2022
@@ -69,6 +69,7 @@ extern _X_EXPORT char *xf86KeyboardName;
 extern _X_EXPORT int xf86FbBpp;
 extern _X_EXPORT int xf86Depth;
 extern _X_EXPORT rgb xf86Weight;
+extern _X_EXPORT Bool xf86FlipPixels;
 extern _X_EXPORT Gamma xf86Gamma;
 
 /* Other parameters */

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c:1.6 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c:1.7
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c:1.6	Fri Jul 15 02:18:59 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c	Sat Jul 30 16:13:53 2022
@@ -952,8 +952,14 @@ xf86SetDpi(ScrnInfoPtr pScrn, int x, int
 void
 xf86SetBlackWhitePixels(ScreenPtr pScreen)
 {
-pScreen->whitePixel = 1;
-pScreen->blackPixel = 0;
+if (xf86FlipPixels) {
+

  1   2   3   4   5   6   7   8   >