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

2024-02-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  2 15:59:30 UTC 2024

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c nextdisplayvar.h

Log Message:
Add WSDISPLAY_GINFO, LINEBYTES, and SMODE ioctl(2)s and mmap(2) support.

mlterm-wscons partially works (no 2 bpp support) with these APIs.
XXX: Xorg server needs wsmouse support.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/dev/nextdisplayvar.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/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.30 src/sys/arch/next68k/dev/nextdisplay.c:1.31
--- src/sys/arch/next68k/dev/nextdisplay.c:1.30	Sat Feb 11 02:34:15 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Fri Feb  2 15:59:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.31 2024/02/02 15:59:30 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -170,6 +170,7 @@ nextdisplay_init(struct nextdisplay_conf
 	dc->dc_wid = 1120;
 	dc->dc_ht = 832;
 	dc->dc_depth = color ? 16 : 2;
+	dc->dc_cmsize = color ? 256 : 4;
 	dc->dc_rowbytes = (turbo ? 1120 : 1152) * dc->dc_depth / 8;
 
 	dc->dc_videobase = dc->dc_vaddr;
@@ -259,6 +260,8 @@ nextdisplay_attach(device_t parent, devi
 		INTR_ENABLE(NEXT_I_C16_VIDEO);
 	}
 
+	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
+
 	/* initialize the raster */
 	waa.console = isconsole;
 	waa.scrdata = iscolor ?
@@ -294,6 +297,7 @@ nextdisplay_ioctl(void *v, void *vs, u_l
 {
 	struct nextdisplay_softc *sc = v;
 	struct nextdisplay_config *dc = sc->sc_dc;
+	int new_mode;
 
 	switch (cmd) {
 	case WSDISPLAYIO_GTYPE:
@@ -309,6 +313,25 @@ nextdisplay_ioctl(void *v, void *vs, u_l
 		return EPASSTHROUGH;
 
 	case WSDISPLAYIO_GINFO:
+#define wsd_fbip ((struct wsdisplay_fbinfo *)data)
+		wsd_fbip->height = dc->dc_ht;
+		wsd_fbip->width = dc->dc_wid;
+		wsd_fbip->depth = dc->dc_depth;
+		wsd_fbip->cmsize = dc->dc_cmsize;
+#undef wsd_fbip
+return 0;
+
+	case WSDISPLAYIO_LINEBYTES:
+		*(u_int *)data = dc->dc_rowbytes;
+		return 0;
+
+	case WSDISPLAYIO_SMODE:
+		new_mode = *(int *)data;
+		if (new_mode != sc->sc_mode) {
+			sc->sc_mode = new_mode;
+		}
+		return 0;
+
 	case WSDISPLAYIO_GETCMAP:
 	case WSDISPLAYIO_PUTCMAP:
 	case WSDISPLAYIO_GVIDEO:
@@ -326,10 +349,18 @@ nextdisplay_ioctl(void *v, void *vs, u_l
 static paddr_t
 nextdisplay_mmap(void *v, void *vs, off_t offset, int prot)
 {
+	struct nextdisplay_softc *sc = v;
+	struct nextdisplay_config *dc = sc->sc_dc;
+	paddr_t cookie = -1;
+
+	switch (sc->sc_mode) {
+	case WSDISPLAYIO_MODE_DUMBFB:
+		if (offset >= 0 && offset < dc->dc_size)
+			cookie = m68k_btop(dc->dc_paddr + offset);
+		break;
+	}
 
-	/* XXX */
-	printf("nextdisplay_mmap: failed\n");
-	return -1;
+	return cookie;
 }
 
 int

Index: src/sys/arch/next68k/dev/nextdisplayvar.h
diff -u src/sys/arch/next68k/dev/nextdisplayvar.h:1.6 src/sys/arch/next68k/dev/nextdisplayvar.h:1.7
--- src/sys/arch/next68k/dev/nextdisplayvar.h:1.6	Fri Feb  3 23:13:00 2023
+++ src/sys/arch/next68k/dev/nextdisplayvar.h	Fri Feb  2 15:59:30 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplayvar.h,v 1.6 2023/02/03 23:13:00 tsutsui Exp $ */
+/* $NetBSD: nextdisplayvar.h,v 1.7 2024/02/02 15:59:30 tsutsui Exp $ */
 /*
  * Copyright (c) 1998 Matt DeBergalis
  * All rights reserved.
@@ -54,6 +54,7 @@ struct nextdisplay_config {
 	int dc_ht;			/* height of frame buffer */
 	int dc_depth;			/* depth of frame buffer */
 	int dc_rowbytes;		/* bytes in fb scan line */
+	int dc_cmsize;
 
 	struct raster dc_raster;	/* raster description */
 	struct rcons dc_rcons;		/* raster blitter control info */
@@ -67,6 +68,7 @@ struct nextdisplay_softc {
 	device_t sc_dev;
 
 	struct nextdisplay_config *sc_dc;
+	int sc_mode;
 
 	int nscreens;
 };



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

2024-02-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  2 15:59:30 UTC 2024

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c nextdisplayvar.h

Log Message:
Add WSDISPLAY_GINFO, LINEBYTES, and SMODE ioctl(2)s and mmap(2) support.

mlterm-wscons partially works (no 2 bpp support) with these APIs.
XXX: Xorg server needs wsmouse support.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/dev/nextdisplayvar.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/next68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 13:46:14 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h intr.h types.h vectors.h

Log Message:
Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT.
Also included is G/C of the old ssir stuff that's no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/next68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/include/types.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/next68k/include/vectors.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/next68k/conf/files.next68k
diff -u src/sys/arch/next68k/conf/files.next68k:1.44 src/sys/arch/next68k/conf/files.next68k:1.45
--- src/sys/arch/next68k/conf/files.next68k:1.44	Sat Jan 13 21:40:53 2024
+++ src/sys/arch/next68k/conf/files.next68k	Thu Jan 18 13:46:14 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.next68k,v 1.44 2024/01/13 21:40:53 thorpej Exp $
+# $NetBSD: files.next68k,v 1.45 2024/01/18 13:46:14 thorpej Exp $
 
 # next68k-specific configuration info
 
@@ -35,6 +35,8 @@ file	arch/next68k/dev/zs_kgdb.c	kgdb
 file	arch/m68k/m68k/cacheops.c
 file	arch/m68k/m68k/db_memrw.c		ddb | kgdb
 file	arch/m68k/m68k/kgdb_machdep.c		kgdb
+file	arch/m68k/m68k/m68k_intr.c
+file	arch/m68k/m68k/m68k_intr_stubs.s
 file	arch/m68k/m68k/m68k_trap.c
 file	arch/m68k/m68k/mmu_subr.s
 file	arch/m68k/m68k/pmap_motorola.c
@@ -50,7 +52,6 @@ file	arch/next68k/next68k/pmap_bootstrap
 file	arch/next68k/next68k/machdep.c
 file	arch/next68k/next68k/clock.c
 file	arch/next68k/next68k/conf.c
-file	arch/next68k/next68k/isr.c
 file	arch/next68k/next68k/autoconf.c
 file	arch/next68k/next68k/mainbus.c
 file	arch/next68k/next68k/nextrom.c

Index: src/sys/arch/next68k/include/cpu.h
diff -u src/sys/arch/next68k/include/cpu.h:1.54 src/sys/arch/next68k/include/cpu.h:1.55
--- src/sys/arch/next68k/include/cpu.h:1.54	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/include/cpu.h	Thu Jan 18 13:46:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.54 2024/01/13 21:40:54 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.55 2024/01/18 13:46:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -65,17 +65,17 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the next68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
  */
 struct clockframe {
-	u_short	sr;		/* sr at time of interrupt */
-	u_long	pc;		/* pc at time of interrupt */
-	u_short	fmt:4,
-		vec:12;		/* vector offset (4-word frame) */
+	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+	u_short	cf_sr;		/* sr at time of interrupt */
+	u_long	cf_pc;		/* pc at time of interrupt */
+	u_short	cf_vo;		/* vector offset (4-word frame) */
 } __attribute__((packed));
 
-#define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
-#define	CLKF_PC(framep)		((framep)->pc)
+#define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
+#define	CLKF_PC(framep)		((framep)->cf_pc)
 
 /*
  * The clock interrupt handler can determine if it's a nested
@@ -83,8 +83,7 @@ struct clockframe {
  * (Remember, the clock interrupt handler itself will cause the
  * depth counter to be incremented).
  */
-extern volatile unsigned int interrupt_depth;
-#define	CLKF_INTR(framep)	(interrupt_depth > 1)
+#define	CLKF_INTR(framep)	(idepth > 1)
 
 /*
  * Preempt the current process if in interrupt from user mode,

Index: src/sys/arch/next68k/include/intr.h
diff -u src/sys/arch/next68k/include/intr.h:1.23 src/sys/arch/next68k/include/intr.h:1.24
--- src/sys/arch/next68k/include/intr.h:1.23	Tue Jul 11 11:13:32 2023
+++ src/sys/arch/next68k/include/intr.h	Thu Jan 18 13:46:14 2024
@@ -1,10 +1,12 @@
-/*	$NetBSD: intr.h,v 1.23 2023/07/11 11:13:32 riastradh Exp $	*/
+/*	$NetBSD: intr.h,v 1.24 2024/01/18 13:46:14 thorpej Exp $	*/
 
-/*
- * Copyright (C) 1997 Scott Reynolds
- * Copyright (C) 1998 Darrin Jewell
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -13,93 +15,45 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior 

CVS commit: src/sys/arch/next68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 18 13:46:14 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h intr.h types.h vectors.h

Log Message:
Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT.
Also included is G/C of the old ssir stuff that's no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/next68k/include/intr.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/include/types.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/next68k/include/vectors.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/next68k/next68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 00:34:58 UTC 2024

Modified Files:
src/sys/arch/next68k/next68k: genassym.cf isr.h locore.s trap.c
Removed Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT.
Also included is G/C of the old ssir stuff that's no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/genassym.cf
cvs rdiff -u -r1.35 -r0 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/next68k/next68k/trap.c

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

Modified files:

Index: src/sys/arch/next68k/next68k/genassym.cf
diff -u src/sys/arch/next68k/next68k/genassym.cf:1.33 src/sys/arch/next68k/next68k/genassym.cf:1.34
--- src/sys/arch/next68k/next68k/genassym.cf:1.33	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/next68k/next68k/genassym.cf	Tue Jan 16 00:34:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.33 2024/01/09 04:16:26 thorpej Exp $
+#	$NetBSD: genassym.cf,v 1.34 2024/01/16 00:34:58 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -127,6 +127,7 @@ define	P_VMSPACE		offsetof(struct proc, 
 
 # interrupt/fault metering
 define	CI_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
+define	NMI_INTRCNT		((sizeof(struct evcnt)*7) + offsetof(struct evcnt, ev_count32))
 
 # PSL values (should just include psl.h?)
 define	PSL_S			PSL_S

Index: src/sys/arch/next68k/next68k/isr.h
diff -u src/sys/arch/next68k/next68k/isr.h:1.10 src/sys/arch/next68k/next68k/isr.h:1.11
--- src/sys/arch/next68k/next68k/isr.h:1.10	Mon Jan 15 20:28:56 2024
+++ src/sys/arch/next68k/next68k/isr.h	Tue Jan 16 00:34:58 2024
@@ -1,14 +1,7 @@
-/*	$NetBSD: isr.h,v 1.10 2024/01/15 20:28:56 thorpej Exp $ */
-
-/*
- * This file was taken from mvme68k/mvme68k/isr.h
- * should probably be re-synced when needed.
- * Darrin B. Jewell   Tue Nov 10 05:07:16 1998
- * original cvs id: NetBSD: isr.h,v 1.3 1997/10/09 08:40:06 jtc Exp
- */
+/*	$NetBSD: isr.h,v 1.11 2024/01/16 00:34:58 thorpej Exp $	*/
 
 /*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -36,59 +29,27 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-/*
- * The location and size of the autovectored interrupt portion
- * of the vector table.
- */
-#define ISRAUTOVEC	0x18
-#define NISRAUTOVEC	8
-#define NIPLS		8
+#ifndef _NEXT68K_ISR_H_
+#define	_NEXT68K_ISR_H_
 
-/*
- * The location and size of the vectored interrupt portion
- * of the vector table.
- */
-#define ISRVECTORED	0x40
+#include 
 
 /*
- * Autovectored interrupt handler cookie.
+ * Aliases for the legacy next68k ISR routines.
  */
-struct isr_autovec {
-	LIST_ENTRY(isr_autovec) isr_link;
-	int		(*isr_func)(void *);
-	void		*isr_arg;
-	int		isr_ipl;
-	int		isr_priority;
-	struct evcnt	*isr_evcnt;
-};
 
-typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t;
+static inline void
+isrinit(void)
+{
+	m68k_intr_init(NULL);
+}
 
-/*
- * Vectored interrupt handler cookie.  The handler may request to
- * receive the exception frame as an argument by specifying NULL
- * when establishing the interrupt.
- */
-struct isr_vectored {
-	int		(*isr_func)(void *);
-	void		*isr_arg;
-	int		isr_ipl;
-	struct evcnt	*isr_evcnt;
-};
+static inline void
+isrlink_autovec(int (*func)(void *), void *arg, int ipl, int isrpri,
+struct evcnt *ev)
+{
+	/* XXX leaks interrupt handle. */
+	m68k_intr_establish(func, arg, ev, 0, ipl, isrpri, 0);
+}
 
-/*
- * Autovectored ISR priorities.  These are not the same as interrupt levels.
- */
-#define ISRPRI_BIO		0
-#define ISRPRI_NET		1
-#define ISRPRI_TTY		2
-#define ISRPRI_TTYNOBUF		3
-
-extern struct evcnt next68k_irq_evcnt[];
-
-void	isrinit(void);
-void	isrlink_autovec(int (*)(void *), void *, int, int, struct evcnt *);
-void	isrdispatch_autovec(struct clockframe *);
-void	netintr(void);
+#endif /* _NEXT68K_ISR_H_ */

Index: src/sys/arch/next68k/next68k/locore.s
diff -u src/sys/arch/next68k/next68k/locore.s:1.81 src/sys/arch/next68k/next68k/locore.s:1.82
--- src/sys/arch/next68k/next68k/locore.s:1.81	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/next68k/locore.s	Tue Jan 16 00:34:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.81 2024/01/13 21:40:54 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.82 2024/01/16 00:34:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -500,13 +500,7 @@ ENTRY_NOPROFILE(trap0)
 	jbsr	_C_LABEL(syscall)	| handle it
 	addql	#4,%sp			| pop syscall arg
 	tstl	_C_LABEL(astpending)
-	jne	Lrei2
-	tstb	_C_LABEL(ssir)
-	jeq	Ltrap1
-	movw	#SPL1,%sr
-	tstb	_C_LABEL(ssir)
-	jne	Lsir1
-Ltrap1:
+	jne	Lrei
 	

CVS commit: src/sys/arch/next68k/next68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan 16 00:34:58 UTC 2024

Modified Files:
src/sys/arch/next68k/next68k: genassym.cf isr.h locore.s trap.c
Removed Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Switch next68k over to common interrupt dispatch and G/C __HAVE_LEGACY_INTRCNT.
Also included is G/C of the old ssir stuff that's no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/genassym.cf
cvs rdiff -u -r1.35 -r0 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/next68k/next68k/trap.c

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



CVS commit: src/sys/arch/next68k/next68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 20:28:56 UTC 2024

Modified Files:
src/sys/arch/next68k/next68k: isr.c isr.h

Log Message:
G/C unused isrlink_evcnt().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/next68k/isr.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/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.34 src/sys/arch/next68k/next68k/isr.c:1.35
--- src/sys/arch/next68k/next68k/isr.c:1.34	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/next68k/isr.c	Mon Jan 15 20:28:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $ */
+/*	$NetBSD: isr.c,v 1.35 2024/01/15 20:28:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.35 2024/01/15 20:28:56 thorpej Exp $");
 
 #include 
 #include 
@@ -159,23 +159,6 @@ isrlink_autovec(int (*func)(void *), voi
 }
 
 /*
- * Return a pointer to the evcnt structure for
- * the specified ipl.
- */
-struct evcnt *
-isrlink_evcnt(int ipl)
-{
-
-#ifdef DIAGNOSTIC
-	if (ipl < 0 ||
-	ipl >= (sizeof(next68k_irq_evcnt) / sizeof(struct evcnt)))
-		panic("isrlink_evcnt: bad ipl %d", ipl);
-#endif
-
-	return (_irq_evcnt[ipl]);
-}
-
-/*
  * This is the dispatcher called by the low-level
  * assembly language autovectored interrupt routine.
  */

Index: src/sys/arch/next68k/next68k/isr.h
diff -u src/sys/arch/next68k/next68k/isr.h:1.9 src/sys/arch/next68k/next68k/isr.h:1.10
--- src/sys/arch/next68k/next68k/isr.h:1.9	Sat Jan 13 21:40:54 2024
+++ src/sys/arch/next68k/next68k/isr.h	Mon Jan 15 20:28:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.h,v 1.9 2024/01/13 21:40:54 thorpej Exp $ */
+/*	$NetBSD: isr.h,v 1.10 2024/01/15 20:28:56 thorpej Exp $ */
 
 /*
  * This file was taken from mvme68k/mvme68k/isr.h
@@ -89,7 +89,6 @@ struct isr_vectored {
 extern struct evcnt next68k_irq_evcnt[];
 
 void	isrinit(void);
-struct	evcnt *isrlink_evcnt(int);
 void	isrlink_autovec(int (*)(void *), void *, int, int, struct evcnt *);
 void	isrdispatch_autovec(struct clockframe *);
 void	netintr(void);



CVS commit: src/sys/arch/next68k/next68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 20:28:56 UTC 2024

Modified Files:
src/sys/arch/next68k/next68k: isr.c isr.h

Log Message:
G/C unused isrlink_evcnt().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/next68k/isr.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/next68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 21:40:54 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/next68k/include: vectors.h
Removed Files:
src/sys/arch/next68k/next68k: vectors.s

Log Message:
Switch next68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/include/vectors.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.13 -r0 src/sys/arch/next68k/next68k/vectors.s

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/next68k/conf/files.next68k
diff -u src/sys/arch/next68k/conf/files.next68k:1.43 src/sys/arch/next68k/conf/files.next68k:1.44
--- src/sys/arch/next68k/conf/files.next68k:1.43	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/next68k/conf/files.next68k	Sat Jan 13 21:40:53 2024
@@ -1,4 +1,4 @@
-# $NetBSD: files.next68k,v 1.43 2024/01/09 04:16:26 thorpej Exp $
+# $NetBSD: files.next68k,v 1.44 2024/01/13 21:40:53 thorpej Exp $
 
 # next68k-specific configuration info
 
@@ -40,6 +40,7 @@ file	arch/m68k/m68k/mmu_subr.s
 file	arch/m68k/m68k/pmap_motorola.c
 file	arch/m68k/m68k/procfs_machdep.c		procfs
 file	arch/m68k/m68k/sys_machdep.c
+file	arch/m68k/m68k/vectors.c
 file	arch/m68k/m68k/vm_machdep.c
 
 # include "arch/m68k/fpe/files.fpe"

Index: src/sys/arch/next68k/include/cpu.h
diff -u src/sys/arch/next68k/include/cpu.h:1.53 src/sys/arch/next68k/include/cpu.h:1.54
--- src/sys/arch/next68k/include/cpu.h:1.53	Tue Jan  9 04:16:26 2024
+++ src/sys/arch/next68k/include/cpu.h	Sat Jan 13 21:40:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.53 2024/01/09 04:16:26 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.54 2024/01/13 21:40:54 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -112,8 +112,6 @@ extern volatile unsigned int interrupt_d
 
 extern	int	astpending;	/* need to trap before returning to user mode */
 
-extern	void (*vectab[])(void);
-
 /* locore.s functions */
 void	doboot(void) __attribute__((__noreturn__));
 int	nmihand(void *);

Index: src/sys/arch/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.33 src/sys/arch/next68k/next68k/isr.c:1.34
--- src/sys/arch/next68k/next68k/isr.c:1.33	Fri Feb  3 23:19:03 2023
+++ src/sys/arch/next68k/next68k/isr.c	Sat Jan 13 21:40:54 2024
@@ -1,11 +1,4 @@
-/*	$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $ */
-
-/*
- * This file was taken from mvme68k/mvme68k/isr.c
- * should probably be re-synced when needed.
- * Darrin B. Jewell   Tue Nov 10 05:07:16 1998
- * original cvs id: NetBSD: isr.c,v 1.12 1998/07/05 06:49:07 jonathan Exp
- */
+/*	$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.34 2024/01/13 21:40:54 thorpej Exp $");
 
 #include 
 #include 
@@ -59,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33
 
 volatile unsigned int interrupt_depth;
 isr_autovec_list_t isr_autovec[NISRAUTOVEC];
-struct	isr_vectored isr_vectored[NISRVECTORED];
 static const char irqgroupname[] = "hard irqs";
 struct	evcnt next68k_irq_evcnt[] = {
 	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, irqgroupname, "spur"),
@@ -77,7 +69,6 @@ int ssir;
 extern	u_int intrcnt[];	/* from locore.s. XXXSCW: will go away soon */
 extern	void (*vectab[])(void);
 extern	void badtrap(void);
-extern	void intrhand_vectored(void);
 
 #if 0
 static	int spurintr(void *);
@@ -95,10 +86,6 @@ isrinit(void)
 	/* Initialise the interrupt event counts */
 	for (i = 0; i < (sizeof(next68k_irq_evcnt) / sizeof(struct evcnt)); i++)
 		evcnt_attach_static(_irq_evcnt[i]);
-
-	/* Arrange to trap Spurious and NMI auto-vectored Interrupts */
-/* 	isrlink_autovec(spurintr, NULL, 0, 0, NULL); */
-/* 	isrlink_autovec(nmihand, NULL, 7, 0, NULL); */
 }
 
 /*
@@ -172,40 +159,6 @@ isrlink_autovec(int (*func)(void *), voi
 }
 
 /*
- * Establish a vectored interrupt handler.
- * Called by bus interrupt establish functions.
- */
-void
-isrlink_vectored(int (*func)(void *), void *arg, int ipl, int vec,
-struct evcnt *evcnt)
-{
-	struct isr_vectored *isr;
-
-#ifdef DIAGNOSTIC
-	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
-		panic("isrlink_vectored: bad ipl %d", ipl);
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrlink_vectored: bad vec 0x%x", vec);
-#endif
-
-	isr = _vectored[vec - ISRVECTORED];
-
-#ifdef 

CVS commit: src/sys/arch/next68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 21:40:54 UTC 2024

Modified Files:
src/sys/arch/next68k/conf: files.next68k
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: isr.c isr.h locore.s
Added Files:
src/sys/arch/next68k/include: vectors.h
Removed Files:
src/sys/arch/next68k/next68k: vectors.s

Log Message:
Switch next68k over to the common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/next68k/conf/files.next68k
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/include/vectors.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/isr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/next68k/isr.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.13 -r0 src/sys/arch/next68k/next68k/vectors.s

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



CVS commit: src/sys/arch/next68k

2023-12-27 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 27 19:47:00 UTC 2023

Modified Files:
src/sys/arch/next68k/include: pmap.h
src/sys/arch/next68k/next68k: genassym.cf locore.s

Log Message:
Define the values for the 68040 TT registers in terms of the definitions in
 rather than using magic numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/include/pmap.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/genassym.cf
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/next68k/next68k/locore.s

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/next68k/include/pmap.h
diff -u src/sys/arch/next68k/include/pmap.h:1.15 src/sys/arch/next68k/include/pmap.h:1.16
--- src/sys/arch/next68k/include/pmap.h:1.15	Sun Nov  3 19:56:33 2002
+++ src/sys/arch/next68k/include/pmap.h	Wed Dec 27 19:47:00 2023
@@ -1,3 +1,25 @@
-/*	$NetBSD: pmap.h,v 1.15 2002/11/03 19:56:33 chs Exp $	*/
+/*	$NetBSD: pmap.h,v 1.16 2023/12/27 19:47:00 thorpej Exp $	*/
+
+#ifndef _NEXT68K_PMAP_H_
+#define	_NEXT68K_PMAP_H_
 
 #include 
+#include 
+
+/*
+ * Transparent translation register values for IO space and the
+ * kernel text/data.  These are only used temporarily during
+ * early boot.
+ *
+ * XXX BOTH?  Really?  But that matches the historical value.  But
+ * just SUPER should be sufficient.
+ */
+#define	NEXT68K_TT40_IO		(0x0200 |\
+ TTR40_E | TTR40_BOTH |			\
+ PTE40_CM_NC_SER)
+
+#define	NEXT68K_TT40_KERN	(0x0400 |\
+ __SHIFTIN(0x03,TTR40_LAM) |		\
+TTR40_E | TTR40_BOTH)
+
+#endif /* _NEXT68K_PMAP_H_ */

Index: src/sys/arch/next68k/next68k/genassym.cf
diff -u src/sys/arch/next68k/next68k/genassym.cf:1.31 src/sys/arch/next68k/next68k/genassym.cf:1.32
--- src/sys/arch/next68k/next68k/genassym.cf:1.31	Wed Dec 27 17:35:36 2023
+++ src/sys/arch/next68k/next68k/genassym.cf	Wed Dec 27 19:47:00 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.31 2023/12/27 17:35:36 thorpej Exp $
+#	$NetBSD: genassym.cf,v 1.32 2023/12/27 19:47:00 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -117,6 +117,10 @@ export	MMU51_CRP_BITS
 export	MMU51_TCR_BITS
 export	MMU40_TCR_BITS
 
+# Transparent translation register values (from pmap.h)
+export	NEXT68K_TT40_IO
+export	NEXT68K_TT40_KERN
+
 # lwp & proc fields and values
 define	L_PCB			offsetof(struct lwp, l_addr)
 define	L_PROC			offsetof(struct lwp, l_proc)

Index: src/sys/arch/next68k/next68k/locore.s
diff -u src/sys/arch/next68k/next68k/locore.s:1.76 src/sys/arch/next68k/next68k/locore.s:1.77
--- src/sys/arch/next68k/next68k/locore.s:1.76	Wed Dec 27 03:03:42 2023
+++ src/sys/arch/next68k/next68k/locore.s	Wed Dec 27 19:47:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.76 2023/12/27 03:03:42 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.77 2023/12/27 19:47:00 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -361,17 +361,17 @@ Lstploaddone:
 	| This is a hack to get PA=KVA when turning on MMU as mentioned above.
 	| Currently this will only work on 68040's.  We should also provide
 	| %tt0 and %tt1 settings to boot 68030's later.
-	movel	#0x0200c040,%d0		| intio devices are at 0x0200
+	movel	#NEXT68K_TT40_IO,%d0	| see pmap.h
 	.long	0x4e7b0004		| movc %d0,%itt0
 	.long	0x4e7b0006		| movc %d0,%dtt0
-	movel	#0x0403c000,%d0		| kernel text and data at 0x0400
+	movel	#NEXT68K_TT40_KERN,%d0	| see pmap.h
 	.long	0x4e7b0005		| movc %d0,%itt1
 	.long	0x4e7b0007		| movc %d0,%dtt1
 
 	.word	0xf4d8			| cinva bc
 	.word	0xf518			| pflusha
-	movl	#0x8000,%d0
-	.long	0x4e7b0003		| movc %d0,tc
+	movl	#MMU40_TCR_BITS,%d0
+	.long	0x4e7b0003		| movc %d0,%tc
 	movl	#0x80008000,%d0
 	movc	%d0,%cacr		| turn on both caches
 



CVS commit: src/sys/arch/next68k

2023-12-27 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 27 19:47:00 UTC 2023

Modified Files:
src/sys/arch/next68k/include: pmap.h
src/sys/arch/next68k/next68k: genassym.cf locore.s

Log Message:
Define the values for the 68040 TT registers in terms of the definitions in
 rather than using magic numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/include/pmap.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/genassym.cf
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/next68k/next68k/locore.s

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



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

2023-10-20 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Oct 20 11:38:25 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: zs_kgdb.c

Log Message:
make zs_kgdb.c build for next68k.

kgdb_dev expects llx/d format specifier.
change serial number print message to the same as sgimips.
remove rr0 definition in zs_kgdb_txint, it is unused.

Fixes also KGDB enabled build for next68k.
Similar or partial changes likely required for few other ports.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/zs_kgdb.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/next68k/dev

2023-10-20 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Oct 20 11:38:25 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: zs_kgdb.c

Log Message:
make zs_kgdb.c build for next68k.

kgdb_dev expects llx/d format specifier.
change serial number print message to the same as sgimips.
remove rr0 definition in zs_kgdb_txint, it is unused.

Fixes also KGDB enabled build for next68k.
Similar or partial changes likely required for few other ports.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/zs_kgdb.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/next68k/dev/zs_kgdb.c
diff -u src/sys/arch/next68k/dev/zs_kgdb.c:1.12 src/sys/arch/next68k/dev/zs_kgdb.c:1.13
--- src/sys/arch/next68k/dev/zs_kgdb.c:1.12	Mon Apr 28 20:23:30 2008
+++ src/sys/arch/next68k/dev/zs_kgdb.c	Fri Oct 20 11:38:25 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs_kgdb.c,v 1.12 2008/04/28 20:23:30 martin Exp $	*/
+/*	$NetBSD: zs_kgdb.c,v 1.13 2023/10/20 11:38:25 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.12 2008/04/28 20:23:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs_kgdb.c,v 1.13 2023/10/20 11:38:25 andvar Exp $");
 
 #include "opt_kgdb.h"
 
@@ -134,14 +134,14 @@ zs_kgdb_init(void)
 	int channel;
 	extern const struct cdevsw zstty_cdevsw;
 
-	printf("zs_kgdb_init: kgdb_dev=0x%x\n", kgdb_dev);
+	printf("zs_kgdb_init: kgdb_dev=0x%llx\n", kgdb_dev);
 	if (cdevsw_lookup(kgdb_dev) != _cdevsw)
 		return;
 
 	/* Note: (ttya,ttyb) on zs0, and (ttyc,ttyd) on zs2 */
 	channel  =  kgdb_dev & 1;
-	printf("zs_kgdb_init: attaching tty%c at %d baud\n",
-		   'a' + (kgdb_dev & 3), kgdb_rate);
+	printf("zs_kgdb_init: attaching to Serial(%lld) at %d baud\n",
+		   (kgdb_dev & 3), kgdb_rate);
 
 	/* Setup temporary chanstate. */
 	memset(, 0, sizeof(cs));
@@ -244,9 +244,6 @@ zs_kgdb_rxint(struct zs_chanstate *cs)
 static void
 zs_kgdb_txint(struct zs_chanstate *cs)
 {
-	int rr0;
-
-	rr0 = zs_read_csr(cs);
 	zs_write_csr(cs, ZSWR0_RESET_TXINT);
 }
 



CVS commit: src/sys/arch/next68k/next68k

2023-10-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct 19 22:07:13 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: rtc.c

Log Message:
Fix printf specifier for tvp->tv_sec from 0x%08x to 0x%08llx.
Remove printf secs argument for "Regs after:" printout, none expected.
Remove "Setting RTC to 0x%08x." and non existing secs arg from settime_old().
Code was changed with rev. 1.14 without fully adjusting DEBUG code.

Fixes RTC_DEBUG build for next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/next68k/rtc.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/next68k/next68k/rtc.c
diff -u src/sys/arch/next68k/next68k/rtc.c:1.19 src/sys/arch/next68k/next68k/rtc.c:1.20
--- src/sys/arch/next68k/next68k/rtc.c:1.19	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/rtc.c	Thu Oct 19 22:07:13 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: rtc.c,v 1.19 2023/02/03 23:13:01 tsutsui Exp $*/
+/*  $NetBSD: rtc.c,v 1.20 2023/10/19 22:07:13 andvar Exp $*/
 /*
  * Copyright (c) 1998 Darrin Jewell
  * Copyright (c) 1997 Rolf Grossmann
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2023/02/03 23:13:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.20 2023/10/19 22:07:13 andvar Exp $");
 
 #include 
 #include   /* for panic */
@@ -321,7 +321,7 @@ settime_old(todr_chip_handle_t tcr, stru
 	rtc_write(RTC_CONTROL, rtc_read(RTC_CONTROL) & ~RTC_START);
 
 #ifdef RTC_DEBUG
-	printf("Setting RTC to 0x%08x.  Regs before:\n", secs);
+	printf("Regs before:\n");
 	rtc_print();
 #endif
 
@@ -352,7 +352,7 @@ settime_old(todr_chip_handle_t tcr, stru
 	rtc_write(RTC_YR, bintobcd(dt->dt_year % 100));
 
 #ifdef RTC_DEBUG
-	printf("Regs after:\n", secs);
+	printf("Regs after:\n");
 	rtc_print();
 #endif
 
@@ -380,7 +380,7 @@ settime_new(todr_chip_handle_t tch, stru
 	rtc_write(RTC_CONTROL, rtc_read(RTC_CONTROL) & ~RTC_START);
 
 #ifdef RTC_DEBUG
-	printf("Setting RTC to 0x%08x.  Regs before:\n", tvp->tv_sec);
+	printf("Setting RTC to 0x%08llx.  Regs before:\n", tvp->tv_sec);
 	rtc_print();
 #endif
 
@@ -390,7 +390,7 @@ settime_new(todr_chip_handle_t tch, stru
 	rtc_write(RTC_CNTR3, (tvp->tv_sec) & 0xff);
 
 #ifdef RTC_DEBUG
-	printf("Regs after:\n", secs);
+	printf("Regs after:\n");
 	rtc_print();
 #endif
 



CVS commit: src/sys/arch/next68k/next68k

2023-10-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Oct 19 22:07:13 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: rtc.c

Log Message:
Fix printf specifier for tvp->tv_sec from 0x%08x to 0x%08llx.
Remove printf secs argument for "Regs after:" printout, none expected.
Remove "Setting RTC to 0x%08x." and non existing secs arg from settime_old().
Code was changed with rev. 1.14 without fully adjusting DEBUG code.

Fixes RTC_DEBUG build for next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/next68k/rtc.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/next68k/include

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 11:13:32 UTC 2023

Modified Files:
src/sys/arch/next68k/include: intr.h

Log Message:
next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/include/intr.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/next68k/include/intr.h
diff -u src/sys/arch/next68k/include/intr.h:1.22 src/sys/arch/next68k/include/intr.h:1.23
--- src/sys/arch/next68k/include/intr.h:1.22	Thu Apr 19 21:50:07 2018
+++ src/sys/arch/next68k/include/intr.h	Tue Jul 11 11:13:32 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.22 2018/04/19 21:50:07 christos Exp $	*/
+/*	$NetBSD: intr.h,v 1.23 2023/07/11 11:13:32 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1997 Scott Reynolds
@@ -35,6 +35,12 @@
 
 /* Probably want to dealwith IPL's here @@@ */
 
+#if defined(_KERNEL) || defined(_KMEMUSER)
+typedef struct {
+	uint16_t _psl;
+} ipl_cookie_t;
+#endif
+
 #ifdef _KERNEL
 
 /* spl0 requires checking for software interrupts */
@@ -67,9 +73,6 @@
 extern const uint16_t ipl2psl_table[NIPL];
 
 typedef int ipl_t;
-typedef struct {
-	uint16_t _psl;
-} ipl_cookie_t;
 
 static __inline ipl_cookie_t
 makeiplcookie(ipl_t ipl)



CVS commit: src/sys/arch/next68k/include

2023-07-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul 11 11:13:32 UTC 2023

Modified Files:
src/sys/arch/next68k/include: intr.h

Log Message:
next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/include/intr.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/next68k/dev

2023-06-10 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Jun 10 17:14:57 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795reg.h

Log Message:
gratuitous commit to fix spelling error


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/mb8795reg.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/next68k/dev/mb8795reg.h
diff -u src/sys/arch/next68k/dev/mb8795reg.h:1.4 src/sys/arch/next68k/dev/mb8795reg.h:1.5
--- src/sys/arch/next68k/dev/mb8795reg.h:1.4	Sat Apr 24 19:58:13 2010
+++ src/sys/arch/next68k/dev/mb8795reg.h	Sat Jun 10 17:14:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795reg.h,v 1.4 2010/04/24 19:58:13 dbj Exp $	*/
+/*	$NetBSD: mb8795reg.h,v 1.5 2023/06/10 17:14:57 dbj Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -75,7 +75,7 @@ struct mb8795_regs {
 #define MB8795_TXMASK_BITS \
 "\20\10READYIE\06TXRXIE\04UNDERFLOWIE\03COLLIE\02COLL16IE\01PARERRIE"
 
-/* cummulative receiver status (address 2) */
+/* cumulative receiver status (address 2) */
 #define MB8795_RXSTAT   2
 
 #define MB8795_RXSTAT_OK		0x80	/* packet received is correct */



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

2023-06-10 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Jun 10 17:14:57 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795reg.h

Log Message:
gratuitous commit to fix spelling error


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/mb8795reg.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/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 10:18:23 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Actually bump version (missed in the previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/stand/boot/version

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/next68k/stand/boot/version
diff -u src/sys/arch/next68k/stand/boot/version:1.6 src/sys/arch/next68k/stand/boot/version:1.7
--- src/sys/arch/next68k/stand/boot/version:1.6	Sat Feb 11 18:09:55 2023
+++ src/sys/arch/next68k/stand/boot/version	Sun Feb 12 10:18:23 2023
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.6 2023/02/11 18:09:55 tsutsui Exp $
+$NetBSD: version,v 1.7 2023/02/12 10:18:23 tsutsui Exp $
 
 1.1:	initial import
 1.3:	Add ELF support
@@ -6,3 +6,4 @@ $NetBSD: version,v 1.6 2023/02/11 18:09:
 1.5:	loadfile() update to avoid backwards seeks for ELF Program Headers.
 1.6:	Fix a bug on DMA reg accesses and a problem on detecting old drives
 1.7:	Add support of NeXT_CUBE_TURBO
+1.8:	Fix DELAY() to actually wait specified microsconds



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 10:18:23 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Actually bump version (missed in the previous commit).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/stand/boot/version

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



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 10:04:56 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: boot.c samachdep.h scsi.c

Log Message:
Replace DELAY() with one in hp300 bootloader and adjust cpuspeed counts.

Fix boot failure on my ancient Seagate ST52160N drive.
It looks some of such old drives can't respond to SCSI
test-unit-ready command without proper wait after SCSI bus reset.
Bump version again to denote a fix.

XXX we should re-evaluate cpuspeed counts for DELAY() in bootloaders
(where cache is disabled) on other m68k ports, hp300 and luna68k etc.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/scsi.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/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 10:04:56 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: boot.c samachdep.h scsi.c

Log Message:
Replace DELAY() with one in hp300 bootloader and adjust cpuspeed counts.

Fix boot failure on my ancient Seagate ST52160N drive.
It looks some of such old drives can't respond to SCSI
test-unit-ready command without proper wait after SCSI bus reset.
Bump version again to denote a fix.

XXX we should re-evaluate cpuspeed counts for DELAY() in bootloaders
(where cache is disabled) on other m68k ports, hp300 and luna68k etc.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/scsi.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/next68k/stand/boot/boot.c
diff -u src/sys/arch/next68k/stand/boot/boot.c:1.14 src/sys/arch/next68k/stand/boot/boot.c:1.15
--- src/sys/arch/next68k/stand/boot/boot.c:1.14	Sun Feb 12 08:25:09 2023
+++ src/sys/arch/next68k/stand/boot/boot.c	Sun Feb 12 10:04:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.14 2023/02/12 08:25:09 tsutsui Exp $	*/
+/*	$NetBSD: boot.c,v 1.15 2023/02/12 10:04:56 tsutsui Exp $	*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -59,6 +59,7 @@ int devparse(const char *, int *, char *
 #define KNAMEN 100
 char kernel[KNAMEN];
 int entry_point;		/* return value filled in by machdep_start */
+int cpuspeed = MHZ_33;		/* assume fastest 33 MHz for sanity */
 int turbo;
 
 volatile int qq;
@@ -79,10 +80,13 @@ main(char *boot_arg)
 	machine = MON(char, MG_machine_type);
 	if (machine == NeXT_TURBO_MONO ||
 	machine == NeXT_TURBO_COLOR ||
-	machine == NeXT_CUBE_TURBO)
+	machine == NeXT_CUBE_TURBO) {
 		turbo = 1;
-	else
+		cpuspeed = MHZ_33;
+	} else {
 		turbo = 0;
+		cpuspeed = MHZ_25;
+	}
 
 	memset(marks, 0, sizeof(marks));
 	printf(">> %s BOOT [%s #%d]\n", bootprog_name, bootprog_rev, build);

Index: src/sys/arch/next68k/stand/boot/samachdep.h
diff -u src/sys/arch/next68k/stand/boot/samachdep.h:1.1 src/sys/arch/next68k/stand/boot/samachdep.h:1.2
--- src/sys/arch/next68k/stand/boot/samachdep.h:1.1	Sun Feb 12 08:25:09 2023
+++ src/sys/arch/next68k/stand/boot/samachdep.h	Sun Feb 12 10:04:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: samachdep.h,v 1.1 2023/02/12 08:25:09 tsutsui Exp $	*/
+/*	$NetBSD: samachdep.h,v 1.2 2023/02/12 10:04:56 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -36,6 +36,7 @@
 
 /* boot.c */
 extern int entry_point;
+extern int cpuspeed;
 extern int turbo;
 
 /* en.c */
@@ -63,4 +64,14 @@ extern	char bootprog_name[], bootprog_re
 /* build.c (generated by ${.CURDIR}/newvers.sh) */
 extern int build;
 
-#define DELAY(n)	{ register int N = (n); while (--N > 0); }
+/* delay constants; note all CPU cache is turned off here */
+#define MHZ_25		3
+#define MHZ_33		4
+
+#define DELAY(n)			\
+do {	\
+	register u_int __n = (cpuspeed * (n) / 4) + 1;			\
+	do {\
+		__asm("subql #1, %0" : "=r" (__n) : "0" (__n));		\
+	} while (__n > 0);		\
+} while (/* CONSTCOND */ 0)

Index: src/sys/arch/next68k/stand/boot/scsi.c
diff -u src/sys/arch/next68k/stand/boot/scsi.c:1.13 src/sys/arch/next68k/stand/boot/scsi.c:1.14
--- src/sys/arch/next68k/stand/boot/scsi.c:1.13	Sun Feb 12 08:25:09 2023
+++ src/sys/arch/next68k/stand/boot/scsi.c	Sun Feb 12 10:04:56 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: scsi.c,v 1.13 2023/02/12 08:25:09 tsutsui Exp $*/
+/*  $NetBSD: scsi.c,v 1.14 2023/02/12 10:04:56 tsutsui Exp $*/
 /*
  * Copyright (c) 1994, 1997 Rolf Grossmann
  * All rights reserved.
@@ -90,7 +90,8 @@ scsi_init(void)
 
 /* now reset the SCSI bus */
 sr[NCR_CMD]= NCRCMD_RSTSCSI;
-DELAY(400);	/* XXX should be about 2-3 seconds at least */
+/* wait 2 seconds after SCSI bus reset */
+DELAY(2 * 1000 * 1000);
 
 /* then reset the SCSI chip again and initialize it properly */
 sr[NCR_CMD]= NCRCMD_RSTCHIP;



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 08:25:10 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: boot.c conf.c devopen.c en.c machdep.c
rtc.c scsi.c scsivar.h sd.c
Added Files:
src/sys/arch/next68k/stand/boot: samachdep.h

Log Message:
Use common declarations and macros in proper headers.

Also fix inconsistent sdopen() and sdstrategy() args and
remove useless #if 0'ed out code.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/stand/boot/conf.c \
src/sys/arch/next68k/stand/boot/devopen.c \
src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/stand/boot/en.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/next68k/stand/boot/scsivar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot/boot.c
diff -u src/sys/arch/next68k/stand/boot/boot.c:1.13 src/sys/arch/next68k/stand/boot/boot.c:1.14
--- src/sys/arch/next68k/stand/boot/boot.c:1.13	Sat Feb 11 02:33:27 2023
+++ src/sys/arch/next68k/stand/boot/boot.c	Sun Feb 12 08:25:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.13 2023/02/11 02:33:27 tsutsui Exp $	*/
+/*	$NetBSD: boot.c,v 1.14 2023/02/12 08:25:09 tsutsui Exp $	*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -34,17 +34,17 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include /* for NEXT_RAMBASE */
 
 #include 
 
-#define KERN_LOADADDR NEXT_RAMBASE
+#include "samachdep.h"
 
-extern int errno;
+#define KERN_LOADADDR NEXT_RAMBASE
 
-extern char *mg;
 #define	MON(type, off) (*(type *)((u_int) (mg) + off))
 
 int devparse(const char *, int *, char *, char *, char *, char **);
@@ -56,18 +56,11 @@ int devparse(const char *, int *, char *
  * Boot device is derived from PROM provided information.
  */
 
-extern char bootprog_rev[];
-extern char bootprog_name[];
-extern int build;
 #define KNAMEN 100
 char kernel[KNAMEN];
 int entry_point;		/* return value filled in by machdep_start */
 int turbo;
 
-extern void rtc_init(void);
-
-extern int try_bootp;
-
 volatile int qq;
 
 int

Index: src/sys/arch/next68k/stand/boot/conf.c
diff -u src/sys/arch/next68k/stand/boot/conf.c:1.7 src/sys/arch/next68k/stand/boot/conf.c:1.8
--- src/sys/arch/next68k/stand/boot/conf.c:1.7	Sun Dec 11 12:18:29 2005
+++ src/sys/arch/next68k/stand/boot/conf.c	Sun Feb 12 08:25:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.7 2005/12/11 12:18:29 christos Exp $	*/
+/*	$NetBSD: conf.c,v 1.8 2023/02/12 08:25:09 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -45,21 +45,15 @@
 #include 
 #include 
 
+#include "samachdep.h"
+
 /*
  * Device configuration
  */
 
-extern int	sdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
-extern int	sdopen(struct open_file *, ...);
-extern int	sdclose(struct open_file *);
 #define	sdioctl	noioctl
 
-/* ### now from libsa
-extern int	enstrategy(void *, int, daddr_t, size_t, void *, size_t *);
-extern int	enopen(struct open_file *, ...);
-extern int	enclose(struct open_file *);
 #define	enioctl	noioctl
-*/
 
 struct devsw devsw[] = {
 	{ "sd",	sdstrategy,	sdopen,	sdclose,	sdioctl },
Index: src/sys/arch/next68k/stand/boot/devopen.c
diff -u src/sys/arch/next68k/stand/boot/devopen.c:1.7 src/sys/arch/next68k/stand/boot/devopen.c:1.8
--- src/sys/arch/next68k/stand/boot/devopen.c:1.7	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/stand/boot/devopen.c	Sun Feb 12 08:25:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.7 2023/02/04 14:38:09 tsutsui Exp $	*/
+/*	$NetBSD: devopen.c,v 1.8 2023/02/12 08:25:09 tsutsui Exp $	*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include 
 
 int devlookup(const char *, int);
-int devparse(const char *, int *, char *, char *, char *, char **);
+int devparse(const char *, int *, int *, int *, int *, char **);
 
 int
 devlookup(const char *d, int len)
@@ -64,7 +64,7 @@ devlookup(const char *d, int len)
  */
 int
 devparse(const char *fname, int *dev,
-	 char *count, char *lun, char *part, char **file)
+	 int *count, int *lun, int *part, char **file)
 {
 int i;
 const char *s, *args[3];
@@ -120,7 +120,7 @@ devopen(struct open_file *f, const char 
 {
 int error;
 int dev;
-char count, lun, part;
+int count, lun, part;
 struct devsw *dp;
 
 dev   = 0;	/* default device is first in table (usually scsi disk) */
Index: src/sys/arch/next68k/stand/boot/rtc.c
diff -u src/sys/arch/next68k/stand/boot/rtc.c:1.7 src/sys/arch/next68k/stand/boot/rtc.c:1.8
--- 

CVS commit: src/sys/arch/next68k/stand/boot

2023-02-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb 12 08:25:10 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: boot.c conf.c devopen.c en.c machdep.c
rtc.c scsi.c scsivar.h sd.c
Added Files:
src/sys/arch/next68k/stand/boot: samachdep.h

Log Message:
Use common declarations and macros in proper headers.

Also fix inconsistent sdopen() and sdstrategy() args and
remove useless #if 0'ed out code.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/boot.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/stand/boot/conf.c \
src/sys/arch/next68k/stand/boot/devopen.c \
src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/stand/boot/en.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/next68k/stand/boot/samachdep.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/next68k/stand/boot/scsivar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 18:09:55 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Bump version again to denote NeXT_CUBE_TURBO support.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/stand/boot/version

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/next68k/stand/boot/version
diff -u src/sys/arch/next68k/stand/boot/version:1.5 src/sys/arch/next68k/stand/boot/version:1.6
--- src/sys/arch/next68k/stand/boot/version:1.5	Sat Feb 11 18:06:22 2023
+++ src/sys/arch/next68k/stand/boot/version	Sat Feb 11 18:09:55 2023
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.5 2023/02/11 18:06:22 tsutsui Exp $
+$NetBSD: version,v 1.6 2023/02/11 18:09:55 tsutsui Exp $
 
 1.1:	initial import
 1.3:	Add ELF support
 1.4:	loadfile() update:  ELF symbols no longer need backward seeks.
 1.5:	loadfile() update to avoid backwards seeks for ELF Program Headers.
 1.6:	Fix a bug on DMA reg accesses and a problem on detecting old drives
+1.7:	Add support of NeXT_CUBE_TURBO



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 18:09:55 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Bump version again to denote NeXT_CUBE_TURBO support.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/stand/boot/version

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



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 18:06:22 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.

All these fixes should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/stand/boot/version

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/next68k/stand/boot/version
diff -u src/sys/arch/next68k/stand/boot/version:1.4 src/sys/arch/next68k/stand/boot/version:1.5
--- src/sys/arch/next68k/stand/boot/version:1.4	Fri Nov  9 19:53:17 2001
+++ src/sys/arch/next68k/stand/boot/version	Sat Feb 11 18:06:22 2023
@@ -1,6 +1,7 @@
-$NetBSD: version,v 1.4 2001/11/09 19:53:17 scw Exp $
+$NetBSD: version,v 1.5 2023/02/11 18:06:22 tsutsui Exp $
 
 1.1:	initial import
 1.3:	Add ELF support
 1.4:	loadfile() update:  ELF symbols no longer need backward seeks.
 1.5:	loadfile() update to avoid backwards seeks for ELF Program Headers.
+1.6:	Fix a bug on DMA reg accesses and a problem on detecting old drives



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 18:06:22 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: version

Log Message:
Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.

All these fixes should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/stand/boot/version

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



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

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 08:27:21 UTC 2023

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

Log Message:
Disable rarely used options and devices, and add options MODULAR instead.

Also enable files-system MSDOS for file exchange via removable media.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/next68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.160 src/sys/arch/next68k/conf/GENERIC:1.161
--- src/sys/arch/next68k/conf/GENERIC:1.160	Sat Feb 11 07:42:25 2023
+++ src/sys/arch/next68k/conf/GENERIC	Sat Feb 11 08:27:21 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.160 2023/02/11 07:42:25 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.161 2023/02/11 08:27:21 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.160 $"
+#ident 		"GENERIC-$Revision: 1.161 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -37,6 +37,9 @@ options 	SYSVMSG		# System V message que
 options 	SYSVSEM		# System V semaphores
 options 	SYSVSHM		# System V shared memory
 
+options 	MODULAR		# new style module(7) framework
+options 	MODULAR_DEFAULT_AUTOLOAD
+
 options 	INSECURE	# disable kernel security level
 options 	USERCONF	# userconf(4) support
 #options	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
@@ -62,7 +65,7 @@ options 	DDB_HISTORY_SIZE=100	# enable h
 
 # Other debugging options
 #options 	PMAP_DEBUG
-options 	SCSIDEBUG
+#options 	SCSIDEBUG
 options 	SCSIVERBOSE		# Verbose SCSI errors
 
 # Compatibility options
@@ -83,15 +86,15 @@ file-system 	FFS		# UFS
 file-system 	MFS		# memory file system
 file-system 	NFS		# Network File System client
 file-system 	CD9660		# ISO 9660 + Rock Ridge file system
-#file-system 	MSDOSFS		# MS-DOS file system
+file-system 	MSDOSFS		# MS-DOS file system
 file-system 	FDESC		# /dev/fd
 file-system 	KERNFS		# /kern
 file-system 	NULLFS		# loopback file system
-file-system 	OVERLAY		# overlay file system
-file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+#file-system 	OVERLAY		# overlay file system
+#file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
 file-system 	PROCFS		# /proc
-file-system 	UMAPFS		# NULLFS + uid and gid remapping
-file-system 	UNION		# union file system
+#file-system 	UMAPFS		# NULLFS + uid and gid remapping
+#file-system 	UNION		# union file system
 file-system	PTYFS		# /dev/pts/N support
 file-system	TMPFS		# Efficient memory file-system
 #file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
@@ -197,11 +200,11 @@ scsibus* at scsi?
 sd*	at scsibus? target ? lun ?	# SCSI disk drives
 st*	at scsibus? target ? lun ?	# SCSI tape drives
 cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
-ch*	at scsibus? target ? lun ?	# SCSI autochangers
+#ch*	at scsibus? target ? lun ?	# SCSI autochangers
 dse*	at scsibus? target ? lun ?	# SCSI ethernet (Dayna)
 se*	at scsibus? target ? lun ?	# SCSI ethernet
-ss*	at scsibus? target ? lun ?	# SCSI scanners
-uk*	at scsibus? target ? lun ?	# SCSI unknown
+#ss*	at scsibus? target ? lun ?	# SCSI scanners
+#uk*	at scsibus? target ? lun ?	# SCSI unknown
 
 
 # Memory-disk drivers
@@ -209,27 +212,27 @@ pseudo-device	md
 
 #
 # accept filters
-pseudo-device   accf_data		# "dataready" accept filter
-pseudo-device   accf_http		# "httpready" accept filter
+#pseudo-device   accf_data		# "dataready" accept filter
+#pseudo-device   accf_http		# "httpready" accept filter
 
 # Misc.
 pseudo-device	loop			# network loopback
 pseudo-device	bpfilter		# packet filter
-pseudo-device	carp			# Common Address Redundancy Protocol
+#pseudo-device	carp			# Common Address Redundancy Protocol
 pseudo-device	sl			# CSLIP
 pseudo-device	ppp			# PPP
 pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
-pseudo-device	tun			# network tunneling over tty
-pseudo-device	tap			# virtual Ethernet
+#pseudo-device	tun			# network tunneling over tty
+#pseudo-device	tap			# virtual Ethernet
 #pseudo-device	gre			# generic L3 over IP tunnel
-pseudo-device	npf			# NPF packet filter
+#pseudo-device	npf			# NPF packet filter
 pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
 #pseudo-device	faith			# IPv[46] tcp relay translation i/f
 pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
-pseudo-device	vlan			# IEEE 802.1q encapsulation
-pseudo-device	bridge			# simple inter-network bridging
-pseudo-device	vether			# Virtual Ethernet for bridge
-pseudo-device	agr			# IEEE 802.3ad link aggregation
+#pseudo-device	vlan			# IEEE 802.1q encapsulation
+#pseudo-device	bridge			# simple inter-network bridging

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

2023-02-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 08:27:21 UTC 2023

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

Log Message:
Disable rarely used options and devices, and add options MODULAR instead.

Also enable files-system MSDOS for file exchange via removable media.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/next68k/conf/GENERIC

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



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:42:25 UTC 2023

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

Log Message:
Remove unnecessary commented out lines.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/arch/next68k/conf/GENERIC

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



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:42:25 UTC 2023

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

Log Message:
Remove unnecessary commented out lines.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/arch/next68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.159 src/sys/arch/next68k/conf/GENERIC:1.160
--- src/sys/arch/next68k/conf/GENERIC:1.159	Sat Feb 11 07:32:44 2023
+++ src/sys/arch/next68k/conf/GENERIC	Sat Feb 11 07:42:25 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.159 2023/02/11 07:32:44 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.160 2023/02/11 07:42:25 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.159 $"
+#ident 		"GENERIC-$Revision: 1.160 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -35,10 +35,6 @@ maxusers	16
 options 	KTRACE		# system call tracing
 options 	SYSVMSG		# System V message queues
 options 	SYSVSEM		# System V semaphores
-#options 	SEMMNI=10	# number of semaphore identifiers
-#options 	SEMMNS=60	# number of semaphores in system
-#options 	SEMUME=10	# max number of undo entries per process
-#options 	SEMMNU=30	# number of undo structures in system
 options 	SYSVSHM		# System V shared memory
 
 options 	INSECURE	# disable kernel security level
@@ -170,8 +166,6 @@ config		netbsd root on ? type ?
 # The root node:
 mainbus0 at root
 
-#fpu0 at mainbus?
-
 # device space
 intio0	at mainbus?
 
@@ -185,7 +179,6 @@ wskbd*		at nextkbd? console ?
 nextdma*	at intio? ipl 6
 
 zsc0	at intio? ipl 5
-#zsc1	at intio? ipl 5
 
 xe*	at intio? ipl 3			# ethernet
 



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:32:44 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove nonexistent options SWAPDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/next68k/conf/SLAB

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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.158 src/sys/arch/next68k/conf/GENERIC:1.159
--- src/sys/arch/next68k/conf/GENERIC:1.158	Sat Feb 11 07:12:34 2023
+++ src/sys/arch/next68k/conf/GENERIC	Sat Feb 11 07:32:44 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.158 2023/02/11 07:12:34 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.159 2023/02/11 07:32:44 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.158 $"
+#ident 		"GENERIC-$Revision: 1.159 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -68,7 +68,6 @@ options 	DDB_HISTORY_SIZE=100	# enable h
 #options 	PMAP_DEBUG
 options 	SCSIDEBUG
 options 	SCSIVERBOSE		# Verbose SCSI errors
-options 	SWAPDEBUG
 
 # Compatibility options
 include 	"conf/compat_netbsd09.config"

Index: src/sys/arch/next68k/conf/SLAB
diff -u src/sys/arch/next68k/conf/SLAB:1.62 src/sys/arch/next68k/conf/SLAB:1.63
--- src/sys/arch/next68k/conf/SLAB:1.62	Fri Feb  3 23:07:47 2023
+++ src/sys/arch/next68k/conf/SLAB	Sat Feb 11 07:32:44 2023
@@ -1,4 +1,4 @@
-# $NetBSD: SLAB,v 1.62 2023/02/03 23:07:47 tsutsui Exp $
+# $NetBSD: SLAB,v 1.63 2023/02/11 07:32:44 tsutsui Exp $
 #
 # deberg's development machine
 #
@@ -40,7 +40,6 @@ makeoptions	DEBUG="-g"		# debugging symb
 #options 	PMAP_DEBUG
 options 	SCSIDEBUG
 options 	SCSIVERBOSE		# Verbose SCSI errors
-options 	SWAPDEBUG
 
 # Compatibility options
 include 	"conf/compat_netbsd14.config"



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:32:44 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove nonexistent options SWAPDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/next68k/conf/SLAB

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



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:12:34 UTC 2023

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

Log Message:
Enable file-system CD9660.

It's useful for installation especially on emulators.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/next68k/conf/GENERIC

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



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 07:12:34 UTC 2023

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

Log Message:
Enable file-system CD9660.

It's useful for installation especially on emulators.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/next68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.157 src/sys/arch/next68k/conf/GENERIC:1.158
--- src/sys/arch/next68k/conf/GENERIC:1.157	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/conf/GENERIC	Sat Feb 11 07:12:34 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.157 2023/02/04 14:38:09 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.158 2023/02/11 07:12:34 tsutsui Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.157 $"
+#ident 		"GENERIC-$Revision: 1.158 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -87,7 +87,7 @@ file-system 	FFS		# UFS
 #file-system 	LFS		# log-structured file system
 file-system 	MFS		# memory file system
 file-system 	NFS		# Network File System client
-#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	CD9660		# ISO 9660 + Rock Ridge file system
 #file-system 	MSDOSFS		# MS-DOS file system
 file-system 	FDESC		# /dev/fd
 file-system 	KERNFS		# /kern



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:34:15 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c

Log Message:
NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG.

Info from Andreas Grabher on port-next68k@.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/dev/nextdisplay.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/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.29 src/sys/arch/next68k/dev/nextdisplay.c:1.30
--- src/sys/arch/next68k/dev/nextdisplay.c:1.29	Sat Feb 11 02:33:27 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Sat Feb 11 02:34:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.30 2023/02/11 02:34:15 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -246,7 +246,7 @@ nextdisplay_attach(device_t parent, devi
 	printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
 	sc->sc_dc->dc_depth);
 
-	if (iscolor) {
+	if (iscolor && !turbo) {
 #if 0
 		uint8_t x;
 



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

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:34:15 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c

Log Message:
NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG.

Info from Andreas Grabher on port-next68k@.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/dev/nextdisplay.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/next68k

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:33:27 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextcons.c nextdisplay.c
src/sys/arch/next68k/next68k: nextrom.c nextrom.h
src/sys/arch/next68k/stand/boot: boot.c

Log Message:
Add and check machine type NeXT_CUBE_TURBO (type 8).

Info from Andreas Grabher on port-next68k@.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/boot.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/next68k/dev/nextcons.c
diff -u src/sys/arch/next68k/dev/nextcons.c:1.13 src/sys/arch/next68k/dev/nextcons.c:1.14
--- src/sys/arch/next68k/dev/nextcons.c:1.13	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/dev/nextcons.c	Sat Feb 11 02:33:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextcons.c,v 1.13 2023/02/04 14:38:09 tsutsui Exp $	*/
+/*	$NetBSD: nextcons.c,v 1.14 2023/02/11 02:33:27 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Darrin B. Jewell
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.13 2023/02/04 14:38:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.14 2023/02/11 02:33:27 tsutsui Exp $");
 
 #include 
 #include 
@@ -67,7 +67,8 @@ nextcnprobe(struct consdev *cp)
 	rom_machine_type == NeXT_X15 ||
 	rom_machine_type == NeXT_WARP9C ||
 	rom_machine_type == NeXT_TURBO_MONO ||
-	rom_machine_type == NeXT_TURBO_COLOR)
+	rom_machine_type == NeXT_TURBO_COLOR ||
+	rom_machine_type == NeXT_CUBE_TURBO)
 		cp->cn_pri = CN_INTERNAL;
 	else
 		cp->cn_pri = CN_DEAD;

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.28 src/sys/arch/next68k/dev/nextdisplay.c:1.29
--- src/sys/arch/next68k/dev/nextdisplay.c:1.28	Sat Feb 11 02:31:34 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Sat Feb 11 02:33:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -147,7 +147,8 @@ nextdisplay_match(device_t parent, cfdat
 	rom_machine_type == NeXT_X15 ||
 	rom_machine_type == NeXT_WARP9C ||
 	rom_machine_type == NeXT_TURBO_MONO ||
-	rom_machine_type == NeXT_TURBO_COLOR)
+	rom_machine_type == NeXT_TURBO_COLOR ||
+	rom_machine_type == NeXT_CUBE_TURBO)
 		return 1;
 	else
 		return 0;

Index: src/sys/arch/next68k/next68k/nextrom.c
diff -u src/sys/arch/next68k/next68k/nextrom.c:1.28 src/sys/arch/next68k/next68k/nextrom.c:1.29
--- src/sys/arch/next68k/next68k/nextrom.c:1.28	Sat Feb 11 02:31:34 2023
+++ src/sys/arch/next68k/next68k/nextrom.c	Sat Feb 11 02:33:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextrom.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $	*/
+/*	$NetBSD: nextrom.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextrom.c,v 1.29 2023/02/11 02:33:27 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_serial.h"
@@ -261,6 +261,11 @@ next68k_bootargs(unsigned char **args)
 			msize4  =  0x80;
 			msize1  =  0x20;
 			ROM_PUTS("Looks like a NeXT_TURBO_MONO\r\n");
+		} else if (MONRELOC(char, MG_machine_type) == NeXT_CUBE_TURBO) {
+			msize16 = 0x200;
+			msize4  =  0x80;
+			msize1  =  0x20;
+			ROM_PUTS("Looks like a NeXT_CUBE_TURBO\r\n");
 		} else {
 			msize16 = 0x10;
 			msize4  = 0x10;
@@ -270,7 +275,9 @@ next68k_bootargs(unsigned char **args)
 
 		mach = MONRELOC(char, MG_machine_type);
 		RELOC(rom_machine_type, char) = mach;
-		if (mach == NeXT_TURBO_MONO || mach == NeXT_TURBO_COLOR)
+		if (mach == NeXT_TURBO_MONO ||
+		mach == NeXT_TURBO_COLOR ||
+		mach == NeXT_CUBE_TURBO)
 			turbo_l = 1;
 		else
 			turbo_l = 0;

Index: src/sys/arch/next68k/next68k/nextrom.h
diff -u src/sys/arch/next68k/next68k/nextrom.h:1.12 src/sys/arch/next68k/next68k/nextrom.h:1.13
--- src/sys/arch/next68k/next68k/nextrom.h:1.12	Wed May 18 13:56:32 2022
+++ src/sys/arch/next68k/next68k/nextrom.h	Sat Feb 11 02:33:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextrom.h,v 1.12 2022/05/18 13:56:32 andvar Exp $	*/
+/*	$NetBSD: nextrom.h,v 1.13 2023/02/11 02:33:27 tsutsui Exp $	*/
 /*
  * 

CVS commit: src/sys/arch/next68k

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:33:27 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextcons.c nextdisplay.c
src/sys/arch/next68k/next68k: nextrom.c nextrom.h
src/sys/arch/next68k/stand/boot: boot.c

Log Message:
Add and check machine type NeXT_CUBE_TURBO (type 8).

Info from Andreas Grabher on port-next68k@.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/nextrom.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/boot.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/next68k

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:31:34 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c intiovar.h nextdisplay.c
src/sys/arch/next68k/include: bus_space.h cpu.h
src/sys/arch/next68k/next68k: locore.s nextrom.c pmap_bootstrap.c

Log Message:
Handle NeXT Turbo VRAM regions properly.

Info from Andreas Grabher on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/06/msg52.html

Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/dev/intiovar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/next68k/next68k/pmap_bootstrap.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/next68k/dev/intio.c
diff -u src/sys/arch/next68k/dev/intio.c:1.18 src/sys/arch/next68k/dev/intio.c:1.19
--- src/sys/arch/next68k/dev/intio.c:1.18	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/dev/intio.c	Sat Feb 11 02:31:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio.c,v 1.18 2023/02/04 14:38:09 tsutsui Exp $	*/
+/*	$NetBSD: intio.c,v 1.19 2023/02/11 02:31:34 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.18 2023/02/04 14:38:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.19 2023/02/11 02:31:34 tsutsui Exp $");
 
 #include 
 #include 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -107,3 +108,27 @@ intiosearch(device_t parent, cfdata_t cf
 
 	return 0;
 }
+
+int
+bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size,
+int flags, bus_space_handle_t *bsh)
+{
+
+	if (addr >= INTIOBASE && (addr + size) < INTIOTOP) {
+		*bsh = IIOV(addr);
+		return 0;
+	}
+
+	return EINVAL;
+}
+
+paddr_t
+bus_space_mmap(bus_space_tag_t bst, bus_addr_t addr, off_t offset, int prot,
+int flags)
+{
+
+	if (addr >= INTIOBASE && (addr + offset) < INTIOTOP)
+		return m68k_btop(addr + offset);
+
+	return -1;
+}

Index: src/sys/arch/next68k/dev/intiovar.h
diff -u src/sys/arch/next68k/dev/intiovar.h:1.7 src/sys/arch/next68k/dev/intiovar.h:1.8
--- src/sys/arch/next68k/dev/intiovar.h:1.7	Sun Jan  2 08:19:03 2011
+++ src/sys/arch/next68k/dev/intiovar.h	Sat Feb 11 02:31:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intiovar.h,v 1.7 2011/01/02 08:19:03 tsutsui Exp $	*/
+/*	$NetBSD: intiovar.h,v 1.8 2023/02/11 02:31:34 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@ struct intio_attach_args {
 
 extern	vaddr_t intiobase;
 extern  vaddr_t intiolimit;
-extern	vaddr_t monobase;
-extern  vaddr_t monolimit;
-extern	vaddr_t colorbase;
-extern  vaddr_t colorlimit;
+extern	vaddr_t fbbase;
+extern  vaddr_t fblimit;
+extern	paddr_t fbbasepa;
+extern  paddr_t fblimitpa;

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.27 src/sys/arch/next68k/dev/nextdisplay.c:1.28
--- src/sys/arch/next68k/dev/nextdisplay.c:1.27	Fri Feb  3 23:21:17 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Sat Feb 11 02:31:34 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.28 2023/02/11 02:31:34 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -162,15 +162,9 @@ nextdisplay_init(struct nextdisplay_conf
 
 	/* printf("in nextdisplay_init\n"); */
 
-	if (color) {
-		dc->dc_vaddr = colorbase;
-		dc->dc_paddr = COLORBASE;
-		dc->dc_size = NEXT_P_C16_VIDEOSIZE;
-	} else {
-		dc->dc_vaddr = monobase;
-		dc->dc_paddr = MONOBASE;
-		dc->dc_size = NEXT_P_VIDEOSIZE;
-	}
+	dc->dc_vaddr = fbbase;
+	dc->dc_paddr = fbbasepa;
+	dc->dc_size = color ? NEXT_P_C16_VIDEOSIZE : NEXT_P_VIDEOSIZE;
 
 	dc->dc_wid = 1120;
 	dc->dc_ht = 832;
@@ -182,8 +176,8 @@ nextdisplay_init(struct nextdisplay_conf
 #if 0
 	printf("intiobase at: %08x\n", intiobase);
 	printf("intiolimit at: %08x\n", intiolimit);
-	printf("videobase at: %08x\n", color ? colorbase : monobase);
-	printf("videolimit at: %08x\n", color ? colorlimit : monolimit);
+	printf("videobase at: %08x\n", fbbase);
+	printf("videolimit at: %08x\n", fblimit);
 
 	printf("virtual fb at: %08x\n", 

CVS commit: src/sys/arch/next68k

2023-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 11 02:31:34 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c intiovar.h nextdisplay.c
src/sys/arch/next68k/include: bus_space.h cpu.h
src/sys/arch/next68k/next68k: locore.s nextrom.c pmap_bootstrap.c

Log Message:
Handle NeXT Turbo VRAM regions properly.

Info from Andreas Grabher on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/06/msg52.html

Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9).


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/dev/intiovar.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/nextrom.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/next68k/next68k/pmap_bootstrap.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/next68k/stand/boot

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 15:20:40 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: Makefile scsi.c sd.c

Log Message:
Disable DEBUG options properly.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot/Makefile
diff -u src/sys/arch/next68k/stand/boot/Makefile:1.30 src/sys/arch/next68k/stand/boot/Makefile:1.31
--- src/sys/arch/next68k/stand/boot/Makefile:1.30	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/stand/boot/Makefile	Thu Feb  9 15:20:40 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2023/02/04 14:38:09 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.31 2023/02/09 15:20:40 tsutsui Exp $
 
 NOMAN=	# defined
 
@@ -24,10 +24,13 @@ RELOC=	438
 
 # XXX make defs arch-indep.
 INCLUDES+=	-I${.OBJDIR} -I${S}/arch -I${S} -I${S}/lib/libsa
-DEFS+=		-D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP  -DDEBUG -DSD_DEBUG -DSCSI_DEBUG # -DEN_DEBUG   -DNETIF_DEBUG
-SAMISCCPPFLAGS=	-DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER # -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG # -DNETIF_DEBUG -DNFS_DEBUG  -DARP_DEBUG
+DEFS+=		-D_STANDALONE -DMC68040 -DSUPPORT_BOOTP -DSUPPORT_DHCP
+#DEFS+=		-DDEBUG -DSD_DEBUG -DSCSI_DEBUG -DEN_DEBUG -DNETIF_DEBUG
+SAMISCCPPFLAGS=	-DSUPPORT_DHCP -DSUPPORT_BOOTP -DSA_EXEC_ANYOWNER
+#SAMISCCPPFLAGS+= -DBOOTP_DEBUG -DETHER_DEBUG -DNET_DEBUG-DNETIF_DEBUG
+#SAMISCCPPFLAGS+= -DNFS_DEBUG -DARP_DEBUG
 WARNS=1
-CFLAGS+=	 -ffreestanding -nostdinc ${INCLUDES} ${DEFS}
+CFLAGS+=	-ffreestanding -nostdinc ${INCLUDES} ${DEFS}
 CFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
 AFLAGS+=	${INCLUDES}
 # XXX SHOULD NOT NEED TO DEFINE THESE!

Index: src/sys/arch/next68k/stand/boot/scsi.c
diff -u src/sys/arch/next68k/stand/boot/scsi.c:1.11 src/sys/arch/next68k/stand/boot/scsi.c:1.12
--- src/sys/arch/next68k/stand/boot/scsi.c:1.11	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/stand/boot/scsi.c	Thu Feb  9 15:20:40 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: scsi.c,v 1.11 2023/02/04 14:38:09 tsutsui Exp $*/
+/*  $NetBSD: scsi.c,v 1.12 2023/02/09 15:20:40 tsutsui Exp $*/
 /*
  * Copyright (c) 1994, 1997 Rolf Grossmann
  * All rights reserved.
@@ -61,7 +61,7 @@ int scsiicmd(char target, char lun,
 #define NDPRINTF(x)
 #define PRINTF(x)
 /* printf x; */
-#ifdef xSCSI_DEBUG
+#ifdef SCSI_DEBUG
 #define DPRINTF(x) printf x;
 #else
 #define DPRINTF(x)

Index: src/sys/arch/next68k/stand/boot/sd.c
diff -u src/sys/arch/next68k/stand/boot/sd.c:1.15 src/sys/arch/next68k/stand/boot/sd.c:1.16
--- src/sys/arch/next68k/stand/boot/sd.c:1.15	Thu Feb  9 15:00:56 2023
+++ src/sys/arch/next68k/stand/boot/sd.c	Thu Feb  9 15:20:40 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: sd.c,v 1.15 2023/02/09 15:00:56 tsutsui Exp $*/
+/*  $NetBSD: sd.c,v 1.16 2023/02/09 15:20:40 tsutsui Exp $*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -40,7 +40,7 @@
 #include  /* for bzero() */
 #include "dmareg.h"
 
-#ifdef xSD_DEBUG
+#ifdef SD_DEBUG
 #define DPRINTF(x) printf x;
 #else
 #define DPRINTF(x)



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 15:20:40 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: Makefile scsi.c sd.c

Log Message:
Disable DEBUG options properly.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 15:00:56 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: sd.c

Log Message:
Request only 36 bytes for a response of INQUIRY command for legacy drives.

Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).

The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator)a on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot/sd.c
diff -u src/sys/arch/next68k/stand/boot/sd.c:1.14 src/sys/arch/next68k/stand/boot/sd.c:1.15
--- src/sys/arch/next68k/stand/boot/sd.c:1.14	Thu Feb  9 14:41:54 2023
+++ src/sys/arch/next68k/stand/boot/sd.c	Thu Feb  9 15:00:56 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: sd.c,v 1.14 2023/02/09 14:41:54 tsutsui Exp $*/
+/*  $NetBSD: sd.c,v 1.15 2023/02/09 15:00:56 tsutsui Exp $*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -98,8 +98,8 @@ sdprobe(char target, char lun)
 
 memset(, 0, sizeof(cdb2));
 cdb2.opcode = INQUIRY;
-cdb2.length = sizeof(inq);
-count = sizeof (inq);
+cdb2.length = SCSIPI_INQUIRY_LENGTH_SCSI2;
+count = SCSIPI_INQUIRY_LENGTH_SCSI2;
 error = scsiicmd(target, lun, (u_char *), sizeof(cdb2),
 		 (char *), );
 if (error != 0)



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 15:00:56 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: sd.c

Log Message:
Request only 36 bytes for a response of INQUIRY command for legacy drives.

Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).

The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator)a on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html


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

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 14:41:54 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: sd.c

Log Message:
Avoid possible division by zero trap in error cases to make debug easier.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/stand/boot/sd.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/next68k/stand/boot/sd.c
diff -u src/sys/arch/next68k/stand/boot/sd.c:1.13 src/sys/arch/next68k/stand/boot/sd.c:1.14
--- src/sys/arch/next68k/stand/boot/sd.c:1.13	Sat Feb  4 14:38:09 2023
+++ src/sys/arch/next68k/stand/boot/sd.c	Thu Feb  9 14:41:54 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: sd.c,v 1.13 2023/02/04 14:38:09 tsutsui Exp $*/
+/*  $NetBSD: sd.c,v 1.14 2023/02/09 14:41:54 tsutsui Exp $*/
 /*
  * Copyright (c) 1994 Rolf Grossmann
  * All rights reserved.
@@ -135,6 +135,10 @@ sdgetinfo(struct sd_softc *ss)
 	return error<0 ? EHER : error;
 blklen = (cap.length[0]<<24) + (cap.length[1]<<16)
 	 + (cap.length[2]<<8) + cap.length[3];
+
+/* avoid division by zero trap even on possible xfer errors */
+if (blklen == 0)
+	blklen = DEV_BSIZE;
 ss->sc_dev_bsize = blklen;
 
 ss->sc_pinfo.offset[ss->sc_part] = 0; /* read absolute sector */



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb  9 14:41:54 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: sd.c

Log Message:
Avoid possible division by zero trap in error cases to make debug easier.


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

2023-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Feb  7 14:27:59 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: dmareg.h

Log Message:
Make sure to specify volatile explicitly on DMA register accesses.

It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/next68k/stand/boot/dmareg.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/next68k/stand/boot/dmareg.h
diff -u src/sys/arch/next68k/stand/boot/dmareg.h:1.3 src/sys/arch/next68k/stand/boot/dmareg.h:1.4
--- src/sys/arch/next68k/stand/boot/dmareg.h:1.3	Wed Sep 11 01:46:36 2002
+++ src/sys/arch/next68k/stand/boot/dmareg.h	Tue Feb  7 14:27:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmareg.h,v 1.3 2002/09/11 01:46:36 mycroft Exp $	*/
+/*	$NetBSD: dmareg.h,v 1.4 2023/02/07 14:27:59 tsutsui Exp $	*/
 /*
  * Copyright (c) 1997 Rolf Grossmann
  * All rights reserved.
@@ -55,7 +55,7 @@
 		 &~(DMA_ENDALIGNMENT-1))|0x8000))
 
 struct dma_dev {		/* format of dma device registers */
-	int dd_csr;		/* control & status register */
+	volatile uint32_t dd_csr; /* control & status register */
 	char dd_pad[0x3fec];	/* csr not contiguous with next */
 	char *dd_saved_next;	/* saved pointers for HW restart */
 	char *dd_saved_limit;



CVS commit: src/sys/arch/next68k/stand/boot

2023-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Feb  7 14:27:59 UTC 2023

Modified Files:
src/sys/arch/next68k/stand/boot: dmareg.h

Log Message:
Make sure to specify volatile explicitly on DMA register accesses.

It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/next68k/stand/boot/dmareg.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/next68k

2023-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 14:38:09 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC majors.next68k
src/sys/arch/next68k/dev: bmapreg.h if_xereg.h intio.c nextcons.c
wskbdmap_next.c zs.c
src/sys/arch/next68k/include: vmparam.h
src/sys/arch/next68k/next68k: machdep.c mainbus.c pmap_bootstrap.c
src/sys/arch/next68k/stand/boot: Makefile README devopen.c machdep.c
rtc.c scsi.c sd.c srt0.s

Log Message:
Remove trailing spaces and TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/conf/majors.next68k
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/next68k/dev/bmapreg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/next68k/dev/if_xereg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/wskbdmap_next.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/next68k/dev/zs.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/next68k/next68k/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/next68k/next68k/mainbus.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/next68k/next68k/pmap_bootstrap.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/next68k/stand/boot/README
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/stand/boot/devopen.c \
src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/next68k/stand/boot/srt0.s

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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.156 src/sys/arch/next68k/conf/GENERIC:1.157
--- src/sys/arch/next68k/conf/GENERIC:1.156	Fri Feb  3 23:07:47 2023
+++ src/sys/arch/next68k/conf/GENERIC	Sat Feb  4 14:38:09 2023
@@ -1,7 +1,7 @@
-# $NetBSD: GENERIC,v 1.156 2023/02/03 23:07:47 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.157 2023/02/04 14:38:09 tsutsui Exp $
 #
 # GENERIC machine description file
-# 
+#
 # This machine description file is used to generate the default NetBSD
 # kernel.  The generic kernel does not include all options, subsystems
 # and device drivers, but should be useful for most applications.
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.156 $"
+#ident 		"GENERIC-$Revision: 1.157 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for

Index: src/sys/arch/next68k/conf/majors.next68k
diff -u src/sys/arch/next68k/conf/majors.next68k:1.25 src/sys/arch/next68k/conf/majors.next68k:1.26
--- src/sys/arch/next68k/conf/majors.next68k:1.25	Sat Apr  4 16:06:15 2020
+++ src/sys/arch/next68k/conf/majors.next68k	Sat Feb  4 14:38:09 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.next68k,v 1.25 2020/04/04 16:06:15 jdolecek Exp $
+#	$NetBSD: majors.next68k,v 1.26 2023/02/04 14:38:09 tsutsui Exp $
 #
 # Device majors for next68k
 #
@@ -50,5 +50,5 @@ device-major	wsfont		char 50			wsfont
 #device-major	obsolete	char 98			obsolete (nsmb)
 
 # Majors up to 143 are reserved for machine-dependent drivers.
-# New machine-independent driver majors are assigned in 
+# New machine-independent driver majors are assigned in
 # sys/conf/majors.

Index: src/sys/arch/next68k/dev/bmapreg.h
diff -u src/sys/arch/next68k/dev/bmapreg.h:1.3 src/sys/arch/next68k/dev/bmapreg.h:1.4
--- src/sys/arch/next68k/dev/bmapreg.h:1.3	Fri Oct 23 02:32:33 2009
+++ src/sys/arch/next68k/dev/bmapreg.h	Sat Feb  4 14:38:09 2023
@@ -1,6 +1,6 @@
-/*	$NetBSD: bmapreg.h,v 1.3 2009/10/23 02:32:33 snj Exp $	*/
+/*	$NetBSD: bmapreg.h,v 1.4 2023/02/04 14:38:09 tsutsui Exp $	*/
 
-/* 
+/*
  * Copyright (c) 2002 Christian Limpach
  * All rights reserved.
  *

Index: src/sys/arch/next68k/dev/if_xereg.h
diff -u src/sys/arch/next68k/dev/if_xereg.h:1.2 src/sys/arch/next68k/dev/if_xereg.h:1.3
--- src/sys/arch/next68k/dev/if_xereg.h:1.2	Fri Oct 23 02:32:33 2009
+++ src/sys/arch/next68k/dev/if_xereg.h	Sat Feb  4 14:38:09 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xereg.h,v 1.2 2009/10/23 02:32:33 snj Exp $  */
+/*  $NetBSD: if_xereg.h,v 1.3 2023/02/04 14:38:09 tsutsui Exp $  */
 
 /*
  * Copyright (c) 2002 Christian Limpach
@@ -11,19 +11,19 @@
  *notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following 

CVS commit: src/sys/arch/next68k

2023-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 14:38:09 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC majors.next68k
src/sys/arch/next68k/dev: bmapreg.h if_xereg.h intio.c nextcons.c
wskbdmap_next.c zs.c
src/sys/arch/next68k/include: vmparam.h
src/sys/arch/next68k/next68k: machdep.c mainbus.c pmap_bootstrap.c
src/sys/arch/next68k/stand/boot: Makefile README devopen.c machdep.c
rtc.c scsi.c sd.c srt0.s

Log Message:
Remove trailing spaces and TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/conf/majors.next68k
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/next68k/dev/bmapreg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/next68k/dev/if_xereg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/wskbdmap_next.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/next68k/dev/zs.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/next68k/next68k/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/next68k/next68k/mainbus.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/next68k/next68k/pmap_bootstrap.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/next68k/stand/boot/Makefile
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/next68k/stand/boot/README
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/next68k/stand/boot/devopen.c \
src/sys/arch/next68k/stand/boot/rtc.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/next68k/stand/boot/machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/next68k/stand/boot/scsi.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/stand/boot/sd.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/next68k/stand/boot/srt0.s

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



CVS commit: src/sys/arch/next68k

2023-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 08:42:45 UTC 2023

Modified Files:
src/sys/arch/next68k/include: param.h vmparam.h
src/sys/arch/next68k/next68k: locore.s pmap_bootstrap.c

Log Message:
Remove leftover "last kernel PT page" settings derived from hp300.

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

All hp300 machines has RAMs at a region from the highest address
i.e. 0x to smaller address (as HP claims "it's the MSB first"),
so kernels have to prepare PA==KVA mappings as the "last PT page" to
guarantee the running kernel works both before and after the MMU is
turned on.  For such a special mapping, we have to set up necessary
segment table and page table during early startup, in pmap_bootstrap()
invoked from locore.s.

On the other hand, NeXT machines have RAMs at a region from 0x4000
to below (i.e. to larger address) so we still need a PA==KVA mapping.
However currently NetBSD/next68k just uses the transparent translation
registers to achieve the PA==KVA mapping, so unlike hp300 we don't have
to prepare special segment table and page table for it.

Note many other m68k ports (like luna68k, news68k, x68k etc.) have
RAMs at a region from 0x so usually we can assume PA==KVA
and don't have to bother to prepare such speicial mappings.

No user visible changes (except now freed wasted pages for the tables).
Tested on my NeXTstation slab.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/include/param.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/next68k/next68k/pmap_bootstrap.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/next68k

2023-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 08:42:45 UTC 2023

Modified Files:
src/sys/arch/next68k/include: param.h vmparam.h
src/sys/arch/next68k/next68k: locore.s pmap_bootstrap.c

Log Message:
Remove leftover "last kernel PT page" settings derived from hp300.

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

All hp300 machines has RAMs at a region from the highest address
i.e. 0x to smaller address (as HP claims "it's the MSB first"),
so kernels have to prepare PA==KVA mappings as the "last PT page" to
guarantee the running kernel works both before and after the MMU is
turned on.  For such a special mapping, we have to set up necessary
segment table and page table during early startup, in pmap_bootstrap()
invoked from locore.s.

On the other hand, NeXT machines have RAMs at a region from 0x4000
to below (i.e. to larger address) so we still need a PA==KVA mapping.
However currently NetBSD/next68k just uses the transparent translation
registers to achieve the PA==KVA mapping, so unlike hp300 we don't have
to prepare special segment table and page table for it.

Note many other m68k ports (like luna68k, news68k, x68k etc.) have
RAMs at a region from 0x so usually we can assume PA==KVA
and don't have to bother to prepare such speicial mappings.

No user visible changes (except now freed wasted pages for the tables).
Tested on my NeXTstation slab.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/include/param.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/next68k/include/vmparam.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/next68k/next68k/pmap_bootstrap.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/next68k/include/param.h
diff -u src/sys/arch/next68k/include/param.h:1.12 src/sys/arch/next68k/include/param.h:1.13
--- src/sys/arch/next68k/include/param.h:1.12	Fri Feb 10 17:35:48 2012
+++ src/sys/arch/next68k/include/param.h	Sat Feb  4 08:42:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.12 2012/02/10 17:35:48 para Exp $	*/
+/*	$NetBSD: param.h,v 1.13 2023/02/04 08:42:45 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #define	PGSHIFT		12		/* LOG2(NBPG) */
 #define	KERNBASE	0x	/* start of kernel virtual */
 
-#define	UPAGES		3  		/* pages of u-area */
+#define	UPAGES		2  		/* pages of u-area */
 
 #include 
 

Index: src/sys/arch/next68k/include/vmparam.h
diff -u src/sys/arch/next68k/include/vmparam.h:1.28 src/sys/arch/next68k/include/vmparam.h:1.29
--- src/sys/arch/next68k/include/vmparam.h:1.28	Sun Dec  5 04:54:21 2021
+++ src/sys/arch/next68k/include/vmparam.h	Sat Feb  4 08:42:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.28 2021/12/05 04:54:21 msaitoh Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.29 2023/02/04 08:42:45 tsutsui Exp $	*/
 
 /*
  * This file was taken from mvme68k/include/vmparam.h and
@@ -59,16 +59,8 @@
 
 /*
  * USRSTACK is the top (end) of the user stack.
- *
- * NOTE: the ONLY reason that HIGHPAGES is 0x100 instead of UPAGES (3)
- * is for HPUX compatibility.  Why??  Because HPUX's debuggers
- * have the user's stack hard-wired at FFF0 for post-mortems,
- * and we must be compatible...
- */
-#define	USRSTACK	(-HIGHPAGES*PAGE_SIZE)	/* Start of user stack */
-#define	BTOPUSRSTACK	(0x10-HIGHPAGES)	/* btop(USRSTACK) */
-#define	P1PAGES		0x10
-#define	HIGHPAGES	(0x10/PAGE_SIZE)
+ */
+#define	USRSTACK	VM_MAXUSER_ADDRESS	/* Start of user stack */
 
 /*
  * Virtual memory related constants, all in bytes
@@ -106,7 +98,7 @@
 #define VM_MAXUSER_ADDRESS	((vaddr_t)0xFFF0)
 #define VM_MAX_ADDRESS		((vaddr_t)0xFFF0)
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t)0)
-#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)(0-PAGE_SIZE*NPTEPG*2))
+#define VM_MAX_KERNEL_ADDRESS	((vaddr_t)(0-PAGE_SIZE*NPTEPG))
 
 /* virtual sizes (bytes) for various kernel submaps */
 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
@@ -131,4 +123,4 @@ struct pmap_physseg {
 	struct pv_header *pvheader;	/* pv table for this seg */
 };
 
-#endif /* _MVME68K_VMPARAM_H_ */
+#endif /* _NEXT68K_VMPARAM_H_ */

Index: src/sys/arch/next68k/next68k/locore.s
diff -u src/sys/arch/next68k/next68k/locore.s:1.70 src/sys/arch/next68k/next68k/locore.s:1.71
--- src/sys/arch/next68k/next68k/locore.s:1.70	Sat Feb  4 07:07:41 2023
+++ src/sys/arch/next68k/next68k/locore.s	Sat Feb  4 08:42:45 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.70 2023/02/04 07:07:41 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.71 2023/02/04 08:42:45 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -320,11 +320,11 @@ Lstart3:
  * Prepare to enable MMU.
  * Since the kernel is not mapped logical == physical we must insure
  * that when the MMU is turned on, all prefetched addresses (including
- * the PC) are valid.  In order guarantee 

CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 07:07:41 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: locore.s

Log Message:
Remove #ifdef'ed out hp300 specific stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/next68k/locore.s

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



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 07:07:41 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: locore.s

Log Message:
Remove #ifdef'ed out hp300 specific stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/next68k/locore.s

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/next68k/next68k/locore.s
diff -u src/sys/arch/next68k/next68k/locore.s:1.69 src/sys/arch/next68k/next68k/locore.s:1.70
--- src/sys/arch/next68k/next68k/locore.s:1.69	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/locore.s	Sat Feb  4 07:07:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.69 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.70 2023/02/04 07:07:41 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -229,10 +229,6 @@ Lnot68030:
 	movl	#CPU_68040,%a0@		| and a 68040 CPU
 	RELOC(fputype, %a0)
 	movl	#FPU_68040,%a0@		| ...and FPU
-#if defined(ENABLE_HP_CODE)
-	RELOC(ectype, %a0)
-	movl	#EC_NONE,%a0@		| and no cache (for now XXX)
-#endif
 	RELOC(machineid, %a0)
 	movl	#40,%a0@		| @@@ useless
 	jra	Lstart1
@@ -334,10 +330,6 @@ Lstart3:
 	movl	%a0@,%d1		| read value (a PA)
 
 	RELOC(mmutype, %a0)
-#if defined(ENABLE_HP_CODE)
-	tstl	%a0@			| HP MMU?
-	jeq	Lhpmmu2			| yes, skip
-#endif
 	cmpl	#MMU_68040,%a0@		| 68040?
 	jne	Lmotommu1		| no, skip
 	.long	0x4e7b1807		| movc %d1,%srp
@@ -349,31 +341,7 @@ Lmotommu1:
 	pmove	%a0@,%srp		| load the supervisor root pointer
 	movl	#0x8002,%a0@	| reinit upper half for CRP loads
 
-#if defined(ENABLE_HP_CODE)
-	jra	Lstploaddone		| done
-Lhpmmu2:
-	moveq	#PGSHIFT,%d2
-	lsrl	%d2,%d1			| convert to page frame
-	movl	%d1,INTIOBASE+MMUBASE+MMUSSTP | load in sysseg table register
-#endif
 Lstploaddone:
-#if defined(ENABLE_MAXADDR_TRAMPOLINE)
-	lea	MAXADDR,%a2		| PA of last RAM page
-	ASRELOC(Lhighcode, %a1)		| addr of high code
-	ASRELOC(Lehighcode, %a3)	| end addr
-Lcodecopy:
-	movw	%a1@+,%a2@+		| copy a word
-	cmpl	%a3,%a1			| done yet?
-	jcs	Lcodecopy		| no, keep going
-	jmp	MAXADDR			| go for it!
-	/*
-	 * BEGIN MMU TRAMPOLINE.  This section of code is not
-	 * executed in-place.  It's copied to the last page
-	 * of RAM (mapped va == pa) and executed there.
-	 */
-
-Lhighcode:
-#endif /* ENABLE_MAXADDR_TRAMPOLINE */
 
 	/*
 	 * Set up the vector table, and race to get the MMU
@@ -387,17 +355,8 @@ Lhighcode:
 	movc	%d0,%vbr
 
 	RELOC(mmutype, %a0)
-#if defined(ENABLE_HP_CODE)
-	tstl	%a0@			| HP MMU?
-	jeq	Lhpmmu3			| yes, skip
-#endif
 	cmpl	#MMU_68040,%a0@		| 68040?
 	jne	Lmotommu2		| no, skip
-#if defined(ENABLE_HP_CODE)
-	movw	#0,INTIOBASE+MMUBASE+MMUCMD+2
-	movw	#MMU_IEN+MMU_CEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD+2
-	| enable FPU and caches
-#endif
 
 	| This is a hack to get PA=KVA when turning on MMU
 	| it will only work on 68040's.  We should fix something
@@ -425,28 +384,11 @@ Lturnoffttr:
 	.long	0x4e7b0007		| movc %d0,%dtt1
 	jmp	Lenab1
 Lmotommu2:
-#if defined(ENABLE_HP_CODE)
-	movl	#MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD
-	| enable 68881 and i-cache
-#endif
 	pflusha
 	RELOC(prototc, %a2)
 	movl	#0x82c0aa00,%a2@	| value to load TC with
 	pmove	%a2@,%tc		| load it
 	jmp	Lenab1:l		| force absolute (not pc-relative) jmp
-#if defined(ENABLE_HP_CODE)
-Lhpmmu3:
-	movl	#0,INTIOBASE+MMUBASE+MMUCMD	| clear external cache
-	movl	#MMU_ENAB,INTIOBASE+MMUBASE+MMUCMD | turn on MMU
-	jmp	Lenab1:l			| jmp to mapped code
-#endif
-#if defined(ENABLE_MAXADDR_TRAMPOLINE)
-Lehighcode:
-
-	/*
-	 * END MMU TRAMPOLINE.  Address register %a5 is now free.
-	 */
-#endif
 
 /*
  * Should be running mapped from this point on
@@ -941,24 +883,6 @@ Lsldone:
 	rts
 #endif
 
-#if defined(ENABLE_HP_CODE)
-ENTRY(ecacheon)
-	tstl	_C_LABEL(ectype)
-	jeq	Lnocache7
-	MMUADDR(%a0)
-	orl	#MMU_CEN,%a0@(MMUCMD)
-Lnocache7:
-	rts
-
-ENTRY(ecacheoff)
-	tstl	_C_LABEL(ectype)
-	jeq	Lnocache8
-	MMUADDR(%a0)
-	andl	#~MMU_CEN,%a0@(MMUCMD)
-Lnocache8:
-	rts
-#endif
-
 /*
  * Load a new user segment table pointer.
  */
@@ -1137,11 +1061,6 @@ GLOBAL(mmutype)
 GLOBAL(cputype)
 	.long	0xdeadbeef	| default to 68020 CPU
 
-#if defined(ENABLE_HP_CODE)
-GLOBAL(ectype)
-	.long	EC_NONE		| external cache type, default to none
-#endif
-
 GLOBAL(fputype)
 	.long	0xdeadbeef	| default to 68882 FPU
 
@@ -1175,20 +1094,6 @@ ASLOCAL(save_vbr)		| VBR from ROM
 GLOBAL(monbootflag)
 	.long 0
 
-#if defined(ENABLE_HP_CODE)
-GLOBAL(extiobase)
-	.long	0		| KVA of base of external IO space
-
-GLOBAL(CLKbase)
-	.long	0		| KVA of base of clock registers
-
-GLOBAL(MMUbase)
-	.long	0		| KVA of base of HP MMU registers
-
-GLOBAL(pagezero)
-	.long	0		| PA of first page of kernel text
-#endif
-
 #ifdef USELEDS
 ASLOCAL(heartbeat)
 	.long	0		| clock ticks since last pulse of heartbeat



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 02:08:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: disksubr.c

Log Message:
Misc KNF and cleanup.


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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb  4 02:08:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: disksubr.c

Log Message:
Misc KNF and cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/next68k/next68k/disksubr.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/next68k/next68k/disksubr.c
diff -u src/sys/arch/next68k/next68k/disksubr.c:1.31 src/sys/arch/next68k/next68k/disksubr.c:1.32
--- src/sys/arch/next68k/next68k/disksubr.c:1.31	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/next68k/disksubr.c	Sat Feb  4 02:08:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.31 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.32 2023/02/04 02:08:03 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.31 2023/02/03 23:13:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.32 2023/02/04 02:08:03 tsutsui Exp $");
 
 #include 
 #include 
@@ -76,23 +76,23 @@ parse_nextstep_label(struct next68k_disk
 struct cpu_disklabel *osdep)
 {
 	int i, t, nbp;
-	unsigned short *checksum;
+	uint16_t *checksum;
 
 	if (ondisk->cd_version == NEXT68K_LABEL_CD_V3) {
 		checksum = >NEXT68K_LABEL_cd_v3_checksum;
 	} else {
 		checksum = >NEXT68K_LABEL_cd_checksum;
 	}
-	if (nextstep_checksum ((unsigned char *)ondisk,
-			   (unsigned char *)checksum) != *checksum) {
-		return ("disk label corrupted");
+	if (nextstep_checksum((uint8_t *)ondisk, (uint8_t *)checksum) !=
+	*checksum) {
+		return "disk label corrupted";
 	}
 
 	osdep->od_version = ondisk->cd_version;
 	lp->d_magic = lp->d_magic2 = DISKMAGIC;
 	lp->d_type = DKTYPE_SCSI;
 	lp->d_subtype = 0;
-	if (sizeof (lp->d_typename) > sizeof(ondisk->cd_name))
+	if (sizeof(lp->d_typename) > sizeof(ondisk->cd_name))
 		lp->d_typename[sizeof (ondisk->cd_name)] = '\0';
 	memcpy(lp->d_typename, ondisk->cd_name,
 	uimin(sizeof (lp->d_typename), sizeof(ondisk->cd_name)));
@@ -171,7 +171,6 @@ build_nextstep_label(struct next68k_disk
 	int front_porch = NEXT68K_LABEL_DEFAULTFRONTPORCH;
 	uint16_t *checksum;
 
-
 	memset(ondisk, 0, sizeof(*ondisk));
 
 	ondisk->cd_version = NEXT68K_LABEL_CD_V3;
@@ -213,7 +212,7 @@ build_nextstep_label(struct next68k_disk
 
 	/*
 	 * figure out front porch
-	 * try to map partitions which were moved 
+	 * try to map partitions which were moved
 	 */
 	for (nbp = 0; nbp < lp->d_npartitions; nbp++) {
 		if (nbp != RAW_PART && lp->d_partitions[nbp].p_offset > 0 &&
@@ -230,12 +229,12 @@ build_nextstep_label(struct next68k_disk
 			 (ondisk->cd_secsize / lp->d_secsize)) &&
 			((lp->d_partitions[nbp].p_fstype == FS_OTHER) ||
 			 (!strncmp (ondisk->cd_partitions[t].cp_type,
- fstypenames[lp->d_partitions[nbp].p_fstype], 
+ fstypenames[lp->d_partitions[nbp].p_fstype],
  NEXT68K_LABEL_MAXFSTLEN {
 struct next68k_partition tmp;
-memcpy(, >cd_partitions[t], 
+memcpy(, >cd_partitions[t],
 sizeof(tmp));
-memcpy(>cd_partitions[t], 
+memcpy(>cd_partitions[t],
 >cd_partitions[nbp > RAW_PART ?
 nbp - 1 : nbp],
 sizeof (tmp));
@@ -247,7 +246,7 @@ build_nextstep_label(struct next68k_disk
 	}
 	front_porch /= (ondisk->cd_secsize / lp->d_secsize);
 
-	/* 
+	/*
 	 * update partitions
 	 */
 	nbp = 0;
@@ -279,7 +278,7 @@ build_nextstep_label(struct next68k_disk
 			p->cp_offset = -1;
 			p->cp_bsize = -1;
 			p->cp_fsize = -1;
-			p->cp_density = -1; 
+			p->cp_density = -1;
 			p->cp_minfree = -1;
 		}
 		nbp++;
@@ -422,7 +421,7 @@ writedisklabel(dev_t dev, void (*strat)(
 	 * We always write a NeXT v3 disklabel, and a NetBSD disklabel in
 	 * the last sector of the NeXT label area.
 	 */
-  
+
 	bp = geteblk(NEXT68K_LABEL_SIZE);
 	bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), labelpart);
 	bp->b_blkno = NEXT68K_LABEL_SECTOR;



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:22:34 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: mainbus.c

Log Message:
Misc KNF and cosmetics.


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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:22:34 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: mainbus.c

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/mainbus.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/next68k/next68k/mainbus.c
diff -u src/sys/arch/next68k/next68k/mainbus.c:1.13 src/sys/arch/next68k/next68k/mainbus.c:1.14
--- src/sys/arch/next68k/next68k/mainbus.c:1.13	Sat Aug  7 16:19:01 2021
+++ src/sys/arch/next68k/next68k/mainbus.c	Fri Feb  3 23:22:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.13 2021/08/07 16:19:01 thorpej Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.14 2023/02/03 23:22:34 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.13 2021/08/07 16:19:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.14 2023/02/03 23:22:34 tsutsui Exp $");
 
 #include 
 #include 
@@ -73,9 +73,10 @@ static int mainbus_attached = 0;
 static int
 mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
+
 	/* Allow only one instance. */
 	if (mainbus_attached)
-		return (0);
+		return 0;
 
 	return 1;
 }
@@ -83,7 +84,7 @@ mainbus_match(device_t parent, cfdata_t 
 static void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct mainbus_attach_args	mba;
+	struct mainbus_attach_args mba;
 
 	printf("\n");
 
@@ -97,9 +98,9 @@ mainbus_attach(device_t parent, device_t
 }
 
 static int
-mainbus_search(device_t parent, cfdata_t cf,
-	   const int *ldesc, void *aux)
+mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
+
 	if (config_probe(parent, cf, aux))
 		config_attach(parent, cf, aux, NULL, CFARGS_NONE);
 	return 0;



CVS commit: src/sys/arch/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:21:18 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: machdep.c

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/next68k/next68k/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/arch/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:21:18 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdisplay.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: machdep.c

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/next68k/next68k/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/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.26 src/sys/arch/next68k/dev/nextdisplay.c:1.27
--- src/sys/arch/next68k/dev/nextdisplay.c:1.26	Fri Feb  3 23:13:00 2023
+++ src/sys/arch/next68k/dev/nextdisplay.c	Fri Feb  3 23:21:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.26 2023/02/03 23:13:00 tsutsui Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.26 2023/02/03 23:13:00 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.27 2023/02/03 23:21:17 tsutsui Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -197,7 +197,7 @@ nextdisplay_init(struct nextdisplay_conf
 #endif
 
 	/* clear the screen */
-	for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
+	for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(uint32_t))
 		*(uint32_t *)(dc->dc_videobase + i) =
 		color ? 0x0 : 0x;
 
@@ -205,7 +205,7 @@ nextdisplay_init(struct nextdisplay_conf
 	rap->width = dc->dc_wid;
 	rap->height = dc->dc_ht;
 	rap->depth = color ? 16 : 2;
-	rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
+	rap->linelongs = dc->dc_rowbytes / sizeof(uint32_t);
 	rap->pixels = (uint32_t *)dc->dc_videobase;
 
 	/* initialize the raster console blitter */

Index: src/sys/arch/next68k/include/bus_space.h
diff -u src/sys/arch/next68k/include/bus_space.h:1.21 src/sys/arch/next68k/include/bus_space.h:1.22
--- src/sys/arch/next68k/include/bus_space.h:1.21	Fri Feb  3 23:13:01 2023
+++ src/sys/arch/next68k/include/bus_space.h	Fri Feb  3 23:21:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.h,v 1.21 2023/02/03 23:13:01 tsutsui Exp $	*/
+/*	$NetBSD: bus_space.h,v 1.22 2023/02/03 23:21:18 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -131,7 +131,7 @@ typedef u_long	bus_space_handle_t;
 		m68k_btop((t)+((a)-COLORBASE)) : (-1
 
 /*
- *	u_intN_t bus_space_read_N(bus_space_tag_t tag,
+ *	uintN_t bus_space_read_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset);
  *
  * Read a 1, 2, 4, or 8 byte quantity from bus space
@@ -139,18 +139,18 @@ typedef u_long	bus_space_handle_t;
  */
 
 #define	bus_space_read_1(t, h, o)	\
-((void) t, (*(volatile u_int8_t *)((h) + (o
+((void) t, (*(volatile uint8_t *)((h) + (o
 
 #define	bus_space_read_2(t, h, o)	\
-((void) t, (*(volatile u_int16_t *)((h) + (o
+((void) t, (*(volatile uint16_t *)((h) + (o
 
 #define	bus_space_read_4(t, h, o)	\
-((void) t, (*(volatile u_int32_t *)((h) + (o
+((void) t, (*(volatile uint32_t *)((h) + (o
 
 /*
  *	void bus_space_read_multi_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t *addr, size_t count);
+ *	uintN_t *addr, size_t count);
  *
  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  * described by tag/handle/offset and copy into buffer provided.
@@ -201,7 +201,7 @@ typedef u_long	bus_space_handle_t;
 /*
  *	void bus_space_read_region_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t *addr, size_t count);
+ *	uintN_t *addr, size_t count);
  *
  * Read `count' 1, 2, 4, or 8 byte quantities from bus space
  * described by tag/handle and starting at `offset' and copy into
@@ -253,25 +253,25 @@ typedef u_long	bus_space_handle_t;
 /*
  *	void bus_space_write_N(bus_space_tag_t tag,
  *	bus_space_handle_t bsh, bus_size_t offset,
- *	u_intN_t value);
+ *	uintN_t value);
  *
  * Write the 1, 2, 4, or 8 byte value `value' to bus space
  * described by tag/handle/offset.
  */
 
 #define	bus_space_write_1(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int8_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint8_t *)((h) + (o)) = (v
 
 #define	bus_space_write_2(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int16_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint16_t *)((h) + (o)) = (v
 
 #define	bus_space_write_4(t, h, o, v)	\
-((void) t, ((void)(*(volatile u_int32_t *)((h) + (o)) = (v
+((void) t, ((void)(*(volatile uint32_t *)((h) + (o)) = (v
 
 /*
  *	void 

CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:19:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Use proper LIST(3) macro.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/next68k/next68k/isr.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/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:19:03 UTC 2023

Modified Files:
src/sys/arch/next68k/next68k: isr.c

Log Message:
Use proper LIST(3) macro.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/next68k/next68k/isr.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/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.32 src/sys/arch/next68k/next68k/isr.c:1.33
--- src/sys/arch/next68k/next68k/isr.c:1.32	Fri Apr  2 12:11:41 2021
+++ src/sys/arch/next68k/next68k/isr.c	Fri Feb  3 23:19:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.32 2021/04/02 12:11:41 rin Exp $ */
+/*	$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $ */
 
 /*
  * This file was taken from mvme68k/mvme68k/isr.c
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.32 2021/04/02 12:11:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.33 2023/02/03 23:19:03 tsutsui Exp $");
 
 #include 
 #include 
@@ -146,7 +146,7 @@ isrlink_autovec(int (*func)(void *), voi
 	 * at the head of the list.
 	 */
 	list = _autovec[ipl];
-	if (list->lh_first == NULL) {
+	if (LIST_FIRST(list) == NULL) {
 		LIST_INSERT_HEAD(list, newisr, isr_link);
 		return;
 	}
@@ -156,8 +156,8 @@ isrlink_autovec(int (*func)(void *), voi
 	 * and place ourselves after any ISRs with our current (or
 	 * higher) priority.
 	 */
-	for (curisr = list->lh_first; curisr->isr_link.le_next != NULL;
-	curisr = curisr->isr_link.le_next) {
+	for (curisr = LIST_FIRST(list); LIST_NEXT(curisr, isr_link) != NULL;
+	curisr = LIST_NEXT(curisr, isr_link)) {
 		if (newisr->isr_priority > curisr->isr_priority) {
 			LIST_INSERT_BEFORE(curisr, newisr, isr_link);
 			return;
@@ -281,7 +281,7 @@ isrdispatch_autovec(struct clockframe *f
 #endif
 
 	list = _autovec[ipl];
-	if (list->lh_first == NULL) {
+	if (LIST_FIRST(list) == NULL) {
 		printf("isrdispatch_autovec: ipl %d unexpected\n", ipl);
 		if (++unexpected > 10)
 			panic("too many unexpected interrupts");
@@ -291,7 +291,8 @@ isrdispatch_autovec(struct clockframe *f
 
 	/* Give all the handlers a chance. */
 	handled = 0;
-	for (isr = list->lh_first ; isr != NULL; isr = isr->isr_link.le_next) {
+	for (isr = LIST_FIRST(list); isr != NULL;
+	isr = LIST_NEXT(isr, isr_link)) {
 		arg = isr->isr_arg ? isr->isr_arg : frame;
 		if ((*isr->isr_func)(arg) != 0) {
 			if (isr->isr_evcnt)



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:17:49 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:17:49 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
Make local functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/next68k/dev/esp.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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.66 src/sys/arch/next68k/dev/esp.c:1.67
--- src/sys/arch/next68k/dev/esp.c:1.66	Fri Feb  3 23:16:07 2023
+++ src/sys/arch/next68k/dev/esp.c	Fri Feb  3 23:17:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $	*/
+/*	$NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.67 2023/02/03 23:17:49 tsutsui Exp $");
 
 #include 
 #include 
@@ -126,13 +126,13 @@ int esp_debug = 0;
 #define PRINTF(x) printf x;
 
 
-int	espmatch_intio(device_t, cfdata_t, void *);
-void	espattach_intio(device_t, device_t, void *);
+static int espmatch_intio(device_t, cfdata_t, void *);
+static void espattach_intio(device_t, device_t, void *);
 
 /* DMA callbacks */
-bus_dmamap_t esp_dmacb_continue(void *);
-void esp_dmacb_completed(bus_dmamap_t, void *);
-void esp_dmacb_shutdown(void *);
+static bus_dmamap_t esp_dmacb_continue(void *);
+static void esp_dmacb_completed(bus_dmamap_t, void *);
+static void esp_dmacb_shutdown(void *);
 
 static void findchannel_defer(device_t);
 
@@ -155,18 +155,20 @@ static int attached = 0;
 /*
  * Functions and the switch for the MI code.
  */
-uint8_t	esp_read_reg(struct ncr53c9x_softc *, int);
-void	esp_write_reg(struct ncr53c9x_softc *, int, uint8_t);
-int	esp_dma_isintr(struct ncr53c9x_softc *);
-void	esp_dma_reset(struct ncr53c9x_softc *);
-int	esp_dma_intr(struct ncr53c9x_softc *);
-int	esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int,
-	size_t *);
-void	esp_dma_go(struct ncr53c9x_softc *);
-void	esp_dma_stop(struct ncr53c9x_softc *);
-int	esp_dma_isactive(struct ncr53c9x_softc *);
+static uint8_t esp_read_reg(struct ncr53c9x_softc *, int);
+static void esp_write_reg(struct ncr53c9x_softc *, int, uint8_t);
+static int esp_dma_isintr(struct ncr53c9x_softc *);
+static void esp_dma_reset(struct ncr53c9x_softc *);
+static int esp_dma_intr(struct ncr53c9x_softc *);
+static int esp_dma_setup(struct ncr53c9x_softc *, uint8_t **, size_t *, int,
+size_t *);
+static void esp_dma_go(struct ncr53c9x_softc *);
+static void esp_dma_stop(struct ncr53c9x_softc *);
+static int esp_dma_isactive(struct ncr53c9x_softc *);
 
-struct ncr53c9x_glue esp_glue = {
+static int doze(volatile int);
+
+static struct ncr53c9x_glue esp_glue = {
 	.gl_read_reg = esp_read_reg,
 	.gl_write_reg = esp_write_reg,
 	.gl_dma_isintr = esp_dma_isintr,
@@ -215,7 +217,7 @@ esp_hex_dump(unsigned char *pkt, size_t 
 }
 #endif
 
-int
+static int
 espmatch_intio(device_t parent, cfdata_t cf, void *aux)
 {
 	struct intio_attach_args *ia = aux;
@@ -286,7 +288,7 @@ findchannel_defer(device_t self)
 	device_xname(esc->sc_dma->sc_dev));
 }
 
-void
+static void
 espattach_intio(device_t parent, device_t self, void *aux)
 {
 	struct esp_softc *esc = device_private(self);
@@ -417,7 +419,7 @@ espattach_intio(device_t parent, device_
  * Glue functions.
  */
 
-uint8_t
+static uint8_t
 esp_read_reg(struct ncr53c9x_softc *sc, int reg)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -425,7 +427,7 @@ esp_read_reg(struct ncr53c9x_softc *sc, 
 	return bus_space_read_1(esc->sc_bst, esc->sc_bsh, reg);
 }
 
-void
+static void
 esp_write_reg(struct ncr53c9x_softc *sc, int reg, uint8_t val)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -436,8 +438,7 @@ esp_write_reg(struct ncr53c9x_softc *sc,
 volatile uint32_t save1;
 
 #define xADDR 0x0211a000
-int doze(volatile int);
-int
+static int
 doze(volatile int c)
 {
 #if 0
@@ -464,7 +465,7 @@ doze(volatile int c)
 	return 0;
 }
 
-int
+static int
 esp_dma_isintr(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -480,7 +481,7 @@ esp_dma_isintr(struct ncr53c9x_softc *sc
 	}
 }
 
-int
+static int
 esp_dma_intr(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -746,7 +747,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 	return r;
 }
 
-void
+static void
 esp_dma_reset(struct ncr53c9x_softc *sc)
 {
 	struct esp_softc *esc = (struct esp_softc *)sc;
@@ -808,7 +809,7 @@ esp_dma_reset(struct ncr53c9x_softc *sc)
  * (len may be > maxxfer)
  */
 
-int
+static int
 esp_dma_setup(struct ncr53c9x_softc *sc, uint8_t **addr, size_t *len,
 int datain, size_t *dmasize)
 {
@@ -1277,7 +1278,7 @@ esp_dma_print(struct ncr53c9x_softc *sc)
 }
 #endif
 
-void
+static void
 esp_dma_go(struct 

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:16:07 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c espreg.h espvar.h

Log Message:
Misc cleanup.

- use C99 designated initializer
- misc KNF
- TAB/space cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.65 src/sys/arch/next68k/dev/esp.c:1.66
--- src/sys/arch/next68k/dev/esp.c:1.65	Fri Jan 27 15:31:05 2023
+++ src/sys/arch/next68k/dev/esp.c	Fri Feb  3 23:16:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $	*/
+/*	$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.66 2023/02/03 23:16:07 tsutsui Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ bus_dmamap_t esp_dmacb_continue(void *);
 void esp_dmacb_completed(bus_dmamap_t, void *);
 void esp_dmacb_shutdown(void *);
 
-static void	findchannel_defer(device_t);
+static void findchannel_defer(device_t);
 
 #ifdef ESP_DEBUG
 char esp_dma_dump[5*1024] = "";
@@ -167,18 +167,23 @@ void	esp_dma_stop(struct ncr53c9x_softc 
 int	esp_dma_isactive(struct ncr53c9x_softc *);
 
 struct ncr53c9x_glue esp_glue = {
-	esp_read_reg,
-	esp_write_reg,
-	esp_dma_isintr,
-	esp_dma_reset,
-	esp_dma_intr,
-	esp_dma_setup,
-	esp_dma_go,
-	esp_dma_stop,
-	esp_dma_isactive,
-	NULL,			/* gl_clear_latched_intr */
+	.gl_read_reg = esp_read_reg,
+	.gl_write_reg = esp_write_reg,
+	.gl_dma_isintr = esp_dma_isintr,
+	.gl_dma_reset = esp_dma_reset,
+	.gl_dma_intr = esp_dma_intr,
+	.gl_dma_setup = esp_dma_setup,
+	.gl_dma_go = esp_dma_go,
+	.gl_dma_stop = esp_dma_stop,
+	.gl_dma_isactive = esp_dma_isactive,
+	.gl_clear_latched_intr = NULL
 };
 
+#define nd_bsr4(reg) \
+	bus_space_read_4(nsc->sc_bst, nsc->sc_bsh, (reg))
+#define nd_bsw4(reg, val) \
+	bus_space_write_4(nsc->sc_bst, nsc->sc_bsh, (reg), (val))
+
 #ifdef ESP_DEBUG
 #define XCHR(x) hexdigits[(x) & 0xf]
 static void
@@ -188,18 +193,22 @@ esp_hex_dump(unsigned char *pkt, size_t 
 
 	printf("  ");
 	for(i = 0; i < len; i++) {
-		printf("%c%c ", XCHR(pkt[i]>>4), XCHR(pkt[i]));
+		printf("%c%c ", XCHR(pkt[i] >> 4), XCHR(pkt[i]));
 		if ((i + 1) % 16 == 8) {
 			printf(" ");
 		}
 		if ((i + 1) % 16 == 0) {
 			printf(" %c", '|');
 			for(j = 0; j < 16; j++) {
-printf("%c", pkt[i-15+j]>=32 && pkt[i-15+j]<127?pkt[i-15+j]:'.');
+printf("%c", pkt[i - 15 + j] >= 32 &&
+pkt[i - 15 + j] < 127 ?
+pkt[i - 15 + j] : '.');
 			}
-			printf("%c\n%c%c%c%c%c%c%c%c  ", '|', 
-	XCHR((i+1)>>28),XCHR((i+1)>>24),XCHR((i+1)>>20),XCHR((i+1)>>16),
-	XCHR((i+1)>>12), XCHR((i+1)>>8), XCHR((i+1)>>4), XCHR(i+1));
+			printf("%c\n%c%c%c%c%c%c%c%c  ", '|',
+			XCHR((i + 1) >> 28), XCHR((i + 1) >> 24),
+			XCHR((i + 1) >> 20), XCHR((i + 1) >> 16),
+			XCHR((i + 1) >> 12), XCHR((i + 1) >>  8),
+			XCHR((i + 1) >>  4), XCHR(i + 1));
 		}
 	}
 	printf("\n");
@@ -226,10 +235,10 @@ findchannel_defer(device_t self)
 	struct ncr53c9x_softc *sc = >sc_ncr53c9x;
 	int error;
 
-	if (!esc->sc_dma) {
+	if (esc->sc_dma == NULL) {
 		aprint_normal("%s", device_xname(sc->sc_dev));
 		esc->sc_dma = nextdma_findchannel("scsi");
-		if (!esc->sc_dma)
+		if (esc->sc_dma == NULL)
 			panic("%s: can't find DMA channel",
 			   device_xname(sc->sc_dev));
 	}
@@ -240,23 +249,21 @@ findchannel_defer(device_t self)
 	nextdma_setconf(esc->sc_dma, cb_arg, sc);
 
 	error = bus_dmamap_create(esc->sc_dma->sc_dmat,
-  sc->sc_maxxfer,
-  sc->sc_maxxfer / PAGE_SIZE + 1,
-  sc->sc_maxxfer,
-  0, BUS_DMA_ALLOCNOW, >sc_main_dmamap);
-	if (error) {
+	sc->sc_maxxfer, sc->sc_maxxfer / PAGE_SIZE + 1, sc->sc_maxxfer,
+	0, BUS_DMA_ALLOCNOW, >sc_main_dmamap);
+	if (error != 0) {
 		panic("%s: can't create main i/o DMA map, error = %d",
-		  device_xname(sc->sc_dev), error);
+		device_xname(sc->sc_dev), error);
 	}
 
 	error = bus_dmamap_create(esc->sc_dma->sc_dmat,
-  ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE,
-  0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap);
-	if (error) {
+	ESP_DMA_TAILBUFSIZE, 1, ESP_DMA_TAILBUFSIZE,
+	0, BUS_DMA_ALLOCNOW, >sc_tail_dmamap);
+	if (error != 0) {
 		panic("%s: can't create tail i/o DMA map, error = %d",
-		  device_xname(sc->sc_dev), error);
+		device_xname(sc->sc_dev), error);
 	}
-	
+
 #if 0
 	/* Turn on target selection using the `DMA' method */
 	sc->sc_features |= NCR_F_DMASELECT;
@@ -273,7 +280,7 @@ findchannel_defer(device_t self)
 
 	

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:16:07 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c espreg.h espvar.h

Log Message:
Misc cleanup.

- use C99 designated initializer
- misc KNF
- TAB/space cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/esp.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/next68k/dev/espreg.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/dev/espvar.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/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:13:01 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c nextcons.c nextdisplay.c
nextdisplayvar.h nextkbd.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: autoconf.c clock.c disksubr.c locore.s
rtc.c trap.c vectors.s

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/autoconf.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/disksubr.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/next68k/rtc.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/vectors.s

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/next68k/dev/intio.c
diff -u src/sys/arch/next68k/dev/intio.c:1.16 src/sys/arch/next68k/dev/intio.c:1.17
--- src/sys/arch/next68k/dev/intio.c:1.16	Sat Aug  7 16:19:01 2021
+++ src/sys/arch/next68k/dev/intio.c	Fri Feb  3 23:13:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $	*/
+/*	$NetBSD: intio.c,v 1.17 2023/02/03 23:13:00 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.16 2021/08/07 16:19:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.17 2023/02/03 23:13:00 tsutsui Exp $");
 
 #include 
 #include 
@@ -53,12 +53,6 @@ int	intiosearch(device_t, cfdata_t, cons
 CFATTACH_DECL_NEW(intio, 0,
 intiomatch, intioattach, NULL, NULL);
 
-#if 0
-struct cfdriver intio_cd = {
-	NULL, "intio", DV_DULL
-};
-#endif
-
 static bool intio_attached;
 
 int
@@ -66,9 +60,9 @@ intiomatch(device_t parent, cfdata_t mat
 {
 	/* Allow only one instance. */
 	if (intio_attached)
-		return (0);
+		return 0;
 
-	return (1);
+	return 1;
 }
 
 void
@@ -92,24 +86,24 @@ intioprint(void *aux, const char *pnp)
 	if (ia->ia_addr)
 		aprint_normal(" addr %p", ia->ia_addr);
 
-	return (UNCONF);
+	return UNCONF;
 }
 
 int
 intiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct mainbus_attach_args *mba = (struct mainbus_attach_args *) aux;
+	struct mainbus_attach_args *mba = aux;
 	struct intio_attach_args ia;
 
 	do {
 		ia.ia_addr = NULL;
 		ia.ia_bst = NEXT68K_INTIO_BUS_SPACE;
 		ia.ia_dmat = mba->mba_dmat;
-		
+
 		if (!config_probe(parent, cf, ))
 			break;
 		config_attach(parent, cf, , intioprint, CFARGS_NONE);
 	} while (cf->cf_fstate == FSTATE_STAR);
 
-	return (0);
+	return 0;
 }

Index: src/sys/arch/next68k/dev/nextcons.c
diff -u src/sys/arch/next68k/dev/nextcons.c:1.11 src/sys/arch/next68k/dev/nextcons.c:1.12
--- src/sys/arch/next68k/dev/nextcons.c:1.11	Sat Apr 24 19:58:13 2010
+++ src/sys/arch/next68k/dev/nextcons.c	Fri Feb  3 23:13:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $	*/
+/*	$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1999 Darrin B. Jewell
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.11 2010/04/24 19:58:13 dbj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextcons.c,v 1.12 2023/02/03 23:13:00 tsutsui Exp $");
 
 #include 
 #include 
@@ -63,11 +63,11 @@ void
 nextcnprobe(struct consdev *cp)
 {
 
-	if ((rom_machine_type == NeXT_WARP9)
-	|| (rom_machine_type == NeXT_X15)
-	|| (rom_machine_type == NeXT_WARP9C)
-	|| (rom_machine_type == NeXT_TURBO_MONO)
-	|| (rom_machine_type == NeXT_TURBO_COLOR))
+	if (rom_machine_type == NeXT_WARP9 ||
+	rom_machine_type == NeXT_X15 ||
+	rom_machine_type == NeXT_WARP9C ||
+	rom_machine_type == NeXT_TURBO_MONO ||
+	rom_machine_type == NeXT_TURBO_COLOR)
 		cp->cn_pri = CN_INTERNAL;
 	else 
 		cp->cn_pri = CN_DEAD;
@@ -78,6 +78,7 @@ nextcnprobe(struct consdev *cp)
 void
 nextcninit(struct consdev *cp)
 {
+
 	nextkbd_cnattach(NEXT68K_INTIO_BUS_SPACE);
 	nextdisplay_cnattach();
 }
@@ -85,17 +86,20 @@ nextcninit(struct consdev *cp)
 int
 nextcngetc (dev_t dev)
 {
+
 	return wskbd_cngetc(dev);
 }
 
 void
 nextcnputc(dev_t dev, int c)
 {
-	wsdisplay_cnputc(dev,c);	
+
+	wsdisplay_cnputc(dev,c);
 }
 
 void
 nextcnpollc(dev_t dev, int on)
 {
+
 	wskbd_cnpollc(dev,on);
 }

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.25 

CVS commit: src/sys/arch/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:13:01 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: intio.c nextcons.c nextdisplay.c
nextdisplayvar.h nextkbd.c
src/sys/arch/next68k/include: bus_space.h
src/sys/arch/next68k/next68k: autoconf.c clock.c disksubr.c locore.s
rtc.c trap.c vectors.s

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/next68k/dev/intio.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/dev/nextcons.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/next68k/dev/nextdisplayvar.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/next68k/include/bus_space.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/next68k/autoconf.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/disksubr.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/next68k/locore.s
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/next68k/next68k/rtc.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/next68k/next68k/trap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/vectors.s

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



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:07:47 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove trailing TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/next68k/conf/SLAB

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/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.155 src/sys/arch/next68k/conf/GENERIC:1.156
--- src/sys/arch/next68k/conf/GENERIC:1.155	Fri Jan 27 15:36:58 2023
+++ src/sys/arch/next68k/conf/GENERIC	Fri Feb  3 23:07:47 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.155 2023/01/27 15:36:58 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.156 2023/02/03 23:07:47 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.155 $"
+#ident 		"GENERIC-$Revision: 1.156 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -213,7 +213,7 @@ uk*	at scsibus? target ? lun ?	# SCSI un
 
 
 # Memory-disk drivers
-pseudo-device	md		
+pseudo-device	md
 
 #
 # accept filters

Index: src/sys/arch/next68k/conf/SLAB
diff -u src/sys/arch/next68k/conf/SLAB:1.61 src/sys/arch/next68k/conf/SLAB:1.62
--- src/sys/arch/next68k/conf/SLAB:1.61	Thu Dec 22 11:05:55 2022
+++ src/sys/arch/next68k/conf/SLAB	Fri Feb  3 23:07:47 2023
@@ -1,4 +1,4 @@
-# $NetBSD: SLAB,v 1.61 2022/12/22 11:05:55 nat Exp $
+# $NetBSD: SLAB,v 1.62 2023/02/03 23:07:47 tsutsui Exp $
 #
 # deberg's development machine
 #
@@ -165,7 +165,7 @@ scsibus* at scsi?
 
 
 # Memory-disk drivers
-pseudo-device	md		
+pseudo-device	md
 
 # Misc.
 pseudo-device	loop			# network loopback



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:07:47 UTC 2023

Modified Files:
src/sys/arch/next68k/conf: GENERIC SLAB

Log Message:
Remove trailing TABs.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/arch/next68k/conf/GENERIC
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/next68k/conf/SLAB

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



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:06:42 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.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/next68k/dev/nextdma.c
diff -u src/sys/arch/next68k/dev/nextdma.c:1.50 src/sys/arch/next68k/dev/nextdma.c:1.51
--- src/sys/arch/next68k/dev/nextdma.c:1.50	Fri Mar 31 08:38:13 2017
+++ src/sys/arch/next68k/dev/nextdma.c	Fri Feb  3 23:06:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $	*/
+/*	$NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,11 +25,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.50 2017/03/31 08:38:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdma.c,v 1.51 2023/02/03 23:06:42 tsutsui Exp $");
 
 #include 
 #include 
-#include  
+#include 
 #include 
 #include 
 #include 
@@ -168,14 +168,32 @@ CFATTACH_DECL_NEW(nextdma, sizeof(struct
 
 static struct nextdma_channel nextdma_channel[] = {
 #if NESP > 0
-	{ "scsi", NEXT_P_SCSI_CSR, DD_SIZE, NEXT_I_SCSI_DMA, _esp_intr },
+	{
+		"scsi",
+		NEXT_P_SCSI_CSR,
+		DD_SIZE,
+		NEXT_I_SCSI_DMA,
+		_esp_intr
+	},
 #endif
 #if NXE > 0
-	{ "enetx", NEXT_P_ENETX_CSR, DD_SIZE, NEXT_I_ENETX_DMA, _enet_intr },
-	{ "enetr", NEXT_P_ENETR_CSR, DD_SIZE, NEXT_I_ENETR_DMA, _enet_intr },
+	{
+		"enetx",
+		NEXT_P_ENETX_CSR,
+		DD_SIZE,
+		NEXT_I_ENETX_DMA,
+		_enet_intr
+	},
+	{
+		"enetr",
+		NEXT_P_ENETR_CSR,
+		DD_SIZE,
+		NEXT_I_ENETR_DMA,
+		_enet_intr
+	},
 #endif
 };
-static int nnextdma_channels = (sizeof(nextdma_channel)/sizeof(nextdma_channel[0]));
+static int nnextdma_channels = __arraycount(nextdma_channel);
 
 static int attached = 0;
 
@@ -206,11 +224,11 @@ nextdma_match(device_t parent, cfdata_t 
 	struct intio_attach_args *ia = (struct intio_attach_args *)aux;
 
 	if (attached >= nnextdma_channels)
-		return (0);
+		return 0;
 
 	ia->ia_addr = (void *)nextdma_channel[attached].nd_base;
 
-	return (1);
+	return 1;
 }
 
 void
@@ -229,22 +247,20 @@ nextdma_attach(device_t parent, device_t
 	nsc->sc_bst = ia->ia_bst;
 
 	if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base,
-			  nsc->sc_chan->nd_size, 0, >sc_bsh)) {
+	nsc->sc_chan->nd_size, 0, >sc_bsh)) {
 		panic("%s: can't map DMA registers for channel %s",
-		  device_xname(self), nsc->sc_chan->nd_name);
+		device_xname(self), nsc->sc_chan->nd_name);
 	}
 
-	nextdma_init (nsc);
+	nextdma_init(nsc);
 
 	isrlink_autovec(nsc->sc_chan->nd_intrfunc, nsc,
-			NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
+	NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
 	INTR_ENABLE(nsc->sc_chan->nd_intr);
 
-	printf (": channel %d (%s)\n", attached, 
+	printf(": channel %d (%s)\n", attached,
 		nsc->sc_chan->nd_name);
 	attached++;
-
-	return;
 }
 
 void
@@ -257,7 +273,7 @@ nextdma_init(struct nextdma_softc *nsc)
 		snprintb(sbuf, sizeof(sbuf), NEXT_INTR_BITS,
 		NEXT_I_BIT(nsc->sc_chan->nd_intr));
 		printf("DMA init ipl (%ld) intr(%s)\n",
-			NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf);
+		NEXT_I_IPL(nsc->sc_chan->nd_intr), sbuf);
 	}
 #endif
 
@@ -267,8 +283,8 @@ nextdma_init(struct nextdma_softc *nsc)
 	nsc->sc_stat.nd_idx_cont = 0;
 	nsc->sc_stat.nd_exception = 0;
 
-	nd_bsw4 (DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE);
-	nd_bsw4 (DD_CSR, 0);
+	nd_bsw4(DD_CSR, DMACSR_RESET | DMACSR_CLRCOMPLETE);
+	nd_bsw4(DD_CSR, 0);
 
 #if 01
 	nextdma_setup_curr_regs(nsc);
@@ -287,10 +303,10 @@ nextdma_init(struct nextdma_softc *nsc)
 		 */
 		state &= (DMACSR_COMPLETE | DMACSR_SUPDATE | DMACSR_ENABLE);
 #else
-		state &= (DMACSR_BUSEXC | DMACSR_COMPLETE | 
+		state &= (DMACSR_BUSEXC | DMACSR_COMPLETE |
 			  DMACSR_SUPDATE | DMACSR_ENABLE);
 #endif
-		if (state) {
+		if (state != 0) {
 			nextdma_print(nsc);
 			panic("DMA did not reset");
 		}
@@ -309,17 +325,19 @@ nextdma_reset(struct nextdma_softc *nsc)
 	DPRINTF(("DMA reset\n"));
 
 #if (defined(ND_DEBUG))
-	if (NEXTDMA_DEBUG > 1) nextdma_print(nsc);
+	if (NEXTDMA_DEBUG > 1)
+		nextdma_print(nsc);
 #endif
 
-	nd_bsw4 (DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET);
+	nd_bsw4(DD_CSR, DMACSR_CLRCOMPLETE | DMACSR_RESET);
 	if ((stat->nd_map) || (stat->nd_map_cont)) {
 		if (stat->nd_map_cont) {
-			DPRINTF(("DMA: resetting with non null continue map\n"));
-			if (nsc->sc_conf.nd_completed_cb) 
-(*nsc->sc_conf.nd_completed_cb)
-	(stat->nd_map_cont, nsc->sc_conf.nd_cb_arg);
-			
+			DPRINTF(
+			("DMA: resetting with non null continue map\n"));
+			if (nsc->sc_conf.nd_completed_cb)
+(*nsc->sc_conf.nd_completed_cb)(
+

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:06:42 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: nextdma.c nextdmareg.h nextdmavar.h

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/dev/nextdma.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/next68k/dev/nextdmareg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/next68k/dev/nextdmavar.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:04:36 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795var.h

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.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/next68k/dev/mb8795var.h
diff -u src/sys/arch/next68k/dev/mb8795var.h:1.15 src/sys/arch/next68k/dev/mb8795var.h:1.16
--- src/sys/arch/next68k/dev/mb8795var.h:1.15	Mon Apr 13 21:18:42 2015
+++ src/sys/arch/next68k/dev/mb8795var.h	Fri Feb  3 23:04:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795var.h,v 1.15 2015/04/13 21:18:42 riastradh Exp $	*/
+/*	$NetBSD: mb8795var.h,v 1.16 2023/02/03 23:04:35 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -62,7 +62,7 @@ struct mb8795_softc {
 
 	bus_space_handle_t sc_bmap_bsh; /* bus space handle */
 
-	u_int8_t sc_enaddr[6];
+	uint8_t sc_enaddr[6];
 
 	struct ifaltq sc_tx_snd;
 



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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:04:36 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795var.h

Log Message:
Use proper C99 int types.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/mb8795var.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:02:56 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
TAB/space cleanup.


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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:02:56 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/next68k/dev/if_xe.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/next68k/dev/if_xe.c
diff -u src/sys/arch/next68k/dev/if_xe.c:1.27 src/sys/arch/next68k/dev/if_xe.c:1.28
--- src/sys/arch/next68k/dev/if_xe.c:1.27	Sat Nov 21 17:49:20 2020
+++ src/sys/arch/next68k/dev/if_xe.c	Fri Feb  3 23:02:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $	*/
+/*	$NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.28 2023/02/03 23:02:56 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -202,16 +202,17 @@ findchannel_defer(device_t self)
 	xsc->sc_rx_completed_idx = 0;
 	xsc->sc_rx_handled_idx = 0;
 
-	/* @@@ more next hacks 
+	/*
+	 * @@@ more next hacks
 	 * the  2000 covers at least a 1500 mtu + headers
 	 * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT
 	 */
 	xsc->sc_txbuf = kmem_alloc(2000, KM_SLEEP);
 	xsc->sc_tx_mb_head = NULL;
 	xsc->sc_tx_loaded = 0;
-	
+
 	mb8795_config(sc, xe_dma_medias, nxe_dma_medias, xe_dma_medias[0]);
-	
+
 	isrlink_autovec(xe_tint, sc, NEXT_I_IPL(NEXT_I_ENETX), 1, NULL);
 	INTR_ENABLE(NEXT_I_ENETX);
 	isrlink_autovec(xe_rint, sc, NEXT_I_IPL(NEXT_I_ENETR), 1, NULL);
@@ -312,7 +313,7 @@ xe_dma_reset(struct mb8795_softc *sc)
 	int i;
 
 	DPRINTF(("xe DMA reset\n"));
-	
+
 	nextdma_reset(xsc->sc_rxdma);
 	nextdma_reset(xsc->sc_txdma);
 
@@ -346,7 +347,7 @@ xe_dma_rx_setup(struct mb8795_softc *sc)
 	DPRINTF(("xe DMA rx setup\n"));
 
 	for(i = 0; i < MB8795_NRXBUFS; i++)
-		xsc->sc_rx_mb_head[i] = 
+		xsc->sc_rx_mb_head[i] =
 			xe_dma_rxmap_load(sc, xsc->sc_rx_dmamap[i]);
 
 	xsc->sc_rx_loaded_idx = 0;
@@ -380,17 +381,17 @@ xe_dma_rx_mbuf(struct mb8795_softc *sc)
 
 		map = xsc->sc_rx_dmamap[xsc->sc_rx_handled_idx];
 		m = xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx];
-		
+
 		m->m_len = map->dm_xfer_len;
 
 		bus_dmamap_sync(xsc->sc_rxdma->sc_dmat, map,
 0, map->dm_mapsize, BUS_DMASYNC_POSTREAD);
-		
+
 		bus_dmamap_unload(xsc->sc_rxdma->sc_dmat, map);
-		
+
 		/* Install a fresh mbuf for next packet */
-		
-		xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] = 
+
+		xsc->sc_rx_mb_head[xsc->sc_rx_handled_idx] =
 			xe_dma_rxmap_load(sc,map);
 
 		/* Punt runt packets
@@ -467,7 +468,7 @@ xe_dma_tx_mbuf(struct mb8795_softc *sc, 
 buflen = ETHER_MIN_LEN - ETHER_CRC_LEN;
 			}
 		}
-		
+
 		error = bus_dmamap_load(xsc->sc_txdma->sc_dmat,
 		xsc->sc_tx_dmamap, buf, buflen, NULL, BUS_DMA_NOWAIT);
 	}
@@ -503,7 +504,7 @@ xe_dma_tx_isactive(struct mb8795_softc *
 
 //
 
-void 
+void
 xe_dma_tx_completed(bus_dmamap_t map, void *arg)
 {
 #if defined (XE_DEBUG) || defined (DIAGNOSTIC)
@@ -527,7 +528,7 @@ xe_dma_tx_completed(bus_dmamap_t map, vo
 #endif
 }
 
-void 
+void
 xe_dma_tx_shutdown(void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -550,7 +551,7 @@ xe_dma_tx_shutdown(void *arg)
 		bus_dmamap_unload(xsc->sc_txdma->sc_dmat, xsc->sc_tx_dmamap);
 		m_freem(xsc->sc_tx_mb_head);
 		xsc->sc_tx_mb_head = NULL;
-		
+
 		xsc->sc_tx_loaded--;
 	}
 
@@ -571,14 +572,14 @@ xe_dma_tx_shutdown(void *arg)
 
 #if 0
 	/* Enable ready interrupt */
-	MB_WRITE_REG(sc, MB8795_TXMASK, 
+	MB_WRITE_REG(sc, MB8795_TXMASK,
 		 MB_READ_REG(sc, MB8795_TXMASK)
 		 | MB8795_TXMASK_TXRXIE/* READYIE */);
 #endif
 }
 
 
-void 
+void
 xe_dma_rx_completed(bus_dmamap_t map, void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -588,11 +589,11 @@ xe_dma_rx_completed(bus_dmamap_t map, vo
 	if (ifp->if_flags & IFF_RUNNING) {
 		xsc->sc_rx_completed_idx++;
 		xsc->sc_rx_completed_idx %= MB8795_NRXBUFS;
-		
+
 		DPRINTF(("%s: xe_dma_rx_completed(), "
 			"sc->sc_rx_completed_idx = %d\n",
 			 device_xname(sc->sc_dev), xsc->sc_rx_completed_idx));
-		
+
 #if (defined(DIAGNOSTIC))
 		if (map != xsc->sc_rx_dmamap[xsc->sc_rx_completed_idx])
 			panic("%s: Unexpected rx dmamap completed",
@@ -606,7 +607,7 @@ xe_dma_rx_completed(bus_dmamap_t map, vo
 #endif
 }
 
-void 
+void
 xe_dma_rx_shutdown(void *arg)
 {
 	struct mb8795_softc *sc = arg;
@@ -616,7 +617,7 @@ xe_dma_rx_shutdown(void *arg)
 	if (ifp->if_flags & IFF_RUNNING) {
 		DPRINTF(("%s: xe_dma_rx_shutdown(), restarting.\n",
 			 device_xname(sc->sc_dev)));
-		
+
 		nextdma_start(xsc->sc_rxdma, DMACSR_SETREAD);
 		if (turbo)
 			MB_WRITE_REG(sc, MB8795_RXMODE,
@@ -659,7 +660,7 @@ xe_dma_rxmap_load(struct mb8795_softc *s
 
 	/*
 	 * Align buffer, @@@ next specific.
-	 * perhaps should be using M_ALIGN here 

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

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:00:33 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Add proper rnd_add_uint32(9) calls to next68k xe(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.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/next68k/dev

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 23:00:33 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Add proper rnd_add_uint32(9) calls to next68k xe(4) driver.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/next68k/dev/mb8795.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/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.69 src/sys/arch/next68k/dev/mb8795.c:1.70
--- src/sys/arch/next68k/dev/mb8795.c:1.69	Sun Sep 18 13:00:18 2022
+++ src/sys/arch/next68k/dev/mb8795.c	Fri Feb  3 23:00:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $	*/
+/*	$NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.70 2023/02/03 23:00:33 tsutsui Exp $");
 
 #include "opt_inet.h"
 
@@ -348,6 +348,7 @@ mb8795_rint(struct mb8795_softc *sc)
 		printf("rxmode = %s\n", sbuf);
 	}
 #endif
+	rnd_add_uint32(>rnd_source, rxstat);
 
 	return;
 }
@@ -380,7 +381,7 @@ mb8795_tint(struct mb8795_softc *sc)
 			/* printf ("Z"); */
 			mb8795_start_dma(sc);
 		}
-		return;
+		goto out;
 	}
 
 	if (txstat & MB8795_TXSTAT_SHORTED) {
@@ -414,6 +415,8 @@ mb8795_tint(struct mb8795_softc *sc)
 		txmask & ~MB8795_TXMASK_READYIE);
 	}
 #endif
+ out:
+	rnd_add_uint32(>rnd_source, txstat);
 
 	return;
 }



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 22:57:05 UTC 2023

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

Log Message:
Use explicit CPU strings and remove hp300 derived stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/next68k/next68k/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/next68k/next68k/machdep.c
diff -u src/sys/arch/next68k/next68k/machdep.c:1.117 src/sys/arch/next68k/next68k/machdep.c:1.118
--- src/sys/arch/next68k/next68k/machdep.c:1.117	Fri Jan 27 15:21:52 2023
+++ src/sys/arch/next68k/next68k/machdep.c	Fri Feb  3 22:57:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.118 2023/02/03 22:57:05 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.118 2023/02/03 22:57:05 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -321,7 +321,7 @@ cpu_startup(void)
 void
 identifycpu(void)
 {
-	const char *mc, *mmu_str, *fpu_str, *cache_str;
+	const char *cpu_str, *mmu_str, *fpu_str, *cache_str;
 	extern int turbo;
 
 	/*
@@ -329,21 +329,23 @@ identifycpu(void)
 	 */
 	switch (cputype) {
 	case CPU_68040:
-		mc = "40";
+		cpu_str = "MC68040";
 		cpuspeed = turbo ? 33 : 25;
 		delay_divisor = 759 / cpuspeed;
 		break;
 	case CPU_68030:
-		mc = "30";
+		cpu_str = "MC68030";
 		cpuspeed = 25;
 		delay_divisor = 2048 / cpuspeed;
 		break;
+#if 0
 	case CPU_68020:
-		mc = "20";
+		cpu_str = "MC68020";
 		break;
+#endif
 	default:
 		printf("\nunknown cputype %d\n", cputype);
-		goto lose;
+		panic("startup");
 	}
 
 	/*
@@ -354,14 +356,13 @@ identifycpu(void)
 	case MMU_68030:
 		mmu_str = "+MMU";
 		break;
+#if 0
 	case MMU_68851:
 		mmu_str = ", MC68851 MMU";
 		break;
-	case MMU_HP:
-		mmu_str = ", HP MMU";
-		break;
+#endif
 	default:
-		printf("MC680%s: unknown MMU type %d\n", mc, mmutype);
+		printf("%s: unknown MMU type %d\n", cpu_str, mmutype);
 		panic("startup");
 	}
 
@@ -376,7 +377,7 @@ identifycpu(void)
 		fpu_str = ", MC68882 FPU";
 		break;
 	case FPU_68881:
-		fpu_str = ", MHz MC68881 FPU";
+		fpu_str = ", MC68881 FPU";
 		break;
 	default:
 		fpu_str = ", unknown FPU";
@@ -387,30 +388,11 @@ identifycpu(void)
 	 */
 	if (cputype == CPU_68040)
 		cache_str = ", 4k on-chip physical I/D caches";
-	else {
-#if defined(ENABLE_HP_CODE)
-		switch (ectype) {
-		case EC_VIRT:
-			cache_str = ", virtual-address cache";
-			break;
-		case EC_PHYS:
-			cache_str = ", physical-address cache";
-			break;
-		default:
-			cache_str = "";
-			break;
-		}
-#else
+	else
 		cache_str = "";
-#endif
-	}
 
-	cpu_setmodel("NeXT/MC680%s CPU%s%s%s", mc, mmu_str, fpu_str, cache_str);
+	cpu_setmodel("NeXT/%s CPU%s%s%s", cpu_str, mmu_str, fpu_str, cache_str);
 	printf("%s\n", cpu_getmodel());
-
-	return;
- lose:
-	panic("startup");
 }
 
 /*



CVS commit: src/sys/arch/next68k/next68k

2023-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  3 22:57:05 UTC 2023

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

Log Message:
Use explicit CPU strings and remove hp300 derived stuff.


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

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:36:58 UTC 2023

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

Log Message:
next68k:  Specify -fno-unwind-tables to shrink kernel binary size.

next68k bootloader cannot load a kernel larger than ~3.8 MB.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/next68k/conf/GENERIC

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



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

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:36:58 UTC 2023

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

Log Message:
next68k:  Specify -fno-unwind-tables to shrink kernel binary size.

next68k bootloader cannot load a kernel larger than ~3.8 MB.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/next68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/next68k/conf/GENERIC
diff -u src/sys/arch/next68k/conf/GENERIC:1.154 src/sys/arch/next68k/conf/GENERIC:1.155
--- src/sys/arch/next68k/conf/GENERIC:1.154	Thu Dec 22 11:05:55 2022
+++ src/sys/arch/next68k/conf/GENERIC	Fri Jan 27 15:36:58 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.154 2022/12/22 11:05:55 nat Exp $
+# $NetBSD: GENERIC,v 1.155 2023/01/27 15:36:58 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,9 +22,9 @@ include 	"arch/next68k/conf/std.next68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.154 $"
+#ident 		"GENERIC-$Revision: 1.155 $"
 
-makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-omit-frame-pointer"
+makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-unwind-tables -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
 	# backtraces in DDB.
 



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

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:31:05 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
next68k: Fix silent stall of next68k esp(4) SCSI.

next68k esp(4) driver requires nextdma(4) interrupts at ipl 6
during ncr53c9x_intr() for esp(4) at ipl 3.  It worked on netbsd-5
and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6
for SMP support and on netbsd-6 ncr53c9x driver was changed to
use mutex(9) instead of simple_lock(9), so nextdma interrupts
were no longer raised during ncr53c9x interrupt handler.

For now, just call mutex_exit(9) and mutex_enter(9) during
waiting nextdma(4) interrupts in MD esp_dma_intr() handler.
This could be wrong and the interrupt handler for nextdma should
be reorganized, but it just works.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/next68k/dev/esp.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/next68k/dev/esp.c
diff -u src/sys/arch/next68k/dev/esp.c:1.64 src/sys/arch/next68k/dev/esp.c:1.65
--- src/sys/arch/next68k/dev/esp.c:1.64	Fri Mar 31 08:38:13 2017
+++ src/sys/arch/next68k/dev/esp.c	Fri Jan 27 15:31:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $	*/
+/*	$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.64 2017/03/31 08:38:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.65 2023/01/27 15:31:05 tsutsui Exp $");
 
 #include 
 #include 
@@ -509,6 +509,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 			}
 #endif
 
+			mutex_exit(>sc_lock);	/* for nextdma intr */
 			while (!nextdma_finished(nsc)) {
 			/* esp_dma_isactive(sc)) { */
 NDTRACEIF (ndtrace_addc('w'));
@@ -602,7 +603,7 @@ esp_dma_intr(struct ncr53c9x_softc *sc)
 
 			}
 		out:
-			;
+			mutex_enter(>sc_lock);	/* for nextdma intr */
 
 #ifdef ESP_DEBUG
 /* 			esp_dma_nest--; */



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

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:31:05 UTC 2023

Modified Files:
src/sys/arch/next68k/dev: esp.c

Log Message:
next68k: Fix silent stall of next68k esp(4) SCSI.

next68k esp(4) driver requires nextdma(4) interrupts at ipl 6
during ncr53c9x_intr() for esp(4) at ipl 3.  It worked on netbsd-5
and prior, but on netbsd-5 splbio() was changed from ipl 3 to 6
for SMP support and on netbsd-6 ncr53c9x driver was changed to
use mutex(9) instead of simple_lock(9), so nextdma interrupts
were no longer raised during ncr53c9x interrupt handler.

For now, just call mutex_exit(9) and mutex_enter(9) during
waiting nextdma(4) interrupts in MD esp_dma_intr() handler.
This could be wrong and the interrupt handler for nextdma should
be reorganized, but it just works.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/next68k/dev/esp.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/next68k/include

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:25:47 UTC 2023

Modified Files:
src/sys/arch/next68k/include: bus_space.h

Log Message:
next68k: Specify proper constraints for bus_space_read region and multi ops.

These functions write the read data into memory at a specified pointer,
but without the "memory" constraint gcc could optimize out these ops
if the memory is allocated on local stack.

With this fix nextkbd(4) works again.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/include/bus_space.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/next68k/include/bus_space.h
diff -u src/sys/arch/next68k/include/bus_space.h:1.19 src/sys/arch/next68k/include/bus_space.h:1.20
--- src/sys/arch/next68k/include/bus_space.h:1.19	Sat Jan 23 19:38:08 2021
+++ src/sys/arch/next68k/include/bus_space.h	Fri Jan 27 15:25:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.h,v 1.19 2021/01/23 19:38:08 christos Exp $	*/
+/*	$NetBSD: bus_space.h,v 1.20 2023/01/27 15:25:47 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -167,7 +167,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_multi_2(t, h, o, a, c) do {			\
@@ -181,7 +181,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_multi_4(t, h, o, a, c) do {			\
@@ -195,7 +195,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 /*
@@ -219,7 +219,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0);
 
 #define	bus_space_read_region_2(t, h, o, a, c) do {			\
@@ -233,7 +233,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");	\
 } while (0);
 
 #define	bus_space_read_region_4(t, h, o, a, c) do {			\
@@ -247,7 +247,7 @@ typedef u_long	bus_space_handle_t;
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" (c)		:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");	\
 } while (0);
 
 /*



CVS commit: src/sys/arch/next68k/include

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:25:47 UTC 2023

Modified Files:
src/sys/arch/next68k/include: bus_space.h

Log Message:
next68k: Specify proper constraints for bus_space_read region and multi ops.

These functions write the read data into memory at a specified pointer,
but without the "memory" constraint gcc could optimize out these ops
if the memory is allocated on local stack.

With this fix nextkbd(4) works again.

Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/next68k/include/bus_space.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/next68k

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:21:52 UTC 2023

Modified Files:
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: clock.c machdep.c

Log Message:
next68k: Fix delay_divisor value for proper delay(9) on 68040.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/next68k/next68k/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/arch/next68k

2023-01-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 27 15:21:52 UTC 2023

Modified Files:
src/sys/arch/next68k/include: cpu.h
src/sys/arch/next68k/next68k: clock.c machdep.c

Log Message:
next68k: Fix delay_divisor value for proper delay(9) on 68040.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/next68k/next68k/clock.c
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/next68k/next68k/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/next68k/include/cpu.h
diff -u src/sys/arch/next68k/include/cpu.h:1.50 src/sys/arch/next68k/include/cpu.h:1.51
--- src/sys/arch/next68k/include/cpu.h:1.50	Sat Nov 23 19:40:36 2019
+++ src/sys/arch/next68k/include/cpu.h	Fri Jan 27 15:21:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.50 2019/11/23 19:40:36 ad Exp $	*/
+/*	$NetBSD: cpu.h,v 1.51 2023/01/27 15:21:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -120,9 +120,6 @@ void	loadustp(int);
 void	doboot(void) __attribute__((__noreturn__));
 int	nmihand(void *);
 
-/* clock.c functions */
-void	next68k_calibrate_delay(void);
-
 #endif /* _KERNEL */
 
 #define NEXT_RAMBASE  (0x400) /* really depends on slot, but... */

Index: src/sys/arch/next68k/next68k/clock.c
diff -u src/sys/arch/next68k/next68k/clock.c:1.12 src/sys/arch/next68k/next68k/clock.c:1.13
--- src/sys/arch/next68k/next68k/clock.c:1.12	Sat Apr 24 19:58:13 2010
+++ src/sys/arch/next68k/next68k/clock.c	Fri Jan 27 15:21:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.12 2010/04/24 19:58:13 dbj Exp $	*/
+/*	$NetBSD: clock.c,v 1.13 2023/01/27 15:21:52 tsutsui Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.12 2010/04/24 19:58:13 dbj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.13 2023/01/27 15:21:52 tsutsui Exp $");
 
 #include 
 #include 
@@ -48,38 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.
  * -- jew...@mit.edu
  */
 
-/*
- * Note that the value of delay_divisor is roughly
- * 2048 / cpuspeed (where cpuspeed is in MHz) on 68020
- * and 68030 systems.  See clock.c for the delay
- * calibration algorithm.
- */
-int	cpuspeed;		  /* relative cpu speed; XXX skewed on 68040 */
-int	delay_divisor = 2048/25;  /* delay constant */
-
-/*
- * Calibrate the delay constant.
- */
-void
-next68k_calibrate_delay(void)
-{
-	extern int delay_divisor;
-
-	/* @@@ write this once we know how to read
-	 * a real time clock
-	 */
-
-	/*
-	 * Sanity check the delay_divisor value.  If we totally lost,
-	 * assume a 25MHz CPU;
-	 */
-	if (delay_divisor == 0)
-		delay_divisor = 2048 / 25;
-
-	/* Calculate CPU speed. */
-	cpuspeed = 2048 / delay_divisor;
-}
-
 int clock_intr(void *);
 
 int

Index: src/sys/arch/next68k/next68k/machdep.c
diff -u src/sys/arch/next68k/next68k/machdep.c:1.116 src/sys/arch/next68k/next68k/machdep.c:1.117
--- src/sys/arch/next68k/next68k/machdep.c:1.116	Sat Oct  9 20:00:42 2021
+++ src/sys/arch/next68k/next68k/machdep.c	Fri Jan 27 15:21:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.116 2021/10/09 20:00:42 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.116 2021/10/09 20:00:42 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.117 2023/01/27 15:21:52 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -168,6 +168,17 @@ phys_seg_list_t phys_seg_list[VM_PHYSSEG
 phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
 int	mem_cluster_cnt;
 
+/*
+ * On the 68020/68030, the value of delay_divisor is roughly
+ * 2048 / cpuspeed (where cpuspeed is in MHz).
+ *
+ * On the 68040/68060(?), the value of delay_divisor is roughly
+ * 759 / cpuspeed (where cpuspeed is in MHz).
+ * XXX -- is the above formula correct?
+ */
+int	cpuspeed = 33;		  /* relative cpu speed; XXX skewed on 68040 */
+int	delay_divisor = 759 / 33;  /* delay constant; assume fastest 33 MHz */
+
 //
 
 /*
@@ -208,9 +219,6 @@ next68k_init(void)
 		}
 	}
 
-	/* Calibrate the delay loop. */
-	next68k_calibrate_delay();
-
 	/*
 	 * Initialize error message buffer (at end of core).
 	 */
@@ -256,8 +264,6 @@ consinit(void)
 		}
 
 		init = 1;
-	} else {
-		next68k_calibrate_delay();
 	}
 }
 
@@ -316,6 +322,7 @@ void
 identifycpu(void)
 {
 	const char *mc, *mmu_str, *fpu_str, *cache_str;
+	extern int turbo;
 
 	/*
 	 * ...and the CPU type.
@@ -323,9 +330,13 @@ identifycpu(void)
 	switch (cputype) {
 	case CPU_68040:
 		mc = "40";
+		cpuspeed = turbo ? 33 : 25;
+		delay_divisor = 759 / cpuspeed;
 		break;
 	case CPU_68030:
 		mc = "30";
+		cpuspeed = 25;
+		delay_divisor = 2048 / cpuspeed;
 		break;
 	case 

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

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:00:18 UTC 2022

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Eliminate use of IFF_OACTIVE.  (It was not being used correctly here in
any case.)


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/dev/mb8795.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/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.68 src/sys/arch/next68k/dev/mb8795.c:1.69
--- src/sys/arch/next68k/dev/mb8795.c:1.68	Thu Mar 17 08:08:03 2022
+++ src/sys/arch/next68k/dev/mb8795.c	Sun Sep 18 13:00:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795.c,v 1.68 2022/03/17 08:08:03 andvar Exp $	*/
+/*	$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.68 2022/03/17 08:08:03 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.69 2022/09/18 13:00:18 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -430,7 +430,7 @@ mb8795_reset(struct mb8795_softc *sc)
 
 	DPRINTF (("%s: mb8795_reset()\n", device_xname(sc->sc_dev)));
 
-	sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+	sc->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING;
 	sc->sc_ethercom.ec_if.if_timer = 0;
 
 	MBDMA_RESET(sc);
@@ -526,7 +526,6 @@ mb8795_init(struct mb8795_softc *sc)
 			MBDMA_TX_SETUP(sc);
 
 			ifp->if_flags |= IFF_RUNNING;
-			ifp->if_flags &= ~IFF_OACTIVE;
 			ifp->if_timer = 0;
 
 			MBDMA_RX_GO(sc);
@@ -674,19 +673,15 @@ mb8795_start(struct ifnet *ifp)
 #endif
 
 	while (1) {
-		if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE))
-		!= IFF_RUNNING)
+		if ((ifp->if_flags & IFF_RUNNING) == 0)
 			return;
 
 #if 0
 		return;	/* @@@ Turn off xmit for debugging */
 #endif
 
-		ifp->if_flags |= IFF_OACTIVE;
-
 		IFQ_DEQUEUE(>if_snd, m);
 		if (m == 0) {
-			ifp->if_flags &= ~IFF_OACTIVE;
 			return;
 		}
 
@@ -698,8 +693,6 @@ mb8795_start(struct ifnet *ifp)
 		if (!MBDMA_TX_ISACTIVE(sc))
 			mb8795_start_dma(sc);
 		splx(s);
-
-		ifp->if_flags &= ~IFF_OACTIVE;
 	}
 }
 



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

2022-09-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 18 13:00:18 UTC 2022

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Eliminate use of IFF_OACTIVE.  (It was not being used correctly here in
any case.)


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/next68k/dev/mb8795.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/next68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:49:20 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: if_xe.c nextdisplay.c nextkbd.c
src/sys/arch/next68k/next68k: isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/if_xe.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/isr.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/next68k/dev/if_xe.c
diff -u src/sys/arch/next68k/dev/if_xe.c:1.26 src/sys/arch/next68k/dev/if_xe.c:1.27
--- src/sys/arch/next68k/dev/if_xe.c:1.26	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/next68k/dev/if_xe.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $	*/
+/*	$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.26 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.27 2020/11/21 17:49:20 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -205,7 +206,7 @@ findchannel_defer(device_t self)
 	 * the  2000 covers at least a 1500 mtu + headers
 	 * + DMA_BEGINALIGNMENT+ DMA_ENDALIGNMENT
 	 */
-	xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_WAITOK);
+	xsc->sc_txbuf = kmem_alloc(2000, KM_SLEEP);
 	xsc->sc_tx_mb_head = NULL;
 	xsc->sc_tx_loaded = 0;
 	

Index: src/sys/arch/next68k/dev/nextdisplay.c
diff -u src/sys/arch/next68k/dev/nextdisplay.c:1.22 src/sys/arch/next68k/dev/nextdisplay.c:1.23
--- src/sys/arch/next68k/dev/nextdisplay.c:1.22	Tue Nov 12 13:17:44 2019
+++ src/sys/arch/next68k/dev/nextdisplay.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nextdisplay.c,v 1.22 2019/11/12 13:17:44 msaitoh Exp $ */
+/* $NetBSD: nextdisplay.c,v 1.23 2020/11/21 17:49:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 Matt DeBergalis
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.22 2019/11/12 13:17:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextdisplay.c,v 1.23 2020/11/21 17:49:20 thorpej Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextdisplay.
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -251,8 +251,8 @@ nextdisplay_attach(device_t parent, devi
 		sc->sc_dc = _console_dc;
 		sc->nscreens = 1;
 	} else {
-		sc->sc_dc = (struct nextdisplay_config *)
-malloc(sizeof(struct nextdisplay_config), M_DEVBUF, M_WAITOK);
+		sc->sc_dc = kmem_alloc(sizeof(struct nextdisplay_config),
+		KM_SLEEP);
 		nextdisplay_init(sc->sc_dc, iscolor);
 	}
 

Index: src/sys/arch/next68k/dev/nextkbd.c
diff -u src/sys/arch/next68k/dev/nextkbd.c:1.15 src/sys/arch/next68k/dev/nextkbd.c:1.16
--- src/sys/arch/next68k/dev/nextkbd.c:1.15	Mon Mar 24 20:01:03 2014
+++ src/sys/arch/next68k/dev/nextkbd.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: nextkbd.c,v 1.15 2014/03/24 20:01:03 christos Exp $ */
+/* $NetBSD: nextkbd.c,v 1.16 2020/11/21 17:49:20 thorpej Exp $ */
 /*
  * Copyright (c) 1998 Matt DeBergalis
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 1.15 2014/03/24 20:01:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 1.16 2020/11/21 17:49:20 thorpej Exp $");
 
 #include 			/* RCS ID & Copyright macro defns */
 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: nextkbd.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -152,10 +152,9 @@ nextkbd_attach(device_t parent, device_t
 	if (isconsole) {
 		sc->id = _consdata;
 	} else {
-		sc->id = malloc(sizeof(struct nextkbd_internal), 
-M_DEVBUF, M_WAITOK);
+		sc->id = kmem_zalloc(sizeof(struct nextkbd_internal), 
+KM_SLEEP);
 
-		memset(sc->id, 0, sizeof(struct nextkbd_internal));
 		sc->id->iot = ia->ia_bst;
 		if (bus_space_map(sc->id->iot, NEXT_P_MON,
 sizeof(struct mon_regs),

Index: src/sys/arch/next68k/next68k/isr.c
diff -u src/sys/arch/next68k/next68k/isr.c:1.30 src/sys/arch/next68k/next68k/isr.c:1.31
--- src/sys/arch/next68k/next68k/isr.c:1.30	Sun Nov 10 21:16:31 2019
+++ src/sys/arch/next68k/next68k/isr.c	Sat Nov 21 17:49:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $ */
+/*	$NetBSD: isr.c,v 1.31 2020/11/21 17:49:20 thorpej Exp $ */
 
 /*
  * This file was taken from mvme68k/mvme68k/isr.c
@@ -41,11 +41,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.30 2019/11/10 21:16:31 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.31 2020/11/21 17:49:20 thorpej 

CVS commit: src/sys/arch/next68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:49:20 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: if_xe.c nextdisplay.c nextkbd.c
src/sys/arch/next68k/next68k: isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/next68k/dev/if_xe.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/next68k/dev/nextdisplay.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/next68k/dev/nextkbd.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/next68k/next68k/isr.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/next68k/dev

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:31:10 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/mb8795.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/next68k/dev

2020-01-28 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 29 05:31:10 UTC 2020

Modified Files:
src/sys/arch/next68k/dev: mb8795.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/next68k/dev/mb8795.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/next68k/dev/mb8795.c
diff -u src/sys/arch/next68k/dev/mb8795.c:1.65 src/sys/arch/next68k/dev/mb8795.c:1.66
--- src/sys/arch/next68k/dev/mb8795.c:1.65	Wed May 29 10:07:29 2019
+++ src/sys/arch/next68k/dev/mb8795.c	Wed Jan 29 05:31:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: mb8795.c,v 1.66 2020/01/29 05:31:10 thorpej Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.65 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.66 2020/01/29 05:31:10 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -283,7 +283,7 @@ mb8795_rint(struct mb8795_softc *sc)
 	}
 
 	if (error) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		/* @@@ handle more gracefully, free memory, etc. */
 	}
 
@@ -385,20 +385,20 @@ mb8795_tint(struct mb8795_softc *sc)
 
 	if (txstat & MB8795_TXSTAT_SHORTED) {
 		printf("%s: tx cable shorted\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 	if (txstat & MB8795_TXSTAT_UNDERFLOW) {
 		printf("%s: tx underflow\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	}
 	if (txstat & MB8795_TXSTAT_COLLERR) {
 		DPRINTF(("%s: tx collision\n", device_xname(sc->sc_dev)));
-		ifp->if_collisions++;
+		if_statinc(ifp, if_collisions);
 	}
 	if (txstat & MB8795_TXSTAT_COLLERR16) {
 		printf("%s: tx 16th collision\n", device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
-		ifp->if_collisions += 16;
+		if_statinc(ifp, if_oerrors);
+		if_statadd(ifp, if_collisions, 16);
 	}
 
 #if 0
@@ -483,10 +483,7 @@ mb8795_watchdog(struct ifnet *ifp)
 	struct mb8795_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
-
-	DPRINTF(("%s: %lld input errors, %lld input packets\n",
-		device_xname(sc->sc_dev), ifp->if_ierrors, ifp->if_ipackets));
+	if_statinc(ifp, if_oerrors);
 
 	ifp->if_flags &= ~IFF_RUNNING;
 	mb8795_init(sc);
@@ -762,7 +759,7 @@ mb8795_start_dma(struct mb8795_softc *sc
 		MB_WRITE_REG(sc, MB8795_TXMODE,
 		MB8795_TXMODE_TURBO1 | MB8795_TXMODE_TURBOSTART);
 
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 }
 
 //



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

2019-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 25 08:31:33 UTC 2019

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
- KNF.
- Use __arraycount.
- Remove extra 'n' from debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/next68k/dev/if_xe.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/next68k/dev/if_xe.c
diff -u src/sys/arch/next68k/dev/if_xe.c:1.24 src/sys/arch/next68k/dev/if_xe.c:1.25
--- src/sys/arch/next68k/dev/if_xe.c:1.24	Fri Jun 10 13:27:12 2016
+++ src/sys/arch/next68k/dev/if_xe.c	Thu Apr 25 08:31:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_xe.c,v 1.24 2016/06/10 13:27:12 ozaki-r Exp $	*/
+/*	$NetBSD: if_xe.c,v 1.25 2019/04/25 08:31:33 msaitoh Exp $	*/
 /*
  * Copyright (c) 1998 Darrin B. Jewell
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.24 2016/06/10 13:27:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xe.c,v 1.25 2019/04/25 08:31:33 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -82,26 +82,26 @@ void	xe_attach(device_t, device_t, void 
 int	xe_tint(void *);
 int	xe_rint(void *);
 
-struct mbuf * xe_dma_rxmap_load(struct mb8795_softc *, bus_dmamap_t);
+struct mbuf *xe_dma_rxmap_load(struct mb8795_softc *, bus_dmamap_t);
 
 bus_dmamap_t xe_dma_rx_continue(void *);
-void xe_dma_rx_completed(bus_dmamap_t, void *);
+void	xe_dma_rx_completed(bus_dmamap_t, void *);
 bus_dmamap_t xe_dma_tx_continue(void *);
-void xe_dma_tx_completed(bus_dmamap_t, void *);
-void xe_dma_rx_shutdown(void *);
-void xe_dma_tx_shutdown(void *);
+void	xe_dma_tx_completed(bus_dmamap_t, void *);
+void	xe_dma_rx_shutdown(void *);
+void	xe_dma_tx_shutdown(void *);
 
-static void	findchannel_defer(device_t);
+static void findchannel_defer(device_t);
 
 CFATTACH_DECL_NEW(xe, sizeof(struct xe_softc),
 xe_match, xe_attach, NULL, NULL);
 
 static int xe_dma_medias[] = {
-	IFM_ETHER|IFM_AUTO,
-	IFM_ETHER|IFM_10_T,
-	IFM_ETHER|IFM_10_2,
+	IFM_ETHER | IFM_AUTO,
+	IFM_ETHER | IFM_10_T,
+	IFM_ETHER | IFM_10_2,
 };
-static int nxe_dma_medias = (sizeof(xe_dma_medias)/sizeof(xe_dma_medias[0]));
+static int nxe_dma_medias = __arraycount(xe_dma_medias);
 
 static int attached = 0;
 
@@ -138,11 +138,11 @@ xe_match(device_t parent, cfdata_t match
 	struct intio_attach_args *ia = (struct intio_attach_args *)aux;
 
 	if (attached)
-		return (0);
+		return 0;
 
 	ia->ia_addr = (void *)NEXT_P_ENET;
 
-	return (1);
+	return 1;
 }
 
 static void
@@ -180,17 +180,17 @@ findchannel_defer(device_t self)
 
 	/* Initialize the DMA maps */
 	error = bus_dmamap_create(xsc->sc_txdma->sc_dmat, MCLBYTES,
-  (MCLBYTES/MSIZE), MCLBYTES, 0, BUS_DMA_ALLOCNOW,
-  >sc_tx_dmamap);
+	(MCLBYTES/MSIZE), MCLBYTES, 0, BUS_DMA_ALLOCNOW,
+	>sc_tx_dmamap);
 	if (error) {
-		aprint_error_dev(sc->sc_dev, "can't create tx DMA map, error = %d",
-		  error);
+		aprint_error_dev(sc->sc_dev,
+		"can't create tx DMA map, error = %d", error);
 	}
 
 	for(i = 0; i < MB8795_NRXBUFS; i++) {
 		error = bus_dmamap_create(xsc->sc_rxdma->sc_dmat, MCLBYTES,
-	  (MCLBYTES/MSIZE), MCLBYTES, 0, BUS_DMA_ALLOCNOW,
-	  >sc_rx_dmamap[i]);
+		(MCLBYTES/MSIZE), MCLBYTES, 0, BUS_DMA_ALLOCNOW,
+		>sc_rx_dmamap[i]);
 		if (error) {
 			panic("%s: can't create rx DMA map, error = %d",
 			  device_xname(sc->sc_dev), error);
@@ -207,7 +207,8 @@ findchannel_defer(device_t self)
 	 */
 	xsc->sc_txbuf = malloc(2000, M_DEVBUF, M_NOWAIT);
 	if (!xsc->sc_txbuf)
-		panic("%s: can't malloc tx DMA buffer", device_xname(sc->sc_dev));
+		panic("%s: can't malloc tx DMA buffer",
+		device_xname(sc->sc_dev));
 	
 	xsc->sc_tx_mb_head = NULL;
 	xsc->sc_tx_loaded = 0;
@@ -231,11 +232,12 @@ xe_attach(device_t parent, device_t self
 	DPRINTF(("%s: xe_attach()\n", device_xname(self)));
 
 	{
-		extern u_char rom_enetaddr[6]; /* kludge from machdep.c:next68k_bootargs() */
+		/* kludge from machdep.c:next68k_bootargs() */
+		extern u_char rom_enetaddr[6];
 		int i;
-		for(i=0;i<6;i++) {
+
+		for (i = 0; i < 6; i++)
 			sc->sc_enaddr[i] = rom_enetaddr[i];
-		}
 	}
 
 	printf("\n%s: MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -252,23 +254,18 @@ xe_attach(device_t parent, device_t self
 
 	sc->sc_bmap_bst = ia->ia_bst;
 	if (bus_space_map(sc->sc_bmap_bst, NEXT_P_BMAP,
-			  BMAP_SIZE, 0, >sc_bmap_bsh)) {
-		panic("\n%s: can't map bmap registers",
-		  device_xname(self));
-	}
+	BMAP_SIZE, 0, >sc_bmap_bsh))
+		panic("\n%s: can't map bmap registers", device_xname(self));
 
-	/*
-	 * Set up glue for MI code.
-	 */
+	/* Set up glue for MI code. */
 	sc->sc_glue = _glue;
 
 	xsc->sc_txdma = nextdma_findchannel("enetx");
 	xsc->sc_rxdma = nextdma_findchannel("enetr");
-	if (xsc->sc_rxdma && xsc->sc_txdma) {
+	if (xsc->sc_rxdma && xsc->sc_txdma)
 		findchannel_defer(self);
-	} else {
+	else
 		config_defer(self, 

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

2019-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 25 08:31:33 UTC 2019

Modified Files:
src/sys/arch/next68k/dev: if_xe.c

Log Message:
- KNF.
- Use __arraycount.
- Remove extra 'n' from debug printf.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/next68k/dev/if_xe.c

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



  1   2   >