CVS commit: src/sys/arch/virt68k/virt68k

2024-11-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Nov 11 13:55:22 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
virt68k/bootinfo.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.7 src/sys/arch/virt68k/virt68k/bootinfo.c:1.8
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.7	Fri Nov  1 14:28:42 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Mon Nov 11 13:55:22 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.7 2024/11/01 14:28:42 mlelstv Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.8 2024/11/11 13:55:22 riastradh Exp $*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.7 2024/11/01 14:28:42 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.8 2024/11/11 13:55:22 riastradh Exp $");
 
 #include "opt_md.h"
 



CVS commit: src/sys/arch/virt68k/virt68k

2024-11-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Nov 11 13:55:22 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
virt68k/bootinfo.c: Nix trailing whitespace.

No functional change intended.


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

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:28:42 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Make compilable without GFTTY


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.6 src/sys/arch/virt68k/virt68k/bootinfo.c:1.7
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.6	Mon Jan  8 05:09:41 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Fri Nov  1 14:28:42 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.6 2024/01/08 05:09:41 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.7 2024/11/01 14:28:42 mlelstv Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.6 2024/01/08 05:09:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.7 2024/11/01 14:28:42 mlelstv Exp $");
 
 #include "opt_md.h"
 
@@ -69,6 +69,7 @@ static bool		bootinfo_console_addr_valid
 static uint32_t		bootinfo_initrd_start;
 static uint32_t		bootinfo_initrd_size;
 
+#if NGFTTY > 0
 static bool
 bootinfo_set_console(paddr_t pa)
 {
@@ -79,6 +80,7 @@ bootinfo_set_console(paddr_t pa)
 	}
 	return false;
 }
+#endif
 
 static inline struct bi_record *
 bootinfo_next(struct bi_record *bi)



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

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:31:59 UTC 2024

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

Log Message:
Add drvctl driver.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/conf/GENERIC

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



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

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:31:59 UTC 2024

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

Log Message:
Add drvctl driver.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.8 src/sys/arch/virt68k/conf/GENERIC:1.9
--- src/sys/arch/virt68k/conf/GENERIC:1.8	Mon Sep 23 10:38:31 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Fri Nov  1 14:31:59 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.8 2024/09/23 10:38:31 rin Exp $
+# $NetBSD: GENERIC,v 1.9 2024/11/01 14:31:59 mlelstv Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.8 $"
+#ident 		"GENERIC-$Revision: 1.9 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -150,6 +150,7 @@ pseudo-device	clockctl		# user control o
 pseudo-device	ksyms			# /dev/ksyms
 #pseudo-device	npf			# NPF packet filter
 pseudo-device 	swwdog			# software watchdog timer -- swwdog(4)
+pseudo-device	drvctl			# user control of drive subsystem
 
 # crypto pseudo-devices
 pseudo-device	crypto			# /dev/crypto device
@@ -174,10 +175,10 @@ virtctrl*	at mainbus? addr ?
 # VirtIO devices
 virtio*		at mainbus? addr ?	# VirtIO nexus
 ld*		at virtio?		# VirtIO disk device
-viocon*		at virtio?		# VirtIO serial device
 vioif*		at virtio?		# VirtIO network device
 viornd*		at virtio?		# VirtIO entropy device
 vioscsi*	at virtio?		# VirtIO SCSI device
+viocon*		at virtio?		# Virtio Console
 
 # SCSI devices
 scsibus* at scsi?



CVS commit: src/sys/arch/virt68k/virt68k

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:28:42 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Make compilable without GFTTY


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

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:28:08 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: intr.c

Log Message:
Catch stray interrupts.
The message reports the CPU interrupt level.


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

2024-11-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov  1 14:28:08 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: intr.c

Log Message:
Catch stray interrupts.
The message reports the CPU interrupt level.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/intr.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/virt68k/virt68k/intr.c
diff -u src/sys/arch/virt68k/virt68k/intr.c:1.3 src/sys/arch/virt68k/virt68k/intr.c:1.4
--- src/sys/arch/virt68k/virt68k/intr.c:1.3	Fri Jan 19 05:46:36 2024
+++ src/sys/arch/virt68k/virt68k/intr.c	Fri Nov  1 14:28:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.4 2024/11/01 14:28:08 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.4 2024/11/01 14:28:08 mlelstv Exp $");
 
 #define _VIRT68K_INTR_PRIVATE
 
@@ -279,6 +279,11 @@ intr_dispatch(struct clockframe frame)
 		return;
 	}
 
+	if (pics[pic] == NULL) {
+		printf("Interrupt without a cause on CPU ipl %d\n", ipl);
+		return;
+	}
+
 	const int base = pic * NIRQ_PER_PIC;
 	struct intrhand *ih;
 	bool rv = false;
@@ -293,7 +298,7 @@ intr_dispatch(struct clockframe frame)
 		}
 	}
 	if (!rv) {
-		printf("Spurious interrupt on CPU irq %d\n", ipl);
+		printf("Spurious interrupt on CPU ipl %d\n", ipl);
 	}
 }
 



CVS commit: src/sys/arch/virt68k/virt68k

2024-09-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 23 10:43:33 UTC 2024

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

Log Message:
virt68k: trap: Fix ksi_code for T_TRAP{,15}|T_USER

Fix ATF failures for lib/libc/sys/t_ptrace_wait*:{,set}step*.

XXX
It would be really nice if we can factor out copy-paste b/w
m68k ports...


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/trap.c
diff -u src/sys/arch/virt68k/virt68k/trap.c:1.3 src/sys/arch/virt68k/virt68k/trap.c:1.4
--- src/sys/arch/virt68k/virt68k/trap.c:1.3	Sun Feb 25 14:35:31 2024
+++ src/sys/arch/virt68k/virt68k/trap.c	Mon Sep 23 10:43:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $	*/
+/*	$NetBSD: trap.c,v 1.4 2024/09/23 10:43:33 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.4 2024/09/23 10:43:33 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -505,6 +505,10 @@ trap(struct frame *fp, int type, unsigne
 	case T_TRAP15|T_USER:	/* SUN user trace trap */
 		fp->f_sr &= ~PSL_T;
 		ksi.ksi_signo = SIGTRAP;
+		if (type == (T_TRAP15|T_USER))
+			ksi.ksi_code = TRAP_BRKPT;
+		else
+			ksi.ksi_code = TRAP_TRACE;
 		break;
 
 	case T_ASTFLT:		/* system async trap, cannot happen */



CVS commit: src/sys/arch/virt68k/virt68k

2024-09-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 23 10:43:33 UTC 2024

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

Log Message:
virt68k: trap: Fix ksi_code for T_TRAP{,15}|T_USER

Fix ATF failures for lib/libc/sys/t_ptrace_wait*:{,set}step*.

XXX
It would be really nice if we can factor out copy-paste b/w
m68k ports...


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

2024-09-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 23 10:38:31 UTC 2024

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

Log Message:
virt68k: GENERIC: Add some features required by ATF

- NULLFS, PUFFS, and putter
- SYSV{MSG,SEM,SHM}
- {,sw}crypto


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.7 src/sys/arch/virt68k/conf/GENERIC:1.8
--- src/sys/arch/virt68k/conf/GENERIC:1.7	Tue Jul 16 12:01:19 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Mon Sep 23 10:38:31 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.7 2024/07/16 12:01:19 riastradh Exp $
+# $NetBSD: GENERIC,v 1.8 2024/09/23 10:38:31 rin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.7 $"
+#ident 		"GENERIC-$Revision: 1.8 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -68,6 +68,9 @@ file-system	MSDOSFS
 file-system	PTYFS		# /dev/pts/N support
 file-system	TMPFS		# Efficient memory file-system
 #file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+file-system	NULLFS		# loopback file system
+file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
+pseudo-device	putter		# for puffs and pud
 
 # File system options
 #options 	FFS_EI		# FFS Endian Independent support
@@ -105,6 +108,11 @@ include 	"conf/compat_netbsd09.config"
 #options 	COMPAT_LINUX	# compatibility with Linux/m68k binaries
 #options 	COMPAT_OSSAUDIO	# compatibility with Linux/m68k binaries
 
+# Shared memory options
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+options 	SYSVSHM		# System V-like memory sharing
+
 ## force NFS root and swap
 #config	netbsd		root on ? type nfs
 ## "generic" boot (put root on boot device)
@@ -143,6 +151,10 @@ pseudo-device	ksyms			# /dev/ksyms
 #pseudo-device	npf			# NPF packet filter
 pseudo-device 	swwdog			# software watchdog timer -- swwdog(4)
 
+# crypto pseudo-devices
+pseudo-device	crypto			# /dev/crypto device
+pseudo-device	swcrypto		# software crypto implementation
+
 # random number generator pseudo-device
 #options 	RND_COM			# use "com" randomness as well (BROKEN)
 



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

2024-09-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep 23 10:38:31 UTC 2024

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

Log Message:
virt68k: GENERIC: Add some features required by ATF

- NULLFS, PUFFS, and putter
- SYSV{MSG,SEM,SHM}
- {,sw}crypto


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/conf/GENERIC

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



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

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:16:31 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: virtio_mainbus.c

