CVS commit: src/sys/arch/vax/vax

2024-04-15 Thread Kalvis Duckmanton
Module Name:src
Committed By:   kalvisd
Date:   Tue Apr 16 00:03:30 UTC 2024

Modified Files:
src/sys/arch/vax/vax: unimpl_emul.S

Log Message:
vax/unimpl_emul.S: Initialise locations storing floating-point values with
a constant of the appropriate format


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/vax/vax/unimpl_emul.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/vax/vax/unimpl_emul.S
diff -u src/sys/arch/vax/vax/unimpl_emul.S:1.4 src/sys/arch/vax/vax/unimpl_emul.S:1.5
--- src/sys/arch/vax/vax/unimpl_emul.S:1.4	Mon May 22 16:53:05 2017
+++ src/sys/arch/vax/vax/unimpl_emul.S	Tue Apr 16 00:03:30 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: unimpl_emul.S,v 1.4 2017/05/22 16:53:05 ragge Exp $	*/
+/*	$NetBSD: unimpl_emul.S,v 1.5 2024/04/16 00:03:30 kalvisd Exp $	*/
 
 /*
  * Copyright (c) 2001 Brandon Creighton.  All rights reserved.
@@ -683,7 +683,7 @@ emodd:	bsbw	touser
 	 * there aren't any bits left for the fraction.  Therefore we're
 	 * done here;  TMPFRAC1 is equal to TMPFRACTGT and TMPFRAC2 is 0.
 	 */
-	movq $0f0.0, TMPFRAC2
+	movq $0d0.0, TMPFRAC2
 	jmp 9f		/* we're done, move on */
 1:	
 	/*
@@ -727,7 +727,7 @@ emodd:	bsbw	touser
 	 * We are less than 1.0; TMPFRAC1 should be 0, and TMPFRAC2 should
 	 * be equal to TMPFRACTGT.
 	 */
-	movd $0f0.0, TMPFRAC1
+	movd $0d0.0, TMPFRAC1
 	movd TMPFRACTGT, TMPFRAC2
 9:			
 	/*
@@ -763,7 +763,7 @@ zeroexit:
 	bsbw getaddr_byte
 	movl $0x0, (%r0)
 	bsbw getaddr_byte
-	movd $0f0, (%r0)
+	movd $0d0, (%r0)
 	brw goback
 
 



CVS commit: src/sys/arch/vax/vax

2024-04-15 Thread Kalvis Duckmanton
Module Name:src
Committed By:   kalvisd
Date:   Tue Apr 16 00:03:30 UTC 2024

Modified Files:
src/sys/arch/vax/vax: unimpl_emul.S

Log Message:
vax/unimpl_emul.S: Initialise locations storing floating-point values with
a constant of the appropriate format


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

2024-01-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jan 11 04:33:45 UTC 2024

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

Log Message:
vax: set default RLIMIT_AS to the same as MAXDSIZ

this allows modern GCC to run without returning to the issues that
reported in PR#28379, and avoids a strange sort-of-invariant violation
where the rlimit for data equaled the rlimit for all address space, so
there is no room for text or stack etc.

ok ragge@

XXX: pullup-10


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

2024-01-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Jan 11 04:33:45 UTC 2024

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

Log Message:
vax: set default RLIMIT_AS to the same as MAXDSIZ

this allows modern GCC to run without returning to the issues that
reported in PR#28379, and avoids a strange sort-of-invariant violation
where the rlimit for data equaled the rlimit for all address space, so
there is no room for text or stack etc.

ok ragge@

XXX: pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/vax/vax/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/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.197 src/sys/arch/vax/vax/machdep.c:1.198
--- src/sys/arch/vax/vax/machdep.c:1.197	Fri Jan  5 17:29:29 2024
+++ src/sys/arch/vax/vax/machdep.c	Thu Jan 11 04:33:45 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.197 2024/01/05 17:29:29 hans Exp $	 */
+/* $NetBSD: machdep.c,v 1.198 2024/01/11 04:33:45 mrg Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.197 2024/01/05 17:29:29 hans Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.198 2024/01/11 04:33:45 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -773,6 +773,6 @@ mm_md_readwrite(dev_t dev, struct uio *u
 void
 machdep_init(void)
 {
-	proc0.p_rlimit[RLIMIT_AS].rlim_cur = DFLDSIZ;
+	proc0.p_rlimit[RLIMIT_AS].rlim_cur = MAXDSIZ;
 	proc0.p_rlimit[RLIMIT_AS].rlim_max = MAXDSIZ;
 }



CVS commit: src/sys/arch/vax/vax

2024-01-05 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Fri Jan  5 17:29:29 UTC 2024

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

Log Message:
Include leds.h to make /dev/leds work.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/vax/vax/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/vax/vax/machdep.c
diff -u src/sys/arch/vax/vax/machdep.c:1.196 src/sys/arch/vax/vax/machdep.c:1.197
--- src/sys/arch/vax/vax/machdep.c:1.196	Thu Jun 11 19:20:46 2020
+++ src/sys/arch/vax/vax/machdep.c	Fri Jan  5 17:29:29 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.196 2020/06/11 19:20:46 ad Exp $	 */
+/* $NetBSD: machdep.c,v 1.197 2024/01/05 17:29:29 hans Exp $	 */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2020/06/11 19:20:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.197 2024/01/05 17:29:29 hans Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -130,6 +130,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #endif
 
+#include "leds.h"
 #include "smg.h"
 #include "ksyms.h"
 



CVS commit: src/sys/arch/vax/vax

2024-01-05 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Fri Jan  5 17:29:29 UTC 2024

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

