CVS commit: src/sys/arch/luna68k

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

Modified Files:
src/sys/arch/luna68k/include: intr.h types.h
src/sys/arch/luna68k/luna68k: genassym.cf locore.s

Log Message:
G/C __HAVE_LEGACY_INTRCNT from luna68k.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/include/intr.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/luna68k/include/types.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/luna68k/luna68k/genassym.cf
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/luna68k/luna68k/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/luna68k/include/intr.h
diff -u src/sys/arch/luna68k/include/intr.h:1.17 src/sys/arch/luna68k/include/intr.h:1.18
--- src/sys/arch/luna68k/include/intr.h:1.17	Mon Jan 15 02:16:52 2024
+++ src/sys/arch/luna68k/include/intr.h	Mon Jan 15 20:10:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.17 2024/01/15 02:16:52 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.18 2024/01/15 20:10:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -41,6 +41,9 @@
 #define	MACHINE_PSL_IPL_VM		PSL_IPL4
 #define	MACHINE_PSL_IPL_SCHED		PSL_IPL5
 
+#define	MACHINE_INTREVCNT_NAMES		\
+	{ "spur", "lev1", "scsi", "network", "lev4", "clock", "serial", "nmi" }
+
 #include 
 
 #endif	/* _LUNA68K_INTR_H */

Index: src/sys/arch/luna68k/include/types.h
diff -u src/sys/arch/luna68k/include/types.h:1.9 src/sys/arch/luna68k/include/types.h:1.10
--- src/sys/arch/luna68k/include/types.h:1.9	Tue Jul  5 15:37:13 2022
+++ src/sys/arch/luna68k/include/types.h	Mon Jan 15 20:10:33 2024
@@ -1,5 +1,3 @@
-/*	$NetBSD: types.h,v 1.9 2022/07/05 15:37:13 tsutsui Exp $	*/
+/*	$NetBSD: types.h,v 1.10 2024/01/15 20:10:33 thorpej Exp $	*/
 
 #include 
-
-#define	__HAVE_LEGACY_INTRCNT

Index: src/sys/arch/luna68k/luna68k/genassym.cf
diff -u src/sys/arch/luna68k/luna68k/genassym.cf:1.27 src/sys/arch/luna68k/luna68k/genassym.cf:1.28
--- src/sys/arch/luna68k/luna68k/genassym.cf:1.27	Tue Jan  9 04:16:25 2024
+++ src/sys/arch/luna68k/luna68k/genassym.cf	Mon Jan 15 20:10:34 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.27 2024/01/09 04:16:25 thorpej Exp $
+#	$NetBSD: genassym.cf,v 1.28 2024/01/15 20:10:34 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -110,6 +110,8 @@ define	P_VMSPACE		offsetof(struct proc, 
 
 # interrupt/fault metering
 define	CI_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
+define	CLOCK_INTRCNT		((sizeof(struct evcnt)*5) + offsetof(struct evcnt, ev_count32))
+define	NMI_INTRCNT		((sizeof(struct evcnt)*7) + offsetof(struct evcnt, ev_count32))
 
 define	T_BUSERR		T_BUSERR
 define	T_ADDRERR		T_ADDRERR

Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.78 src/sys/arch/luna68k/luna68k/locore.s:1.79
--- src/sys/arch/luna68k/luna68k/locore.s:1.78	Mon Jan 15 19:30:15 2024
+++ src/sys/arch/luna68k/luna68k/locore.s	Mon Jan 15 20:10:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.78 2024/01/15 19:30:15 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.79 2024/01/15 20:10:34 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -555,7 +555,7 @@ Lbrkpt3:
  */
 
 ENTRY_NOPROFILE(lev7intr)		/* Level 7: NMI */
-	addql	#1,_C_LABEL(intrcnt)+32
+	addql	#1,_C_LABEL(m68k_intr_evcnt)+NMI_INTRCNT
 	clrl	%sp@-
 	moveml	#0x,%sp@-		| save registers
 	movl	%usp,%a0		| and save
@@ -580,7 +580,7 @@ ENTRY_NOPROFILE(lev5intr)
 	movl	%a1,%sp@-
 	jbsr	_C_LABEL(hardclock)	| hardclock()
 	addql	#4,%sp
-	addql	#1,_C_LABEL(intrcnt)+20
+	addql	#1,_C_LABEL(m68k_intr_evcnt)+CLOCK_INTRCNT
 	INTERRUPT_RESTOREREG
 1:
 	subql	#1,_C_LABEL(idepth)
@@ -830,19 +830,3 @@ GLOBAL(intiobase_phys)
 	.long	0		| PA of board's I/O registers
 GLOBAL(intiotop_phys)
 	.long	0		| PA of top of board's I/O registers
-
-GLOBAL(intrnames)
-	.asciz	"spur"
-	.asciz	"lev1"
-	.asciz	"scsi"
-	.asciz	"network"
-	.asciz	"lev4"
-	.asciz	"clock"
-	.asciz	"serial"
-	.asciz	"nmi"
-	.asciz	"statclock"
-GLOBAL(eintrnames)
-	.even
-GLOBAL(intrcnt)
-	.long	0,0,0,0,0,0,0,0,0
-GLOBAL(eintrcnt)



CVS commit: src/sys/arch/luna68k

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

Modified Files:
src/sys/arch/luna68k/include: intr.h types.h
src/sys/arch/luna68k/luna68k: genassym.cf locore.s

Log Message:
G/C __HAVE_LEGACY_INTRCNT from luna68k.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/include/intr.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/luna68k/include/types.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/luna68k/luna68k/genassym.cf
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/luna68k/luna68k/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/luna68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 19:30:15 UTC 2024

Modified Files:
src/sys/arch/luna68k/include: vectors.h
src/sys/arch/luna68k/luna68k: locore.s

Log Message:
No need for our own spurious interrupt handler now that m68k_intr.c
handles them for us.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/luna68k/luna68k/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/luna68k/include/vectors.h
diff -u src/sys/arch/luna68k/include/vectors.h:1.2 src/sys/arch/luna68k/include/vectors.h:1.3
--- src/sys/arch/luna68k/include/vectors.h:1.2	Mon Jan 15 02:16:52 2024
+++ src/sys/arch/luna68k/include/vectors.h	Mon Jan 15 19:30:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vectors.h,v 1.2 2024/01/15 02:16:52 thorpej Exp $	*/
+/*	$NetBSD: vectors.h,v 1.3 2024/01/15 19:30:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-#define	MACHINE_AV0_HANDLER	spurintr
+#define	MACHINE_AV0_HANDLER	intrstub_autovec
 #define	MACHINE_AV1_HANDLER	intrstub_autovec
 #define	MACHINE_AV2_HANDLER	intrstub_autovec
 #define	MACHINE_AV3_HANDLER	intrstub_autovec

Index: src/sys/arch/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.77 src/sys/arch/luna68k/luna68k/locore.s:1.78
--- src/sys/arch/luna68k/luna68k/locore.s:1.77	Mon Jan 15 02:16:52 2024
+++ src/sys/arch/luna68k/luna68k/locore.s	Mon Jan 15 19:30:15 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.77 2024/01/15 02:16:52 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.78 2024/01/15 19:30:15 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -554,13 +554,6 @@ Lbrkpt3:
  * Interrupt handlers.
  */
 
-ENTRY_NOPROFILE(spurintr)		/* Level 0 */
-	addql	#1,_C_LABEL(intrcnt)+0
-	INTERRUPT_SAVEREG
-	CPUINFO_INCREMENT(CI_NINTR)
-	INTERRUPT_RESTOREREG
-	jra	_ASM_LABEL(rei)
-
 ENTRY_NOPROFILE(lev7intr)		/* Level 7: NMI */
 	addql	#1,_C_LABEL(intrcnt)+32
 	clrl	%sp@-



CVS commit: src/sys/arch/luna68k

2024-01-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 19:30:15 UTC 2024

Modified Files:
src/sys/arch/luna68k/include: vectors.h
src/sys/arch/luna68k/luna68k: locore.s

Log Message:
No need for our own spurious interrupt handler now that m68k_intr.c
handles them for us.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/luna68k/luna68k/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/luna68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 02:16:52 UTC 2024

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

Log Message:
Switch luna68k over to the common interrupt dispatch code.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/include/intr.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.27 -r0 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/luna68k/luna68k/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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.33 src/sys/arch/luna68k/conf/files.luna68k:1.34
--- src/sys/arch/luna68k/conf/files.luna68k:1.33	Sun Jan 14 00:17:46 2024
+++ src/sys/arch/luna68k/conf/files.luna68k	Mon Jan 15 02:16:52 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.33 2024/01/14 00:17:46 thorpej Exp $
+#	$NetBSD: files.luna68k,v 1.34 2024/01/15 02:16:52 thorpej Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -10,7 +10,6 @@ defflag			PANICBUTTON
 file arch/luna68k/luna68k/autoconf.c
 file arch/luna68k/luna68k/clock.c
 file arch/luna68k/luna68k/disksubr.c
-file arch/luna68k/luna68k/isr.c
 file arch/luna68k/luna68k/machdep.c
 file arch/luna68k/luna68k/pmap_bootstrap.c
 file arch/luna68k/luna68k/trap.c
@@ -18,6 +17,8 @@ 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/fpu.c		compile-with "${M68K_KERN_FPU}"
+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

Index: src/sys/arch/luna68k/include/cpu.h
diff -u src/sys/arch/luna68k/include/cpu.h:1.39 src/sys/arch/luna68k/include/cpu.h:1.40
--- src/sys/arch/luna68k/include/cpu.h:1.39	Tue Jan  9 04:16:25 2024
+++ src/sys/arch/luna68k/include/cpu.h	Mon Jan 15 02:16:52 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.39 2024/01/09 04:16:25 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.40 2024/01/15 02:16:52 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -57,19 +57,20 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the luna68k, 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	vo;		/* 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)
 #if 0
 /* We would like to do it this way... */
-#define CLKF_INTR(framep)	(((framep)->sr & PSL_M) == 0)
+#define CLKF_INTR(framep)	(((framep)->cf_sr & PSL_M) == 0)
 #else
 /* but until we start using PSL_M, we have to do this instead */
 #define CLKF_INTR(framep)	(0)	/* XXX */

Index: src/sys/arch/luna68k/include/intr.h
diff -u src/sys/arch/luna68k/include/intr.h:1.16 src/sys/arch/luna68k/include/intr.h:1.17
--- src/sys/arch/luna68k/include/intr.h:1.16	Tue Jul 11 11:06:04 2023
+++ src/sys/arch/luna68k/include/intr.h	Mon Jan 15 02:16:52 2024
@@ -1,11 +1,11 @@
-/* $NetBSD: intr.h,v 1.16 2023/07/11 11:06:04 riastradh Exp $ */
+/*	$NetBSD: intr.h,v 1.17 2024/01/15 02:16:52 thorpej Exp $	*/
 
 /*-
- * Copyright (c) 2000 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
- * by Tohru Nishimura.
+ * by Jason R. Thorpe.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,67 +29,18 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _MACHINE_INTR_H
-#define _MACHINE_INTR_H
+#ifndef _LUNA68K_INTR_H_
+#define _LUNA68K_INTR_H_
 
-#if defined(_KERNEL) || defined(_KMEMUSER)
-typedef struct {
-	uint16_t _psl;
-} ipl_cookie_t;
-#endif
+#include 
 
-#ifdef _KERNEL
+#define	MACHINE_PSL_IPL_SOFTCLOCK	PSL_IPL1
+#define	MACHINE_PSL_IPL_SOFTBIO		PSL_IPL1
+#define	

CVS commit: src/sys/arch/luna68k

2024-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan 15 02:16:52 UTC 2024

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

Log Message:
Switch luna68k over to the common interrupt dispatch code.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/include/intr.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.27 -r0 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/luna68k/luna68k/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/luna68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:17:47 UTC 2024

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.4 -r0 src/sys/arch/luna68k/luna68k/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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.32 src/sys/arch/luna68k/conf/files.luna68k:1.33
--- src/sys/arch/luna68k/conf/files.luna68k:1.32	Tue Jan  9 04:16:24 2024
+++ src/sys/arch/luna68k/conf/files.luna68k	Sun Jan 14 00:17:46 2024
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.32 2024/01/09 04:16:24 thorpej Exp $
+#	$NetBSD: files.luna68k,v 1.33 2024/01/14 00:17:46 thorpej Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -23,6 +23,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
 file dev/cons.c
 

Index: src/sys/arch/luna68k/luna68k/isr.c
diff -u src/sys/arch/luna68k/luna68k/isr.c:1.26 src/sys/arch/luna68k/luna68k/isr.c:1.27
--- src/sys/arch/luna68k/luna68k/isr.c:1.26	Fri Jan 12 23:36:29 2024
+++ src/sys/arch/luna68k/luna68k/isr.c	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $	*/
+/*	$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.26 2024/01/12 23:36:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.27 2024/01/14 00:17:46 thorpej Exp $");
 
 /*
  * Link and dispatch interrupts.
@@ -134,51 +134,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 isr_vectored *isr;
-
-	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);
-
-	isr = _vectored[vec - ISRVECTORED];
-
-	if ((vectab[vec] != badtrap) || (isr->isr_func != NULL))
-		panic("isrlink_vectored: vec 0x%x not available", vec);
-
-	/* Fill in the new entry. */
-	isr->isr_func = func;
-	isr->isr_arg = arg;
-	isr->isr_ipl = ipl;
-
-	/* Hook into the vector table. */
-	vectab[vec] = intrhand_vectored;
-}
-
-/*
- * Unhook a vectored interrupt.
- */
-void
-isrunlink_vectored(int vec)
-{
-
-	if ((vec < ISRVECTORED) || (vec >= ISRVECTORED + NISRVECTORED))
-		panic("isrunlink_vectored: bad vec 0x%x", vec);
-
-	if (vectab[vec] != intrhand_vectored)
-		panic("isrunlink_vectored: not vectored interrupt");
-
-	vectab[vec] = badtrap;
-	memset(_vectored[vec - ISRVECTORED], 0, sizeof(struct isr_vectored));
-}
-
-/*
  * This is the dispatcher called by the low-level
  * assembly language autovectored interrupt routine.
  */
@@ -222,42 +177,6 @@ isrdispatch_autovec(int evec)
 	idepth--;
 }
 
-/*
- * This is the dispatcher called by the low-level
- * assembly language vectored interrupt routine.
- */
-void
-isrdispatch_vectored(int pc, int evec, void *frame)
-{
-	struct isr_vectored *isr;
-	int ipl, vec;
-
-	idepth++;
-	vec = (evec & 0xfff) >> 2;
-	ipl = (getsr() >> 8) & 7;
-
-	intrcnt[ipl]++;
-	curcpu()->ci_data.cpu_nintr++;
-
-	if ((vec < ISRVECTORED) || (vec >= (ISRVECTORED + NISRVECTORED)))
-		panic("isrdispatch_vectored: bad vec 0x%x", vec);
-	isr = _vectored[vec - ISRVECTORED];
-
-	if (isr->isr_func == NULL) {
-		printf("isrdispatch_vectored: no handler for vec 0x%x\n", vec);
-		vectab[vec] = badtrap;
-		idepth--;
-		return;
-	}
-
-	/*
-	 * Handler gets exception frame if argument is NULL.
-	 */
-	if ((*isr->isr_func)(isr->isr_arg ? isr->isr_arg : frame) == 0)
-		printf("isrdispatch_vectored: vec 0x%x not claimed\n", vec);
-	idepth--;
-}
-
 bool
 cpu_intr_p(void)
 {

Index: src/sys/arch/luna68k/luna68k/isr.h
diff -u src/sys/arch/luna68k/luna68k/isr.h:1.4 src/sys/arch/luna68k/luna68k/isr.h:1.5
--- src/sys/arch/luna68k/luna68k/isr.h:1.4	Sat Mar 14 14:46:01 2009
+++ src/sys/arch/luna68k/luna68k/isr.h	Sun Jan 14 00:17:46 2024
@@ -1,4 +1,4 @@
-/*	

CVS commit: src/sys/arch/luna68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan 14 00:17:47 UTC 2024

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/vectors.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/isr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/luna68k/isr.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.4 -r0 src/sys/arch/luna68k/luna68k/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/luna68k

2023-12-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 29 02:30:36 UTC 2023

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

Log Message:
Use proper macro for the 030/040 TT registers to map LUNA's I/O spaces.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/include/pmap.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/luna68k/genassym.cf
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/luna68k/luna68k/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/luna68k/include/pmap.h
diff -u src/sys/arch/luna68k/include/pmap.h:1.10 src/sys/arch/luna68k/include/pmap.h:1.11
--- src/sys/arch/luna68k/include/pmap.h:1.10	Sun Nov  3 19:56:29 2002
+++ src/sys/arch/luna68k/include/pmap.h	Fri Dec 29 02:30:35 2023
@@ -1,3 +1,38 @@
-/*	$NetBSD: pmap.h,v 1.10 2002/11/03 19:56:29 chs Exp $	*/
+/*	$NetBSD: pmap.h,v 1.11 2023/12/29 02:30:35 tsutsui Exp $	*/
+
+#ifndef _LUNA68K_PMAP_H_
 
 #include 
+#include 
+
+/*
+ * Transparent translation register values for IO space 0x4000-0x
+ *
+ * map via TT0: 0x4000-0x7fff
+ * map via TT1: 0x8000-0x
+ *
+ * On 030 both use Function Codes 4-7 (to get SUPERD and SUPERP).
+ * XXX: they can probably just use SUPERD.
+ */
+
+#define	LUNA68K_TT30_IO0	(0x4000 |\
+ __SHIFTIN(0x3f,TT30_LAM) |		\
+ TT30_E | TT30_CI | TT30_RWM |	\
+__SHIFTIN(4,TT30_FCBASE) |		\
+__SHIFTIN(3,TT30_FCMASK))
+#define	LUNA68K_TT30_IO1	(0x8000 |\
+ __SHIFTIN(0x7f,TT30_LAM) |		\
+ TT30_E | TT30_CI | TT30_RWM |	\
+__SHIFTIN(4,TT30_FCBASE) |		\
+__SHIFTIN(3,TT30_FCMASK))
+
+#define	LUNA68K_TT40_IO0	(0x4000 |\
+ __SHIFTIN(0x3f,TTR40_LAM) |		\
+ TTR40_E | TTR40_SUPER |		\
+ PTE40_CM_NC_SER)
+#define	LUNA68K_TT40_IO1	(0x8000 |\
+ __SHIFTIN(0x7f,TTR40_LAM) |		\
+ TTR40_E | TTR40_SUPER |		\
+ PTE40_CM_NC_SER)
+
+#endif /* _LUNA68K_PMAP_H_ */