Log Message:
Fix a null dereference.
free_interrupts may be called even when sc_ih has not been assigned yet.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtio_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/virt68k/dev/virtio_mainbus.c
diff -u src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1 src/sys/arch/virt68k/dev/virtio_mainbus.c:1.2
--- src/sys/arch/virt68k/dev/virtio_mainbus.c:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/dev/virtio_mainbus.c	Sat Mar  9 11:16:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $	*/
+/*	$NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $	*/
 
 /*
  * Copyright (c) 2021, 2024 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_mainbus.c,v 1.2 2024/03/09 11:16:31 isaki Exp $");
 
 #include 
 #include 
@@ -170,6 +170,8 @@ virtio_mainbus_alloc_interrupts(struct v
 static void
 virtio_mainbus_free_interrupts(struct virtio_mmio_softc *msc)
 {
-	intr_disestablish(msc->sc_ih);
-	msc->sc_ih = NULL;
+	if (msc->sc_ih) {
+		intr_disestablish(msc->sc_ih);
+		msc->sc_ih = NULL;
+	}
 }



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

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:16:31 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: virtio_mainbus.c

Log Message:
Fix a null dereference.
free_interrupts may be called even when sc_ih has not been assigned yet.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtio_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/virt68k/virt68k

2024-02-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 25 14:35:31 UTC 2024

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

Log Message:
Don't crash in copyin/copyout when a NULL pointer is passed.


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

2024-02-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Feb 25 14:35:31 UTC 2024

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

Log Message:
Don't crash in copyin/copyout when a NULL pointer is passed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/trap.c
diff -u src/sys/arch/virt68k/virt68k/trap.c:1.2 src/sys/arch/virt68k/virt68k/trap.c:1.3
--- src/sys/arch/virt68k/virt68k/trap.c:1.2	Sat Jan 20 00:15:33 2024
+++ src/sys/arch/virt68k/virt68k/trap.c	Sun Feb 25 14:35:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $	*/
+/*	$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -554,7 +554,7 @@ trap(struct frame *fp, int type, unsigne
 
 		va = trunc_page((vaddr_t)v);
 
-		if (map == kernel_map && va == 0) {
+		if (map == kernel_map && va == 0 && onfault == 0) {
 			printf("trap: bad kernel %s access at 0x%x\n",
 			(ftype & VM_PROT_WRITE) ? "read/write" :
 			"read", v);



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

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 20 01:04:29 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: aout_machdep.h cdefs.h db_machdep.h
elf_machdep.h ieeefp.h kcore.h lock.h ptrace.h reg.h

Log Message:
Hygiene.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/aout_machdep.h \
src/sys/arch/virt68k/include/cdefs.h \
src/sys/arch/virt68k/include/db_machdep.h \
src/sys/arch/virt68k/include/elf_machdep.h \
src/sys/arch/virt68k/include/ieeefp.h \
src/sys/arch/virt68k/include/kcore.h src/sys/arch/virt68k/include/lock.h \
src/sys/arch/virt68k/include/ptrace.h src/sys/arch/virt68k/include/reg.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/virt68k/include

2024-01-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 20 01:04:29 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: aout_machdep.h cdefs.h db_machdep.h
elf_machdep.h ieeefp.h kcore.h lock.h ptrace.h reg.h

Log Message:
Hygiene.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/aout_machdep.h \
src/sys/arch/virt68k/include/cdefs.h \
src/sys/arch/virt68k/include/db_machdep.h \
src/sys/arch/virt68k/include/elf_machdep.h \
src/sys/arch/virt68k/include/ieeefp.h \
src/sys/arch/virt68k/include/kcore.h src/sys/arch/virt68k/include/lock.h \
src/sys/arch/virt68k/include/ptrace.h src/sys/arch/virt68k/include/reg.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/virt68k/include/aout_machdep.h
diff -u src/sys/arch/virt68k/include/aout_machdep.h:1.1 src/sys/arch/virt68k/include/aout_machdep.h:1.2
--- src/sys/arch/virt68k/include/aout_machdep.h:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/include/aout_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: aout_machdep.h,v 1.1 2024/01/02 07:40:59 thorpej Exp $	*/
-
-#ifndef _MACHINE_EXEC_H_
-#define _MACHINE_EXEC_H_
+/*	$NetBSD: aout_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif  /* _MACHINE_EXEC_H_ */
Index: src/sys/arch/virt68k/include/cdefs.h
diff -u src/sys/arch/virt68k/include/cdefs.h:1.1 src/sys/arch/virt68k/include/cdefs.h:1.2
--- src/sys/arch/virt68k/include/cdefs.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/cdefs.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: cdefs.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
+/*	$NetBSD: cdefs.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/db_machdep.h
diff -u src/sys/arch/virt68k/include/db_machdep.h:1.1 src/sys/arch/virt68k/include/db_machdep.h:1.2
--- src/sys/arch/virt68k/include/db_machdep.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/db_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,6 +1,3 @@
-/*	$NetBSD: db_machdep.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: db_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
-
-#define DB_ELF_SYMBOLS
Index: src/sys/arch/virt68k/include/elf_machdep.h
diff -u src/sys/arch/virt68k/include/elf_machdep.h:1.1 src/sys/arch/virt68k/include/elf_machdep.h:1.2
--- src/sys/arch/virt68k/include/elf_machdep.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/elf_machdep.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: elf_machdep.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_ELF_MACHDEP_H_
-#define _MACHINE_ELF_MACHDEP_H_
+/*	$NetBSD: elf_machdep.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/ieeefp.h
diff -u src/sys/arch/virt68k/include/ieeefp.h:1.1 src/sys/arch/virt68k/include/ieeefp.h:1.2
--- src/sys/arch/virt68k/include/ieeefp.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/ieeefp.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: ieeefp.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: ieeefp.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/kcore.h
diff -u src/sys/arch/virt68k/include/kcore.h:1.1 src/sys/arch/virt68k/include/kcore.h:1.2
--- src/sys/arch/virt68k/include/kcore.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/kcore.h	Sat Jan 20 01:04:29 2024
@@ -1,8 +1,3 @@
-/*	$NetBSD: kcore.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
-
-#ifndef _MACHINE_KCORE_H_
-#define _MACHINE_KCORE_H_
+/*	$NetBSD: kcore.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
 #include 
-
-#endif
Index: src/sys/arch/virt68k/include/lock.h
diff -u src/sys/arch/virt68k/include/lock.h:1.1 src/sys/arch/virt68k/include/lock.h:1.2
--- src/sys/arch/virt68k/include/lock.h:1.1	Tue Jan  2 07:41:01 2024
+++ src/sys/arch/virt68k/include/lock.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: lock.h,v 1.1 2024/01/02 07:41:01 thorpej Exp $	*/
+/*	$NetBSD: lock.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/ptrace.h
diff -u src/sys/arch/virt68k/include/ptrace.h:1.1 src/sys/arch/virt68k/include/ptrace.h:1.2
--- src/sys/arch/virt68k/include/ptrace.h:1.1	Tue Jan  2 07:41:01 2024
+++ src/sys/arch/virt68k/include/ptrace.h	Sat Jan 20 01:04:29 2024
@@ -1,4 +1,3 @@
-/*	$NetBSD: ptrace.h,v 1.1 2024/01/02 07:41:01 thorpej Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.2 2024/01/20 01:04:29 thorpej Exp $	*/
 
-/* Just use the common m68k definition */
 #include 
Index: src/sys/arch/virt68k/include/reg.h
diff -u src/sys/arch/virt68k/include/reg.h:1.1 src/sys/arch/virt68

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

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:47:15 UTC 2024

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

Log Message:
Revert unintended commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.5 src/sys/arch/virt68k/conf/GENERIC:1.6
--- src/sys/arch/virt68k/conf/GENERIC:1.5	Fri Jan 19 05:46:36 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Fri Jan 19 05:47:15 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.5 2024/01/19 05:46:36 thorpej Exp $
+# $NetBSD: GENERIC,v 1.6 2024/01/19 05:47:15 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.5 $"
+#ident 		"GENERIC-$Revision: 1.6 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -100,9 +100,7 @@ options 	INET6		# IPV6
 
 options 	COMPAT_AOUT_M68K	# compatibility with NetBSD/m68k a.out
 include 	"conf/compat_netbsd09.config"
-options 	COMPAT_SUNOS
-options 	COMPAT_13
-options 	COMPAT_16
+#options 	COMPAT_SUNOS
 #options 	COMPAT_M68K4K	# compatibility with NetBSD/m68k4k binaries
 #options 	COMPAT_LINUX	# compatibility with Linux/m68k binaries
 #options 	COMPAT_OSSAUDIO	# compatibility with Linux/m68k binaries



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

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:47:15 UTC 2024

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

Log Message:
Revert unintended commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/conf/GENERIC

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



CVS commit: src/sys/arch/virt68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:46:36 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: GENERIC
src/sys/arch/virt68k/include: cpu.h intr.h
src/sys/arch/virt68k/virt68k: intr.c locore.s

Log Message:
Adjust the clockframe to be the same as what the common m68k interrupt
dispatch code expects.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/intr.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/intr.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/virt68k/virt68k/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/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.4 src/sys/arch/virt68k/conf/GENERIC:1.5
--- src/sys/arch/virt68k/conf/GENERIC:1.4	Mon Jan  8 05:11:54 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.4 2024/01/08 05:11:54 thorpej Exp $
+# $NetBSD: GENERIC,v 1.5 2024/01/19 05:46:36 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.4 $"
+#ident 		"GENERIC-$Revision: 1.5 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -100,7 +100,9 @@ options 	INET6		# IPV6
 
 options 	COMPAT_AOUT_M68K	# compatibility with NetBSD/m68k a.out
 include 	"conf/compat_netbsd09.config"
-#options 	COMPAT_SUNOS
+options 	COMPAT_SUNOS
+options 	COMPAT_13
+options 	COMPAT_16
 #options 	COMPAT_M68K4K	# compatibility with NetBSD/m68k4k binaries
 #options 	COMPAT_LINUX	# compatibility with Linux/m68k binaries
 #options 	COMPAT_OSSAUDIO	# compatibility with Linux/m68k binaries

Index: src/sys/arch/virt68k/include/cpu.h
diff -u src/sys/arch/virt68k/include/cpu.h:1.5 src/sys/arch/virt68k/include/cpu.h:1.6
--- src/sys/arch/virt68k/include/cpu.h:1.5	Thu Jan 18 14:39:07 2024
+++ src/sys/arch/virt68k/include/cpu.h	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.5 2024/01/18 14:39:07 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.6 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -54,17 +54,17 @@
 /*
  * Arguments to hardclock and gatherstats encapsulate the previous
  * machine state in an opaque clockframe.  On the virt68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
+ * what the locore.s glue puts on the stack before calling C-code.
  */
 struct clockframe {
-	u_short	sr;		/* sr at time of interrupt */
-	u_long	pc;		/* pc at time of interrupt */
-	u_short	fmt:4,
-		vec:12;		/* vector offset (4-word frame) */
+	u_int	cf_regs[4];	/* d0,d1,a0,a1 */
+	u_short	cf_sr;		/* sr at time of interrupt */
+	u_long	cf_pc;		/* pc at time of interrupt */
+	u_short	cf_vo;		/* vector offset (4-word frame) */
 } __attribute__((packed));
 
-#define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
-#define	CLKF_PC(framep)		((framep)->pc)
+#define	CLKF_USERMODE(framep)	(((framep)->cf_sr & PSL_S) == 0)
+#define	CLKF_PC(framep)		((framep)->cf_pc)
 
 /*
  * The clock interrupt handler can determine if it's a nested

Index: src/sys/arch/virt68k/include/intr.h
diff -u src/sys/arch/virt68k/include/intr.h:1.1 src/sys/arch/virt68k/include/intr.h:1.2
--- src/sys/arch/virt68k/include/intr.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/intr.h	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: intr.h,v 1.2 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -162,7 +162,7 @@ void	intr_register_pic(struct device *, 
 #include 
 #include 
 
-void	intr_dispatch(struct clockframe *);
+void	intr_dispatch(struct clockframe);
 #endif /* _VIRT68K_INTR_PRIVATE */
 
 #endif /* !_LOCORE */