Log Message:
Include leds.h to make /dev/leds work.


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

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:14:57 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
pmap_is_modified(): If we fall into the slow path and encounter a modified
page during PV list walk, set PG_M in the pvh_attrs to avoid falling into
the slow path again.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.200 src/sys/arch/vax/vax/pmap.c:1.201
--- src/sys/arch/vax/vax/pmap.c:1.200	Fri Dec 22 17:55:49 2023
+++ src/sys/arch/vax/vax/pmap.c	Fri Dec 22 19:14:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $	   */
+/*	$NetBSD: pmap.c,v 1.201 2023/12/22 19:14:57 thorpej Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.201 2023/12/22 19:14:57 thorpej Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1474,6 +1474,7 @@ pmap_is_modified(struct vm_page *pg)
 		if (pte[0].pg_m | pte[1].pg_m | pte[2].pg_m | pte[3].pg_m
 		| pte[4].pg_m | pte[5].pg_m | pte[6].pg_m | pte[7].pg_m) {
 			rv = true;
+			SET(pv->pv_attr, PG_M);
 			break;
 		}
 	} while ((pv = pv->pv_next) != NULL);



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:14:57 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
pmap_is_modified(): If we fall into the slow path and encounter a modified
page during PV list walk, set PG_M in the pvh_attrs to avoid falling into
the slow path again.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 17:55:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
rmspace(): when a PT page is put back onto the free list, invalidate
it's VA in the TB.

rmptep(): Add a comment that the no TIBS is needed for newly-freed PT
pages here because all of the callers perform a TBIA.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.199 src/sys/arch/vax/vax/pmap.c:1.200
--- src/sys/arch/vax/vax/pmap.c:1.199	Thu Dec 21 09:09:43 2023
+++ src/sys/arch/vax/vax/pmap.c	Fri Dec 22 17:55:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $	   */
+/*	$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -633,6 +633,7 @@ rmspace(struct pmap *pm)
 		}
 		free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 		*ptpp = 0;
+		mtpr((vaddr_t)br, PR_TBIS);
 	}
 	lr = pm->pm_p1lr/NPTEPG;
 	for (i = lr; i < NPTEPERREG/NPTEPG; i++) {
@@ -647,6 +648,7 @@ rmspace(struct pmap *pm)
 		}
 		free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 		*ptpp = 0;
+		mtpr((vaddr_t)br, PR_TBIS);
 	}
 
 	if (pm->pm_p0lr != 0)
@@ -772,6 +774,7 @@ rmptep(struct pte *pte)
 #endif
 	free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 	*ptpp = 0;
+	/* N.B. callers all do a TBIA, so TBIS not needed here. */
 }
 
 static int



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 17:55:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
rmspace(): when a PT page is put back onto the free list, invalidate
it's VA in the TB.

rmptep(): Add a comment that the no TIBS is needed for newly-freed PT
pages here because all of the callers perform a TBIA.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-12-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 21 09:09:43 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
fix locking botch: use mutex_spin_exit(), not _exit(), for PMAP_UNLOCK.

fixes LOCKDEBUG issue in first attempt to unlock it.

also call PMAP_UNLOCK in one non-fatal out of memory case.

XXX: pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-12-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 21 09:09:43 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
fix locking botch: use mutex_spin_exit(), not _exit(), for PMAP_UNLOCK.

fixes LOCKDEBUG issue in first attempt to unlock it.

also call PMAP_UNLOCK in one non-fatal out of memory case.

XXX: pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.198 src/sys/arch/vax/vax/pmap.c:1.199
--- src/sys/arch/vax/vax/pmap.c:1.198	Tue Oct 17 10:22:07 2023
+++ src/sys/arch/vax/vax/pmap.c	Thu Dec 21 09:09:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $	   */
+/*	$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -161,7 +161,7 @@ ptpinuse(void *pte)
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 static kmutex_t pmap_lock;
 #define PMAP_LOCK	mutex_spin_enter(_lock);
-#define PMAP_UNLOCK	mutex_spin_enter(_lock);
+#define PMAP_UNLOCK	mutex_spin_exit(_lock);
 #else
 #define PMAP_LOCK
 #define PMAP_UNLOCK
@@ -1196,6 +1196,7 @@ pmap_enter(pmap_t pmap, vaddr_t v, paddr
 	return 0;
 
 growfail:
+	PMAP_UNLOCK;
 	if (flags & PMAP_CANFAIL)
 		return ENOMEM;
 	panic("usrptmap space leakage");



CVS commit: src/sys/arch/vax/vax

2023-12-18 Thread Kalvis Duckmanton
Module Name:src
Committed By:   kalvisd
Date:   Mon Dec 18 22:40:01 UTC 2023

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
vax: preserve AST requests raised when handling software interrupts

PR port-vax/55415

On return from a software interrupt, if the software interrupt LWP
raised an AST request, copy the AST level from its PCB to the PCB
of the interrupted LWP.

Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/vax/vax/subr.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/vax/vax/subr.S
diff -u src/sys/arch/vax/vax/subr.S:1.42 src/sys/arch/vax/vax/subr.S:1.43
--- src/sys/arch/vax/vax/subr.S:1.42	Thu Feb 23 14:57:08 2023
+++ src/sys/arch/vax/vax/subr.S	Mon Dec 18 22:40:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.S,v 1.42 2023/02/23 14:57:08 riastradh Exp $	   */
+/*	$NetBSD: subr.S,v 1.43 2023/12/18 22:40:01 kalvisd Exp $	   */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -319,7 +319,18 @@ softint_process:
 	movl	%r6,CI_CURLWP(%r8)
 	/* XXX store-before-load barrier -- see cpu_switchto */
 #endif
