CVS commit: src/sys/arch/sparc/sparc

2021-08-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Aug  7 19:23:03 UTC 2021

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

Log Message:
sp_tlb_flush - consistent whitespace in inline asm.


To generate a diff of this commit:
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.373 src/sys/arch/sparc/sparc/pmap.c:1.374
--- src/sys/arch/sparc/sparc/pmap.c:1.373	Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/sparc/pmap.c	Sat Aug  7 19:23:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $ */
+/*	$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -663,13 +663,13 @@ sp_tlb_flush(int va, int ctx, int lvl)
 	opsr = getpsr();	/* KDASSERT(opsr & PSR_ET); */
 	__asm volatile ("wr %0, %1, %%psr"
 			:: "r"(opsr), "n"(PSR_ET) : "memory");
-	__asm volatile ("nop; nop;nop");
+	__asm volatile ("nop; nop; nop");
 
 	octx = getcontext4m();	/* save context */
 
 	/* Do the TLB flush in "ctx" */
 	setcontext4m(ctx);
-	__asm volatile("sta %%g0, [%0]%1" :: "r"(va), "n"(ASI_SRMMUFP));
+	__asm volatile ("sta %%g0, [%0]%1" :: "r"(va), "n"(ASI_SRMMUFP));
 
 	setcontext4m(octx);	/* restore context */
 	setpsr(opsr);		/* turn traps on again */



CVS commit: src/sys/arch/sparc/sparc

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 16:54:37 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
s/propective/prospective


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/sys/arch/sparc/sparc/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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.267 src/sys/arch/sparc/sparc/autoconf.c:1.268
--- src/sys/arch/sparc/sparc/autoconf.c:1.267	Sat Jul 31 10:07:22 2021
+++ src/sys/arch/sparc/sparc/autoconf.c	Sat Jul 31 16:54:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $ */
+/*	$NetBSD: autoconf.c,v 1.268 2021/07/31 16:54:37 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.268 2021/07/31 16:54:37 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -2009,7 +2009,7 @@ bootinfo_relocate(void *newloc)
 		(size_t)cp < (size_t)bootinfo + BOOTINFO_SIZE);
 
 	/*
-	 * Check propective gains.
+	 * Check prospective gains.
 	 */
 	if ((int)bootinfo - (int)newloc < bi_size)
 		/* Don't bother */



CVS commit: src/sys/arch/sparc/sparc

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 10:07:23 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
fix typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 src/sys/arch/sparc/sparc/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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.266 src/sys/arch/sparc/sparc/autoconf.c:1.267
--- src/sys/arch/sparc/sparc/autoconf.c:1.266	Mon May 10 23:53:44 2021
+++ src/sys/arch/sparc/sparc/autoconf.c	Sat Jul 31 10:07:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.266 2021/05/10 23:53:44 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.266 2021/05/10 23:53:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1114,7 +1114,7 @@ mainbus_attach(device_t parent, device_t
 		const char *const dev;
 #define BS_EARLY	1	/* attach device early */
 #define	BS_IGNORE	2	/* ignore root device */
-#define	BS_OPTIONAL	4	/* device not alwas present */
+#define	BS_OPTIONAL	4	/* device not always present */
 		unsigned int flags;
 	};
 



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

2021-06-10 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 11 04:58:30 UTC 2021

Modified Files:
src/sys/arch/sparc/dev: ts102.c

Log Message:
During slot enable and disable, make sure that the card Access and VCC
controls are enabled and disabled at the same time.
Also remove the software reset during slot enable (we are already in
reset because of the earlier Access and VCC changes).
While here, convert DELAY() to delay() and tsleep(), like nell(4).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/ts102.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/sparc/dev/ts102.c
diff -u src/sys/arch/sparc/dev/ts102.c:1.19 src/sys/arch/sparc/dev/ts102.c:1.20
--- src/sys/arch/sparc/dev/ts102.c:1.19	Sat Apr 24 23:36:49 2021
+++ src/sys/arch/sparc/dev/ts102.c	Fri Jun 11 04:58:30 2021
@@ -1,5 +1,5 @@
 /*	$OpenBSD: ts102.c,v 1.14 2005/01/27 17:03:23 millert Exp $	*/
-/*	$NetBSD: ts102.c,v 1.19 2021/04/24 23:36:49 thorpej Exp $ */
+/*	$NetBSD: ts102.c,v 1.20 2021/06/11 04:58:30 jdc Exp $ */
 /*
  * Copyright (c) 2003, 2004, Miodrag Vallat.
  * Copyright (c) 2005, Michael Lorenz.
@@ -182,6 +182,7 @@ static void tslot_slot_intr(struct tslot
 static void tslot_slot_settype(pcmcia_chipset_handle_t, int);
 static void tslot_update_lcd(struct tslot_softc *, int, int);
 static void tslot_intr_dispatch(void *arg);
+void tslot_delay(struct tslot_softc *sc, unsigned int ms);
 
 CFATTACH_DECL_NEW(tslot, sizeof(struct tslot_softc),
 tslot_match, tslot_attach, NULL, NULL);
@@ -620,22 +621,35 @@ static void
 tslot_slot_disable(pcmcia_chipset_handle_t pch)
 {
 	struct tslot_data *td = (struct tslot_data *)pch;
+	int status;
+
 #ifdef TSLOT_DEBUG
 	printf("%s: disable slot %d\n",
 	device_xname(td->td_parent->sc_dev), td->td_slot);
 #endif
 
-	/*
-	 * Disable card access.
-	 */
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
-	TSLOT_READ(td, TS102_REG_CARD_A_STS) & ~TS102_CARD_STS_ACEN);
+	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
+
+	status &= ~TS102_CARD_STS_ACEN;
 
 	/*
 	 * Disable interrupts, except for insertion.
 	 */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
 	TS102_CARD_INT_MASK_CARDDETECT_STATUS);
+
+	/*
+	 * Power down the socket and disable access
+	 */
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	
+	/*
+	 * wait 300ms until power fails (Tpf).
+	 */
+	tslot_delay(td->td_parent, 300);
 }
 
 static void
@@ -652,18 +666,23 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	/* Power down the socket to reset it */
 	status = TSLOT_READ(td, TS102_REG_CARD_A_STS);
 	TSPRINTF("status: %x\n", status);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status | TS102_CARD_STS_VCCEN);
+
+	status &= ~TS102_CARD_STS_ACEN;
+	status &= ~(TS102_CARD_STS_VPP1_MASK | TS102_CARD_STS_VPP2_MASK);
+	status |= TS102_CARD_STS_VCCEN;
+	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
 	/*
 	 * wait 300ms until power fails (Tpf).  Then, wait 100ms since we
 	 * are changing Vcc (Toff).
 	 */
-	DELAY((300 + 100) * 1000);
+	tslot_delay(td->td_parent, 300 + 100);
 
 	/*
 	 * Power on the card if not already done, and enable card access
 	 */
 	status |= TS102_CARD_STS_ACEN;
+	status |= TS102_CARD_STS_VPP1_VCC;
 	status &= ~TS102_CARD_STS_VCCEN;
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
 
@@ -671,22 +690,18 @@ tslot_slot_enable(pcmcia_chipset_handle_
 	 * wait 100ms until power raise (Tpr) and 20ms to become
 	 * stable (Tsu(Vcc)).
 	 */
-	DELAY((100 + 20) * 1000);
-
-	status &= ~TS102_CARD_STS_VPP1_MASK;
-	status |= TS102_CARD_STS_VPP1_VCC;
-	TSLOT_WRITE(td, TS102_REG_CARD_A_STS, status);
+	tslot_delay(td->td_parent, 100 + 20);
 
 	/*
 	 * hold RESET at least 20us.
 	 */
 	intr = TSLOT_READ(td, TS102_REG_CARD_A_INT);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, TS102_CARD_INT_SOFT_RESET);
-	DELAY(20);
-	TSLOT_WRITE(td, TS102_REG_CARD_A_INT, intr);
+	delay(20);
+	TSLOT_WRITE(td, TS102_REG_CARD_A_INT,
+	intr & ~TS102_CARD_INT_SOFT_RESET);
 
 	/* wait 20ms as per pc card standard (r2.01) section 4.3.6 */
-	DELAY(20 * 1000);
+	tslot_delay(td->td_parent, 20);
 
 	/* We need level-triggered interrupts for PC Card hardware */
 	TSLOT_WRITE(td, TS102_REG_CARD_A_STS,
@@ -709,7 +724,7 @@ tslot_slot_enable(pcmcia_chipset_handle_
 		if (status & TS102_CARD_STS_RDY)
 			break;
 		else
-			DELAY(100);
+			delay(100);
 	}
 
 	if (i == 0) {
@@ -1020,3 +1035,24 @@ tslot_update_lcd(struct tslot_softc *sc,
 	}
 #endif
 }
+
+/*
+ * Delay and possibly yield CPU.
+ * XXX - assumes a context
+ */
+void
+tslot_delay(struct tslot_softc *sc, unsigned int ms)
+{
+	unsigned int ticks = mstohz(ms);
+
+	if (cold || ticks == 0) {
+		delay(ms);
+		return;
+	}
+
+#ifdef DIAGNOSTIC
+	if (ticks > 60*hz)
+		panic("tslot: preposterous delay: %u", ticks);
+#endif
+	tsleep(sc, 0, "tslotdel", ticks);

CVS commit: src/sys/arch/sparc/sparc

2021-05-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat May 29 02:58:38 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: cpu.c

Log Message:
report to the scheduler if we have different speed cpus.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/sparc/sparc/cpu.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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.259 src/sys/arch/sparc/sparc/cpu.c:1.260
--- src/sys/arch/sparc/sparc/cpu.c:1.259	Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/sparc/cpu.c	Sat May 29 02:58:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.259 2021/01/24 07:36:54 mrg Exp $ */
+/*	$NetBSD: cpu.c,v 1.260 2021/05/29 02:58:37 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.259 2021/01/24 07:36:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.260 2021/05/29 02:58:37 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -520,6 +520,19 @@ cpu_attach(struct cpu_softc *sc, int nod
 	 */
 	if (bootmid == 0)
 		bootmid = mid;
+
+	/*
+	 * Set speeds now we've attached all CPUs.
+	 */
+	if (sparc_ncpus > 1 && sparc_ncpus == cpu_attach_count) {
+		CPU_INFO_ITERATOR n;
+		unsigned best_hz = 0;
+
+		for (CPU_INFO_FOREACH(n, cpi))
+			best_hz = MAX(cpi->hz, best_hz);
+		for (CPU_INFO_FOREACH(n, cpi))
+			cpu_topology_setspeed(cpi, cpi->hz < best_hz);
+	}
 }
 
 /*



CVS commit: src/sys/arch/sparc/sparc

2021-04-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 25 21:59:38 UTC 2021

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

Log Message:
fix a comment to match the code.


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.279 src/sys/arch/sparc/sparc/locore.s:1.280
--- src/sys/arch/sparc/sparc/locore.s:1.279	Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/sparc/locore.s	Sun Apr 25 21:59:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.279 2021/01/24 07:36:54 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.280 2021/04/25 21:59:38 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -2662,7 +2662,7 @@ sparc_interrupt4m_bogus:
 	bnz,a	1f			!	splhigh();
 	 or	%l0, 0xf00, %l0		! } else
 
-	call	_C_LABEL(bogusintr)	!	strayintr()
+	call	_C_LABEL(bogusintr)	!	bogusintr()
 	 add	%sp, CCFSZ, %o0
 	/* all done: restore registers and go return */
 1:



CVS commit: src/sys/arch/sparc/sparc

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 16:10:08 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: db_disasm.c

Log Message:
The location arg of db_disasm() is a db_addr_t, not a vaddr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/sparc/db_disasm.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/sparc/sparc/db_disasm.c
diff -u src/sys/arch/sparc/sparc/db_disasm.c:1.22 src/sys/arch/sparc/sparc/db_disasm.c:1.23
--- src/sys/arch/sparc/sparc/db_disasm.c:1.22	Wed Jan 11 12:14:32 2017
+++ src/sys/arch/sparc/sparc/db_disasm.c	Tue Apr  6 16:10:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.22 2017/01/11 12:14:32 joerg Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.23 2021/04/06 16:10:08 simonb Exp $ */
 
 /*
  * Copyright (c) 1994 David S. Miller, da...@nadzieja.rutgers.edu
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2017/01/11 12:14:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.23 2021/04/06 16:10:08 simonb Exp $");
 
 #include 
 #include 
@@ -876,7 +876,7 @@ struct sparc_insn sparc_i[] = {
 };
 
 db_addr_t
-db_disasm(vaddr_t loc, bool altfmt)
+db_disasm(db_addr_t loc, bool altfmt)
 {
 	struct sparc_insn*	i_ptr = (struct sparc_insn *)_i;
 



CVS commit: src/sys/arch/sparc/sparc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:10:46 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: openfirm.c

Log Message:
sun4v: add 32/64 bit workaround for the OF_read() call, similar to the one 
introduced in revision 1.21


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/sparc/openfirm.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/sparc/sparc/openfirm.c
diff -u src/sys/arch/sparc/sparc/openfirm.c:1.23 src/sys/arch/sparc/sparc/openfirm.c:1.24
--- src/sys/arch/sparc/sparc/openfirm.c:1.23	Sun Mar 26 12:38:24 2017
+++ src/sys/arch/sparc/sparc/openfirm.c	Sat Feb 27 18:10:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.24 2021/02/27 18:10:46 palle Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.24 2021/02/27 18:10:46 palle Exp $");
 
 #include 
 #include 
@@ -503,6 +503,15 @@ OF_read(int handle, void *addr, int len)
 	} args;
 	int l, act = 0;
 
+#ifdef SUN4V
+#if __arch64__
+	void *oaddr = addr;
+	__cpu_simple_lock(_lock);
+	if (len > OFBOUNCE_MAXSIZE) 
+		panic("OF_read(len = %d) exceedes bounce buffer\n", len);
+	addr = ofbounce;
+#endif	
+#endif
 	args.name = ADR2CELL("read");
 	args.nargs = 3;
 	args.nreturns = 1;
@@ -511,18 +520,31 @@ OF_read(int handle, void *addr, int len)
 	for (; len > 0; len -= l) {
 		l = MIN(NBPG, len);
 		args.len = l;
-		if (openfirmware() == -1)
-			return -1;
+		if (openfirmware() == -1) {
+			act = -1;
+			goto OF_read_exit;
+		}
 		if (args.actual > 0) {
 			act += args.actual;
 		}
 		if (args.actual < l) {
 			if (act)
-return act;
-			else
-return args.actual;
+goto OF_read_exit;
+			else {
+act = args.actual;	
+goto OF_read_exit;
+			}
 		}
 	}
+OF_read_exit:
+#ifdef SUN4V
+#if __arch64__
+	if (act > 0) {
+		memcpy(oaddr, addr, act);	
+	}
+	__cpu_simple_unlock(_lock);
+#endif
+#endif
 	return act;
 }
 



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

2021-01-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jan 25 20:05:30 UTC 2021

Modified Files:
src/sys/arch/sparc/include: pmap.h

Log Message:
avoid needing .  fixes sparc64 build.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/include/pmap.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/sparc/include/pmap.h
diff -u src/sys/arch/sparc/include/pmap.h:1.96 src/sys/arch/sparc/include/pmap.h:1.97
--- src/sys/arch/sparc/include/pmap.h:1.96	Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/include/pmap.h	Mon Jan 25 20:05:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.96 2021/01/24 07:36:54 mrg Exp $ */
+/*	$NetBSD: pmap.h,v 1.97 2021/01/25 20:05:29 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -55,8 +55,6 @@ struct vm_page;
 #include 
 #include 
 
-#include 
-
 #include 
 
 /*
@@ -190,6 +188,7 @@ struct segmap {
 #define PMAP_NULL	((pmap_t)0)
 
 /* Mostly private data exported for a few key consumers. */
+struct memarr;
 extern struct memarr *pmemarr;
 extern int npmemarr;
 extern vaddr_t prom_vstart;



CVS commit: src/sys/arch/sparc

2021-01-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 24 07:36:54 UTC 2021

Modified Files:
src/sys/arch/sparc/dev: cons.h
src/sys/arch/sparc/include: autoconf.h cpu.h db_machdep.h intr.h pmap.h
trap.h
src/sys/arch/sparc/sparc: autoconf.c cache.c cpu.c db_interface.c
eeprom.c intr.c locore.s machdep.c memecc.c mkclock.c msiiepvar.h
oclock.c pci_fixup.c pmap.c process_machdep.c promlib.c timervar.h
trap.c
Added Files:
src/sys/arch/sparc/include: locore.h

Log Message:
avoid using 'extern ;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/dev/cons.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/sparc/include/autoconf.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc/include/db_machdep.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/include/intr.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/include/locore.h
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/sparc/include/pmap.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/include/trap.h
cvs rdiff -u -r1.263 -r1.264 src/sys/arch/sparc/sparc/autoconf.c
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/sparc/cache.c
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sparc/sparc/db_interface.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/sparc/eeprom.c \
src/sys/arch/sparc/sparc/msiiepvar.h
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.278 -r1.279 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/sparc/memecc.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/sparc/mkclock.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sparc/sparc/oclock.c \
src/sys/arch/sparc/sparc/process_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/sparc/pci_fixup.c
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/sparc/sparc/pmap.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc/sparc/promlib.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/sparc/timervar.h
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/sparc/sparc/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/sparc/dev/cons.h
diff -u src/sys/arch/sparc/dev/cons.h:1.5 src/sys/arch/sparc/dev/cons.h:1.6
--- src/sys/arch/sparc/dev/cons.h:1.5	Wed Nov 16 00:49:03 2005
+++ src/sys/arch/sparc/dev/cons.h	Sun Jan 24 07:36:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.h,v 1.5 2005/11/16 00:49:03 uwe Exp $	*/
+/*	$NetBSD: cons.h,v 1.6 2021/01/24 07:36:53 mrg Exp $	*/
 
 
 /*
@@ -9,6 +9,7 @@ extern int prom_stdin_node;
 extern int prom_stdout_node;
 extern char prom_stdin_args[];
 extern char prom_stdout_args[];
+extern struct consdev consdev_prom;
 
 #ifdef	KGDB
 struct zs_chanstate;

Index: src/sys/arch/sparc/include/autoconf.h
diff -u src/sys/arch/sparc/include/autoconf.h:1.49 src/sys/arch/sparc/include/autoconf.h:1.50
--- src/sys/arch/sparc/include/autoconf.h:1.49	Sun Jan 17 01:02:28 2021
+++ src/sys/arch/sparc/include/autoconf.h	Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.h,v 1.49 2021/01/17 01:02:28 mrg Exp $ */
+/*	$NetBSD: autoconf.h,v 1.50 2021/01/24 07:36:54 mrg Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -179,5 +179,7 @@ int	romgetcursoraddr(int **, int **);
 
 /* Exported from autoconf.c for other consumers.  */
 extern char	machine_model[100];
+extern struct sparc_bus_dma_tag mainbus_dma_tag;
+extern struct sparc_bus_space_tag mainbus_space_tag;
 
 #endif /* !_MACHINE_AUTOCONF_H_ */

Index: src/sys/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.108 src/sys/arch/sparc/include/cpu.h:1.109
--- src/sys/arch/sparc/include/cpu.h:1.108	Sat May 16 17:52:42 2020
+++ src/sys/arch/sparc/include/cpu.h	Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.108 2020/05/16 17:52:42 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.109 2021/01/24 07:36:54 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -490,6 +490,9 @@ extern int sparc_ncpus;
 /* Provide %pc of a lwp */
 #define LWP_PC(l)   ((l)->l_md.md_tf->tf_pc)
 
+/* Hardware cross-call mutex */
+extern kmutex_t xpmsg_mutex;
+
 /*
  * Interrupt handler chains.  Interrupt handlers should return 0 for
  * ``not me'' or 1 (``I took care of it'').  intr_establish() inserts a

Index: src/sys/arch/sparc/include/db_machdep.h
diff -u src/sys/arch/sparc/include/db_machdep.h:1.28 src/sys/arch/sparc/include/db_machdep.h:1.29
--- src/sys/arch/sparc/include/db_machdep.h:1.28	Mon Nov  6 03:47:48 2017
+++ src/sys/arch/sparc/include/db_machdep.h	Sun Jan 24 07:36:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.h,v 1.28 2017/11/06 03:47:48 christos Exp $ */
+/*	$NetBSD: db_machdep.h,v 

CVS commit: src/sys/arch/sparc/sparc

2021-01-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 17 01:54:37 UTC 2021

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

Log Message:
convert most uses of pmapdebug to use the new DPRINTF() macro.

add PMAP_INITLOUD debug option, that shows how pmap_bootstrap()
eats up the space provided by /boot as spare space.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.371 src/sys/arch/sparc/sparc/pmap.c:1.372
--- src/sys/arch/sparc/sparc/pmap.c:1.371	Wed Jan 13 16:42:17 2021
+++ src/sys/arch/sparc/sparc/pmap.c	Sun Jan 17 01:54:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.371 2021/01/13 16:42:17 chs Exp $ */
+/*	$NetBSD: pmap.c,v 1.372 2021/01/17 01:54:37 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.371 2021/01/13 16:42:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.372 2021/01/17 01:54:37 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -155,6 +155,7 @@ EVCNT_ATTACH_STATIC(mmu_pagein_evcnt);
 #define	PDB_CHANGEPROT	0x0008
 #define	PDB_ENTER	0x0010
 #define	PDB_FOLLOW	0x0020
+#define	PDB_INITLOUD	0x0040
 
 #define	PDB_MMU_ALLOC	0x0100
 #define	PDB_MMU_STEAL	0x0200
@@ -166,6 +167,12 @@ EVCNT_ATTACH_STATIC(mmu_pagein_evcnt);
 #define	PDB_SWITCHMAP	0x8000
 #define	PDB_SANITYCHK	0x1
 int	pmapdebug = 0;
+#define DPRINTF(level, fmt, ...) do { \
+	if (pmapdebug & (level)) \
+		printf("%s:%d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__); \
+} while (0)
+#else
+#define DPRINTF(level, fmt, ...) /* nothing */
 #endif
 
 /*
@@ -1619,8 +1626,8 @@ me_alloc(struct mmuentry *mh, struct pma
 #ifdef DEBUG
 		if (me->me_pmap != NULL)
 			panic("me_alloc: freelist entry has pmap");
-		if (pmapdebug & PDB_MMU_ALLOC)
-			printf("me_alloc: got pmeg %d\n", me->me_cookie);
+		DPRINTF(PDB_MMU_ALLOC,
+		"me_alloc: got pmeg %d", me->me_cookie);
 #endif
 		mmuq_insert_tail(mh, me);
 
@@ -1651,11 +1658,8 @@ me_alloc(struct mmuentry *mh, struct pma
 
 	me = mmuq_first(_lru);
 	pm = me->me_pmap;
-#ifdef DEBUG
-	if (pmapdebug & (PDB_MMU_ALLOC | PDB_MMU_STEAL))
-		printf("me_alloc: stealing pmeg 0x%x from pmap %p\n",
-		me->me_cookie, pm);
-#endif
+	DPRINTF(PDB_MMU_ALLOC | PDB_MMU_STEAL,
+	"me_alloc: stealing pmeg 0x%x from pmap %p", me->me_cookie, pm);
 
 	mmu_stolenpmegs_evcnt.ev_count++;
 
@@ -1801,9 +1805,8 @@ me_free(struct pmap *pm, u_int pmeg)
 
 #ifdef DEBUG
 	rp = >pm_regmap[me->me_vreg];
-	if (pmapdebug & PDB_MMU_ALLOC)
-		printf("me_free: freeing pmeg %d from pmap %p\n",
-		me->me_cookie, pm);
+	DPRINTF(PDB_MMU_ALLOC,
+	   "me_free: freeing pmeg %d from pmap %p", me->me_cookie, pm);
 	if (me->me_cookie != pmeg)
 		panic("me_free: wrong mmuentry");
 	if (pm != me->me_pmap)
@@ -1869,8 +1872,8 @@ region_alloc(struct mmuentry *mh, struct
 #ifdef DEBUG
 		if (me->me_pmap != NULL)
 			panic("region_alloc: freelist entry has pmap");
-		if (pmapdebug & PDB_MMUREG_ALLOC)
-			printf("region_alloc: got smeg 0x%x\n", me->me_cookie);
+		DPRINTF(PDB_MMUREG_ALLOC,
+		"region_alloc: got smeg 0x%x", me->me_cookie);
 #endif
 		mmuq_insert_tail(mh, me);
 
@@ -1895,11 +1898,10 @@ region_alloc(struct mmuentry *mh, struct
 		panic("region_alloc: LRU entry has no pmap");
 	if (pm == pmap_kernel())
 		panic("region_alloc: stealing from kernel");
-#ifdef DEBUG
-	if (pmapdebug & (PDB_MMUREG_ALLOC | PDB_MMUREG_STEAL))
-		printf("region_alloc: stealing smeg 0x%x from pmap %p\n",
-		me->me_cookie, pm);
-#endif
+	DPRINTF(PDB_MMUREG_ALLOC | PDB_MMUREG_STEAL,
+	"region_alloc: stealing smeg 0x%x from pmap %p",
+	me->me_cookie, pm);
+
 	/*
 	 * Remove from LRU list, and insert at end of new list
 	 * (probably the LRU list again, but so what?).
@@ -1946,10 +1948,9 @@ region_free(struct pmap *pm, u_int smeg)
 {
 	struct mmuentry *me = [smeg];
 
+	DPRINTF(PDB_MMUREG_ALLOC,
+	"region_free: freeing smeg 0x%x from pmap %p", me->me_cookie, pm);
 #ifdef DEBUG
-	if (pmapdebug & PDB_MMUREG_ALLOC)
-		printf("region_free: freeing smeg 0x%x from pmap %p\n",
-		me->me_cookie, pm);
 	if (me->me_cookie != smeg)
 		panic("region_free: wrong mmuentry");
 	if (pm != me->me_pmap)
@@ -2145,9 +2146,10 @@ ctx_alloc(struct pmap *pm)
 #ifdef DEBUG
 	if (pm->pm_ctx)
 		panic("ctx_alloc pm_ctx");
-	if (pmapdebug & PDB_CTX_ALLOC)
-		printf("ctx_alloc[%d](%p)\n", cpu_number(), pm);
 #endif
+	DPRINTF(PDB_CTX_ALLOC,
+	"ctx_alloc[%d](%p)", cpu_number(), pm);
+
 	if (CPU_HAS_SUNMMU) {
 		gap_start = pm->pm_gap_start;
 		gap_end = pm->pm_gap_end;
@@ -2169,10 +2171,11 @@ ctx_alloc(struct pmap *pm)
 #ifdef DEBUG
 		if (c->c_pmap == NULL)
 			panic("ctx_alloc cu_pmap");
-		if (pmapdebug & (PDB_CTX_ALLOC | PDB_CTX_STEAL))
-			printf("ctx_alloc[%d]: steal context %d from %p\n",
-			  

CVS commit: src/sys/arch/sparc/sparc

2021-01-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 17 01:04:58 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
note that find_cpus() also sets cpu_arch.


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/sys/arch/sparc/sparc/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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.262 src/sys/arch/sparc/sparc/autoconf.c:1.263
--- src/sys/arch/sparc/sparc/autoconf.c:1.262	Sun Jan 17 01:02:28 2021
+++ src/sys/arch/sparc/sparc/autoconf.c	Sun Jan 17 01:04:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.262 2021/01/17 01:02:28 mrg Exp $ */
+/*	$NetBSD: autoconf.c,v 1.263 2021/01/17 01:04:58 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.262 2021/01/17 01:02:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.263 2021/01/17 01:04:58 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -198,6 +198,8 @@ set_machine_model(bool late)
 /*
  * Get the number of CPUs in the system and the CPUs' SPARC architecture
  * version. We need this information early in the boot process.
+ *
+ * This also sets cpu_arch to 8 on sun4m and sun4d.
  */
 static int
 find_cpus(void)



CVS commit: src/sys/arch/sparc

2021-01-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 17 01:02:28 UTC 2021

Modified Files:
src/sys/arch/sparc/include: autoconf.h
src/sys/arch/sparc/sparc: autoconf.c cpu.c

Log Message:
set machine_model[] earlier, so that bootstrap can use it.

also, avoid "extern " in .c files, and add
idempotency to autoconf.h.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc/include/autoconf.h
cvs rdiff -u -r1.261 -r1.262 src/sys/arch/sparc/sparc/autoconf.c
cvs rdiff -u -r1.257 -r1.258 src/sys/arch/sparc/sparc/cpu.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/sparc/include/autoconf.h
diff -u src/sys/arch/sparc/include/autoconf.h:1.48 src/sys/arch/sparc/include/autoconf.h:1.49
--- src/sys/arch/sparc/include/autoconf.h:1.48	Sat Oct 27 17:18:11 2012
+++ src/sys/arch/sparc/include/autoconf.h	Sun Jan 17 01:02:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.h,v 1.48 2012/10/27 17:18:11 chs Exp $ */
+/*	$NetBSD: autoconf.h,v 1.49 2021/01/17 01:02:28 mrg Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -69,6 +69,9 @@
  *	@(#)autoconf.h	8.2 (Berkeley) 9/30/93
  */
 
+#ifndef	_MACHINE_AUTOCONF_H_
+#define	_MACHINE_AUTOCONF_H_
+
 /*
  * Autoconfiguration information.
  */
@@ -173,3 +176,8 @@ void	mountroot_hook_establish(void (*)(d
 
 void	bootstrap(void);
 int	romgetcursoraddr(int **, int **);
+
+/* Exported from autoconf.c for other consumers.  */
+extern char	machine_model[100];
+
+#endif /* !_MACHINE_AUTOCONF_H_ */

Index: src/sys/arch/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.261 src/sys/arch/sparc/sparc/autoconf.c:1.262
--- src/sys/arch/sparc/sparc/autoconf.c:1.261	Fri Aug 14 10:34:22 2020
+++ src/sys/arch/sparc/sparc/autoconf.c	Sun Jan 17 01:02:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.261 2020/08/14 10:34:22 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.262 2021/01/17 01:02:28 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.261 2020/08/14 10:34:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.262 2021/01/17 01:02:28 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -169,6 +169,33 @@ matchbyname(device_t parent, cfdata_t cf
 }
 
 /*
+ * Set machine_model[] to something useful.  If late is set, then
+ * have now probed the sun4 class and can finish it.  Other systems
+ * are complete with the first call with late=false out of bootstrap.
+ */
+static void
+set_machine_model(bool late)
+{
+	char namebuf[32];
+
+	if (!CPU_ISSUN4) {
+		if (late) {
+			KASSERT(machine_model[0] != '\0');
+		} else {
+			snprintf(machine_model, sizeof machine_model, "%s",
+			prom_getpropstringA(findroot(), "name", namebuf,
+			sizeof(namebuf)));
+		}
+		return;
+	}
+	if (late)
+		snprintf(machine_model, sizeof machine_model, "SUN-4/%d series",
+		cpuinfo.classlvl);
+	else
+		snprintf(machine_model, sizeof machine_model, "SUN-4 series");
+}
+
+/*
  * Get the number of CPUs in the system and the CPUs' SPARC architecture
  * version. We need this information early in the boot process.
  */
@@ -188,6 +215,9 @@ find_cpus(void)
 	 */
 	cpu_arch = 7;
 
+	/* Initialise machine_model, early phase. */
+	set_machine_model(false);
+
 	/* On sun4 and sun4c we support only one CPU */
 	if (!CPU_ISSUN4M && !CPU_ISSUN4D)
 		return (1);
@@ -1181,14 +1211,7 @@ extern struct sparc_bus_space_tag mainbu
 #define	openboot_special4d	((void *)0)
 #endif
 
-
-	if (CPU_ISSUN4)
-		snprintf(machine_model, sizeof machine_model, "SUN-4/%d series",
-		cpuinfo.classlvl);
-	else
-		snprintf(machine_model, sizeof machine_model, "%s",
-		prom_getpropstringA(findroot(), "name", namebuf,
-		sizeof(namebuf)));
+	set_machine_model(true);
 
 	prom_getidprom();
 	printf(": %s: hostid %lx\n", machine_model, hostid);

Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.257 src/sys/arch/sparc/sparc/cpu.c:1.258
--- src/sys/arch/sparc/sparc/cpu.c:1.257	Sat Dec  5 08:04:51 2020
+++ src/sys/arch/sparc/sparc/cpu.c	Sun Jan 17 01:02:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.257 2020/12/05 08:04:51 mrg Exp $ */
+/*	$NetBSD: cpu.c,v 1.258 2021/01/17 01:02:28 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.257 2020/12/05 08:04:51 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.258 2021/01/17 01:02:28 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -115,7 +115,6 @@ struct cpu_softc {
 char	machine[] = MACHINE;		/* from  */
 char	machine_arch[] = MACHINE_ARCH;	/* from  */
 int	cpu_arch;			/* sparc architecture version */
-extern char machine_model[];
 
 int	sparc_ncpus;			/* # of CPUs detected by PROM */
 struct cpu_info *cpus[_MAXNCPU+1];	/* we only support 4 CPUs. */



CVS commit: src/sys/arch/sparc/sparc

2021-01-13 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Jan 13 16:42:17 UTC 2021

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

Log Message:
in pmap_writetext(), restore the context also when we return early.


To generate a diff of this commit:
cvs rdiff -u -r1.370 -r1.371 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.370 src/sys/arch/sparc/sparc/pmap.c:1.371
--- src/sys/arch/sparc/sparc/pmap.c:1.370	Mon Jan 11 06:12:43 2021
+++ src/sys/arch/sparc/sparc/pmap.c	Wed Jan 13 16:42:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.370 2021/01/11 06:12:43 chs Exp $ */
+/*	$NetBSD: pmap.c,v 1.371 2021/01/13 16:42:17 chs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.370 2021/01/11 06:12:43 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.371 2021/01/13 16:42:17 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -7868,8 +7868,7 @@ pmap_writetext(unsigned char *dst, int c
 	if (CPU_HAS_SRMMU) {
 		pte0 = getpte4m(va);
 		if ((pte0 & SRMMU_TETYPE) != SRMMU_TEPTE) {
-			splx(s);
-			return;
+			goto out;
 		}
 		pte = pte0 | PPROT_WRITE;
 		setpte4m(va, pte);
@@ -7882,8 +7881,7 @@ pmap_writetext(unsigned char *dst, int c
 	if (CPU_ISSUN4C || CPU_ISSUN4) {
 		pte0 = getpte4(va);
 		if ((pte0 & PG_V) == 0) {
-			splx(s);
-			return;
+			goto out;
 		}
 		pte = pte0 | PG_W;
 		setpte4(va, pte);
@@ -7892,6 +7890,8 @@ pmap_writetext(unsigned char *dst, int c
 	}
 #endif
 	cache_flush(dst, 1);
+
+out:
 	setcontext(ctx);
 	splx(s);
 }



CVS commit: src/sys/arch/sparc/sparc

2021-01-10 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan 11 06:12:43 UTC 2021

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

Log Message:
in pgt_page_alloc(), wait and retry the page allocation if PR_WAITOK.
fixes PR 55895.


To generate a diff of this commit:
cvs rdiff -u -r1.369 -r1.370 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.369 src/sys/arch/sparc/sparc/pmap.c:1.370
--- src/sys/arch/sparc/sparc/pmap.c:1.369	Wed Dec  9 11:35:44 2020
+++ src/sys/arch/sparc/sparc/pmap.c	Mon Jan 11 06:12:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.369 2020/12/09 11:35:44 uwe Exp $ */
+/*	$NetBSD: pmap.c,v 1.370 2021/01/11 06:12:43 chs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.369 2020/12/09 11:35:44 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.370 2021/01/11 06:12:43 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -907,13 +907,20 @@ pgt_page_alloc(struct pool *pp, int flag
 	paddr_t pa;
 
 	/* Allocate a page of physical memory */
-	if ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL)
-		return (NULL);
+	while ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL &&
+	   (flags & PR_WAITOK) != 0) {
+		uvm_wait("pgtpg");
+	}
+	if (pg == NULL) {
+		KASSERT((flags & PR_WAITOK) == 0);
+		return NULL;
+	}
 
 	/* Allocate virtual memory */
 	va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_VAONLY |
 		((flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK));
 	if (va == 0) {
+		KASSERT((flags & PR_WAITOK) == 0);
 		uvm_pagefree(pg);
 		return (NULL);
 	}



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

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 15:29:34 UTC 2021

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Use sel{record,remove}_knote().


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.62 src/sys/arch/sparc/dev/tctrl.c:1.63
--- src/sys/arch/sparc/dev/tctrl.c:1.62	Sat Jun 13 05:31:28 2020
+++ src/sys/arch/sparc/dev/tctrl.c	Mon Jan  4 15:29:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.63 2021/01/04 15:29:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.63 2021/01/04 15:29:34 thorpej Exp $");
 
 #include 
 #include 
@@ -1218,7 +1218,7 @@ filt_tctrlrdetach(struct knote *kn)
 	int s;
 
 	s = splts102();
-	SLIST_REMOVE(>sc_rsel.sel_klist, kn, knote, kn_selnext);
+	selremove_knote(>sc_rsel, kn);
 	splx(s);
 }
 