Index: src/sys/arch/virt68k/virt68k/intr.c
diff -u src/sys/arch/virt68k/virt68k/intr.c:1.2 src/sys/arch/virt68k/virt68k/intr.c:1.3
--- src/sys/arch/virt68k/virt68k/intr.c:1.2	Tue Jan  2 07:48:46 2024
+++ src/sys/arch/virt68k/virt68k/intr.c	Fri Jan 19 05:46:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2023 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.3 2024/01/19 05:46:36 thorpej Exp $");
 
 #define _VIRT68K_INTR_PRIVATE
 
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -267,9 +269,9 @@ intr_string(void *v, char *buf, size_t b
 #define	VEC_AVINTR	0x18

CVS commit: src/sys/arch/virt68k

2024-01-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 19 05:46:36 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: GENERIC
src/sys/arch/virt68k/include: cpu.h intr.h
src/sys/arch/virt68k/virt68k: intr.c locore.s

Log Message:
Adjust the clockframe to be the same as what the common m68k interrupt
dispatch code expects.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/intr.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/intr.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k

2024-01-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jan 18 12:07:51 UTC 2024

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

Log Message:
Set TT0 register to recognize the I/O space even on the 68030 case.

http://mail-index.netbsd.org/port-m68k/2024/01/17/msg000870.html


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.13 src/sys/arch/virt68k/virt68k/locore.s:1.14
--- src/sys/arch/virt68k/virt68k/locore.s:1.13	Wed Jan 17 12:33:51 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Thu Jan 18 12:07:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.13 2024/01/17 12:33:51 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.14 2024/01/18 12:07:51 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -199,8 +199,13 @@ Lnot060cache:
 	jmp	Lenab1
 
 Lmotommu2:
+	movl	#VIRT68K_TT30_IO,%sp@-	| TT0 maps the I/O space
+	.long	0xf0170800		| pmove %sp@,%tt0
+	clrl	%sp@			| ensure TT1 is disabled
+	.long	0xf0170c00		| pmove %sp@,%tt1
+
 	pflusha
-	movl	#MMU51_TCR_BITS,%sp@-	| value to load TC with
+	movl	#MMU51_TCR_BITS,%sp@	| value to load TC with
 	pmove	%sp@,%tc		| load it
 
 /*



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-18 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Jan 18 12:07:51 UTC 2024

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

Log Message:
Set TT0 register to recognize the I/O space even on the 68030 case.

http://mail-index.netbsd.org/port-m68k/2024/01/17/msg000870.html


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

2024-01-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 17 05:22:11 UTC 2024

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

Log Message:
G/C intrcnt[].


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.10 src/sys/arch/virt68k/virt68k/locore.s:1.11
--- src/sys/arch/virt68k/virt68k/locore.s:1.10	Tue Jan 16 15:38:58 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Wed Jan 17 05:22:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.10 2024/01/16 15:38:58 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.11 2024/01/17 05:22:11 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -622,24 +622,3 @@ GLOBAL(cputype)
 
 GLOBAL(fputype)
 	.long	FPU_68040	| default to FPU_68040
-
-/*
- * interrupt counters.
- * XXXSCW: Will go away soon; kept here to keep vmstat happy
- */
-GLOBAL(intrnames)
-	.asciz	"spur"
-	.asciz	"lev1"
-	.asciz	"lev2"
-	.asciz	"lev3"
-	.asciz	"lev4"
-	.asciz	"clock"
-	.asciz	"lev6"
-	.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/virt68k/virt68k

2024-01-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan 17 05:22:11 UTC 2024

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

Log Message:
G/C intrcnt[].


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

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:58 UTC 2024

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

Log Message:
Switch to common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/include/vectors.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/virt68k/machdep.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/virt68k/virt68k/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/virt68k/conf/files.virt68k
diff -u src/sys/arch/virt68k/conf/files.virt68k:1.3 src/sys/arch/virt68k/conf/files.virt68k:1.4
--- src/sys/arch/virt68k/conf/files.virt68k:1.3	Tue Jan  9 04:16:27 2024
+++ src/sys/arch/virt68k/conf/files.virt68k	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.virt68k,v 1.3 2024/01/09 04:16:27 thorpej Exp $
+#	$NetBSD: files.virt68k,v 1.4 2024/01/13 17:10:58 thorpej Exp $
 
 # config file for virt68k
 
@@ -51,6 +51,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/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.8 src/sys/arch/virt68k/virt68k/locore.s:1.9
--- src/sys/arch/virt68k/virt68k/locore.s:1.8	Fri Jan 12 23:36:30 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.8 2024/01/12 23:36:30 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.9 2024/01/13 17:10:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -72,8 +72,6 @@
 	.space	PAGE_SIZE
 ASLOCAL(tmpstk)
 
-#include 
-
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
@@ -128,36 +126,6 @@ ASENTRY_NOPROFILE(start)
 	movc	%d0,%cacr		| clear and disable on-chip cache(s)
 	/* XXX XXX XXX */
 
-	/*
-	 * bootinfo_start() will have determined what kind of CPU
-	 * we have, so it's time to fix up the vector table:
-	 *
-	 *	vectab+8	bus error
-	 *	vectab+12	address error
-	 */
-	RELOC(cputype, %a0)
-	movl#_C_LABEL(vectab),%a2
-	addl	%a5,%a2
-#if defined(M68040)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jne	1f			| no, skip
-	movl	#_C_LABEL(buserr40),%a2@(8)
-	movl	#_C_LABEL(addrerr4060),%a2@(12)
-	jra	Lstart1
-1:
-#endif /* M68040 */
-#if defined(M68030)
-	cmpl	#CPU_68040,%a0@		| 68040?
-	jeq	1f			| yes, skip
-	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
-	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
-	jra	Lstart1
-1:
-#endif /* M68030 */
-
-	/* Config botch.  No hope.  SOLDIER ON! */
-
-Lstart1:
 /* initialize source/destination control registers for movs */
 	moveq	#FC_USERD,%d0		| user space
 	movc	%d0,%sfc		|   as source
@@ -239,10 +207,8 @@ Lmotommu2:
  * Should be running mapped from this point on
  */
 Lenab1:
-/* Point the CPU VBR at our vector table */
-	movl	#_C_LABEL(vectab),%d0	| get our VBR address
-	movc	%d0,%vbr
-	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
+	lea	_ASM_LABEL(tmpstk),%sp	| re-load the temporary stack
+	jbsr	_C_LABEL(vec_init)	| initialize the vector table
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.7 src/sys/arch/virt68k/virt68k/machdep.c:1.8
--- src/sys/arch/virt68k/virt68k/machdep.c:1.7	Tue Jan  9 14:24:08 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Sat Jan 13 17:10:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.8 2024/01/13 17:10:58 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.8 2024/01/13 17:10:58 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -802,41 +802,7 @@ dumpsys(void)
 void
 initcpu(void)
 {
-#if defined(M68060)
-	extern void *vectab[256];
-#if defined(M060SP)
-	extern uint8_t I_CALL_TOP[];
-	extern uint8_t FP_CALL_TOP[];
-#else
-	extern uint8_t illinst;
-#endif
-	extern uint8_t fpfault;
-#endif
-
-#if defined(M68060)
-	if (cputype == CPU_68060) {
-#if defined(M060SP)
-		/* integer support */
-		vectab[61] = &I_CALL_TOP[128 + 0x00];
-
-		/* floating point support */
-		vectab[11] = &FP_CALL_TOP[128 + 0x30];
-		vectab[55] = &FP_CALL_TOP[128 + 0x38];
-		vectab[60] = &FP_CALL_TOP[128 + 0x40];
-
-		vectab[54] = &FP_CALL_TOP[128 + 0x00];
-		vectab[52] = &FP_CALL_TOP[128 + 0x08];
-

CVS commit: src/sys/arch/virt68k

2024-01-13 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan 13 17:10:58 UTC 2024

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

Log Message:
Switch to common m68k vector table.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/include/vectors.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/virt68k/virt68k/machdep.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/virt68k/virt68k/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/virt68k/dev

2024-01-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 12 06:23:20 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: gfrtc_mainbus.c

Log Message:
The interrupt handler needs to clear the interrupt condition
before re-arming the timer. Otherwise the timer could expire
again before clearing the interrupt, the interrupt gets lost
and the clock stops.

On real hardware that could only occur if the timer interval
is extremely short or if there is a higher-than-clock interrupt
that delays processing. In the emulated world however, time
can progress non-continously and this happens often under load.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/gfrtc_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/virt68k/dev/gfrtc_mainbus.c
diff -u src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.1 src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.2
--- src/sys/arch/virt68k/dev/gfrtc_mainbus.c:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/dev/gfrtc_mainbus.c	Fri Jan 12 06:23:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gfrtc_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $	*/
+/*	$NetBSD: gfrtc_mainbus.c,v 1.2 2024/01/12 06:23:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2023, 2024 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gfrtc_mainbus.c,v 1.1 2024/01/02 07:40:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gfrtc_mainbus.c,v 1.2 2024/01/12 06:23:20 mlelstv Exp $");
 
 #include 
 #include 
@@ -65,12 +65,12 @@ struct gfrtc_mainbus_softc {
 
 #define	CLOCK_HANDLER()			\
 do {	\
-	/* Get the next alarm set ASAP. */\
-	gfrtc_set_alarm(&sc->sc_gfrtc, sc->sc_interval_ns);		\
-	\
 	/* Clear the interrupt condition. */\
 	gfrtc_clear_interrupt(&sc->sc_gfrtc);\
 	\
+	/* Get the next alarm set ASAP. */\
+	gfrtc_set_alarm(&sc->sc_gfrtc, sc->sc_interval_ns);		\
+	\
 	/* Increment the counter and call the handler. */		\
 	sc->sc_evcnt->ev_count++;	\
 	sc->sc_handler((struct clockframe *)v);\



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

2024-01-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 12 06:23:20 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: gfrtc_mainbus.c

Log Message:
The interrupt handler needs to clear the interrupt condition
before re-arming the timer. Otherwise the timer could expire
again before clearing the interrupt, the interrupt gets lost
and the clock stops.

On real hardware that could only occur if the timer interval
is extremely short or if there is a higher-than-clock interrupt
that delays processing. In the emulated world however, time
can progress non-continously and this happens often under load.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/gfrtc_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/virt68k/virt68k

2024-01-09 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  9 14:24:08 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: locore.s machdep.c

Log Message:
Properly implement mm_md_physacc() and garbage-collect the now unused
"lowram" variable (hold-over from hp300 lineage).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.5 src/sys/arch/virt68k/virt68k/locore.s:1.6
--- src/sys/arch/virt68k/virt68k/locore.s:1.5	Tue Jan  9 07:28:26 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Tue Jan  9 14:24:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.5 2024/01/09 07:28:26 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.6 2024/01/09 14:24:08 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -83,7 +83,6 @@ ASLOCAL(tmpstk)
 #define	RELOC(var, ar)		_RELOC(_C_LABEL(var), ar)
 #define	ASRELOC(var, ar)	_RELOC(_ASM_LABEL(var), ar)
 
-BSS(lowram,4)
 BSS(esym,4)
 
 	.globl	_C_LABEL(edata)
@@ -113,9 +112,6 @@ ASENTRY_NOPROFILE(start)
 1:	clrl	%a0@+
 	dbra	%d0,1b
 
-	RELOC(lowram, %a0)
-	movl	%a5,%a0@		| store start of physical memory
-
 	/*
 	 * Qemu does not pass us the symbols, so leave esym alone.
 	 * The bootinfo immediately follows the kernel.  Go parse

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.6 src/sys/arch/virt68k/virt68k/machdep.c:1.7
--- src/sys/arch/virt68k/virt68k/machdep.c:1.6	Mon Jan  8 05:10:51 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Tue Jan  9 14:24:08 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.7 2024/01/09 14:24:08 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -113,7 +113,6 @@ paddr_t msgbufpa;		/* PA of message buff
 
 // int	maxmem;			/* max memory per process */
 
-extern	u_int lowram;
 extern	short exframesize[];
 
 /* prototypes for local functions */ 
@@ -902,6 +901,18 @@ const uint16_t ipl2psl_table[NIPL] = {
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
+	psize_t size;
+	int i;
 
-	return (pa < lowram || pa >= 0xfffc) ? EFAULT : 0;
+	for (i = 0; i < bootinfo_mem_nsegments; i++) {
+		if (pa < bootinfo_mem_segments[i].mem_addr) {
+			continue;
+		}
+		size = trunc_page(bootinfo_mem_segments[i].mem_size);
+		if (pa >= bootinfo_mem_segments[i].mem_addr + size) {
+			continue;
+		}
+		return 0;
+	}
+	return EFAULT;
 }



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-09 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  9 14:24:08 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: locore.s machdep.c

Log Message:
Properly implement mm_md_physacc() and garbage-collect the now unused
"lowram" variable (hold-over from hp300 lineage).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/virt68k/virt68k/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/virt68k/conf

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:11:54 UTC 2024

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

Log Message:
Add PROCFS and MSDOSFS.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/GENERIC

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



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

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:11:54 UTC 2024

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

Log Message:
Add PROCFS and MSDOSFS.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.3 src/sys/arch/virt68k/conf/GENERIC:1.4
--- src/sys/arch/virt68k/conf/GENERIC:1.3	Tue Jan  2 18:11:44 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Mon Jan  8 05:11:54 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.3 2024/01/02 18:11:44 thorpej Exp $
+# $NetBSD: GENERIC,v 1.4 2024/01/08 05:11:54 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.3 $"
+#ident 		"GENERIC-$Revision: 1.4 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -60,9 +60,10 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 file-system 	FFS
 file-system 	NFS
 file-system 	KERNFS
+file-system 	PROCFS
 #file-system 	MFS
 file-system 	CD9660
-#file-system	MSDOSFS
+file-system	MSDOSFS
 #file-system	UNION
 file-system	PTYFS		# /dev/pts/N support
 file-system	TMPFS		# Efficient memory file-system



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:11:33 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: clock.c

Log Message:
Use aprint_error() rather than a bare printf() in a few spots, and
an aprint_normal() in some others.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/clock.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/virt68k/virt68k/clock.c
diff -u src/sys/arch/virt68k/virt68k/clock.c:1.1 src/sys/arch/virt68k/virt68k/clock.c:1.2
--- src/sys/arch/virt68k/virt68k/clock.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/clock.c	Mon Jan  8 05:11:32 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: clock.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*  $NetBSD: clock.c,v 1.2 2024/01/08 05:11:32 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.2 2024/01/08 05:11:32 thorpej Exp $");
 
 #include 
 #include 
@@ -174,20 +174,20 @@ cpu_initclocks(void)
 	}
 
 	if (100 % hz) {
-		printf("Cannot get %d Hz clock; using 100 Hz\n", hz);
+		aprint_error("Cannot get %d Hz clock; using 100 Hz\n", hz);
 		hz = 100;
 		tick = 100 / hz;
 	}
 
 	if (virt68k_clocks[CLOCK_STATCLOCK].args == NULL) {
-		printf("No statclock; using hardclock.\n");
+		aprint_normal("No statclock; using hardclock.\n");
 		stathz = 0;
 		statint = 0;
 	} else if (stathz == 0) {
 		stathz = hz;
 		if (100 % stathz) {
-			printf("Cannot get %d Hz statclock; using 100 Hz\n",
-			stathz);
+			aprint_error("Cannot get %d Hz statclock; "
+ "using 100 Hz\n", stathz);
 			stathz = 100;
 		}
 		profhz = stathz;	/* always */



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:11:33 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: clock.c

Log Message:
Use aprint_error() rather than a bare printf() in a few spots, and
an aprint_normal() in some others.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/clock.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/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:10:51 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: autoconf.c machdep.c

Log Message:
Accept "root=xxx" for the root device and "flags=xxx" as the boothowto
flags from the kernel command line arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.4 src/sys/arch/virt68k/virt68k/autoconf.c:1.5
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.4	Sun Jan  7 16:41:24 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Mon Jan  8 05:10:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.5 2024/01/08 05:10:51 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2024/01/08 05:10:51 thorpej Exp $");
 
 #include 
 #include 
@@ -96,6 +96,26 @@ void
 device_register(device_t dev, void *aux)
 {
 	device_t parent = device_parent(dev);
+	char rootname[DEVICE_XNAME_SIZE];
+	bool rootname_valid = false;
+
+	if (booted_device == NULL) {
+		rootname_valid = bootinfo_getarg("root",
+		rootname, sizeof(rootname));
+		if (rootname_valid) {
+			size_t len = strlen(rootname);
+			while (len) {
+len--;
+if (isdigit(rootname[len])) {
+	break;
+}
+rootname[len] = '\0';
+			}
+			if (strcmp(device_xname(dev), rootname) == 0) {
+booted_device = dev;
+			}
+		}
+	}
 
 	if (device_is_a(parent, "mainbus")) {
 		struct mainbus_attach_args *ma = aux;

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.5 src/sys/arch/virt68k/virt68k/machdep.c:1.6
--- src/sys/arch/virt68k/virt68k/machdep.c:1.5	Sat Jan  6 21:43:37 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Mon Jan  8 05:10:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.5 2024/01/06 21:43:37 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2024/01/06 21:43:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.6 2024/01/08 05:10:51 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include "ksyms.h"
 
@@ -100,8 +101,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #endif
 
-#define	MAXMEM	64*1024	/* XXX - from cmap.h */
-
 /* the following is used externally (sysctl_hw) */
 char	machine[] = MACHINE;	/* from  */
 
@@ -207,6 +206,17 @@ virt68k_init(void)
 
 	/* Check for RND seed from the loader. */
 	bootinfo_setup_rndseed();
+
+	char flags[32];
+	if (bootinfo_getarg("flags", flags, sizeof(flags))) {
+		for (const char *cp = flags; *cp != '\0'; cp++) {
+			/* Consume 'm' in favor of BI_RAMDISK. */
+			if (*cp == 'm') {
+continue;
+			}
+			BOOT_FLAG(*cp, boothowto);
+		}
+	}
 }
 
 /*



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:10:51 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: autoconf.c machdep.c

Log Message:
Accept "root=xxx" for the root device and "flags=xxx" as the boothowto
flags from the kernel command line arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/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/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:09:41 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Add bootinfo_getarg(), which gets the name kernel command line argument
and returns its value (sort of like getenv()).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  8 05:09:41 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Add bootinfo_getarg(), which gets the name kernel command line argument
and returns its value (sort of like getenv()).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k/include/bootinfo.h
diff -u src/sys/arch/virt68k/include/bootinfo.h:1.4 src/sys/arch/virt68k/include/bootinfo.h:1.5
--- src/sys/arch/virt68k/include/bootinfo.h:1.4	Sat Jan  6 17:32:40 2024
+++ src/sys/arch/virt68k/include/bootinfo.h	Mon Jan  8 05:09:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.4 2024/01/06 17:32:40 thorpej Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.5 2024/01/08 05:09:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -156,6 +156,7 @@ bool			bootinfo_addr_is_console(paddr_t)
 
 void			bootinfo_setup_initrd(void);
 void			bootinfo_setup_rndseed(void);
+bool			bootinfo_getarg(const char *, char *, size_t);
 
 void			bootinfo_md_cnattach(void (*)(bus_space_tag_t,
 		  bus_space_handle_t),

Index: src/sys/arch/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.5 src/sys/arch/virt68k/virt68k/bootinfo.c:1.6
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.5	Sat Jan  6 21:40:41 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Mon Jan  8 05:09:41 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.5 2024/01/06 21:40:41 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.6 2024/01/08 05:09:41 thorpej Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.5 2024/01/06 21:40:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.6 2024/01/08 05:09:41 thorpej Exp $");
 
 #include "opt_md.h"
 
@@ -426,3 +426,49 @@ bootinfo_setup_rndseed(void)
 		explicit_memset(rnd->data_bytes, 0, rnd->data_length);
 	}
 }
+
+/*
+ * bootinfo_getarg --
+ *	Get an argument from the BI_COMMAND_LINE bootinfo record.
+ */
+bool
+bootinfo_getarg(const char *var, char *buf, size_t buflen)
+{
+	const size_t varlen = strlen(var);
+	struct bi_record *bi = bootinfo_find(BI_COMMAND_LINE);
+
+	if (bi == NULL) {
+		return false;
+	}
+
+	const char *sp = bootinfo_dataptr(bi);
+	const char *osp = sp;
+	for (;;) {
+		sp = strstr(sp, var);
+		if (sp == NULL) {
+			return false;
+		}
+
+		if (sp != osp &&
+		sp[-1] != ' ' && sp[-1] != '\t' && sp[-1] != '-') {
+			continue;
+		}
+		sp += varlen;
+		char ch = *sp++;
+		if (ch != '=' && ch != ' ' && ch != '\t' && ch != '\0') {
+			continue;
+		}
+		/* Found it. */
+		break;
+	}
+
+	while (--buflen) {
+		if (*sp == ' ' || *sp == '\t' || *sp == '\0') {
+			break;
+		}
+		*buf++ = *sp++;
+	}
+	*buf = '\0';
+
+	return true;
+}



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan  7 16:41:24 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: autoconf.c locore.s

Log Message:
Don't to go IPL0 right before calling main(), instead call spl0() at the
end of cpu_configure().  It seems that Qemu doesn't reset pending interrupts
correctly after a RESET request, which was causing an explosion when an
interrupt was delivered to the new kernel instance.  This change makes
reboot work.

Thx to mlelstv@ for figuring out what the problem was.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k

2024-01-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jan  7 16:41:24 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: autoconf.c locore.s

Log Message:
Don't to go IPL0 right before calling main(), instead call spl0() at the
end of cpu_configure().  It seems that Qemu doesn't reset pending interrupts
correctly after a RESET request, which was causing an explosion when an
interrupt was delivered to the new kernel instance.  This change makes
reboot work.

Thx to mlelstv@ for figuring out what the problem was.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.3 src/sys/arch/virt68k/virt68k/autoconf.c:1.4
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.3	Tue Jan  2 16:59:14 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Sun Jan  7 16:41:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2024/01/07 16:41:24 thorpej Exp $");
 
 #include 
 #include 
@@ -73,6 +73,14 @@ cpu_configure(void)
 
 	if (config_rootfound("mainbus", NULL) == NULL)
 		panic("autoconfig failed, no root");
+
+	/*
+	 * XXX Go ahead and enable interrupts now that we've configured
+	 * XXX everything.
+	 * XXX
+	 * XXX See locore.s, right before main() is called.
+	 */
+	spl0();
 }
 
 void

Index: src/sys/arch/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.2 src/sys/arch/virt68k/virt68k/locore.s:1.3
--- src/sys/arch/virt68k/virt68k/locore.s:1.2	Tue Jan  2 18:10:36 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Sun Jan  7 16:41:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.2 2024/01/02 18:10:36 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.3 2024/01/07 16:41:24 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -278,7 +278,14 @@ Lenab3:
  * later on.
  */
 	jbsr	_C_LABEL(virt68k_init)	| additional pre-main initialization
+#if 0
+	/*
+	 * XXX Don't do the spl0() here; when Qemu performs a reboot request,
+	 * XXX it seems to not clear pending interrupts, and so we blow up
+	 * XXX early when the new kernel starts up.
+	 */
 	movw	#PSL_LOWIPL,%sr		| lower SPL
+#endif
 	clrw	%sp@-			| vector offset/frame type
 	clrl	%sp@-			| PC - filled in by "execve"
 	movw	#PSL_USER,%sp@-		| in user mode



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

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 21:49:59 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: virtctrl.c

Log Message:
Fix dump paste-o.  Halt works properly.  Reboot does reboot, but the
new kernel instance crashes early.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtctrl.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/virt68k/dev/virtctrl.c
diff -u src/sys/arch/virt68k/dev/virtctrl.c:1.1 src/sys/arch/virt68k/dev/virtctrl.c:1.2
--- src/sys/arch/virt68k/dev/virtctrl.c:1.1	Tue Jan  2 18:11:44 2024
+++ src/sys/arch/virt68k/dev/virtctrl.c	Sat Jan  6 21:49:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtctrl.c,v 1.1 2024/01/02 18:11:44 thorpej Exp $	*/
+/*	$NetBSD: virtctrl.c,v 1.2 2024/01/06 21:49:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2024 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtctrl.c,v 1.1 2024/01/02 18:11:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtctrl.c,v 1.2 2024/01/06 21:49:59 thorpej Exp $");
 
 #include 
 #include 
@@ -64,7 +64,7 @@ static const struct device_compatible_en
 #define	REG_READ(sc, r)		\
 	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (r))
 #define	REG_WRITE(sc, r, v)	\
-	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (r))
+	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (r), (v))
 
 static void
 virtctrl_reset_handler(void *v, int howto)



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

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 21:49:59 UTC 2024

Modified Files:
src/sys/arch/virt68k/dev: virtctrl.c

Log Message:
Fix dump paste-o.  Halt works properly.  Reboot does reboot, but the
new kernel instance crashes early.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/dev/virtctrl.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/virt68k/virt68k

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 21:43:37 UTC 2024

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

Log Message:
Fix stupid typo in cpu_set_reset_func().


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.4 src/sys/arch/virt68k/virt68k/machdep.c:1.5
--- src/sys/arch/virt68k/virt68k/machdep.c:1.4	Sat Jan  6 17:32:41 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Sat Jan  6 21:43:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.5 2024/01/06 21:43:37 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.5 2024/01/06 21:43:37 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -429,7 +429,7 @@ void
 cpu_set_reset_func(void (*func)(void *, int), void *arg)
 {
 	if (cpu_reset_func == NULL) {
-		cpu_reset_func = cpu_reset_func;
+		cpu_reset_func = func;
 		cpu_reset_func_arg = arg;
 	}
 }



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 21:43:37 UTC 2024

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

Log Message:
Fix stupid typo in cpu_set_reset_func().


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

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

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Implement bootinfo_setup_rndseed().  Thx Riastradh@ for the suggestion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.4 src/sys/arch/virt68k/virt68k/bootinfo.c:1.5
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.4	Sat Jan  6 17:32:41 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Sat Jan  6 21:40:41 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.5 2024/01/06 21:40:41 thorpej Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,13 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.5 2024/01/06 21:40:41 thorpej Exp $");
 
 #include "opt_md.h"
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -413,14 +414,15 @@ bootinfo_setup_initrd(void)
 void
 bootinfo_setup_rndseed(void)
 {
+	static struct krndsource bootinfo_rndsource;
 	struct bi_record *bi = bootinfo_find(BI_RNG_SEED);
 	if (bi != NULL) {
 		struct bi_data *rnd = bootinfo_dataptr(bi);
-#if 0 /* XXX */
-		rnd_seed(rnd->data_bytes, rnd->data_length);
-#else
-		printf("WARNING: ignored %u bytes of RND_SEED data @ %p\n",
-		rnd->data_length, rnd->data_bytes);
-#endif
+		rnd_attach_source(&bootinfo_rndsource, "bootinfo",
+		RND_TYPE_RNG, RND_FLAG_DEFAULT);
+		rnd_add_data(&bootinfo_rndsource,
+		rnd->data_bytes, rnd->data_length,
+		rnd->data_length * NBBY);
+		explicit_memset(rnd->data_bytes, 0, rnd->data_length);
 	}
 }



CVS commit: src/sys/arch/virt68k/virt68k

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

Modified Files:
src/sys/arch/virt68k/virt68k: bootinfo.c

Log Message:
Implement bootinfo_setup_rndseed().  Thx Riastradh@ for the suggestion.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 17:32:41 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h vmparam.h
src/sys/arch/virt68k/virt68k: bootinfo.c machdep.c

Log Message:
The RAM disk specified by bootinfo is not necessarily loaded along with
the static kernel image.  Map is separately and account for it in the
available memory segments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/vmparam.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/bootinfo.c \
src/sys/arch/virt68k/virt68k/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/virt68k/include/bootinfo.h
diff -u src/sys/arch/virt68k/include/bootinfo.h:1.3 src/sys/arch/virt68k/include/bootinfo.h:1.4
--- src/sys/arch/virt68k/include/bootinfo.h:1.3	Tue Jan  2 17:13:03 2024
+++ src/sys/arch/virt68k/include/bootinfo.h	Sat Jan  6 17:32:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.3 2024/01/02 17:13:03 thorpej Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.4 2024/01/06 17:32:40 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -142,6 +142,7 @@ extern size_t	bootinfo_mem_segments_igno
 extern struct bi_mem_info bootinfo_mem_segments[];
 extern struct bi_mem_info bootinfo_mem_segments_avail[];
 extern int	bootinfo_mem_nsegments;
+extern int	bootinfo_mem_nsegments_avail;
 extern vaddr_t	bootinfo_end;
 
 #define	bootinfo_dataptr(bi)	((void *)&(bi)->bi_data[0])

Index: src/sys/arch/virt68k/include/vmparam.h
diff -u src/sys/arch/virt68k/include/vmparam.h:1.1 src/sys/arch/virt68k/include/vmparam.h:1.2
--- src/sys/arch/virt68k/include/vmparam.h:1.1	Tue Jan  2 07:41:01 2024
+++ src/sys/arch/virt68k/include/vmparam.h	Sat Jan  6 17:32:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.1 2024/01/02 07:41:01 thorpej Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.2 2024/01/06 17:32:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -115,10 +115,15 @@
 
 /*
  * Constants which control the way the VM system deals with memory segments.
- * The Qemu virt68k platform only has a single memory segment.
+ *
+ * We generally assume there's just a single real memory segment on this
+ * platform, but we need to be able to deal with a "hole" left by a RAM
+ * disk if the loader provided one.  We optimize for the loader either
+ * plopping the RAM disk immediately after the kernel image or at the end
+ * of RAM, which would still leave us with a single large segment.
  */
-#define	VM_PHYSSEG_MAX		1
-#define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
+#define	VM_PHYSSEG_MAX		4
+#define	VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 
 #define	VM_NFREELIST		1
 #define	VM_FREELIST_DEFAULT	0

Index: src/sys/arch/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.3 src/sys/arch/virt68k/virt68k/bootinfo.c:1.4
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.3	Tue Jan  2 17:13:03 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Sat Jan  6 17:32:41 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.3 2024/01/02 17:13:03 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.3 2024/01/02 17:13:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.4 2024/01/06 17:32:41 thorpej Exp $");
 
 #include "opt_md.h"
 
@@ -38,6 +38,8 @@ __KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v
 #include 
 #include 
 
+#include 
+
 #ifdef MEMORY_DISK_DYNAMIC
 #include 
 #endif
@@ -58,10 +60,14 @@ size_t			bootinfo_mem_segments_ignored_b
 struct bi_mem_info	bootinfo_mem_segments[VM_PHYSSEG_MAX];
 struct bi_mem_info	bootinfo_mem_segments_avail[VM_PHYSSEG_MAX];
 int			bootinfo_mem_nsegments;
+int			bootinfo_mem_nsegments_avail;
 
 static paddr_t		bootinfo_console_addr;
 static bool		bootinfo_console_addr_valid;
 
+static uint32_t		bootinfo_initrd_start;
+static uint32_t		bootinfo_initrd_size;
+
 static bool
 bootinfo_set_console(paddr_t pa)
 {
@@ -141,9 +147,79 @@ bootinfo_add_mem(struct bi_record *bi)
 	m->mem_size = m68k_trunc_page(m->mem_size);
 	physmem += m->mem_size >> PGSHIFT;
 
-	bootinfo_mem_segments[bootinfo_mem_nsegments] = *m;
-	bootinfo_mem_segments_avail[bootinfo_mem_nsegments] = *m;
-	bootinfo_mem_nsegments++;
+	bootinfo_mem_segments[bootinfo_mem_nsegments++] = *m;
+	bootinfo_mem_segments_avail[bootinfo_mem_nsegments_avail++] = *m;
+}
+
+static inline void
+bootinfo_add_initrd(struct bi_record *bi)
+{
+	struct bi_mem_info *rd = bootinfo_dataptr(bi);
+
+	if (bootinfo_initrd_size == 0) {
+		bootinfo_initrd_start = rd->mem_addr;
+		bootinfo_initrd_size  = rd->mem_size;
+	}
+}
+
+static inline void
+bootinfo_reserve_initrd(void)
+{
+	if (bootinfo_initrd_size == 0) {
+		return;
+	

CVS commit: src/sys/arch/virt68k

2024-01-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jan  6 17:32:41 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h vmparam.h
src/sys/arch/virt68k/virt68k: bootinfo.c machdep.c

Log Message:
The RAM disk specified by bootinfo is not necessarily loaded along with
the static kernel image.  Map is separately and account for it in the
available memory segments.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/vmparam.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/bootinfo.c \
src/sys/arch/virt68k/virt68k/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/virt68k/conf

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan  3 03:56:57 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: majors.virt68k

Log Message:
Add gftty at char 12.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/majors.virt68k

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/virt68k/conf/majors.virt68k
diff -u src/sys/arch/virt68k/conf/majors.virt68k:1.1 src/sys/arch/virt68k/conf/majors.virt68k:1.2
--- src/sys/arch/virt68k/conf/majors.virt68k:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/conf/majors.virt68k	Wed Jan  3 03:56:57 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.virt68k,v 1.1 2024/01/02 07:40:59 thorpej Exp $
+#	$NetBSD: majors.virt68k,v 1.2 2024/01/03 03:56:57 thorpej Exp $
 #
 # Device majors for virt68k
 # Aligns with historical values on mvme68k (and some slots also used
@@ -16,6 +16,8 @@ device-major	ipl		char 7			ipfilter
 device-major	sd		char 8   block 4	sd
 device-major	ld		char 9   block 2	ld
 
+device-major	gftty		char 12
+
 device-major	ccd		char 17  block 5	ccd
 device-major	cd		char 18  block 8	cd
 device-major	vnd		char 19  block 6	vnd



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

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Jan  3 03:56:57 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: majors.virt68k

Log Message:
Add gftty at char 12.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/majors.virt68k

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



CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 18:11:44 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: GENERIC files.virt68k
Added Files:
src/sys/arch/virt68k/dev: virtctrl.c

Log Message:
Add a driver for the Qemu Virtual System Controller that can be used
to halt or reset the system.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/dev/virtctrl.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/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.2 src/sys/arch/virt68k/conf/GENERIC:1.3
--- src/sys/arch/virt68k/conf/GENERIC:1.2	Tue Jan  2 07:47:36 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Tue Jan  2 18:11:44 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.2 2024/01/02 07:47:36 thorpej Exp $
+# $NetBSD: GENERIC,v 1.3 2024/01/02 18:11:44 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.2 $"
+#ident 		"GENERIC-$Revision: 1.3 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -155,6 +155,9 @@ gfpic*		at mainbus? addr ?	# interrupt c
 gftty*		at mainbus? addr ?	# console terminal
 gfrtc*		at mainbus? addr ?	# real-time clock / timer
 
+# Qemu Virtual System Controller
+virtctrl*	at mainbus? addr ?
+
 # VirtIO devices
 virtio*		at mainbus? addr ?	# VirtIO nexus
 ld*		at virtio?		# VirtIO disk device

Index: src/sys/arch/virt68k/conf/files.virt68k
diff -u src/sys/arch/virt68k/conf/files.virt68k:1.1 src/sys/arch/virt68k/conf/files.virt68k:1.2
--- src/sys/arch/virt68k/conf/files.virt68k:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/conf/files.virt68k	Tue Jan  2 18:11:44 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.virt68k,v 1.1 2024/01/02 07:40:59 thorpej Exp $
+#	$NetBSD: files.virt68k,v 1.2 2024/01/02 18:11:44 thorpej Exp $
 
 # config file for virt68k
 
@@ -26,6 +26,10 @@ file arch/virt68k/dev/gfrtc_mainbus.c		g
 attach virtio at mainbus with virtio_mainbus: virtio_mmio
 file arch/virt68k/dev/virtio_mainbus.c		virtio_mainbus
 
+device virtctrl
+attach virtctrl at mainbus
+file arch/virt68k/dev/virtctrl.c		virtctrl
+
 # Memory disk for installer
 file dev/md_root.cmemory_disk_hooks
 

Added files:

Index: src/sys/arch/virt68k/dev/virtctrl.c
diff -u /dev/null src/sys/arch/virt68k/dev/virtctrl.c:1.1
--- /dev/null	Tue Jan  2 18:11:44 2024
+++ src/sys/arch/virt68k/dev/virtctrl.c	Tue Jan  2 18:11:44 2024
@@ -0,0 +1,120 @@
+/*	$NetBSD: virtctrl.c,v 1.1 2024/01/02 18:11:44 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2024 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: virtctrl.c,v 1.1 2024/01/02 18:11:44 thorpej Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+struct virtctrl_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+};
+
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "netbsd,qemu-virt-ctrl" },
+	DEVICE_COMPAT_EOL
+};
+
+#define	VIRTCTRL_REG_FEATURES	0x00
+#define	VIRTCTRL_REG_CMD	0x04
+
+#define	CMD_NOP			0
+#define	CMD_RESET		1
+#define	CMD_HALT		2
+#define	CMD_PANIC		3
+
+#define	REG_READ(sc, r)		\
+	bus_space_read_4((sc)->sc_bst, (sc)->sc_

CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 18:11:44 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: GENERIC files.virt68k
Added Files:
src/sys/arch/virt68k/dev: virtctrl.c

Log Message:
Add a driver for the Qemu Virtual System Controller that can be used
to halt or reset the system.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/conf/GENERIC
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/files.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/dev/virtctrl.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/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 18:10:36 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: cpu.h
src/sys/arch/virt68k/virt68k: locore.s machdep.c

Log Message:
Provide a mechanism for a system reset controller to register to be used
to reset/halt the system.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/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/virt68k/include/cpu.h
diff -u src/sys/arch/virt68k/include/cpu.h:1.2 src/sys/arch/virt68k/include/cpu.h:1.3
--- src/sys/arch/virt68k/include/cpu.h:1.2	Tue Jan  2 17:16:27 2024
+++ src/sys/arch/virt68k/include/cpu.h	Tue Jan  2 18:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.2 2024/01/02 17:16:27 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.3 2024/01/02 18:10:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -110,8 +110,7 @@ extern int astpending;		/* need to trap 
 #endif /* _KERNEL */
 
 #ifdef _KERNEL
-void	doboot(int) 
-	__attribute__((__noreturn__));
+void	cpu_set_reset_func(void (*)(void *, int), void *);
 int	nmihand(void *);
 void	loadustp(paddr_t);
 

Index: src/sys/arch/virt68k/virt68k/locore.s
diff -u src/sys/arch/virt68k/virt68k/locore.s:1.1 src/sys/arch/virt68k/virt68k/locore.s:1.2
--- src/sys/arch/virt68k/virt68k/locore.s:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/locore.s	Tue Jan  2 18:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.2 2024/01/02 18:10:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -694,13 +694,6 @@ ENTRY(getsr)
 	rts
 
 /*
- * Handle the nitty-gritty of rebooting the machine.
- */
-ENTRY_NOPROFILE(doboot)
-	movw	#PSL_HIGHIPL,%sr
-1:	jra	1b			| XXX
-
-/*
  * Misc. global variables.
  */
 	.data

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.2 src/sys/arch/virt68k/virt68k/machdep.c:1.3
--- src/sys/arch/virt68k/virt68k/machdep.c:1.2	Tue Jan  2 17:13:03 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Tue Jan  2 18:10:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.2 2024/01/02 17:13:03 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.3 2024/01/02 18:10:36 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2024/01/02 17:13:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.3 2024/01/02 18:10:36 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -422,6 +422,18 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 
 int	waittime = -1;
 
+static void (*cpu_reset_func)(void *, int);
+static void *cpu_reset_func_arg;
+
+void
+cpu_set_reset_func(void (*func)(void *, int), void *arg)
+{
+	if (cpu_reset_func == NULL) {
+		cpu_reset_func = cpu_reset_func;
+		cpu_reset_func_arg = arg;
+	}
+}
+
 void
 cpu_reboot(int howto, char *bootstr)
 {
@@ -471,17 +483,29 @@ cpu_reboot(int howto, char *bootstr)
 	}
 #endif
 
+	if (cpu_reset_func == NULL) {
+		printf("WARNING: No reset handler, holding here.\n\n");
+		for (;;) {
+			/* spin forever. */
+		}
+	}
+
 	/* Finally, halt/reboot the system. */
 	if (howto & RB_HALT) {
 		printf("halted\n\n");
-		doboot(RB_HALT);
+		(*cpu_reset_func)(cpu_reset_func_arg, RB_HALT);
+		/* NOTREACHED */
+	} else {
+		printf("rebooting...\n");
+		delay(100);
+		(*cpu_reset_func)(cpu_reset_func_arg, RB_AUTOBOOT);
 		/* NOTREACHED */
 	}
-
-	printf("rebooting...\n");
-	delay(100);
-	doboot(RB_AUTOBOOT);
-	/*NOTREACHED*/
+	/* ...but just in case it is... */
+	printf("WARNING: System reset handler failed, holding here.\n\n");
+	for (;;) {
+		/* spin forever. */
+	}
 }
 
 /*



CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 18:10:36 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: cpu.h
src/sys/arch/virt68k/virt68k: locore.s machdep.c

Log Message:
Provide a mechanism for a system reset controller to register to be used
to reset/halt the system.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/include/cpu.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/locore.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/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/virt68k/include

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 17:16:27 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: cpu.h

Log Message:
Collect some garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/cpu.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/virt68k/include

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 17:16:27 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: cpu.h

Log Message:
Collect some garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/cpu.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/virt68k/include/cpu.h
diff -u src/sys/arch/virt68k/include/cpu.h:1.1 src/sys/arch/virt68k/include/cpu.h:1.2
--- src/sys/arch/virt68k/include/cpu.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/cpu.h	Tue Jan  2 17:16:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: cpu.h,v 1.2 2024/01/02 17:16:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -110,14 +110,9 @@ extern int astpending;		/* need to trap 
 #endif /* _KERNEL */
 
 #ifdef _KERNEL
-extern	int cpuspeed;
-extern	char *intiobase, *intiolimit;
-
 void	doboot(int) 
 	__attribute__((__noreturn__));
 int	nmihand(void *);
-void	*iomap(u_long, size_t);
-void	iounmap(void *, size_t);
 void	loadustp(paddr_t);
 
 #endif /* _KERNEL */



CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 17:13:03 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: bootinfo.c machdep.c

Log Message:
Detect a RND seed passed in by the loader.
XXX We don't actually *do* anything with it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/bootinfo.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/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/virt68k/include/bootinfo.h
diff -u src/sys/arch/virt68k/include/bootinfo.h:1.2 src/sys/arch/virt68k/include/bootinfo.h:1.3
--- src/sys/arch/virt68k/include/bootinfo.h:1.2	Tue Jan  2 16:59:14 2024
+++ src/sys/arch/virt68k/include/bootinfo.h	Tue Jan  2 17:13:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.2 2024/01/02 16:59:14 thorpej Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.3 2024/01/02 17:13:03 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -154,6 +154,7 @@ void			bootinfo_enumerate(bool (*)(struc
 bool			bootinfo_addr_is_console(paddr_t);
 
 void			bootinfo_setup_initrd(void);
+void			bootinfo_setup_rndseed(void);
 
 void			bootinfo_md_cnattach(void (*)(bus_space_tag_t,
 		  bus_space_handle_t),

Index: src/sys/arch/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.2 src/sys/arch/virt68k/virt68k/bootinfo.c:1.3
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.2	Tue Jan  2 16:59:14 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Tue Jan  2 17:13:03 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.2 2024/01/02 16:59:14 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.3 2024/01/02 17:13:03 thorpej Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.2 2024/01/02 16:59:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.3 2024/01/02 17:13:03 thorpej Exp $");
 
 #include "opt_md.h"
 
 #include 
 #include 
+#include 
 
 #ifdef MEMORY_DISK_DYNAMIC
 #include 
@@ -293,3 +294,23 @@ bootinfo_setup_initrd(void)
 	}
 #endif /* MEMORY_DISK_DYNAMIC */
 }
+
+/*
+ * bootinfo_setup_rndseed --
+ *	Check for a BI_RNG_SEED record and, if found, use it to
+ *	seed the kenrnel entropy pool.
+ */
+void
+bootinfo_setup_rndseed(void)
+{
+	struct bi_record *bi = bootinfo_find(BI_RNG_SEED);
+	if (bi != NULL) {
+		struct bi_data *rnd = bootinfo_dataptr(bi);
+#if 0 /* XXX */
+		rnd_seed(rnd->data_bytes, rnd->data_length);
+#else
+		printf("WARNING: ignored %u bytes of RND_SEED data @ %p\n",
+		rnd->data_length, rnd->data_bytes);
+#endif
+	}
+}

Index: src/sys/arch/virt68k/virt68k/machdep.c
diff -u src/sys/arch/virt68k/virt68k/machdep.c:1.1 src/sys/arch/virt68k/virt68k/machdep.c:1.2
--- src/sys/arch/virt68k/virt68k/machdep.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/machdep.c	Tue Jan  2 17:13:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.2 2024/01/02 17:13:03 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.2 2024/01/02 17:13:03 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_m060sp.h"
@@ -204,6 +204,9 @@ virt68k_init(void)
 	}
 	initmsgbuf(msgbufaddr, round_page(MSGBUFSIZE));
 	pmap_update(pmap_kernel());
+
+	/* Check for RND seed from the loader. */
+	bootinfo_setup_rndseed();
 }
 
 /*



CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 17:13:03 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: bootinfo.c machdep.c

Log Message:
Detect a RND seed passed in by the loader.
XXX We don't actually *do* anything with it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/bootinfo.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/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/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 16:59:14 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: autoconf.c bootinfo.c

Log Message:
Move the initrd setup into bootinfo.c


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 16:59:14 UTC 2024

Modified Files:
src/sys/arch/virt68k/include: bootinfo.h
src/sys/arch/virt68k/virt68k: autoconf.c bootinfo.c

Log Message:
Move the initrd setup into bootinfo.c


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/include/bootinfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/bootinfo.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/virt68k/include/bootinfo.h
diff -u src/sys/arch/virt68k/include/bootinfo.h:1.1 src/sys/arch/virt68k/include/bootinfo.h:1.2
--- src/sys/arch/virt68k/include/bootinfo.h:1.1	Tue Jan  2 07:41:00 2024
+++ src/sys/arch/virt68k/include/bootinfo.h	Tue Jan  2 16:59:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.1 2024/01/02 07:41:00 thorpej Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.2 2024/01/02 16:59:14 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -153,6 +153,8 @@ void			bootinfo_enumerate(bool (*)(struc
 	   void *);
 bool			bootinfo_addr_is_console(paddr_t);
 
+void			bootinfo_setup_initrd(void);
+
 void			bootinfo_md_cnattach(void (*)(bus_space_tag_t,
 		  bus_space_handle_t),
 	 paddr_t, psize_t);

Index: src/sys/arch/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.2 src/sys/arch/virt68k/virt68k/autoconf.c:1.3
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.2	Tue Jan  2 16:48:01 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Tue Jan  2 16:59:14 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,9 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $");
-
-#include "opt_md.h"
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2024/01/02 16:59:14 thorpej Exp $");
 
 #include 
 #include 
@@ -56,10 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include 
 #include 
 
-#ifdef MEMORY_DISK_DYNAMIC
-#include 
-#endif
-
 #include 
 #include 
 
@@ -84,21 +78,7 @@ cpu_configure(void)
 void
 cpu_rootconf(void)
 {
-#ifdef MEMORY_DISK_DYNAMIC
-	struct bi_record *bi;
-
-	/*
-	 * Look for a RAMDISK bootinfo record.  If we have one,
-	 * hook is up to the memory disk and set it as the root
-	 * file system.
-	 */
-	bi = bootinfo_find(BI_RAMDISK);
-	if (bi != NULL) {
-		struct bi_mem_info *rd = bootinfo_dataptr(bi);
-		md_root_setconf((void *)rd->mem_addr, rd->mem_size);
-	}
-#endif /* MEMORY_DISK_DYNAMIC */
-
+	bootinfo_setup_initrd();
 	rootconf();
 }
 