Index: src/sys/arch/luna68k/luna68k/genassym.cf
diff -u src/sys/arch/luna68k/luna68k/genassym.cf:1.25 src/sys/arch/luna68k/luna68k/genassym.cf:1.26
--- src/sys/arch/luna68k/luna68k/genassym.cf:1.25	Wed Dec 27 17:35:35 2023
+++ src/sys/arch/luna68k/luna68k/genassym.cf	Fri Dec 29 02:30:36 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.25 2023/12/27 17:35:35 thorpej Exp $
+#	$NetBSD: genassym.cf,v 1.26 2023/12/29 02:30:36 tsutsui Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -91,6 +91,12 @@ export	MMU51_CRP_BITS
 export	MMU51_TCR_BITS
 export	MMU40_TCR_BITS
 
+# Transparent translation register values (from pmap.h)
+export	LUNA68K_TT30_IO0
+export	LUNA68K_TT30_IO1
+export	LUNA68K_TT40_IO0
+export	LUNA68K_TT40_IO1
+
 # 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/luna68k/luna68k/locore.s
diff -u src/sys/arch/luna68k/luna68k/locore.s:1.71 src/sys/arch/luna68k/luna68k/locore.s:1.72
--- src/sys/arch/luna68k/luna68k/locore.s:1.71	Wed Dec 27 03:03:41 2023
+++ src/sys/arch/luna68k/luna68k/locore.s	Fri Dec 29 02:30:36 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.71 2023/12/27 03:03:41 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.72 2023/12/29 02:30:36 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -898,16 +898,16 @@ GLOBAL(protocrp)
 
 GLOBAL(prototc)
 	.long	MMU51_TCR_BITS	| %tc -- see pmap.h
-GLOBAL(protott0)		| tt0 0x4000.-0x7fff.
-	.long	0x403f8543	|
-GLOBAL(protott1)		| tt1 0x8000.-0x.
-	.long	0x807f8543	|
+GLOBAL(protott0)
+	.long	LUNA68K_TT30_IO0 | prototype transparent translation register 0
+GLOBAL(protott1)
+	.long	LUNA68K_TT30_IO1 | prototype transparent translation register 1
 GLOBAL(proto040tc)
 	.long	MMU40_TCR_BITS	| %tc -- see pmap.h
-GLOBAL(proto040tt0)		| tt0 0x4000.-0x7fff.
-	.long	0x403fa040	| kernel only, cache inhibit, serialized
-GLOBAL(proto040tt1)		| tt1 0x8000.-0x.
-	.long	0x807fa040	| kernel only, cache inhibit, serialized
+GLOBAL(proto040tt0)
+	.long	LUNA68K_TT40_IO0 | prototype transparent translation register 0
+GLOBAL(proto040tt1)
+	.long	LUNA68K_TT40_IO1 | prototype transparent translation register 1
 nullrp:
 	.long	0x7fff0001	| do-nothing MMU root pointer
 



CVS commit: src/sys/arch/luna68k

2023-12-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 29 02:30:36 UTC 2023

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

Log Message:
Use proper macro for the 030/040 TT registers to map LUNA's I/O spaces.

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/include/pmap.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/luna68k/genassym.cf
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/luna68k/luna68k/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/luna68k

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:35:14 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL majors.luna68k
src/sys/arch/luna68k/dev/xplx: xplx.asm

Log Message:
Remove trailing spaces and TAB.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/conf/majors.luna68k
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/dev/xplx/xplx.asm

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



CVS commit: src/sys/arch/luna68k

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:35:14 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL majors.luna68k
src/sys/arch/luna68k/dev/xplx: xplx.asm

Log Message:
Remove trailing spaces and TAB.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/conf/majors.luna68k
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/dev/xplx/xplx.asm

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

Modified files:

Index: src/sys/arch/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.136 src/sys/arch/luna68k/conf/GENERIC:1.137
--- src/sys/arch/luna68k/conf/GENERIC:1.136	Sun Feb 12 14:50:40 2023
+++ src/sys/arch/luna68k/conf/GENERIC	Fri Oct 13 16:35:14 2023
@@ -1,7 +1,7 @@
-# $NetBSD: GENERIC,v 1.136 2023/02/12 14:50:40 abs Exp $
+# $NetBSD: GENERIC,v 1.137 2023/10/13 16:35:14 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/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.136 $"
+#ident 		"GENERIC-$Revision: 1.137 $"
 
 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/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.35 src/sys/arch/luna68k/conf/INSTALL:1.36
--- src/sys/arch/luna68k/conf/INSTALL:1.35	Sun Aug  7 02:52:27 2022
+++ src/sys/arch/luna68k/conf/INSTALL	Fri Oct 13 16:35:14 2023
@@ -1,7 +1,7 @@
-# $NetBSD: INSTALL,v 1.35 2022/08/07 02:52:27 simonb Exp $
+# $NetBSD: INSTALL,v 1.36 2023/10/13 16:35:14 tsutsui Exp $
 #
 # config for installation ramdisk kernel
-# 
+#
 include 	"arch/luna68k/conf/std.luna68k"
 
 makeoptions	COPTS="-Os -fno-unwind-tables"	# Optimise for space.

Index: src/sys/arch/luna68k/conf/majors.luna68k
diff -u src/sys/arch/luna68k/conf/majors.luna68k:1.25 src/sys/arch/luna68k/conf/majors.luna68k:1.26
--- src/sys/arch/luna68k/conf/majors.luna68k:1.25	Fri Jun 10 21:42:23 2022
+++ src/sys/arch/luna68k/conf/majors.luna68k	Fri Oct 13 16:35:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.luna68k,v 1.25 2022/06/10 21:42:23 tsutsui Exp $
+#	$NetBSD: majors.luna68k,v 1.26 2023/10/13 16:35:14 tsutsui Exp $
 #
 # Device majors for luna68k
 #
@@ -45,5 +45,5 @@ device-major	audio		char 42			audio
 #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/luna68k/dev/xplx/xplx.asm
diff -u src/sys/arch/luna68k/dev/xplx/xplx.asm:1.1 src/sys/arch/luna68k/dev/xplx/xplx.asm:1.2
--- src/sys/arch/luna68k/dev/xplx/xplx.asm:1.1	Fri Jun 10 21:42:24 2022
+++ src/sys/arch/luna68k/dev/xplx/xplx.asm	Fri Oct 13 16:35:14 2023
@@ -117,7 +117,7 @@
 ;
 ;  +4.b STAT_RESET
 ;ファームウェア転送で 0 にされる。
-;リセット位置の実行のたびに +1 
+;リセット位置の実行のたびに +1
 ;すなわち何もなければ 1 になっている。
 ;  +5.3 align
 ;  +8.w PRT0_TIMER
@@ -1491,7 +1491,7 @@ PAM_DRIVER_MAP:
 	DW	136		;CYCLE_CLK
 	DB	36		;REPT_CLK
 	DB	38		;REPT_MAX
-	
+
 
 
 PAM_DRIVER_MAP_LEN:	.EQU	$-PAM_DRIVER_MAP



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

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:30:01 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: bmd.c

Log Message:
Fix spelling. From OpenBSD/luna88k.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/stand/boot/bmd.c

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

Modified files:

Index: src/sys/arch/luna68k/stand/boot/bmd.c
diff -u src/sys/arch/luna68k/stand/boot/bmd.c:1.8 src/sys/arch/luna68k/stand/boot/bmd.c:1.9
--- src/sys/arch/luna68k/stand/boot/bmd.c:1.8	Sun Jun 30 05:04:49 2019
+++ src/sys/arch/luna68k/stand/boot/bmd.c	Fri Oct 13 16:30:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bmd.c,v 1.8 2019/06/30 05:04:49 tsutsui Exp $	*/
+/*	$NetBSD: bmd.c,v 1.9 2023/10/13 16:30:01 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -471,7 +471,7 @@ bmdclear(void)
 
 
 /*
- *  charactor operation routines
+ *  character operation routines
  */
 
 static void



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

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:30:01 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: bmd.c

Log Message:
Fix spelling. From OpenBSD/luna88k.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/stand/boot/bmd.c

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



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

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:10:24 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: ufs_disksubr.c

Log Message:
Fix typo.  From OpenBSD/luna88k.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/ufs_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/luna68k/stand/boot/ufs_disksubr.c
diff -u src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.6 src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.7
--- src/sys/arch/luna68k/stand/boot/ufs_disksubr.c:1.6	Mon May 17 19:31:38 2021
+++ src/sys/arch/luna68k/stand/boot/ufs_disksubr.c	Fri Oct 13 16:10:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_disksubr.c,v 1.6 2021/05/17 19:31:38 mrg Exp $	*/
+/*	$NetBSD: ufs_disksubr.c,v 1.7 2023/10/13 16:10:24 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -85,7 +85,7 @@
 
 /*
  * Attempt to read a disk label from a device
- * using the indicated stategy routine.
+ * using the indicated strategy routine.
  * The label must be partly set up before this:
  * secpercyl and anything required in the strategy routine
  * (e.g., sector size) must be filled in before calling us.



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

2023-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Oct 13 16:10:24 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: ufs_disksubr.c

Log Message:
Fix typo.  From OpenBSD/luna88k.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/ufs_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/luna68k

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 12:30:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: files.luna68k
src/sys/arch/luna68k/luna68k: trap.c

Log Message:
fix KGDB enabled build for luna68k:
* include sys/kgdb.h in luna68k/trap.c for missing definitions.
* cast second kgdb_trap argument to (db_regs_t *).
* build m68k/kgdb_machdep.c in kgdb enable build for kgdb_trap() implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/luna68k/luna68k/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/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.30 src/sys/arch/luna68k/conf/files.luna68k:1.31
--- src/sys/arch/luna68k/conf/files.luna68k:1.30	Fri Jun 10 21:42:23 2022
+++ src/sys/arch/luna68k/conf/files.luna68k	Sun Sep 17 12:30:00 2023
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: files.luna68k,v 1.30 2022/06/10 21:42:23 tsutsui Exp $
+#	$NetBSD: files.luna68k,v 1.31 2023/09/17 12:30:00 andvar Exp $
 #
 maxpartitions 8
 maxusers 2 8 64
@@ -16,6 +16,7 @@ file arch/luna68k/luna68k/pmap_bootstrap
 file arch/luna68k/luna68k/trap.c
 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/fpu.c		compile-with "${M68K_KERN_FPU}"
 file arch/m68k/m68k/m68k_trap.c
 file arch/m68k/m68k/pmap_motorola.c

Index: src/sys/arch/luna68k/luna68k/trap.c
diff -u src/sys/arch/luna68k/luna68k/trap.c:1.76 src/sys/arch/luna68k/luna68k/trap.c:1.77
--- src/sys/arch/luna68k/luna68k/trap.c:1.76	Sat Sep 16 20:53:18 2023
+++ src/sys/arch/luna68k/luna68k/trap.c	Sun Sep 17 12:30:00 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.76 2023/09/16 20:53:18 andvar Exp $ */
+/* $NetBSD: trap.c,v 1.77 2023/09/17 12:30:00 andvar Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.76 2023/09/16 20:53:18 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.77 2023/09/17 12:30:00 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -258,7 +259,7 @@ trap(struct frame *fp, int type, unsigne
 		s = splhigh();
 #ifdef KGDB
 		/* If connected, step or cont returns 1 */
-		if (kgdb_trap(type, fp))
+		if (kgdb_trap(type, (db_regs_t *)fp))
 			goto kgdb_cont;
 #endif
 #ifdef DDB



CVS commit: src/sys/arch/luna68k

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 12:30:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: files.luna68k
src/sys/arch/luna68k/luna68k: trap.c

Log Message:
fix KGDB enabled build for luna68k:
* include sys/kgdb.h in luna68k/trap.c for missing definitions.
* cast second kgdb_trap argument to (db_regs_t *).
* build m68k/kgdb_machdep.c in kgdb enable build for kgdb_trap() implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 10:14:49 UTC 2023

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

Log Message:
all sunos_exec_aout_makecmds references were removed from machedep back in 1997,
as the code was standardized and moved to sunos_exec_aout.c.

removing this code from luna68k as well, for whatever reason it was missed.

Fixes build with COMPAT_SUNOS enabled for luna68k.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k/machdep.c
diff -u src/sys/arch/luna68k/luna68k/machdep.c:1.108 src/sys/arch/luna68k/luna68k/machdep.c:1.109
--- src/sys/arch/luna68k/luna68k/machdep.c:1.108	Sat Oct  9 20:00:41 2021
+++ src/sys/arch/luna68k/luna68k/machdep.c	Sun Sep 17 10:14:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.108 2021/10/09 20:00:41 tsutsui Exp $ */
+/* $NetBSD: machdep.c,v 1.109 2023/09/17 10:14:49 andvar Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.108 2021/10/09 20:00:41 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.109 2023/09/17 10:14:49 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -822,14 +822,7 @@ luna68k_abort(const char *cp)
 int
 cpu_exec_aout_makecmds(struct lwp *l, struct exec_package *epp)
 {
-	int error = ENOEXEC;
-#ifdef COMPAT_SUNOS
-	extern sunos_exec_aout_makecmds(struct proc *, struct exec_package *);
-
-	if ((error = sunos_exec_aout_makecmds(l->l_proc, epp)) == 0)
-		return 0;
-#endif
-	return error;
+	return ENOEXEC;
 }
 
 #ifdef MODULAR



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

2023-09-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 17 10:14:49 UTC 2023

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

Log Message:
all sunos_exec_aout_makecmds references were removed from machedep back in 1997,
as the code was standardized and moved to sunos_exec_aout.c.

removing this code from luna68k as well, for whatever reason it was missed.

Fixes build with COMPAT_SUNOS enabled for luna68k.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/luna68k/luna68k/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/luna68k/include

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/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/luna68k/include/intr.h
diff -u src/sys/arch/luna68k/include/intr.h:1.15 src/sys/arch/luna68k/include/intr.h:1.16
--- src/sys/arch/luna68k/include/intr.h:1.15	Sat Mar 22 16:52:07 2014
+++ src/sys/arch/luna68k/include/intr.h	Tue Jul 11 11:06:04 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.15 2014/03/22 16:52:07 tsutsui Exp $ */
+/* $NetBSD: intr.h,v 1.16 2023/07/11 11:06:04 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -32,6 +32,12 @@
 #ifndef _MACHINE_INTR_H
 #define _MACHINE_INTR_H
 
+#if defined(_KERNEL) || defined(_KMEMUSER)
+typedef struct {
+	uint16_t _psl;
+} ipl_cookie_t;
+#endif
+
 #ifdef _KERNEL
 
 /*
@@ -62,9 +68,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/luna68k/include

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

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

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


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

2023-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 24 08:00:52 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: sioreg.h

Log Message:
Add comments and remove nonexistent status registers.


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

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



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

2023-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 24 08:00:52 UTC 2023

Modified Files:
src/sys/arch/luna68k/stand/boot: sioreg.h

Log Message:
Add comments and remove nonexistent status registers.


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

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

Modified files:

Index: src/sys/arch/luna68k/stand/boot/sioreg.h
diff -u src/sys/arch/luna68k/stand/boot/sioreg.h:1.5 src/sys/arch/luna68k/stand/boot/sioreg.h:1.6
--- src/sys/arch/luna68k/stand/boot/sioreg.h:1.5	Tue Mar 28 20:01:57 2023
+++ src/sys/arch/luna68k/stand/boot/sioreg.h	Sat Jun 24 08:00:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sioreg.h,v 1.5 2023/03/28 20:01:57 andvar Exp $	*/
+/*	$NetBSD: sioreg.h,v 1.6 2023/06/24 08:00:52 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -98,17 +98,14 @@ struct siodevice {
 #define WR6		0x06
 #define WR7		0x07
 
-#define WR2A		0x02
-#define WR2B		0x12
+#define WR2A		0x02	/* on channel A */
+#define WR2B		0x12	/* on channel B */
 
 #define RR0		0x08
 #define RR1		0x09
 #define RR2		0x0A