@@ -1243,12 +1243,10 @@ tctrlkqfilter(dev_t dev, struct knote *k
 {
 	struct tctrl_softc *sc = device_lookup_private(_cd,
 		   TCTRL_STD_DEV);
-	struct klist *klist;
 	int s;
 
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
-		klist = >sc_rsel.sel_klist;
 		kn->kn_fop = _filtops;
 		break;
 
@@ -1259,7 +1257,7 @@ tctrlkqfilter(dev_t dev, struct knote *k
 	kn->kn_hook = sc;
 
 	s = splts102();
-	SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+	selrecord_knote(>sc_rsel, kn);
 	splx(s);
 
 	return (0);



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

2020-12-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec 18 00:45:53 UTC 2020

Modified Files:
src/sys/arch/sparc/include: pmap.h

Log Message:
remove unused and #if 0'd since introduced in 1996 struct kvm_cpustate.
sparc kvm was handled differently for the sun4m port.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sparc/include/pmap.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/sparc/include/pmap.h
diff -u src/sys/arch/sparc/include/pmap.h:1.94 src/sys/arch/sparc/include/pmap.h:1.95
--- src/sys/arch/sparc/include/pmap.h:1.94	Sun Sep  6 10:48:21 2020
+++ src/sys/arch/sparc/include/pmap.h	Fri Dec 18 00:45:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.94 2020/09/06 10:48:21 mrg Exp $ */
+/*	$NetBSD: pmap.h,v 1.95 2020/12/18 00:45:52 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -183,15 +183,6 @@ struct segmap {
 	int8_t	sg_nwired;		/* number of wired pages */
 };
 
-#if 0
-struct kvm_cpustate {
-	int		kvm_npmemarr;
-	struct memarr	kvm_pmemarr[MA_SIZE];
-	int		kvm_seginval;			/* [4,4c] */
-	struct segmap	kvm_segmap_store[NKREG*NSEGRG];	/* [4,4c] */
-}/*not yet used*/;
-#endif
-
 #ifdef _KERNEL
 
 #define PMAP_NULL	((pmap_t)0)



CVS commit: src/sys/arch/sparc/sparc

2020-12-09 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Dec  9 11:35:44 UTC 2020

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

Log Message:
Add "memory" constraint on wrpsr, lost in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.368 -r1.369 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.368 src/sys/arch/sparc/sparc/pmap.c:1.369
--- src/sys/arch/sparc/sparc/pmap.c:1.368	Wed Dec  9 04:02:20 2020
+++ src/sys/arch/sparc/sparc/pmap.c	Wed Dec  9 11:35:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.368 2020/12/09 04:02:20 uwe Exp $ */
+/*	$NetBSD: pmap.c,v 1.369 2020/12/09 11:35:44 uwe Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.368 2020/12/09 04:02:20 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.369 2020/12/09 11:35:44 uwe Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -653,7 +653,8 @@ sp_tlb_flush(int va, int ctx, int lvl)
 	 * XXX: Add to asm.h?  We can use this in cache.c too.
 	 */
 	opsr = getpsr();	/* KDASSERT(opsr & PSR_ET); */
-	__asm volatile ("wr %0, %1, %%psr" :: "r"(opsr), "n"(PSR_ET));
+	__asm volatile ("wr %0, %1, %%psr"
+			:: "r"(opsr), "n"(PSR_ET) : "memory");
 	__asm volatile ("nop; nop;nop");
 
 	octx = getcontext4m();	/* save context */



CVS commit: src/sys/arch/sparc/sparc

2020-12-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Dec  9 04:02:20 UTC 2020

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

Log Message:
sp_tlb_flush() - fix inline asm miscompiled by newer gcc versions.

As one national park director once said: "my problems start when the
dumber of my visitors meet the smarter of my bears".

Old inline asm used specific hardcoded registers "assuming that gcc
doesn't do anything funny with these".  Unfortunately now it does,
especially when this function is inlined.  We ended up restoring a
wrong context.  The result was mysterious infinite memory faults.

Rewrite in safer inline asm, so that gcc is not confused.

Many thanks to chs@ for his patience.


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.367 src/sys/arch/sparc/sparc/pmap.c:1.368
--- src/sys/arch/sparc/sparc/pmap.c:1.367	Sat Mar 14 14:05:43 2020
+++ src/sys/arch/sparc/sparc/pmap.c	Wed Dec  9 04:02:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.367 2020/03/14 14:05:43 ad Exp $ */
+/*	$NetBSD: pmap.c,v 1.368 2020/12/09 04:02:20 uwe Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.367 2020/03/14 14:05:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.368 2020/12/09 04:02:20 uwe Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -631,42 +631,39 @@ void 		(*pmap_rmu_p)(struct pmap *, vadd
 /*
  * SP versions of the tlb flush operations.
  *
- * Turn off traps to prevent register window overflows
- * from writing user windows to the wrong stack.
+ * Turn off traps to prevent register window overflows from writing
+ * user windows to the wrong stack.  Cf. tlb_flush_page_real() 
  */
 static void
 sp_tlb_flush(int va, int ctx, int lvl)
 {
-	/*
-	 * XXX convert %o3 (oldpsr), %o4 (SRMMU_CXR) and %o5 (old context)
-	 * into generically named registers.  right now we're assuming that
-	 * gcc doesn't do anything funny with these registers.
-	 */
-
-	/* Traps off */
-	__asm("rd	%psr, %o3");
-	__asm("wr	%%o3, %0, %%psr" :: "n" (PSR_ET));
+	int opsr, octx;
 
-	/* Save context */
-	__asm("mov	%0, %%o4" :: "n"(SRMMU_CXR));
-	__asm("lda	[%%o4]%0, %%o5" :: "n"(ASI_SRMMU));
-
-	/* Set new context and flush type bits */
 	va &= ~0xfff;
-	__asm("sta	%1, [%%o4]%0" :: "n"(ASI_SRMMU), "r"(ctx));
 	va |= lvl;
 
-	/* Do the TLB flush */
-	__asm("sta	%%g0, [%1]%0" :: "n"(ASI_SRMMUFP), "r"(va));
+	/*
+	 * Turn off traps.
+	 *
+	 * Like setpsr((opsr = getpsr()) & ~PSR_ET); but we can shave
+	 * off one instruction b/c we never disable traps recursively,
+	 * so we can use the xor done by wrpsr itself to clear the
+	 * bit.
+	 *
+	 * XXX: Add to asm.h?  We can use this in cache.c too.
+	 */
+	opsr = getpsr();	/* KDASSERT(opsr & PSR_ET); */
+	__asm volatile ("wr %0, %1, %%psr" :: "r"(opsr), "n"(PSR_ET));
+	__asm volatile ("nop; nop;nop");
+
+	octx = getcontext4m();	/* save context */
 
-	/* Restore context */
-	__asm("sta	%%o5, [%%o4]%0" :: "n"(ASI_SRMMU));
+	/* Do the TLB flush in "ctx" */
+	setcontext4m(ctx);
+	__asm volatile("sta %%g0, [%0]%1" :: "r"(va), "n"(ASI_SRMMUFP));
 
-	/* and turn traps on again */
-	__asm("wr	%o3, 0, %psr");
-	__asm("nop");
-	__asm("nop");
-	__asm("nop");
+	setcontext4m(octx);	/* restore context */
+	setpsr(opsr);		/* turn traps on again */
 }
 
 static inline void



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

2020-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec  6 03:19:15 UTC 2020

Modified Files:
src/sys/arch/sparc/include: types.h

Log Message:
undo previous; __register_t is already defined


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc/include/types.h

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

Modified files:

Index: src/sys/arch/sparc/include/types.h
diff -u src/sys/arch/sparc/include/types.h:1.69 src/sys/arch/sparc/include/types.h:1.70
--- src/sys/arch/sparc/include/types.h:1.69	Sat Dec  5 21:23:12 2020
+++ src/sys/arch/sparc/include/types.h	Sat Dec  5 22:19:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.69 2020/12/06 02:23:12 christos Exp $ */
+/*	$NetBSD: types.h,v 1.70 2020/12/06 03:19:14 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,10 +57,9 @@
 #include 
 #include 
 
-typedef unsigned long int	__register_t;
 /* The following are unsigned to prevent annoying sign extended pointers. */
 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
-typedef __register_t		register_t;
+typedef unsigned long int	register_t;
 #define	PRIxREGISTER		"lx"
 typedef unsigned int		register32_t;
 #define	PRIxREGISTER32		"x"



CVS commit: src/sys/arch/sparc/sparc

2020-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec  5 08:04:51 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: cpu.c

Log Message:
for boot -1, don't attach more than the boot CPU most others


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/arch/sparc/sparc/cpu.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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.256 src/sys/arch/sparc/sparc/cpu.c:1.257
--- src/sys/arch/sparc/sparc/cpu.c:1.256	Sat Jun 13 20:01:27 2020
+++ src/sys/arch/sparc/sparc/cpu.c	Sat Dec  5 08:04:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.256 2020/06/13 20:01:27 ad Exp $ */
+/*	$NetBSD: cpu.c,v 1.257 2020/12/05 08:04:51 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.256 2020/06/13 20:01:27 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.257 2020/12/05 08:04:51 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.25
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -486,6 +487,11 @@ cpu_attach(struct cpu_softc *sc, int nod
 
 #if defined(MULTIPROCESSOR)
 	if (cpu_attach_count > 1) {
+		if ((boothowto & RB_MD1) != 0) {
+			aprint_naive("\n");
+			aprint_normal(": multiprocessor boot disabled\n");
+			return;
+		}
 		cpu_attach_non_boot(sc, cpi, node);
 		cpu_init_evcnt(cpi);
 		cpu_setup_sysctl(sc);



CVS commit: src/sys/arch/sparc

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Nov 22 03:55:33 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: bootbus.c ebus.c fd.c pckbc_js.c sbus.c sw.c
vme_machdep.c
src/sys/arch/sparc/sparc: clock.c cpuunit.c intr.c machdep.c msiiep.c

Log Message:
malloc(9) -> kmem(9) (easy, straight-forward cases only, for now)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/bootbus.c \
src/sys/arch/sparc/dev/pckbc_js.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc/dev/ebus.c
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/sparc/dev/fd.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/sparc/dev/sbus.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/dev/sw.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc/dev/vme_machdep.c
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc/sparc/clock.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/sparc/cpuunit.c
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/sparc/sparc/intr.c
cvs rdiff -u -r1.334 -r1.335 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc/sparc/msiiep.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/sparc/dev/bootbus.c
diff -u src/sys/arch/sparc/dev/bootbus.c:1.19 src/sys/arch/sparc/dev/bootbus.c:1.20
--- src/sys/arch/sparc/dev/bootbus.c:1.19	Mon Jul 18 00:31:13 2011
+++ src/sys/arch/sparc/dev/bootbus.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $	*/
+/*	$NetBSD: bootbus.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,10 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -95,8 +96,7 @@ bootbus_attach(device_t parent, device_t
 	/*
 	 * Initialize the bus space tag we pass on to our children.
 	 */
-	sc->sc_bustag = malloc(sizeof(*sc->sc_bustag), M_DEVBUF,
-	M_WAITOK|M_ZERO);
+	sc->sc_bustag = kmem_zalloc(sizeof(*sc->sc_bustag), KM_SLEEP);
 	sc->sc_bustag->cookie = sc;
 	sc->sc_bustag->parent = sc->sc_st;
 	sc->sc_bustag->sparc_bus_map = sc->sc_st->sparc_bus_map;
Index: src/sys/arch/sparc/dev/pckbc_js.c
diff -u src/sys/arch/sparc/dev/pckbc_js.c:1.19 src/sys/arch/sparc/dev/pckbc_js.c:1.20
--- src/sys/arch/sparc/dev/pckbc_js.c:1.19	Sat Oct 13 17:58:54 2012
+++ src/sys/arch/sparc/dev/pckbc_js.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pckbc_js.c,v 1.19 2012/10/13 17:58:54 jdc Exp $ */
+/*	$NetBSD: pckbc_js.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,13 +28,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc_js.c,v 1.19 2012/10/13 17:58:54 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_js.c,v 1.20 2020/11/22 03:55:33 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -194,8 +194,7 @@ pckbc_js_attach_common(struct pckbc_js_s
 			return;
 		}
 
-		t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
-		memset(t, 0, sizeof(struct pckbc_internal));
+		t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
 		t->t_iot = iot;
 		t->t_ioh_d = ioh_d;
 		t->t_ioh_c = ioh_c;

Index: src/sys/arch/sparc/dev/ebus.c
diff -u src/sys/arch/sparc/dev/ebus.c:1.37 src/sys/arch/sparc/dev/ebus.c:1.38
--- src/sys/arch/sparc/dev/ebus.c:1.37	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/ebus.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: ebus.c,v 1.38 2020/11/22 03:55:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.37 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.38 2020/11/22 03:55:33 thorpej Exp $");
 
 #if defined(DEBUG) && !defined(EBUS_DEBUG)
 #define EBUS_DEBUG
@@ -56,6 +56,7 @@ int ebus_debug = 0;
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -421,8 +422,7 @@ ebus_alloc_dma_tag(struct ebus_softc *sc
 {
 	bus_dma_tag_t dt;
 
-	dt = (bus_dma_tag_t)
-		malloc(sizeof(struct sparc_bus_dma_tag), M_DEVBUF, M_WAITOK | M_ZERO);
+	dt = kmem_zalloc(sizeof(*dt), KM_SLEEP);
 	dt->_cookie = sc;
 #define PCOPY(x)	dt->x = pdt->x
 	PCOPY(_dmamap_create);

Index: src/sys/arch/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.160 src/sys/arch/sparc/dev/fd.c:1.161
--- src/sys/arch/sparc/dev/fd.c:1.160	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/fd.c	Sun Nov 22 03:55:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.160 2019/11/10 21:16:32 chs Exp $	*/
+/*	$NetBSD: fd.c,v 1.161 2020/11/22 03:55:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include 

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

2020-09-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Sep 14 09:47:43 UTC 2020

Modified Files:
src/sys/arch/sparc/include: ptrace.h

Log Message:
Switch from register_t to unsigned long int

Removes dependency on _KERNTYPES.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/include/ptrace.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/sparc/include/ptrace.h
diff -u src/sys/arch/sparc/include/ptrace.h:1.15 src/sys/arch/sparc/include/ptrace.h:1.16
--- src/sys/arch/sparc/include/ptrace.h:1.15	Tue Dec 24 14:50:59 2019
+++ src/sys/arch/sparc/include/ptrace.h	Mon Sep 14 09:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.15 2019/12/24 14:50:59 kamil Exp $ */
+/*	$NetBSD: ptrace.h,v 1.16 2020/09/14 09:47:43 kamil Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -55,14 +55,14 @@
 	"PT_SETFPREGS",
 
 #include 
-#define PTRACE_REG_PC(r)	((register_t)(r)->r_pc)
+#define PTRACE_REG_PC(r)	((unsigned long int)(r)->r_pc)
 #define PTRACE_REG_FP(r)	0 /* not stored in struct reg */
 #define PTRACE_REG_SET_PC(r, v)	do {	\
 	(r)->r_pc = (v);		\
 	(r)->r_npc = (v) + 4;		\
 } while (/*CONSTCOND*/0)
-#define PTRACE_REG_SP(r)	((register_t)(r)->r_out[6])
-#define PTRACE_REG_INTRV(r)	((register_t)(r)->r_out[0])
+#define PTRACE_REG_SP(r)	((unsigned long int)(r)->r_out[6])
+#define PTRACE_REG_INTRV(r)	((unsigned long int)(r)->r_out[0])
 
 #define PTRACE_ILLEGAL_ASM	__asm __volatile (".word 0" : : : "memory")
 



CVS commit: src/sys/arch/sparc/sparc

2020-08-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 14 13:45:44 UTC 2020

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

Log Message:
PR port-sparc/55573: remove kernel message about disabled coprocessor
instructions - it is triggered by userland trying to detect availability
of sparcv9 VIS instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/sparc/sparc/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/sparc/sparc/trap.c
diff -u src/sys/arch/sparc/sparc/trap.c:1.198 src/sys/arch/sparc/sparc/trap.c:1.199
--- src/sys/arch/sparc/sparc/trap.c:1.198	Sat Apr  6 03:06:27 2019
+++ src/sys/arch/sparc/sparc/trap.c	Fri Aug 14 13:45:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.198 2019/04/06 03:06:27 thorpej Exp $ */
+/*	$NetBSD: trap.c,v 1.199 2020/08/14 13:45:44 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.198 2019/04/06 03:06:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.199 2020/08/14 13:45:44 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_sunos.h"
@@ -606,7 +606,6 @@ trap(unsigned type, int psr, int pc, str
 		break;
 
 	case T_CPDISABLED:
-		uprintf("coprocessor instruction\n");	/* XXX */
 		sig = SIGILL;
 		KSI_INIT_TRAP();
 		ksi.ksi_trap = type;



CVS commit: src/sys/arch/sparc/sparc

2020-08-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 14 10:34:22 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
Adapt to new proplib api


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/sys/arch/sparc/sparc/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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.260 src/sys/arch/sparc/sparc/autoconf.c:1.261
--- src/sys/arch/sparc/sparc/autoconf.c:1.260	Mon Jun  8 02:27:08 2020
+++ src/sys/arch/sparc/sparc/autoconf.c	Fri Aug 14 10:34:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.260 2020/06/08 02:27:08 mrg Exp $ */
+/*	$NetBSD: autoconf.c,v 1.261 2020/08/14 10:34:22 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.260 2020/06/08 02:27:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.261 2020/08/14 10:34:22 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1636,7 +1636,7 @@ set_network_props(device_t dev, void *au
 
 	prom_getether(ofnode, eaddr);
 	dict = device_properties(dev);
-	blob = prop_data_create_data(eaddr, ETHER_ADDR_LEN);
+	blob = prop_data_create_copy(eaddr, ETHER_ADDR_LEN);
 	prop_dictionary_set(dict, "mac-address", blob);
 	prop_object_release(blob);
 }



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

2020-06-12 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Jun 13 05:31:29 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: tctrl.c

Log Message:
Initialise the mutex before we use it.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sparc/dev/tctrl.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/sparc/dev/tctrl.c
diff -u src/sys/arch/sparc/dev/tctrl.c:1.61 src/sys/arch/sparc/dev/tctrl.c:1.62
--- src/sys/arch/sparc/dev/tctrl.c:1.61	Wed Oct 25 08:12:37 2017
+++ src/sys/arch/sparc/dev/tctrl.c	Sat Jun 13 05:31:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tctrl.c,v 1.61 2017/10/25 08:12:37 maya Exp $	*/
+/*	$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.61 2017/10/25 08:12:37 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.62 2020/06/13 05:31:28 jdc Exp $");
 
 #include 
 #include 
@@ -260,6 +260,8 @@ tctrl_attach(device_t parent, device_t s
 
 	sc->sc_tft_on = 1;
 
+	mutex_init(>sc_requestlock, MUTEX_DEFAULT, IPL_NONE);
+
 	/* clear any pending data.
 	 */
 	for (i = 0; i < 1; i++) {
@@ -312,7 +314,6 @@ tctrl_attach(device_t parent, device_t s
 	sc->sc_ext_pending = 0;
 		sc->sc_ext_pending = 0;
 
-	mutex_init(>sc_requestlock, MUTEX_DEFAULT, IPL_NONE);
 	selinit(>sc_rsel);
 
 	/* setup sensors and register the power button */



CVS commit: src/sys/arch/sparc/sparc

2020-06-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jun  8 02:27:08 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
make find_cpus() static.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/sparc/sparc/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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.259 src/sys/arch/sparc/sparc/autoconf.c:1.260
--- src/sys/arch/sparc/sparc/autoconf.c:1.259	Sun Oct  4 08:15:46 2015
+++ src/sys/arch/sparc/sparc/autoconf.c	Mon Jun  8 02:27:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.259 2015/10/04 08:15:46 joerg Exp $ */
+/*	$NetBSD: autoconf.c,v 1.260 2020/06/08 02:27:08 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.259 2015/10/04 08:15:46 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.260 2020/06/08 02:27:08 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -144,7 +144,7 @@ static	void bootpath_build(void);
 static	void bootpath_fake(struct bootpath *, const char *);
 static	void bootpath_print(struct bootpath *);
 static	struct bootpath	*bootpath_store(int, struct bootpath *);
-int	find_cpus(void);
+static	int find_cpus(void);
 char	machine_model[100];
 
 #ifdef DEBUG
@@ -172,7 +172,7 @@ matchbyname(device_t parent, cfdata_t cf
  * Get the number of CPUs in the system and the CPUs' SPARC architecture
  * version. We need this information early in the boot process.
  */
-int
+static int
 find_cpus(void)
 {
 	int n;



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

2020-06-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun  3 02:51:40 UTC 2020

Modified Files:
src/sys/arch/sparc/stand/boot: Makefile

Log Message:
Appease clang -Waddress-of-packed-member for ,
in the same manner as done for sparc64; pointer substitution is just for
sanity check and harmless there.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc/stand/boot/Makefile

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/sparc/stand/boot/Makefile
diff -u src/sys/arch/sparc/stand/boot/Makefile:1.42 src/sys/arch/sparc/stand/boot/Makefile:1.43
--- src/sys/arch/sparc/stand/boot/Makefile:1.42	Fri Apr 28 13:38:35 2017
+++ src/sys/arch/sparc/stand/boot/Makefile	Wed Jun  3 02:51:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.42 2017/04/28 13:38:35 christos Exp $
+#	$NetBSD: Makefile,v 1.43 2020/06/03 02:51:39 rin Exp $
 
 STRIPFLAG=
 PROGSOURCE=	boot.c net.c netif_sun.c conf.c openfirm.c bootinfo.c \
@@ -14,6 +14,11 @@ CFLAGS+=	-freestanding
 INCLUDE_LIBZ=	yes
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=  -Wno-error=address-of-packed-member
+
 .include "../Makefile.buildboot"
 
 .if ${MACHINE} == sparc64



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

2020-05-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 17 06:30:44 UTC 2020

Modified Files:
src/sys/arch/sparc/include: types.h

Log Message:
__HAVE_CPU_DATA_FIRST is still true for sparc64 (which shares this file)


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sparc/include/types.h

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

Modified files:

Index: src/sys/arch/sparc/include/types.h
diff -u src/sys/arch/sparc/include/types.h:1.67 src/sys/arch/sparc/include/types.h:1.68
--- src/sys/arch/sparc/include/types.h:1.67	Sat May 16 17:52:42 2020
+++ src/sys/arch/sparc/include/types.h	Sun May 17 06:30:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.67 2020/05/16 17:52:42 ad Exp $ */
+/*	$NetBSD: types.h,v 1.68 2020/05/17 06:30:44 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -127,6 +127,7 @@ typedef unsigned long int	__register_t;
 #define	__HAVE_RAS
 
 #ifdef __sparc_v9__
+#define	__HAVE_CPU_DATA_FIRST
 #define	__HAVE_DEVICE_REGISTER_POSTCONFIG
 #define	__HAVE_ATOMIC64_OPS
 #define	__HAVE_CPU_COUNTER	/* sparc v9 CPUs have %tick */



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

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 17:52:42 UTC 2020

Modified Files:
src/sys/arch/sparc/include: cpu.h types.h

Log Message:
PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/sparc/include/types.h

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

Modified files:

Index: src/sys/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.107 src/sys/arch/sparc/include/cpu.h:1.108
--- src/sys/arch/sparc/include/cpu.h:1.107	Sat May 16 17:37:28 2020
+++ src/sys/arch/sparc/include/cpu.h	Sat May 16 17:52:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.107 2020/05/16 17:37:28 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.108 2020/05/16 17:52:42 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,8 +175,6 @@ struct xpmsg {
  */
 
 struct cpu_info {
-	struct cpu_data ci_data;	/* MI per-cpu data */
-
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -395,6 +393,8 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
+
+	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */

Index: src/sys/arch/sparc/include/types.h
diff -u src/sys/arch/sparc/include/types.h:1.66 src/sys/arch/sparc/include/types.h:1.67
--- src/sys/arch/sparc/include/types.h:1.66	Sat Jan 23 22:31:20 2016
+++ src/sys/arch/sparc/include/types.h	Sat May 16 17:52:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.66 2016/01/23 22:31:20 christos Exp $ */
+/*	$NetBSD: types.h,v 1.67 2020/05/16 17:52:42 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -123,7 +123,6 @@ typedef unsigned long int	__register_t;
 #define	__HAVE_NEW_STYLE_BUS_H
 #define	__HAVE_SYSCALL_INTERN
 #define	__GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
-#define __HAVE_CPU_DATA_FIRST
 #define	__HAVE_CPU_VMSPACE_EXEC
 #define	__HAVE_RAS
 



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

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 17:37:28 UTC 2020

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

Log Message:
Back out previous - it doesn't work.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/sparc/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/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.106 src/sys/arch/sparc/include/cpu.h:1.107
--- src/sys/arch/sparc/include/cpu.h:1.106	Fri May 15 18:45:08 2020
+++ src/sys/arch/sparc/include/cpu.h	Sat May 16 17:37:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.106 2020/05/15 18:45:08 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.107 2020/05/16 17:37:28 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,6 +175,8 @@ struct xpmsg {
  */
 
 struct cpu_info {
+	struct cpu_data ci_data;	/* MI per-cpu data */
+
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -393,8 +395,6 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
-
-	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */



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

2020-05-15 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri May 15 18:45:08 UTC 2020

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

Log Message:
PR port-sparc/55261: sparc still panics running ATF tests

Put cpu_data at the end of cpu_info to see how that modifies the symptom.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/sparc/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/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.105 src/sys/arch/sparc/include/cpu.h:1.106
--- src/sys/arch/sparc/include/cpu.h:1.105	Tue Mar 10 03:48:05 2020
+++ src/sys/arch/sparc/include/cpu.h	Fri May 15 18:45:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.105 2020/03/10 03:48:05 christos Exp $ */
+/*	$NetBSD: cpu.h,v 1.106 2020/05/15 18:45:08 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,8 +175,6 @@ struct xpmsg {
  */
 
 struct cpu_info {
-	struct cpu_data ci_data;	/* MI per-cpu data */
-
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -395,6 +393,8 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
+
+	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */



CVS commit: src/sys/arch/sparc/sparc

2020-05-11 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 11 18:38:27 UTC 2020

Modified Files:
src/sys/arch/sparc/sparc: process_machdep.c

Log Message:
Reject setting unaligned Program Counter

Patch taken from OpenBSD.

Tested in qemu.

Fixes PR port-sparc/54734 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/sparc/process_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/sparc/sparc/process_machdep.c
diff -u src/sys/arch/sparc/sparc/process_machdep.c:1.19 src/sys/arch/sparc/sparc/process_machdep.c:1.20
--- src/sys/arch/sparc/sparc/process_machdep.c:1.19	Fri Dec 30 17:54:43 2016
+++ src/sys/arch/sparc/sparc/process_machdep.c	Mon May 11 18:38:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.19 2016/12/30 17:54:43 christos Exp $ */
+/*	$NetBSD: process_machdep.c,v 1.20 2020/05/11 18:38:26 kamil Exp $ */
 
 /*
  * Copyright (c) 1993 The Regents of the University of California.
@@ -95,7 +95,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.19 2016/12/30 17:54:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.20 2020/05/11 18:38:26 kamil Exp $");
 
 #include 
 #include 
@@ -122,6 +122,9 @@ process_write_regs(struct lwp *l, const 
 {
 	int	psr = l->l_md.md_tf->tf_psr & ~PSR_ICC;
 
+	if (((regs->r_pc | regs->r_npc) & 0x03) != 0)
+		return EINVAL;
+
 	memcpy(l->l_md.md_tf, regs, sizeof(*regs));
 	l->l_md.md_tf->tf_psr = psr | (regs->r_psr & PSR_ICC);
 	return 0;
@@ -140,6 +143,9 @@ int
 process_set_pc(struct lwp *l, void *addr)
 {
 
+	if (((u_int)addr & 0x03) != 0)
+		return EINVAL;
+
 	l->l_md.md_tf->tf_pc = (u_int)addr;
 	l->l_md.md_tf->tf_npc = (u_int)addr + 4;
 	return 0;



CVS commit: src/sys/arch/sparc/stand/bootxx

2020-04-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Apr 23 00:11:29 UTC 2020

Modified Files:
src/sys/arch/sparc/stand/bootxx: Makefile

Log Message:
Uses LFS boot code


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/stand/bootxx/Makefile

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/sparc/stand/bootxx/Makefile
diff -u src/sys/arch/sparc/stand/bootxx/Makefile:1.17 src/sys/arch/sparc/stand/bootxx/Makefile:1.18
--- src/sys/arch/sparc/stand/bootxx/Makefile:1.17	Sun Jan 12 15:26:31 2014
+++ src/sys/arch/sparc/stand/bootxx/Makefile	Thu Apr 23 00:11:29 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2014/01/12 15:26:31 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.18 2020/04/23 00:11:29 joerg Exp $
 
 PROG=		bootxx
 PROGSOURCE=	bootxx.c
@@ -10,6 +10,11 @@ STRIPFLAG=
 LINKFLAGS=	-N -Ttext ${RELOC_BOOTXX} -e start
 CLEANFILES+=	${PROG}.sym
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+
 # XXX SHOULD NOT NEED TO DEFINE THESE!
 LIBCRT0=
 LIBCRTI=



CVS commit: src/sys/arch/sparc/stand/ofwboot

2020-04-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 20 02:04:44 UTC 2020

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
More -Wno-error=address-of-packed-member to placate clang.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc/stand/ofwboot/Makefile

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/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.38 src/sys/arch/sparc/stand/ofwboot/Makefile:1.39
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.38	Sat Apr  8 19:53:23 2017
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Mon Apr 20 02:04:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2017/04/08 19:53:23 christos Exp $
+#	$NetBSD: Makefile,v 1.39 2020/04/20 02:04:44 riastradh Exp $
 
 .include 
 
@@ -38,6 +38,11 @@ CPPFLAGS+=	-DSUPPORT_DHCP
 #CPPFLAGS+=	-DNETIF_DEBUG 
 #CPPFLAGS+=	-D_DEBUG
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+
 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
 
 NOMAN=		# defined



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

2020-04-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 12 06:05:34 UTC 2020

Modified Files:
src/sys/arch/sparc/conf: INSTALL

Log Message:
base INSTALL kernel upon GENERIC with many "no ...".


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc/conf/INSTALL

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

Modified files:

Index: src/sys/arch/sparc/conf/INSTALL
diff -u src/sys/arch/sparc/conf/INSTALL:1.103 src/sys/arch/sparc/conf/INSTALL:1.104
--- src/sys/arch/sparc/conf/INSTALL:1.103	Sun Jan 19 01:25:07 2020
+++ src/sys/arch/sparc/conf/INSTALL	Sun Apr 12 06:05:34 2020
@@ -1,18 +1,13 @@
-#	$NetBSD: INSTALL,v 1.103 2020/01/19 01:25:07 thorpej Exp $
+#	$NetBSD: INSTALL,v 1.104 2020/04/12 06:05:34 mrg Exp $
 #
 # from: NetBSD: GENERIC,v 1.84 1999/06/06 13:00:03 mrg Exp
 #
-# floppy install kernel.  try to keep this in sync with GENERIC but
-# leave as much disabled as possible.
+# floppy install kernel.  based upon GENERIC, with much turned off.
 
-include "arch/sparc/conf/std.sparc"
-
-#options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+include "arch/sparc/conf/GENERIC"
 
 makeoptions	COPTS="-Os"		# Optimise for space. Implies -O2
 
-maxusers	32
-
 # Enable the hooks used for initializing the root memory-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -24,546 +19,79 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 
 pseudo-device	md			# memory disk device (ramdisk)
 
-## System kernel configuration.  See options(4) for more detail.
-
-
-# Options for variants of the Sun SPARC architecure.
-# We currently support three architecture types; at least one is required.
-options 	SUN4		# sun4/100, sun4/200, sun4/300
-options 	SUN4C		# sun4c - SS1, 1+, 2, ELC, SLC, IPC, IPX, etc.
-options 	SUN4M		# sun4m - SS10, SS20, Classic, etc.
-
-options 	SUN4_MMU3L	# 3-level MMU on sun4/400
-
-## System options specific to the sparc machine type
-
-# Blink the power LED on some machines to indicate the system load.
-#options 	BLINK
-
-# wscons stuff
-#options 	WSEMUL_SUN
-options 	WSEMUL_VT100
+no options 	SUN4D
 options 	WSDISPLAY_DEFAULTSCREENS=1
-#options 	WSDISPLAY_COMPAT_USL		# wsconscfg VT handling
-options 	WSDISPLAY_COMPAT_RAWKBD
-options 	WSDISPLAY_CUSTOM_OUTPUT
-options 	WS_DEFAULT_FG=WSCOL_BLACK
-options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
-options 	WS_KERNEL_FG=WSCOL_GREEN
-options 	WS_KERNEL_BG=WSCOL_LIGHT_WHITE
-options 	FONT_GALLANT12x22	# the console font
-options 	FONT_BOLD8x16		# a somewhat smaller font
-
- System options that are the same for all ports
-
-## Root device configuration: change the ?'s if you are going to use a
-## nonstandard root partition (other than where the kernel is booted from)
-## and/or nonstandard root type (not ffs or nfs).  Normally this can be
-## automagically determined at boot time.
-
-config		netbsd	root on ? type ?
-
-## System call tracing (see ktrace(1)).
-#options 	KTRACE
-
-## System V compatible IPC subsystem.  (msgctl(2), semctl(2), and shmctl(2))
-#options 	SYSVMSG		# System V message queues
-#options 	SYSVSEM		# System V semaphores
-#options 	SYSVSHM		# System V shared memory
-
-options 	USERCONF	# userconf(4) support
-options 	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
-#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
-
-## NFS boot options; tries DHCP/BOOTP then BOOTPARAM
-options 	NFS_BOOT_BOOTPARAM
-#options 	NFS_BOOT_BOOTP
-options 	NFS_BOOT_DHCP
-
- Debugging options
-
-## The DDB in-kernel debugger runs at panic (unless DDB_ONPANIC=0), or at
-## serial console break or keyboard reset, where the PROM would normally
-## intercept.  DDB_HISTORY_SIZE adds up/down arrow command history.
-#options 	DDB			# kernel dynamic debugger
-#options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
-#options 	DDB_ONPANIC=1		# see also sysctl(7): `ddb.onpanic'
-
-## You may also use gdb, on another computer connected to this machine over
-## a serial port.  Both KGDB_DEV and KGDB_DEVRATE should be specified;
-## KGDB_DEV is a dev_t encoded device number of the serial port to use.
-## (0xc01 = ttya, 0xc02 = ttyb.)
-#options 	KGDB			# support for kernel gdb
-#options 	KGDB_DEV=0xc01		# kgdb device number (this is `ttyb')
-#options 	KGDB_DEVRATE=38400	# baud rate
-
-
-## Compile the kernel with debugging symbols (`netbsd.gdb' is the debug file),
-## such that gdb(1) can be used on a kernel coredump.
-
-#makeoptions	DEBUG="-g"
-
-
-## Adds code to the kernel that does internal consistency checks, and will
-## cause the kernel to panic if corruption of internal data structures
-## is detected.
-#options 	DIAGNOSTIC	# extra kernel sanity checking
-
-## Enable (possibly expensive) debugging code that may also display messages
-## on the system console
-#options 	DEBUG
-
-#options 	MIIVERBOSE	# verbose PHY autoconfig messages
-
-## Make SCSI error messages more verbose when 

CVS commit: src/sys/arch/sparc/sparc

2020-03-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Mar 22 21:21:07 UTC 2020

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

Log Message:
cpu_intr_p(): use cpuinfo (always the same VA) for preemption safety.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/arch/sparc/sparc/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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.124 src/sys/arch/sparc/sparc/intr.c:1.125
--- src/sys/arch/sparc/sparc/intr.c:1.124	Sat Mar 14 13:34:43 2020
+++ src/sys/arch/sparc/sparc/intr.c	Sun Mar 22 21:21:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $ */
+/*	$NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.125 2020/03/22 21:21:07 ad Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -889,17 +889,10 @@ intr_biglock_wrapper(void *vp)
 bool
 cpu_intr_p(void)
 {
-	uint64_t ncsw;
-	int idepth;
-	lwp_t *l;
-
-	l = curlwp;
-	do {
-		ncsw = l->l_ncsw;
-		__insn_barrier();
-		idepth = curcpu()->ci_idepth;
-		__insn_barrier();
-	} while (__predict_false(ncsw != l->l_ncsw));
 
-	return idepth != 0;
+	/* 
+	 * cpuinfo is the same VA on every CPU.  Even if preempted it will
+	 * give the correct answer.
+	 */
+	return cpuinfo.ci_idepth != 0;
 }



CVS commit: src/sys/arch/sparc/sparc

2020-03-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Mar 14 13:34:44 UTC 2020

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

Log Message:
sparc cpu_intr_p(): try to work around l_cpu not being set early on by
using curcpu().


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/sparc/sparc/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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.123 src/sys/arch/sparc/sparc/intr.c:1.124
--- src/sys/arch/sparc/sparc/intr.c:1.123	Tue Dec  3 15:20:59 2019
+++ src/sys/arch/sparc/sparc/intr.c	Sat Mar 14 13:34:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.123 2019/12/03 15:20:59 riastradh Exp $ */
+/*	$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.123 2019/12/03 15:20:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.124 2020/03/14 13:34:43 ad Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -897,7 +897,7 @@ cpu_intr_p(void)
 	do {
 		ncsw = l->l_ncsw;
 		__insn_barrier();
-		idepth = l->l_cpu->ci_idepth;
+		idepth = curcpu()->ci_idepth;
 		__insn_barrier();
 	} while (__predict_false(ncsw != l->l_ncsw));
 



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

2020-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 10 03:48:05 UTC 2020

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

Log Message:
tuck curproc/curlwp under _KERNEL only (no _KMEMUSER)


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/sparc/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/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.104 src/sys/arch/sparc/include/cpu.h:1.105
--- src/sys/arch/sparc/include/cpu.h:1.104	Mon Dec 30 17:13:47 2019
+++ src/sys/arch/sparc/include/cpu.h	Mon Mar  9 23:48:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.104 2019/12/30 22:13:47 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.105 2020/03/10 03:48:05 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -397,6 +397,11 @@ struct cpu_info {
 	struct evcnt ci_sintrcnt[16];
 };
 
+#endif /* _KERNEL || _KMEMUSER */
+
+/* Kernel only things. */
+#if defined(_KERNEL)
+
 /*
  * definitions of cpu-dependent requirements
  * referenced in generic code
@@ -408,10 +413,6 @@ struct cpu_info {
 
 #define	cpu_number()		(cpuinfo.ci_cpuid)
 
-#endif /* _KERNEL || _KMEMUSER */
-
-/* Kernel only things. */
-#if defined(_KERNEL)
 void	cpu_proc_fork(struct proc *, struct proc *);
 
 #if defined(MULTIPROCESSOR)



CVS commit: src/sys/arch/sparc/sparc

2020-01-12 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Jan 12 19:13:55 UTC 2020

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

Log Message:
Fix some more places in this file it's assumed cpu_info is smaller than 1kB.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.276 src/sys/arch/sparc/sparc/locore.s:1.277
--- src/sys/arch/sparc/sparc/locore.s:1.276	Wed Jan  8 20:59:19 2020
+++ src/sys/arch/sparc/sparc/locore.s	Sun Jan 12 19:13:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.276 2020/01/08 20:59:19 skrll Exp $	*/
+/*	$NetBSD: locore.s,v 1.277 2020/01/12 19:13:55 ad Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -2770,14 +2770,16 @@ lev14_softint:
 	addx	%l4, %g0, %l4
 	std	%l4, [%l7 + CPUINFO_LEV14]
 
-	ld	[%l6 + CPUINFO_XMSG_TRAP], %l7
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_TRAP), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_TRAP)], %l7
 #ifdef DIAGNOSTIC
 	tst	%l7
 	bz	sparc_interrupt4m_bogus
 	 nop
 #endif
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG0), %l6
 	jmp	%l7
-	 ld	[%l6 + CPUINFO_XMSG_ARG0], %l3	! prefetch 1st arg
+	 ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG0)], %l3	! prefetch 1st arg
 
 /*
  * Fast flush handlers. xcalled from other CPUs throught soft interrupt 14
@@ -2789,9 +2791,11 @@ lev14_softint:
  */
 _ENTRY(_C_LABEL(ft_tlb_flush))
 	!	<%l3 already fetched for us>	! va
-	ld	[%l6 + CPUINFO_XMSG_ARG2], %l5	! level
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG2), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG2)], %l5	! level
 	andn	%l3, 0xfff, %l3			! %l3 = (va&~0xfff | lvl);
-	ld	[%l6 + CPUINFO_XMSG_ARG1], %l4	! context
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4	! context
 	or	%l3, %l5, %l3
 
 	mov	SRMMU_CXR, %l7			!
@@ -2805,7 +2809,8 @@ ft_rett:
 	! enter here with %l5 = ctx to restore, %l6 = CPUINFO_VA, %l7 = ctx reg
 	mov	1, %l4!
 	sta	%l5, [%l7]ASI_SRMMU		! restore context
-	st	%l4, [%l6 + CPUINFO_XMSG_CMPLT]	! completed = 1
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_CMPLT), %l6
+	st	%l4, [%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_CMPLT)]	! completed = 1
 
 	mov	%l0, %psr			! return from trap
 	 nop
@@ -2813,21 +2818,24 @@ ft_rett:
 
 _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_page))
 	!	<%l3 already fetched for us>	! va