Index: src/sys/arch/virt68k/virt68k/bootinfo.c
diff -u src/sys/arch/virt68k/virt68k/bootinfo.c:1.1 src/sys/arch/virt68k/virt68k/bootinfo.c:1.2
--- src/sys/arch/virt68k/virt68k/bootinfo.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/bootinfo.c	Tue Jan  2 16:59:14 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: bootinfo.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $*/  
+/*  $NetBSD: bootinfo.c,v 1.2 2024/01/02 16:59:14 thorpej Exp $*/  
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,11 +30,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootinfo.c,v 1.2 2024/01/02 16:59:14 thorpej Exp $");
+
+#include "opt_md.h"
 
 #include 
 #include 
 
+#ifdef MEMORY_DISK_DYNAMIC
+#include 
+#endif
+
 #include 
 #include 
 
@@ -270,3 +276,20 @@ bootinfo_addr_is_console(paddr_t pa)
 {
 	return bootinfo_console_addr_valid && bootinfo_console_addr == pa;
 }
+
+/*
+ * bootinfo_setup_initrd --
+ *	Check for a BI_RAMDISK record and, if found, set it as
+ *	the root file system.
+ */
+void
+bootinfo_setup_initrd(void)
+{
+#ifdef MEMORY_DISK_DYNAMIC
+	struct bi_record *bi = bootinfo_find(BI_RAMDISK);
+	if (bi != NULL) {
+		struct bi_mem_info *rd = bootinfo_dataptr(bi);
+		md_root_setconf((void *)rd->mem_addr, rd->mem_size);
+	}
+#endif /* MEMORY_DISK_DYNAMIC */
+}