-
+	/* copy AST level from current LWP to pinned LWP, reset
+	   current AST level */
+	mfpr	$PR_SSP,%r4		/* current LWP */
+	movl	L_PCB(%r4),%r4		/* PCB address */
+	movl	P0LR(%r4),%r0		/* LR and ASTLVL field, current PCB */
+	movl	P0LR(%r3),%r1		/* same, pinned LWP */
+	cmpl	%r0,%r1
+	bgtru	1f			/* AST(current) >= AST(pinned) */
+	extv	$24,$3,%r0,%r0		/* ASTLVL field for current LWP */
+	insv	%r0,$24,$3,P0LR(%r3)	/* copy to pinned LWP */
+	insv	$4,$24,$3,P0LR(%r4)	/* reset AST for current LWP */
+1:
 	mtpr	PCB_PADDR(%r3),$PR_PCBB	/* restore PA of interrupted pcb */
 	ldpctx/* implicitly updates curlwp */
 	rei



CVS commit: src/sys/arch/vax/vax

2023-12-18 Thread Kalvis Duckmanton
Module Name:src
Committed By:   kalvisd
Date:   Mon Dec 18 22:40:01 UTC 2023

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
vax: preserve AST requests raised when handling software interrupts

PR port-vax/55415

On return from a software interrupt, if the software interrupt LWP
raised an AST request, copy the AST level from its PCB to the PCB
of the interrupted LWP.

Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/vax/vax/subr.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/vax/vax

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 18:39:02 UTC 2023

Modified Files:
src/sys/arch/vax/vax: ka780.c

Log Message:
Fix TRENDATA option build by moving TRENDATA code block with memlog() definition
over its usage in ka780_memerr() and making it static. Also return type is
changed to void and removed unnecessary break at the end of the method.

Finally fixed struct memlogtab initialization by adding missing braces around
each member in the array.

The code builds, but I am not sure weather it was fully finished.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/vax/vax/ka780.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/vax/vax/ka780.c
diff -u src/sys/arch/vax/vax/ka780.c:1.33 src/sys/arch/vax/vax/ka780.c:1.34
--- src/sys/arch/vax/vax/ka780.c:1.33	Sun Mar 25 08:13:20 2018
+++ src/sys/arch/vax/vax/ka780.c	Sun Dec 17 18:39:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ka780.c,v 1.33 2018/03/25 08:13:20 ragge Exp $ */
+/*	$NetBSD: ka780.c,v 1.34 2023/12/17 18:39:02 andvar Exp $ */
 /*-
  * Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ka780.c,v 1.33 2018/03/25 08:13:20 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka780.c,v 1.34 2023/12/17 18:39:02 andvar Exp $");
 
 #include 
 #include 
@@ -200,6 +200,55 @@ mem_sbi_attach(device_t parent, device_t
 	printf("\n");
 }
 
+#ifdef TRENDATA
+/*
+ * Figure out what chip to replace on Trendata boards.
+ * Assumes all your memory is Trendata or the non-Trendata
+ * memory never fails..
+ */
+const struct {
+	u_char	m_syndrome;
+	char	m_chip[4];
+} memlogtab[] = {
+	{0x01,	"C00"},	{0x02,	"C01"},	{0x04,	"C02"},	{0x08,	"C03"},
+	{0x10,	"C04"},	{0x19,	"L01"},	{0x1A,	"L02"},	{0x1C,	"L04"},
+	{0x1F,	"L07"},	{0x20,	"C05"},	{0x38,	"L00"},	{0x3B,	"L03"},
+	{0x3D,	"L05"},	{0x3E,	"L06"},	{0x40,	"C06"},	{0x49,	"L09"},
+	{0x4A,	"L10"},	{0x4c,	"L12"},	{0x4F,	"L15"},	{0x51,	"L17"},
+	{0x52,	"L18"},	{0x54,	"L20"},	{0x57,	"L23"},	{0x58,	"L24"},
+	{0x5B,	"L27"},	{0x5D,	"L29"},	{0x5E,	"L30"},	{0x68,	"L08"},
+	{0x6B,	"L11"},	{0x6D,	"L13"},	{0x6E,	"L14"},	{0x70,	"L16"},
+	{0x73,	"L19"},	{0x75,	"L21"},	{0x76,	"L22"},	{0x79,	"L25"},
+	{0x7A,	"L26"},	{0x7C,	"L28"},	{0x7F,	"L31"},	{0x80,	"C07"},
+	{0x89,	"U01"},	{0x8A,	"U02"},	{0x8C,	"U04"},	{0x8F,	"U07"},
+	{0x91,	"U09"},	{0x92,	"U10"},	{0x94,	"U12"},	{0x97,	"U15"},
+	{0x98,	"U16"},	{0x9B,	"U19"},	{0x9D,	"U21"},	{0x9E,	"U22"},
+	{0xA8,	"U00"},	{0xAB,	"U03"},	{0xAD,	"U05"},	{0xAE,	"U06"},
+	{0xB0,	"U08"},	{0xB3,	"U11"},	{0xB5,	"U13"},	{0xB6,	"U14"},
+	{0xB9,	"U17"},	{0xBA,	"U18"},	{0xBC,	"U20"},	{0xBF,	"U23"},
+	{0xC1,	"U25"},	{0xC2,	"U26"},	{0xC4,	"U28"},	{0xC7,	"U31"},
+	{0xE0,	"U24"},	{0xE3,	"U27"},	{0xE5,	"U29"},	{0xE6,	"U30"}
+};
+
+static void
+memlog(int m, struct mcr780 *mcr)
+{
+	int i;
+
+	for (i = 0; i < __arraycount(memlogtab); i++)
+		if ((u_char)(M780C_SYN(mcr)) == memlogtab[i].m_syndrome) {
+			printf(
+			"mcr%d: replace %s chip in %s bank of memory"
+			" board %d (0-15)\n",
+			m, memlogtab[i].m_chip,
+			(M780C_ADDR(mcr) & 0x8000) ? "upper" : "lower",
+			(M780C_ADDR(mcr) >> 16));
+			return;
+		}
+	printf("mcr%d: multiple errors, not traceable\n", m);
+}
+#endif /* TRENDATA */
+
 /* log crd errors */
 void
 ka780_memerr(void)