-	ld	[%l6 + CPUINFO_XMSG_ARG1], %l4	! context
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4	! context
 
 	mov	SRMMU_CXR, %l7			!
 	lda	[%l7]ASI_SRMMU, %l5		! %l5 = old context
 	sta	%l4, [%l7]ASI_SRMMU		! set new context
 
 	set	4096, %l4			! N = page size
-	ld	[%l6 + CPUINFO_CACHE_LINESZ], %l7
+	sethi	%hi(CPUINFO_VA+CPUINFO_CACHE_LINESZ), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_LINESZ)], %l7
 1:
 	sta	%g0, [%l3]ASI_IDCACHELFP	!  flush cache line
 	subcc	%l4, %l7, %l4			!  p += linesz;
 	bgu	1b! while ((N -= linesz) > 0)
 	 add	%l3, %l7, %l3
 
-	ld	[%l6 + CPUINFO_XMSG_ARG0], %l3	! reload va
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG0), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG0)], %l3	! reload va
 	!or	%l3, ASI_SRMMUFP_L3(=0), %l3	! va |= ASI_SRMMUFP_L3
 	sta	%g0, [%l3]ASI_SRMMUFP		! flush TLB
 
@@ -2836,8 +2844,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_pa
 
 _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_segment))
 	!	<%l3 already fetched for us>	! vr
-	ld	[%l6 + CPUINFO_XMSG_ARG1], %l5	! vs
-	ld	[%l6 + CPUINFO_XMSG_ARG2], %l4	! context
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l5	! vs
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG2), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG2)], %l4	! context
 
 	sll	%l3, 24, %l3			! va = VSTOVA(vr,vs)
 	sll	%l5, 18, %l5
@@ -2847,8 +2857,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_se
 	lda	[%l7]ASI_SRMMU, %l5		! %l5 = old context
 	sta	%l4, [%l7]ASI_SRMMU		! set new context
 
-	ld	[%l6 + CPUINFO_CACHE_NLINES], %l4
-	ld	[%l6 + CPUINFO_CACHE_LINESZ], %l7
+	sethi	%hi(CPUINFO_VA+CPUINFO_CACHE_NLINES), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_NLINES)], %l4
+	sethi	%hi(CPUINFO_VA+CPUINFO_CACHE_LINESZ), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_CACHE_LINESZ)], %l7
 1:
 	sta	%g0, [%l3]ASI_IDCACHELFS	!  flush cache line
 	deccc	%l4!  p += linesz;