CVS commit: src/sys/arch/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 16:48:02 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: std.virt68k
src/sys/arch/virt68k/virt68k: autoconf.c

Log Message:
If the loader passed us a RAM disk, use it as the root file system.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/std.virt68k
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/autoconf.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/virt68k

2024-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 16:48:02 UTC 2024

Modified Files:
src/sys/arch/virt68k/conf: std.virt68k
src/sys/arch/virt68k/virt68k: autoconf.c

Log Message:
If the loader passed us a RAM disk, use it as the root file system.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/std.virt68k
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/autoconf.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/virt68k/conf/std.virt68k
diff -u src/sys/arch/virt68k/conf/std.virt68k:1.1 src/sys/arch/virt68k/conf/std.virt68k:1.2
--- src/sys/arch/virt68k/conf/std.virt68k:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/conf/std.virt68k	Tue Jan  2 16:48:01 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: std.virt68k,v 1.1 2024/01/02 07:40:59 thorpej Exp $
+#	$NetBSD: std.virt68k,v 1.2 2024/01/02 16:48:01 thorpej Exp $
 #
 # Options/devices that all virt68ks should have
 #
@@ -8,3 +8,8 @@ include		"conf/std"			# MI standard opti
 include		"arch/m68k/conf/std.m68k"	# m68k standard options
 
 options 	EXEC_AOUT	# support for exec'ing a.out