-#define RR3		0x0B
-#define RR4		0x0C
 
-#define RR2A		0x0A
-#define RR2B		0x1A
+#define RR2B		0x1A	/* only on channel B */
 
 #define WR0_NOP		0x00	/* No Operation */
 #define WR0_SNDABRT	0x08	/* Send Abort (HDLC) */



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

2023-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 24 07:02:11 UTC 2023

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

Log Message:
Fix a wrong cdb size of SCSI disk write command.  From OpenBSD/luna88k.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/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/luna68k/stand/boot/sd.c
diff -u src/sys/arch/luna68k/stand/boot/sd.c:1.12 src/sys/arch/luna68k/stand/boot/sd.c:1.13
--- src/sys/arch/luna68k/stand/boot/sd.c:1.12	Sat Feb 14 13:07:39 2015
+++ src/sys/arch/luna68k/stand/boot/sd.c	Sat Jun 24 07:02:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.12 2015/02/14 13:07:39 tsutsui Exp $	*/
+/*	$NetBSD: sd.c,v 1.13 2023/06/24 07:02:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -215,7 +215,7 @@ static struct scsi_generic_cdb cdb_read 
 };
 
 static struct scsi_generic_cdb cdb_write = {
-	6,
+	10,
 	{ CMD_WRITE_EXT, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 };
 



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

2023-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 24 07:02:11 UTC 2023

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

Log Message:
Fix a wrong cdb size of SCSI disk write command.  From OpenBSD/luna88k.


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

2023-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 23 06:58:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: spc.c
src/sys/arch/luna68k/luna68k: mainbus.c

Log Message:
Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in .

Tested on both LUNA and LUNA-II.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/spc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/luna68k/luna68k/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/luna68k/dev/spc.c
diff -u src/sys/arch/luna68k/dev/spc.c:1.10 src/sys/arch/luna68k/dev/spc.c:1.11
--- src/sys/arch/luna68k/dev/spc.c:1.10	Tue Jan 22 15:44:25 2013
+++ src/sys/arch/luna68k/dev/spc.c	Sun Apr 23 06:57:59 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $ */
+/* $NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -66,11 +67,17 @@ spc_mainbus_match(device_t parent, cfdat
 
 	if (strcmp(ma->ma_name, spc_cd.cd_name))
 		return 0;
-#if 0
-	if (badaddr((void *)ma->ma_addr, 4))
+
+	/*
+	 * LUNA-I doesn't have the secondary SCSI.
+	 * However we cannot check it by badaddr() at the address range
+	 * of the secondary SCSI on LUNA-II because the address bus lines
+	 * are not fully decoded on LUNA-I and the primary SCSI registers
+	 * are also accessible at the seconadary address range.
+	 */
+	if (machtype == LUNA_I && ma->ma_addr != SCSI_ADDR)
 		return 0;
-	/* Experiments proved 2nd SPC address does NOT make a buserror. */
-#endif
+
 	return 1;
 }
 

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.20 src/sys/arch/luna68k/luna68k/mainbus.c:1.21
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.20	Thu Apr 13 11:44:10 2023
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Sun Apr 23 06:57:59 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -39,26 +39,17 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 
 #include 
 #include 
+#include 
 
 static const struct mainbus_attach_args luna_devs[] = {
-	{ "clock",  0x4500, -1 },	/* Mostek TimeKeeper */
-	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
-	{ "le", 0xf100, 3 },	/* Am7990 */
-	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
-	{ "fb", 0xc110, -1 },	/* BrookTree RAMDAC */
-	{ "spc",0xe100, 2 },	/* MB89352 */
-};
-
-static const struct mainbus_attach_args luna2_devs[] = {
-	{ "clock",  0x4500, -1 },	/* Dallas TimeKeeper */
-	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
-	{ "le", 0xf100, 3 },	/* Am7990 */
-	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
-	{ "fb", 0xc110, -1 },	/* BrookTree RAMDAC */
-	{ "spc",0xe100, 2 },	/* internal MB89352 */
-	{ "spc",0xe140, 2 },	/* external MB89352 */
+	{ "clock",  NVRAM_ADDR, -1 },	/* Mostek/Dallas TimeKeeper */
+	{ "lcd",OBIO_PIO1A, -1 },	/* Sharp LM16X212 LCD module */
+	{ "le", LANCE_ADDR, 3 },	/* Am7990 */
+	{ "sio",OBIO_SIO, 6 },	/* uPD7201A */
+	{ "xpbus",  TRI_PORT_RAM, -1 },	/* HD647180XP */
+	{ "fb", BMAP_PALLET2, -1 },	/* BrookTree RAMDAC */
+	{ "spc",SCSI_ADDR, 2 },	/* internal MB89352 */
+	{ "spc",SCSI_2_ADDR, 2 },	/* external MB89352 (on LUNA-II) */
 };
 
 static void mainbus_attach(device_t, device_t, void *);