@@ -2860,7 +2872,8 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_se
 
 _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_region))
 	!	<%l3 already fetched for us>	! vr
-	ld	[%l6 + CPUINFO_XMSG_ARG1], %l4	! context
+	sethi	%hi(CPUINFO_VA+CPUINFO_XMSG_ARG1), %l6
+	ld	[%l6 + %lo(CPUINFO_VA+CPUINFO_XMSG_ARG1)], %l4	! context
 
 	sll	%l3, 24, %l3			! va = VRTOVA(vr)
 
@@ -2868,8 +2881,10 @@ _ENTRY(_C_LABEL(ft_srmmu_vcache_flush_re
 	lda	[%l7]ASI_SRMMU, %l5		! %l5 = old context
 	sta	%l4, [%l7]ASI_SRMMU		! set new context
 
-	ld	[%l6 + CPUINFO_CACHE_NLINES], %l4
-	ld	[%l6 + 

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

2020-01-02 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan  2 22:32:20 UTC 2020

Modified Files:
src/sys/arch/sparc/dev: rtc.c

Log Message:
- Use todr_gettime_ymdhms / todr_settime_ymdhms.
- Allocate the todr_handle with the softc, not separately.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sparc/dev/rtc.c

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

Modified files:

Index: src/sys/arch/sparc/dev/rtc.c
diff -u src/sys/arch/sparc/dev/rtc.c:1.19 src/sys/arch/sparc/dev/rtc.c:1.20
--- src/sys/arch/sparc/dev/rtc.c:1.19	Sun Nov 10 21:16:32 2019
+++ src/sys/arch/sparc/dev/rtc.c	Thu Jan  2 22:32:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $ */
+/*	$NetBSD: rtc.c,v 1.20 2020/01/02 22:32:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 Valeriy E. Ushakov
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19 2019/11/10 21:16:32 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.20 2020/01/02 22:32:20 thorpej Exp $");
 
 #include 
 #include 
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.19
 struct rtc_ebus_softc {
 	bus_space_tag_t		sc_bt;	/* parent bus tag */
 	bus_space_handle_t	sc_bh;	/* handle for registers */
+	struct todr_chip_handle	sc_todr;/* TODR handle */
 };
 
 static int	rtcmatch_ebus(device_t, cfdata_t, void *);
@@ -65,16 +66,12 @@ static void	rtcattach_ebus(device_t, dev
 CFATTACH_DECL_NEW(rtc_ebus, sizeof(struct rtc_ebus_softc),
 rtcmatch_ebus, rtcattach_ebus, NULL, NULL);
 
-/* XXX: global TOD clock handle (sparc/clock.c) */
-extern todr_chip_handle_t todr_handle;
-
 /* todr(9) methods */
-static int rtc_gettime(todr_chip_handle_t, struct timeval *);
-static int rtc_settime(todr_chip_handle_t, struct timeval *);
+static int rtc_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+static int rtc_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
 
 int rtc_auto_century_adjust = 1; /* XXX: do we ever want not to? */
 
-
 /*
  * MD read/write functions declared in mc146818reg.h
  */
@@ -134,27 +131,23 @@ rtcattach_ebus(device_t parent, device_t
 	mc146818_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);
 
 	/* setup our todr_handle */
-	handle = malloc(ALIGN(sizeof(struct todr_chip_handle)),
-			M_DEVBUF, M_WAITOK);
+	handle = >sc_todr;
 	handle->cookie = sc;
 	handle->bus_cookie = NULL; /* unused */
-	handle->todr_gettime = rtc_gettime;
-	handle->todr_settime = rtc_settime;
+	handle->todr_gettime = NULL;
+	handle->todr_settime = NULL;
+	handle->todr_gettime_ymdhms = rtc_gettime_ymdhms;
+	handle->todr_settime_ymdhms = rtc_settime_ymdhms;
 	handle->todr_setwen = NULL; /* not necessary, no idprom to protect */
 
 	todr_attach(handle);
 }
 
 
-/*
- * Get time-of-day and convert to a `struct timeval'
- * Return 0 on success; an error number otherwise.
- */
 static int
-rtc_gettime(todr_chip_handle_t handle, struct timeval *tv)
+rtc_gettime_ymdhms(todr_chip_handle_t handle, struct clock_ymdhms *dt)
 {
 	struct rtc_ebus_softc *sc = handle->cookie;
-	struct clock_ymdhms dt;
 	u_int year;
 
 	/* update in progress; spin loop */
@@ -166,12 +159,12 @@ rtc_gettime(todr_chip_handle_t handle, s
 		   (mc146818_read(sc, MC_REGB) | MC_REGB_SET));
 
 	/* read time */
-	dt.dt_sec  = mc146818_read(sc, MC_SEC);
-	dt.dt_min  = mc146818_read(sc, MC_MIN);
-	dt.dt_hour = mc146818_read(sc, MC_HOUR);
-	dt.dt_day  = mc146818_read(sc, MC_DOM);
-	dt.dt_mon  = mc146818_read(sc, MC_MONTH);
-	year   = mc146818_read(sc, MC_YEAR);
+	dt->dt_sec  = mc146818_read(sc, MC_SEC);
+	dt->dt_min  = mc146818_read(sc, MC_MIN);
+	dt->dt_hour = mc146818_read(sc, MC_HOUR);
+	dt->dt_day  = mc146818_read(sc, MC_DOM);
+	dt->dt_mon  = mc146818_read(sc, MC_MONTH);
+	year= mc146818_read(sc, MC_YEAR);
 
 	/* reenable updates */
 	mc146818_write(sc, MC_REGB,
@@ -181,32 +174,18 @@ rtc_gettime(todr_chip_handle_t handle, s
 	year += 1900;
 	if (year < POSIX_BASE_YEAR && rtc_auto_century_adjust != 0)
 		year += 100;
-	dt.dt_year = year;
+	dt->dt_year = year;
 
-	/* simple sanity checks */
-	if (dt.dt_mon > 12 || dt.dt_day > 31
-	|| dt.dt_hour >= 24 || dt.dt_min >= 60 || dt.dt_sec >= 60)
-		return (ERANGE);
-
-	tv->tv_sec = clock_ymdhms_to_secs();
-	tv->tv_usec = 0;
 	return (0);
 }
 
-/*
- * Set the time-of-day clock based on the value of the `struct timeval' arg.
- * Return 0 on success; an error number otherwise.
- */
 static int
-rtc_settime(todr_chip_handle_t handle, struct timeval *tv)
+rtc_settime_ymdhms(todr_chip_handle_t handle, struct clock_ymdhms *dt)
 {
 	struct rtc_ebus_softc *sc = handle->cookie;
-	struct clock_ymdhms dt;
 	u_int year;
 
-	clock_secs_to_ymdhms(tv->tv_sec, );
-
-	year = dt.dt_year - 1900;
+	year = dt->dt_year - 1900;
 	if (year >= 100 && rtc_auto_century_adjust != 0)
 		year -= 100;
 
@@ -214,12 +193,12 @@ rtc_settime(todr_chip_handle_t handle, s
 	mc146818_write(sc, MC_REGB,
 		   (mc146818_read(sc, 

CVS commit: src/sys/arch/sparc

2019-12-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Mon Dec 30 22:13:47 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: apc.c
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc/sparc: clkctrl.c lock_stubs.s locore.s msiiep.c

Log Message:
PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc/dev/apc.c
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/sparc/clkctrl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/sparc/lock_stubs.s
cvs rdiff -u -r1.274 -r1.275 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc/sparc/msiiep.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/sparc/dev/apc.c
diff -u src/sys/arch/sparc/dev/apc.c:1.1 src/sys/arch/sparc/dev/apc.c:1.2
--- src/sys/arch/sparc/dev/apc.c:1.1	Fri Jan 15 20:57:12 2010
+++ src/sys/arch/sparc/dev/apc.c	Mon Dec 30 22:13:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: apc.c,v 1.1 2010/01/15 20:57:12 bouyer Exp $	*/
+/*	$NetBSD: apc.c,v 1.2 2019/12/30 22:13:46 ad Exp $	*/
 
 /*
  * Copyright (c) 2010 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: apc.c,v 1.1 2010/01/15 20:57:12 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apc.c,v 1.2 2019/12/30 22:13:46 ad Exp $");
 
 
 /*
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: apc.c,v 1.1 
 
 static int apcmatch(device_t, struct cfdata *, void *);
 static void apcattach(device_t, device_t, void *);
-static void apc_cpu_sleep(struct cpu_info *);
+static void apc_cpu_sleep(void);
 
 struct apc_softc {
 	device_t	sc_dev;
@@ -86,7 +86,7 @@ apcattach(device_t parent, device_t self
 }
 
 static void
-apc_cpu_sleep(struct cpu_info *ci)
+apc_cpu_sleep(void)
 {
 	uint8_t val;
 	if (apc == NULL)

Index: src/sys/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.103 src/sys/arch/sparc/include/cpu.h:1.104
--- src/sys/arch/sparc/include/cpu.h:1.103	Sun Dec  1 15:34:45 2019
+++ src/sys/arch/sparc/include/cpu.h	Mon Dec 30 22:13:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.103 2019/12/01 15:34:45 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.104 2019/12/30 22:13:47 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -374,7 +374,7 @@ struct cpu_info {
 	 * unrecoverable faults end up here.
 	 */
 	void		(*memerr)(unsigned, u_int, u_int, struct trapframe *);
-	void		(*idlespin)(struct cpu_info *);
+	void		(*idlespin)(void);
 	/* Module Control Registers */
 	/*bus_space_handle_t*/ long ci_mbusport;
 	/*bus_space_handle_t*/ long ci_mxccregs;

Index: src/sys/arch/sparc/sparc/clkctrl.c
diff -u src/sys/arch/sparc/sparc/clkctrl.c:1.5 src/sys/arch/sparc/sparc/clkctrl.c:1.6
--- src/sys/arch/sparc/sparc/clkctrl.c:1.5	Sun Jul 17 23:32:37 2011
+++ src/sys/arch/sparc/sparc/clkctrl.c	Mon Dec 30 22:13:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: clkctrl.c,v 1.5 2011/07/17 23:32:37 mrg Exp $	*/
+/*	$NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $	*/
 
 /*
  * Copyright (c) 2005 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.5 2011/07/17 23:32:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clkctrl.c,v 1.6 2019/12/30 22:13:47 ad Exp $");
 
 #include 
 #include 
@@ -44,7 +44,7 @@ static void clkctrl_attach(device_t, dev
 CFATTACH_DECL_NEW(clkctrl, 0,
  clkctrl_match, clkctrl_attach, NULL, NULL);
 
-static void tadpole_cpu_sleep(struct cpu_info *);
+static void tadpole_cpu_sleep(void);
 volatile uint8_t *clkctrl_reg = NULL;
 
 static int
@@ -91,8 +91,9 @@ clkctrl_attach(device_t parent, device_t
 
 /* ARGSUSED */
 static void
-tadpole_cpu_sleep(struct cpu_info *ci)
+tadpole_cpu_sleep(void)
 {
+
 	if (clkctrl_reg == 0)
 		return;
 	*clkctrl_reg = 0;

Index: src/sys/arch/sparc/sparc/lock_stubs.s
diff -u src/sys/arch/sparc/sparc/lock_stubs.s:1.12 src/sys/arch/sparc/sparc/lock_stubs.s:1.13
--- src/sys/arch/sparc/sparc/lock_stubs.s:1.12	Sun May 25 15:56:12 2008
+++ src/sys/arch/sparc/sparc/lock_stubs.s	Mon Dec 30 22:13:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.12 2008/05/25 15:56:12 chs Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.13 2019/12/30 22:13:47 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -122,10 +122,10 @@ ENTRY(mutex_exit)
  * void mutex_spin_enter(kmutex_t *);
  */
 ENTRY(mutex_spin_enter)
-	sethi	%hi(CPUINFO_VA), %o4
-	ld	[ %o4 + CPUINFO_MTX_COUNT ], %o5
+	sethi	%hi(CPUINFO_VA+CPUINFO_MTX_COUNT), %o4
+	ld	[ %o4 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ], %o5
 	sub	%o5, 1, %o1
-	st	%o1, [ %o4 + CPUINFO_MTX_COUNT ]
+	st	%o1, [ %o4 + %lo(CPUINFO_VA+CPUINFO_MTX_COUNT) ]
 	ldub	[ %o0 + MTX_IPL ], %o2
 	rd	%psr, %o1
 	sll	%o2, 8, %o2
@@ -140,8 +140,9 @@ ENTRY(mutex_spin_enter)
 	nop
 	tst	%o5
 1:
+	sethi	%hi(CPUINFO_VA+CPUINFO_MTX_OLDSPL), %o4
 	bz,a	2f
-	 st	%o3, [ %o4 + 

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

2019-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 17 15:42:02 UTC 2019

Modified Files:
src/sys/arch/sparc/include: ptrace.h

Log Message:
Make the illegal instruction macro safe, so the compiler does not fear it
would be an illegal instruction when compiling with certain cpu options.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/include/ptrace.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/sparc/include/ptrace.h
diff -u src/sys/arch/sparc/include/ptrace.h:1.12 src/sys/arch/sparc/include/ptrace.h:1.13
--- src/sys/arch/sparc/include/ptrace.h:1.12	Tue Apr 16 11:38:21 2019
+++ src/sys/arch/sparc/include/ptrace.h	Wed Apr 17 15:42:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.12 2019/04/16 11:38:21 martin Exp $ */
+/*	$NetBSD: ptrace.h,v 1.13 2019/04/17 15:42:02 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,7 +63,7 @@
 #define PTRACE_REG_SP(r)	((register_t)(r)->r_out[6])
 #define PTRACE_REG_INTRV(r)	((register_t)(r)->r_out[0])
 
-#define PTRACE_ILLEGAL_ASM	__asm __volatile ("illtrap 0" : : : "memory")
+#define PTRACE_ILLEGAL_ASM	__asm __volatile (".word 0" : : : "memory")
 
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x91, 0xd0, 0x20, 0x01 })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile("ta 1")



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

2019-04-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 16 11:38:21 UTC 2019

Modified Files:
src/sys/arch/sparc/include: ptrace.h

Log Message:
Add PTRACE_ILLEGAL_ASM


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc/include/ptrace.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/sparc/include/ptrace.h
diff -u src/sys/arch/sparc/include/ptrace.h:1.11 src/sys/arch/sparc/include/ptrace.h:1.12
--- src/sys/arch/sparc/include/ptrace.h:1.11	Wed Apr 12 18:18:00 2017
+++ src/sys/arch/sparc/include/ptrace.h	Tue Apr 16 11:38:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.11 2017/04/12 18:18:00 kamil Exp $ */
+/*	$NetBSD: ptrace.h,v 1.12 2019/04/16 11:38:21 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,6 +63,8 @@
 #define PTRACE_REG_SP(r)	((register_t)(r)->r_out[6])
 #define PTRACE_REG_INTRV(r)	((register_t)(r)->r_out[0])
 
+#define PTRACE_ILLEGAL_ASM	__asm __volatile ("illtrap 0" : : : "memory")
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x91, 0xd0, 0x20, 0x01 })
 #define PTRACE_BREAKPOINT_ASM	__asm __volatile("ta 1")
 #define PTRACE_BREAKPOINT_SIZE	4



CVS commit: src/sys/arch/sparc/sparc

2019-04-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Apr  6 16:22:01 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc: db_trace.c

Log Message:
Fix building crash(8) on sparc after ufetch / ustore changes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sparc/sparc/db_trace.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/sparc/sparc/db_trace.c
diff -u src/sys/arch/sparc/sparc/db_trace.c:1.36 src/sys/arch/sparc/sparc/db_trace.c:1.37
--- src/sys/arch/sparc/sparc/db_trace.c:1.36	Sat Apr  6 03:06:27 2019
+++ src/sys/arch/sparc/sparc/db_trace.c	Sat Apr  6 16:22:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.36 2019/04/06 03:06:27 thorpej Exp $ */
+/*	$NetBSD: db_trace.c,v 1.37 2019/04/06 16:22:01 thorpej Exp $ */
 
 /*
  * Mach Operating System
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2019/04/06 03:06:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2019/04/06 16:22:01 thorpej Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -51,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #define ONINTSTACK(fr)	(0)
 #endif
 
+#ifdef _KERNEL
 static db_addr_t
 db_fetch_word(const void *uaddr)
 {
@@ -60,6 +62,7 @@ db_fetch_word(const void *uaddr)
 		val = (u_int)-1;
 	return val;
 }
+#endif /* _KERNEL */
 
 void
 db_stack_trace_print(db_expr_t addr, bool have_addr,



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

2019-03-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 20:18:09 UTC 2019

Modified Files:
src/sys/arch/sparc/include: vmparam.h

Log Message:
remove extra token


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc/include/vmparam.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/sparc/include/vmparam.h
diff -u src/sys/arch/sparc/include/vmparam.h:1.47 src/sys/arch/sparc/include/vmparam.h:1.48
--- src/sys/arch/sparc/include/vmparam.h:1.47	Fri Mar 29 08:51:15 2019
+++ src/sys/arch/sparc/include/vmparam.h	Fri Mar 29 16:18:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.47 2019/03/29 12:51:15 christos Exp $ */
+/*	$NetBSD: vmparam.h,v 1.48 2019/03/29 20:18:09 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -74,7 +74,7 @@
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4
 #endif
 
-#ifdef	PAGE_SHIFT		PAGE_SHIFT_SUN4
+#ifdef	PAGE_SHIFT
 #define	PAGE_SIZE		(1 << PAGE_SHIFT)
 #define	PAGE_MASK		(PAGE_SIZE - 1)
 #endif



CVS commit: src/sys/arch/sparc/stand/bootblk

2019-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 00:07:39 UTC 2019

Modified Files:
src/sys/arch/sparc/stand/bootblk: Makefile

Log Message:
no more _LKM -> _MODULE


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/stand/bootblk/Makefile

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/sparc/stand/bootblk/Makefile
diff -u src/sys/arch/sparc/stand/bootblk/Makefile:1.16 src/sys/arch/sparc/stand/bootblk/Makefile:1.17
--- src/sys/arch/sparc/stand/bootblk/Makefile:1.16	Sat Oct  1 09:57:44 2016
+++ src/sys/arch/sparc/stand/bootblk/Makefile	Thu Mar 28 20:07:39 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2016/10/01 13:57:44 christos Exp $
+#	$NetBSD: Makefile,v 1.17 2019/03/29 00:07:39 christos Exp $
 
 .include	
 
@@ -21,7 +21,7 @@ STRIPFLAG=
 USE_GENASSYM?=	no
 
 INCLUDES=	-I. -I$S/arch -I$S -I${S}/../common/include -nostdinc
-CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_LKM -D_KERNEL
+CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_MODULE -D_KERNEL
 
 ffs.fth.h: genfth.cf machine sparc
 	${TOOL_GENASSYM} -f -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \



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

2019-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 00:08:14 UTC 2019

Modified Files:
src/sys/arch/sparc/include: vmparam.h

Log Message:
add more exceptions for standalone and modules


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/sparc/include/vmparam.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/sparc/include/vmparam.h
diff -u src/sys/arch/sparc/include/vmparam.h:1.45 src/sys/arch/sparc/include/vmparam.h:1.46
--- src/sys/arch/sparc/include/vmparam.h:1.45	Thu Mar 28 11:44:51 2019
+++ src/sys/arch/sparc/include/vmparam.h	Thu Mar 28 20:08:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.45 2019/03/28 15:44:51 christos Exp $ */
+/*	$NetBSD: vmparam.h,v 1.46 2019/03/29 00:08:13 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -72,7 +72,8 @@
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4CM
 #elif CPU_NTYPES == 1 && defined(SUN4)
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4
-#elif defined(_KERNEL) && !defined(_RUMPKERNEL)
+#elif defined(_KERNEL) && !defined(_RUMPKERNEL) \
+&& !defined(STANDALONE) && !defined(_MODULE)
 #error "Cannot determine page size"
 #else
 /* Default to max for userland */



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

2019-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 28 15:44:51 UTC 2019

Modified Files:
src/sys/arch/sparc/include: vmparam.h

Log Message:
make rump work again..


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc/include/vmparam.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/sparc/include/vmparam.h
diff -u src/sys/arch/sparc/include/vmparam.h:1.44 src/sys/arch/sparc/include/vmparam.h:1.45
--- src/sys/arch/sparc/include/vmparam.h:1.44	Wed Mar 27 15:01:44 2019
+++ src/sys/arch/sparc/include/vmparam.h	Thu Mar 28 11:44:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.44 2019/03/27 19:01:44 christos Exp $ */
+/*	$NetBSD: vmparam.h,v 1.45 2019/03/28 15:44:51 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -72,7 +72,7 @@
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4CM
 #elif CPU_NTYPES == 1 && defined(SUN4)
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4
-#elif defined(_KERNEL)
+#elif defined(_KERNEL) && !defined(_RUMPKERNEL)
 #error "Cannot determine page size"
 #else
 /* Default to max for userland */



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

2019-03-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 27 19:01:44 UTC 2019

Modified Files:
src/sys/arch/sparc/include: vmparam.h

Log Message:
provide the max page size for userland


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc/include/vmparam.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/sparc/include/vmparam.h
diff -u src/sys/arch/sparc/include/vmparam.h:1.43 src/sys/arch/sparc/include/vmparam.h:1.44
--- src/sys/arch/sparc/include/vmparam.h:1.43	Mon Jan  7 11:59:18 2013
+++ src/sys/arch/sparc/include/vmparam.h	Wed Mar 27 15:01:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.43 2013/01/07 16:59:18 chs Exp $ */
+/*	$NetBSD: vmparam.h,v 1.44 2019/03/27 19:01:44 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -62,18 +62,25 @@
 #define	PAGE_SHIFT_SUN4		13
 #define	PAGE_SHIFT_SUN4CM	12
 
-#define	MIN_PAGE_SIZE		(1 << PAGE_SHIFT_SUN4CM)
-#define	MAX_PAGE_SIZE		(1 << PAGE_SHIFT_SUN4)
+#define MAX_PAGE_SHIFT		PAGE_SHIFT_SUN4
+#define MIN_PAGE_SHIFT		PAGE_SHIFT_SUN4CM
+
+#define	MIN_PAGE_SIZE		(1 << MIN_PAGE_SHIFT)
+#define	MAX_PAGE_SIZE		(1 << MAX_PAGE_SHIFT)
 
 #if CPU_NTYPES != 0 && !defined(SUN4)
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4CM
-#define	PAGE_SIZE		(1 << PAGE_SHIFT)
-#define	PAGE_MASK		(PAGE_SIZE - 1)
 #elif CPU_NTYPES == 1 && defined(SUN4)
 #define	PAGE_SHIFT		PAGE_SHIFT_SUN4
+#elif defined(_KERNEL)
+#error "Cannot determine page size"
+#else
+/* Default to max for userland */
+#define	PAGE_SHIFT		MAX_PAGE_SHIFT
+#endif
+
 #define	PAGE_SIZE		(1 << PAGE_SHIFT)
 #define	PAGE_MASK		(PAGE_SIZE - 1)
-#endif
 
 /*
  * USRSTACK is the top (end) of the user stack.



CVS commit: src/sys/arch/sparc/sparc

2019-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  2 14:21:19 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc: pci_fixup.c

Log Message:
Catch up with MI pci changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/pci_fixup.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/sparc/sparc/pci_fixup.c
diff -u src/sys/arch/sparc/sparc/pci_fixup.c:1.2 src/sys/arch/sparc/sparc/pci_fixup.c:1.3
--- src/sys/arch/sparc/sparc/pci_fixup.c:1.2	Fri Mar  1 04:25:59 2019
+++ src/sys/arch/sparc/sparc/pci_fixup.c	Sat Mar  2 09:21:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_fixup.c,v 1.2 2019/03/01 09:25:59 msaitoh Exp $	*/
+/*	$NetBSD: pci_fixup.c,v 1.3 2019/03/02 14:21:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -323,8 +323,8 @@ mspcic_pci_fixup(int depth, pcitag_t sta
 
 	/* Secondary bus = startbus, subordinate bus = 0xff */
 	pci_conf_write(NULL, starttag, PCI_BRIDGE_BUS_REG,
-	((startbus & 0xff) << PCI_BRIDGE_BUS_SECONDARY_SHIFT) |
-	(0xff << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
+	__SHIFTIN(startbus & 0xff,  PCI_BRIDGE_BUS_SECONDARY) |
+	__SHIFTIN(0xff, PCI_BRIDGE_BUS_SUBORDINATE));
 
 	/*
 	 * Fix up bus numbering, bus addresses, device addresses,
@@ -441,8 +441,8 @@ mspcic_pci_fixup(int depth, pcitag_t sta
 
 	/* Secondary bus = startbus, subordinate bus = maxbus */
 	pci_conf_write(NULL, starttag, PCI_BRIDGE_BUS_REG,
-	((startbus & 0xff) << PCI_BRIDGE_BUS_SECONDARY_SHIFT) |
-	((*maxbus & 0xff) << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
+	__SHIFTIN(startbus & 0xff,  PCI_BRIDGE_BUS_SECONDARY) |
+	__SHIFTIN(*maxbus & 0xff, PCI_BRIDGE_BUS_SUBORDINATE));
 
 	/* 16-bit I/O range */
 	val = ((startio & 0xf000) >> 8) | ((*(io) - 1) & 0xf000);



CVS commit: src/sys/arch/sparc/sparc

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:33:55 UTC 2019

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

Log Message:
since SX can trigger NMIs dump the status and error registers along with
the rest if sx is present.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/sparc/sparc/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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.120 src/sys/arch/sparc/sparc/intr.c:1.121
--- src/sys/arch/sparc/sparc/intr.c:1.120	Mon Feb  4 09:57:39 2019
+++ src/sys/arch/sparc/sparc/intr.c	Fri Mar  1 02:33:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $ */
+/*	$NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,10 +41,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.121 2019/03/01 02:33:55 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
+#include "sx.h"
 
 #include 
 #include 
@@ -70,6 +71,11 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.1
 #include 
 #endif
 
+#if NSX > 0
+#include 
+#include 
+#endif
+
 #if defined(MULTIPROCESSOR)
 static int intr_biglock_wrapper(void *);
 
@@ -255,7 +261,10 @@ nmi_hard(void)
 	si = *((uint32_t *)ICR_SI_PEND);
 	snprintb(bits, sizeof(bits), SINTR_BITS, si);
 	printf("cpu%d: NMI: system interrupts: %s\n", cpu_number(), bits);
-		
+
+#if NSX > 0
+	sx_dump();
+#endif
 
 	if ((si & SINTR_M) != 0) {
 		/* ECC memory error */



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

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:30:42 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: sx.c sxvar.h

Log Message:
adapt to changes in sxreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc/dev/sx.c \
src/sys/arch/sparc/dev/sxvar.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/sparc/dev/sx.c
diff -u src/sys/arch/sparc/dev/sx.c:1.3 src/sys/arch/sparc/dev/sx.c:1.4
--- src/sys/arch/sparc/dev/sx.c:1.3	Tue Apr 15 10:24:54 2014
+++ src/sys/arch/sparc/dev/sx.c	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $	*/
+/*	$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2014/04/15 10:24:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.4 2019/03/01 02:30:42 macallan Exp $");
 
 #include "locators.h"
 
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.3 2
 #include 
 #include 
 #include 
+#include "opt_sx.h"
 
 /* autoconfiguration driver */
 static	int sx_match(device_t, struct cfdata *, void *);
@@ -57,6 +58,8 @@ static	void sx_attach(device_t, device_t
 CFATTACH_DECL_NEW(sx, sizeof(struct sx_softc),
 sx_match, sx_attach, NULL, NULL);
 
+static struct sx_softc *sx0 = NULL;
+
 static int
 sx_match(device_t parent, struct cfdata *cf, void *aux)
 {
@@ -90,7 +93,7 @@ sx_attach(device_t parent, device_t self
 	id = sx_read(sc, SX_ID);
 	aprint_normal_dev(self, "architecture rev. %d chip rev. %d\n",
 	(id & SX_ARCHITECTURE_MASK),
-	(id & SX_CHIP_REVISION) >> 8);
+	(id & SX_CHIP_REVISION) >> 3);
 
 	/* stop the processor */
 	sx_write(sc, SX_CONTROL_STATUS, 0);
@@ -114,6 +117,8 @@ sx_attach(device_t parent, device_t self
 	/* ... and start the processor again */
 	sx_write(sc, SX_CONTROL_STATUS, SX_PB | SX_GO);
 
+	sx0 = sc;
+
 #ifdef SX_DEBUG
 	sta(0xfc00, ASI_SX, SX_LD(8, 31, 0));
 	for (i = 1; i < 60; i++)
@@ -143,3 +148,15 @@ sx_attach(device_t parent, device_t self
 #endif
 }
 
+void
+sx_dump(void)
+{
+	if (sx0 == NULL)
+		return;
+	printf("SX STATUS: %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_CONTROL_STATUS));
+	printf("SX ERROR : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_ERROR));
+	printf("SX DIAG  : %08x\n",
+	bus_space_read_4(sx0->sc_tag, sx0->sc_regh, SX_DIAGNOSTICS));
+}
Index: src/sys/arch/sparc/dev/sxvar.h
diff -u src/sys/arch/sparc/dev/sxvar.h:1.3 src/sys/arch/sparc/dev/sxvar.h:1.4
--- src/sys/arch/sparc/dev/sxvar.h:1.3	Sun Jun 29 03:57:10 2014
+++ src/sys/arch/sparc/dev/sxvar.h	Fri Mar  1 02:30:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxvar.h,v 1.3 2014/06/29 03:57:10 tsutsui Exp $	*/
+/*	$NetBSD: sxvar.h,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,4 +51,6 @@ sx_read(struct sx_softc *sc, int addr)
 	return bus_space_read_4(sc->sc_tag, sc->sc_regh, addr);
 }
 
+void sx_dump(void);
+
 #endif



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

2019-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar  1 02:28:27 UTC 2019

Modified Files:
src/sys/arch/sparc/conf: files.sparc

Log Message:
defflag SX_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/sparc/conf/files.sparc

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/sparc/conf/files.sparc
diff -u src/sys/arch/sparc/conf/files.sparc:1.158 src/sys/arch/sparc/conf/files.sparc:1.159
--- src/sys/arch/sparc/conf/files.sparc:1.158	Wed Dec 19 13:57:49 2018
+++ src/sys/arch/sparc/conf/files.sparc	Fri Mar  1 02:28:27 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc,v 1.158 2018/12/19 13:57:49 maxv Exp $
+#	$NetBSD: files.sparc,v 1.159 2019/03/01 02:28:27 macallan Exp $
 
 # @(#)files.sparc	8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -122,6 +122,7 @@ file	arch/sparc/sparc/memecc.c		eccmemct
 device sx {}
 attach sx at mainbus
 file	arch/sparc/dev/sx.c			sx needs-flag
+defflag	opt_sx.h	SX_DEBUG
 
 device tctrl: sysmon_envsys, sysmon_power, sysmon_taskq
 attach tctrl at obio



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

2019-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 22 23:01:25 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
some register bits are defined differently by SunOS's sxreg.h and the SPAM
manual, upon investigation the hardware appears to agree with the SunOS header,
so adapt accordingly


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.16 src/sys/arch/sparc/dev/sxreg.h:1.17
--- src/sys/arch/sparc/dev/sxreg.h:1.16	Fri Dec  8 22:28:54 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Fri Feb 22 23:01:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.16 2017/12/08 22:28:54 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.17 2019/02/22 23:01:25 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -47,6 +47,8 @@
 #define SX_ID			0x0028
 #define SX_R0_INIT		0x002c
 #define SX_SOFTRESET		0x0030
+#define SX_SYNC			0x0034	/* write will stall CPU until */
+		/* SX is idle		  */
 /* write registers directly, only when processor is stopped */
 #define SX_DIRECT_R0		0x0100
 #define SX_DIRECT_R1		0x0104	/* and so on until R127 */
@@ -73,10 +75,39 @@
 #define SX_EE5		0x0010	/* alignment violation */
 #define SX_EE6		0x0020	/* illegal instruction queue write */
 #define SX_EI		0x0080	/* interrupt on error */
+/*
+ * XXX
+ * the following bit definitions are from the SX manual. They're defined in a
+ * different way in SunOS's sxreg.h, the hardware seems to follow the latter.
+ */
+#if 0
 #define SX_PB		0x1000	/* enable page bound checking */
 #define SX_WO		0x2000	/* write occured ( by SX ) */
 #define SX_GO		0x4000	/* start/stop the processor */
 #define SX_MT		0x8000	/* instruction queue is empty */
+#endif
+
+#define SX_PB		0x0400	/* enable page bound checking */
+#define SX_WO		0x0800	/* write occured ( by SX ) */
+#define SX_GO		0x1000	/* start/stop the processor */
+#define SX_JB		0x2000	/* Jammed/Busy specifies the type of events */
+	/* which increment the SX timer */
+#define SX_MT		0x4000	/* instruction queue is empty */
+#define SX_BZ		0x8000	/* Busy bit. When set it indicates that SX */
+	/* is processing an instruction or an */
+	/* instruction is pending in the Q  */
+#define SX_B0MOD	0x0001	/* When set by SX it indicates that a write */
+	/* to bank zero of the SX registers (0-31) */
+	/* occured */
+#define SX_B1MOD	0x0002	/* When set by SX it indicates that a write */
+	/* to bank 1 of the SX registers (32-63) */
+	/* occured */
+#define SX_B2MOD	0x0004	/* When set by SX it indicates that a write */
+	/* to bank 2 of the SX registers (64-95) */
+	/* occured */
+#define SX_B3MOD	0x0008	/* When set by SX it indicates that a write */
+	/* to bank 3 of the SX registers (96-127) */
+	/* occured */
 
 /* SX_ERROR */
 #define SX_SE1		0x0001	/* illegal instruction */
@@ -87,13 +118,29 @@
 #define SX_SE6		0x0020	/* illegal instruction queue write */
 #define SX_SI		0x0080	/* interrupt on error */
 
-/* SX_ID */
+/* SX_ID from the manual */
+#if 0
 #define SX_ARCHITECTURE_MASK	0x00ff
 #define SX_CHIP_REVISION	0xff00
+#endif
+
+#define SX_ARCHITECTURE_MASK	0x0003
+#define SX_CHIP_REVISION	0x00f8
 
 /* SX_DIAGNOSTICS */
 #define SX_IQ_FIFO_ACCESS	0x0001	/* allow memory instructions
 		 * in SX_INSTRUCTIONS */
+#define SX_SERIAL_INSTRUCTIONS	0x0002	/* force inst. serializing */
+#define SX_RAM_PAGE_CROSS	0x0004	/* indicates page crossing */
+#define SX_ARRAY_CONSTRAINING	0x0008	/* When set constrains VRAM */
+		/* array offset effective */
+		/* address calculation  */
+#define SX_UPG_MPG_DISABLE	0x0010	/* When set, disables page */
+		/* cross input into ld/st */
+		/* state machines */
+#define SX_DIAG_INIT		0x4804		/* Setting of the diag reg */
+		/* upon reset */
+
 
 /*
  * memory referencing instructions are written to 0x8 + PA



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

2019-02-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb 12 07:15:58 UTC 2019

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

Log Message:
add commented QUOTA2 line.


To generate a diff of this commit:
cvs rdiff -u -r1.263 -r1.264 src/sys/arch/sparc/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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.263 src/sys/arch/sparc/conf/GENERIC:1.264
--- src/sys/arch/sparc/conf/GENERIC:1.263	Mon Jan 14 00:13:18 2019
+++ src/sys/arch/sparc/conf/GENERIC	Tue Feb 12 07:15:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.263 2019/01/14 00:13:18 mrg Exp $
+# $NetBSD: GENERIC,v 1.264 2019/02/12 07:15:58 mrg Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/sparc/conf/std.sparc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.263 $"
+#ident 		"GENERIC-$Revision: 1.264 $"
 
 maxusers	32
 
@@ -182,6 +182,7 @@ file-system	TMPFS		# Efficient memory fi
 ## File system options.
 options 	NFSSERVER	# Sun NFS-compatible filesystem server
 options 	QUOTA		# FFS quotas
+#options 	QUOTA2		# new, in-filesystem UFS quotas
 #options 	FFS_EI		# FFS Endian Independent support
 options 	WAPBL		# File system journaling support
 #options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental



CVS commit: src/sys/arch/sparc/sparc

2019-02-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb  4 09:57:39 UTC 2019

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

Log Message:
print the cpu number for the mutex not held xcallintr debug message.
add a comment about why this case fires.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/sparc/sparc/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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.119 src/sys/arch/sparc/sparc/intr.c:1.120
--- src/sys/arch/sparc/sparc/intr.c:1.119	Sat Dec  2 00:48:05 2017
+++ src/sys/arch/sparc/sparc/intr.c	Mon Feb  4 09:57:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.119 2017/12/02 00:48:05 macallan Exp $ */
+/*	$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.119 2017/12/02 00:48:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.120 2019/02/04 09:57:39 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -366,10 +366,14 @@ xcallintr(void *v)
 	if (v != xcallintr)
 		cpuinfo.ci_sintrcnt[13].ev_count++;
 
+	/*
+	 * This happens when the remote CPU is slow at responding and the
+	 * caller gave up, and has given up the mutex.
+	 */
 	if (mutex_owned(_mutex) == 0) {
 		cpuinfo.ci_xpmsg_mutex_not_held.ev_count++;
 #ifdef DEBUG
-		printf("%s: mutex not held\n", __func__);
+		printf("%s: cpu%d mutex not held\n", __func__, cpu_number());
 #endif
 		cpuinfo.msg.complete = 1;
 		kpreempt_enable();



CVS commit: src/sys/arch/sparc/sparc

2019-02-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Feb  4 03:32:27 UTC 2019

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

Log Message:
- rework mm_md_readwrite() to avoid fallthrough warnings entirely


To generate a diff of this commit:
cvs rdiff -u -r1.328 -r1.329 src/sys/arch/sparc/sparc/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/sparc/sparc/machdep.c
diff -u src/sys/arch/sparc/sparc/machdep.c:1.328 src/sys/arch/sparc/sparc/machdep.c:1.329
--- src/sys/arch/sparc/sparc/machdep.c:1.328	Sat Dec 10 10:41:07 2016
+++ src/sys/arch/sparc/sparc/machdep.c	Mon Feb  4 03:32:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.328 2016/12/10 10:41:07 mrg Exp $ */
+/*	$NetBSD: machdep.c,v 1.329 2019/02/04 03:32:27 mrg Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.328 2016/12/10 10:41:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.329 2019/02/04 03:32:27 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_sunos.h"
@@ -3143,10 +3143,7 @@ mm_md_readwrite(dev_t dev, struct uio *u
 	case DEV_EEPROM:
 		if (cputyp == CPU_SUN4)
 			return eeprom_uio(uio);
-		else
 #endif
-		return ENXIO;
-	default:
-		return ENXIO;
 	}
+	return ENXIO;
 }



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

2019-02-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  3 11:58:38 UTC 2019

Modified Files:
src/sys/arch/sparc/stand/common: promdev.c

Log Message:
don't compare string pointers against \0


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc/stand/common/promdev.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/sparc/stand/common/promdev.c
diff -u src/sys/arch/sparc/stand/common/promdev.c:1.28 src/sys/arch/sparc/stand/common/promdev.c:1.29
--- src/sys/arch/sparc/stand/common/promdev.c:1.28	Sat Mar 25 09:21:21 2017
+++ src/sys/arch/sparc/stand/common/promdev.c	Sun Feb  3 11:58:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: promdev.c,v 1.28 2017/03/25 09:21:21 martin Exp $ */
+/*	$NetBSD: promdev.c,v 1.29 2019/02/03 11:58:38 mrg Exp $ */
 
 /*
  * Copyright (c) 1993 Paul Kranenburg
@@ -234,7 +234,7 @@ devopen(struct open_file *f, const char 
 		memcpy(disk_pd, pd, sizeof(struct promdata));
 		if (prom_version() != PROM_OLDMON) {
 			strcpy(rawpart, prom_bootdevice);
-			if ((partition = strchr(rawpart, ':')) != '\0' &&
+			if ((partition = strchr(rawpart, ':')) != NULL &&
 			*++partition >= 'a' &&
 			*partition <= 'a' +  MAXPARTITIONS) {
 part = *partition - 'a';



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

2019-01-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 17 23:05:15 UTC 2019

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
don't crash when we're not the console


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.86 src/sys/arch/sparc/dev/cgfourteen.c:1.87
--- src/sys/arch/sparc/dev/cgfourteen.c:1.86	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jan 17 23:05:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.86 2018/09/03 16:29:27 riastradh Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.87 2019/01/17 23:05:15 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -284,7 +284,7 @@ cgfourteenattach(device_t parent, device
 	if (sbus_bus_map(sa->sa_bustag, sa->sa_slot,
 			 sa->sa_offset,
 			 sa->sa_size,
-			 0 /*BUS_SPACE_MAP_LINEAR*/,
+			 BUS_SPACE_MAP_LINEAR,
 			 ) != 0) {
 		printf("%s: cannot map control registers\n",
 		device_xname(self));
@@ -744,7 +744,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	sc->sc_gc.gc_blitcookie = sc;
 	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
-	if (is_cons) {
+
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
 		);
 
@@ -770,21 +770,10 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
 			defattr);
+	if (is_cons) {
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 		vcons_replay_msgbuf(>sc_console_screen);
-	} else {
-		/*
-		 * since we're not the console we can postpone the rest
-		 * until someone actually allocates a screen for us
-		 */
-		glyphcache_init(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
-			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) -
-			 sc->sc_fb.fb_type.fb_height - 5,
-			sc->sc_fb.fb_type.fb_width,
-			ri->ri_font->fontwidth,
-			ri->ri_font->fontheight,
-			DEFATTR);
 	}
 
 	cg14_init_cmap(sc);



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

2019-01-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jan 14 00:13:18 UTC 2019

Modified Files:
src/sys/arch/sparc/conf: GENERIC KRUPS

Log Message:
normalise comment for fileassoc(8).  from PR#44873.


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/sys/arch/sparc/conf/GENERIC
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/sparc/conf/KRUPS

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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.262 src/sys/arch/sparc/conf/GENERIC:1.263
--- src/sys/arch/sparc/conf/GENERIC:1.262	Wed Dec 19 13:57:49 2018
+++ src/sys/arch/sparc/conf/GENERIC	Mon Jan 14 00:13:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.262 2018/12/19 13:57:49 maxv Exp $
+# $NetBSD: GENERIC,v 1.263 2019/01/14 00:13:18 mrg Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/sparc/conf/std.sparc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.262 $"
+#ident 		"GENERIC-$Revision: 1.263 $"
 
 maxusers	32
 
@@ -712,7 +712,7 @@ pseudo-device	wsmux			# mouse and keyboa
 pseudo-device	wsfont
 pseudo-device	putter			# for puffs and pud
 
-#options 	FILEASSOC		# fileassoc(9)
+#options 	FILEASSOC		# fileassoc(9) - required for Veriexec
 	# and PAX_SEGVGUARD
 
 # Veriexec

Index: src/sys/arch/sparc/conf/KRUPS
diff -u src/sys/arch/sparc/conf/KRUPS:1.78 src/sys/arch/sparc/conf/KRUPS:1.79
--- src/sys/arch/sparc/conf/KRUPS:1.78	Wed Dec 19 13:57:49 2018
+++ src/sys/arch/sparc/conf/KRUPS	Mon Jan 14 00:13:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: KRUPS,v 1.78 2018/12/19 13:57:49 maxv Exp $
+# $NetBSD: KRUPS,v 1.79 2019/01/14 00:13:18 mrg Exp $
 # From: NetBSD: GENERIC,v 1.197 2006/12/04 23:43:35 elad Exp
 #
 # Krups (JavaStation-NC) machine description file
@@ -8,7 +8,7 @@ include 	"arch/sparc/conf/std.sparc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"KRUPS-$Revision: 1.78 $"
+#ident 		"KRUPS-$Revision: 1.79 $"
 
 maxusers	32
 
@@ -339,7 +339,7 @@ pseudo-device	putter			# for puffs and p
 
 #pseudo-device	fss			# file system snapshot device
 
-#options 	FILEASSOC		# fileassoc(9)
+#options 	FILEASSOC		# fileassoc(9) - required for Veriexec
 	# and PAX_SEGVGUARD
 
 # Veriexec



CVS commit: src/sys/arch/sparc/sparc

2019-01-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jan 13 22:11:11 UTC 2019

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

Log Message:
switch sparc pmap lock to the scheme sparc64 uses:

- local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.365 -r1.366 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.365 src/sys/arch/sparc/sparc/pmap.c:1.366
--- src/sys/arch/sparc/sparc/pmap.c:1.365	Mon Sep  3 16:29:27 2018
+++ src/sys/arch/sparc/sparc/pmap.c	Sun Jan 13 22:11:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.365 2018/09/03 16:29:27 riastradh Exp $ */
+/*	$NetBSD: pmap.c,v 1.366 2019/01/13 22:11:11 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.365 2018/09/03 16:29:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.366 2019/01/13 22:11:11 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4392,7 +4393,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4662,7 +4665,7 @@ pmap_remove(struct pmap *pm, vaddr_t va,
 	}
 
 	ctx = getcontext();
-	s = splvm();		/* XXX conservative */
+	s = splvm();
 	PMAP_LOCK();
 	for (; va < endva; va = nva) {
 		/* do one virtual 

CVS commit: src/sys/arch/sparc/stand/binstall

2018-09-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Sep 22 03:29:51 UTC 2018

Modified Files:
src/sys/arch/sparc/stand/binstall: binstall.sh

Log Message:
Convert from getopt to getopts(script is slightly smaller as a
result, but not enough to save a block ... but if /usr/bin/getopt is
not used elsewhere, and it should not be, it will no longer be required.)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/stand/binstall/binstall.sh

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/sparc/stand/binstall/binstall.sh
diff -u src/sys/arch/sparc/stand/binstall/binstall.sh:1.17 src/sys/arch/sparc/stand/binstall/binstall.sh:1.18
--- src/sys/arch/sparc/stand/binstall/binstall.sh:1.17	Sun Sep 16 14:26:04 2018
+++ src/sys/arch/sparc/stand/binstall/binstall.sh	Sat Sep 22 03:29:51 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: binstall.sh,v 1.17 2018/09/16 14:26:04 kre Exp $
+#	$NetBSD: binstall.sh,v 1.18 2018/09/22 03:29:51 kre Exp $
 #
 
 vecho () {
@@ -53,27 +53,22 @@ VERBOSE=
 : ${OFWBOOTBLK:=ofwboot}
 [ "$( sysctl -n machdep.cpu_arch )" = 9 ] && ULTRASPARC=true || ULTRASPARC=false
 
-### XXX this should be converted to use getopts
-set -- $(getopt "b:hf:i:m:tUuv" "$@" )
-if [ $? -gt 0 ]; then
-	Usage
-fi
-
-for a
+while getopts b:hf:i:m:tUuv a
 do
-	case "$1" in
-	-h) Help; shift ;;
-	-u) ULTRASPARC=true; shift ;;
-	-U) ULTRASPARC=false; shift ;;
-	-b) BOOTPROG=$2; OFWBOOTBLK=$2; shift 2 ;;
-	-f) DEV=$2; shift 2 ;;
-	-m) MDEC=$2; shift 2 ;;
-	-i) INSTALLBOOT=$2; shift 2 ;;
-	-t) TEST=1; VERBOSE=-v; shift ;;
-	-v) VERBOSE=-v; shift ;;
-	--) shift; break ;;
+	case "$a" in
+	h) Help;;
+	u) ULTRASPARC=true;;
+	U) ULTRASPARC=false;;
+	b) BOOTPROG=$OPTARG; OFWBOOTBLK=$OPTARG;;
+	f) DEV=$OPTARG;;
+	m) MDEC=$OPTARG;;
+	i) INSTALLBOOT=$OPTARG;;
+	t) TEST=1; VERBOSE=-v;;
+	v) VERBOSE=-v;;
+	\?) Usage;;
 	esac
 done
+shift $(( $OPTIND - 1 ))
 
 if [ "$( sysctl -n kern.securelevel )" -gt 0 ] && ! [ -f "$DEV" ]; then
 	Secure



CVS commit: src/sys/arch/sparc/stand/binstall

2018-09-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Sep 16 14:26:04 UTC 2018

Modified Files:
src/sys/arch/sparc/stand/binstall: binstall.sh

Log Message:
General cleanups...
Better quote usage
No more need for sed
(should be no need for getopt either, but did not do that one)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/stand/binstall/binstall.sh

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/sparc/stand/binstall/binstall.sh
diff -u src/sys/arch/sparc/stand/binstall/binstall.sh:1.16 src/sys/arch/sparc/stand/binstall/binstall.sh:1.17
--- src/sys/arch/sparc/stand/binstall/binstall.sh:1.16	Sun Sep 16 14:23:04 2018
+++ src/sys/arch/sparc/stand/binstall/binstall.sh	Sun Sep 16 14:26:04 2018
@@ -1,12 +1,10 @@
 #!/bin/sh
-#	$NetBSD: binstall.sh,v 1.16 2018/09/16 14:23:04 kre Exp $
+#	$NetBSD: binstall.sh,v 1.17 2018/09/16 14:26:04 kre Exp $
 #
 
 vecho () {
-# echo if VERBOSE on
-	if [ "$VERBOSE" = "1" ]; then
-		echo "$@" 1>&2
-	fi
+	# echo if VERBOSE on
+	[ -n "$VERBOSE" ] && echo "$*" 1>&2
 	return 0
 }
 
@@ -25,7 +23,7 @@ Options () {
 }
 
 Usage () {
-	echo "Usage: $0 [options] <"'"net"|"ffs"'"> "
+	echo "Usage: $0"' [options] <"net"|"ffs"> '
 	Options
 	exit 1
 }
@@ -33,7 +31,7 @@ Usage () {
 Help () {
 	echo "This script copies the boot programs to one of several"
 	echo "commonly used places."
-	echo "When installing an \"ffs\" boot program, this script also runs"
+	echo 'When installing an "ffs" boot program, this script also runs'
 	echo "installboot(8) which installs the default proto bootblocks into"
 	echo "the appropriate filesystem partition or filesystem image."
 	Options
@@ -48,38 +46,36 @@ Secure () {
 }
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
+VERBOSE=
 : ${MDEC:=/usr/mdec}
 : ${INSTALLBOOT:=/usr/sbin/installboot}
 : ${BOOTPROG:=boot}
 : ${OFWBOOTBLK:=ofwboot}
-if [ "`sysctl -n machdep.cpu_arch`" = 9 ]; then
-	ULTRASPARC=1
-else
-	ULTRASPARC=0
-fi
+[ "$( sysctl -n machdep.cpu_arch )" = 9 ] && ULTRASPARC=true || ULTRASPARC=false
 
-set -- `getopt "b:hf:i:m:tUuv" "$@"`
+### XXX this should be converted to use getopts
+set -- $(getopt "b:hf:i:m:tUuv" "$@" )
 if [ $? -gt 0 ]; then
 	Usage
 fi
 
-for a in $*
+for a
 do
-	case $1 in
+	case "$1" in
 	-h) Help; shift ;;
-	-u) ULTRASPARC=1; shift ;;
-	-U) ULTRASPARC=0; shift ;;
+	-u) ULTRASPARC=true; shift ;;
+	-U) ULTRASPARC=false; shift ;;
 	-b) BOOTPROG=$2; OFWBOOTBLK=$2; shift 2 ;;
 	-f) DEV=$2; shift 2 ;;
 	-m) MDEC=$2; shift 2 ;;
 	-i) INSTALLBOOT=$2; shift 2 ;;
-	-t) TEST=1; VERBOSE=1; shift ;;
-	-v) VERBOSE=1; shift ;;
+	-t) TEST=1; VERBOSE=-v; shift ;;
+	-v) VERBOSE=-v; shift ;;
 	--) shift; break ;;
 	esac
 done
 
-if [ "`sysctl -n kern.securelevel`" -gt 0 ] && [ ! -f "$DEV" ]; then
+if [ "$( sysctl -n kern.securelevel )" -gt 0 ] && ! [ -f "$DEV" ]; then
 	Secure
 fi
 
@@ -92,12 +88,13 @@ fi
 WHAT=$1
 DEST=$2
 
-if [ ! -d $DEST ]; then
+if ! [ -d "$DEST" ]; then
 	echo "$DEST: not a directory"
 	Usage
 fi
 
-if [ "$ULTRASPARC" = "1" ]; then
+if $ULTRASPARC
+then
 	machine=sparc64
 	targ=ofwboot
 	stage2=""
@@ -114,42 +111,42 @@ fi
 
 case $WHAT in
 "ffs")
-	if [ "$DEV" = "" ]; then
+	if [ -z "$DEV" ]; then
 		# Lookup device mounted on DEST
-		DEV=`mount | while read line; do
+		DEV=$( mount | while read line; do
 			set -- $line
 			vecho "Inspecting \"$line\""
 			if [ "$2" = "on" ] && [ "$3" = "$DEST" ]; then
-if [ ! -b $1 ]; then
-	continue
-fi
-RAW=\`echo -n "$1" | sed -e 's;/dev/;/dev/r;'\`
-if [ ! -c \$RAW ]; then
-	continue
-fi
-echo -n $RAW
+[ -b "$1" ] || continue
+case "$1" in
+(*/*) RAW="${1%/*}/r${1##*/}";;
+(*)   RAW="r$1";;
+esac
+[ -c "$RAW" ] || continue
+echo -n "$RAW"
 break;
 			fi
-		done`
-		if [ "$DEV" = "" ]; then
+		done )
+		if [ -z "$DEV" ]; then
 			echo "Cannot find \"$DEST\" in mount table"
 			exit 1
 		fi
 	fi
 
-	vecho Boot device: $DEV
-	vecho Primary boot program: $BOOTXX
-	vecho Secondary boot program: $DEST/$targ
+	vecho "Boot device: $DEV"
+	vecho "Primary boot program: $BOOTXX"
+	vecho "Secondary boot program: $DEST/$targ"
 
-	$DOIT cp -p -f ${MDEC}/${BOOTPROG} $DEST/$targ
+	$DOIT cp -p -f "${MDEC}/${BOOTPROG}" "$DEST/$targ"
 	sync; sync; sync
-	vecho ${INSTALLBOOT} ${VERBOSE:+-v} -m $machine $DEV ${BOOTXX} $stage2
-	$DOIT ${INSTALLBOOT} ${VERBOSE:+-v} -m $machine $DEV ${BOOTXX} $stage2
+	vecho "${INSTALLBOOT} ${VERBOSE} -m $machine $DEV $BOOTXX $stage2"
+	$DOIT "${INSTALLBOOT}" ${VERBOSE} -m "$machine" \
+		"$DEV" "$BOOTXX" "$stage2"
 	;;
 
 "net")
-	vecho Network boot program: $DEST/$boot.${machine}.netbsd
-	$DOIT cp -p -f ${MDEC}/$netboot $DEST/$boot.${machine}.netbsd
+	vecho "Network boot program: $DEST/$boot.${machine}.netbsd"
+	$DOIT cp -p -f "${MDEC}/$netboot" "$DEST/$boot.${machine}.netbsd"
 	;;
 
 *)



CVS commit: src/sys/arch/sparc/stand/binstall

2018-09-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Sep 16 14:23:04 UTC 2018

Modified Files:
src/sys/arch/sparc/stand/binstall: binstall.sh

Log Message:
PR install/53610

Remove use of -a in test(1) - deprecated in standard, and no
longer supported in SMALL (install media) versions of test in /bin/sh


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/stand/binstall/binstall.sh

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/sparc/stand/binstall/binstall.sh
diff -u src/sys/arch/sparc/stand/binstall/binstall.sh:1.15 src/sys/arch/sparc/stand/binstall/binstall.sh:1.16
--- src/sys/arch/sparc/stand/binstall/binstall.sh:1.15	Wed Jul 12 21:34:45 2006
+++ src/sys/arch/sparc/stand/binstall/binstall.sh	Sun Sep 16 14:23:04 2018
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: binstall.sh,v 1.15 2006/07/12 21:34:45 he Exp $
+#	$NetBSD: binstall.sh,v 1.16 2018/09/16 14:23:04 kre Exp $
 #
 
 vecho () {
@@ -119,7 +119,7 @@ case $WHAT in
 		DEV=`mount | while read line; do
 			set -- $line
 			vecho "Inspecting \"$line\""
-			if [ "$2" = "on" -a "$3" = "$DEST" ]; then
+			if [ "$2" = "on" ] && [ "$3" = "$DEST" ]; then
 if [ ! -b $1 ]; then
 	continue
 fi



CVS commit: src/sys/arch/sparc/sparc

2018-05-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu May 31 22:44:13 UTC 2018

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

Log Message:
convert Lfp_null_fpstate (which is invoked if savefpstate() is called
with NULL) into a panic for DIAGNOSTIC kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.270 src/sys/arch/sparc/sparc/locore.s:1.271
--- src/sys/arch/sparc/sparc/locore.s:1.270	Fri Mar 16 09:29:24 2018
+++ src/sys/arch/sparc/sparc/locore.s	Thu May 31 22:44:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.270 2018/03/16 09:29:24 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.271 2018/05/31 22:44:13 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -5754,24 +5754,20 @@ Lfp_finish:
 	retl
 	 std	%f30, [%o0 + FS_REGS + (4*30)]
 
-/*
- * We really should panic here but while we figure out what the bug is
- * that a remote CPU gets a NULL struct fpstate *, this lets the system
- * work at least seemingly stably.
- */
+/* Handle NULL fpstate argument for savefpstate */
 Lfp_null_fpstate:
-#if 1
+#ifdef DIAGNOSTIC
+	ld	[%o5 + CPUINFO_CPUNO], %o1
+	sethi	%hi(Lpanic_savefpstate), %o0
+	call	_C_LABEL(panic)
+	 or	%o0, %lo(Lpanic_savefpstate), %o0
+#else
 	sethi	%hi(CPUINFO_VA), %o5
 	ldd	[%o5 + CPUINFO_SAVEFPSTATE_NULL], %o2
 	inccc   %o3
 	addx%o2, 0, %o2
 	retl
 	 std	%o2, [%o5 + CPUINFO_SAVEFPSTATE_NULL]
-#else
-	ld	[%o5 + CPUINFO_CPUNO], %o1
-	sethi	%hi(Lpanic_savefpstate), %o0
-	call	_C_LABEL(panic)
-	 or	%o0, %lo(Lpanic_savefpstate), %o0
 #endif
 
 /*



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

2018-04-11 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Apr 11 19:37:58 UTC 2018

Modified Files:
src/sys/arch/sparc/include: frame.h

Log Message:
Fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/include/frame.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/sparc/include/frame.h
diff -u src/sys/arch/sparc/include/frame.h:1.9 src/sys/arch/sparc/include/frame.h:1.10
--- src/sys/arch/sparc/include/frame.h:1.9	Tue Oct  6 20:03:05 2015
+++ src/sys/arch/sparc/include/frame.h	Wed Apr 11 19:37:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.9 2015/10/06 20:03:05 martin Exp $ */
+/*	$NetBSD: frame.h,v 1.10 2018/04/11 19:37:58 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -104,7 +104,7 @@ struct frame32 {
  * of the frame, you must first force the kernel to write any such
  * windows to the stack.
  *
- * V9 frames have an odd bias, so you can tall a v9 frame from
+ * V9 frames have an odd bias, so you can tell a v9 frame from
  * a v8 frame by testing the stack pointer's lsb.
  */
 #if !defined(_LOCORE) && !defined(_LIBC)



CVS commit: src/sys/arch/sparc/sparc

2018-03-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar 16 09:29:24 UTC 2018

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

Log Message:
remove obsolete ovbcopy().  it may be the very slightly bit
faster for larger copies, but slower for smaller ones.
i don't see any major benefit in keeping this code.

this is the final ovbcopy() reference in src.  you're welcome :-)


To generate a diff of this commit:
cvs rdiff -u -r1.269 -r1.270 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.269 src/sys/arch/sparc/sparc/locore.s:1.270
--- src/sys/arch/sparc/sparc/locore.s:1.269	Sat Nov 25 04:11:37 2017
+++ src/sys/arch/sparc/sparc/locore.s	Fri Mar 16 09:29:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.269 2017/11/25 04:11:37 maya Exp $	*/
+/*	$NetBSD: locore.s,v 1.270 2018/03/16 09:29:24 mrg Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -5331,7 +5331,6 @@ ENTRY(qzero)
 
 ENTRY(bcopy)
 	cmp	%o2, BCOPY_SMALL
-Lbcopy_start:
 	bge,a	Lbcopy_fancy	! if >= this many, go be fancy.
 	btst	7, %o0		! (part of being fancy)
 
@@ -5494,164 +5493,6 @@ Lbcopy_done:
 1:
 	retl
 	 stb	%o4,[%o1]
-/*
- * ovbcopy(src, dst, len): like bcopy, but regions may overlap.
- */
-ENTRY(ovbcopy)
-	cmp	%o0, %o1	! src < dst?
-	bgeu	Lbcopy_start	! no, go copy forwards as via bcopy
-	cmp	%o2, BCOPY_SMALL! (check length for doublecopy first)
-
-	/*
-	 * Since src comes before dst, and the regions might overlap,
-	 * we have to do the copy starting at the end and working backwards.
-	 */
-	add	%o2, %o0, %o0	! src += len
-	add	%o2, %o1, %o1	! dst += len
-	bge,a	Lback_fancy	! if len >= BCOPY_SMALL, go be fancy
-	btst	3, %o0
-
-	/*
-	 * Not much to copy, just do it a byte at a time.
-	 */
-	deccc	%o2		! while (--len >= 0)
-	bl	1f
-	 .empty
-0:
-	dec	%o0		!	*--dst = *--src;
-	ldsb	[%o0], %o4
-	dec	%o1
-	deccc	%o2
-	bge	0b
-	stb	%o4, [%o1]
-1:
-	retl
-	nop
-
-	/*
-	 * Plenty to copy, try to be optimal.
-	 * We only bother with word/halfword/byte copies here.
-	 */
-Lback_fancy:
-!	btst	3, %o0		! done already
-	bnz	1f		! if ((src & 3) == 0 &&
-	btst	3, %o1		! (dst & 3) == 0)
-	bz,a	Lback_words	!	goto words;
-	dec	4, %o2		! (done early for word copy)
-
-1:
-	/*
-	 * See if the low bits match.
-	 */
-	xor	%o0, %o1, %o3	! t = src ^ dst;
-	btst	1, %o3
-	bz,a	3f		! if (t & 1) == 0, can do better
-	btst	1, %o0
-
-	/*
-	 * Nope; gotta do byte copy.
-	 */
-2:
-	dec	%o0		! do {
-	ldsb	[%o0], %o4	!	*--dst = *--src;
-	dec	%o1
-	deccc	%o2		! } while (--len != 0);
-	bnz	2b
-	stb	%o4, [%o1]
-	retl
-	nop
-
-3:
-	/*
-	 * Can do halfword or word copy, but might have to copy 1 byte first.
-	 */
-!	btst	1, %o0		! done earlier
-	bz,a	4f		! if (src & 1) {	/* copy 1 byte */
-	btst	2, %o3		! (done early)
-	dec	%o0		!	*--dst = *--src;
-	ldsb	[%o0], %o4
-	dec	%o1
-	stb	%o4, [%o1]
-	dec	%o2		!	len--;
-	btst	2, %o3		! }
-
-4:
-	/*
-	 * See if we can do a word copy ((t&2) == 0).
-	 */
-!	btst	2, %o3		! done earlier
-	bz,a	6f		! if (t & 2) == 0, can do word copy
-	btst	2, %o0		! (src&2, done early)
-
-	/*
-	 * Gotta do halfword copy.
-	 */
-	dec	2, %o2		! len -= 2;
-5:
-	dec	2, %o0		! do {
-	ldsh	[%o0], %o4	!	src -= 2;
-	dec	2, %o1		!	dst -= 2;
-	deccc	2, %o0		!	*(short *)dst = *(short *)src;
-	bge	5b		! } while ((len -= 2) >= 0);
-	sth	%o4, [%o1]
-	b	Lback_mopb	! goto mop_up_byte;
-	btst	1, %o2		! (len&1, done early)
-
-6:
-	/*
-	 * We can do word copies, but we might have to copy
-	 * one halfword first.
-	 */
-!	btst	2, %o0		! done already
-	bz	7f		! if (src & 2) {
-	dec	4, %o2		! (len -= 4, done early)
-	dec	2, %o0		!	src -= 2, dst -= 2;
-	ldsh	[%o0], %o4	!	*(short *)dst = *(short *)src;
-	dec	2, %o1
-	sth	%o4, [%o1]
-	dec	2, %o2		!	len -= 2;
-! }
-
-7:
-Lback_words:
-	/*
-	 * Do word copies (backwards), then mop up trailing halfword
-	 * and byte if any.
-	 */
-!	dec	4, %o2		! len -= 4, done already
-0:! do {
-	dec	4, %o0		!	src -= 4;
-	dec	4, %o1		!	src -= 4;
-	ld	[%o0], %o4	!	*(int *)dst = *(int *)src;
-	deccc	4, %o2		! } while ((len -= 4) >= 0);
-	bge	0b
-	st	%o4, [%o1]
-
-	/*
-	 * Check for trailing shortword.
-	 */
-	btst	2, %o2		! if (len & 2) {
-	bz,a	1f
-	btst	1, %o2		! (len&1, done early)
-	dec	2, %o0		!	src -= 2, dst -= 2;
-	ldsh	[%o0], %o4	!	*(short *)dst = *(short *)src;
-	dec	2, %o1
-	sth	%o4, [%o1]	! }
-	btst	1, %o2
-
-	/*
-	 * Check for trailing byte.
-	 */
-1:
-Lback_mopb:
-!	btst	1, %o2		! (done already)
-	bnz,a	1f		! if (len & 1) {
-	ldsb	[%o0 - 1], %o4	!	b = src[-1];
-	retl
-	nop
-1:
-	retl			!	dst[-1] = b;
-	stb	%o4, [%o1 - 1]	! }
 
 /*
  * kcopy() is exactly like bcopy except that it set pcb_onfault such that



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

2018-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 18 15:29:29 UTC 2018

Modified Files:
src/sys/arch/sparc/include: mcontext.h

Log Message:
Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/include/mcontext.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/sparc/include/mcontext.h
diff -u src/sys/arch/sparc/include/mcontext.h:1.15 src/sys/arch/sparc/include/mcontext.h:1.16
--- src/sys/arch/sparc/include/mcontext.h:1.15	Sat Feb 17 10:22:22 2018
+++ src/sys/arch/sparc/include/mcontext.h	Sun Feb 18 10:29:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.15 2018/02/17 15:22:22 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.16 2018/02/18 15:29:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -145,33 +145,19 @@ typedef struct {
 
 #ifdef __arch64__
 #define _UC_MACHINE_PAD	8		/* Padding appended to ucontext_t */
-#define	_UC_MACHINE_SP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6])+0x7ff)
-#define	_UC_MACHINE_FP(uc)	(_uc_machine_fp((uc), 2047))
+#define	_UC_MACHINE_SP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6]) + 0x7ff)
+#define	_UC_MACHINE_FP(uc)	(((__greg_t *)_UC_MACHINE_SP(uc))[15])
 #define _UC_MACHINE32_PAD	43	/* compat_netbsd32 variant */
 #define	_UC_MACHINE32_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
-#define	_UC_MACHINE32_FP(uc)	(_uc_machine_fp((uc), 0))
+#define	_UC_MACHINE32_FP(uc)	(((__greg_t *)_UC_MACHINE32_SP(uc))[15])
 #else
 #define _UC_MACHINE_PAD	43		/* Padding appended to ucontext_t */
 #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
-#define	_UC_MACHINE_FP(uc)	(_uc_machine_fp((uc), 0))
+#define	_UC_MACHINE_FP(uc)	(((__greg_t *)_UC_MACHINE_SP(uc))[15])
 #endif
 #define	_UC_MACHINE_PC(uc)	((uc)->uc_mcontext.__gregs[_REG_PC])
 #define	_UC_MACHINE_INTRV(uc)	((uc)->uc_mcontext.__gregs[_REG_O0])
 
-static inline long
-_uc_machine_fp(ucontext_t *ucontext, long shift)
-{
-	long *sptr;
-	long *sp;
-	long fp;
-
-	sp = (long *)_UC_MACHINE_SP(ucontext);
-	sptr = (long *)(*sp + shift);
-	fp = sptr[15];
-
-	return fp;
-}
-
 #define	_UC_MACHINE_SET_PC(uc, pc)	\
 do {	\
 	(uc)->uc_mcontext.__gregs[_REG_PC] = (pc);			\



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

2018-02-17 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 17 15:22:22 UTC 2018

Modified Files:
src/sys/arch/sparc/include: mcontext.h

Log Message:
Improve _UC_MACHINE_FP() for SPARC/SPARC64

Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.

Algorithm:

  uptr *stk_ptr;
#  if defined (__arch64__)
  stk_ptr = (uptr *) (*sp + 2047);
#  else
  stk_ptr = (uptr *) *sp;
#  endif
  *bp = stk_ptr[15];

Noted by 


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/include/mcontext.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/sparc/include/mcontext.h
diff -u src/sys/arch/sparc/include/mcontext.h:1.14 src/sys/arch/sparc/include/mcontext.h:1.15
--- src/sys/arch/sparc/include/mcontext.h:1.14	Thu Feb 15 15:53:57 2018
+++ src/sys/arch/sparc/include/mcontext.h	Sat Feb 17 15:22:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.14 2018/02/15 15:53:57 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.15 2018/02/17 15:22:22 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -146,18 +146,32 @@ typedef struct {
 #ifdef __arch64__
 #define _UC_MACHINE_PAD	8		/* Padding appended to ucontext_t */
 #define	_UC_MACHINE_SP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6])+0x7ff)
-#define	_UC_MACHINE_FP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6])+0x80e)
+#define	_UC_MACHINE_FP(uc)	(_uc_machine_fp((uc), 2047))
 #define _UC_MACHINE32_PAD	43	/* compat_netbsd32 variant */
 #define	_UC_MACHINE32_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
-#define	_UC_MACHINE32_FP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6])+0xf)
+#define	_UC_MACHINE32_FP(uc)	(_uc_machine_fp((uc), 0))
 #else
 #define _UC_MACHINE_PAD	43		/* Padding appended to ucontext_t */
 #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
-#define	_UC_MACHINE_FP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6])+0xf)
+#define	_UC_MACHINE_FP(uc)	(_uc_machine_fp((uc), 0))
 #endif
 #define	_UC_MACHINE_PC(uc)	((uc)->uc_mcontext.__gregs[_REG_PC])
 #define	_UC_MACHINE_INTRV(uc)	((uc)->uc_mcontext.__gregs[_REG_O0])
 
+static inline long
+_uc_machine_fp(ucontext_t *ucontext, long shift)
+{
+	long *sptr;
+	long *sp;
+	long fp;
+
+	sp = (long *)_UC_MACHINE_SP(ucontext);
+	sptr = (long *)(*sp + shift);
+	fp = sptr[15];
+
+	return fp;
+}
+
 #define	_UC_MACHINE_SET_PC(uc, pc)	\
 do {	\
 	(uc)->uc_mcontext.__gregs[_REG_PC] = (pc);			\



CVS commit: src/sys/arch/sparc/sparc

2018-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Feb  6 09:22:58 UTC 2018

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

Log Message:
workaround a problem -Warray-bounds triggers but isn't a problem
in practise, as described from this old commment:

/*
 * Set up pm_regmap for kernel to point NUREG *below* the beginning
 * of kernel regmap storage. Since the kernel only uses regions
 * above NUREG, we save storage space and can index kernel and
 * user regions in the same way.
 */


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.362 src/sys/arch/sparc/sparc/pmap.c:1.363
--- src/sys/arch/sparc/sparc/pmap.c:1.362	Tue Jan 16 08:23:17 2018
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Feb  6 09:22:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.362 2018/01/16 08:23:17 mrg Exp $ */
+/*	$NetBSD: pmap.c,v 1.363 2018/02/06 09:22:57 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.362 2018/01/16 08:23:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.363 2018/02/06 09:22:57 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -3214,7 +3214,10 @@ pmap_bootstrap4_4c(void *top, int nctx, 
 	 * above NUREG, we save storage space and can index kernel and
 	 * user regions in the same way.
 	 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
 	kernel_pmap_store.pm_regmap = kernel_regmap_store - NUREG;
+#pragma GCC diagnostic pop
 	for (i = NKREG; --i >= 0;) {
 #if defined(SUN4_MMU3L)
 		kernel_regmap_store[i].rg_smeg = reginval;
@@ -3592,7 +3595,10 @@ pmap_bootstrap4m(void *top)
 	 * above NUREG, we save storage space and can index kernel and
 	 * user regions in the same way.
 	 */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
 	kernel_pmap_store.pm_regmap = kernel_regmap_store - NUREG;
+#pragma GCC diagnostic pop
 	memset(kernel_regmap_store, 0, NKREG * sizeof(struct regmap));
 	memset(kernel_segmap_store, 0, NKREG * NSEGRG * sizeof(struct segmap));
 	for (i = NKREG; --i >= 0;) {



CVS commit: src/sys/arch/sparc/sparc

2018-02-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb  1 22:58:44 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: cpu.c

Log Message:
"save fp ipi" is an interrupt type counter, mark it so.


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/arch/sparc/sparc/cpu.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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.252 src/sys/arch/sparc/sparc/cpu.c:1.253
--- src/sys/arch/sparc/sparc/cpu.c:1.252	Wed Jan 17 07:38:20 2018
+++ src/sys/arch/sparc/sparc/cpu.c	Thu Feb  1 22:58:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $ */
+/*	$NetBSD: cpu.c,v 1.253 2018/02/01 22:58:44 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.253 2018/02/01 22:58:44 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -363,7 +363,7 @@ cpu_init_evcnt(struct cpu_info *cpi)
 	 * The "savefp null" counter should go away when the NULL
 	 * struct fpstate * bug is fixed.
 	 */
-	evcnt_attach_dynamic(>ci_savefpstate, EVCNT_TYPE_MISC,
+	evcnt_attach_dynamic(>ci_savefpstate, EVCNT_TYPE_INTR,
 			 NULL, cpu_name(cpi), "savefp ipi");
 	evcnt_attach_dynamic(>ci_savefpstate_null, EVCNT_TYPE_MISC,
 			 NULL, cpu_name(cpi), "savefp null ipi");



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

2018-01-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 25 14:45:58 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
do boundary checks when writing cursor sprite colour registers


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.84 src/sys/arch/sparc/dev/cgfourteen.c:1.85
--- src/sys/arch/sparc/dev/cgfourteen.c:1.84	Fri Jan 12 23:38:24 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Thu Jan 25 14:45:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.84 2018/01/12 23:38:24 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.85 2018/01/25 14:45:58 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1120,7 +1120,11 @@ cg14_do_cursor(struct cgfourteen_softc *
 	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
 		int i;
 		uint32_t val;
-	
+
+		if ((cur->cmap.index > 2) || (cur->cmap.count > 3) ||
+		(cur->cmap.index + cur->cmap.count > 3))
+			return EINVAL;
+
 		for (i = 0; i < min(cur->cmap.count, 3); i++) {
 			val = (cur->cmap.red[i] ) |
 			  (cur->cmap.green[i] << 8) |



CVS commit: src/sys/arch/sparc/sparc

2018-01-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jan 17 07:38:20 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: cpu.c cpuvar.h

Log Message:
fix previous:
CPUFLG_SUN4CACHEBUG was renamed to CACHE_TRAPPAGEBUG and moved
into the cacheinfo.  don't revive the no longer used value, but
fix the non-sun4m code to match cpu.c 1.251.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/sparc/cpuvar.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/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.251 src/sys/arch/sparc/sparc/cpu.c:1.252
--- src/sys/arch/sparc/sparc/cpu.c:1.251	Tue Jan 16 08:23:17 2018
+++ src/sys/arch/sparc/sparc/cpu.c	Wed Jan 17 07:38:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.251 2018/01/16 08:23:17 mrg Exp $ */
+/*	$NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.251 2018/01/16 08:23:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.252 2018/01/17 07:38:20 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -1187,7 +1187,7 @@ getcacheinfo_sun4(struct cpu_info *sc, i
 		ci->c_l2linesize = 4;
 		ci->c_split = 0;
 		ci->c_nlines = ci->c_totalsize >> ci->c_l2linesize;
-		sc->flags |= CPUFLG_SUN4CACHEBUG;
+		sc->cacheinfo.c_flags |= CACHE_TRAPPAGEBUG;
 		break;
 	case CPUTYP_4_400:
 		ci->c_vactype = VAC_WRITEBACK;
@@ -1321,7 +1321,7 @@ getcacheinfo_sun4c(struct cpu_info *sc, 
 	 * mysterious buserr-type variable)
 	 */
 	if (prom_getpropint(node, "buserr-type", 0) == 1)
-		sc->flags |= CPUFLG_SUN4CACHEBUG;
+		sc->cacheinfo.c_flags |= CACHE_TRAPPAGEBUG;
 }
 #endif /* SUN4C */
 

Index: src/sys/arch/sparc/sparc/cpuvar.h
diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.96 src/sys/arch/sparc/sparc/cpuvar.h:1.97
--- src/sys/arch/sparc/sparc/cpuvar.h:1.96	Wed Jan 17 02:39:16 2018
+++ src/sys/arch/sparc/sparc/cpuvar.h	Wed Jan 17 07:38:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.96 2018/01/17 02:39:16 christos Exp $ */
+/*	$NetBSD: cpuvar.h,v 1.97 2018/01/17 07:38:20 mrg Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -157,7 +157,6 @@ struct module_info {
 #define CPUFLG_HATCHED		0x1000	/* CPU is alive */
 #define CPUFLG_PAUSED		0x2000	/* CPU is paused */
 #define CPUFLG_GOTMSG		0x4000	/* CPU got an lev13 IPI */
-#define CPUFLG_SUN4CACHEBUG	0x8000	/* CPU has the sun4 cache bug */
 
 
 /*



CVS commit: src/sys/arch/sparc/sparc

2018-01-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 17 02:39:16 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: cpuvar.h

Log Message:
fix compilation


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/sparc/sparc/cpuvar.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/sparc/sparc/cpuvar.h
diff -u src/sys/arch/sparc/sparc/cpuvar.h:1.95 src/sys/arch/sparc/sparc/cpuvar.h:1.96
--- src/sys/arch/sparc/sparc/cpuvar.h:1.95	Tue Jan 16 03:23:17 2018
+++ src/sys/arch/sparc/sparc/cpuvar.h	Tue Jan 16 21:39:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuvar.h,v 1.95 2018/01/16 08:23:17 mrg Exp $ */
+/*	$NetBSD: cpuvar.h,v 1.96 2018/01/17 02:39:16 christos Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -157,6 +157,7 @@ struct module_info {
 #define CPUFLG_HATCHED		0x1000	/* CPU is alive */
 #define CPUFLG_PAUSED		0x2000	/* CPU is paused */
 #define CPUFLG_GOTMSG		0x4000	/* CPU got an lev13 IPI */
+#define CPUFLG_SUN4CACHEBUG	0x8000	/* CPU has the sun4 cache bug */
 
 
 /*



CVS commit: src/sys/arch/sparc/sparc

2018-01-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jan 15 21:25:25 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: cache.c

Log Message:
vcache_flush_* event counters are not interrupt type.  mark them misc.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sparc/sparc/cache.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/sparc/sparc/cache.c
diff -u src/sys/arch/sparc/sparc/cache.c:1.98 src/sys/arch/sparc/sparc/cache.c:1.99
--- src/sys/arch/sparc/sparc/cache.c:1.98	Fri Dec  1 22:57:07 2017
+++ src/sys/arch/sparc/sparc/cache.c	Mon Jan 15 21:25:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $ */
+/*	$NetBSD: cache.c,v 1.99 2018/01/15 21:25:25 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.99 2018/01/15 21:25:25 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -78,19 +78,19 @@ __KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.
 #include 
 
 struct evcnt vcache_flush_pg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","pg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","pg");
 EVCNT_ATTACH_STATIC(vcache_flush_pg);
 struct evcnt vcache_flush_seg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","seg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","seg");
 EVCNT_ATTACH_STATIC(vcache_flush_seg);
 struct evcnt vcache_flush_reg =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","reg");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","reg");
 EVCNT_ATTACH_STATIC(vcache_flush_reg);
 struct evcnt vcache_flush_ctx =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","ctx");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","ctx");
 EVCNT_ATTACH_STATIC(vcache_flush_ctx);
 struct evcnt vcache_flush_range =
-	EVCNT_INITIALIZER(EVCNT_TYPE_INTR,0,"vcfl","rng");
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,"vcfl","rng");
 EVCNT_ATTACH_STATIC(vcache_flush_range);
 
 int cache_alias_dist;		/* Cache anti-aliasing constants */



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

2018-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 15 10:06:49 UTC 2018

Modified Files:
src/sys/arch/sparc/include: reg.h

Log Message:
Redo previous: apply the alignement to the whole struct fpstate - everything
in there is properly aligned, and we need to have fs_queue double aligned
as well.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/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/sparc/include/reg.h
diff -u src/sys/arch/sparc/include/reg.h:1.10 src/sys/arch/sparc/include/reg.h:1.11
--- src/sys/arch/sparc/include/reg.h:1.10	Sun Jan 14 11:55:33 2018
+++ src/sys/arch/sparc/include/reg.h	Mon Jan 15 10:06:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: reg.h,v 1.10 2018/01/14 11:55:33 martin Exp $ */
+/*	$NetBSD: reg.h,v 1.11 2018/01/15 10:06:49 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -106,18 +106,19 @@ struct fp_qentry {
 struct fpreg {
 	u_int	fr_regs[32];		/* our view is 32 32-bit registers */
 	int	fr_fsr;			/* %fsr */
-}
-#ifdef _KERNEL
- __aligned(8)/* asm code uses std instructions */
-#endif
-;
+};
+
 struct fpstate {
 	struct fpreg fs_reg;
 #define fs_regs fs_reg.fr_regs
 #define fs_fsr	fs_reg.fr_fsr
 	int	fs_qsize;		/* actual queue depth */
 	struct	fp_qentry fs_queue[FP_QSIZE];	/* queue contents */
-};
+}
+#ifdef _KERNEL
+ __aligned(8)/* asm code uses std instructions */
+#endif
+;
 
 /*
  * The actual FP registers are made accessible (c.f. ptrace(2)) through



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

2018-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 15 09:48:28 UTC 2018

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

Log Message:
Enable DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/arch/sparc/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/sparc/conf/GENERIC
diff -u src/sys/arch/sparc/conf/GENERIC:1.256 src/sys/arch/sparc/conf/GENERIC:1.257
--- src/sys/arch/sparc/conf/GENERIC:1.256	Thu Sep 14 07:58:43 2017
+++ src/sys/arch/sparc/conf/GENERIC	Mon Jan 15 09:48:28 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.256 2017/09/14 07:58:43 mrg Exp $
+# $NetBSD: GENERIC,v 1.257 2018/01/15 09:48:28 martin Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include 	"arch/sparc/conf/std.sparc"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.256 $"
+#ident 		"GENERIC-$Revision: 1.257 $"
 
 maxusers	32
 
@@ -125,7 +125,7 @@ options 	DDB_HISTORY_SIZE=100	# enable h
 ## Adds code to the kernel that does internal consistency checks, and will
 ## cause the kernel to panic if corruption of internal data structures
 ## is detected.
-#options 	DIAGNOSTIC	# extra kernel sanity checking
+options 	DIAGNOSTIC	# extra kernel sanity checking
 
 ## Enable (possibly expensive) debugging code that may also display messages
 ## on the system console



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

2018-01-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 14 11:55:33 UTC 2018

Modified Files:
src/sys/arch/sparc/include: reg.h

Log Message:
Force explicit alignment for fpstate in the kernel, to match what our
asm code assumes.
We use a stack variable at least once (in fpu_init).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/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/sparc/include/reg.h
diff -u src/sys/arch/sparc/include/reg.h:1.9 src/sys/arch/sparc/include/reg.h:1.10
--- src/sys/arch/sparc/include/reg.h:1.9	Fri Dec 30 17:54:43 2016
+++ src/sys/arch/sparc/include/reg.h	Sun Jan 14 11:55:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: reg.h,v 1.9 2016/12/30 17:54:43 christos Exp $ */
+/*	$NetBSD: reg.h,v 1.10 2018/01/14 11:55:33 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -106,7 +106,11 @@ struct fp_qentry {
 struct fpreg {
 	u_int	fr_regs[32];		/* our view is 32 32-bit registers */
 	int	fr_fsr;			/* %fsr */
-};
+}
+#ifdef _KERNEL
+ __aligned(8)/* asm code uses std instructions */
+#endif
+;
 struct fpstate {
 	struct fpreg fs_reg;
 #define fs_regs fs_reg.fr_regs



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

2018-01-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 12 23:38:24 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
enable font loading


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.83 src/sys/arch/sparc/dev/cgfourteen.c:1.84
--- src/sys/arch/sparc/dev/cgfourteen.c:1.83	Sat Jan  6 07:26:54 2018
+++ src/sys/arch/sparc/dev/cgfourteen.c	Fri Jan 12 23:38:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.84 2018/01/12 23:38:24 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -724,7 +724,8 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		WSSCREEN_RESIZE,
 		NULL
 	};
 	cg14_set_depth(sc, 8);
@@ -734,6 +735,8 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	vcons_init(>sc_vd, sc, >sc_defaultscreen_descr,
 	_accessops);
 	sc->sc_vd.init_screen = cg14_init_screen;
+	sc->sc_vd.show_screen_cookie = >sc_gc;
+	sc->sc_vd.show_screen_cb = glyphcache_adapt;
 
 	ri = >sc_console_screen.scr_ri;
 
@@ -1009,6 +1012,8 @@ cg14_init_screen(void *cookie, struct vc
 	ri->ri_flg = RI_CENTER | RI_FULLCLEAR;
 
 	ri->ri_bits = (char *)sc->sc_fb.fb_pixels;
+
+	scr->scr_flags |= VCONS_LOADFONT;
 #if NSX > 0
 	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 
@@ -1020,14 +1025,15 @@ cg14_init_screen(void *cookie, struct vc
 		scr->scr_flags |= VCONS_NO_COPYCOLS;
 	} else
 #endif
-	scr->scr_flags |= VCONS_DONT_READ;
+		scr->scr_flags |= VCONS_DONT_READ;
 
 	if (existing) {
 		ri->ri_flg |= RI_CLEAR;
 	}
 
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		  WSSCREEN_RESIZE;
 
 	rasops_reconfig(ri,
 	sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight,



CVS commit: src/sys/arch/sparc/sparc

2018-01-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jan 12 09:47:44 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: timer.c

Log Message:
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/sparc/timer.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.33 src/sys/arch/sparc/sparc/timer.c:1.34
--- src/sys/arch/sparc/sparc/timer.c:1.33	Fri Jan 12 06:01:33 2018
+++ src/sys/arch/sparc/sparc/timer.c	Fri Jan 12 09:47:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.34 2018/01/12 09:47:44 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.34 2018/01/12 09:47:44 mrg Exp $");
 
 #include 
 #include 
@@ -162,17 +162,11 @@ timer_get_timecount(struct timecounter *
 
 	/*
 	 * This handles early-boot cases where the counter resets twice
-	 * before the offset is updated.
+	 * before the offset is updated, and we have a stupid check to
+	 * ensure overflow hasn't happened.
 	 */
-	if (res < cntr.lastres) {
-		if (fixup == 0)
-			fixup = cntr.limit;
-		while (res < cntr.lastres) {
-			if (res > UINT_MAX - fixup)
-break;
-			res += fixup;
-		}
-	}
+	if (res < cntr.lastres && res > (TMR_MASK+1) << 3)
+		res = cntr.lastres + 1;
 
 	cntr.lastres = res;
 



CVS commit: src/sys/arch/sparc/sparc

2018-01-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jan 12 06:01:34 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: timer.c timer_sun4m.c timerreg.h

Log Message:
fix time goes backwards problems on sparc.

there are a few things here:
- there's a race between reading the limit register (which clears
  the interrupt and the limit bit) and increasing the latest offset.
  this can happen easily if an interrupt comes between the read and
  the call to tickle_tc() that increases the offset (i obverved this
  actually happening.)
- in early boot, sometimes the counter can cycle twice before the
  tickle happens.

to handle these issues, add two workarounds:
- if the limit bit isn't set, but the counter value is less than
  the previous value, and the offset hasn't changed, use the same
  fixup as if the limit bit was set.  this handles the first case
  above.
- add a hard-workaround for never allowing returning a smaller
  value (except during 32 bit overflow): if the result is less than
  the last result, add fixups until it does (or until it would
  overflow.)

the first workaround fixes general run-time issues, and the second
fixes issues only seen during boot.

also expand some comments in timer_sun4m.c and re-enable the sun4m
sub-microsecond tmr_ustolim4m() support (but it's always called with
at least 'tick' microseconds, so the end result is the same.)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/sparc/timer.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc/sparc/timer_sun4m.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c
diff -u src/sys/arch/sparc/sparc/timer.c:1.32 src/sys/arch/sparc/sparc/timer.c:1.33
--- src/sys/arch/sparc/sparc/timer.c:1.32	Sun Jan 19 00:22:33 2014
+++ src/sys/arch/sparc/sparc/timer.c	Fri Jan 12 06:01:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $ */
+/*	$NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.32 2014/01/19 00:22:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $");
 
 #include 
 #include 
@@ -85,55 +85,98 @@ void *sched_cookie;
  * timecounter local state
  */
 static struct counter {
-	volatile u_int *cntreg;	/* counter register */
+	__cpu_simple_lock_t lock; /* protects access to offset, reg, last* */
+	volatile u_int *cntreg;	/* counter register to read */
 	u_int limit;		/* limit we count up to */
 	u_int offset;		/* accumulated offset due to wraps */
 	u_int shift;		/* scaling for valid bits */
 	u_int mask;		/* valid bit mask */
-} cntr;
+	u_int lastcnt;		/* the last* values are used to notice */
+	u_int lastres;		/* and fix up cases where it would appear */
+	u_int lastoffset;	/* time went backwards. */
+} cntr __aligned(CACHE_LINE_SIZE);
 
 /*
  * define timecounter
  */
 
 static struct timecounter counter_timecounter = {
-	timer_get_timecount,	/* get_timecount */
-	0,			/* no poll_pps */
-	~0u,			/* counter_mask */
-	0,  /* frequency - set at initialisation */
-	"timer-counter",	/* name */
-	100,			/* quality */
-/* private reference */
+	.tc_get_timecount =	timer_get_timecount,
+	.tc_poll_pps =		NULL,
+	.tc_counter_mask =	~0u,
+	.tc_frequency =		0,
+	.tc_name =		"timer-counter",
+	.tc_quality =		100,
+	.tc_priv =		,
 };
 
 /*
  * timer_get_timecount provide current counter value
  */
+__attribute__((__optimize__("Os")))
 static u_int
 timer_get_timecount(struct timecounter *tc)
 {
-	struct counter *ctr = (struct counter *)tc->tc_priv;
-
-	u_int c, res, r;
+	u_int cnt, res, fixup, offset;
 	int s;
 
+	/*
+	 * We use splhigh/__cpu_simple_lock here as we don't want
+	 * any mutex or lockdebug overhead.  The lock protects a
+	 * bunch of the members of cntr that are written here to
+	 * deal with the various minor races to be observed and
+	 * worked around.
+	 */
 	s = splhigh();
-
-	res = c = *ctr->cntreg;
+	__cpu_simple_lock();
+	res = cnt = *cntr.cntreg;
 
 	res &= ~TMR_LIMIT;
+	offset = cntr.offset;
 
-	if (c != res) {
-		r = ctr->limit;
+	/*
+	 * There are 3 cases here:
+	 * - limit reached, interrupt not yet processed.
+	 * - count reset but offset the same, race between handling
+	 *   the interrupt and tickle_tc() updating the offset.
+	 * - normal case.
+	 *
+	 * For the first two cases, add the limit so that we avoid
+	 * time going backwards.
+	 */
+	if (cnt != res) {
+		fixup = cntr.limit;
+	} else if (res < cntr.lastcnt && offset == cntr.lastoffset) {
+		fixup = cntr.limit;
 	} else {
-		r = 0;
+		fixup = 0;
 	}
+
+	cntr.lastcnt = res;
+	cntr.lastoffset = offset;
 	
-	res >>= ctr->shift;
-	res  &= ctr->mask;
+	res >>= cntr.shift;
+	res  &= cntr.mask;
+
+	res += fixup + offset;
 
-	res += r + 

CVS commit: src/sys/arch/sparc/sparc

2018-01-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jan 10 01:49:05 UTC 2018

Modified Files:
src/sys/arch/sparc/sparc: memecc.c

Log Message:
s/level 25/level 15/ -- there's nothing higher than 15 on sparc, and
this is talking about NMI.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/sparc/memecc.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/sparc/sparc/memecc.c
diff -u src/sys/arch/sparc/sparc/memecc.c:1.16 src/sys/arch/sparc/sparc/memecc.c:1.17
--- src/sys/arch/sparc/sparc/memecc.c:1.16	Sat Oct 19 19:40:23 2013
+++ src/sys/arch/sparc/sparc/memecc.c	Wed Jan 10 01:49:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: memecc.c,v 1.16 2013/10/19 19:40:23 mrg Exp $	*/
+/*	$NetBSD: memecc.c,v 1.17 2018/01/10 01:49:05 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.16 2013/10/19 19:40:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: memecc.c,v 1.17 2018/01/10 01:49:05 mrg Exp $");
 
 #include 
 #include 
@@ -114,7 +114,7 @@ memecc_attach(device_t parent, device_t 
 }
 
 /*
- * Called if the MEMORY ERROR bit is set after a level 25 interrupt.
+ * Called if the MEMORY ERROR bit is set after a level 15 interrupt.
  */
 int
 memecc_error(void)



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

2018-01-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Jan  6 07:26:54 UTC 2018

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support underlines


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.82 src/sys/arch/sparc/dev/cgfourteen.c:1.83
--- src/sys/arch/sparc/dev/cgfourteen.c:1.82	Fri Sep 16 22:39:35 2016
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sat Jan  6 07:26:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.82 2016/09/16 22:39:35 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -163,6 +163,7 @@ static int  cg14_do_cursor(struct cgfour
 static void cg14_wait_idle(struct cgfourteen_softc *);
 static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int,
 uint32_t);
+static void cg14_rectfill_a(void *, int, int, int, int, long);
 static void cg14_invert(struct cgfourteen_softc *, int, int, int, int);
 static void cg14_bitblt(void *, int, int, int, int, int, int, int);
 static void cg14_bitblt_gc(void *, int, int, int, int, int, int, int);
@@ -723,7 +724,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE,
 		NULL
 	};
 	cg14_set_depth(sc, 8);
@@ -738,6 +739,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 
 	sc->sc_gc.gc_bitblt = cg14_bitblt_gc;
 	sc->sc_gc.gc_blitcookie = sc;
+	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
 	if (is_cons) {
 		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
@@ -1008,7 +1010,7 @@ cg14_init_screen(void *cookie, struct vc
 
 	ri->ri_bits = (char *)sc->sc_fb.fb_pixels;
 #if NSX > 0
-	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA;
+	ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 
 	/*
 	 * unaligned copies with horizontal overlap are slow, so don't bother
@@ -1025,7 +1027,7 @@ cg14_init_screen(void *cookie, struct vc
 	}
 
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE;
 
 	rasops_reconfig(ri,
 	sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight,
@@ -1209,7 +1211,7 @@ cg14_rectfill(struct cgfourteen_softc *s
 			cnt -= pre;
 		}
 		/* now do the aligned pixels in 32bit chunks */
-		while(cnt > 31) {
+		while(cnt > 3) {
 			words = min(32, cnt >> 2);
 			sta(pptr & ~7, ASI_SX, SX_STS(8, words - 1, pptr & 7));
 			pptr += words << 2;
@@ -1223,6 +1225,16 @@ cg14_rectfill(struct cgfourteen_softc *s
 }
 
 static void
+cg14_rectfill_a(void *cookie, int dstx, int dsty,
+int width, int height, long attr)
+{
+	struct cgfourteen_softc *sc = cookie;
+
+	cg14_rectfill(sc, dstx, dsty, width, height,
+	sc->sc_vd.active->scr_ri.ri_devcmap[(attr >> 24 & 0xf)]);
+}
+
+static void
 cg14_invert(struct cgfourteen_softc *sc, int x, int y, int wi, int he)
 {
 	uint32_t addr, pptr;
@@ -1459,17 +1471,20 @@ cg14_putchar(void *cookie, int row, int 
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
 	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
-	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
-	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
 
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
+	sx_write(sc->sc_sx, SX_QUEUED(8), bg);
+	sx_write(sc->sc_sx, SX_QUEUED(9), fg);
+
 	data = WSFONT_GLYPH(c, font);
 	addr = sc->sc_fb_paddr + x + stride * y;
 
@@ -1501,6 +1516,8 @@ cg14_putchar(void *cookie, int row, int 
 			break;
 		}
 	}
+	if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 }
 
 static void
@@ -1545,7 +1562,7 @@ cg14_putchar_aa(void *cookie, int row, i
 	struct vcons_screen *scr = ri->ri_hw;
 	struct cgfourteen_softc *sc = scr->scr_cookie;
 	int stride = sc->sc_fb.fb_type.fb_width;
-	uint32_t bg, addr, bg8, fg8, pixel, in, q, next;
+	uint32_t bg, fg, addr, bg8, fg8, pixel, in, q, next;
 	int i, j, x, y, wi, he, r, g, b, aval, cnt, reg;
 	int r1, g1, b1, r0, g0, b0, fgo, bgo, rv;
 	uint8_t *data8;
@@ -1560,10 +1577,13 @@ cg14_putchar_aa(void *cookie, int row, i
 	he = font->fontheight;
 
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
 	if (c == 0x20) {
 		cg14_rectfill(sc, x, y, wi, he, bg);
+		if (attr & 1)
+			cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 		return;
 	}
 
@@ -1641,7 +1661,9 @@ cg14_putchar_aa(void *cookie, int row, i
 
 	if (rv == GC_ADD) {
 		glyphcache_add(>sc_gc, c, x, y);
-	}
+	} else if (attr & 1)
+		cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
+
 }
 
 static void



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

2017-12-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Dec  8 22:28:54 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
fix tpyos and pastos


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.15 src/sys/arch/sparc/dev/sxreg.h:1.16
--- src/sys/arch/sparc/dev/sxreg.h:1.15	Thu Dec  7 19:15:56 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Fri Dec  8 22:28:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.15 2017/12/07 19:15:56 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.16 2017/12/08 22:28:54 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -293,9 +293,9 @@
 /* MISC group */
 #define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
 #define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
-#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_GTHR | \
-		((sa) << 14) | ((d << 7) | (sb))
-#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_SCRT | \
-		((sa) << 14) | ((d << 7) | (sb))
+#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt) << 24) | SX_GTHR | \
+		 ((sa) << 14) | ((d) << 7) | (sb))
+#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt) << 24) | SX_SCTR | \
+		 ((sa) << 14) | ((d) << 7) | (sb))
 
 #endif /* SXREG_H */



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

2017-12-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec  7 19:15:56 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add SCATTER/GATHER instructions


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.14 src/sys/arch/sparc/dev/sxreg.h:1.15
--- src/sys/arch/sparc/dev/sxreg.h:1.14	Mon Oct 30 21:41:39 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Thu Dec  7 19:15:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.14 2017/10/30 21:41:39 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.15 2017/12/07 19:15:56 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -290,4 +290,12 @@
 #define SX_ADDV(sa, sb, d, cnt) (0xa000 | ((cnt) << 24) | SX_ADD_V | \
 		((sa) << 14) | ((d) << 7) | (sb))
 
+/* MISC group */
+#define SX_GTHR		(3 << 21)	/* sa with spacing sb -> d */
+#define SX_SCTR		(2 << 21)	/* sa -> d with spacing sb */
+#define SX_GATHER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_GTHR | \
+		((sa) << 14) | ((d << 7) | (sb))
+#define SX_SCATTER(sa, sb, d, cnt) (0xe000 | ((cnt << 24) | SX_SCRT | \
+		((sa) << 14) | ((d << 7) | (sb))
+
 #endif /* SXREG_H */



CVS commit: src/sys/arch/sparc

2017-12-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Dec  2 00:48:05 UTC 2017

Modified Files:
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc/sparc: cpu.c intr.c

Log Message:
- return early in xcall() if the function is sparc_noop() instead of triggering
  the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
  IPI
- add event counters for IPIs being caught with the mutex not held, and for
  messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.249 -r1.250 src/sys/arch/sparc/sparc/cpu.c
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/sparc/sparc/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/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.98 src/sys/arch/sparc/include/cpu.h:1.99
--- src/sys/arch/sparc/include/cpu.h:1.98	Fri Jun 16 18:17:42 2017
+++ src/sys/arch/sparc/include/cpu.h	Sat Dec  2 00:48:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.98 2017/06/16 18:17:42 jdolecek Exp $ */
+/*	$NetBSD: cpu.h,v 1.99 2017/12/02 00:48:04 macallan Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -164,7 +164,7 @@ struct cpu_info {
 	 * the pending register to avoid a hardware bug.
 	 */
 #define raise_ipi(cpi,lvl)	do {			\
-	int x;		\
+	volatile int x;		\
 	(cpi)->intreg_4m->pi_set = PINTR_SINTRLEV(lvl);	\
 	x = (cpi)->intreg_4m->pi_pend; __USE(x);	\
 } while (0)
@@ -333,6 +333,8 @@ struct cpu_info {
 	struct evcnt ci_savefpstate_null;
 	struct evcnt ci_xpmsg_mutex_fail;
 	struct evcnt ci_xpmsg_mutex_fail_call;
+	struct evcnt ci_xpmsg_mutex_not_held;
+	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
 };

Index: src/sys/arch/sparc/sparc/cpu.c
diff -u src/sys/arch/sparc/sparc/cpu.c:1.249 src/sys/arch/sparc/sparc/cpu.c:1.250
--- src/sys/arch/sparc/sparc/cpu.c:1.249	Wed Jan 18 21:33:25 2017
+++ src/sys/arch/sparc/sparc/cpu.c	Sat Dec  2 00:48:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.249 2017/01/18 21:33:25 macallan Exp $ */
+/*	$NetBSD: cpu.c,v 1.250 2017/12/02 00:48:05 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.249 2017/01/18 21:33:25 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.250 2017/12/02 00:48:05 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -183,7 +183,7 @@ int go_smp_cpus = 0;	/* non-primary CPUs
  * This must be locked around all message transactions to ensure only
  * one CPU is generating them.
  */
-static kmutex_t xpmsg_mutex;
+kmutex_t xpmsg_mutex;
 
 #endif /* MULTIPROCESSOR */
 
@@ -367,6 +367,10 @@ cpu_init_evcnt(struct cpu_info *cpi)
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail");
 	evcnt_attach_dynamic(>ci_xpmsg_mutex_fail_call, EVCNT_TYPE_MISC,
 			 NULL, cpu_name(cpi), "IPI mutex_trylock fail/call");
+	evcnt_attach_dynamic(>ci_xpmsg_mutex_not_held, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "IPI with mutex not held");
+	evcnt_attach_dynamic(>ci_xpmsg_bogus, EVCNT_TYPE_MISC,
+			 NULL, cpu_name(cpi), "bogus IPI");
 
 	/*
 	 * These are the per-cpu per-IPL hard & soft interrupt counters.
@@ -653,6 +657,8 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	char *bufp = errbuf;
 	size_t bufsz = sizeof errbuf, wrsz;
 
+	if (is_noop) return;
+
 	mybit = (1 << cpuinfo.ci_cpuid);
 	callself = func && (cpuset & mybit) != 0;
 	cpuset &= ~mybit;
@@ -714,7 +720,10 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		if ((cpuset & (1 << n)) == 0)
 			continue;
 
-		cpi->msg.tag = XPMSG_FUNC;
+		/*
+		 * Write msg.tag last - if another CPU is polling above it may
+		 * end up seeing an incomplete message. Not likely but still.
+		 */ 
 		cpi->msg.complete = 0;
 		p = >msg.u.xpmsg_func;
 		p->func = func;
@@ -722,6 +731,9 @@ xcall(xcall_func_t func, xcall_trap_t tr
 		p->arg0 = arg0;
 		p->arg1 = arg1;
 		p->arg2 = arg2;
+		__insn_barrier();
+		cpi->msg.tag = XPMSG_FUNC;
+		__insn_barrier();
 		/* Fast cross calls use interrupt level 14 */
 		raise_ipi(cpi,13+fasttrap);/*xcall_cookie->pil*/
 	}
@@ -737,7 +749,7 @@ xcall(xcall_func_t func, xcall_trap_t tr
 	 * have completed (bailing if it takes "too long", being loud about
 	 * this in the process).
 	 */
-	done = is_noop;
+	done = 0;
 	i = 100;	/* time-out, not too long, but still an _AGE_ */
 	while (!done) {
 		if (--i < 0) {
@@ -774,7 +786,7 @@ xcall(xcall_func_t func, xcall_trap_t tr
 
 	

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

2017-12-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec  1 23:14:20 UTC 2017

Modified Files:
src/sys/arch/sparc/include: pte.h

Log Message:
- normalise some tab/space issues.
- fix (debugger-only useful) struct srmmu_pte::pg_pfnum to be the
  right size.
- add SRMMU_TEPTERBO as a PTE type -- supersparc-II only feature
  of mapping pages in reverse-byte-order (eg little endian by
  default, but there's also a global RBO flag, that makes this
  flag big-endian.)  we don't use it (yet?)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/sparc/include/pte.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/sparc/include/pte.h
diff -u src/sys/arch/sparc/include/pte.h:1.31 src/sys/arch/sparc/include/pte.h:1.32
--- src/sys/arch/sparc/include/pte.h:1.31	Thu Feb 16 20:17:15 2006
+++ src/sys/arch/sparc/include/pte.h	Fri Dec  1 23:14:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pte.h,v 1.31 2006/02/16 20:17:15 perry Exp $ */
+/*	$NetBSD: pte.h,v 1.32 2017/12/01 23:14:20 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -187,32 +187,32 @@ typedef u_char smeg_t;		/* 8 bits needed
 #error "configuration error"
 #endif
 
-#define	NBPRG	(1 << 24)	/* bytes per region */
-#define	RGSHIFT	24		/* log2(NBPRG) */
-#define	RGOFSET	(NBPRG - 1)	/* mask for region offset */
+#define NBPRG	(1 << 24)	/* bytes per region */
+#define RGSHIFT	24		/* log2(NBPRG) */
+#define RGOFSET	(NBPRG - 1)	/* mask for region offset */
 #define NSEGRG	(NBPRG / NBPSG)	/* segments per region */
 
-#define	NBPSG	(1 << 18)	/* bytes per segment */
-#define	SGSHIFT	18		/* log2(NBPSG) */
-#define	SGOFSET	(NBPSG - 1)	/* mask for segment offset */
+#define NBPSG	(1 << 18)	/* bytes per segment */
+#define SGSHIFT	18		/* log2(NBPSG) */
+#define SGOFSET	(NBPSG - 1)	/* mask for segment offset */
 
 /* number of PTEs that map one segment (not number that fit in one segment!) */
 #if defined(SUN4) && (defined(SUN4C) || defined(SUN4M) || defined(SUN4D))
 extern int nptesg;
-#define	NPTESG	nptesg		/* (which someone will have to initialize) */
+#define NPTESG	nptesg		/* (which someone will have to initialize) */
 #else
-#define	NPTESG	(NBPSG / NBPG)
+#define NPTESG	(NBPSG / NBPG)
 #endif
 
 /* virtual address to virtual region number */
-#define	VA_VREG(va)	(((unsigned int)(va) >> RGSHIFT) & 255)
+#define VA_VREG(va)	(((unsigned int)(va) >> RGSHIFT) & 255)
 
 /* virtual address to virtual segment number */
-#define	VA_VSEG(va)	(((unsigned int)(va) >> SGSHIFT) & 63)
+#define VA_VSEG(va)	(((unsigned int)(va) >> SGSHIFT) & 63)
 
 /* virtual address to virtual page number, for Sun-4 and Sun-4c */
-#define	VA_SUN4_VPG(va)		(((int)(va) >> 13) & 31)
-#define	VA_SUN4C_VPG(va)	(((int)(va) >> 12) & 63)
+#define VA_SUN4_VPG(va)		(((int)(va) >> 13) & 31)
+#define VA_SUN4C_VPG(va)	(((int)(va) >> 12) & 63)
 #define VA_SUN4M_VPG(va)	(((int)(va) >> 12) & 63)
 #define VA_VPG(va)	\
 	(PGSHIFT==SUN4_PGSHIFT ? VA_SUN4_VPG(va) : VA_SUN4C_VPG(va))
@@ -226,16 +226,16 @@ extern int nptesg;
 
 
 /* truncate virtual address to region base */
-#define	VA_ROUNDDOWNTOREG(va)	((int)(va) & ~RGOFSET)
+#define VA_ROUNDDOWNTOREG(va)	((int)(va) & ~RGOFSET)
 
 /* truncate virtual address to segment base */
-#define	VA_ROUNDDOWNTOSEG(va)	((int)(va) & ~SGOFSET)
+#define VA_ROUNDDOWNTOSEG(va)	((int)(va) & ~SGOFSET)
 
 /* virtual segment to virtual address (must sign extend on holy MMUs!) */
-#define	VRTOVA(vr)	((CPU_HAS_SRMMU || HASSUN4_MMU3L)	\
+#define VRTOVA(vr)	((CPU_HAS_SRMMU || HASSUN4_MMU3L)	\
 	? ((int)(vr) << RGSHIFT)\
 	: (((int)(vr) << (RGSHIFT+2)) >> 2))
-#define	VSTOVA(vr,vs)	((CPU_HAS_SRMMU || HASSUN4_MMU3L)	\
+#define VSTOVA(vr,vs)	((CPU_HAS_SRMMU || HASSUN4_MMU3L)	\
 	? (((int)(vr) << RGSHIFT) + ((int)(vs) << SGSHIFT))	\
 	: int)(vr) << (RGSHIFT+2)) >> 2) + ((int)(vs) << SGSHIFT)))
 
@@ -249,38 +249,38 @@ extern int mmu_has_hole;
 #define MMU_HOLE_END	0xe000
 
 /* there is no `struct pte'; we just use `int'; this is for non-4M only */
-#define	PG_V		0x8000
-#define	PG_PROT		0x6000	/* both protection bits */
-#define	PG_W		0x4000	/* allowed to write */
-#define	PG_S		0x2000	/* supervisor only */
-#define	PG_NC		0x1000	/* non-cacheable */
-#define	PG_TYPE		0x0c00	/* both type bits */
-
-#define	PG_OBMEM	0x	/* on board memory */
-#define	PG_OBIO		0x0400	/* on board I/O (incl. Sbus on 4c) */
-#define	PG_VME16	0x0800	/* 16-bit-data VME space */
-#define	PG_VME32	0x0c00	/* 32-bit-data VME space */
+#define PG_V		0x8000
+#define PG_PROT		0x6000	/* both protection bits */
+#define PG_W		0x4000	/* allowed to write */
+#define PG_S		0x2000	/* supervisor only */
+#define PG_NC		0x1000	/* non-cacheable */
+#define PG_TYPE		0x0c00	/* both type bits */
+
+#define PG_OBMEM	0x	/* on board memory */
+#define PG_OBIO		0x0400	/* on board I/O (incl. Sbus on 4c) */
+#define PG_VME16	

CVS commit: src/sys/arch/sparc/sparc

2017-12-01 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Dec  1 22:57:07 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: cache.c

Log Message:
note some bits no longer present in SuperSPARC-II.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sparc/sparc/cache.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/sparc/sparc/cache.c
diff -u src/sys/arch/sparc/sparc/cache.c:1.97 src/sys/arch/sparc/sparc/cache.c:1.98
--- src/sys/arch/sparc/sparc/cache.c:1.97	Sun Mar  4 09:03:34 2007
+++ src/sys/arch/sparc/sparc/cache.c	Fri Dec  1 22:57:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.c,v 1.97 2007/03/04 09:03:34 macallan Exp $ */
+/*	$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.97 2007/03/04 09:03:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.98 2017/12/01 22:57:07 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -973,8 +973,8 @@ viking_pcache_flush_page(paddr_t pa, int
 		 * +---+-+---+-+---+-+---++
 		 *
 		 * PA: bits 12-35 of the physical address
-		 * S:  line shared bit
-		 * D:  line dirty bit
+		 * S:  line shared bit (not present on SuperSPARC-II)
+		 * D:  line dirty bit (not present on SuperSPARC-II)
 		 * V:  line valid bit
 		 */
 



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

2017-11-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 29 17:49:04 UTC 2017

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

Log Message:
include  for sigset_t


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/include/signal.h

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

Modified files:

Index: src/sys/arch/sparc/include/signal.h
diff -u src/sys/arch/sparc/include/signal.h:1.22 src/sys/arch/sparc/include/signal.h:1.23
--- src/sys/arch/sparc/include/signal.h:1.22	Wed Nov 19 13:36:00 2008
+++ src/sys/arch/sparc/include/signal.h	Wed Nov 29 12:49:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: signal.h,v 1.22 2008/11/19 18:36:00 ad Exp $ */
+/*	$NetBSD: signal.h,v 1.23 2017/11/29 17:49:03 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -51,7 +51,7 @@ typedef int sig_atomic_t;
 
 #if defined(_NETBSD_SOURCE)
 #ifndef _LOCORE
-
+#include 
 /*
  * Information pushed on stack when a signal is delivered.
  * This is used by the kernel to restore state following



CVS commit: src/sys/arch/sparc/sparc

2017-11-24 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Nov 25 04:11:37 UTC 2017

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

Log Message:
Avoid an instruction requiring a higher alignment than we are guaranteed

Fixes PR port-sparc/52721: ddb errors on ps command
Thanks to mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.268 src/sys/arch/sparc/sparc/locore.s:1.269
--- src/sys/arch/sparc/sparc/locore.s:1.268	Sun Nov  4 00:32:47 2012
+++ src/sys/arch/sparc/sparc/locore.s	Sat Nov 25 04:11:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.268 2012/11/04 00:32:47 chs Exp $	*/
+/*	$NetBSD: locore.s,v 1.269 2017/11/25 04:11:37 maya Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -6288,8 +6288,9 @@ ENTRY(longjmp)
 	cmp	%fp, %g7	! compare against desired frame
 	bl,a	1b		! if below,
 	 restore		!pop frame and loop
-	be,a	2f		! if there,
-	 ldd	[%g1+0], %o2	!fetch return %sp and pc, and get out
+	ld	[%g1+0], %o2	! fetch return %sp
+	be,a	2f		! we're there, get out
+	 ld	[%g1+4], %o3	! fetch return pc
 
 Llongjmpbotch:
 ! otherwise, went too far; bomb out



CVS commit: src/sys/arch/sparc/sparc

2017-11-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Nov  5 01:18:15 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: kobj_machdep.c

Log Message:
fix type of addr.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/sparc/kobj_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/sparc/sparc/kobj_machdep.c
diff -u src/sys/arch/sparc/sparc/kobj_machdep.c:1.4 src/sys/arch/sparc/sparc/kobj_machdep.c:1.5
--- src/sys/arch/sparc/sparc/kobj_machdep.c:1.4	Fri Nov  3 05:59:08 2017
+++ src/sys/arch/sparc/sparc/kobj_machdep.c	Sat Nov  4 21:18:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobj_machdep.c,v 1.4 2017/11/03 09:59:08 maxv Exp $	*/
+/*	$NetBSD: kobj_machdep.c,v 1.5 2017/11/05 01:18:15 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -126,9 +126,9 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas
 	   bool isrela, bool local)
 {
 	const Elf_Rela *rela;
-	Elf_Addr *where;
+	Elf_Addr *where, addr;
 	Elf_Word value, mask;
-	uintptr_t tmp, addr;
+	uintptr_t tmp;
 	u_int symidx, type;
 	int error;
 



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

2017-10-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Oct 30 21:41:39 UTC 2017

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add load & store instructions for channel data type
mostly for Xorg


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.13 src/sys/arch/sparc/dev/sxreg.h:1.14
--- src/sys/arch/sparc/dev/sxreg.h:1.13	Fri Jan 13 21:49:46 2017
+++ src/sys/arch/sparc/dev/sxreg.h	Mon Oct 30 21:41:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.13 2017/01/13 21:49:46 macallan Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.14 2017/10/30 21:41:39 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -158,6 +158,14 @@
 SX_UQUAD_16 | (dreg << 7) | (o))
 #define SX_LDUQ24(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_UQUAD_24 | (dreg << 7) | (o))
+#define SX_LDUC0(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_0 | (dreg << 7) | (o))
+#define SX_LDUC8(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_8 | (dreg << 7) | (o))
+#define SX_LDUC16(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_16 | (dreg << 7) | (o))
+#define SX_LDUC24(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_UCHAN_24 | (dreg << 7) | (o))
 #define SX_ST(sreg, cnt, o)  (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_LONG | (sreg << 7) | (o))
 #define SX_STM(sreg, cnt, o)  (0x8000 | ((cnt) << 23) | SX_STORE_MASK | \
@@ -184,6 +192,16 @@
 SX_UQUAD_16 | (sreg << 7) | (o))
 #define SX_STUQ24(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_UQUAD_24 | (sreg << 7) | (o))
+#define SX_STUC0(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_0 | (sreg << 7) | (o))
+#define SX_STUC0C(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_CLAMP | \
+SX_UCHAN_0 | (sreg << 7) | (o))
+#define SX_STUC8(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_8 | (sreg << 7) | (o))
+#define SX_STUC16(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_16 | (sreg << 7) | (o))
+#define SX_STUC24(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_UCHAN_24 | (sreg << 7) | (o))
 
 /* ROP and SELECT instructions */
 #define SX_ROPB	(0x0 << 21)	/* mask bits apply to bytes */



CVS commit: src/sys/arch/sparc

2017-07-21 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jul 21 20:56:10 UTC 2017

Modified Files:
src/sys/arch/sparc/conf: files.sparc
src/sys/arch/sparc/sparc: db_interface.c
Added Files:
src/sys/arch/sparc/sparc: db_machdep.c

Log Message:
Move the ddb registers and empty command table used for crash(8) into
db_machdep.c like other archs.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/sparc/conf/files.sparc
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/sparc/sparc/db_interface.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/sparc/db_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/sparc/conf/files.sparc
diff -u src/sys/arch/sparc/conf/files.sparc:1.156 src/sys/arch/sparc/conf/files.sparc:1.157
--- src/sys/arch/sparc/conf/files.sparc:1.156	Sat Apr 30 05:24:45 2016
+++ src/sys/arch/sparc/conf/files.sparc	Fri Jul 21 20:56:10 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc,v 1.156 2016/04/30 05:24:45 macallan Exp $
+#	$NetBSD: files.sparc,v 1.157 2017/07/21 20:56:10 nakayama Exp $
 
 # @(#)files.sparc	8.1 (Berkeley) 7/19/93
 # sparc-specific configuration info
@@ -317,6 +317,7 @@ file	arch/sparc/sparc/trap.c
 file	arch/sparc/sparc/vm_machdep.c
 
 file	arch/sparc/sparc/db_interface.c	ddb | kgdb
+file	arch/sparc/sparc/db_machdep.c	ddb
 file	arch/sparc/sparc/db_trace.c	ddb
 file	arch/sparc/sparc/db_disasm.c	ddb
 

Index: src/sys/arch/sparc/sparc/db_interface.c
diff -u src/sys/arch/sparc/sparc/db_interface.c:1.93 src/sys/arch/sparc/sparc/db_interface.c:1.94
--- src/sys/arch/sparc/sparc/db_interface.c:1.93	Wed Dec 14 18:50:56 2016
+++ src/sys/arch/sparc/sparc/db_interface.c	Fri Jul 21 20:56:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.93 2016/12/14 18:50:56 mrg Exp $ */
+/*	$NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $ */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.93 2016/12/14 18:50:56 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.94 2017/07/21 20:56:10 nakayama Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -113,8 +113,6 @@ db_write_bytes(vaddr_t addr, size_t size
 }
 #endif
 
-db_regs_t *ddb_regp;
-
 #if defined(DDB)
 
 /*
@@ -132,81 +130,6 @@ cpu_Debugger(void)
 
 #if defined(DDB) || defined(_KMEMUSER)
 
-static long nil;
-
-/*
- * Machine register set.
- */
-#define dbreg(xx) (long *)offsetof(db_regs_t, db_tf.tf_ ## xx)
-#define dbregfr(xx) (long *)offsetof(db_regs_t, db_fr.fr_ ## xx)
-
-static int db_sparc_regop(const struct db_variable *, db_expr_t *, int);
-
-const struct db_variable db_regs[] = {
-	{ "psr",	dbreg(psr),		db_sparc_regop, NULL, },
-	{ "pc",		dbreg(pc),		db_sparc_regop, NULL, },
-	{ "npc",	dbreg(npc),		db_sparc_regop, NULL, },
-	{ "y",		dbreg(y),		db_sparc_regop, NULL, },
-	{ "wim",	dbreg(global[0]),	db_sparc_regop, NULL, }, /* see reg.h */
-	{ "g0",		,			FCN_NULL, 	NULL, },
-	{ "g1",		dbreg(global[1]),	db_sparc_regop, NULL, },
-	{ "g2",		dbreg(global[2]),	db_sparc_regop, NULL, },
-	{ "g3",		dbreg(global[3]),	db_sparc_regop, NULL, },
-	{ "g4",		dbreg(global[4]),	db_sparc_regop, NULL, },
-	{ "g5",		dbreg(global[5]),	db_sparc_regop, NULL, },
-	{ "g6",		dbreg(global[6]),	db_sparc_regop, NULL, },
-	{ "g7",		dbreg(global[7]),	db_sparc_regop, NULL, },
-	{ "o0",		dbreg(out[0]),		db_sparc_regop, NULL, },
-	{ "o1",		dbreg(out[1]),		db_sparc_regop, NULL, },
-	{ "o2",		dbreg(out[2]),		db_sparc_regop, NULL, },
-	{ "o3",		dbreg(out[3]),		db_sparc_regop, NULL, },
-	{ "o4",		dbreg(out[4]),		db_sparc_regop, NULL, },
-	{ "o5",		dbreg(out[5]),		db_sparc_regop, NULL, },
-	{ "o6",		dbreg(out[6]),		db_sparc_regop, NULL, },
-	{ "o7",		dbreg(out[7]),		db_sparc_regop, NULL, },
-	{ "l0",		dbregfr(local[0]),	db_sparc_regop, NULL, },
-	{ "l1",		dbregfr(local[1]),	db_sparc_regop, NULL, },
-	{ "l2",		dbregfr(local[2]),	db_sparc_regop, NULL, },
-	{ "l3",		dbregfr(local[3]),	db_sparc_regop, NULL, },
-	{ "l4",		dbregfr(local[4]),	db_sparc_regop, NULL, },
-	{ "l5",		dbregfr(local[5]),	db_sparc_regop, NULL, },
-	{ "l6",		dbregfr(local[6]),	db_sparc_regop, NULL, },
-	{ "l7",		dbregfr(local[7]),	db_sparc_regop, NULL, },
-	{ "i0",		dbregfr(arg[0]),	db_sparc_regop, NULL, },
-	{ "i1",		dbregfr(arg[1]),	db_sparc_regop, NULL, },
-	{ "i2",		dbregfr(arg[2]),	db_sparc_regop, NULL, },
-	{ "i3",		dbregfr(arg[3]),	db_sparc_regop, NULL, },
-	{ "i4",		dbregfr(arg[4]),	db_sparc_regop, NULL, },
-	{ "i5",		dbregfr(arg[5]),	db_sparc_regop, NULL, },
-	{ "i6",		dbregfr(fp),		db_sparc_regop, NULL, },
-	{ "i7",		dbregfr(pc),		db_sparc_regop, NULL, },
-};
-const struct db_variable * const db_eregs =
-db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-static int
-db_sparc_regop (const struct db_variable *vp, db_expr_t *val, int opcode)
-{
-	db_expr_t *regaddr =
-	(db_expr_t *)(((uint8_t *)DDB_REGS) + ((size_t)vp->valuep));
-
-	switch (opcode) {
-	case 

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

2017-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 31 11:09:22 UTC 2017

Modified Files:
src/sys/arch/sparc/include: profile.h

Log Message:
Fix __PIC__ profiled binaries


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/include/profile.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/sparc/include/profile.h
diff -u src/sys/arch/sparc/include/profile.h:1.16 src/sys/arch/sparc/include/profile.h:1.17
--- src/sys/arch/sparc/include/profile.h:1.16	Thu Sep 12 15:36:17 2013
+++ src/sys/arch/sparc/include/profile.h	Wed May 31 11:09:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.16 2013/09/12 15:36:17 joerg Exp $ */
+/*	$NetBSD: profile.h,v 1.17 2017/05/31 11:09:22 martin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,7 +57,6 @@
 	__asm("add %o7, 8, %o1");\
 	__asm("1: rd %pc, %o2");\
 	__asm("add %o2," _MCOUNT_SYM "-1b, %o2");\
-	__asm("ld [%o2], %o2");\
 	__asm("jmpl %o2, %g0");\
 	__asm("add %i7, 8, %o0");
 #else
@@ -65,9 +64,10 @@
 	__asm(".global " _MCOUNT_ENTRY);\
 	__asm(_MCOUNT_ENTRY ":");\
 	__asm("add %o7, 8, %o1");\
+	__asm("mov %o7, %o3");\
 	__asm("1: call 2f; nop; 2:");\
 	__asm("add %o7," _MCOUNT_SYM "-1b, %o2");\
-	__asm("ld [%o2], %o2");\
+	__asm("mov %o3, %o7");\
 	__asm("jmpl %o2, %g0");\
 	__asm("add %i7, 8, %o0");
 #endif



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

2017-04-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 28 13:38:36 UTC 2017

Modified Files:
src/sys/arch/sparc/stand/boot: Makefile

Log Message:
Also move bootjs.net after we've evaluated $OBJS (thanks gson@)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc/stand/boot/Makefile

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/sparc/stand/boot/Makefile
diff -u src/sys/arch/sparc/stand/boot/Makefile:1.41 src/sys/arch/sparc/stand/boot/Makefile:1.42
--- src/sys/arch/sparc/stand/boot/Makefile:1.41	Sun Apr  9 16:51:55 2017
+++ src/sys/arch/sparc/stand/boot/Makefile	Fri Apr 28 09:38:35 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.41 2017/04/09 20:51:55 christos Exp $
+#	$NetBSD: Makefile,v 1.42 2017/04/28 13:38:35 christos Exp $
 
 STRIPFLAG=
 PROGSOURCE=	boot.c net.c netif_sun.c conf.c openfirm.c bootinfo.c \
@@ -40,16 +40,17 @@ SUN_MAGIC_HEADER='\01\03\01\07\060\200\0
 boot.net: boot.${RELOC_DEFAULT}
 	(printf ${SUN_MAGIC_HEADER}; cat ${.ALLSRC} ) > ${.TARGET}
 
+
+.include "${S}/conf/newvers_stand.mk"
+
+.include 
+
 bootjs.net: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${LD} -S -o ${.TARGET} ${LINKFLAGS} -Ttext 30 ${OBJS} \
 	${LIBSA} ${LIBZ} ${LIBKERN}
 	${SIZE} ${.TARGET}
 CLEANFILES+=	bootjs.net.map
 
-.include "${S}/conf/newvers_stand.mk"
-
-.include 
-
 .for RELOC in ${RELOCS}
 boot.${RELOC}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${LD} -S -o ${.TARGET}.tmp ${LINKFLAGS} -Ttext ${RELOC} ${OBJS} \



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

2017-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  9 20:51:56 UTC 2017

Modified Files:
src/sys/arch/sparc/stand/boot: Makefile

Log Message:
move .for generated rules after OBJS have been set.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/sparc/stand/boot/Makefile

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/sparc/stand/boot/Makefile
diff -u src/sys/arch/sparc/stand/boot/Makefile:1.40 src/sys/arch/sparc/stand/boot/Makefile:1.41
--- src/sys/arch/sparc/stand/boot/Makefile:1.40	Sat Apr  8 15:53:23 2017
+++ src/sys/arch/sparc/stand/boot/Makefile	Sun Apr  9 16:51:55 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.40 2017/04/08 19:53:23 christos Exp $
+#	$NetBSD: Makefile,v 1.41 2017/04/09 20:51:55 christos Exp $
 
 STRIPFLAG=
 PROGSOURCE=	boot.c net.c netif_sun.c conf.c openfirm.c bootinfo.c \
@@ -31,15 +31,6 @@ LINKFLAGS=-N -e start -Map $@.map
 .MAIN: all
 realall: ${FILES}
 
-.for RELOC in ${RELOCS}
-boot.${RELOC}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
-	${LD} -S -o ${.TARGET}.tmp ${LINKFLAGS} -Ttext ${RELOC} ${OBJS} \
-	${LIBSA} ${LIBZ} ${LIBKERN}
-	${SIZE} ${.TARGET}.tmp
-	${OBJCOPY} -O binary ${.TARGET}.tmp ${.TARGET}
-	rm -f ${.TARGET}.tmp
-CLEANFILES+=	boot.${RELOC}.map
-.endfor
 
 # conjure up a magic header that is accepted by all Sun PROMS;
 # see installboot.c for details.
@@ -58,3 +49,13 @@ CLEANFILES+=	bootjs.net.map
 .include "${S}/conf/newvers_stand.mk"
 
 .include 
+
+.for RELOC in ${RELOCS}
+boot.${RELOC}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
+	${LD} -S -o ${.TARGET}.tmp ${LINKFLAGS} -Ttext ${RELOC} ${OBJS} \
+	${LIBSA} ${LIBZ} ${LIBKERN}
+	${SIZE} ${.TARGET}.tmp
+	${OBJCOPY} -O binary ${.TARGET}.tmp ${.TARGET}
+	rm -f ${.TARGET}.tmp
+CLEANFILES+=	boot.${RELOC}.map
+.endfor



CVS commit: src/sys/arch/sparc/sparc

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 12:38:24 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: openfirm.c

Log Message:
Add KASSERTs to catch access to NULL OF nodes early


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/sparc/openfirm.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/sparc/sparc/openfirm.c
diff -u src/sys/arch/sparc/sparc/openfirm.c:1.22 src/sys/arch/sparc/sparc/openfirm.c:1.23
--- src/sys/arch/sparc/sparc/openfirm.c:1.22	Thu Apr  7 19:46:39 2016
+++ src/sys/arch/sparc/sparc/openfirm.c	Sun Mar 26 12:38:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $");
 
 #include 
 #include 
@@ -166,6 +166,7 @@ OF_getproplen(int handle, const char *pr
 		cell_t size;
 	} args;
 
+	KASSERT(handle != 0);
 	args.name = ADR2CELL("getproplen");
 	args.nargs = 2;
 	args.nreturns = 1;
@@ -190,6 +191,7 @@ OF_getprop(int handle, const char *prop,
 		cell_t size;
 	} args;
 
+	KASSERT(handle != 0);
 	if (buflen > NBPG)
 		return -1;
 	args.name = ADR2CELL("getprop");



CVS commit: src/sys/arch/sparc/stand/ofwboot

2017-03-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 25 09:22:02 UTC 2017

Modified Files:
src/sys/arch/sparc/stand/ofwboot: version

Log Message:
Bump version - virtio support added


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/stand/ofwboot/version

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

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/version
diff -u src/sys/arch/sparc/stand/ofwboot/version:1.21 src/sys/arch/sparc/stand/ofwboot/version:1.22
--- src/sys/arch/sparc/stand/ofwboot/version:1.21	Sun Jun 14 18:40:10 2015
+++ src/sys/arch/sparc/stand/ofwboot/version	Sat Mar 25 09:22:02 2017
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.21 2015/06/14 18:40:10 martin Exp $
+$NetBSD: version,v 1.22 2017/03/25 09:22:02 martin Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -22,3 +22,4 @@ is taken as the current.
 1.16:	Add support to boot with root on cd9660
 1.17:	Add support for sun4v architecture
 1.18:	Fix loading of kernels with huge .bss
+1.19:	Support booting from virtio devices



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

2017-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb  2 08:12:08 UTC 2017

Modified Files:
src/sys/arch/sparc/include: elf_machdep.h

Log Message:
PR port-sparc64/51925: cosmetic cleanup, no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/include/elf_machdep.h

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

Modified files:

Index: src/sys/arch/sparc/include/elf_machdep.h
diff -u src/sys/arch/sparc/include/elf_machdep.h:1.7 src/sys/arch/sparc/include/elf_machdep.h:1.8
--- src/sys/arch/sparc/include/elf_machdep.h:1.7	Sat May 30 05:56:53 2009
+++ src/sys/arch/sparc/include/elf_machdep.h	Thu Feb  2 08:12:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_machdep.h,v 1.7 2009/05/30 05:56:53 skrll Exp $	*/
+/*	$NetBSD: elf_machdep.h,v 1.8 2017/02/02 08:12:08 martin Exp $	*/
 
 #define ELF32_MACHDEP_ENDIANNESS	ELFDATA2MSB
 #define	ELF32_MACHDEP_ID_CASES		\
@@ -6,13 +6,11 @@
 		case EM_SPARC32PLUS:	\
 			break;
 
-#define	ELF64_MACHDEP_ENDIANNESS	ELFDATA2MSB
+#define	ELF64_MACHDEP_ENDIANNESS	XXX	/* break compilation */
 #define	ELF64_MACHDEP_ID_CASES		\
-		case EM_SPARC32PLUS:	\
-		case EM_SPARCV9:	\
 		/* no 64-bit ELF machine types supported */
 
-#define	ELF32_MACHDEP_ID	EM_SPARC	/* XXX right? */
+#define	ELF32_MACHDEP_ID	EM_SPARC
 
 #define ARCH_ELFSIZE		32	/* MD native binary size */
 



  1   2   3   4   >