+
+# initrd support
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_DYNAMIC
+pseudo-device	md

Index: src/sys/arch/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.1 src/sys/arch/virt68k/virt68k/autoconf.c:1.2
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Tue Jan  2 16:48:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $");
+
+#include "opt_md.h"
 
 #include 
 #include 
@@ -54,6 +56,11 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include 
 #include 
 
+#ifdef MEMORY_DISK_DYNAMIC
+#include 
+#endif
+
+#include 
 #include 
 
 #include 
@@ -77,7 +84,21 @@ cpu_configure(void)
 void
 cpu_rootconf(void)
 {
-	/* XXX handle RAM disk on kernel command line. */
+#ifdef MEMORY_DISK_DYNAMIC
+	struct bi_record *bi;
+
+	/*
+	 * Look for a RAMDISK bootinfo record.  If we have one,
+	 * hook is up to the memory disk and set it as the root
+	 * file system.
+	 */
+	bi = bootinfo_find(BI_RAMDISK);
+	if (bi != NULL) {
+		struct bi_mem_info *rd = bootinfo_dataptr(bi);
+		md_root_setconf((void *)rd->mem_addr, rd->mem_size);
+	}
+#endif /* MEMORY_DISK_DYNAMIC */
+
 	rootconf();
 }
 



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:52:47 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: vectors.s