@@ -250,56 +299,6 @@ ka780_memerr(void)
 	}
 }
 
-#ifdef TRENDATA
-/*
- * Figure out what chip to replace on Trendata boards.
- * Assumes all your memory is Trendata or the non-Trendata
- * memory never fails..
- */
-const struct {
-	u_char	m_syndrome;
-	char	m_chip[4];
-} memlogtab[] = {
-	0x01,	"C00",	0x02,	"C01",	0x04,	"C02",	0x08,	"C03",
-	0x10,	"C04",	0x19,	"L01",	0x1A,	"L02",	0x1C,	"L04",
-	0x1F,	"L07",	0x20,	"C05",	0x38,	"L00",	0x3B,	"L03",
-	0x3D,	"L05",	0x3E,	"L06",	0x40,	"C06",	0x49,	"L09",
-	0x4A,	"L10",	0x4c,	"L12",	0x4F,	"L15",	0x51,	"L17",
-	0x52,	"L18",	0x54,	"L20",	0x57,	"L23",	0x58,	"L24",
-	0x5B,	"L27",	0x5D,	"L29",	0x5E,	"L30",	0x68,	"L08",
-	0x6B,	"L11",	0x6D,	"L13",	0x6E,	"L14",	0x70,	"L16",
-	0x73,	"L19",	0x75,	"L21",	0x76,	"L22",	0x79,	"L25",
-	0x7A,	"L26",	0x7C,	"L28",	0x7F,	"L31",	0x80,	"C07",
-	0x89,	"U01",	0x8A,	"U02",	0x8C,	"U04",	0x8F,	"U07",
-	0x91,	"U09",	0x92,	"U10",	0x94,	"U12",	0x97,	"U15",
-	0x98,	"U16",	0x9B,	"U19",	0x9D,	"U21",	0x9E,	"U22",
-	0xA8,	"U00",	0xAB,	"U03",	0xAD,	"U05",	0xAE,	"U06",
-	0xB0,	"U08",	0xB3,	"U11",	0xB5,	"U13",	0xB6,	"U14",
-	0xB9,	"U17",	0xBA,	"U18",	0xBC,	"U20",	0xBF,	"U23",
-	0xC1,	"U25",	0xC2,	"U26",	0xC4,	"U28",	0xC7,	"U31",
-	0xE0,	"U24",	0xE3,	"U27",	0xE5,	"U29",	0xE6,	"U30"
-};
-
-int
-memlog(int m, struct mcr780 *mcr)
-{
-	int i;
-
-	for (i = 0; i < __arraycount(memlogtab); i++)
-		if ((u_char)(M780C_SYN(mcr)) == memlogtab[i].m_syndrome) {
-			printf (
-	"mcr%d: replace %s chip in %s bank of memory board %d (0-15)\n",
-m,
-

CVS commit: src/sys/arch/vax/vax

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 18:39:02 UTC 2023

Modified Files:
src/sys/arch/vax/vax: ka780.c

Log Message:
Fix TRENDATA option build by moving TRENDATA code block with memlog() definition
over its usage in ka780_memerr() and making it static. Also return type is
changed to void and removed unnecessary break at the end of the method.

Finally fixed struct memlogtab initialization by adding missing braces around
each member in the array.

The code builds, but I am not sure weather it was fully finished.


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

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 15:06:34 UTC 2023

Modified Files:
src/sys/arch/vax/vax: crx.c

Log Message:
Fix format specifier for ka820port_ptr->csr.

Fixed CRXDEBUG build option for vax.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/vax/vax/crx.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/vax/vax/crx.c
diff -u src/sys/arch/vax/vax/crx.c:1.15 src/sys/arch/vax/vax/crx.c:1.16
--- src/sys/arch/vax/vax/crx.c:1.15	Fri Jul 25 08:10:35 2014
+++ src/sys/arch/vax/vax/crx.c	Sun Dec 17 15:06:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crx.c,v 1.15 2014/07/25 08:10:35 dholland Exp $	*/
+/*	$NetBSD: crx.c,v 1.16 2023/12/17 15:06:33 andvar Exp $	*/
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crx.c,v 1.15 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crx.c,v 1.16 2023/12/17 15:06:33 andvar Exp $");
 
 #include 
 #include 
@@ -149,7 +149,7 @@ crxrw(dev_t dev, struct uio *uio, int fl
 #if	CRXDEBUG
 	printf("crxrw(csa%d): %s\n", 
 		rx50unit(dev), uio->uio_rw==UIO_READ?"read":"write");
-	printf("crxrw: ka820port = %x\n", ka820port_ptr->csr);
+	printf("crxrw: ka820port = %lx\n", ka820port_ptr->csr);
 #endif
 	/* enforce whole-sector I/O */
 	if ((uio->uio_offset & 511) || (uio->uio_resid & 511))
@@ -202,7 +202,7 @@ crxrw(dev_t dev, struct uio *uio, int fl
 #endif
 #if	CRXDEBUG
 		printf("crx: going off\n");
-		printf("crxrw: ka820port = %x\n", ka820port_ptr->csr);
+		printf("crxrw: ka820port = %lx\n", ka820port_ptr->csr);
 #endif
 		rxaddr->rxgo = 0;	/* start it up */
 		ka820port_ptr->csr |= KA820PORT_RXIRQ;
@@ -210,7 +210,7 @@ crxrw(dev_t dev, struct uio *uio, int fl
 		while ((rs->rs_flags & RS_DONE) == 0) {
 #if	CRXDEBUG
 			printf("crx: sleeping on I/O\n");
-			printf("crxopen: ka820port = %x\n", ka820port_ptr->csr);
+			printf("crxopen: ka820port = %lx\n", ka820port_ptr->csr);
 #endif
 			(void) tsleep(>rs_blkno, PRIBIO, "crxrw", 0);
 		}



CVS commit: src/sys/arch/vax/vax

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 15:06:34 UTC 2023

Modified Files:
src/sys/arch/vax/vax: crx.c

Log Message:
Fix format specifier for ka820port_ptr->csr.

Fixed CRXDEBUG build option for vax.


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

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 14:54:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: bus_dma.c

Log Message:
Fix printf format specifier for size. Fixes DEBUG_DMA build option.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/vax/vax/bus_dma.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/vax/vax/bus_dma.c
diff -u src/sys/arch/vax/vax/bus_dma.c:1.39 src/sys/arch/vax/vax/bus_dma.c:1.40
--- src/sys/arch/vax/vax/bus_dma.c:1.39	Tue Oct 11 22:03:37 2022
+++ src/sys/arch/vax/vax/bus_dma.c	Sun Dec 17 14:54:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.39 2022/10/11 22:03:37 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.40 2023/12/17 14:54:49 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2022/10/11 22:03:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.40 2023/12/17 14:54:49 andvar Exp $");
 
 #include 
 #include 
@@ -485,7 +485,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, void 
 {
 
 #ifdef DEBUG_DMA
-	printf("dmamem_unmap: t=%p kva=%p size=%x\n", t, kva, size);
+	printf("dmamem_unmap: t=%p kva=%p size=%lx\n", t, kva, size);
 #endif	/* DEBUG_DMA */
 #ifdef DIAGNOSTIC
 	if ((u_long)kva & PGOFSET)



CVS commit: src/sys/arch/vax/vax

2023-12-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 17 14:54:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: bus_dma.c

Log Message:
Fix printf format specifier for size. Fixes DEBUG_DMA build option.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/vax/vax/bus_dma.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/vax/vax

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:22:07 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax/pmap.c: Sort includes.  Nix traliing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:22:07 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax/pmap.c: Sort includes.  Nix traliing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.197 src/sys/arch/vax/vax/pmap.c:1.198
--- src/sys/arch/vax/vax/pmap.c:1.197	Mon Oct 16 17:04:38 2023
+++ src/sys/arch/vax/vax/pmap.c	Tue Oct 17 10:22:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $	   */
+/*	$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,26 +25,27 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $");
 
-#include "opt_ddb.h"
 #include "opt_cputype.h"
+#include "opt_ddb.h"
+#include "opt_lockdebug.h"
 #include "opt_modular.h"
 #include "opt_multiprocessor.h"
-#include "opt_lockdebug.h"
 #include "opt_pipe.h"
 
 #include 
-#include 
+
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -54,20 +55,20 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #endif
 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
 
 /* QDSS console mapping hack */
 #include "qd.h"
 void	qdearly(void);
 
-/* 
- * This code uses bitfield operators for most page table entries.  
+/*
+ * This code uses bitfield operators for most page table entries.
  */
 #define PROTSHIFT	27
 #define PROT_KW		(PG_KW >> PROTSHIFT)
-#define PROT_KR		(PG_KR >> PROTSHIFT) 
+#define PROT_KR		(PG_KR >> PROTSHIFT)
 #define PROT_RW		(PG_RW >> PROTSHIFT)
 #define PROT_RO		(PG_RO >> PROTSHIFT)
 #define PROT_URKW	(PG_URKW >> PROTSHIFT)
@@ -275,10 +276,10 @@ pmap_bootstrap(void)
 	usrptsize = (1024*1024*1024)/VAX_NBPG;	/* 1GB total VM */
 	if (vax_btop(usrptsize)* PPTESZ > avail_end/20)
 		usrptsize = (avail_end/(20 * PPTESZ)) * VAX_NBPG;
-		
+
 	kvmsize = calc_kvmsize(usrptsize);
 	/*
-	 * Ensure that not more than 1G is allocated, since that is 
+	 * Ensure that not more than 1G is allocated, since that is
 	 * max size of S0 space.
 	 * Also note that for full S0 space the SLR should be 0x20,
 	 * since the comparison in the vax microcode is >= SLR.
@@ -290,7 +291,7 @@ pmap_bootstrap(void)
 	/*
 	 * Virtual_* and avail_* is used for mapping of system page table.
 	 * The need for kernel virtual memory is linear dependent of the
-	 * amount of physical memory also, therefore sysptsize is 
+	 * amount of physical memory also, therefore sysptsize is
 	 * a variable here that is changed dependent of the physical
 	 * memory size.
 	 */
@@ -478,8 +479,8 @@ pmap_steal_memory(vsize_t size, vaddr_t 
  * is enabled. It is meant to do machine-specific allocations.
  * Here is the resource map for the user page tables inited.
  */
-void 
-pmap_init(void) 
+void
+pmap_init(void)
 {
 	/*
 	 * Create the extent map used to manage the page table space.
@@ -529,7 +530,7 @@ rmpage(pmap_t pm, int *br)
 		return; /* Forget mappings of IO space */
 
 	pv = pv_table + ((br[0] & PG_FRAME) >> LTOHPS);
-	if (((br[0] & PG_PROT) == PG_RW) && 
+	if (((br[0] & PG_PROT) == PG_RW) &&
 	((pv->pv_attr & PG_M) != PG_M))
 		pv->pv_attr |= br[0]|br[1]|br[2]|br[3]|br[4]|br[5]|br[6]|br[7];
 	pmap_decrement_stats(pm, (br[0] & PG_W) != 0);
@@ -565,10 +566,10 @@ update_pcbs(struct pmap *pm)
 		pcb->P0LR = pm->pm_p0lr | (pcb->P0LR & AST_MASK);
 		pcb->P1BR = pm->pm_p1br;
 		pcb->P1LR = pm->pm_p1lr;
-		
+
 	}
 
-	/* If curlwp uses this pmap update the regs too */ 
+	/* If curlwp uses this pmap update the regs too */
 	if (pm == curproc->p_vmspace->vm_map.pmap) {
 		mtpr((uintptr_t)pm->pm_p0br, PR_P0BR);
 		mtpr(pm->pm_p0lr, PR_P0LR);
@@ -773,7 +774,7 @@ rmptep(struct pte *pte)
 	*ptpp = 0;
 }
 
-static int 
+static int
 grow_p0(struct pmap *pm, int reqlen)
 {
 	vaddr_t nptespc;
@@ -781,7 +782,7 @@ grow_p0(struct pmap *pm, int reqlen)
 	int srclen, dstlen;
 	int inuse, len, p0lr;
 	u_long p0br;
- 
+
 	PMDEBUG(("grow_p0: pmap %p reqlen %d\n", pm, reqlen));
 
 	/* Get new pte space */
@@ -791,7 +792,7 @@ grow_p0(struct pmap *pm, int reqlen)
 	PMAP_UNLOCK;
 	nptespc = pmap_getusrptes(pm, len);
 	PMAP_LOCK;
- 
+
 	if (nptespc == 0)
 		return 0;
 	/*
@@ -826,7 +827,7 @@ grow_p1(struct pmap *pm, int len)
 {
 	vaddr_t nptespc, optespc;
 	int nlen, olen;
- 
+
 	PMDEBUG(("grow_p1: pm %p len %x\n", pm, len));
 
 	/* Get new pte space */
@@ -867,7 +868,7 @@ pmap_pinit(pmap_t pmap)
 {
 
 	/*
-	 * Do not allocate any pte's here, we don't 

CVS commit: src/sys/arch/vax/vax

2023-10-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 16 17:04:38 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
This now needs  to compile.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.196 src/sys/arch/vax/vax/pmap.c:1.197
--- src/sys/arch/vax/vax/pmap.c:1.196	Sun Mar 26 12:21:09 2023
+++ src/sys/arch/vax/vax/pmap.c	Mon Oct 16 17:04:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.196 2023/03/26 12:21:09 ragge Exp $	   */
+/*	$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.196 2023/03/26 12:21:09 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/vax/vax

2023-10-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 16 17:04:38 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
This now needs  to compile.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-03-26 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Sun Mar 26 12:21:09 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
Ensure that the kernel do not try to allocate a S0 segment larger than 1G,
since the hardware prohibits that.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.195 src/sys/arch/vax/vax/pmap.c:1.196
--- src/sys/arch/vax/vax/pmap.c:1.195	Sun Dec 11 18:02:40 2022
+++ src/sys/arch/vax/vax/pmap.c	Sun Mar 26 12:21:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.195 2022/12/11 18:02:40 oster Exp $	   */
+/*	$NetBSD: pmap.c,v 1.196 2023/03/26 12:21:09 ragge Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.195 2022/12/11 18:02:40 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.196 2023/03/26 12:21:09 ragge Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -276,6 +276,15 @@ pmap_bootstrap(void)
 		usrptsize = (avail_end/(20 * PPTESZ)) * VAX_NBPG;
 		
 	kvmsize = calc_kvmsize(usrptsize);
+	/*
+	 * Ensure that not more than 1G is allocated, since that is 
+	 * max size of S0 space.
+	 * Also note that for full S0 space the SLR should be 0x20,
+	 * since the comparison in the vax microcode is >= SLR.
+	 */
+#define	S0SPACE	(1*1024*1024*1024)
+	if (kvmsize > S0SPACE)
+		kvmsize = S0SPACE;
 	sysptsize = kvmsize >> VAX_PGSHIFT;
 	/*
 	 * Virtual_* and avail_* is used for mapping of system page table.



CVS commit: src/sys/arch/vax/vax

2023-03-26 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Sun Mar 26 12:21:09 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
Ensure that the kernel do not try to allocate a S0 segment larger than 1G,
since the hardware prohibits that.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-02-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 23 14:57:09 UTC 2023

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
vax: Note where cpu_switchto needs barriers.

PR kern/57240

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/vax/vax/subr.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/vax/vax/subr.S
diff -u src/sys/arch/vax/vax/subr.S:1.41 src/sys/arch/vax/vax/subr.S:1.42
--- src/sys/arch/vax/vax/subr.S:1.41	Mon Oct 31 20:30:23 2022
+++ src/sys/arch/vax/vax/subr.S	Thu Feb 23 14:57:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.S,v 1.41 2022/10/31 20:30:23 andvar Exp $	   */
+/*	$NetBSD: subr.S,v 1.42 2023/02/23 14:57:08 riastradh Exp $	   */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -315,7 +315,9 @@ softint_process:
 	movab	softint_exit,PCB_PC(%r3)/* do a quick exit */
 #ifdef MULTIPROCESSOR
 	movl	L_CPU(%r6),%r8
+	/* XXX store-before-store barrier -- see cpu_switchto */
 	movl	%r6,CI_CURLWP(%r8)
+	/* XXX store-before-load barrier -- see cpu_switchto */
 #endif
 
 	mtpr	PCB_PADDR(%r3),$PR_PCBB	/* restore PA of interrupted pcb */
@@ -338,7 +340,9 @@ softint_common:
 	movl	%r6,PCB_R6(%r3)		/* move old lwp into new pcb */
 	movl	%r1,PCB_R7(%r3)		/* move IPL into new pcb */
 #ifdef MULTIPROCESSOR
+	/* XXX store-before-store barrier -- see cpu_switchto */
 	movl	%r2,CI_CURLWP(%r8)	/* update ci_curlwp */
+	/* XXX store-before-load barrier -- see cpu_switchto */
 #endif
 
 	/*
@@ -404,7 +408,31 @@ JSBENTRY(Swtchto)
 #ifdef MULTIPROCESSOR
 	movl	L_CPU(%r0), %r8		/* get cpu_info of old lwp */
 	movl	%r8, L_CPU(%r1)		/* update cpu_info of new lwp */
+	/*
+	 * Issue barriers to coordinate mutex_exit on this CPU with
+	 * mutex_vector_enter on another CPU.
+	 *
+	 * 1. Any prior mutex_exit by oldlwp must be visible to other
+	 *CPUs before we set ci_curlwp := newlwp on this one,
+	 *requiring a store-before-store barrier.
+	 *
+	 * 2. ci_curlwp := newlwp must be visible on all other CPUs
+	 *before any subsequent mutex_exit by newlwp can even test
+	 *whether there might be waiters, requiring a
+	 *store-before-load barrier.
+	 *
+	 * See kern_mutex.c for details -- this is necessary for
+	 * adaptive mutexes to detect whether the lwp is on the CPU in
+	 * order to safely block without requiring atomic r/m/w in
+	 * mutex_exit.
+	 *
+	 * XXX I'm fuzzy on the memory model of VAX.  I would guess
+	 * it's TSO like x86 but I can't find a store-before-load
+	 * barrier, which is the only one TSO requires explicitly.
+	 */
+	/* XXX store-before-store barrier */
 	movl	%r1,CI_CURLWP(%r8)	/* update ci_curlwp */
+	/* XXX store-before-load barrier */
 #endif
 
 	mtpr	PCB_PADDR(%r3),$PR_PCBB	# set PA of new pcb



CVS commit: src/sys/arch/vax/vax

2023-02-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Feb 23 14:57:09 UTC 2023

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
vax: Note where cpu_switchto needs barriers.

PR kern/57240

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/vax/vax/subr.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/vax/vax

2022-03-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  3 06:28:26 UTC 2022

Modified Files:
src/sys/arch/vax/vax: autoconf.c ka6400.c ka820.c ka88.c multicpu.c

Log Message:
vax: Use device_set_private.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/vax/vax/autoconf.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/vax/vax/ka6400.c \
src/sys/arch/vax/vax/ka88.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/vax/vax/ka820.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/vax/vax/multicpu.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/vax/vax/autoconf.c
diff -u src/sys/arch/vax/vax/autoconf.c:1.99 src/sys/arch/vax/vax/autoconf.c:1.100
--- src/sys/arch/vax/vax/autoconf.c:1.99	Sat Aug  7 16:19:07 2021
+++ src/sys/arch/vax/vax/autoconf.c	Thu Mar  3 06:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.99 2021/08/07 16:19:07 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.100 2022/03/03 06:28:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.99 2021/08/07 16:19:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.100 2022/03/03 06:28:26 riastradh Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_cputype.h"
@@ -173,7 +173,7 @@ cpu_mainbus_attach(device_t parent, devi
 
 	KASSERT(device_private(self) == NULL);
 	ci = curcpu();
-	self->dv_private = ci;
+	device_set_private(self, ci);
 	ci->ci_dev = self;
 	ci->ci_cpuid = device_unit(self);
 

Index: src/sys/arch/vax/vax/ka6400.c
diff -u src/sys/arch/vax/vax/ka6400.c:1.20 src/sys/arch/vax/vax/ka6400.c:1.21
--- src/sys/arch/vax/vax/ka6400.c:1.20	Sun Dec  1 15:34:46 2019
+++ src/sys/arch/vax/vax/ka6400.c	Thu Mar  3 06:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ka6400.c,v 1.20 2019/12/01 15:34:46 ad Exp $	*/
+/*	$NetBSD: ka6400.c,v 1.21 2022/03/03 06:28:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ka6400.c,v 1.20 2019/12/01 15:34:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka6400.c,v 1.21 2022/03/03 06:28:26 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -146,7 +146,7 @@ ka6400_attach(device_t parent, device_t 
 	mtpr(0, PR_VPSR); /* Can't use vector processor */
 
 	ci = curcpu();
-	self->dv_private = ci;
+	device_set_private(self, ci);
 	ci->ci_dev = self;
 	ci->ci_cpuid = device_unit(self);
 	ci->ci_slotid = xa->xa_nodenr;
Index: src/sys/arch/vax/vax/ka88.c
diff -u src/sys/arch/vax/vax/ka88.c:1.20 src/sys/arch/vax/vax/ka88.c:1.21
--- src/sys/arch/vax/vax/ka88.c:1.20	Sun Dec  1 15:34:46 2019
+++ src/sys/arch/vax/vax/ka88.c	Thu Mar  3 06:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ka88.c,v 1.20 2019/12/01 15:34:46 ad Exp $	*/
+/*	$NetBSD: ka88.c,v 1.21 2022/03/03 06:28:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ka88.c,v 1.20 2019/12/01 15:34:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka88.c,v 1.21 2022/03/03 06:28:26 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -149,7 +149,7 @@ ka88_cpu_attach(device_t parent, device_
 		return;
 	}
 	ci = curcpu();
-	self->dv_private = ci;
+	device_set_private(self, ci);
 	ci->ci_dev = self;
 	ci->ci_cpuid = device_unit(self);
 	ci->ci_slotid = na->na_slot;

Index: src/sys/arch/vax/vax/ka820.c
diff -u src/sys/arch/vax/vax/ka820.c:1.57 src/sys/arch/vax/vax/ka820.c:1.58
--- src/sys/arch/vax/vax/ka820.c:1.57	Sun Dec  1 15:34:46 2019
+++ src/sys/arch/vax/vax/ka820.c	Thu Mar  3 06:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ka820.c,v 1.57 2019/12/01 15:34:46 ad Exp $	*/
+/*	$NetBSD: ka820.c,v 1.58 2022/03/03 06:28:26 riastradh Exp $	*/
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ka820.c,v 1.57 2019/12/01 15:34:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka820.c,v 1.58 2022/03/03 06:28:26 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -169,8 +169,8 @@ ka820_attach(device_t parent, device_t s
 #endif
 
 	ci = curcpu();
-	self->dv_private = ci;	/* eww. but curcpu() is already too */
-/* entrenched to change */
+	device_set_private(self, ci);	/* eww. but curcpu() is already too */
+	/* entrenched to change */
 	ci->ci_slotid = ba->ba_nodenr;
 	ci->ci_cpuid = device_unit(self);
 	ci->ci_dev = self;

Index: src/sys/arch/vax/vax/multicpu.c
diff -u src/sys/arch/vax/vax/multicpu.c:1.36 src/sys/arch/vax/vax/multicpu.c:1.37
--- src/sys/arch/vax/vax/multicpu.c:1.36	Sat Nov 21 22:37:11 2020
+++ src/sys/arch/vax/vax/multicpu.c	Thu Mar  3 06:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: multicpu.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $	*/
+/*	$NetBSD: multicpu.c,v 1.37 2022/03/03 

CVS commit: src/sys/arch/vax/vax

2022-03-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  3 06:28:26 UTC 2022

Modified Files:
src/sys/arch/vax/vax: autoconf.c ka6400.c ka820.c ka88.c multicpu.c

Log Message:
vax: Use device_set_private.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/vax/vax/autoconf.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/vax/vax/ka6400.c \
src/sys/arch/vax/vax/ka88.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/vax/vax/ka820.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/vax/vax/multicpu.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/vax/vax

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 17:26:56 UTC 2022

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax: Remove a vestige from before the device_t/softc split.

Verified MicroVAX 4000/96 still boots.

cpu0 at mainbus0: KA49, NVAX, 10KB L1 cache, 256KB L2 cache


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.193 src/sys/arch/vax/vax/pmap.c:1.194
--- src/sys/arch/vax/vax/pmap.c:1.193	Tue Oct 12 08:36:28 2021
+++ src/sys/arch/vax/vax/pmap.c	Fri Feb 11 17:26:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.193 2021/10/12 08:36:28 andvar Exp $	   */
+/*	$NetBSD: pmap.c,v 1.194 2022/02/11 17:26:55 riastradh Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.193 2021/10/12 08:36:28 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.194 2022/02/11 17:26:55 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -397,8 +397,7 @@ pmap_bootstrap(void)
 	ci = (struct cpu_info *) scratch;
 	lwp0.l_cpu = ci;
 	ci->ci_istack = istack;
-	memset(ci, 0, sizeof(struct cpu_info) + sizeof(struct device));
-	ci->ci_dev = (void *)(ci + 1);
+	memset(ci, 0, sizeof(*ci));
 #if defined(MULTIPROCESSOR)
 	ci->ci_curlwp = 
 	ci->ci_flags = CI_MASTERCPU|CI_RUNNING;



CVS commit: src/sys/arch/vax/vax

2022-02-11 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 11 17:26:56 UTC 2022

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax: Remove a vestige from before the device_t/softc split.

Verified MicroVAX 4000/96 still boots.

cpu0 at mainbus0: KA49, NVAX, 10KB L1 cache, 256KB L2 cache


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/vax/vax/pmap.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/vax/vax

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 03:01:59 UTC 2021

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
s/implictily/implicitly/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/vax/vax/subr.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/vax/vax/subr.S
diff -u src/sys/arch/vax/vax/subr.S:1.39 src/sys/arch/vax/vax/subr.S:1.40
--- src/sys/arch/vax/vax/subr.S:1.39	Mon Oct  4 20:25:20 2021
+++ src/sys/arch/vax/vax/subr.S	Sun Dec  5 03:01:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.S,v 1.39 2021/10/04 20:25:20 andvar Exp $	   */
+/*	$NetBSD: subr.S,v 1.40 2021/12/05 03:01:59 msaitoh Exp $	   */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -319,7 +319,7 @@ softint_process:
 #endif
 
 	mtpr	PCB_PADDR(%r3),$PR_PCBB	/* restore PA of interrupted pcb */
-	ldpctx/* implictily updates curlwp */
+	ldpctx/* implicitly updates curlwp */
 	rei
 
 



CVS commit: src/sys/arch/vax/vax

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 03:01:59 UTC 2021

Modified Files:
src/sys/arch/vax/vax: subr.S

Log Message:
s/implictily/implicitly/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/vax/vax/subr.S

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



Re: CVS commit: src/sys/arch/vax/vax

2009-12-14 Thread Mindaugas Rasiukevicius
Hello,

 Module Name:src
 Committed By:   martin
 Date:   Sat Dec 12 12:23:29 UTC 2009
 
 Modified Files:
 src/sys/arch/vax/vax: vm_machdep.c
 
 Log Message:
 Clear new pcb in cpu_lwp_fork, now that this seems to no longer be
 guaranteed to be zeroed memory after the uarea swap changes.

 XXX shouldn't we zero the new uarea upfront in MI code before calling
 uvm_lwp_fork?

No, MD part manages the contents of uarea.  Also, why do you need to clear
it (as opposed to correctly copying and setting up the PCB et al)?

-- 
Mindaugas