@@ -87,13 +78,9 @@ mainbus_attach(device_t parent, device_t
 	const struct mainbus_attach_args *devs;
 	struct mainbus_attach_args ma;
 
-	if (machtype == LUNA_II) {
-		devs = luna2_devs;
-		ndevs = __arraycount(luna2_devs);
-	} else {
-		devs = luna_devs;
-		ndevs = __arraycount(luna_devs);
-	}
+	devs = luna_devs;
+	ndevs = __arraycount(luna_devs);
+
 	aprint_normal("\n");
 	for (i = 0; i < ndevs; i++) {
 		ma = devs[i];



CVS commit: src/sys/arch/luna68k

2023-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 23 06:58:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: spc.c
src/sys/arch/luna68k/luna68k: mainbus.c

Log Message:
Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in .

Tested on both LUNA and LUNA-II.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/spc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/luna68k/luna68k/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/luna68k

2023-04-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 22 10:00:24 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k: trap.c
src/sys/arch/luna68k/stand/boot: trap.c

Log Message:
Remove ancient /*ARGSUSED*/ comments.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/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/luna68k/luna68k/trap.c
diff -u src/sys/arch/luna68k/luna68k/trap.c:1.74 src/sys/arch/luna68k/luna68k/trap.c:1.75
--- src/sys/arch/luna68k/luna68k/trap.c:1.74	Sun Jan 15 05:08:33 2023
+++ src/sys/arch/luna68k/luna68k/trap.c	Sat Apr 22 10:00:24 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.74 2023/01/15 05:08:33 tsutsui Exp $ */
+/* $NetBSD: trap.c,v 1.75 2023/04/22 10:00:24 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.74 2023/01/15 05:08:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.75 2023/04/22 10:00:24 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -218,7 +218,6 @@ machine_userret(struct lwp *l, struct fr
  * including events such as simulated software interrupts/AST's.
  * System calls are broken out for efficiency.
  */
-/*ARGSUSED*/
 void
 trap(struct frame *fp, int type, unsigned code, unsigned v)
 {

Index: src/sys/arch/luna68k/stand/boot/trap.c
diff -u src/sys/arch/luna68k/stand/boot/trap.c:1.2 src/sys/arch/luna68k/stand/boot/trap.c:1.3
--- src/sys/arch/luna68k/stand/boot/trap.c:1.2	Tue Jun 15 18:54:34 2021
+++ src/sys/arch/luna68k/stand/boot/trap.c	Sat Apr 22 10:00:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.2 2021/06/15 18:54:34 tsutsui Exp $	*/
+/*	$NetBSD: trap.c,v 1.3 2023/04/22 10:00:24 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -98,7 +98,6 @@ const char *trap_type[] = {
 /*
  * Called from the trap handler when a processor trap occurs.
  */
-/*ARGSUSED*/
 void
 trap(int type, unsigned int code, unsigned int v, struct frame frame)
 {



CVS commit: src/sys/arch/luna68k

2023-04-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Apr 22 10:00:24 UTC 2023

Modified Files:
src/sys/arch/luna68k/luna68k: trap.c
src/sys/arch/luna68k/stand/boot: trap.c

Log Message:
Remove ancient /*ARGSUSED*/ comments.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/luna68k/luna68k/trap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/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/luna68k/luna68k

2023-04-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 13 11:44:10 UTC 2023

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

Log Message:
Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/luna68k/luna68k/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/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.19 src/sys/arch/luna68k/luna68k/mainbus.c:1.20
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.19	Sun Jan 15 05:08:33 2023
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Thu Apr 13 11:44:10 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.19 2023/01/15 05:08:33 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.19 2023/01/15 05:08:33 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ static const struct mainbus_attach_args 
 	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
 	{ "le", 0xf100, 3 },	/* Am7990 */
 	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xp", 0x7100, 1 },	/* HD647180XP */
+	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
 	{ "fb", 0xc110, -1 },	/* BrookTree RAMDAC */
 	{ "spc",0xe100, 2 },	/* internal MB89352 */
 	{ "spc",0xe140, 2 },	/* external MB89352 */



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

2023-04-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 13 11:44:10 UTC 2023

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

Log Message:
Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.


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

2023-04-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Apr 11 13:26:19 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: Makefile.luna68k

Log Message:
Fix missing locore.d dependency output on make depend.

Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):
 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13

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


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

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

Modified files:

Index: src/sys/arch/luna68k/conf/Makefile.luna68k
diff -u src/sys/arch/luna68k/conf/Makefile.luna68k:1.29 src/sys/arch/luna68k/conf/Makefile.luna68k:1.30
--- src/sys/arch/luna68k/conf/Makefile.luna68k:1.29	Sat Sep 22 12:24:02 2018
+++ src/sys/arch/luna68k/conf/Makefile.luna68k	Tue Apr 11 13:26:19 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.luna68k,v 1.29 2018/09/22 12:24:02 rin Exp $
+#	$NetBSD: Makefile.luna68k,v 1.30 2023/04/11 13:26:19 tsutsui Exp $
 
 # Makefile for NetBSD
 #
@@ -48,7 +48,7 @@ OPT_MODULAR=	%MODULAR%
 MD_OBJS=	locore.o
 MD_LIBS=	${FPSP}
 MD_CFILES=
-MD_SFILES=	
+MD_SFILES=	${LUNA68K}/luna68k/locore.s
 
 locore.o: ${LUNA68K}/luna68k/locore.s assym.h
 	${NORMAL_S}



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

2023-04-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Apr 11 13:26:19 UTC 2023

Modified Files:
src/sys/arch/luna68k/conf: Makefile.luna68k

Log Message:
Fix missing locore.d dependency output on make depend.

Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):
 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13

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


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

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



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

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

Modified Files:
src/sys/arch/luna68k/include: bus.h

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

Sync with next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/include/bus.h

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

Modified files:

Index: src/sys/arch/luna68k/include/bus.h
diff -u src/sys/arch/luna68k/include/bus.h:1.17 src/sys/arch/luna68k/include/bus.h:1.18
--- src/sys/arch/luna68k/include/bus.h:1.17	Sun Jan 15 05:08:33 2023
+++ src/sys/arch/luna68k/include/bus.h	Fri Jan 27 19:49:21 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.17 2023/01/15 05:08:33 tsutsui Exp $	*/
+/*	$NetBSD: bus.h,v 1.18 2023/01/27 19:49:21 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -177,7 +177,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)*4), "g" (a), "g" ((size_t)(c)) :	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 #define	bus_space_read_multi_2(t, h, o, a, c) do {			\
@@ -191,7 +191,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)*2), "g" (a), "g" ((size_t)(c)) :	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 #define	bus_space_read_multi_4(t, h, o, a, c) do {			\
@@ -205,7 +205,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" ((size_t)(c))	:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 /*
@@ -230,7 +230,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)*4), "g" (a), "g" ((size_t)(c)) :	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 #define	bus_space_read_region_2(t, h, o, a, c) do {			\
@@ -245,7 +245,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)*2), "g" (a), "g" ((size_t)(c)) :	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 #define	bus_space_read_region_4(t, h, o, a, c) do {			\
@@ -259,7 +259,7 @@ void	bus_space_free(bus_space_tag_t t, b
 		jne	1b"	:	\
 :	\
 		"r" ((h) + (o)), "g" (a), "g" ((size_t)(c))	:	\
-		"a0","a1","d0");	\
+		"a0","a1","d0","memory");\
 } while (0)
 
 /*



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

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

Modified Files:
src/sys/arch/luna68k/include: bus.h

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

Sync with next68k.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/include/bus.h

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



CVS commit: src/sys/arch/luna68k

2023-01-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan 15 05:08:33 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: lcd.c lunaws.c omkbdmap.c omrasops.c
psgpam_enc.c siotty.c xp.c
src/sys/arch/luna68k/include: bus.h cpu.h lcd.h param.h vmparam.h
src/sys/arch/luna68k/luna68k: disksubr.c mainbus.c pmap_bootstrap.c
trap.c

Log Message:
TAB/space/indent cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/dev/lcd.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/dev/omkbdmap.c \
src/sys/arch/luna68k/dev/psgpam_enc.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/xp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/include/bus.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/lcd.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/luna68k/include/param.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/include/vmparam.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/luna68k/disksubr.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/luna68k/luna68k/mainbus.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/luna68k/luna68k/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/luna68k

2023-01-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan 15 05:08:33 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: lcd.c lunaws.c omkbdmap.c omrasops.c
psgpam_enc.c siotty.c xp.c
src/sys/arch/luna68k/include: bus.h cpu.h lcd.h param.h vmparam.h
src/sys/arch/luna68k/luna68k: disksubr.c mainbus.c pmap_bootstrap.c
trap.c

Log Message:
TAB/space/indent cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/dev/lcd.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/dev/omkbdmap.c \
src/sys/arch/luna68k/dev/psgpam_enc.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/xp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/include/bus.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/lcd.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/luna68k/include/param.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/include/vmparam.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/luna68k/disksubr.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/luna68k/luna68k/mainbus.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/luna68k/luna68k/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/luna68k/dev/lcd.c
diff -u src/sys/arch/luna68k/dev/lcd.c:1.12 src/sys/arch/luna68k/dev/lcd.c:1.13
--- src/sys/arch/luna68k/dev/lcd.c:1.12	Tue Dec 29 17:17:14 2020
+++ src/sys/arch/luna68k/dev/lcd.c	Sun Jan 15 05:08:33 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lcd.c,v 1.12 2020/12/29 17:17:14 tsutsui Exp $ */
+/* $NetBSD: lcd.c,v 1.13 2023/01/15 05:08:33 tsutsui Exp $ */
 /* $OpenBSD: lcd.c,v 1.7 2015/02/10 22:42:35 miod Exp $ */
 
 /*-
@@ -32,7 +32,7 @@
 
 #include 		/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.12 2020/12/29 17:17:14 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcd.c,v 1.13 2023/01/15 05:08:33 tsutsui Exp $");
 
 #include 
 #include 
@@ -297,7 +297,7 @@ lcdbusywait(void)
 	s = splhigh();
 	p1->portC = POWER | READ_BUSY | DISABLE;
 	splx(s);
-}	
+}
 
 static void
 lcdput(int cc)

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.41 src/sys/arch/luna68k/dev/lunaws.c:1.42
--- src/sys/arch/luna68k/dev/lunaws.c:1.41	Sat Jun 25 01:54:37 2022
+++ src/sys/arch/luna68k/dev/lunaws.c	Sun Jan 15 05:08:33 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.41 2022/06/25 01:54:37 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.42 2023/01/15 05:08:33 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.41 2022/06/25 01:54:37 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.42 2023/01/15 05:08:33 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -525,7 +525,7 @@ omkbd_get_buzcmd(struct ws_softc *sc, st
 		buzcmd |= OMKBD_BUZZER_150HZ;
 	else
 		buzcmd |= OMKBD_BUZZER_100HZ;
-		
+
 	/* no volume control for buzzer on the LUNA keyboards */
 
 	return buzcmd;

Index: src/sys/arch/luna68k/dev/omkbdmap.c
diff -u src/sys/arch/luna68k/dev/omkbdmap.c:1.2 src/sys/arch/luna68k/dev/omkbdmap.c:1.3
--- src/sys/arch/luna68k/dev/omkbdmap.c:1.2	Sat Oct  4 14:42:41 2014
+++ src/sys/arch/luna68k/dev/omkbdmap.c	Sun Jan 15 05:08:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: omkbdmap.c,v 1.2 2014/10/04 14:42:41 tsutsui Exp $	*/
+/*	$NetBSD: omkbdmap.c,v 1.3 2023/01/15 05:08:33 tsutsui Exp $	*/
 /*	$OpenBSD: omkbdmap.c,v 1.2 2013/11/16 18:31:44 miod Exp $	*/
 
 /* Partially from:
@@ -97,9 +97,9 @@ const uint8_t omkbd_raw[0x80] = {
 	0x0c,		/* 0x2c: equal */
 	0x0d,		/* 0x2d: asciitilde */
 	0x7d,		/* 0x2e: bar */
-	0x00, 		/* 0x2f */
-	0x00, 		/* 0x30: f13 */
-	0x00, 		/* 0x31: f14 */
+	0x00,		/* 0x2f */
+	0x00,		/* 0x30: f13 */
+	0x00,		/* 0x31: f14 */
 	0x10,		/* 0x32 */
 	0x11,		/* 0x33 */
 	0x12,		/* 0x34 */
@@ -207,7 +207,7 @@ static const keysym_t omkbd_keydesc_jp[]
 	KC(0x1d),			KS_KP_Left,
 	KC(0x1e),			KS_KP_Right,
 	KC(0x1f),			KS_KP_Down,
-	/* 0x20, 			KS_f11, */
+	/* 0x20,			KS_f11, */
 	/* 0x21,			KS_f12, */
 	KC(0x22),			KS_1,		KS_exclam,
 	KC(0x23),			KS_2,		KS_quotedbl,
Index: src/sys/arch/luna68k/dev/psgpam_enc.c
diff -u src/sys/arch/luna68k/dev/psgpam_enc.c:1.2 src/sys/arch/luna68k/dev/psgpam_enc.c:1.3
--- src/sys/arch/luna68k/dev/psgpam_enc.c:1.2	Sat Oct  1 13:41:12 2022
+++ src/sys/arch/luna68k/dev/psgpam_enc.c	Sun Jan 15 05:08:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: psgpam_enc.c,v 1.2 2022/10/01 13:41:12 tsutsui Exp $	*/
+/*	$NetBSD: psgpam_enc.c,v 1.3 2023/01/15 05:08:33 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2018 Yosuke 

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

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

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

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

No binary change.

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


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/luna68k/dev/siotty.c

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



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

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

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

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

No binary change.

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


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/luna68k/dev/siotty.c

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

Modified files:

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



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

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

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

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

No functional change.


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

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

Modified files:

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

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

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

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

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

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

No functional change.


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

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



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

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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/lunafb.c

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

Modified files:

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



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

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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/lunafb.c

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



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/dev/omrasops.c

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

Modified files:

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



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/luna68k/dev/omrasops.c

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



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

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

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

Log Message:
Remove trailing whitespaces.


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

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



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

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

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

Log Message:
Remove trailing whitespaces.


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

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

Modified files:

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

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



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

2022-09-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Sep 25 11:28:40 UTC 2022

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

Log Message:
lunafb: Improve drawing performance using VRAM ROP features.
- Drawing a character on 4bpp normally needs 4 times writes, but by using
  VRAM ROP actively, it can be reduced to write only once.
  The same goes for copyrows.  If the whole row consists of only two colors
  (one foreground and one background), it can be copied by reading once and
  writing once, regardless of the number of planes.  Only if the row consists
  of more than two colors, it will be copied plane by plane.
- On 8bpp board, it acts as 4bpp (16 colors).
- On 4bpp board on the real LUNA-I(68030/20MHz), monochrome scroll is about
  4 times faster even without asm.  Using asm improves it by additional 5%
  (asm is enabled by default).
- By tsutsui@-san's report, even color scroll is about about 2 times faster
  on his 8bpp board on the real LUNA-II(68040).
This was first developped by Y.Sugahara back in late 2019, and was modified
a lot by me in 2022.
http://mail-index.netbsd.org/port-luna68k/2022/09/23/msg72.html


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/dev/omrasopsvar.h

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



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

2022-09-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Sep 25 11:28:40 UTC 2022

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

Log Message:
lunafb: Improve drawing performance using VRAM ROP features.
- Drawing a character on 4bpp normally needs 4 times writes, but by using
  VRAM ROP actively, it can be reduced to write only once.
  The same goes for copyrows.  If the whole row consists of only two colors
  (one foreground and one background), it can be copied by reading once and
  writing once, regardless of the number of planes.  Only if the row consists
  of more than two colors, it will be copied plane by plane.
- On 8bpp board, it acts as 4bpp (16 colors).
- On 4bpp board on the real LUNA-I(68030/20MHz), monochrome scroll is about
  4 times faster even without asm.  Using asm improves it by additional 5%
  (asm is enabled by default).
- By tsutsui@-san's report, even color scroll is about about 2 times faster
  on his 8bpp board on the real LUNA-II(68040).
This was first developped by Y.Sugahara back in late 2019, and was modified
a lot by me in 2022.
http://mail-index.netbsd.org/port-luna68k/2022/09/23/msg72.html


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/luna68k/dev/lunafb.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/luna68k/dev/omrasops.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/luna68k/dev/omrasopsvar.h

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.46 src/sys/arch/luna68k/dev/lunafb.c:1.47
--- src/sys/arch/luna68k/dev/lunafb.c:1.46	Thu Jul 14 20:13:21 2022
+++ src/sys/arch/luna68k/dev/lunafb.c	Sun Sep 25 11:28:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.47 2022/09/25 11:28:40 isaki Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.47 2022/09/25 11:28:40 isaki Exp $");
 
 #include 
 #include 
@@ -76,6 +76,8 @@ struct bt458 {
 
 #define	OMFB_RFCNT	BMAP_RFCNT	/* video h-origin/v-origin */
 #define	OMFB_RAMDAC	BMAP_PALLET2	/* Bt454/Bt458 RAMDAC */
+#define	OMFB_FB_WADDR	(BMAP_BMP + 8)	/* common bitmap plane */
+#define	OMFB_FB_RADDR	(BMAP_BMAP0 + 8)/* bitmap plane #0 */
 
 #define	OMFB_SIZE	(BMAP_FN0 - BMAP_BMP + PAGE_SIZE)
 
@@ -173,6 +175,8 @@ CFATTACH_DECL_NEW(fb, sizeof(struct omfb
 
 extern int hwplanemask;	/* hardware planemask; retrieved at boot */
 
+int hwplanecount;	/* for omrasops */
+
 static int omfb_console;
 int  omfb_cnattach(void);
 
@@ -456,7 +460,7 @@ omfb_resetcmap(struct om_hwdevconfig *dc
 static void
 omfb_getdevconfig(paddr_t paddr, struct om_hwdevconfig *dc)
 {
-	int bpp, i;
+	int i;
 	struct rasops_info *ri;
 	union {
 		struct { short h, v; } p;
@@ -465,21 +469,21 @@ omfb_getdevconfig(paddr_t paddr, struct 
 
 	switch (hwplanemask) {
 	case 0xff:
-		bpp = 8;	/* XXX check monochrome bit in DIPSW */
+		hwplanecount = 8;	/* XXX check monochrome bit in DIPSW */
 		break;
 	default:
 	case 0x0f:
-		bpp = 4;	/* XXX check monochrome bit in DIPSW */
+		hwplanecount = 4;	/* XXX check monochrome bit in DIPSW */
 		break;
 	case 1:
-		bpp = 1;
+		hwplanecount = 1;
 		break;
 	}
 	dc->dc_wid = 1280;
 	dc->dc_ht = 1024;
-	dc->dc_depth = bpp;
+	dc->dc_depth = hwplanecount;
 	dc->dc_rowbytes = 2048 / 8;
-	dc->dc_cmsize = (bpp == 1) ? 0 : 1 << bpp;
+	dc->dc_cmsize = (hwplanecount == 1) ? 0 : 1 << hwplanecount;
 	dc->dc_videobase = paddr;
 
 	omfb_resetcmap(dc);
@@ -509,7 +513,7 @@ omfb_getdevconfig(paddr_t paddr, struct 
 		ri->ri_flg |= RI_NO_AUTO;
 	ri->ri_hw = dc;
 
-	if (bpp == 4 || bpp == 8)
+	if (hwplanecount == 4 || hwplanecount == 8)
 		omrasops4_init(ri, 34, 80);
 	else
 		omrasops1_init(ri, 34, 80);

Index: src/sys/arch/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.22 src/sys/arch/luna68k/dev/omrasops.c:1.23
--- src/sys/arch/luna68k/dev/omrasops.c:1.22	Sun Sep 25 11:22:36 2022
+++ src/sys/arch/luna68k/dev/omrasops.c	Sun Sep 25 11:28:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.22 2022/09/25 11:22:36 isaki Exp $ */
+/* $NetBSD: omrasops.c,v 1.23 2022/09/25 11:28:40 isaki Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.22 2022/09/25 11:22:36 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.23 2022/09/25 11:28:40 isaki Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -41,6 +41,15 @@ __KERNEL_RCSID(0, "$NetBSD: omrasops.c,v
  *	- first column is at 32bit aligned address,
  *	- font glyphs are stored in 32bit padded.
  */
+/*
+ * BMSEL affects both of
+ * 1) which plane a 

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

2022-09-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Sep 25 11:22:36 UTC 2022

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

Log Message:
Cosmetic changes.  Fix a typo in comment.


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

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

Modified files:

Index: src/sys/arch/luna68k/dev/omrasops.c
diff -u src/sys/arch/luna68k/dev/omrasops.c:1.21 src/sys/arch/luna68k/dev/omrasops.c:1.22
--- src/sys/arch/luna68k/dev/omrasops.c:1.21	Wed Jul 31 02:09:02 2019
+++ src/sys/arch/luna68k/dev/omrasops.c	Sun Sep 25 11:22:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: omrasops.c,v 1.21 2019/07/31 02:09:02 rin Exp $ */
+/* $NetBSD: omrasops.c,v 1.22 2022/09/25 11:22:36 isaki Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.21 2019/07/31 02:09:02 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omrasops.c,v 1.22 2022/09/25 11:22:36 isaki Exp $");
 
 /*
  * Designed speficically for 'm68k bitorder';
@@ -80,7 +80,7 @@ static int	omrasops_init(struct rasops_i
 
 /*
  * macros to handle unaligned bit copy ops.
- * See src/sys/dev/rasops/rasops_mask.h for MI version.
+ * See src/sys/dev/rasops/rasops_masks.h for MI version.
  * Also refer src/sys/arch/hp300/dev/maskbits.h.
  * (which was implemented for ancient src/sys/arch/hp300/dev/grf_hy.c)
  */
@@ -97,7 +97,7 @@ static int	omrasops_init(struct rasops_i
 	asm("bfins %3,%0{%1:%2}"	\
 	: "+o" (*(uint32_t *)(pdst))\
 	: "di" (x), "di" (w), "d" (src)\
-	: "memory" );
+	: "memory" )
 
 #define	GETBITS(psrc, x, w, dst)	FASTGETBITS(psrc, x, w, dst)
 #define	PUTBITS(src, x, w, pdst)	FASTPUTBITS(src, x, w, pdst)
@@ -629,7 +629,7 @@ om1_copycols(void *cookie, int startrow,
 
 	lmask = (db == 0) ? 0 : ALL1BITS >> db;
 	eb = (db + w) & ALIGNMASK;
-	rmask = (eb == 0) ? 0 : ALL1BITS << (32 - eb); 
+	rmask = (eb == 0) ? 0 : ALL1BITS << (32 - eb);
 	lnum = (32 - db) & ALIGNMASK;
 	rnum = (dstx + w) & ALIGNMASK;
 
@@ -765,7 +765,7 @@ om4_copycols(void *cookie, int startrow,
 
 	lmask = (db == 0) ? 0 : ALL1BITS >> db;
 	eb = (db + w) & ALIGNMASK;
-	rmask = (eb == 0) ? 0 : ALL1BITS << (32 - eb); 
+	rmask = (eb == 0) ? 0 : ALL1BITS << (32 - eb);
 	lnum = (32 - db) & ALIGNMASK;
 	rnum = (dstx + w) & ALIGNMASK;
 



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

2022-09-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Sep 25 11:22:36 UTC 2022

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

Log Message:
Cosmetic changes.  Fix a typo in comment.


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

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



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

2022-07-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 14 20:13:21 UTC 2022

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

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/luna68k/dev/lunafb.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.45 src/sys/arch/luna68k/dev/lunafb.c:1.46
--- src/sys/arch/luna68k/dev/lunafb.c:1.45	Thu Jul 14 19:55:56 2022
+++ src/sys/arch/luna68k/dev/lunafb.c	Thu Jul 14 20:13:21 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $");
 
 #include 
 #include 
@@ -322,20 +322,24 @@ static int
 omgetcmap(struct omfb_softc *sc, struct wsdisplay_cmap *p)
 {
 	u_int index = p->index, count = p->count;
-	int cmsize, error;
+	u_int cmsize;
+	int error;
 
 	cmsize = sc->sc_dc->dc_cmsize;
 	if (index >= cmsize || count > cmsize - index)
 		return EINVAL;
 
 	error = copyout(>sc_dc->dc_cmap.r[index], p->red, count);
-	if (error)
+	if (error != 0)
 		return error;
 	error = copyout(>sc_dc->dc_cmap.g[index], p->green, count);
-	if (error)
+	if (error != 0)
 		return error;
 	error = copyout(>sc_dc->dc_cmap.b[index], p->blue, count);
-	return error;
+	if (error != 0)
+		return error;
+
+	return 0;
 }
 
 static int
@@ -343,20 +347,22 @@ omsetcmap(struct omfb_softc *sc, struct 
 {
 	struct hwcmap cmap;
 	u_int index = p->index, count = p->count;
-	int cmsize, i, error;
+	u_int cmsize;
+	int i, error;
 
 	cmsize = sc->sc_dc->dc_cmsize;
+
 	if (index >= cmsize || count > cmsize - index)
 		return EINVAL;
 
 	error = copyin(p->red, [index], count);
-	if (error)
+	if (error != 0)
 		return error;
 	error = copyin(p->green, [index], count);
-	if (error)
+	if (error != 0)
 		return error;
 	error = copyin(p->blue, [index], count);
-	if (error)
+	if (error != 0)
 		return error;
 
 	memcpy(>sc_dc->dc_cmap.r[index], [index], count);
@@ -495,7 +501,7 @@ omfb_getdevconfig(paddr_t paddr, struct 
 	ri = >dc_ri;
 	ri->ri_width = dc->dc_wid;
 	ri->ri_height = dc->dc_ht;
-	ri->ri_depth = 1;   /* since planes are independently addressed */
+	ri->ri_depth = 1;	/* since planes are independently addressed */
 	ri->ri_stride = dc->dc_rowbytes;
 	ri->ri_bits = (void *)dc->dc_videobase;
 	ri->ri_flg = RI_CENTER;



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

2022-07-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 14 20:13:21 UTC 2022

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

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/luna68k/dev/lunafb.c

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



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

2022-07-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 14 19:55:56 UTC 2022

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

Log Message:
Fix pasto.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/luna68k/dev/lunafb.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.44 src/sys/arch/luna68k/dev/lunafb.c:1.45
--- src/sys/arch/luna68k/dev/lunafb.c:1.44	Sun Jul  3 11:30:48 2022
+++ src/sys/arch/luna68k/dev/lunafb.c	Thu Jul 14 19:55:56 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.44 2022/07/03 11:30:48 andvar Exp $ */
+/* $NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.44 2022/07/03 11:30:48 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $");
 
 #include 
 #include 
@@ -253,7 +253,7 @@ omfbioctl(void *v, void *vs, u_long cmd,
 		wsd_fbip->width = dc->dc_wid;
 		wsd_fbip->depth = dc->dc_depth;
 		wsd_fbip->cmsize = dc->dc_cmsize;
-#undef fbt
+#undef wsd_fbip
 		return 0;
 
 	case WSDISPLAYIO_LINEBYTES:



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

2022-07-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 14 19:55:56 UTC 2022

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

Log Message:
Fix pasto.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/luna68k/dev/lunafb.c

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



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

2022-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  5 15:37:13 UTC 2022

Modified Files:
src/sys/arch/luna68k/include: cdefs.h elf_machdep.h kcore.h reg.h
types.h

Log Message:
Remove unnecessary multiple inclusion protections.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/cdefs.h \
src/sys/arch/luna68k/include/elf_machdep.h \
src/sys/arch/luna68k/include/kcore.h src/sys/arch/luna68k/include/reg.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/include/types.h

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

Modified files:

Index: src/sys/arch/luna68k/include/cdefs.h
diff -u src/sys/arch/luna68k/include/cdefs.h:1.1 src/sys/arch/luna68k/include/cdefs.h:1.2
--- src/sys/arch/luna68k/include/cdefs.h:1.1	Wed Jan  5 08:48:59 2000
+++ src/sys/arch/luna68k/include/cdefs.h	Tue Jul  5 15:37:13 2022
@@ -1,8 +1,3 @@
-/*	$NetBSD: cdefs.h,v 1.1 2000/01/05 08:48:59 nisimura Exp $	*/
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
+/*	$NetBSD: cdefs.h,v 1.2 2022/07/05 15:37:13 tsutsui Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/luna68k/include/elf_machdep.h
diff -u src/sys/arch/luna68k/include/elf_machdep.h:1.1 src/sys/arch/luna68k/include/elf_machdep.h:1.2
--- src/sys/arch/luna68k/include/elf_machdep.h:1.1	Mon Dec 24 17:56:31 2001
+++ src/sys/arch/luna68k/include/elf_machdep.h	Tue Jul  5 15:37:13 2022
@@ -1,8 +1,3 @@
-/*	$NetBSD: elf_machdep.h,v 1.1 2001/12/24 17:56:31 chs Exp $	*/
-
-#ifndef _MACHINE_ELF_MACHDEP_H_
-#define _MACHINE_ELF_MACHDEP_H_
+/*	$NetBSD: elf_machdep.h,v 1.2 2022/07/05 15:37:13 tsutsui Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/luna68k/include/kcore.h
diff -u src/sys/arch/luna68k/include/kcore.h:1.1 src/sys/arch/luna68k/include/kcore.h:1.2
--- src/sys/arch/luna68k/include/kcore.h:1.1	Wed Jan  5 08:48:58 2000
+++ src/sys/arch/luna68k/include/kcore.h	Tue Jul  5 15:37:13 2022
@@ -1,8 +1,3 @@
-/*	$NetBSD: kcore.h,v 1.1 2000/01/05 08:48:58 nisimura Exp $	*/
-
-#ifndef _MACHINE_KCORE_H_
-#define _MACHINE_KCORE_H_
+/*	$NetBSD: kcore.h,v 1.2 2022/07/05 15:37:13 tsutsui Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/luna68k/include/reg.h
diff -u src/sys/arch/luna68k/include/reg.h:1.1 src/sys/arch/luna68k/include/reg.h:1.2
--- src/sys/arch/luna68k/include/reg.h:1.1	Wed Jan  5 08:49:01 2000
+++ src/sys/arch/luna68k/include/reg.h	Tue Jul  5 15:37:13 2022
@@ -1,8 +1,3 @@
-/*	$NetBSD: reg.h,v 1.1 2000/01/05 08:49:01 nisimura Exp $	*/
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
+/*	$NetBSD: reg.h,v 1.2 2022/07/05 15:37:13 tsutsui Exp $	*/
 
 #include 
-
-#endif /* _MACHINE_REG_H_ */

Index: src/sys/arch/luna68k/include/types.h
diff -u src/sys/arch/luna68k/include/types.h:1.8 src/sys/arch/luna68k/include/types.h:1.9
--- src/sys/arch/luna68k/include/types.h:1.8	Thu Apr  1 04:43:00 2021
+++ src/sys/arch/luna68k/include/types.h	Tue Jul  5 15:37:13 2022
@@ -1,10 +1,5 @@
-/*	$NetBSD: types.h,v 1.8 2021/04/01 04:43:00 simonb Exp $	*/
-
-#ifndef _MACHINE_TYPES_H_
-#define	_MACHINE_TYPES_H_
+/*	$NetBSD: types.h,v 1.9 2022/07/05 15:37:13 tsutsui Exp $	*/
 
 #include 
 
 #define	__HAVE_LEGACY_INTRCNT
-
-#endif



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

2022-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  5 15:37:13 UTC 2022

Modified Files:
src/sys/arch/luna68k/include: cdefs.h elf_machdep.h kcore.h reg.h
types.h

Log Message:
Remove unnecessary multiple inclusion protections.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/cdefs.h \
src/sys/arch/luna68k/include/elf_machdep.h \
src/sys/arch/luna68k/include/kcore.h src/sys/arch/luna68k/include/reg.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/include/types.h

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



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

2022-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  5 15:32:45 UTC 2022

Modified Files:
src/sys/arch/luna68k/include: aout_machdep.h

Log Message:
Remove unnecessary and incorrect mulitple inclusion protection.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/aout_machdep.h

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



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

2022-07-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jul  5 15:32:45 UTC 2022

Modified Files:
src/sys/arch/luna68k/include: aout_machdep.h

Log Message:
Remove unnecessary and incorrect mulitple inclusion protection.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/aout_machdep.h

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

Modified files:

Index: src/sys/arch/luna68k/include/aout_machdep.h
diff -u src/sys/arch/luna68k/include/aout_machdep.h:1.1 src/sys/arch/luna68k/include/aout_machdep.h:1.2
--- src/sys/arch/luna68k/include/aout_machdep.h:1.1	Wed Jan  5 08:49:00 2000
+++ src/sys/arch/luna68k/include/aout_machdep.h	Tue Jul  5 15:32:45 2022
@@ -1,8 +1,3 @@
-/*	$NetBSD: aout_machdep.h,v 1.1 2000/01/05 08:49:00 nisimura Exp $	*/
-
-#ifndef _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
+/*	$NetBSD: aout_machdep.h,v 1.2 2022/07/05 15:32:45 tsutsui Exp $	*/
 
 #include 
-
-#endif  /* _MACHINE_EXEC_H_ */



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

2022-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 25 01:54:37 UTC 2022

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

Log Message:
Add rnd(9) entropy source from keyboard and mouse.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/luna68k/dev/lunaws.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.40 src/sys/arch/luna68k/dev/lunaws.c:1.41
--- src/sys/arch/luna68k/dev/lunaws.c:1.40	Sat Oct  9 20:59:47 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Jun 25 01:54:37 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.40 2021/10/09 20:59:47 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.41 2022/06/25 01:54:37 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.40 2021/10/09 20:59:47 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.41 2022/06/25 01:54:37 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -130,6 +131,7 @@ struct ws_softc {
 	int		sc_rawkbd;
 
 	struct ws_conscookie *sc_conscookie;
+	krndsource_t	sc_rndsource;
 };
 
 static void omkbd_input(struct ws_softc *, int);
@@ -241,6 +243,8 @@ wsattach(device_t parent, device_t self,
 	sc->sc_tx_done = false;
 
 	sc->sc_si = softint_establish(SOFTINT_SERIAL, wssoftintr, sc);
+	rnd_attach_source(>sc_rndsource, device_xname(self),
+	RND_TYPE_TTY, RND_FLAG_DEFAULT);
 
 	/* enable interrupt */
 	setsioreg(sc->sc_ctl, WR1, sc->sc_wr[WR1]);
@@ -274,11 +278,12 @@ wsintr(void *arg)
 {
 	struct ws_softc *sc = arg;
 	struct sioreg *sio = sc->sc_ctl;
-	uint8_t code;
-	uint16_t rr;
+	uint8_t code = 0;
+	uint16_t rr, rndcsr = 0;
 	bool handled = false;
 
 	rr = getsiocsr(sio);
+	rndcsr = rr;
 	if ((rr & RR_RXRDY) != 0) {
 		do {
 			code = sio->sio_data;
@@ -299,8 +304,10 @@ wsintr(void *arg)
 			handled = true;
 		}
 	}
-	if (handled)
+	if (handled) {
 		softint_schedule(sc->sc_si);
+		rnd_add_uint32(>sc_rndsource, (rndcsr << 8) | code);
+	}
 }
 
 static void



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

2022-06-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 25 01:54:37 UTC 2022

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

Log Message:
Add rnd(9) entropy source from keyboard and mouse.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/luna68k/dev/lunaws.c

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



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

2022-06-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 11 14:45:37 UTC 2022

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

Log Message:
Match psgpam(4) only on LUNA-I.  LUNA-II doesn't have YM2149 at XP.


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

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

Modified files:

Index: src/sys/arch/luna68k/dev/psgpam.c
diff -u src/sys/arch/luna68k/dev/psgpam.c:1.1 src/sys/arch/luna68k/dev/psgpam.c:1.2
--- src/sys/arch/luna68k/dev/psgpam.c:1.1	Fri Jun 10 21:42:23 2022
+++ src/sys/arch/luna68k/dev/psgpam.c	Sat Jun 11 14:45:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: psgpam.c,v 1.1 2022/06/10 21:42:23 tsutsui Exp $	*/
+/*	$NetBSD: psgpam.c,v 1.2 2022/06/11 14:45:37 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2018 Yosuke Sugahara. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psgpam.c,v 1.1 2022/06/10 21:42:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psgpam.c,v 1.2 2022/06/11 14:45:37 tsutsui Exp $");
 
 #include 
 #include 
@@ -196,6 +196,10 @@ psgpam_match(device_t parent, cfdata_t c
 	if (psgpam_matched)
 		return 0;
 
+	/* Only the first generation LUNA has YM2149 at XP */
+	if (machtype != LUNA_I)
+		return 0;
+
 	if (strcmp(xa->xa_name, psgpam_cd.cd_name))
 		return 0;
 



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

2022-06-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jun 11 14:45:37 UTC 2022

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

Log Message:
Match psgpam(4) only on LUNA-I.  LUNA-II doesn't have YM2149 at XP.


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

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



CVS commit: src/sys/arch/luna68k

2022-06-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 10 21:42:24 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL files.luna68k majors.luna68k
src/sys/arch/luna68k/dev: xp.c
src/sys/arch/luna68k/luna68k: locore.s mainbus.c
Added Files:
src/sys/arch/luna68k/dev: psgpam.c psgpam_enc.c psgpam_enc.h
psgpam_table.c psgpam_table.h xpbus.c xpbusvar.h xpcmd.c xpcmd.h
xplxfirm.c xplxfirm.h
src/sys/arch/luna68k/dev/xplx: Makefile cdump.awk mkdefs.awk xplx.asm
xplx.inc xplxdefs.h

Log Message:
luna68k: add psgpam(4) audio for LUNA, using YM2149 PSG/SSG sound chip.

"PSG PAM" is a audio driver using "Pulse Amplitude Modulation" with the
YM2149 PSG/SSG chip connected to the I/O processor HD647180X on LUNA.
The driver plays up to 30 kHz PCM audio by manipulating PSG channel volumes
at extremely high speed with 6.144 MHz HD647180X, a Z80 compatible sub CPU.
 https://www.youtube.com/watch?v=fR7PqaLpijQ
 https://www.youtube.com/watch?v=kCDZCgkwgBA

Compatibilities with the existing XPIOCDOWNLD ioctl(2) to download and
exec user programs (PSG sound driver player ported from PC-6001 etc.)
on the HD647180X is still provided.
 https://twitter.com/tsutsuii/status/1533247362965315584

This psgpam(4) driver for NetBSD/luna68k was written by @moveccr
during isaki-audio2 branch developments, and it was also demonstrated
at Open Source Conference 2018 Kyoto:
 https://github.com/isaki68k/netbsd-src/tree/audio2
 https://mail-index.netbsd.org/netbsd-advocacy/2018/08/07/msg000781.html
 https://twitter.com/tsutsuii/status/1025504875625365505

Note specifications of interrupts from the HD647180X to the host LUNA
was confirmed by Kenji Aoyama on his LUNA-88K2 running OpenBSD/luna88k.

I would like to thank all people still working on ancient LUNA machines!


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/luna68k/conf/majors.luna68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/psgpam.c \
src/sys/arch/luna68k/dev/psgpam_enc.c \
src/sys/arch/luna68k/dev/psgpam_enc.h \
src/sys/arch/luna68k/dev/psgpam_table.c \
src/sys/arch/luna68k/dev/psgpam_table.h src/sys/arch/luna68k/dev/xpbus.c \
src/sys/arch/luna68k/dev/xpbusvar.h src/sys/arch/luna68k/dev/xpcmd.c \
src/sys/arch/luna68k/dev/xpcmd.h src/sys/arch/luna68k/dev/xplxfirm.c \
src/sys/arch/luna68k/dev/xplxfirm.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/dev/xp.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/xplx/Makefile \
src/sys/arch/luna68k/dev/xplx/cdump.awk \
src/sys/arch/luna68k/dev/xplx/mkdefs.awk \
src/sys/arch/luna68k/dev/xplx/xplx.asm \
src/sys/arch/luna68k/dev/xplx/xplx.inc \
src/sys/arch/luna68k/dev/xplx/xplxdefs.h
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/luna68k/luna68k/locore.s
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/luna68k/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/luna68k/conf

2022-05-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri May 27 16:59:19 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL

Log Message:
Specify -fno-unwind-tables to shrink binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/INSTALL

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

Modified files:

Index: src/sys/arch/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.131 src/sys/arch/luna68k/conf/GENERIC:1.132
--- src/sys/arch/luna68k/conf/GENERIC:1.131	Fri Feb  4 18:28:53 2022
+++ src/sys/arch/luna68k/conf/GENERIC	Fri May 27 16:59:19 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.131 2022/02/04 18:28:53 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.132 2022/05/27 16:59:19 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,9 +22,9 @@ include 	"arch/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.131 $"
+#ident 		"GENERIC-$Revision: 1.132 $"
 
-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.
 

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.32 src/sys/arch/luna68k/conf/INSTALL:1.33
--- src/sys/arch/luna68k/conf/INSTALL:1.32	Fri Feb  4 18:28:53 2022
+++ src/sys/arch/luna68k/conf/INSTALL	Fri May 27 16:59:19 2022
@@ -1,10 +1,10 @@
-# $NetBSD: INSTALL,v 1.32 2022/02/04 18:28:53 tsutsui Exp $
+# $NetBSD: INSTALL,v 1.33 2022/05/27 16:59:19 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
 include 	"arch/luna68k/conf/std.luna68k"
 
-makeoptions	COPTS="-Os"		# Optimise for space. Implies -O2
+makeoptions	COPTS="-Os -fno-unwind-tables"	# Optimise for space.
 
 maxusers	4
 



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

2022-05-27 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri May 27 16:59:19 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL

Log Message:
Specify -fno-unwind-tables to shrink binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/luna68k/conf/INSTALL

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



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

2022-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  4 18:28:53 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL

Log Message:
Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/luna68k/conf/INSTALL

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

Modified files:

Index: src/sys/arch/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.130 src/sys/arch/luna68k/conf/GENERIC:1.131
--- src/sys/arch/luna68k/conf/GENERIC:1.130	Sun Sep 27 13:48:52 2020
+++ src/sys/arch/luna68k/conf/GENERIC	Fri Feb  4 18:28:53 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.130 2020/09/27 13:48:52 roy Exp $
+# $NetBSD: GENERIC,v 1.131 2022/02/04 18:28:53 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.130 $"
+#ident 		"GENERIC-$Revision: 1.131 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks -fno-omit-frame-pointer"
 	# See share/mk/sys.mk. -fno-omit-frame-pointer is necessary for
@@ -130,6 +130,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
 options 	WSDISPLAY_COMPAT_RAWKBD
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.31 src/sys/arch/luna68k/conf/INSTALL:1.32
--- src/sys/arch/luna68k/conf/INSTALL:1.31	Sun Sep 27 13:48:52 2020
+++ src/sys/arch/luna68k/conf/INSTALL	Fri Feb  4 18:28:53 2022
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.31 2020/09/27 13:48:52 roy Exp $
+# $NetBSD: INSTALL,v 1.32 2022/02/04 18:28:53 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -108,6 +108,9 @@ options 	NFS_BOOT_DHCP	# superset of BOO
 options 	WSEMUL_VT100
 options 	WSDISPLAY_DEFAULTSCREENS=1
 #options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
+options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+
 options 	FONT_OMRON12x20
 
 config		netbsd root on ? type ?



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

2022-02-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Feb  4 18:28:53 UTC 2022

Modified Files:
src/sys/arch/luna68k/conf: GENERIC INSTALL

Log Message:
Use "options WS_KERNEL_FG=WSCOL_GREEN" as most ports with color support.

For demonstration on nono that supports 4bpp framebuffer recently.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/luna68k/conf/INSTALL

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



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

2021-10-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Oct 27 01:06:39 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: signal.h

Log Message:
Remove a superflouous comment.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/signal.h

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

Modified files:

Index: src/sys/arch/luna68k/include/signal.h
diff -u src/sys/arch/luna68k/include/signal.h:1.1 src/sys/arch/luna68k/include/signal.h:1.2
--- src/sys/arch/luna68k/include/signal.h:1.1	Wed Jan  5 08:48:59 2000
+++ src/sys/arch/luna68k/include/signal.h	Wed Oct 27 01:06:38 2021
@@ -1,4 +1,3 @@
-/*	$NetBSD: signal.h,v 1.1 2000/01/05 08:48:59 nisimura Exp $	*/
+/*	$NetBSD: signal.h,v 1.2 2021/10/27 01:06:38 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 



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

2021-10-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Oct 27 01:06:39 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: signal.h

Log Message:
Remove a superflouous comment.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/signal.h

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



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

2021-10-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  9 20:59:47 UTC 2021

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

Log Message:
Handle wskbd(9) .set_leds op in cngetc(9) using wskbd_cnattach(9) cookie.

XXX1: LUNA's keyboards emulate "mechanical lock" for CAP and Kana keys,
  i.e. it sends "DOWN" code only when CAP/Kana LEDs are turned on
  and send "UP" code only when the LEDs are turned off.
  The MD omkbd_input() via wskbd_input(9) for the normal wskbd(4)
  (i.e. ttyE0) devices handles this quirk, but MI wskbd_cngetc()
  in sys/dev/wscons/wskbd.c can do nothing for this.

XXX2: I wonder if we should have an independent .set_leds op for cons(9)
  as cnbell(9), rather than referring a device specific softc stuff
  during .set_leds op in struct wskbd_accessop (registered during
  autoconf(9) via struct wskbddev_attach_args passed to config_found(9))
  even for wskbd cngetc(9) op in struct wskbd_consops (registered
  via early wskbd_cnattach(9)).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/luna68k/dev/lunaws.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.39 src/sys/arch/luna68k/dev/lunaws.c:1.40
--- src/sys/arch/luna68k/dev/lunaws.c:1.39	Sat Sep 25 15:18:38 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Oct  9 20:59:47 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.40 2021/10/09 20:59:47 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.40 2021/10/09 20:59:47 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -101,6 +101,12 @@ static const uint8_t ch1_regs[6] = {
 	WR5_TX8BIT | WR5_TXENBL,		/* Tx */
 };
 
+struct ws_conscookie {
+	struct sioreg	*cc_sio;
+	int		cc_polling;
+	struct ws_softc	*cc_sc;
+};
+
 struct ws_softc {
 	device_t	sc_dev;
 	struct sioreg	*sc_ctl;
@@ -122,6 +128,8 @@ struct ws_softc {
 	int		sc_msreport;
 	void		*sc_si;
 	int		sc_rawkbd;
+
+	struct ws_conscookie *sc_conscookie;
 };
 
 static void omkbd_input(struct ws_softc *, int);
@@ -155,6 +163,7 @@ static const struct wskbd_consops ws_con
 	.pollc = ws_cnpollc,
 	.bell  = ws_cnbell,
 };
+static struct ws_conscookie ws_conscookie;
 
 #if NWSMOUSE > 0
 static int  omms_enable(void *);
@@ -214,6 +223,10 @@ wsattach(device_t parent, device_t self,
 	siosc->sc_intrhand[channel].ih_func = wsintr;
 	siosc->sc_intrhand[channel].ih_arg = sc;
 
+	sc->sc_conscookie = _conscookie;
+	sc->sc_conscookie->cc_sc = sc;
+	sc->sc_conscookie->cc_polling = 0;
+
 	setsioreg(sc->sc_ctl, WR0, sc->sc_wr[WR0]);
 	setsioreg(sc->sc_ctl, WR4, sc->sc_wr[WR4]);
 	setsioreg(sc->sc_ctl, WR3, sc->sc_wr[WR3]);
@@ -514,13 +527,11 @@ omkbd_get_buzcmd(struct ws_softc *sc, st
 static void
 ws_cngetc(void *cookie, u_int *type, int *data)
 {
-	struct ws_softc *sc = cookie;	/* currently unused */
-	struct sioreg *sio, *sio_base;
+	struct ws_conscookie *conscookie = cookie;
+	struct sioreg *sio = conscookie->cc_sio;
+	struct ws_softc *sc = conscookie->cc_sc;	/* currently unused */
 	int code;
 
-	sio_base = (struct sioreg *)OBIO_SIO;
-	sio = _base[1];	/* channel B */
-
 	code = siogetc(sio);
 	omkbd_decode(sc, code, type, data);
 }
@@ -528,19 +539,20 @@ ws_cngetc(void *cookie, u_int *type, int
 static void
 ws_cnpollc(void *cookie, int on)
 {
+	struct ws_conscookie *conscookie = cookie;
+
+	conscookie->cc_polling = on;
 }
 
 static void
 ws_cnbell(void *cookie, u_int pitch, u_int period, u_int volume)
 {
-	struct ws_softc *sc = cookie;	/* currently unused */
-	struct sioreg *sio, *sio_base;
+	struct ws_conscookie *conscookie = cookie;
+	struct sioreg *sio = conscookie->cc_sio;
+	struct ws_softc *sc = conscookie->cc_sc;	/* currently unused */
 	struct wskbd_bell_data wbd;
 	uint8_t buzcmd;
 
-	sio_base = (struct sioreg *)OBIO_SIO;
-	sio = _base[1];	/* channel B */
-
 	/*
 	 * XXX cnbell(9) man page should describe each args..
 	 * (it looks similar to the struct wskbd_bell_data)
@@ -560,11 +572,14 @@ ws_cnbell(void *cookie, u_int pitch, u_i
 /* EXPORT */ void
 ws_cnattach(void)
 {
-	static int voidfill;
+	struct sioreg *sio_base;
+
+	sio_base = (struct sioreg *)OBIO_SIO;
+	ws_conscookie.cc_sio = _base[1];	/* channel B */
 
 	/* XXX need CH.B initialization XXX */
 
-	wskbd_cnattach(_consops, , _keymapdata);
+	wskbd_cnattach(_consops, _conscookie, _keymapdata);
 }
 
 static int
@@ -578,35 +593,41 @@ static void
 omkbd_set_leds(void *cookie, int leds)
 {
 	struct ws_softc *sc = cookie;
-	uint8_t ledcmd;
+	uint8_t capsledcmd, kanaledcmd;
 
-	/*
-	 * XXX:
-	 *  Why does MI wskbd(4) use a common 

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

2021-10-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct  9 20:59:47 UTC 2021

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

Log Message:
Handle wskbd(9) .set_leds op in cngetc(9) using wskbd_cnattach(9) cookie.

XXX1: LUNA's keyboards emulate "mechanical lock" for CAP and Kana keys,
  i.e. it sends "DOWN" code only when CAP/Kana LEDs are turned on
  and send "UP" code only when the LEDs are turned off.
  The MD omkbd_input() via wskbd_input(9) for the normal wskbd(4)
  (i.e. ttyE0) devices handles this quirk, but MI wskbd_cngetc()
  in sys/dev/wscons/wskbd.c can do nothing for this.

XXX2: I wonder if we should have an independent .set_leds op for cons(9)
  as cnbell(9), rather than referring a device specific softc stuff
  during .set_leds op in struct wskbd_accessop (registered during
  autoconf(9) via struct wskbddev_attach_args passed to config_found(9))
  even for wskbd cngetc(9) op in struct wskbd_consops (registered
  via early wskbd_cnattach(9)).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/luna68k/dev/lunaws.c

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



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

2021-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 26 13:43:30 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: board.h

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/board.h

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

Modified files:

Index: src/sys/arch/luna68k/include/board.h
diff -u src/sys/arch/luna68k/include/board.h:1.1 src/sys/arch/luna68k/include/board.h:1.2
--- src/sys/arch/luna68k/include/board.h:1.1	Sun Jun 30 05:04:48 2019
+++ src/sys/arch/luna68k/include/board.h	Sun Sep 26 13:43:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: board.h,v 1.1 2019/06/30 05:04:48 tsutsui Exp $	*/
+/*	$NetBSD: board.h,v 1.2 2021/09/26 13:43:30 tsutsui Exp $	*/
 /*	$OpenBSD: board.h,v 1.15 2017/11/03 06:55:08 aoyama Exp $	*/
 /*
  * Mach Operating System
@@ -46,72 +46,72 @@
 #define U(num)  num/**/U
 #endif
 
-#define PROM_ADDR	U(0x4100) 	/* PROM */
-#define PROM_SPACE	U(0x0004) 
-#define NVRAM_ADDR	U(0x4500) 	/* Non Volatile */
-#define NVRAM_SPACE	U(0x1FDC) 
-#define	FUSE_ROM_ADDR	U(0x4300) 	/* FUSE_ROM */
-#define	FUSE_ROM_SPACE	1024
-#define	OBIO_CLOCK_BASE	U(0x4500) 	/* Mostek or Dallas TimeKeeper */
-#define OBIO_PIO0_BASE	U(0x4900) 	/* PIO-0 */
-#define OBIO_PIO0_SPACE	U(0x0004) 
-#define OBIO_PIO0A	U(0x4900) 	/* PIO-0 port A */
-#define OBIO_PIO0B	U(0x4901) 	/* PIO-0 port B */
-#define OBIO_PIO0C	U(0x4902) 	/* PIO-0 port C*/
-#define OBIO_PIO0	U(0x4903) 	/* PIO-0 control */
-#define OBIO_PIO1_BASE	U(0x4D00) 	/* PIO-1 */
-#define OBIO_PIO1_SPACE U(0x0004) 
-#define OBIO_PIO1A	U(0x4D00) 	/* PIO-1 port A */
-#define OBIO_PIO1B	U(0x4D01) 	/* PIO-1 port B */
-#define OBIO_PIO1C	U(0x4D02) 	/* PIO-1 port C*/
-#define OBIO_PIO1	U(0x4D03) 	/* PIO-1 control */
-#define OBIO_SIO	U(0x5100) 	/* SIO */
-#define	OBIO_TAS	U(0x6100) 	/* TAS register */
-#define	OBIO_CLOCK	U(0x6300) 	/* system clock */
+#define PROM_ADDR	U(0x4100)	/* PROM */
+#define PROM_SPACE	U(0x0004)
+#define NVRAM_ADDR	U(0x4500)	/* Non Volatile */
+#define NVRAM_SPACE	U(0x1FDC)
+#define FUSE_ROM_ADDR	U(0x4300)	/* FUSE_ROM */
+#define FUSE_ROM_SPACE	1024
+#define OBIO_CLOCK_BASE	U(0x4500)	/* Mostek or Dallas TimeKeeper */
+#define OBIO_PIO0_BASE	U(0x4900)	/* PIO-0 */
+#define OBIO_PIO0_SPACE	U(0x0004)
+#define OBIO_PIO0A	U(0x4900)	/* PIO-0 port A */
+#define OBIO_PIO0B	U(0x4901)	/* PIO-0 port B */
+#define OBIO_PIO0C	U(0x4902)	/* PIO-0 port C*/
+#define OBIO_PIO0	U(0x4903)	/* PIO-0 control */
+#define OBIO_PIO1_BASE	U(0x4D00)	/* PIO-1 */
+#define OBIO_PIO1_SPACE U(0x0004)
+#define OBIO_PIO1A	U(0x4D00)	/* PIO-1 port A */
+#define OBIO_PIO1B	U(0x4D01)	/* PIO-1 port B */
+#define OBIO_PIO1C	U(0x4D02)	/* PIO-1 port C*/
+#define OBIO_PIO1	U(0x4D03)	/* PIO-1 control */
+#define OBIO_SIO	U(0x5100)	/* SIO */
+#define OBIO_TAS	U(0x6100)	/* TAS register */
+#define OBIO_CLOCK	U(0x6300)	/* system clock */
 
-#define TRI_PORT_RAM	U(0x7100) 	/* 3 port RAM */
+#define TRI_PORT_RAM	U(0x7100)	/* 3 port RAM */
 #define TRI_PORT_RAM_SPACE	0x2
-#define EXT_A_ADDR	U(0x8100) 	/* extension board A */
-#define EXT_A_SPACE	U(0x0200) 
-#define EXT_B_ADDR	U(0x8300) 	/* extension board B */
-#define EXT_B_SPACE	U(0x0100) 
-#define	PC_BASE		U(0x9000) 	/* pc-98 extension board */
-#define	PC_SPACE	U(0x0200) 
+#define EXT_A_ADDR	U(0x8100)	/* extension board A */
+#define EXT_A_SPACE	U(0x0200)
+#define EXT_B_ADDR	U(0x8300)	/* extension board B */
+#define EXT_B_SPACE	U(0x0100)
+#define PC_BASE		U(0x9000)	/* pc-98 extension board */
+#define PC_SPACE	U(0x0200)
 
-#define MROM_ADDR	U(0xA100) 	/* Mask ROM address */
+#define MROM_ADDR	U(0xA100)	/* Mask ROM address */
 #define MROM_SPACE		0x40
-#define	BMAP_START	U(0xB100) 	/* Bitmap start address */
-#define	BMAP_SPACE	(BMAP_END - BMAP_START)
-#define BMAP_RFCNT	U(0xB100) 	/* RFCNT register */
-#define BMAP_BMSEL	U(0xB104) 	/* BMSEL register */
-#define BMAP_BMP	U(0xB108) 	/* common bitmap plane */
-#define BMAP_BMAP0	U(0xB10C) 	/* bitmap plane 0 */
-#define BMAP_BMAP1	U(0xB110) 	/* bitmap plane 1 */
-#define BMAP_BMAP2	U(0xB114) 	/* bitmap plane 2 */
-#define BMAP_BMAP3	U(0xB118) 	/* bitmap plane 3 */
-#define BMAP_BMAP4	U(0xB11C) 	/* bitmap plane 4 */
-#define BMAP_BMAP5	U(0xB120) 	/* bitmap plane 5 */
-#define BMAP_BMAP6	U(0xB124) 	/* bitmap plane 6 */
-#define BMAP_BMAP7	U(0xB128) 	/* bitmap plane 7 */
-#define BMAP_FN		U(0xB12C) 	/* common bitmap function */
-#define BMAP_FN0	U(0xB130) 	/* bitmap function 0 */
-#define BMAP_FN1	U(0xB134) 	/* bitmap function 1 */
-#define BMAP_FN2	U(0xB138) 	/* bitmap function 2 */
-#define BMAP_FN3	U(0xB13C) 	/* 

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

2021-09-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 26 13:43:30 UTC 2021

Modified Files:
src/sys/arch/luna68k/include: board.h

Log Message:
TAB/space cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/include/board.h

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



CVS commit: src/sys/arch/luna68k

2021-09-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 25 15:18:38 UTC 2021

Modified Files:
src/sys/arch/luna68k/dev: lunaws.c sio.c sioreg.h siotty.c siovar.h
src/sys/arch/luna68k/luna68k: machdep.c
Added Files:
src/sys/arch/luna68k/dev: siottyvar.h
Removed Files:
src/sys/arch/luna68k/dev: syscn.h

Log Message:
Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
  explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
  static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
  (there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/dev/sio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/sioreg.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/siottyvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/siovar.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/syscn.h
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/luna68k/luna68k/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/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.38 src/sys/arch/luna68k/dev/lunaws.c:1.39
--- src/sys/arch/luna68k/dev/lunaws.c:1.38	Mon Sep 20 08:31:09 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.39 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -50,7 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1
 #include 
 #include 
 #include 
-#include 
+
+#include 
 
 #include "ioconf.h"
 
@@ -261,7 +262,7 @@ wsintr(void *arg)
 	struct ws_softc *sc = arg;
 	struct sioreg *sio = sc->sc_ctl;
 	uint8_t code;
-	int rr;
+	uint16_t rr;
 	bool handled = false;
 
 	rr = getsiocsr(sio);
@@ -513,10 +514,14 @@ omkbd_get_buzcmd(struct ws_softc *sc, st
 static void
 ws_cngetc(void *cookie, u_int *type, int *data)
 {
-	struct ws_softc *sc = cookie;
+	struct ws_softc *sc = cookie;	/* currently unused */
+	struct sioreg *sio, *sio_base;
 	int code;
 
-	code = syscngetc((dev_t)1);
+	sio_base = (struct sioreg *)OBIO_SIO;
+	sio = _base[1];	/* channel B */
+
+	code = siogetc(sio);
 	omkbd_decode(sc, code, type, data);
 }
 
@@ -528,10 +533,14 @@ ws_cnpollc(void *cookie, int on)
 static void
 ws_cnbell(void *cookie, u_int pitch, u_int period, u_int volume)
 {
-	struct ws_softc *sc = cookie;
+	struct ws_softc *sc = cookie;	/* currently unused */
+	struct sioreg *sio, *sio_base;
 	struct wskbd_bell_data wbd;
 	uint8_t buzcmd;
 
+	sio_base = (struct sioreg *)OBIO_SIO;
+	sio = _base[1];	/* channel B */
+
 	/*
 	 * XXX cnbell(9) man page should describe each args..
 	 * (it looks similar to the struct wskbd_bell_data)
@@ -545,7 +554,7 @@ ws_cnbell(void *cookie, u_int pitch, u_i
 	wbd.volume = volume;
 	buzcmd = omkbd_get_buzcmd(sc, , OMKBD_BUZZER_DEFAULT);
 
-	syscnputc((dev_t)1, buzcmd);
+	sioputc(sio, buzcmd);
 }
 
 /* EXPORT */ void

Index: src/sys/arch/luna68k/dev/sio.c
diff -u src/sys/arch/luna68k/dev/sio.c:1.15 src/sys/arch/luna68k/dev/sio.c:1.16
--- src/sys/arch/luna68k/dev/sio.c:1.15	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/luna68k/dev/sio.c	Sat Sep 25 15:18:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.16 2021/09/25 15:18:38 tsutsui Exp $");
 
 #include 
 #include 
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: sio.c,v 1.15
 #include 
 
 #include 
+#include 
 #include 
 
 #include "ioconf.h"

Index: 

CVS commit: src/sys/arch/luna68k

2021-09-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 25 15:18:38 UTC 2021

Modified Files:
src/sys/arch/luna68k/dev: lunaws.c sio.c sioreg.h siotty.c siovar.h
src/sys/arch/luna68k/luna68k: machdep.c
Added Files:
src/sys/arch/luna68k/dev: siottyvar.h
Removed Files:
src/sys/arch/luna68k/dev: syscn.h

Log Message:
Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
  explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
  static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
  (there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/luna68k/dev/lunaws.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/luna68k/dev/sio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/dev/sioreg.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/dev/siottyvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/dev/siovar.h
cvs rdiff -u -r1.1 -r0 src/sys/arch/luna68k/dev/syscn.h
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/luna68k/luna68k/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/luna68k/dev

2021-09-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep 20 08:31:09 UTC 2021

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

Log Message:
Add a comment that .set_leds function won't work correctly on cngetc(9).

I'm afraid all other keyboard drivers that have .set_leds function
(like sgimips/dev/zs_kbd.c) have the same issue.
Maybe we needs 'polled' flag in .set_leds function, or an independent
.set_leds accessop in struct wskbd_consops for cons(9).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/dev/lunaws.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.37 src/sys/arch/luna68k/dev/lunaws.c:1.38
--- src/sys/arch/luna68k/dev/lunaws.c:1.37	Sun Sep 19 11:43:54 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Mon Sep 20 08:31:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.37 2021/09/19 11:43:54 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.37 2021/09/19 11:43:54 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.38 2021/09/20 08:31:09 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -571,6 +571,16 @@ omkbd_set_leds(void *cookie, int leds)
 	struct ws_softc *sc = cookie;
 	uint8_t ledcmd;
 
+	/*
+	 * XXX:
+	 *  Why does MI wskbd(4) use a common .set_leds function
+	 *  for both kernel cons(9) and normal tty devices!?
+	 *
+	 *  When CAP key is pressed in cngetc(9) (like ddb(4) etc.)
+	 *  after wskbd(4) is attached, all LED commands are queued
+	 *  into txq[] and will never be sent until ddb(4) returns.
+	 */
+
 	sc->sc_leds = leds;
 	if ((leds & WSKBD_LED_CAPS) != 0) {
 		ledcmd = OMKBD_LED_ON_CAPS;



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

2021-09-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Sep 20 08:31:09 UTC 2021

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

Log Message:
Add a comment that .set_leds function won't work correctly on cngetc(9).

I'm afraid all other keyboard drivers that have .set_leds function
(like sgimips/dev/zs_kbd.c) have the same issue.
Maybe we needs 'polled' flag in .set_leds function, or an independent
.set_leds accessop in struct wskbd_consops for cons(9).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/luna68k/dev/lunaws.c

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



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

2021-09-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 19 11:43:54 UTC 2021

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

Log Message:
Use more C99 designated initializer.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/luna68k/dev/lunaws.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.36 src/sys/arch/luna68k/dev/lunaws.c:1.37
--- src/sys/arch/luna68k/dev/lunaws.c:1.36	Sun Sep 19 07:55:17 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sun Sep 19 11:43:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.36 2021/09/19 07:55:17 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.37 2021/09/19 11:43:54 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.36 2021/09/19 07:55:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.37 2021/09/19 11:43:54 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -161,9 +161,9 @@ static int  omms_ioctl(void *, u_long, v
 static void omms_disable(void *);
 
 static const struct wsmouse_accessops omms_accessops = {
-	omms_enable,
-	omms_ioctl,
-	omms_disable,
+	.enable  = omms_enable,
+	.ioctl   = omms_ioctl,
+	.disable = omms_disable,
 };
 #endif
 



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

2021-09-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 19 11:43:54 UTC 2021

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

Log Message:
Use more C99 designated initializer.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/luna68k/dev/lunaws.c

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



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

2021-09-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 19 07:55:18 UTC 2021

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

Log Message:
Handle CAP and Kana modifier key specification quirk of LUNA's keyboard.

LUNA's keyboard doesn't send any keycode when these modifier keys are
released.  Instead, it sends a pressed or released code per how each
modifier LED status will be changed when the modifier keys are pressed.
To handle this quirk in MI wskbd(4) layer, we have to send a faked
"pressed and released" sequence on passing keycodes to wskbd_input(9).

Tested on LUNA both on ttyE0 and WSKBD_RAW mode (on Xorg server).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/luna68k/dev/lunaws.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.35 src/sys/arch/luna68k/dev/lunaws.c:1.36
--- src/sys/arch/luna68k/dev/lunaws.c:1.35	Sat Sep 18 13:44:02 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sun Sep 19 07:55:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.35 2021/09/18 13:44:02 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.36 2021/09/19 07:55:17 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.35 2021/09/18 13:44:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.36 2021/09/19 07:55:17 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -401,6 +401,14 @@ omkbd_input(struct ws_softc *sc, int dat
 		int c, j = 0;
 
 		c = omkbd_raw[key];
+		if (c == 0x70 /* Kana */ ||
+		c == 0x3a /* CAP  */) {
+			/* See comment in !sc->sc_rawkbd case */
+			cbuf[0] = c;
+			wskbd_rawinput(sc->sc_wskbddev, cbuf, 1);
+			cbuf[0] = c | 0x80;
+			wskbd_rawinput(sc->sc_wskbddev, cbuf, 1);
+		} else
 		if (c != 0x00) {
 			/* fake extended scancode if necessary */
 			if (c & 0x80)
@@ -415,8 +423,27 @@ omkbd_input(struct ws_softc *sc, int dat
 	} else
 #endif
 	{
-		if (sc->sc_wskbddev != NULL)
-			wskbd_input(sc->sc_wskbddev, type, key);
+		if (sc->sc_wskbddev != NULL) {
+			if (key == 0x0b /* Kana */ ||
+			key == 0x0e /* CAP  */) {
+/*
+ * LUNA's keyboard doesn't send any keycode
+ * when these modifier keys are released.
+ * Instead, it sends a pressed or released code
+ * per how each modifier LED status will be
+ * changed when the modifier keys are pressed.
+ * To handle this quirk in MI wskbd(4) layer,
+ * we have to send a faked
+ * "pressed and released" sequence here.
+ */
+wskbd_input(sc->sc_wskbddev,
+WSCONS_EVENT_KEY_DOWN, key);
+wskbd_input(sc->sc_wskbddev,
+WSCONS_EVENT_KEY_UP, key);
+			} else {
+wskbd_input(sc->sc_wskbddev, type, key);
+			}
+		}
 	}
 }
 



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

2021-09-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Sep 19 07:55:18 UTC 2021

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

Log Message:
Handle CAP and Kana modifier key specification quirk of LUNA's keyboard.

LUNA's keyboard doesn't send any keycode when these modifier keys are
released.  Instead, it sends a pressed or released code per how each
modifier LED status will be changed when the modifier keys are pressed.
To handle this quirk in MI wskbd(4) layer, we have to send a faked
"pressed and released" sequence on passing keycodes to wskbd_input(9).

Tested on LUNA both on ttyE0 and WSKBD_RAW mode (on Xorg server).


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/luna68k/dev/lunaws.c

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



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

2021-09-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 18 13:44:02 UTC 2021

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

Log Message:
Implement transmitting keyboard LED and buzzer control commands.

- enable TX on uPD7201 for keyboard port
- prepare TX queue and handle it in hardware interrupt and softint(9)
- send proper LED commands on WSKBDIO_SETLEDS
  (XXX: KANA LED is not handled in wscons)
- return current LED settings on WSKBDIO_GETLEDS
- implement WSKBDIO_COMPLEXBELL by parsing struct wskbd_bell_data and
  send proper buzzer commands
- handle pitch, period, and volume in cnbell(9)
  (XXX: no description in cnbell(9) man pages)
- use proper queued TX function for omms_enable() and omms_disable()
- add DPRINTF()s for debug
- use C99 designated initializer and misc cosmetics

Tested on LUNA and its keyboard (3W4SD-098NDT).


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

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.34 src/sys/arch/luna68k/dev/lunaws.c:1.35
--- src/sys/arch/luna68k/dev/lunaws.c:1.34	Sat Sep  4 18:38:03 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Sep 18 13:44:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.34 2021/09/04 18:38:03 tsutsui Exp $ */
+/* $NetBSD: lunaws.c,v 1.35 2021/09/18 13:44:02 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.34 2021/09/04 18:38:03 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.35 2021/09/18 13:44:02 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -57,10 +57,43 @@ __KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1
 #define OMKBD_RXQ_LEN		64
 #define OMKBD_RXQ_LEN_MASK	(OMKBD_RXQ_LEN - 1)
 #define OMKBD_NEXTRXQ(x)	(((x) + 1) & OMKBD_RXQ_LEN_MASK)
+#define OMKBD_TXQ_LEN		16
+#define OMKBD_TXQ_LEN_MASK	(OMKBD_TXQ_LEN - 1)
+#define OMKBD_NEXTTXQ(x)	(((x) + 1) & OMKBD_TXQ_LEN_MASK)
+
+/* Keyboard commands */
+/*  000Xb : LED commands */
+#define OMKBD_LED_ON_KANA	0x10	/* kana LED on */
+#define OMKBD_LED_OFF_KANA	0x00	/* kana LED off */
+#define OMKBD_LED_ON_CAPS	0x11	/* caps LED on */
+#define OMKBD_LED_OFF_CAPS	0x01	/* caps LED off */
+/*  010Xb : buzzer commands */
+#define OMKBD_BUZZER		0x40
+#define OMKBD_BUZZER_PERIOD	0x18
+#define OMKBD_BUZZER_40MS	0x00
+#define OMKBD_BUZZER_150MS	0x08
+#define OMKBD_BUZZER_400MS	0x10
+#define OMKBD_BUZZER_700MS	0x18
+#define OMKBD_BUZZER_PITCH	0x07
+#define OMKBD_BUZZER_6000HZ	0x00
+#define OMKBD_BUZZER_3000HZ	0x01
+#define OMKBD_BUZZER_1500HZ	0x02
+#define OMKBD_BUZZER_1000HZ	0x03
+#define OMKBD_BUZZER_600HZ	0x04
+#define OMKBD_BUZZER_300HZ	0x05
+#define OMKBD_BUZZER_150HZ	0x06
+#define OMKBD_BUZZER_100HZ	0x07
+/*  011Xb : mouse on command */
+#define OMKBD_MOUSE_ON		0x60
+/*  001Xb : mouse off command */
+#define OMKBD_MOUSE_OFF		0x20
+
+#define OMKBD_BUZZER_DEFAULT	\
+	(OMKBD_BUZZER | OMKBD_BUZZER_40MS | OMKBD_BUZZER_1500HZ)
 
 static const uint8_t ch1_regs[6] = {
 	WR0_RSTINT,/* Reset E/S Interrupt */
-	WR1_RXALLS,/* Rx per char, No Tx */
+	WR1_RXALLS | WR1_TXENBL,		/* Rx per char, Tx */
 	0,	/* */
 	WR3_RX8BIT | WR3_RXENBL,		/* Rx */
 	WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY,	/* Tx/Rx */
@@ -75,6 +108,12 @@ struct ws_softc {
 	uint8_t		sc_rxq[OMKBD_RXQ_LEN];
 	u_int		sc_rxqhead;
 	u_int		sc_rxqtail;
+	uint8_t		sc_txq[OMKBD_TXQ_LEN];
+	u_int		sc_txqhead;
+	u_int		sc_txqtail;
+	bool		sc_tx_busy;
+	bool		sc_tx_done;
+	int		sc_leds;
 #if NWSMOUSE > 0
 	device_t	sc_wsmousedev;
 	int		sc_msbuttons, sc_msdx, sc_msdy;
@@ -84,28 +123,36 @@ struct ws_softc {
 	int		sc_rawkbd;
 };
 
-static void omkbd_input(void *, int);
-static void omkbd_decode(void *, int, u_int *, int *);
+static void omkbd_input(struct ws_softc *, int);
+static void omkbd_send(struct ws_softc *, uint8_t);
+static void omkbd_decode(struct ws_softc *, int, u_int *, int *);
+
 static int  omkbd_enable(void *, int);
 static void omkbd_set_leds(void *, int);
 static int  omkbd_ioctl(void *, u_long, void *, int, struct lwp *);
 
+static void omkbd_complex_buzzer(struct ws_softc *, struct wskbd_bell_data *);
+static uint8_t omkbd_get_buzcmd(struct ws_softc *, struct wskbd_bell_data *,
+uint8_t);
+
 static const struct wskbd_mapdata omkbd_keymapdata = {
-	omkbd_keydesctab,
-	KB_JP,
+	.keydesc = omkbd_keydesctab,
+	.layout  = KB_JP,
 };
 static const struct wskbd_accessops omkbd_accessops = {
-	omkbd_enable,
-	omkbd_set_leds,
-	omkbd_ioctl,
+	.enable   = omkbd_enable,
+	.set_leds = omkbd_set_leds,
+	.ioctl= omkbd_ioctl,
 };
 
 void	ws_cnattach(void);
 static void ws_cngetc(void *, u_int *, int *);
 static void ws_cnpollc(void *, int);
+static void ws_cnbell(void *, u_int, u_int, u_int);
 static const struct 

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

2021-09-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep 18 13:44:02 UTC 2021

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

Log Message:
Implement transmitting keyboard LED and buzzer control commands.

- enable TX on uPD7201 for keyboard port
- prepare TX queue and handle it in hardware interrupt and softint(9)
- send proper LED commands on WSKBDIO_SETLEDS
  (XXX: KANA LED is not handled in wscons)
- return current LED settings on WSKBDIO_GETLEDS
- implement WSKBDIO_COMPLEXBELL by parsing struct wskbd_bell_data and
  send proper buzzer commands
- handle pitch, period, and volume in cnbell(9)
  (XXX: no description in cnbell(9) man pages)
- use proper queued TX function for omms_enable() and omms_disable()
- add DPRINTF()s for debug
- use C99 designated initializer and misc cosmetics

Tested on LUNA and its keyboard (3W4SD-098NDT).


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

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



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 18:38:03 UTC 2021

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

Log Message:
Ignore mouse packets properly even if wsmouse(4) isn't configured.

The internal state of wskbd(4) could be mangled if mouse (which was
connected behind keyboard) was enabled by unexpected keyboard reset.
This could happen on the INSTALL kernel (no wsmouse(4) on it).

Based on a patch from moveccr, with several tweaks by me.


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

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

Modified files:

Index: src/sys/arch/luna68k/dev/lunaws.c
diff -u src/sys/arch/luna68k/dev/lunaws.c:1.33 src/sys/arch/luna68k/dev/lunaws.c:1.34
--- src/sys/arch/luna68k/dev/lunaws.c:1.33	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/luna68k/dev/lunaws.c	Sat Sep  4 18:38:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.33 2021/08/07 16:18:57 thorpej Exp $ */
+/* $NetBSD: lunaws.c,v 1.34 2021/09/04 18:38:03 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.33 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.34 2021/09/04 18:38:03 tsutsui Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "wsmouse.h"
@@ -77,9 +77,9 @@ struct ws_softc {
 	u_int		sc_rxqtail;
 #if NWSMOUSE > 0
 	device_t	sc_wsmousedev;
-	int		sc_msreport;
 	int		sc_msbuttons, sc_msdx, sc_msdy;
 #endif
+	int		sc_msreport;
 	void		*sc_si;
 	int		sc_rawkbd;
 };
@@ -184,9 +184,9 @@ wsattach(device_t parent, device_t self,
 	b.accesscookie = (void *)sc;
 	sc->sc_wsmousedev = config_found(self, , wsmousedevprint,
 	CFARGS(.iattr = "wsmousedev"));
-	sc->sc_msreport = 0;
 	}
 #endif
+	sc->sc_msreport = 0;
 }
 
 /*ARGSUSED*/
@@ -225,41 +225,42 @@ wssoftintr(void *arg)
 	while (sc->sc_rxqhead != sc->sc_rxqtail) {
 		code = sc->sc_rxq[sc->sc_rxqhead];
 		sc->sc_rxqhead = OMKBD_NEXTRXQ(sc->sc_rxqhead);
-#if NWSMOUSE > 0
 		/*
-		 * if (code >= 0x80 && code <= 0x87), then
+		 * if (code >= 0x80 && code <= 0x87), i.e.
+		 * if ((code & 0xf8) == 0x80), then
 		 * it's the first byte of 3 byte long mouse report
 		 *	code[0] & 07 -> LMR button condition
 		 *	code[1], [2] -> x,y delta
 		 * otherwise, key press or release event.
 		 */
-		if (sc->sc_msreport == 0) {
-			if (code < 0x80 || code > 0x87) {
-omkbd_input(sc, code);
-continue;
-			}
-			code = (code & 07) ^ 07;
-			/* LMR->RML: wsevent counts 0 for leftmost */
-			sc->sc_msbuttons = (code & 02);
-			if ((code & 01) != 0)
-sc->sc_msbuttons |= 04;
-			if ((code & 04) != 0)
-sc->sc_msbuttons |= 01;
-			sc->sc_msreport = 1;
-		} else if (sc->sc_msreport == 1) {
+		if (sc->sc_msreport == 1) {
+#if NWSMOUSE > 0
 			sc->sc_msdx = (int8_t)code;
+#endif
 			sc->sc_msreport = 2;
+			continue;
 		} else if (sc->sc_msreport == 2) {
+#if NWSMOUSE > 0
 			sc->sc_msdy = (int8_t)code;
 			wsmouse_input(sc->sc_wsmousedev,
 			sc->sc_msbuttons, sc->sc_msdx, sc->sc_msdy, 0, 0,
 			WSMOUSE_INPUT_DELTA);
-
+#endif
 			sc->sc_msreport = 0;
+			continue;
 		}
-#else
-		omkbd_input(sc, code);
+		if ((code & 0xf8) == 0x80) {
+#if NWSMOUSE > 0
+			/* buttons: Negative logic to positive */
+			code = ~code;
+			/* LMR->RML: wsevent counts 0 for leftmost */
+			sc->sc_msbuttons =
+			((code & 1) << 2) | (code & 2) | ((code & 4) >> 2);
 #endif
+			sc->sc_msreport = 1;
+			continue;
+		}
+		omkbd_input(sc, code);
 	}
 }
 
@@ -380,10 +381,7 @@ omkbd_ioctl(void *v, u_long cmd, void *d
 static int
 omms_enable(void *v)
 {
-	struct ws_softc *sc = v;
-
 	syscnputc((dev_t)1, 0x60); /* enable 3 byte long mouse reporting */
-	sc->sc_msreport = 0;
 	return 0;
 }
 
@@ -402,9 +400,6 @@ omms_ioctl(void *v, u_long cmd, void *da
 static void
 omms_disable(void *v)
 {
-	struct ws_softc *sc = v;
-
 	syscnputc((dev_t)1, 0x20); /* quiet mouse */
-	sc->sc_msreport = 0;
 }
 #endif



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 18:38:03 UTC 2021

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

Log Message:
Ignore mouse packets properly even if wsmouse(4) isn't configured.

The internal state of wskbd(4) could be mangled if mouse (which was
connected behind keyboard) was enabled by unexpected keyboard reset.
This could happen on the INSTALL kernel (no wsmouse(4) on it).

Based on a patch from moveccr, with several tweaks by me.


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

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



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:54:19 UTC 2021

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

Log Message:
Fix several styles and formats.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/luna68k/dev/siotty.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.49 src/sys/arch/luna68k/dev/siotty.c:1.50
--- src/sys/arch/luna68k/dev/siotty.c:1.49	Sat Sep  4 12:44:23 2021
+++ src/sys/arch/luna68k/dev/siotty.c	Sat Sep  4 12:54:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.49 2021/09/04 12:44:23 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.50 2021/09/04 12:54:19 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,9 +31,10 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.49 2021/09/04 12:44:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.50 2021/09/04 12:54:19 tsutsui Exp $");
 
 #include "opt_ddb.h"
+#include "siotty.h"
 
 #include 
 #include 
@@ -105,7 +106,6 @@ u_int siotty_rbuf_size = SIOTTY_RING_SIZ
 
 static struct cnm_state	siotty_cnm_state;
 
-#include "siotty.h"
 static void siostart(struct tty *);
 static int  sioparam(struct tty *, struct termios *);
 static void siottyintr(void *);
@@ -415,14 +415,16 @@ sioparam(struct tty *tp, struct termios 
 	tp->t_ospeed = t->c_ospeed;
 	tp->t_cflag = t->c_cflag;
 
-	sc->sc_wr[WR3] &= 0x3f;
-	sc->sc_wr[WR5] &= 0x9f;
+	sc->sc_wr[WR3] &= ~WR3_RX8BIT;
+	sc->sc_wr[WR5] &= ~WR5_TX8BIT;
 	switch (tp->t_cflag & CSIZE) {
 	case CS7:
-		sc->sc_wr[WR3] |= WR3_RX7BIT; sc->sc_wr[WR5] |= WR5_TX7BIT;
+		sc->sc_wr[WR3] |= WR3_RX7BIT;
+		sc->sc_wr[WR5] |= WR5_TX7BIT;
 		break;
 	case CS8:
-		sc->sc_wr[WR3] |= WR3_RX8BIT; sc->sc_wr[WR5] |= WR5_TX8BIT;
+		sc->sc_wr[WR3] |= WR3_RX8BIT;
+		sc->sc_wr[WR5] |= WR5_TX8BIT;
 		break;
 	}
 	if ((tp->t_cflag & PARENB) != 0) {
@@ -524,9 +526,9 @@ sioopen(dev_t dev, int flag, int mode, s
 		/* raise RTS and DTR here; but, DTR lead is not wired */
 		/* then check DCD condition; but, DCD lead is not wired */
 #if 0
-		if ((sc->sc_flags & TIOCFLAG_SOFTCAR) != 0
-		|| (tp->t_cflag & MDMBUF) != 0
-		|| (getsiocsr(sc->sc_ctl) & RR_DCD) != 0)
+		if ((sc->sc_flags & TIOCFLAG_SOFTCAR) != 0 ||
+		(tp->t_cflag & MDMBUF) != 0 ||
+		(getsiocsr(sc->sc_ctl) & RR_DCD) != 0)
 			tp->t_state |= TS_CARR_ON;
 		else
 			tp->t_state &= ~TS_CARR_ON;
@@ -558,8 +560,8 @@ sioclose(dev_t dev, int flag, int mode, 
 	s = splserial();
 	siomctl(sc, TIOCM_BREAK, DMBIC);
 #if 0 /* because unable to feed DTR signal */
-	if ((tp->t_cflag & HUPCL) != 0
-	|| tp->t_wopen || (tp->t_state & TS_ISOPEN) == 0) {
+	if ((tp->t_cflag & HUPCL) != 0 ||
+	tp->t_wopen || (tp->t_state & TS_ISOPEN) == 0) {
 		siomctl(sc, TIOCM_DTR, DMBIC);
 		/* Yield CPU time to others for 1 second, then ... */
 		siomctl(sc, TIOCM_DTR, DMBIS);



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:54:19 UTC 2021

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

Log Message:
Fix several styles and formats.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/luna68k/dev/siotty.c

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



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:44:23 UTC 2021

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

Log Message:
Use C99 designated initializer.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/luna68k/dev/siotty.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.48 src/sys/arch/luna68k/dev/siotty.c:1.49
--- src/sys/arch/luna68k/dev/siotty.c:1.48	Sat Sep  4 12:38:13 2021
+++ src/sys/arch/luna68k/dev/siotty.c	Sat Sep  4 12:44:23 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.48 2021/09/04 12:38:13 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.49 2021/09/04 12:44:23 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.48 2021/09/04 12:38:13 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.49 2021/09/04 12:44:23 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -692,16 +692,16 @@ getsiocsr(struct sioreg *sio)
 /*-  console interface --*/
 
 struct consdev syscons = {
-	NULL,
-	NULL,
-	syscngetc,
-	syscnputc,
-	nullcnpollc,
-	NULL,
-	NULL,
-	NULL,
-	NODEV,
-	CN_REMOTE,
+	.cn_probe = NULL,
+	.cn_init  = NULL,
+	.cn_getc  = syscngetc,
+	.cn_putc  = syscnputc,
+	.cn_pollc = nullcnpollc,
+	.cn_bell  = NULL,
+	.cn_halt  = NULL,
+	.cn_flush = NULL,
+	.cn_dev   = NODEV,
+	.cn_pri   = CN_REMOTE,
 };
 
 /* EXPORT */ void



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:44:23 UTC 2021

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

Log Message:
Use C99 designated initializer.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/luna68k/dev/siotty.c

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



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:38:13 UTC 2021

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

Log Message:
Use proper macro for device register addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/siotty.c

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

Modified files:

Index: src/sys/arch/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.47 src/sys/arch/luna68k/dev/siotty.c:1.48
--- src/sys/arch/luna68k/dev/siotty.c:1.47	Tue Dec 29 17:17:14 2020
+++ src/sys/arch/luna68k/dev/siotty.c	Sat Sep  4 12:38:13 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.47 2020/12/29 17:17:14 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.48 2021/09/04 12:38:13 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.47 2020/12/29 17:17:14 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.48 2021/09/04 12:38:13 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -711,7 +712,7 @@ syscninit(int channel)
  * boot/reset/poweron.  ROM monitor emits one line message on CH.A.
  */
 	struct sioreg *sio;
-	sio = (struct sioreg *)0x5100 + channel;
+	sio = (struct sioreg *)OBIO_SIO + channel;
 
 	syscons.cn_dev = makedev(cdevsw_lookup_major(_cdevsw),
  channel);
@@ -735,7 +736,7 @@ syscngetc(dev_t dev)
 	struct sioreg *sio;
 	int s, c;
 
-	sio = (struct sioreg *)0x5100 + ((int)dev & 0x1);
+	sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
 	s = splhigh();
 	while ((getsiocsr(sio) & RR_RXRDY) == 0)
 		continue;
@@ -751,7 +752,7 @@ syscnputc(dev_t dev, int c)
 	struct sioreg *sio;
 	int s;
 
-	sio = (struct sioreg *)0x5100 + ((int)dev & 0x1);
+	sio = (struct sioreg *)OBIO_SIO + ((int)dev & 0x1);
 	s = splhigh();
 	while ((getsiocsr(sio) & RR_TXRDY) == 0)
 		continue;



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

2021-09-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Sep  4 12:38:13 UTC 2021

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

Log Message:
Use proper macro for device register addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/luna68k/dev/siotty.c

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



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

2021-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Sep  3 16:21:15 UTC 2021

Modified Files:
src/sys/arch/luna68k/stand/boot: kbd.c

Log Message:
Ignore mouse packets to avoid unexpected data handled as keyboard input.

Patch from moveccr.


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

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

Modified files:

Index: src/sys/arch/luna68k/stand/boot/kbd.c
diff -u src/sys/arch/luna68k/stand/boot/kbd.c:1.4 src/sys/arch/luna68k/stand/boot/kbd.c:1.5
--- src/sys/arch/luna68k/stand/boot/kbd.c:1.4	Sat Feb 14 13:06:28 2015
+++ src/sys/arch/luna68k/stand/boot/kbd.c	Fri Sep  3 16:21:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.4 2015/02/14 13:06:28 tsutsui Exp $	*/
+/*	$NetBSD: kbd.c,v 1.5 2021/09/03 16:21:15 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -213,12 +213,23 @@ static const struct kbd_keymap kbd_keyma
 int	shift_flag = 0;
 int	ctrl_flag  = 0;
 int	meta_flag  = 0;
+int	mouse_flag  = 0;
 
 int
 kbd_decode(uint8_t code)
 {
 	unsigned int c, updown = 0;
 
+	/* ignore mouse data */
+	if (mouse_flag != 0) {
+		mouse_flag--;
+		return KC_IGNORE;
+	}
+	if ((code & 0xf8) == 0x80) {
+		mouse_flag = 2;
+		return KC_IGNORE;
+	}
+
 	if (code & 0x80)
 		updown = 1;
 



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

2021-09-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Sep  3 16:21:15 UTC 2021

Modified Files:
src/sys/arch/luna68k/stand/boot: kbd.c

Log Message:
Ignore mouse packets to avoid unexpected data handled as keyboard input.

Patch from moveccr.


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

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



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

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:21:52 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Back out previous - fixed differently by rin already.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/stand/boot/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/luna68k/stand/boot/machdep.c
diff -u src/sys/arch/luna68k/stand/boot/machdep.c:1.7 src/sys/arch/luna68k/stand/boot/machdep.c:1.8
--- src/sys/arch/luna68k/stand/boot/machdep.c:1.7	Sun Oct 27 11:08:04 2019
+++ src/sys/arch/luna68k/stand/boot/machdep.c	Sun Oct 27 11:21:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2019/10/27 11:08:04 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.8 2019/10/27 11:21:52 martin Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -71,9 +71,7 @@
  */
 
 #include 
-#define _KERNEL	/* we need the register defines (PC/SP/...) */
 #include 
-#undef _KERNEL
 #include 
 
 static void dumpmem(int *, int, int);



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

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:21:52 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Back out previous - fixed differently by rin already.


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

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:08:04 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Define _KERNEL while including reg.h: we need the (now protected) register
names.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/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/luna68k/stand/boot/machdep.c
diff -u src/sys/arch/luna68k/stand/boot/machdep.c:1.6 src/sys/arch/luna68k/stand/boot/machdep.c:1.7
--- src/sys/arch/luna68k/stand/boot/machdep.c:1.6	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/luna68k/stand/boot/machdep.c	Sun Oct 27 11:08:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.6 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.7 2019/10/27 11:08:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -71,7 +71,9 @@
  */
 
 #include 
+#define _KERNEL	/* we need the register defines (PC/SP/...) */
 #include 
+#undef _KERNEL
 #include 
 
 static void dumpmem(int *, int, int);



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

2019-10-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 27 11:08:04 UTC 2019

Modified Files:
src/sys/arch/luna68k/stand/boot: machdep.c

Log Message:
Define _KERNEL while including reg.h: we need the (now protected) register
names.


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

2019-09-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep 22 06:06:01 UTC 2019

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

Log Message:
Correct size of framebuffer; page offset appears only once,
not every color depths.

Pointed out by Araki Ken. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/luna68k/dev/lunafb.c

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



  1   2   >