Log Message:
Remove non-applicable comments.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/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/virt68k/virt68k/vectors.s
diff -u src/sys/arch/virt68k/virt68k/vectors.s:1.1 src/sys/arch/virt68k/virt68k/vectors.s:1.2
--- src/sys/arch/virt68k/virt68k/vectors.s:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/vectors.s	Tue Jan  2 07:52:47 2024
@@ -1,4 +1,4 @@
-|	$NetBSD: vectors.s,v 1.1 2024/01/02 07:41:02 thorpej Exp $
+|	$NetBSD: vectors.s,v 1.2 2024/01/02 07:52:47 thorpej Exp $
 
 | Copyright (c) 1997 Jason R. Thorpe.  All rights reserved.
 | Copyright (c) 1988 University of Utah
@@ -137,10 +137,6 @@ GLOBAL(vectab)
 	VECTOR(badtrap)		/* 62: unassigned, reserved */
 	VECTOR(badtrap)		/* 63: unassigned, reserved */
 
-	/*
-	 * PCC, PCCTWO, MC, and VME vectors are installed from 64-255
-	 * by the *intr_extablish() functions.
-	 */
 	BADTRAP16		/* 64-255: user interrupt vectors */
 	BADTRAP16		/* 64-255: user interrupt vectors */
 	BADTRAP16		/* 64-255: user interrupt vectors */



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:52:47 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: vectors.s

Log Message:
Remove non-applicable comments.


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

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:47:36 UTC 2024

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

Log Message:
Comment out LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/GENERIC

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



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:48:46 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: intr.c

Log Message:
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/intr.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/virt68k/virt68k/intr.c
diff -u src/sys/arch/virt68k/virt68k/intr.c:1.1 src/sys/arch/virt68k/virt68k/intr.c:1.2
--- src/sys/arch/virt68k/virt68k/intr.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/intr.c	Tue Jan  2 07:48:46 2024
@@ -1,7 +1,7 @@
-/*	$NetBSD: intr.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $	*/
 
 /*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 2023 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.2 2024/01/02 07:48:46 thorpej Exp $");
 
 #define _VIRT68K_INTR_PRIVATE
 



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:48:46 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: intr.c

Log Message:
Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/intr.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/virt68k/conf

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:47:36 UTC 2024

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

Log Message:
Comment out LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/GENERIC

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

Modified files:

Index: src/sys/arch/virt68k/conf/GENERIC
diff -u src/sys/arch/virt68k/conf/GENERIC:1.1 src/sys/arch/virt68k/conf/GENERIC:1.2
--- src/sys/arch/virt68k/conf/GENERIC:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/conf/GENERIC	Tue Jan  2 07:47:36 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1 2024/01/02 07:40:59 thorpej Exp $
+# $NetBSD: GENERIC,v 1.2 2024/01/02 07:47:36 thorpej Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/virt68k/conf/std.virt68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.1 $"
+#ident 		"GENERIC-$Revision: 1.2 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -42,7 +42,7 @@ options 	FPSP
 
 options 	DDB
 options 	DIAGNOSTIC
-options 	LOCKDEBUG
+#options 	LOCKDEBUG
 #options 	DEBUG
 
 #options 	SYSVSHM



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:43:29 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
Collect more garbage.


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

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

Modified files:

Index: src/sys/arch/virt68k/virt68k/pmap_bootstrap.c
diff -u src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.2 src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.3
--- src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.2	Tue Jan  2 07:42:52 2024
+++ src/sys/arch/virt68k/virt68k/pmap_bootstrap.c	Tue Jan  2 07:43:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.2 2024/01/02 07:42:52 thorpej Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.3 2024/01/02 07:43:29 thorpej Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.2 2024/01/02 07:42:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.3 2024/01/02 07:43:29 thorpej Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -235,21 +235,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 			*ste++ = protoste;
 			protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
 		}
-#if 0
-		/*
-		 * Now initialize the final portion of that block of
-		 * descriptors to map Sysmap.
-		 */
-		i = SG4_LEV1SIZE + (nl1desc * SG4_LEV2SIZE);
-		ste = (st_entry_t *)kstpa;
-		ste = &ste[i + SG4_LEV2SIZE - (NPTEPG / SG4_LEV3SIZE)];
-		este = &ste[NPTEPG / SG4_LEV3SIZE];
-		protoste = kptmpa | SG_U | SG_RW | SG_V;
-		while (ste < este) {
-			*ste++ = protoste;
-			protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
-		}
-#endif
 		/*
 		 * Calculate the free level 2 descriptor mask
 		 * noting that we have used:



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:46:49 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
Remove yet another remnant of debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/pmap_bootstrap.c

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

Modified files:

Index: src/sys/arch/virt68k/virt68k/pmap_bootstrap.c
diff -u src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.3 src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.4
--- src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.3	Tue Jan  2 07:43:29 2024
+++ src/sys/arch/virt68k/virt68k/pmap_bootstrap.c	Tue Jan  2 07:46:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.3 2024/01/02 07:43:29 thorpej Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.4 2024/01/02 07:46:49 thorpej Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.3 2024/01/02 07:43:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.4 2024/01/02 07:46:49 thorpej Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -136,7 +136,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 
 	kptpa = nextpa;
 	nptpages = RELOC(Sysptsize, int) + howmany(RELOC(physmem, int), NPTEPG);
-	nptpages <<= 1;
 	nextpa += nptpages * PAGE_SIZE;
 
 	/*



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:46:49 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
Remove yet another remnant of debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/virt68k/virt68k/pmap_bootstrap.c

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



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:43:29 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
Collect more garbage.


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

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



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:42:52 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
G/C some scratch-pad notes.


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

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

Modified files:

Index: src/sys/arch/virt68k/virt68k/pmap_bootstrap.c
diff -u src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.1 src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.2
--- src/sys/arch/virt68k/virt68k/pmap_bootstrap.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/pmap_bootstrap.c	Tue Jan  2 07:42:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.2 2024/01/02 07:42:52 thorpej Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.2 2024/01/02 07:42:52 thorpej Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -172,16 +172,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 		int nl1desc, nl2desc;
 
 		/*
-		 * XXX NOTES:
-		 * SYSMAP_VA == 0xfe00
-		 * pte va == 0xfe000e38
-		 *
-		 * L1 idx = 127
-		 * L2 idx = 0
-		 * L3 idx = 
-		 */
-
-		/*
 		 * First invalidate the entire "segment table" pages
 		 * (levels 1 and 2 have the same "invalid" value).
 		 */



CVS commit: src/sys/arch/virt68k/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:42:52 UTC 2024

Modified Files:
src/sys/arch/virt68k/virt68k: pmap_bootstrap.c

Log Message:
G/C some scratch-pad notes.


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

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



CVS commit: src/sys/arch/virt68k

2024-01-01 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Jan  2 07:41:02 UTC 2024

Added Files:
src/sys/arch/virt68k: Makefile
src/sys/arch/virt68k/compile: Makefile
src/sys/arch/virt68k/conf: GENERIC Makefile.virt68k files.virt68k
majors.virt68k std.virt68k
src/sys/arch/virt68k/dev: gfpic_mainbus.c gfrtc_mainbus.c
gftty_mainbus.c mainbus.c mainbusvar.h virtio_mainbus.c
src/sys/arch/virt68k/include: Makefile ansi.h aout_machdep.h asm.h
bootinfo.h bswap.h bus.h bus_dma.h bus_space.h cdefs.h clockvar.h
cpu.h db_machdep.h disklabel.h elf_machdep.h endian.h
endian_machdep.h fcode.h fenv.h float.h frame.h ieee.h ieeefp.h
int_const.h int_fmtio.h int_limits.h int_mwgwtypes.h int_types.h
intr.h kcore.h limits.h lock.h math.h mcontext.h mutex.h param.h
pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h reg.h rwlock.h
setjmp.h signal.h sunos_machdep.h trap.h types.h vmparam.h
wchar_limits.h
src/sys/arch/virt68k/virt68k: autoconf.c bootinfo.c bus_dma.c
bus_space.c clock.c disksubr.c genassym.cf intr.c locore.s
machdep.c pmap_bootstrap.c trap.c vectors.s

Log Message:
Add a port to the Qemu m68k "virt" platform, a 68040-based virtual machine
with VirtIO I/O devices.

This is a work-in-progress, but "successfully mounts root file system
and then complains about missing /sbin/init that is, in fact, not there"
seems like a good checkpoint.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/compile/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/conf/GENERIC \
src/sys/arch/virt68k/conf/Makefile.virt68k \
src/sys/arch/virt68k/conf/files.virt68k \
src/sys/arch/virt68k/conf/majors.virt68k \
src/sys/arch/virt68k/conf/std.virt68k
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/dev/gfpic_mainbus.c \
src/sys/arch/virt68k/dev/gfrtc_mainbus.c \
src/sys/arch/virt68k/dev/gftty_mainbus.c \
src/sys/arch/virt68k/dev/mainbus.c src/sys/arch/virt68k/dev/mainbusvar.h \
src/sys/arch/virt68k/dev/virtio_mainbus.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/include/Makefile \
src/sys/arch/virt68k/include/ansi.h \
src/sys/arch/virt68k/include/aout_machdep.h \
src/sys/arch/virt68k/include/asm.h \
src/sys/arch/virt68k/include/bootinfo.h \
src/sys/arch/virt68k/include/bswap.h src/sys/arch/virt68k/include/bus.h \
src/sys/arch/virt68k/include/bus_dma.h \
src/sys/arch/virt68k/include/bus_space.h \
src/sys/arch/virt68k/include/cdefs.h \
src/sys/arch/virt68k/include/clockvar.h \
src/sys/arch/virt68k/include/cpu.h \
src/sys/arch/virt68k/include/db_machdep.h \
src/sys/arch/virt68k/include/disklabel.h \
src/sys/arch/virt68k/include/elf_machdep.h \
src/sys/arch/virt68k/include/endian.h \
src/sys/arch/virt68k/include/endian_machdep.h \
src/sys/arch/virt68k/include/fcode.h src/sys/arch/virt68k/include/fenv.h \
src/sys/arch/virt68k/include/float.h src/sys/arch/virt68k/include/frame.h \
src/sys/arch/virt68k/include/ieee.h src/sys/arch/virt68k/include/ieeefp.h \
src/sys/arch/virt68k/include/int_const.h \
src/sys/arch/virt68k/include/int_fmtio.h \
src/sys/arch/virt68k/include/int_limits.h \
src/sys/arch/virt68k/include/int_mwgwtypes.h \
src/sys/arch/virt68k/include/int_types.h \
src/sys/arch/virt68k/include/intr.h src/sys/arch/virt68k/include/kcore.h \
src/sys/arch/virt68k/include/limits.h src/sys/arch/virt68k/include/lock.h \
src/sys/arch/virt68k/include/math.h \
src/sys/arch/virt68k/include/mcontext.h \
src/sys/arch/virt68k/include/mutex.h src/sys/arch/virt68k/include/param.h \
src/sys/arch/virt68k/include/pcb.h src/sys/arch/virt68k/include/pmap.h \
src/sys/arch/virt68k/include/proc.h \
src/sys/arch/virt68k/include/profile.h src/sys/arch/virt68k/include/psl.h \
src/sys/arch/virt68k/include/pte.h src/sys/arch/virt68k/include/ptrace.h \
src/sys/arch/virt68k/include/reg.h src/sys/arch/virt68k/include/rwlock.h \
src/sys/arch/virt68k/include/setjmp.h \
src/sys/arch/virt68k/include/signal.h \
src/sys/arch/virt68k/include/sunos_machdep.h \
src/sys/arch/virt68k/include/trap.h src/sys/arch/virt68k/include/types.h \
src/sys/arch/virt68k/include/vmparam.h \
src/sys/arch/virt68k/include/wchar_limits.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/virt68k/virt68k/autoconf.c \
src/sys/arch/virt68k/virt68k/bootinfo.c \
src/sys/arch/virt68k/virt68k/bus_dma.c \
src/sys/arch/virt68k/virt68k/bus_space.c \
src/sys/arch/virt68k/virt68k/clock.c \
src/sys/arch/virt68k/virt68k/disksubr.c \
src/sys/arch/virt68k/virt68k/genassym.cf \
src/sys/arch/virt68k/virt68k/intr.c src/sys/arch/virt68k/virt68k/locore.s \
src/sys/arch/virt68k/virt68k/machdep.c \
src/sys/arch/virt68k/virt68k/pmap_bootstrap.c \