CVS commit: src/sys/arch/sparc64/sparc64

2024-02-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 17 19:36:07 UTC 2024

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

Log Message:
Ensure that the size of the stack is properly specified (2*USPACE) so it 
matches the allocation of stack pages done in pmap_bootstrap(). If this is not 
properly in sync, then the stack pointer may end up in the redzone right before 
the stack causing mmu faults. This issue has been observed on a T2000 (sun4v) 
system while probing the devices (pci/ebus/com) during bootstrap


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2024-02-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 17 19:36:07 UTC 2024

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

Log Message:
Ensure that the size of the stack is properly specified (2*USPACE) so it 
matches the allocation of stack pages done in pmap_bootstrap(). If this is not 
properly in sync, then the stack pointer may end up in the redzone right before 
the stack causing mmu faults. This issue has been observed on a T2000 (sun4v) 
system while probing the devices (pci/ebus/com) during bootstrap


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.433 src/sys/arch/sparc64/sparc64/locore.s:1.434
--- src/sys/arch/sparc64/sparc64/locore.s:1.433	Wed Mar  1 08:18:39 2023
+++ src/sys/arch/sparc64/sparc64/locore.s	Sat Feb 17 19:36:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.433 2023/03/01 08:18:39 riastradh Exp $	*/
+/*	$NetBSD: locore.s,v 1.434 2024/02/17 19:36:07 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -5471,7 +5471,7 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	!! and already accessible here)
 	flushw
 	LDPTR	[%l7 + CI_CPCB], %l0		! load PCB/uarea pointer
-	set	USPACE - TF_SIZE - CC64FSZ, %l1
+	set	2*USPACE - TF_SIZE - CC64FSZ, %l1
  	add	%l1, %l0, %l0
 #ifdef _LP64
 	andn	%l0, 0x0f, %l0			! Needs to be 16-byte aligned



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 08:13:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: intr.c trap.c

Log Message:
Fix typos in trap types and one log message.

OpenBSD fixed those over 20 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 08:13:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: intr.c trap.c

Log Message:
Fix typos in trap types and one log message.

OpenBSD fixed those over 20 years ago.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/intr.c
diff -u src/sys/arch/sparc64/sparc64/intr.c:1.71 src/sys/arch/sparc64/sparc64/intr.c:1.72
--- src/sys/arch/sparc64/sparc64/intr.c:1.71	Sun Jan  9 20:30:04 2022
+++ src/sys/arch/sparc64/sparc64/intr.c	Mon Jan 15 08:13:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $ */
+/*	$NetBSD: intr.c,v 1.72 2024/01/15 08:13:45 andvar Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.72 2024/01/15 08:13:45 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -108,7 +108,7 @@ strayintr(const struct trapframe64 *fp, 
 
 	snprintb(buf, sizeof(buf), PSTATE_BITS,
 	(fp->tf_tstate>>TSTATE_PSTATE_SHIFT));
-	printf("stray interrupt ipl %u pc=%llx npc=%llx pstate=%s vecttored=%d\n",
+	printf("stray interrupt ipl %u pc=%llx npc=%llx pstate=%s vectored=%d\n",
 	fp->tf_pil, (unsigned long long)fp->tf_pc,
 	(unsigned long long)fp->tf_npc,  buf, vectored);
 

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.196 src/sys/arch/sparc64/sparc64/trap.c:1.197
--- src/sys/arch/sparc64/sparc64/trap.c:1.196	Mon Jan  8 19:33:49 2024
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon Jan 15 08:13:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $ */
+/*	$NetBSD: trap.c,v 1.197 2024/01/15 08:13:45 andvar Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.197 2024/01/15 08:13:45 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -342,7 +342,7 @@ const char *trap_type[] = {
 	T, T, T, T, T, T, T, T, /* 128..12f */
 	T, T,			/* 130..131 */
 	"get condition codes",	/* 132 */
-	"set condision codes",	/* 133 */
+	"set condition codes",	/* 133 */
 	T, T, T, T,		/* 134..137 */
 	T, T, T, T, T, T, T, T, /* 138..13f */
 	T, T, T, T, T, T, T, T, /* 140..147 */
@@ -352,7 +352,7 @@ const char *trap_type[] = {
 	T, T, T, T,		/* 160..163 */
 	"SVID syscall64",	/* 164 */
 	"SPARC Intl syscall64",	/* 165 */
-	"OS vedor spec syscall",/* 166 */
+	"OS vendor spec syscall",	/* 166 */
 	"HW OEM syscall",	/* 167 */
 	"ret from deferred trap",	/* 168 */
 };



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan  8 19:33:49 UTC 2024

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

Log Message:
sun4v: only DFA (Data fault address) and DFA (Datafault context) are valid when 
a mem_address_not_aligned fault is triggered, so ajust debug printout to this


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.195 src/sys/arch/sparc64/sparc64/trap.c:1.196
--- src/sys/arch/sparc64/sparc64/trap.c:1.195	Thu Oct  5 19:41:06 2023
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon Jan  8 19:33:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.195 2023/10/05 19:41:06 ad Exp $ */
+/*	$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.195 2023/10/05 19:41:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -747,20 +747,8 @@ dopanic:
 		  
 			printf("Alignment error: pid=%d.%d comm=%s pc=%lx\n",
 			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, pc);
-			paddr_t mmufsa_ift_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ift);
-			paddr_t mmufsa_ifa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifa);
-			paddr_t mmufsa_ifc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifc);
-			paddr_t mmufsa_dft_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dft);
 			paddr_t mmufsa_dfa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfa);
 			paddr_t mmufsa_dfc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfc);
-			int64_t ift = ldxa(mmufsa_ift_addr, ASI_PHYS_CACHED);
-			printf("ift = %016lx\n", ift);
-			int64_t ifa = ldxa(mmufsa_ifa_addr, ASI_PHYS_CACHED);
-			printf("ifa = %016lx\n", ifa);
-			int64_t ifc = ldxa(mmufsa_ifc_addr, ASI_PHYS_CACHED);
-			printf("ifc = %016lx\n", ifc);
-			int64_t dft = ldxa(mmufsa_dft_addr, ASI_PHYS_CACHED);
-			printf("dft = %016lx\n", dft);
 			int64_t dfa = ldxa(mmufsa_dfa_addr, ASI_PHYS_CACHED);
 			printf("dfa = %016lx\n", dfa);
 			int64_t dfc = ldxa(mmufsa_dfc_addr, ASI_PHYS_CACHED);



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan  8 19:33:49 UTC 2024

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

Log Message:
sun4v: only DFA (Data fault address) and DFA (Datafault context) are valid when 
a mem_address_not_aligned fault is triggered, so ajust debug printout to this


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2023-08-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Tue Aug 29 20:17:02 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: static_edid.c

Log Message:
Update the horizontal sync offset based on the Naturetech video timing.
While here, correct the spelling of "Naturetech" in the data.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/sparc64/static_edid.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/sparc64/sparc64/static_edid.c
diff -u src/sys/arch/sparc64/sparc64/static_edid.c:1.1 src/sys/arch/sparc64/sparc64/static_edid.c:1.2
--- src/sys/arch/sparc64/sparc64/static_edid.c:1.1	Sun Oct 11 19:39:22 2020
+++ src/sys/arch/sparc64/sparc64/static_edid.c	Tue Aug 29 20:17:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: static_edid.c,v 1.1 2020/10/11 19:39:22 jdc Exp $ */
+/*	$NetBSD: static_edid.c,v 1.2 2023/08/29 20:17:02 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.1 2020/10/11 19:39:22 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: static_edid.c,v 1.2 2023/08/29 20:17:02 jdc Exp $");
 #include 
 
 /* EDID blocks for some known hardware that doesn't provide its own */
@@ -46,13 +46,13 @@ uint8_t edid_meso999[128] = {
 /* 20 */	0x16, 0x50, 0x54, 0xa5, 0x4a, 0x80, 0x81, 0x40,
 /* 28 */	0x81, 0x80, 0x81, 0x8f, 0x95, 0x00, 0x01, 0x01,
 /* 30 */	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xab, 0x22,
-/* 38 */	0xa0, 0xa0, 0x50, 0x84, 0x1a, 0x30, 0x38, 0x20,
+/* 38 */	0xa0, 0xa0, 0x50, 0x84, 0x1a, 0x30, 0x30, 0x20,
 /* 40 */	0x36, 0x00, 0x9a, 0x01, 0x11, 0x00, 0x00, 0x1a,
 /* 48 */	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 /* 50 */	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 /* 58 */	0x00, 0x01, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x4e,
-/* 60 */	0x41, 0x74, 0x75, 0x72, 0x65, 0x74, 0x65, 0x63,
+/* 60 */	0x61, 0x74, 0x75, 0x72, 0x65, 0x74, 0x65, 0x63,
 /* 68 */	0x68, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfe,
 /* 70 */	0x00, 0x4d, 0x65, 0x73, 0x6f, 0x20, 0x39, 0x39,
-/* 78 */	0x39, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0xed
+/* 78 */	0x39, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0xd5
 };



CVS commit: src/sys/arch/sparc64/sparc64

2023-08-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Tue Aug 29 20:17:02 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: static_edid.c

Log Message:
Update the horizontal sync offset based on the Naturetech video timing.
While here, correct the spelling of "Naturetech" in the data.


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

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



CVS commit: src/sys/arch/sparc64/sparc64

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 08:18:39 UTC 2023

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

Log Message:
sparc64: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.432 src/sys/arch/sparc64/sparc64/locore.s:1.433
--- src/sys/arch/sparc64/sparc64/locore.s:1.432	Thu Feb 23 14:56:56 2023
+++ src/sys/arch/sparc64/sparc64/locore.s	Wed Mar  1 08:18:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.432 2023/02/23 14:56:56 riastradh Exp $	*/
+/*	$NetBSD: locore.s,v 1.433 2023/03/01 08:18:39 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6847,7 +6847,13 @@ ENTRY(softint_fastintr)
 	or	%o3, %lo(USPACE - TF_SIZE - CC64FSZ - STKB), %o3
 	membar	#StoreStore		/* for mutex_enter; see cpu_switchto */
 	STPTR	%i0, [%l7 + %lo(CURLWP)]
-	membar	#StoreLoad		/* for mutex_enter; see cpu_switchto */
+	/*
+	 * No need for barrier after ci->ci_curlwp = softlwp -- when we
+	 * enter a softint lwp, it can't be holding any mutexes, so it
+	 * can't release any until after it has acquired them, so we
+	 * need not participate in the protocol with mutex_vector_enter
+	 * barriers here.
+	 */
 	add	%l1, %o3, %i6
 	STPTR	%l1, [%l6 + %lo(CPCB)]
 	stx	%i6, [%l1 + PCB_SP]



CVS commit: src/sys/arch/sparc64/sparc64

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 08:18:39 UTC 2023

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

Log Message:
sparc64: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.432 -r1.433 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

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

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

Log Message:
sparc64: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.431 -r1.432 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.431 src/sys/arch/sparc64/sparc64/locore.s:1.432
--- src/sys/arch/sparc64/sparc64/locore.s:1.431	Tue Jul  5 20:15:40 2022
+++ src/sys/arch/sparc64/sparc64/locore.s	Thu Feb 23 14:56:56 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.431 2022/07/05 20:15:40 andvar Exp $	*/
+/*	$NetBSD: locore.s,v 1.432 2023/02/23 14:56:56 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6731,9 +6731,28 @@ ENTRY(cpu_switchto)
 	 * Load the new lwp.  To load, we must change stacks and
 	 * alter cpcb and the window control registers, hence we must
 	 * keep interrupts disabled.
+	 *
+	 * Issue barriers to coordinate mutex_exit on this CPU with
+	 * mutex_vector_enter on another CPU.
+	 *
+	 * 1. Any prior mutex_exit by oldlwp must be visible to other
+	 *CPUs before we set ci_curlwp := newlwp on this one,
+	 *requiring a store-before-store barrier.
+	 *
+	 * 2. ci_curlwp := newlwp must be visible on all other CPUs
+	 *before any subsequent mutex_exit by newlwp can even test
+	 *whether there might be waiters, requiring a
+	 *store-before-load barrier.
+	 *
+	 * See kern_mutex.c for details -- this is necessary for
+	 * adaptive mutexes to detect whether the lwp is on the CPU in
+	 * order to safely block without requiring atomic r/m/w in
+	 * mutex_exit.
 	 */
 
+	membar	#StoreStore
 	STPTR	%i1, [%l7 + %lo(CURLWP)]	! curlwp = l;
+	membar	#StoreLoad
 	STPTR	%l1, [%l6 + %lo(CPCB)]		! cpcb = newpcb;
 
 	ldx	[%l1 + PCB_SP], %i6
@@ -6826,7 +6845,9 @@ ENTRY(softint_fastintr)
 	sethi	%hi(USPACE - TF_SIZE - CC64FSZ - STKB), %o3
 	LDPTR	[%i0 + L_PCB], %l1		! l1 = softint pcb
 	or	%o3, %lo(USPACE - TF_SIZE - CC64FSZ - STKB), %o3
+	membar	#StoreStore		/* for mutex_enter; see cpu_switchto */
 	STPTR	%i0, [%l7 + %lo(CURLWP)]
+	membar	#StoreLoad		/* for mutex_enter; see cpu_switchto */
 	add	%l1, %o3, %i6
 	STPTR	%l1, [%l6 + %lo(CPCB)]
 	stx	%i6, [%l1 + PCB_SP]
@@ -6839,7 +6860,9 @@ ENTRY(softint_fastintr)
 
 	/* switch back to interrupted lwp */
 	ldx	[%l5 + PCB_SP], %i6
+	membar	#StoreStore		/* for mutex_enter; see cpu_switchto */
 	STPTR	%l0, [%l7 + %lo(CURLWP)]
+	membar	#StoreLoad		/* for mutex_enter; see cpu_switchto */
 	STPTR	%l5, [%l6 + %lo(CPCB)]
 
 	restore	! rewind register window



CVS commit: src/sys/arch/sparc64/sparc64

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

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

Log Message:
sparc64: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.431 -r1.432 src/sys/arch/sparc64/sparc64/locore.s

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



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

2023-02-20 Thread Valery Ushakov
On Mon, Feb 20, 2023 at 15:41:04 +0100, Martin Husemann wrote:

> On Mon, Feb 20, 2023 at 05:15:33PM +0300, Valery Ushakov wrote:
> > them up, b/c you cannot amend that comment.  To add to the fun, I
> > think releng scripts just clone the commit message on pull ups, so
> > that comment gets splattered all over the target branches too.
> 
> Yes - I try to manually remove them (which is easy if they are at the
> end of the last commit log in the batch) durint the pullup.

Data point:

  $ hg log -b netbsd-9 | grep 'XXX.*pullup.*9' | wc -l
  74

-uwe


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

2023-02-20 Thread Valery Ushakov
On Mon, Feb 20, 2023 at 22:35:40 +0700, Robert Elz wrote:

> Date:Mon, 20 Feb 2023 16:47:01 +0300
> From:Valery Ushakov 
> Message-ID:  
> 
>   | I wonder if we should stop abusing commit messages as pull-up
>   | reminders.  These XXX will not convey any useful information a few
>   | months down the line...
> 
> I think they're useful (if only I remembered to add them all the
> times I should) - it allows someone looking at the commit log to
> easily determine that the change is also intended for another branch.
> Then one can check and see if it happened or not, and if not, send
> a reminder if it is important/needed.
> 
> If the pullup annotation is missing, I tend to assume that the change
> is not intended to be pulled up - either it isn't applicable, or is
> something new that isn't appropriate for older releases.
> 
> That's why I will sometimes even include pullup annotations for ancient
> versions of NetBSD, even though I know they will never happen (never get
> submitted, much less acted upon) - just as an indication that the problem
> being fixed exists from long ago.

In that case they have no business being "XXX" :)

-uwe


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

2023-02-20 Thread Robert Elz
Date:Mon, 20 Feb 2023 16:47:01 +0300
From:Valery Ushakov 
Message-ID:  

  | I wonder if we should stop abusing commit messages as pull-up
  | reminders.  These XXX will not convey any useful information a few
  | months down the line...

I think they're useful (if only I remembered to add them all the
times I should) - it allows someone looking at the commit log to
easily determine that the change is also intended for another branch.
Then one can check and see if it happened or not, and if not, send
a reminder if it is important/needed.

If the pullup annotation is missing, I tend to assume that the change
is not intended to be pulled up - either it isn't applicable, or is
something new that isn't appropriate for older releases.

That's why I will sometimes even include pullup annotations for ancient
versions of NetBSD, even though I know they will never happen (never get
submitted, much less acted upon) - just as an indication that the problem
being fixed exists from long ago.

kre



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

2023-02-20 Thread Martin Husemann
On Mon, Feb 20, 2023 at 05:15:33PM +0300, Valery Ushakov wrote:
> them up, b/c you cannot amend that comment.  To add to the fun, I
> think releng scripts just clone the commit message on pull ups, so
> that comment gets splattered all over the target branches too.

Yes - I try to manually remove them (which is easy if they are at the
end of the last commit log in the batch) durint the pullup.

Martin


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

2023-02-20 Thread Valery Ushakov
On Mon, Feb 20, 2023 at 13:57:32 +, Taylor R Campbell wrote:

> > > XXX pullup-8
> > > XXX pullup-9
> > > XXX pullup-10
> > 
> > I wonder if we should stop abusing commit messages as pull-up
> > reminders.  These XXX will not convey any useful information a few
> > months down the line...
> 
> Happy to try a better mechanism if you have suggestions, but this is
> the best one I've found so far!  If I don't mark commits this way, I'm
> almost guaranteed not to pull them up.

I'm not sure any exists even with modern VCS.  May be something like a
branch that is not closed until it is merged (pulled-up) to all the
intended destination (but then the very notion of the closed branch
requires something more modern than CVS).  The problem with the XXX in
the commit message is that you don't easily know if you _did_ pull
them up, b/c you cannot amend that comment.  To add to the fun, I
think releng scripts just clone the commit message on pull ups, so
that comment gets splattered all over the target branches too.

-uwe


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

2023-02-20 Thread Taylor R Campbell
> Date: Mon, 20 Feb 2023 16:47:01 +0300
> From: Valery Ushakov 
> 
> On Mon, Feb 20, 2023 at 13:30:23 +, Taylor R Campbell wrote:
> 
> > Module Name:src
> > Committed By:   riastradh
> > Date:   Mon Feb 20 13:30:23 UTC 2023
> > 
> > Modified Files:
> > src/sys/arch/sparc64/sparc64: lock_stubs.s
> > 
> > Log Message:
> > sparc64: Add missing LoadStore ordering for mutex_enter stub.
> > 
> > XXX pullup-8
> > XXX pullup-9
> > XXX pullup-10
> 
> I wonder if we should stop abusing commit messages as pull-up
> reminders.  These XXX will not convey any useful information a few
> months down the line...

Happy to try a better mechanism if you have suggestions, but this is
the best one I've found so far!  If I don't mark commits this way, I'm
almost guaranteed not to pull them up.


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

2023-02-20 Thread Valery Ushakov
On Mon, Feb 20, 2023 at 13:30:23 +, Taylor R Campbell wrote:

> Module Name:  src
> Committed By: riastradh
> Date: Mon Feb 20 13:30:23 UTC 2023
> 
> Modified Files:
>   src/sys/arch/sparc64/sparc64: lock_stubs.s
> 
> Log Message:
> sparc64: Add missing LoadStore ordering for mutex_enter stub.
> 
> XXX pullup-8
> XXX pullup-9
> XXX pullup-10

I wonder if we should stop abusing commit messages as pull-up
reminders.  These XXX will not convey any useful information a few
months down the line...

-uwe


CVS commit: src/sys/arch/sparc64/sparc64

2023-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 20 13:30:36 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: lock_stubs.s

Log Message:
sparc64: Rename internal barrier macros to be clearer.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/sparc64/lock_stubs.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/sparc64/sparc64/lock_stubs.s
diff -u src/sys/arch/sparc64/sparc64/lock_stubs.s:1.12 src/sys/arch/sparc64/sparc64/lock_stubs.s:1.13
--- src/sys/arch/sparc64/sparc64/lock_stubs.s:1.12	Mon Feb 20 13:30:22 2023
+++ src/sys/arch/sparc64/sparc64/lock_stubs.s	Mon Feb 20 13:30:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.12 2023/02/20 13:30:22 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.13 2023/02/20 13:30:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
@@ -41,11 +41,11 @@
 #define	CURLWP	(CPUINFO_VA+CI_CURLWP)
 
 #if defined(MULTIPROCESSOR)
-#define	MB_READ	membar #LoadLoad | #LoadStore
-#define	MB_MEM	membar #LoadStore | #StoreStore
+#define	MB_ACQ	membar #LoadLoad | #LoadStore
+#define	MB_REL	membar #LoadStore | #StoreStore
 #else
-#define	MB_READ	/* nothing */
-#define	MB_MEM	/* nothing */
+#define	MB_ACQ	/* nothing */
+#define	MB_REL	/* nothing */
 #endif
 
 #if !defined(LOCKDEBUG)
@@ -58,7 +58,7 @@ ENTRY(mutex_enter)
 	sethi	%hi(CURLWP), %o1
 	LDPTR	[%o1 + %lo(CURLWP)], %o1	! current thread
 	CASPTR	[%o0], %g0, %o1			! compare-and-swap
-	MB_READ
+	MB_ACQ
 	brnz,pn	%o1, 1f! lock was unowned?
 	 nop
 	retl	! - yes, done
@@ -76,7 +76,7 @@ ENTRY(mutex_exit)
 	sethi	%hi(CURLWP), %o1
 	LDPTR	[%o1 + %lo(CURLWP)], %o1	! current thread
 	clr	%o2! new value (0)
-	MB_MEM
+	MB_REL
 	CASPTR	[%o0], %o1, %o2			! compare-and-swap
 	cmp	%o1, %o2
 	bne,pn	CCCR, 1f			! nope, hard case



CVS commit: src/sys/arch/sparc64/sparc64

2023-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 20 13:30:36 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: lock_stubs.s

Log Message:
sparc64: Rename internal barrier macros to be clearer.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/sparc64/lock_stubs.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2023-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 20 13:30:23 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: lock_stubs.s

Log Message:
sparc64: Add missing LoadStore ordering for mutex_enter stub.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/sparc64/lock_stubs.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/sparc64/sparc64/lock_stubs.s
diff -u src/sys/arch/sparc64/sparc64/lock_stubs.s:1.11 src/sys/arch/sparc64/sparc64/lock_stubs.s:1.12
--- src/sys/arch/sparc64/sparc64/lock_stubs.s:1.11	Wed Apr  6 22:47:57 2022
+++ src/sys/arch/sparc64/sparc64/lock_stubs.s	Mon Feb 20 13:30:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.s,v 1.11 2022/04/06 22:47:57 riastradh Exp $	*/
+/*	$NetBSD: lock_stubs.s,v 1.12 2023/02/20 13:30:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 #define	CURLWP	(CPUINFO_VA+CI_CURLWP)
 
 #if defined(MULTIPROCESSOR)
-#define	MB_READ	membar #LoadLoad
+#define	MB_READ	membar #LoadLoad | #LoadStore
 #define	MB_MEM	membar #LoadStore | #StoreStore
 #else
 #define	MB_READ	/* nothing */



CVS commit: src/sys/arch/sparc64/sparc64

2023-02-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 20 13:30:23 UTC 2023

Modified Files:
src/sys/arch/sparc64/sparc64: lock_stubs.s

Log Message:
sparc64: Add missing LoadStore ordering for mutex_enter stub.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/sparc64/lock_stubs.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 23:23:31 UTC 2023

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

Log Message:
sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.56 src/sys/arch/sparc64/sparc64/db_trace.c:1.57
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.56	Tue Jan 24 23:23:12 2023
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Tue Jan 24 23:23:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.56 2023/01/24 23:23:12 riastradh Exp $ */
+/*	$NetBSD: db_trace.c,v 1.57 2023/01/24 23:23:31 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.56 2023/01/24 23:23:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.57 2023/01/24 23:23:31 riastradh Exp $");
 
 #include 
 #include 
@@ -127,12 +127,8 @@ db_stack_trace_print(db_expr_t addr, boo
 			}
 			(*pr)("lid %d ", l.l_lid);
 			pcb = lwp_getpcb();
-#ifndef _KERNEL
 			db_read_bytes((db_addr_t)>pcb_sp,
 			sizeof(frame), (char *));
-#else
-			frame = (vaddr_t)pcb->pcb_sp;
-#endif
 			(*pr)("at %p\n", frame);
 		} else {
 			frame = (vaddr_t)addr;



CVS commit: src/sys/arch/sparc64/sparc64

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 23:23:31 UTC 2023

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

Log Message:
sparc64/db_trace.c: Don't dereference; use db_read_bytes.

Makes crash(8) and ddb match, and avoids crashing in ddb when you
feed in a bad lwp pointer!


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/sparc64/sparc64/db_trace.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 23:23:12 UTC 2023

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

Log Message:
sparc64/db_trace.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.55 src/sys/arch/sparc64/sparc64/db_trace.c:1.56
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.55	Sun May 31 11:28:52 2020
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Tue Jan 24 23:23:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $ */
+/*	$NetBSD: db_trace.c,v 1.56 2023/01/24 23:23:12 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.56 2023/01/24 23:23:12 riastradh Exp $");
 
 #include 
 #include 
@@ -57,7 +57,7 @@ void db_print_window(uint64_t);
 #endif
 
 #ifdef _KERNEL
-#define	KLOAD(x)	probeget((paddr_t)(u_long)&(x), ASI_PRIMARY, sizeof(x))	
+#define	KLOAD(x)	probeget((paddr_t)(u_long)&(x), ASI_PRIMARY, sizeof(x))
 #else
 static long
 kload(db_addr_t addr)
@@ -153,12 +153,12 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (frame & 1) {
 			f64 = (struct frame64 *)(frame + BIAS);
 			pc = (db_addr_t)KLOAD(f64->fr_pc);
-		
+
 			frame = KLOAD(f64->fr_fp);
 		} else {
 			f32 = (struct frame32 *)(frame);
 			pc = (db_addr_t)KLOAD(f32->fr_pc);
-		
+
 			frame = (long)KLOAD(f32->fr_fp);
 		}
 
@@ -175,13 +175,13 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (!INKERNEL(frame))
 			break;
 #endif
-		
+
 		db_find_sym_and_offset(pc, , );
 		if (name == NULL)
 			name = "?";
-		
+
 		(*pr)("%s(", name);
-		
+
 		/*
 		 * Print %i0..%i5; hope these still reflect the
 		 * actual arguments somewhat...
@@ -216,7 +216,7 @@ db_dump_window(db_expr_t addr, bool have
 
 	/* Traverse window stack */
 	for (i=0; ifr_fp;
 		else frame = (uint64_t)((struct frame32 *)(u_long)frame)->fr_fp;
 	}
@@ -226,13 +226,13 @@ db_dump_window(db_expr_t addr, bool have
 }
 #endif
 
-void 
+void
 db_print_window(uint64_t frame)
 {
 	if (frame & 1) {
 		struct frame64* f = (struct frame64*)(u_long)(frame + BIAS);
 
-		db_printf("frame64 %p locals, ins:\n", f);		
+		db_printf("frame64 %p locals, ins:\n", f);
 		if (INKERNEL(f)) {
 			db_printf("%llx %llx %llx %llx ",
   (unsigned long long)f->fr_local[0],
@@ -245,12 +245,12 @@ db_print_window(uint64_t frame)
   (unsigned long long)f->fr_local[6],
   (unsigned long long)f->fr_local[7]);
 			db_printf("%llx %llx %llx %llx ",
-  (unsigned long long)f->fr_arg[0],	
+  (unsigned long long)f->fr_arg[0],
   (unsigned long long)f->fr_arg[1],
   (unsigned long long)f->fr_arg[2],
   (unsigned long long)f->fr_arg[3]);
 			db_printf("%llx %llx %llx=sp %llx=pc:",
-  (unsigned long long)f->fr_arg[4],	
+  (unsigned long long)f->fr_arg[4],
   (unsigned long long)f->fr_arg[5],
   (unsigned long long)f->fr_fp,
   (unsigned long long)f->fr_pc);
@@ -276,7 +276,7 @@ db_print_window(uint64_t frame)
   (unsigned long long)f->fr_arg[5],
   (unsigned long long)f->fr_fp,
   (unsigned long long)f->fr_pc);
-			db_printf("\n");	 
+			db_printf("\n");
 		}
 	} else {
 		struct frame32* f = (struct frame32*)(u_long)frame;
@@ -297,14 +297,14 @@ db_print_window(uint64_t frame)
 			if (copyin(f, , sizeof(fr))) return;
 			f = 
 			db_printf("%8x %8x %8x %8x %8x %8x %8x %8x\n",
-  f->fr_local[0], f->fr_local[1], 
+  f->fr_local[0], f->fr_local[1],
   f->fr_local[2], f->fr_local[3],
-  f->fr_local[4], f->fr_local[5], 
+  f->fr_local[4], f->fr_local[5],
   f->fr_local[6], f->fr_local[7]);
 			db_printf("%8x %8x %8x %8x %8x %8x %8x=sp %8x=pc\n",
-  f->fr_arg[0], f->fr_arg[1], 
+  f->fr_arg[0], f->fr_arg[1],
   f->fr_arg[2], f->fr_arg[3],
-  f->fr_arg[4], f->fr_arg[5], 
+  f->fr_arg[4], f->fr_arg[5],
   f->fr_fp, f->fr_pc);
 		}
 	}
@@ -391,7 +391,7 @@ db_dump_trap(db_expr_t addr, bool have_a
 		  tf, (unsigned long long)tf->tf_tstate,
 		  (unsigned long long)tf->tf_pc,
 		  (unsigned long long)tf->tf_npc);
-	db_printf("y: %x\tpil: %d\toldpil: %d\tfault: %llx\ttt: %x\tGlobals:\n", 
+	db_printf("y: %x\tpil: %d\toldpil: %d\tfault: %llx\ttt: %x\tGlobals:\n",
 		  (int)tf->tf_y, (int)tf->tf_pil, (int)tf->tf_oldpil,
 		  (unsigned long long)tf->tf_fault, (int)tf->tf_tt);
 	db_printf("%016llx %016llx %016llx %016llx\n",



CVS commit: src/sys/arch/sparc64/sparc64

2023-01-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jan 24 23:23:12 UTC 2023

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

Log Message:
sparc64/db_trace.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sparc64/sparc64/db_trace.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2022-05-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon May 16 21:28:06 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c

Log Message:
try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable.  in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE).  this
code not commited.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/cache.h
diff -u src/sys/arch/sparc64/sparc64/cache.h:1.30 src/sys/arch/sparc64/sparc64/cache.h:1.31
--- src/sys/arch/sparc64/sparc64/cache.h:1.30	Sat Dec 11 19:24:21 2021
+++ src/sys/arch/sparc64/sparc64/cache.h	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cache.h,v 1.30 2021/12/11 19:24:21 mrg Exp $ */
+/*	$NetBSD: cache.h,v 1.31 2022/05/16 21:28:05 mrg Exp $ */
 
 /*
  * Copyright (c) 2011 Matthew R. Green
@@ -93,6 +93,7 @@ extern	int	icache_size;
 void 	dcache_flush_page_us(paddr_t);	/* flush page from D$ */
 void 	dcache_flush_page_usiii(paddr_t); /* flush page from D$ */
 void 	sp_blast_dcache(int, int);	/* Clear entire D$ */
+void 	sp_blast_dcache_disabled(int, int); /* Above with D$ disable. */
 void 	blast_icache_us(void);		/* Clear entire I$ */
 void 	blast_icache_usiii(void);	/* Clear entire I$ */
 

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.427 src/sys/arch/sparc64/sparc64/locore.s:1.428
--- src/sys/arch/sparc64/sparc64/locore.s:1.427	Sat Apr  3 17:01:24 2021
+++ src/sys/arch/sparc64/sparc64/locore.s	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.427 2021/04/03 17:01:24 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.428 2022/05/16 21:28:05 mrg Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6193,8 +6193,10 @@ ENTRY(sp_tlb_flush_all_usiii)
 
 /*
  * sp_blast_dcache(int dcache_size, int dcache_line_size)
+ * sp_blast_dcache_disabled(int dcache_size, int dcache_line_size)
  *
- * Clear out all of D$ regardless of contents
+ * Clear out all of D$ regardless of contents.  The latter one also
+ * disables the D$ while doing so.
  */
 	.align 8
 ENTRY(sp_blast_dcache)
@@ -6227,6 +6229,46 @@ ENTRY(sp_blast_dcache)
 	 wrpr	%o3, %pstate
 #endif
 
+	.align 8
+ENTRY(sp_blast_dcache_disabled)
+/*
+ * We turn off interrupts for the duration to prevent RED exceptions.
+ */
+#ifdef PROF
+	save	%sp, -CC64FSZ, %sp
+#endif
+
+	rdpr	%pstate, %o3
+	sub	%o0, %o1, %o0
+	andn	%o3, PSTATE_IE, %o4			! Turn off PSTATE_IE bit
+	wrpr	%o4, 0, %pstate
+
+	ldxa[%g0] ASI_MCCR, %o5
+	andn	%o5, MCCR_DCACHE_EN, %o4		! Turn off the D$
+	stxa	%o4, [%g0] ASI_MCCR
+	flush 	%g0
+
+1:
+	stxa	%g0, [%o0] ASI_DCACHE_TAG
+	membar	#Sync
+	brnz,pt	%o0, 1b
+	 sub	%o0, %o1, %o0
+
+	sethi	%hi(KERNBASE), %o2
+	flush	%o2
+	membar	#Sync
+
+	stxa	%o5, [%g0] ASI_MCCR			! Restore the D$
+	flush 	%g0
+#ifdef PROF
+	wrpr	%o3, %pstate
+	ret
+	 restore
+#else
+	retl
+	 wrpr	%o3, %pstate
+#endif
+
 #ifdef MULTIPROCESSOR
 /*
  * void sparc64_ipi_blast_dcache(int dcache_size, int dcache_line_size)

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.193 src/sys/arch/sparc64/sparc64/trap.c:1.194
--- src/sys/arch/sparc64/sparc64/trap.c:1.193	Tue Feb  2 08:18:42 2021
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon May 16 21:28:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $ */
+/*	$NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.194 2022/05/16 21:28:05 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -561,6 +561,11 @@ trap(struct trapframe64 *tf, unsigned in
 		} else if (type == T_ECCERR) {
 			ecc_corrected_error(type, pc);
 			return;
+		} else if (type == T_FAST_ECC_ERROR) {
+			/* Disable D$, clear error, enable D$, continue. */
+			membar_Sync();
+			sp_blast_dcache_disabled(dcache_size, dcache_line_size);
+			return;
 		}
 		goto dopanic;
 	}



CVS commit: src/sys/arch/sparc64/sparc64

2022-05-16 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon May 16 21:28:06 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: cache.h locore.s trap.c

Log Message:
try to handle ultrasparc III* "fast ecc error" traps.

i had a sunblade 2500 reset with this trap recently, and the
manual says it should have been recoverable.  in particular,
the US IIIv2 manual says in section 12.4.4.2 that the i-cache
won't see this data ever (so nothing needed there), and that
the d-cache needs to be disabled, and all the entries flushed,
and then re-enabled.

tested with a "trap 0x70" from kernel space, that trap.c
converted the "0x170" back to "0x70" (with an ADVANCE).  this
code not commited.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/sparc64/cache.h
cvs rdiff -u -r1.427 -r1.428 src/sys/arch/sparc64/sparc64/locore.s
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:22 UTC 2022

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

Log Message:
sparc64/pmap: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.314 -r1.315 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.314 src/sys/arch/sparc64/sparc64/pmap.c:1.315
--- src/sys/arch/sparc64/sparc64/pmap.c:1.314	Sat Mar 12 15:32:31 2022
+++ src/sys/arch/sparc64/sparc64/pmap.c	Wed Apr  6 22:48:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.314 2022/03/12 15:32:31 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.315 2022/04/06 22:48:21 riastradh Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.314 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.315 2022/04/06 22:48:21 riastradh Exp $");
 
 #undef	NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define	HWREF
@@ -163,6 +163,7 @@ static void ctx_free(struct pmap *, stru
 static __inline void
 dmmu_set_secondary_context(uint ctx)
 {
+
 	if (!CPU_ISSUN4V)
 		__asm volatile(
 			"stxa %0,[%1]%2;	"
@@ -175,7 +176,6 @@ dmmu_set_secondary_context(uint ctx)
 			"membar #Sync		"
 			: : "r" (ctx), "r" (CTX_SECONDARY), "n" (ASI_MMU_CONTEXTID)
 			: "memory");
-		
 }
 
 /*
@@ -564,7 +564,7 @@ pmap_mp_init(void)
 			if (CPU_ISSUN4V)
 tp[i].data |= SUN4V_TLB_X;
 		}
-			
+
 		DPRINTF(PDB_BOOT1, ("xtlb[%d]: Tag: %" PRIx64 " Data: %"
 PRIx64 "\n", i, tp[i].tag, tp[i].data));
 	}



CVS commit: src/sys/arch/sparc64/sparc64

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:22 UTC 2022

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

Log Message:
sparc64/pmap: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.314 -r1.315 src/sys/arch/sparc64/sparc64/pmap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2022-01-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jan  9 20:30:04 UTC 2022

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

Log Message:
sun4v: enable sun4v_intr_xxx() function previously imported from OpenBSD. Note 
that the sun4v_intr_devino_to_sysino() function is adapted to match OpenBSD 
version 1.57 (the introduction of INTR_DEVINO is done in revision 1.58)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc64/sparc64/intr.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2022-01-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jan  9 20:30:04 UTC 2022

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

Log Message:
sun4v: enable sun4v_intr_xxx() function previously imported from OpenBSD. Note 
that the sun4v_intr_devino_to_sysino() function is adapted to match OpenBSD 
version 1.57 (the introduction of INTR_DEVINO is done in revision 1.58)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/intr.c
diff -u src/sys/arch/sparc64/sparc64/intr.c:1.70 src/sys/arch/sparc64/sparc64/intr.c:1.71
--- src/sys/arch/sparc64/sparc64/intr.c:1.70	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/sparc64/intr.c	Sun Jan  9 20:30:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.70 2021/07/03 19:18:55 palle Exp $ */
+/*	$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.70 2021/07/03 19:18:55 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -368,22 +368,16 @@ softint_trigger(uintptr_t machdep)
 
 uint64_t sun4v_group_interrupt_major;
 
-#if 0
-XXX notyet
-wint64_t
+int64_t
 sun4v_intr_devino_to_sysino(uint64_t devhandle, uint64_t devino, uint64_t *ino)
 {
 	if (sun4v_group_interrupt_major < 3)
 		return hv_intr_devino_to_sysino(devhandle, devino, ino);
 
-	KASSERT(INTVEC(devino) == devino);
-	*ino = devino | INTR_DEVINO;
+	*ino = devino;
 	return H_EOK;
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setcookie(uint64_t devhandle, uint64_t ino, uint64_t cookie_value)
 {
@@ -392,10 +386,7 @@ sun4v_intr_setcookie(uint64_t devhandle,
 	
 	return hv_vintr_setcookie(devhandle, ino, cookie_value);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setenabled(uint64_t devhandle, uint64_t ino, uint64_t intr_enabled)
 {
@@ -404,10 +395,7 @@ sun4v_intr_setenabled(uint64_t devhandle
 
 	return hv_vintr_setenabled(devhandle, ino, intr_enabled);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setstate(uint64_t devhandle, uint64_t ino, uint64_t intr_state)
 {
@@ -416,10 +404,7 @@ sun4v_intr_setstate(uint64_t devhandle, 
 
 	return hv_vintr_setstate(devhandle, ino, intr_state);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_settarget(uint64_t devhandle, uint64_t ino, uint64_t cpuid)
 {
@@ -428,6 +413,5 @@ sun4v_intr_settarget(uint64_t devhandle,
 
 	return hv_vintr_settarget(devhandle, ino, cpuid);
 }
-#endif
 
 #endif



CVS commit: src/sys/arch/sparc64/sparc64

2022-01-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Jan  1 11:56:15 UTC 2022

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

Log Message:
Remove an "#ifdef DIAGNOSTIC", KASSERT() always conumes its expression.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.312 src/sys/arch/sparc64/sparc64/pmap.c:1.313
--- src/sys/arch/sparc64/sparc64/pmap.c:1.312	Sat Mar 14 14:05:43 2020
+++ src/sys/arch/sparc64/sparc64/pmap.c	Sat Jan  1 11:56:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.312 2020/03/14 14:05:43 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.313 2022/01/01 11:56:15 hannken Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.312 2020/03/14 14:05:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.313 2022/01/01 11:56:15 hannken Exp $");
 
 #undef	NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define	HWREF
@@ -1537,9 +1537,7 @@ pmap_destroy(struct pmap *pm)
 
 	/* we could be a little smarter and leave pages zeroed */
 	while ((pg = TAILQ_FIRST(>pm_ptps)) != NULL) {
-#ifdef DIAGNOSTIC
 		struct vm_page_md *md = VM_PAGE_TO_MD(pg);
-#endif
 
 		TAILQ_REMOVE(>pm_ptps, pg, pageq.queue);
 		KASSERT(md->mdpg_pvh.pv_pmap == NULL);



CVS commit: src/sys/arch/sparc64/sparc64

2022-01-01 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Jan  1 11:56:15 UTC 2022

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

Log Message:
Remove an "#ifdef DIAGNOSTIC", KASSERT() always conumes its expression.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/arch/sparc64/sparc64/pmap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:39:07 UTC 2021

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

Log Message:
sun4v: request hypervisor api major version 3 for the interrupt group - should 
solve issues when setting up interrupts on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.232 src/sys/arch/sparc64/sparc64/autoconf.c:1.233
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.232	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sat Jul  3 19:39:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $ */
+/*	$NetBSD: autoconf.c,v 1.233 2021/07/03 19:39:07 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.233 2021/07/03 19:39:07 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -189,9 +189,9 @@ void	sun4v_set_soft_state(int, const cha
 char sun4v_soft_state_booting[] __align32 = "NetBSD booting";
 char sun4v_soft_state_running[] __align32 = "NetBSD running";
 
+void	sun4v_interrupt_init(void);
 #if 0
 XXX notyet		
-void	sun4v_interrupt_init(void);
 void	sun4v_sdio_init(void);
 #endif
 #endif
@@ -378,9 +378,9 @@ die_old_boot_loader:
 	if (CPU_ISSUN4V) {
 		sun4v_soft_state_init();
 		sun4v_set_soft_state(SIS_TRANSITION, sun4v_soft_state_booting);
+		sun4v_interrupt_init();
 #if 0
 XXX notyet		
-		sun4v_interrupt_init();
 		sun4v_sdio_init();
 #endif 
 	}
@@ -570,8 +570,6 @@ sun4v_set_soft_state(int state, const ch
 		printf("soft_state_set: %d\n", err);
 }
 
-#if 0
-XXX notyet		
 void
 sun4v_interrupt_init(void)
 {
@@ -582,7 +580,6 @@ sun4v_interrupt_init(void)
 
 	sun4v_group_interrupt_major = 3;
 }
-#endif
 
 #if 0
 XXX notyet		



CVS commit: src/sys/arch/sparc64/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:39:07 UTC 2021

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

Log Message:
sun4v: request hypervisor api major version 3 for the interrupt group - should 
solve issues when setting up interrupts on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-05-10 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 11 03:43:30 UTC 2021

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

Log Message:
All of the OFW-enumerated busses now associate the OFW node with the
device at config_found() time, so we can remove all of the stuff from
device_register() that does it, leaving only the @pci case to fix that
up (similar situation with ACPI on ARM and x86).

Adapt the boot device matching code to use the devhandle from the
device_t rather than the previous mechanism, and add some comments
explaining what's going on and some assertions to validate the
comments.

Collapse the sun4v vdsk boot device detection into the normal "sd"
case because it's almost identical to the normal "sd" case anyhow.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.229 src/sys/arch/sparc64/sparc64/autoconf.c:1.230
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.229	Mon May 10 23:53:44 2021
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Tue May 11 03:43:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.229 2021/05/10 23:53:44 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.230 2021/05/11 03:43:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.229 2021/05/10 23:53:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.230 2021/05/11 03:43:30 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -144,7 +144,6 @@ int kgdb_break_at_attach;
 #endif
 
 #define	OFPATHLEN	128
-#define	OFNODEKEY	"OFpnode"
 
 char	machine_banner[100];
 char	machine_model[100];
@@ -997,62 +996,25 @@ dev_bi_unit_drive_match(device_t dev, in
 }
 
 /*
- * Get the firmware package handle from a device_t.
- * Assuming we have previously stored it in the device properties
- * dictionary.
- */
-static int
-device_ofnode(device_t dev)
-{
-	prop_dictionary_t props;
-	prop_object_t obj;
-
-	if (dev == NULL)
-		return 0;
-	props = device_properties(dev);
-	if (props == NULL)
-		return 0;
-	obj = prop_dictionary_get(props, OFNODEKEY);
-	if (obj == NULL)
-		return 0;
-
-	return prop_number_signed_value(obj);
-}
-
-/*
- * Save the firmware package handle inside the properties dictionary
- * of a device_t.
- */
-static void
-device_setofnode(device_t dev, int node)
-{
-	prop_dictionary_t props;
-	prop_object_t obj;
-
-	if (dev == NULL)
-		return;
-	props = device_properties(dev);
-	if (props == NULL)
-		return;
-	obj = prop_number_create_signed(node);
-	if (obj == NULL)
-		return;
-	prop_dictionary_set(props, OFNODEKEY, obj);
-	prop_object_release(obj);
-	DPRINTF(ACDB_BOOTDEV, (" [device %s has node %x] ",
-	device_xname(dev), node));
-}
-
-/*
  * Called back during autoconfiguration for each device found
  */
 void
 device_register(device_t dev, void *aux)
 {
 	device_t busdev = device_parent(dev);
+	devhandle_t devhandle;
 	int ofnode = 0;
 
 	/*
+	 * If the device has a valid OpenFirmware node association,
+	 * grab it now.
+	 */
+	devhandle = device_handle(dev);
+	if (devhandle_type(devhandle) == DEVHANDLE_TYPE_OF) {
+		ofnode = devhandle_to_of(devhandle);
+	}
+
+	/*
 	 * We don't know the type of 'aux' - it depends on the
 	 * bus this device attaches to. We are only interested in
 	 * certain bus types, this only is used to find the boot
@@ -1063,23 +1025,18 @@ device_register(device_t dev, void *aux)
 		 * Ignore mainbus0 itself, it certainly is not a boot
 		 * device.
 		 */
-	} else if (device_is_a(busdev, "mainbus")) {
-		struct mainbus_attach_args *ma = aux;
-
-		ofnode = ma->ma_node;
 	} else if (device_is_a(busdev, "pci")) {
 		struct pci_attach_args *pa = aux;
 
-		ofnode = PCITAG_NODE(pa->pa_tag);
-	} else if (device_is_a(busdev, "sbus") || device_is_a(busdev, "dma")
-	|| device_is_a(busdev, "ledma")) {
-		struct sbus_attach_args *sa = aux;
-
-		ofnode = sa->sa_node;
-	} else if (device_is_a(busdev, "ebus")) {
-		struct ebus_attach_args *ea = aux;
-
-		ofnode = ea->ea_node;
+		/*
+		 * XXX PCI devices don't currently get their devhandles
+		 * set when the PCI layer attaches them, so we need to
+		 * do it here.  (It's not just us; ACPI has the same
+		 * problem...)
+		 */
+		ofnode = (int)PCITAG_NODE(pa->pa_tag);
+		devhandle = devhandle_from_of(ofnode);
+		device_set_handle(dev, devhandle);
 	} else if (device_is_a(busdev, "iic")) {
 		struct i2c_attach_args *ia = aux;
 
@@ -1098,6 +1055,7 @@ device_register(device_t dev, void *aux)
 add_gpio_props_e250(dev, aux);
 			}
 		} 
+		return;
 	} else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) {
 		struct scsipibus_attach_args *sa = aux;
 		struct scsipi_periph *periph = sa->sa_periph;
@@ -1121,9 +1079,37 @@ device_register(device_t dev, void *aux)
 

CVS commit: src/sys/arch/sparc64/sparc64

2021-05-10 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 11 03:43:30 UTC 2021

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

Log Message:
All of the OFW-enumerated busses now associate the OFW node with the
device at config_found() time, so we can remove all of the stuff from
device_register() that does it, leaving only the @pci case to fix that
up (similar situation with ACPI on ARM and x86).

Adapt the boot device matching code to use the devhandle from the
device_t rather than the previous mechanism, and add some comments
explaining what's going on and some assertions to validate the
comments.

Collapse the sun4v vdsk boot device detection into the normal "sd"
case because it's almost identical to the normal "sd" case anyhow.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 15:55:26 UTC 2021

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

Log Message:
Fix a typo, remove a useless blank line.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_disasm.c
diff -u src/sys/arch/sparc64/sparc64/db_disasm.c:1.18 src/sys/arch/sparc64/sparc64/db_disasm.c:1.19
--- src/sys/arch/sparc64/sparc64/db_disasm.c:1.18	Sun Oct  4 08:16:14 2015
+++ src/sys/arch/sparc64/sparc64/db_disasm.c	Tue Apr  6 15:55:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.18 2015/10/04 08:16:14 joerg Exp $ */
+/*	$NetBSD: db_disasm.c,v 1.19 2021/04/06 15:55:26 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.18 2015/10/04 08:16:14 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2021/04/06 15:55:26 simonb Exp $");
 
 #include 
 #include 
@@ -223,7 +223,7 @@ struct sparc_insn sparc_i[] = {
 	/* Note: if imm22 is zero then this is actually a "nop" grrr... */
 	{(FORMAT2(0, 0x4)), "sethi", "Cd"},
 
-	/* Branch on Integer Co`ndition Codes "Bicc" */
+	/* Branch on Integer Condition Codes "Bicc" */
 	{(FORMAT2(0, 2) | COND(8)), "ba", "a,m"},
 	{(FORMAT2(0, 2) | COND(0)), "bn", "a,m"},
 	{(FORMAT2(0, 2) | COND(9)), "bne", "a,m"},
@@ -1121,4 +1121,3 @@ db_disasm(db_addr_t loc, bool altfmt)
 
 	return (loc + 4);
 }
-



CVS commit: src/sys/arch/sparc64/sparc64

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 15:55:26 UTC 2021

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

Log Message:
Fix a typo, remove a useless blank line.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc64/sparc64/db_disasm.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:03:15 UTC 2021

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

Log Message:
sun4v: handle spill trap properly when trap level is 1 and otherwin is non-zero 
- ensure that all windows are spilled to the pcb like the sun4u winfixsave code 
path


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:03:15 UTC 2021

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

Log Message:
sun4v: handle spill trap properly when trap level is 1 and otherwin is non-zero 
- ensure that all windows are spilled to the pcb like the sun4u winfixsave code 
path


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.425 src/sys/arch/sparc64/sparc64/locore.s:1.426
--- src/sys/arch/sparc64/sparc64/locore.s:1.425	Mon Feb 22 09:56:42 2021
+++ src/sys/arch/sparc64/sparc64/locore.s	Tue Mar 30 20:03:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.425 2021/02/22 09:56:42 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.426 2021/03/30 20:03:14 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -234,7 +234,7 @@
 	.endm
 
 	.macro sun4v_tl1_uspill_other
-	ba,a,pt	%xcc, pcbspill_others
+	ba,a,pt	%xcc, pcbspill_other
 	 nop
 	.align 128
 	.endm
@@ -3485,6 +3485,77 @@ pcbspill_fail:
 	Debugger()
 	NOTREACHED
 
+
+pcbspill_other:
+	
+	set	CPUINFO_VA, %g6
+	ldx	[%g6 + CI_CPCB], %g6
+	
+	GET_CTXBUSY %g1
+
+	ldx	[%g1], %g1! kernel pmap is ctx 0
+	
+	srlx	%g6, STSHIFT, %g7
+	and	%g7, STMASK, %g7
+	sll	%g7, 3, %g7! byte offset into ctxbusy
+	add	%g7, %g1, %g1
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1		! Load pointer to directory
+
+	srlx	%g6, PDSHIFT, %g7			! Do page directory
+	and	%g7, PDMASK, %g7
+	sll	%g7, 3, %g7
+	brz,pn	%g1, pcbspill_other_fail
+	 add	%g7, %g1, %g1
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1
+	srlx	%g6, PTSHIFT, %g7			! Convert to ptab offset
+	and	%g7, PTMASK, %g7
+	brz	%g1, pcbspill_other_fail
+	 sll	%g7, 3, %g7
+	add	%g1, %g7, %g7
+	ldxa	[%g7] ASI_PHYS_CACHED, %g7		! This one is not
+	brgez	%g7, pcbspill_other_fail
+	 srlx	%g7, PGSHIFT, %g7			! Isolate PA part
+	sll	%g6, 32-PGSHIFT, %g6			! And offset
+	sllx	%g7, PGSHIFT+8, %g7			! There are 8 bits to the left of the PA in the TTE
+	srl	%g6, 32-PGSHIFT, %g6
+	srax	%g7, 8, %g7
+	or	%g7, %g6, %g6! Then combine them to form PA
+
+	wr	%g0, ASI_PHYS_CACHED, %asi		! Use ASI_PHYS_CACHED to prevent possible page faults
+
+	lduba	[%g6 + PCB_NSAVED] %asi, %g7		! Fetch current nsaved from the pcb
+	sllx	%g7, 7, %g5! 8+8 registers each 8 bytes = 128 bytes (2^7)
+	add	%g6, %g5, %g5! Offset into pcb_rw
+1:	
+	SPILL	stxa, %g5 + PCB_RW, 8, %asi		! Store the locals and ins
+
+	add	%g5, 16*8, %g5! Next location for saved register windows
+
+	stxa	%o6, [%g5 + PCB_RW + (14*8)] %asi	! Save %sp so we can write these all out
+	
+	saved		! Increments %cansave and decrements %otherwin
+	
+	rdpr	%cwp, %g1! shift register window forward
+	inc	%g1
+	wrpr	%g1, %cwp
+
+
+	inc	%g7	! increment number of saved register windows
+
+	rdpr	%otherwin, %g1! Check to see if done spill'ing otherwin
+	brnz,pt	%g1, 1b
+	 nop
+	
+	stba	%g7, [%g6 + PCB_NSAVED] %asi
+
+	retry
+	NOTREACHED
+
+pcbspill_other_fail:
+	Debugger()
+	NOTREACHED
+
+
 spill_normal_to_user_stack:
 	mov	%sp, %g6		! calculate virtual address of destination stack
 	add	%g6, BIAS, %g6



CVS commit: src/sys/arch/sparc64/sparc64

2021-02-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Feb 22 09:56:42 UTC 2021

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

Log Message:
sun4v: handle spill normal user traps properly when current trap level is 1 - 
registers are spilled to the PA of the stack to avoid further mmu-related 
traps, since sun4v only has 2 trap levels


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.424 src/sys/arch/sparc64/sparc64/locore.s:1.425
--- src/sys/arch/sparc64/sparc64/locore.s:1.424	Sun Dec 20 11:58:58 2020
+++ src/sys/arch/sparc64/sparc64/locore.s	Mon Feb 22 09:56:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.424 2020/12/20 11:58:58 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.425 2021/02/22 09:56:42 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -228,7 +228,7 @@
 	.endm
 
 	.macro sun4v_tl1_uspill_normal
-	ba,a,pt	%xcc, pcbspill_normals
+	ba,a,pt	%xcc, spill_normal_to_user_stack
 	 nop
 	.align 128
 	.endm
@@ -3485,6 +3485,58 @@ pcbspill_fail:
 	Debugger()
 	NOTREACHED
 
+spill_normal_to_user_stack:
+	mov	%sp, %g6		! calculate virtual address of destination stack
+	add	%g6, BIAS, %g6
+
+	mov	CTX_SECONDARY, %g2! Is this context ok or should it be CTX_PRIMARY? XXX
+	GET_MMU_CONTEXTID %g3, %g2, %g1
+	sllx	%g3, 3, %g3	! Make it into an offset into ctxbusy (see below)
+	
+	GET_CTXBUSY %g1
+	ldx	[%g1 + %g3], %g1! Fetch pmap for current context id
+
+	! Start of code to extract PA	
+	srlx	%g6, STSHIFT, %g7
+	and	%g7, STMASK, %g7
+	sll	%g7, 3, %g7		! byte offset into ctxbusy
+	add	%g7, %g1, %g1
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1	! Load pointer to directory
+	srlx	%g6, PDSHIFT, %g7			! Do page directory
+	and	%g7, PDMASK, %g7
+	sll	%g7, 3, %g7
+	brz,pn	%g1, spill_normal_to_user_stack_fail
+	 add	%g7, %g1, %g1
+
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1
+	srlx	%g6, PTSHIFT, %g7			! Convert to ptab offset
+	and	%g7, PTMASK, %g7
+	brz	%g1, spill_normal_to_user_stack_fail
+	 sll	%g7, 3, %g7
+	
+	add	%g1, %g7, %g7
+	ldxa	[%g7] ASI_PHYS_CACHED, %g7	! This one is not
+	brgez	%g7, spill_normal_to_user_stack_fail
+	 srlx	%g7, PGSHIFT, %g7			! Isolate PA part
+	
+	sll	%g6, 32-PGSHIFT, %g6			! And offset
+	sllx	%g7, PGSHIFT+8, %g7			! There are 8 bits to the left of the PA in the TTE
+	srl	%g6, 32-PGSHIFT, %g6
+	srax	%g7, 8, %g7
+	or	%g7, %g6, %g6	! Then combine them to form PA
+	! End of code to extract PA
+
+	wr	%g0, ASI_PHYS_CACHED, %asi		! Use ASI_PHYS_CACHED to prevent possible page faults
+	SPILL	stxa, %g6, 8, %asi			! Store the locals and ins
+	saved
+
+	retry
+	NOTREACHED
+
+spill_normal_to_user_stack_fail:
+	sir
+	 nop
+	
 /*
  * End of traps for sun4v.
  */



CVS commit: src/sys/arch/sparc64/sparc64

2021-02-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Feb 22 09:56:42 UTC 2021

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

Log Message:
sun4v: handle spill normal user traps properly when current trap level is 1 - 
registers are spilled to the PA of the stack to avoid further mmu-related 
traps, since sun4v only has 2 trap levels


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  2 08:18:42 UTC 2021

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

Log Message:
Worakround for traps on invalid VAs:
uvm_fault() can not (currently) deal properly with invalid VAs (inside the
VA hole), so do not pass faults for such addresses to it, but instead
either panic (if fault is in kernel) or send a SIGSEGV to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.192 src/sys/arch/sparc64/sparc64/trap.c:1.193
--- src/sys/arch/sparc64/sparc64/trap.c:1.192	Thu Nov 21 19:24:01 2019
+++ src/sys/arch/sparc64/sparc64/trap.c	Tue Feb  2 08:18:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.192 2019/11/21 19:24:01 ad Exp $ */
+/*	$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.192 2019/11/21 19:24:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.193 2021/02/02 08:18:42 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1092,6 +1092,25 @@ data_access_fault(struct trapframe64 *tf
 	sticks = p->p_sticks;
 	tstate = tf->tf_tstate;
 
+#ifdef _LP64
+	/* deal with invalid VAs early */
+	if (__predict_false(addr >= (1UL<

CVS commit: src/sys/arch/sparc64/sparc64

2021-02-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  2 08:18:42 UTC 2021

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

Log Message:
Worakround for traps on invalid VAs:
uvm_fault() can not (currently) deal properly with invalid VAs (inside the
VA hole), so do not pass faults for such addresses to it, but instead
either panic (if fault is in kernel) or send a SIGSEGV to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-12-22 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Dec 23 07:01:14 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add GPIO pin alert definitions for the E250.
Note, that the front panel also applies to the E450.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.6 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.6	Thu Oct 29 06:47:38 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Wed Dec 23 07:01:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.6 2020/10/29 06:47:38 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.7 2020/12/23 07:01:14 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.6 2020/10/29 06:47:38 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7 2020/12/23 07:01:14 jdc Exp $");
 
 #include 
 
@@ -134,6 +134,16 @@ add_gpio_props_e250(device_t dev, void *
 	prop_array_t pins;
 
 	switch (ia->ia_addr) {
+		case 0x38:	/* interrupt status */
+			pins = prop_array_create();
+			add_gpio_pin(pins, "ALERT high_temp", 1, 0, 30);
+			add_gpio_pin(pins, "ALERT disk_event", 2, 0, 30);
+			add_gpio_pin(pins, "ALERT fan_fail", 4, 0, 30);
+			add_gpio_pin(pins, "ALERT key_event", 5, 0, 30);
+			add_gpio_pin(pins, "ALERT psu_event", 6, 0, 30);
+			prop_dictionary_set(dict, "pins", pins);
+			prop_object_release(pins);
+			break;
 		case 0x39:	/* PSU status */
 			pins = prop_array_create();
 			add_gpio_pin(pins, "INDICATOR psu0_present", 0, 0, -1);
@@ -160,7 +170,7 @@ add_gpio_props_e250(device_t dev, void *
 			prop_dictionary_set(dict, "pins", pins);
 			prop_object_release(pins);
 			break;
-		case 0x3e:	/* front panel LEDs */
+		case 0x3e:	/* front panel LEDs (E250/E450) */
 			pins = prop_array_create();
 			add_gpio_pin(pins, "LED disk_fault", 0, 0, -1);
 			add_gpio_pin(pins, "LED psu_fault", 1, 0, -1);



CVS commit: src/sys/arch/sparc64/sparc64

2020-12-22 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Dec 23 07:01:14 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add GPIO pin alert definitions for the E250.
Note, that the front panel also applies to the E450.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/sparc64/ofw_patch.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-12-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Dec 20 11:58:58 UTC 2020

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

Log Message:
sun4v: add comment in sun4v_tl1_ptbl_miss code path - no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.423 src/sys/arch/sparc64/sparc64/locore.s:1.424
--- src/sys/arch/sparc64/sparc64/locore.s:1.423	Wed Jan  8 20:59:20 2020
+++ src/sys/arch/sparc64/sparc64/locore.s	Sun Dec 20 11:58:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.423 2020/01/08 20:59:20 skrll Exp $	*/
+/*	$NetBSD: locore.s,v 1.424 2020/12/20 11:58:58 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -3343,6 +3343,8 @@ sun4v_tl1_ptbl_miss:
 	bgeu,pt	%xcc, 1f
 	 nop
 
+	/* We had a miss inside rtf_user_fault_start/rtf_user_fault_end block (FILL)
+	
 	/* Fixup %cwp. */
 	rdpr	%cwp, %g1
 	inc	%g1



CVS commit: src/sys/arch/sparc64/sparc64

2020-12-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Dec 20 11:58:58 UTC 2020

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

Log Message:
sun4v: add comment in sun4v_tl1_ptbl_miss code path - no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Oct 29 06:47:39 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c ofw_patch.c ofw_patch.h

Log Message:
Add information about GPIO pin assignments and drive bays in the E250 and
v240.  Consolidate common code for v210/v240 and E250.
Modify the GPIO pin names to include a type (currently LED or INDICATOR)
which we can then handle in the driver.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc64/sparc64/ofw_patch.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/sparc64/ofw_patch.h

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Oct 29 06:47:39 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c ofw_patch.c ofw_patch.h

Log Message:
Add information about GPIO pin assignments and drive bays in the E250 and
v240.  Consolidate common code for v210/v240 and E250.
Modify the GPIO pin names to include a type (currently LED or INDICATOR)
which we can then handle in the driver.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc64/sparc64/ofw_patch.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.226 src/sys/arch/sparc64/sparc64/autoconf.c:1.227
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.226	Fri Oct 23 15:18:10 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Thu Oct 29 06:47:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.226 2020/10/23 15:18:10 jdc Exp $ */
+/*	$NetBSD: autoconf.c,v 1.227 2020/10/29 06:47:38 jdc Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.226 2020/10/23 15:18:10 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.227 2020/10/29 06:47:38 jdc Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1089,6 +1089,11 @@ device_register(device_t dev, void *aux)
 add_gpio_props_v210(dev, aux);
 			}
 		} 
+		if (device_is_a(dev, "pcf8574io")) {
+			if (!strcmp(machine_model, "SUNW,Ultra-250")) {
+add_gpio_props_e250(dev, aux);
+			}
+		} 
 	} else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) {
 		struct scsipibus_attach_args *sa = aux;
 		struct scsipi_periph *periph = sa->sa_periph;
@@ -1117,9 +1122,7 @@ device_register(device_t dev, void *aux)
 		0, periph->periph_lun);
 		if (device_is_a(busdev, "scsibus")) {
 			/* see if we're in a known SCA drivebay */
-			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
-add_drivebay_props_v210(dev, ofnode, aux);
-			}
+			add_drivebay_props(dev, ofnode, aux);
 		}
 		return;
 	} else if (device_is_a(dev, "wd")) {

Index: src/sys/arch/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.5 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.6
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.5	Sun Oct 25 07:46:53 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Thu Oct 29 06:47:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.5 2020/10/25 07:46:53 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.6 2020/10/29 06:47:38 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.5 2020/10/25 07:46:53 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.6 2020/10/29 06:47:38 jdc Exp $");
 
 #include 
 
@@ -42,11 +42,10 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,
 #include 
 
 static void
-add_gpio_LED(prop_array_t pins, const char *name, int num, int act, int def)
+add_gpio_pin(prop_array_t pins, const char *name, int num, int act, int def)
 {
 	prop_dictionary_t pin = prop_dictionary_create();
 	prop_dictionary_set_string(pin, "name", name);
-	prop_dictionary_set_uint32(pin, "type", 0);	/* 0 for LED, for now */
 	prop_dictionary_set_uint32(pin, "pin", num);
 	prop_dictionary_set_bool(pin, "active_high", act);
 	if (def != -1)
@@ -62,7 +61,7 @@ create_i2c_dict(device_t busdev)
 	prop_array_t cfg = NULL;
 
 	cfg = prop_dictionary_get(props, "i2c-child-devices");
- 	if (!cfg) {
+	if (!cfg) {
 		DPRINTF(ACDB_PROBE, ("\nCreating new i2c-child-devices\n"));
 		cfg = prop_array_create();
 		prop_dictionary_set(props, "i2c-child-devices", cfg);
@@ -100,18 +99,89 @@ add_gpio_props_v210(device_t dev, void *
 	switch (ia->ia_addr) {
 		case 0x38:	/* front panel LEDs */
 			pins = prop_array_create();
-			add_gpio_LED(pins, "indicator", 7, 0, -1);
-			add_gpio_LED(pins, "fault", 5, 0, 0);
-			add_gpio_LED(pins, "power", 4, 0, 1);
+			add_gpio_pin(pins, "LED indicator", 7, 0, -1);
+			add_gpio_pin(pins, "LED fault", 5, 0, 0);
+			add_gpio_pin(pins, "LED power", 4, 0, 1);
 			prop_dictionary_set(dict, "pins", pins);
 			prop_object_release(pins);
 			break;
-		case 0x23:	/* drive bay LEDs */
+		case 0x23:	/* drive bay O/1 LEDs */
 			pins = prop_array_create();
-			add_gpio_LED(pins, "bay0_fault", 10, 0, 0);
-			add_gpio_LED(pins, "bay1_fault", 11, 0, 0);
-			add_gpio_LED(pins, "bay0_remove", 12, 0, 0);
-			add_gpio_LED(pins, "bay1_remove", 13, 0, 0);
+			add_gpio_pin(pins, "LED bay0_fault", 10, 0, 0);
+			add_gpio_pin(pins, "LED bay1_fault", 11, 0, 0);
+			add_gpio_pin(pins, "LED bay0_remove", 12, 0, 0);
+			add_gpio_pin(pins, "LED bay1_remove", 13, 0, 0);
+			prop_dictionary_set(dict, "pins", pins);
+			

CVS commit: src/sys/arch/sparc64/sparc64

2020-10-25 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Oct 25 07:46:54 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Don't release the last reference to the "i2c-child-devices" dictionary in
the v210/v240 patches.
Fixes missing i2c devices there (pointed out by macallan@).
While here, add debug to show when we create the dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.4 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.5
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.4	Sat Oct 24 13:47:53 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Sun Oct 25 07:46:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.4 2020/10/24 13:47:53 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.5 2020/10/25 07:46:53 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.4 2020/10/24 13:47:53 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.5 2020/10/25 07:46:53 jdc Exp $");
 
 #include 
 
@@ -63,6 +63,7 @@ create_i2c_dict(device_t busdev)
 
 	cfg = prop_dictionary_get(props, "i2c-child-devices");
  	if (!cfg) {
+		DPRINTF(ACDB_PROBE, ("\nCreating new i2c-child-devices\n"));
 		cfg = prop_array_create();
 		prop_dictionary_set(props, "i2c-child-devices", cfg);
 		prop_dictionary_set_bool(props, "i2c-indirect-config", false);
@@ -171,8 +172,6 @@ add_env_sensors_v210(device_t busdev)
 	add_i2c_device(cfg, "hardware-monitor", "i2c-adm1026", 0x2e, 0);
 	/* LM75 at 0x4e */
 	add_i2c_device(cfg, "temperature-sensor", "i2c-lm75", 0x4e, 0);
-
-	prop_object_release(cfg);
 }
 
 /* Sensors and GPIO's for E450 and E250 */



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-25 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Oct 25 07:46:54 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Don't release the last reference to the "i2c-child-devices" dictionary in
the v210/v240 patches.
Fixes missing i2c devices there (pointed out by macallan@).
While here, add debug to show when we create the dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/sparc64/ofw_patch.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-24 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Oct 24 13:47:53 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add E250 i2c devices missing from the OFW tree.
Normalise the spelling of "temperature".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.3 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.4
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.3	Fri Oct 23 17:53:07 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Sat Oct 24 13:47:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.4 2020/10/24 13:47:53 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.4 2020/10/24 13:47:53 jdc Exp $");
 
 #include 
 
@@ -187,13 +187,13 @@ add_i2c_props_e450(device_t busdev, uint
 	/* Power supply 1 temperature. */
 	add_i2c_device(cfg, "PSU-1", "ecadc", 0x48, node);
 
-	/* Power supply 2 termperature. */
+	/* Power supply 2 temperature. */
 	add_i2c_device(cfg, "PSU-2", "ecadc", 0x49, node);
 
-	/* Power supply 3 tempterature. */
+	/* Power supply 3 temperature. */
 	add_i2c_device(cfg, "PSU-3", "ecadc", 0x4a, node);
 
-	/* Ambient tempterature. */
+	/* Ambient temperature. */
 	add_i2c_device(cfg, "ambient", "i2c-lm75", 0x4d, node);
 
 	/* CPU temperatures. */
@@ -206,15 +206,29 @@ void
 add_i2c_props_e250(device_t busdev, uint64_t node)
 {
 	prop_array_t cfg;
+	int i;
 
 	DPRINTF(ACDB_PROBE, ("\nAdding sensors for %s ", machine_model));
 	cfg = create_i2c_dict(busdev);
 
 	/* PSU temperature / CPU fan */
 	add_i2c_device(cfg, "PSU", "ecadc", 0x4a, node);
+
 	/* CPU & system board temperature */
 	add_i2c_device(cfg, "CPU", "ecadc", 0x4f, node);
 
+	/* GPIO's */
+	for (i = 0x38; i <= 0x39; i++)
+		add_i2c_device(cfg, "gpio", "i2c-pcf8574", i, node);
+	for (i = 0x3d; i <= 0x3f; i++)
+		add_i2c_device(cfg, "gpio", "i2c-pcf8574", i, node);
+
+	/* NVRAM */
+	add_i2c_device(cfg, "nvram", "i2c-at24c02", 0x52, node);
+
+	/* RSC clock */
+	add_i2c_device(cfg, "rscrtc", "i2c-ds1307", 0x68, node);
+
 	prop_object_release(cfg);
 }
 



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-24 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Oct 24 13:47:53 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add E250 i2c devices missing from the OFW tree.
Normalise the spelling of "temperature".


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

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Oct 23 17:53:07 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add missing prop_object_release() to the E250/E450 patches.
Use the recently added (in r1.2) functions for SPARCle i2c devices too.
Simplify adding "compatible" entries and handle cases where there is none.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/ofw_patch.c
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.2 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.3
--- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.2	Fri Oct 23 15:18:10 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.c	Fri Oct 23 17:53:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.c,v 1.2 2020/10/23 15:18:10 jdc Exp $ */
+/*	$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.2 2020/10/23 15:18:10 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.3 2020/10/23 17:53:07 jdc Exp $");
 
 #include 
 
@@ -75,15 +75,14 @@ add_i2c_device(prop_array_t cfg, const c
 uint32_t addr, uint64_t node)
 {
 	prop_dictionary_t dev;
-	prop_data_t data;
 
 	DPRINTF(ACDB_PROBE, ("\nAdding i2c device: %s (%s) @ 0x%x (%lx)\n",
-	name, compat, addr, node & 0x));
+	name, compat == NULL ? "NULL" : compat, addr, node & 0x));
 	dev = prop_dictionary_create();
 	prop_dictionary_set_string(dev, "name", name);
-	data = prop_data_create_copy(compat, strlen(compat) + 1);
-	prop_dictionary_set(dev, "compatible", data);
-	prop_object_release(data);
+	if (compat != NULL)
+		prop_dictionary_set_data(dev, "compatible", compat,
+		strlen(compat) + 1);
 	prop_dictionary_set_uint32(dev, "addr", addr);
 	prop_dictionary_set_uint64(dev, "cookie", node);
 	prop_array_add(cfg, dev);
@@ -146,20 +145,14 @@ add_drivebay_props_v210(device_t dev, in
 void
 add_spdmem_props_sparcle(device_t busdev)
 {
-	prop_dictionary_t props = device_properties(busdev);
-	prop_array_t cfg = prop_array_create();
+	prop_array_t cfg;
 	int i;
 
 	DPRINTF(ACDB_PROBE, ("\nAdding spdmem for SPARCle "));
-	for (i = 0x50; i <= 0x51; i++) {
-		prop_dictionary_t spd = prop_dictionary_create();
-		prop_dictionary_set_string(spd, "name", "dimm-spd");
-		prop_dictionary_set_uint32(spd, "addr", i);
-		prop_dictionary_set_uint64(spd, "cookie", 0);
-		prop_array_add(cfg, spd);
-		prop_object_release(spd);
-	}
-	prop_dictionary_set(props, "i2c-child-devices", cfg);
+
+	cfg = create_i2c_dict(busdev);
+	for (i = 0x50; i <= 0x51; i++)
+		add_i2c_device(cfg, "dimm-spd", NULL, i, 0);
 	prop_object_release(cfg);
 }
 
@@ -205,6 +198,8 @@ add_i2c_props_e450(device_t busdev, uint
 
 	/* CPU temperatures. */
 	add_i2c_device(cfg, "CPU", "ecadc", 0x4f, node);
+
+	prop_object_release(cfg);
 }
 
 void
@@ -219,6 +214,8 @@ add_i2c_props_e250(device_t busdev, uint
 	add_i2c_device(cfg, "PSU", "ecadc", 0x4a, node);
 	/* CPU & system board temperature */
 	add_i2c_device(cfg, "CPU", "ecadc", 0x4f, node);
+
+	prop_object_release(cfg);
 }
 
 /* Hardware specific device properties */



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Oct 23 17:53:07 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: ofw_patch.c

Log Message:
Add missing prop_object_release() to the E250/E450 patches.
Use the recently added (in r1.2) functions for SPARCle i2c devices too.
Simplify adding "compatible" entries and handle cases where there is none.


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

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-17 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Oct 17 08:10:31 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c ofw_patch.h

Log Message:
Avoid declaring autoconf_debug twice when building with DEBUG.
Pointed out by palle@ - thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/sparc64/ofw_patch.h

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-10-17 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat Oct 17 08:10:31 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c ofw_patch.h

Log Message:
Avoid declaring autoconf_debug twice when building with DEBUG.
Pointed out by palle@ - thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/sparc64/ofw_patch.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.224 src/sys/arch/sparc64/sparc64/autoconf.c:1.225
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.224	Fri Oct 16 07:35:16 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sat Oct 17 08:10:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.224 2020/10/16 07:35:16 jdc Exp $ */
+/*	$NetBSD: autoconf.c,v 1.225 2020/10/17 08:10:31 jdc Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.224 2020/10/16 07:35:16 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.225 2020/10/17 08:10:31 jdc Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -116,6 +116,8 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 
 #include "ksyms.h"
 
+int autoconf_debug = 0x0;
+
 struct evcnt intr_evcnts[] = {
 	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "spur"),
 	EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "intr", "lev1"),

Index: src/sys/arch/sparc64/sparc64/ofw_patch.h
diff -u src/sys/arch/sparc64/sparc64/ofw_patch.h:1.1 src/sys/arch/sparc64/sparc64/ofw_patch.h:1.2
--- src/sys/arch/sparc64/sparc64/ofw_patch.h:1.1	Fri Oct 16 07:35:16 2020
+++ src/sys/arch/sparc64/sparc64/ofw_patch.h	Sat Oct 17 08:10:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_patch.h,v 1.1 2020/10/16 07:35:16 jdc Exp $ */
+/*	$NetBSD: ofw_patch.h,v 1.2 2020/10/17 08:10:31 jdc Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #define ACDB_BOOTDEV0x1
 #define ACDB_PROBE  0x2
 #define ACDB_BOOTARGS   0x4
-int autoconf_debug = 0x0;
+extern int autoconf_debug;
 #define DPRINTF(l, s)   do { if (autoconf_debug & l) printf s; } while (0)
 #else
 #define DPRINTF(l, s)



CVS commit: src/sys/arch/sparc64/sparc64

2020-07-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Jul 23 16:08:03 UTC 2020

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

Log Message:
Move machine-specific fixes into separate functions to improve readability.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.221 src/sys/arch/sparc64/sparc64/autoconf.c:1.222
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.221	Sun Jul  5 09:56:06 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Thu Jul 23 16:08:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.221 2020/07/05 09:56:06 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.222 2020/07/23 16:08:02 jdc Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.221 2020/07/05 09:56:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.222 2020/07/23 16:08:02 jdc Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -,6 +,101 @@ add_drivebay_props_v210(device_t dev, in
 }
 
 /*
+ * Add SPARCle spdmem devices (0x50 and 0x51) that are not in the OFW tree
+ */
+static void
+add_spdmem_props_sparcle(device_t busdev)
+{
+	prop_dictionary_t props = device_properties(busdev);
+	prop_array_t cfg = prop_array_create();
+	int i;
+
+	DPRINTF(ACDB_PROBE, ("\nAdding spdmem for SPARCle "));
+	for (i = 0x50; i <= 0x51; i++) {
+		prop_dictionary_t spd = prop_dictionary_create();
+		prop_dictionary_set_string(spd, "name", "dimm-spd");
+		prop_dictionary_set_uint32(spd, "addr", i);
+		prop_dictionary_set_uint64(spd, "cookie", 0);
+		prop_array_add(cfg, spd);
+		prop_object_release(spd);
+	}
+	prop_dictionary_set(props, "i2c-child-devices", cfg);
+	prop_object_release(cfg);
+}
+
+/*
+ * Add V210/V240 environmental sensors that are not in the OFW tree.
+ */
+static void
+add_env_sensors_v210(device_t busdev)
+{
+	prop_dictionary_t props = device_properties(busdev);
+	prop_array_t cfg = NULL;
+	prop_dictionary_t sens;
+	prop_data_t data;
+	const char name_lm[] = "i2c-lm75";
+	const char name_adm[] = "i2c-adm1026";
+
+	DPRINTF(ACDB_PROBE, ("\nAdding sensors for %s ", machine_model));
+	cfg = prop_dictionary_get(props, "i2c-child-devices");
+ 	if (!cfg) {
+		cfg = prop_array_create();
+		prop_dictionary_set(props, "i2c-child-devices", cfg);
+		prop_dictionary_set_bool(props, "i2c-indirect-config", false);
+	}
+
+	/* ADM1026 at 0x2e */
+	sens = prop_dictionary_create();
+	prop_dictionary_set_uint32(sens, "addr", 0x2e);
+	prop_dictionary_set_uint64(sens, "cookie", 0);
+	prop_dictionary_set_string(sens, "name", "hardware-monitor");
+	data = prop_data_create_copy(_adm[0], sizeof(name_adm));
+	prop_dictionary_set(sens, "compatible", data);
+	prop_object_release(data);
+	prop_array_add(cfg, sens);
+	prop_object_release(sens);
+
+	/* LM75 at 0x4e */
+	sens = prop_dictionary_create();
+	prop_dictionary_set_uint32(sens, "addr", 0x4e);
+	prop_dictionary_set_uint64(sens, "cookie", 0);
+	prop_dictionary_set_string(sens, "name", "temperature-sensor");
+	data = prop_data_create_copy(_lm[0], sizeof(name_lm));
+	prop_dictionary_set(sens, "compatible", data);
+	prop_object_release(data);
+	prop_array_add(cfg, sens);
+	prop_object_release(sens);
+}
+
+/* Hardware specific device properties */
+static void
+set_hw_props(device_t dev)
+{
+	device_t busdev = device_parent(dev);
+
+	if ((!strcmp(machine_model, "SUNW,Sun-Fire-V240") ||
+	!strcmp(machine_model, "SUNW,Sun-Fire-V210"))) {
+		device_t busparent = device_parent(busdev);
+		prop_dictionary_t props = device_properties(dev);
+
+		if (busparent != NULL && device_is_a(busparent, "pcfiic") &&
+		device_is_a(dev, "adm1026hm") && props != NULL) {
+			prop_dictionary_set_uint8(props, "fan_div2", 0x55);
+			prop_dictionary_set_bool(props, "multi_read", true);
+		}
+	}
+
+	if (!strcmp(machine_model, "SUNW,Sun-Fire-V440")) {
+		device_t busparent = device_parent(busdev);
+		prop_dictionary_t props = device_properties(dev);
+		if (busparent != NULL && device_is_a(busparent, "pcfiic") &&
+		device_is_a(dev, "adm1026hm") && props != NULL) {
+			prop_dictionary_set_bool(props, "multi_read", true);
+		}
+	}
+}
+
+/*
  * Called back during autoconfiguration for each device found
  */
 void
@@ -1155,7 +1250,8 @@ device_register(device_t dev, void *aux)
 
 		ofnode = (int)ia->ia_cookie;
 		if (device_is_a(dev, "pcagpio")) {
-			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+			if (!strcmp(machine_model, "SUNW,Sun-Fire-V240") ||
+			!strcmp(machine_model, "SUNW,Sun-Fire-V210")) {
 add_gpio_props_v210(dev, aux);
 			}
 		} 
@@ -1344,82 +1440,13 @@ noether:
 			}
 		}
 
-		/*
-		 * Add SPARCle spdmem devices (0x50 and 0x51) that the
-		 * firmware does not know about.
-		 */
-		if (!strcmp(machine_model, 

CVS commit: src/sys/arch/sparc64/sparc64

2020-07-23 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Jul 23 16:08:03 UTC 2020

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

Log Message:
Move machine-specific fixes into separate functions to improve readability.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul  5 09:56:06 UTC 2020

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

Log Message:
Adapt to proplib api changes


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.220 src/sys/arch/sparc64/sparc64/autoconf.c:1.221
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.220	Sun Jul  5 09:27:11 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Jul  5 09:56:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.220 2020/07/05 09:27:11 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.221 2020/07/05 09:56:06 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.220 2020/07/05 09:27:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.221 2020/07/05 09:56:06 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1413,7 +1413,7 @@ noether:
 			prop_dictionary_set_uint64(sens, "cookie", 0);
 			prop_dictionary_set_string(sens, "name",
 			"temperature-sensor");
-			data = prop_data_create_data(_lm[0],
+			data = prop_data_create_copy(_lm[0],
 			sizeof(name_lm));
 			prop_dictionary_set(sens, "compatible", data);
 			prop_object_release(data);



CVS commit: src/sys/arch/sparc64/sparc64

2020-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul  5 09:56:06 UTC 2020

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

Log Message:
Adapt to proplib api changes


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul  5 09:27:11 UTC 2020

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

Log Message:
Adapt to proplib api changes


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-07-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul  5 09:27:11 UTC 2020

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

Log Message:
Adapt to proplib api changes


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.219 src/sys/arch/sparc64/sparc64/autoconf.c:1.220
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.219	Fri Jun 12 03:32:30 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Jul  5 09:27:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.219 2020/06/12 03:32:30 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.220 2020/07/05 09:27:11 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.219 2020/06/12 03:32:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.220 2020/07/05 09:27:11 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1050,7 +1050,7 @@ static void
 add_gpio_LED(prop_array_t pins, const char *name, int num, int act, int def)
 {
 	prop_dictionary_t pin = prop_dictionary_create();
-	prop_dictionary_set_cstring(pin, "name", name);
+	prop_dictionary_set_string(pin, "name", name);
 	prop_dictionary_set_uint32(pin, "type", 0);	/* 0 for LED, for now */
 	prop_dictionary_set_uint32(pin, "pin", num);
 	prop_dictionary_set_bool(pin, "active_high", act);
@@ -1106,7 +1106,7 @@ add_drivebay_props_v210(device_t dev, in
 		char name[16];
 
 		snprintf(name, sizeof(name), "bay%d", target);		
-		prop_dictionary_set_cstring(dict, "location", name);
+		prop_dictionary_set_string(dict, "location", name);
 	}
 }
 
@@ -1258,7 +1258,7 @@ device_register(device_t dev, void *aux)
 if (!prom_get_node_ether(ofnode, eaddr))
 	goto noether;
 			}
-			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);
 			of_to_dataprop(dict, ofnode, "shared-pins",
@@ -1357,7 +1357,7 @@ noether:
 			for (i = 0x50; i <= 0x51; i++) {
 prop_dictionary_t spd =
 prop_dictionary_create();
-prop_dictionary_set_cstring(spd, "name",
+prop_dictionary_set_string(spd, "name",
 "dimm-spd");
 prop_dictionary_set_uint32(spd, "addr", i);
 prop_dictionary_set_uint64(spd, "cookie", 0);
@@ -1398,9 +1398,9 @@ noether:
 			sens = prop_dictionary_create();
 			prop_dictionary_set_uint32(sens, "addr", 0x2e);
 			prop_dictionary_set_uint64(sens, "cookie", 0);
-			prop_dictionary_set_cstring(sens, "name",
+			prop_dictionary_set_string(sens, "name",
 			"hardware-monitor");
-			data = prop_data_create_data(_adm[0],
+			data = prop_data_create_copy(_adm[0],
 			sizeof(name_adm));
 			prop_dictionary_set(sens, "compatible", data);
 			prop_object_release(data);
@@ -1411,7 +1411,7 @@ noether:
 			sens = prop_dictionary_create();
 			prop_dictionary_set_uint32(sens, "addr", 0x4e);
 			prop_dictionary_set_uint64(sens, "cookie", 0);
-			prop_dictionary_set_cstring(sens, "name",
+			prop_dictionary_set_string(sens, "name",
 			"temperature-sensor");
 			data = prop_data_create_data(_lm[0],
 			sizeof(name_lm));
@@ -1669,7 +1669,7 @@ copyprops(device_t busdev, int node, pro
 	pos = strstr(output_device, ":r");
 	if (pos == NULL)
 		return;
-	prop_dictionary_set_cstring(dict, "videomode", pos + 2);
+	prop_dictionary_set_string(dict, "videomode", pos + 2);
 }
 
 static void



CVS commit: src/sys/arch/sparc64/sparc64

2020-06-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  9 21:57:00 UTC 2020

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

Log Message:
proplib API catchup
NFCI, tested on v210


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-06-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun  9 21:57:00 UTC 2020

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

Log Message:
proplib API catchup
NFCI, tested on v210


To generate a diff of this commit:
cvs rdiff -u -r1.217 -r1.218 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.217 src/sys/arch/sparc64/sparc64/autoconf.c:1.218
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.217	Sun Feb 23 05:14:29 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Tue Jun  9 21:57:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $ */
+/*	$NetBSD: autoconf.c,v 1.218 2020/06/09 21:57:00 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.218 2020/06/09 21:57:00 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1019,7 +1019,7 @@ device_ofnode(device_t dev)
 	if (obj == NULL)
 		return 0;
 
-	return prop_number_integer_value(obj);
+	return prop_number_signed_value(obj);
 }
 
 /*
@@ -1037,7 +1037,7 @@ device_setofnode(device_t dev, int node)
 	props = device_properties(dev);
 	if (props == NULL)
 		return;
-	obj = prop_number_create_integer(node);
+	obj = prop_number_create_signed(node);
 	if (obj == NULL)
 		return;
 	prop_dictionary_set(props, OFNODEKEY, obj);
@@ -1274,7 +1274,7 @@ noether:
 			if (OF_getprop(ofnode, "port-wwn", , sizeof(pwwn))
 			== sizeof(pwwn)) {
 pwwnd = 
-prop_number_create_unsigned_integer(pwwn);
+prop_number_create_unsigned(pwwn);
 prop_dictionary_set(dict, "port-wwn", pwwnd);
 prop_object_release(pwwnd);
 			}
@@ -1282,7 +1282,7 @@ noether:
 			if (OF_getprop(ofnode, "node-wwn", , sizeof(nwwn))
 			== sizeof(nwwn)) {
 nwwnd = 
-prop_number_create_unsigned_integer(nwwn);
+prop_number_create_unsigned(nwwn);
 prop_dictionary_set(dict, "node-wwn", nwwnd);
 prop_object_release(nwwnd);
 			}
@@ -1299,7 +1299,7 @@ noether:
 sizeof(id)) <= 0)
 	continue;
 
-idd = prop_number_create_unsigned_integer(id);
+idd = prop_number_create_unsigned(id);
 prop_dictionary_set(dict,
 		"scsi-initiator-id", idd);
 prop_object_release(idd);



CVS commit: src/sys/arch/sparc64/sparc64

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 11:28:52 UTC 2020

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

Log Message:
Avoid using excessive kernel stack.
XXX maybe we should unite all "static proc_t" and "static lwp_t" in ddb
into one global each?


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc64/sparc64/db_trace.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 31 11:28:52 UTC 2020

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

Log Message:
Avoid using excessive kernel stack.
XXX maybe we should unite all "static proc_t" and "static lwp_t" in ddb
into one global each?


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.54 src/sys/arch/sparc64/sparc64/db_trace.c:1.55
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.54	Tue Mar 10 15:54:52 2020
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Sun May 31 11:28:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.54 2020/03/10 15:54:52 christos Exp $ */
+/*	$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.54 2020/03/10 15:54:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.55 2020/05/31 11:28:52 martin Exp $");
 
 #include 
 #include 
@@ -102,9 +102,10 @@ db_stack_trace_print(db_expr_t addr, boo
 #endif
 	} else {
 		if (trace_thread) {
-			proc_t p;
-			lwp_t l;
+			static proc_t p;
+			static lwp_t l;
 			struct pcb *pcb;
+
 			if (lwpaddr) {
 db_read_bytes(addr, sizeof(l), (char *));
 db_read_bytes((db_addr_t)l.l_proc,



CVS commit: src/sys/arch/sparc64/sparc64

2020-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb 23 05:14:29 UTC 2020

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

Log Message:
add location info to sd instances if we know which drive bay they live in
Sun Fire v210 only for now, others should be easy to add


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.216 src/sys/arch/sparc64/sparc64/autoconf.c:1.217
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.216	Sun Feb  2 06:38:23 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Feb 23 05:14:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $ */
+/*	$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1088,6 +1088,28 @@ add_gpio_props_v210(device_t dev, void *
 	}
 }
 
+static void
+add_drivebay_props_v210(device_t dev, int ofnode, void *aux)
+{
+	struct scsipibus_attach_args *sa = aux;
+	int target = sa->sa_periph->periph_target;
+	char path[256]= "";
+
+	OF_package_to_path(ofnode, path, sizeof(path));
+
+	/* see if we're on the onboard controller's 1st channel */
+	if (strcmp(path, "/pci@1c,60/scsi@2") != 0)
+		return;
+	/* yes, yes we are */
+	if ( target < 2) {
+		prop_dictionary_t dict = device_properties(dev);
+		char name[16];
+
+		snprintf(name, sizeof(name), "bay%d", target);		
+		prop_dictionary_set_cstring(dict, "location", name);
+	}
+}
+
 /*
  * Called back during autoconfiguration for each device found
  */
@@ -1163,6 +1185,12 @@ device_register(device_t dev, void *aux)
 		ofnode = device_ofnode(device_parent(busdev));
 		dev_bi_unit_drive_match(dev, ofnode, periph->periph_target + off,
 		0, periph->periph_lun);
+		if (device_is_a(busdev, "scsibus")) {
+			/* see if we're in a known SCA drivebay */
+			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+add_drivebay_props_v210(dev, ofnode, aux);
+			}
+		}
 		return;
 	} else if (device_is_a(dev, "wd")) {
 		struct ata_device *adev = aux;



CVS commit: src/sys/arch/sparc64/sparc64

2020-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb 23 05:14:29 UTC 2020

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

Log Message:
add location info to sd instances if we know which drive bay they live in
Sun Fire v210 only for now, others should be easy to add


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2020-02-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb  2 06:38:24 UTC 2020

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

Log Message:
pass pin info to pcagpio instances, so far for front panel LEDs on
Sun Fire v210 only


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.215 src/sys/arch/sparc64/sparc64/autoconf.c:1.216
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.215	Sat Jan  5 15:46:02 2019
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Feb  2 06:38:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.215 2019/01/05 15:46:02 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.215 2019/01/05 15:46:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1046,6 +1046,48 @@ device_setofnode(device_t dev, int node)
 	device_xname(dev), node));
 }
 
+static void
+add_gpio_LED(prop_array_t pins, const char *name, int num, int act, int def)
+{
+	prop_dictionary_t pin = prop_dictionary_create();
+	prop_dictionary_set_cstring(pin, "name", name);
+	prop_dictionary_set_uint32(pin, "type", 0);	/* 0 for LED, for now */
+	prop_dictionary_set_uint32(pin, "pin", num);
+	prop_dictionary_set_bool(pin, "active_high", act);
+	if (def != -1)
+		prop_dictionary_set_int32(pin, "default_state", def);
+	prop_array_add(pins, pin);
+	prop_object_release(pin);
+}
+	
+static void
+add_gpio_props_v210(device_t dev, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+	prop_dictionary_t dict = device_properties(dev);
+	prop_array_t pins;
+
+	switch (ia->ia_addr) {
+		case 0x38:	/* front panel LEDs */
+			pins = prop_array_create();
+			add_gpio_LED(pins, "indicator", 7, 0, -1);
+			add_gpio_LED(pins, "fault", 5, 0, 0);
+			add_gpio_LED(pins, "power", 4, 0, 1);
+			prop_dictionary_set(dict, "pins", pins);
+			prop_object_release(pins);
+			break;
+		case 0x23:	/* drive bay LEDs */
+			pins = prop_array_create();
+			add_gpio_LED(pins, "bay0_fault", 10, 0, 0);
+			add_gpio_LED(pins, "bay1_fault", 11, 0, 0);
+			add_gpio_LED(pins, "bay0_remove", 12, 0, 0);
+			add_gpio_LED(pins, "bay1_remove", 13, 0, 0);
+			prop_dictionary_set(dict, "pins", pins);
+			prop_object_release(pins);
+			break;
+	}
+}
+
 /*
  * Called back during autoconfiguration for each device found
  */
@@ -1090,6 +1132,11 @@ device_register(device_t dev, void *aux)
 			return;
 
 		ofnode = (int)ia->ia_cookie;
+		if (device_is_a(dev, "pcagpio")) {
+			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+add_gpio_props_v210(dev, aux);
+			}
+		} 
 	} else if (device_is_a(dev, "sd") || device_is_a(dev, "cd")) {
 		struct scsipibus_attach_args *sa = aux;
 		struct scsipi_periph *periph = sa->sa_periph;



CVS commit: src/sys/arch/sparc64/sparc64

2020-02-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb  2 06:38:24 UTC 2020

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

Log Message:
pass pin info to pcagpio instances, so far for front panel LEDs on
Sun Fire v210 only


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/arch/sparc64/sparc64/autoconf.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-12-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 30 06:54:31 UTC 2019

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

Log Message:
add highly experimental NUMA support for US-IIIi machines


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/cpu.c
diff -u src/sys/arch/sparc64/sparc64/cpu.c:1.136 src/sys/arch/sparc64/sparc64/cpu.c:1.137
--- src/sys/arch/sparc64/sparc64/cpu.c:1.136	Tue Oct  1 18:00:08 2019
+++ src/sys/arch/sparc64/sparc64/cpu.c	Mon Dec 30 06:54:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.136 2019/10/01 18:00:08 chs Exp $ */
+/*	$NetBSD: cpu.c,v 1.137 2019/12/30 06:54:31 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.136 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.137 2019/12/30 06:54:31 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -556,7 +556,15 @@ cpu_attach(device_t parent, device_t dev
 		(u_int)GETVER_CPU_IMPL(),
 		(u_int)GETVER_CPU_MASK());
 	}
-
+#ifdef NUMA
+	if (CPU_IS_USIIIi()) {
+		uint64_t start = ci->ci_cpuid;
+		start <<= 36;
+		ci->ci_numa_id = ci->ci_cpuid;
+		printf("NUMA bucket %d %016lx\n", ci->ci_cpuid, start);
+		uvm_page_numa_load(start, 0x10, ci->ci_cpuid);
+	}
+#endif
 	if (ci->ci_system_clockrate[0] != 0) {
 		aprint_normal_dev(dev, "system tick frequency %s MHz\n",
 		clockfreq(ci->ci_system_clockrate[0]));



CVS commit: src/sys/arch/sparc64/sparc64

2019-12-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Dec 30 06:54:31 UTC 2019

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

Log Message:
add highly experimental NUMA support for US-IIIi machines


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/sparc64/sparc64/cpu.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-07-18 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jul 18 18:21:45 UTC 2019

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

Log Message:
sun4v: added some missing comments to the code in pcbspill


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 22 15:10:13 UTC 2019

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

Log Message:
Add missing include to fix the crash(8) build, from Tobias Ulmer, PR 
port-sparc64/54221


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.52 src/sys/arch/sparc64/sparc64/db_trace.c:1.53
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.52	Wed May 22 07:40:09 2019
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Wed May 22 15:10:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.52 2019/05/22 07:40:09 martin Exp $ */
+/*	$NetBSD: db_trace.c,v 1.53 2019/05/22 15:10:13 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.52 2019/05/22 07:40:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.53 2019/05/22 15:10:13 martin Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 



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

2019-05-22 Thread Tobias Ulmer
Oh, should've tested that. Survived kernels and distribution:

diff --git a/sys/arch/sparc64/sparc64/db_trace.c 
b/sys/arch/sparc64/sparc64/db_trace.c
index f5e35e79dd51..d94e5eb2d2ef 100644
--- a/sys/arch/sparc64/sparc64/db_trace.c
+++ b/sys/arch/sparc64/sparc64/db_trace.c
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.52 2019/05/22 
07:40:09 martin Exp $")
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 


On Wed, May 22, 2019 at 03:02:13PM +0200, J. Hannken-Illjes wrote:
> This breaks the build of usr.sbin/crash:
> 
> /work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c: In 
> function 'db_stack_trace_print':
> /work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c:166:37:
>  error: 'VM_MAX_KERNEL_ADDRESS' undeclared (first use in this function); did 
> you mean 'VM_MAXADDRESS'?
> if (frame < KERNBASE || frame >= VM_MAX_KERNEL_ADDRESS)
>  ^
>  VM_MAXADDRESS
> /work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c:166:37:
>  note: each undeclared identifier is reported only once for each function it 
> appears in
> 
> --
> J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig
> 
> > On 22. May 2019, at 09:40, Martin Husemann  wrote:
> > 
> > Module Name:src
> > Committed By:   martin
> > Date:   Wed May 22 07:40:09 UTC 2019
> > 
> > Modified Files:
> > src/sys/arch/sparc64/sparc64: db_trace.c
> > 
> > Log Message:
> > Fix previous and use the original patch from PR port-sparc64/54221
> > instead (XXX should fix comments in param.h)
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sparc64/sparc64/db_trace.c
> > 
> > Please note that diffs are not public domain; they are subject to the
> > copyright notices on the relevant files.
> > 
> 




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

2019-05-22 Thread J. Hannken-Illjes
This breaks the build of usr.sbin/crash:

/work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c: In 
function 'db_stack_trace_print':
/work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c:166:37:
 error: 'VM_MAX_KERNEL_ADDRESS' undeclared (first use in this function); did 
you mean 'VM_MAXADDRESS'?
if (frame < KERNBASE || frame >= VM_MAX_KERNEL_ADDRESS)
 ^
 VM_MAXADDRESS
/work/build/src/usr.sbin/crash/../../sys/arch/sparc64/sparc64/db_trace.c:166:37:
 note: each undeclared identifier is reported only once for each function it 
appears in

--
J. Hannken-Illjes - hann...@eis.cs.tu-bs.de - TU Braunschweig

> On 22. May 2019, at 09:40, Martin Husemann  wrote:
> 
> Module Name:  src
> Committed By: martin
> Date: Wed May 22 07:40:09 UTC 2019
> 
> Modified Files:
>   src/sys/arch/sparc64/sparc64: db_trace.c
> 
> Log Message:
> Fix previous and use the original patch from PR port-sparc64/54221
> instead (XXX should fix comments in param.h)
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sparc64/sparc64/db_trace.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 



signature.asc
Description: Message signed with OpenPGP


CVS commit: src/sys/arch/sparc64/sparc64

2019-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 22 07:40:09 UTC 2019

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

Log Message:
Fix previous and use the original patch from PR port-sparc64/54221
instead (XXX should fix comments in param.h)


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

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 22 07:40:09 UTC 2019

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

Log Message:
Fix previous and use the original patch from PR port-sparc64/54221
instead (XXX should fix comments in param.h)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.51 src/sys/arch/sparc64/sparc64/db_trace.c:1.52
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.51	Wed May 22 04:17:39 2019
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Wed May 22 07:40:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.51 2019/05/22 04:17:39 martin Exp $ */
+/*	$NetBSD: db_trace.c,v 1.52 2019/05/22 07:40:09 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.51 2019/05/22 04:17:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.52 2019/05/22 07:40:09 martin Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (kernel_only) {
 			if (pc < KERNBASE || pc >= KERNEND)
 break;
-			if (frame < KERNBASE || frame >= KERNEND)
+			if (frame < KERNBASE || frame >= VM_MAX_KERNEL_ADDRESS)
 break;
 		} else {
 			if (frame == 0 || frame == (vaddr_t)-1)



CVS commit: src/sys/arch/sparc64/sparc64

2019-05-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 22 04:17:39 UTC 2019

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

Log Message:
Relax test for valid stack frame address (now that we have multiple kernel
stacks since ... a long time). Just test for a valid kernel VA, using
the same test as for "pc".
Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc64/sparc64/db_trace.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-05-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May 22 04:17:39 UTC 2019

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

Log Message:
Relax test for valid stack frame address (now that we have multiple kernel
stacks since ... a long time). Just test for a valid kernel VA, using
the same test as for "pc".
Very close to a patch suggested by Tobias Ulmer in PR port-sparc64/54221.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/db_trace.c
diff -u src/sys/arch/sparc64/sparc64/db_trace.c:1.50 src/sys/arch/sparc64/sparc64/db_trace.c:1.51
--- src/sys/arch/sparc64/sparc64/db_trace.c:1.50	Mon Mar  4 20:17:46 2013
+++ src/sys/arch/sparc64/sparc64/db_trace.c	Wed May 22 04:17:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.50 2013/03/04 20:17:46 christos Exp $ */
+/*	$NetBSD: db_trace.c,v 1.51 2019/05/22 04:17:39 martin Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.50 2013/03/04 20:17:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.51 2019/05/22 04:17:39 martin Exp $");
 
 #include 
 #include 
@@ -163,7 +163,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (kernel_only) {
 			if (pc < KERNBASE || pc >= KERNEND)
 break;
-			if (frame < KERNBASE || frame >= EINTSTACK)
+			if (frame < KERNBASE || frame >= KERNEND)
 break;
 		} else {
 			if (frame == 0 || frame == (vaddr_t)-1)



CVS commit: src/sys/arch/sparc64/sparc64

2019-04-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr  7 19:31:38 UTC 2019

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

Log Message:
make trap 0x70 a TRAP() not UTRAP().  we should be able to handle
fast ECC error as a normal trap, and i saw this once a few years
ago but it never repeated so i haven't been able to test this.


To generate a diff of this commit:
cvs rdiff -u -r1.419 -r1.420 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-04-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr  7 19:31:38 UTC 2019

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

Log Message:
make trap 0x70 a TRAP() not UTRAP().  we should be able to handle
fast ECC error as a normal trap, and i saw this once a few years
ago but it never repeated so i haven't been able to test this.


To generate a diff of this commit:
cvs rdiff -u -r1.419 -r1.420 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.419 src/sys/arch/sparc64/sparc64/locore.s:1.420
--- src/sys/arch/sparc64/sparc64/locore.s:1.419	Fri Feb  8 20:34:23 2019
+++ src/sys/arch/sparc64/sparc64/locore.s	Sun Apr  7 19:31:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.419 2019/02/08 20:34:23 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.420 2019/04/07 19:31:38 mrg Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -763,7 +763,8 @@ ufast_DMMU_protection:			! 06c = fast da
 #endif
 	nop
 	TA32
-	UTRAP(0x070)			! Implementation dependent traps
+	TRAP(0x070)			! 0x070 fast_ECC_error
+	! Implementation dependent traps
 	UTRAP(0x071); UTRAP(0x072); UTRAP(0x073); UTRAP(0x074); UTRAP(0x075); UTRAP(0x076)
 	UTRAP(0x077); UTRAP(0x078); UTRAP(0x079); UTRAP(0x07a); UTRAP(0x07b); UTRAP(0x07c)
 	UTRAP(0x07d); UTRAP(0x07e); UTRAP(0x07f)
@@ -973,7 +974,8 @@ kfast_DMMU_protection:			! 06c = fast da
 #endif
 	nop
 	TA32
-	UTRAP(0x070)			! Implementation dependent traps
+	TRAP(0x070)			! 0x070 fast_ECC_error
+	! Implementation dependent traps
 	UTRAP(0x071); UTRAP(0x072); UTRAP(0x073); UTRAP(0x074); UTRAP(0x075); UTRAP(0x076)
 	UTRAP(0x077); UTRAP(0x078); UTRAP(0x079); UTRAP(0x07a); UTRAP(0x07b); UTRAP(0x07c)
 	UTRAP(0x07d); UTRAP(0x07e); UTRAP(0x07f)



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 15 16:36:33 UTC 2019

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

Log Message:
Add /* FALLTHROUGH */ for DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-15 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Feb 15 16:36:33 UTC 2019

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

Log Message:
Add /* FALLTHROUGH */ for DEBUG kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.190 src/sys/arch/sparc64/sparc64/trap.c:1.191
--- src/sys/arch/sparc64/sparc64/trap.c:1.190	Thu Feb 14 20:09:40 2019
+++ src/sys/arch/sparc64/sparc64/trap.c	Fri Feb 15 16:36:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $ */
+/*	$NetBSD: trap.c,v 1.191 2019/02/15 16:36:33 hannken Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.191 2019/02/15 16:36:33 hannken Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -625,6 +625,7 @@ dopanic:
 		   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm,
 		   pc, type, type < N_TRAP_TYPES ? trap_type[type] : T);
 #endif
+		/* FALLTHROUGH */
 	case T_ILLINST:
 #if defined(DDB) && defined(DEBUG)
 		if (trapdebug & TDB_STOPSIG)



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Feb 14 20:09:40 UTC 2019

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

Log Message:
sun4v: add debug printout for ALIGN trap


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Feb 14 20:09:40 UTC 2019

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

Log Message:
sun4v: add debug printout for ALIGN trap


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.189 src/sys/arch/sparc64/sparc64/trap.c:1.190
--- src/sys/arch/sparc64/sparc64/trap.c:1.189	Wed Dec 19 13:57:50 2018
+++ src/sys/arch/sparc64/sparc64/trap.c	Thu Feb 14 20:09:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.189 2018/12/19 13:57:50 maxv Exp $ */
+/*	$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.189 2018/12/19 13:57:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.190 2019/02/14 20:09:40 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -717,6 +717,10 @@ dopanic:
 #ifdef DEBUG
 		if (!CPU_ISSUN4V) {
 			isfsr = ldxa(SFSR, ASI_IMMU);
+		} else {
+		  paddr_t mmu_fsa_ifa = cpus->ci_mmufsa
+		+ offsetof(struct mmufsa, ifa);
+			isfsr = ldxa(mmu_fsa_ifa, ASI_PHYS_CACHED);
 		}
 #endif
 		/* 
@@ -731,10 +735,34 @@ dopanic:
 		
 #ifdef DEBUG
 #define fmt64(x)	(u_int)((x)>>32), (u_int)((x))
-		printf("Alignment error: pid=%d.%d comm=%s dsfsr=%08x:%08x "
-		   "dsfar=%x:%x isfsr=%08x:%08x pc=%lx\n",
-		   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, fmt64(dsfsr), fmt64(dsfar),
-		   fmt64(isfsr), pc);
+		if (!CPU_ISSUN4V) {
+			printf("Alignment error: pid=%d.%d comm=%s dsfsr=%08x:%08x "
+			   "dsfar=%x:%x isfsr=%08x:%08x pc=%lx\n",
+			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, fmt64(dsfsr), fmt64(dsfar),
+			   fmt64(isfsr), pc);
+		} else {
+		  
+			printf("Alignment error: pid=%d.%d comm=%s pc=%lx\n",
+			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, pc);
+			paddr_t mmufsa_ift_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ift);
+			paddr_t mmufsa_ifa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifa);
+			paddr_t mmufsa_ifc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifc);
+			paddr_t mmufsa_dft_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dft);
+			paddr_t mmufsa_dfa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfa);
+			paddr_t mmufsa_dfc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfc);
+			int64_t ift = ldxa(mmufsa_ift_addr, ASI_PHYS_CACHED);
+			printf("ift = %016lx\n", ift);
+			int64_t ifa = ldxa(mmufsa_ifa_addr, ASI_PHYS_CACHED);
+			printf("ifa = %016lx\n", ifa);
+			int64_t ifc = ldxa(mmufsa_ifc_addr, ASI_PHYS_CACHED);
+			printf("ifc = %016lx\n", ifc);
+			int64_t dft = ldxa(mmufsa_dft_addr, ASI_PHYS_CACHED);
+			printf("dft = %016lx\n", dft);
+			int64_t dfa = ldxa(mmufsa_dfa_addr, ASI_PHYS_CACHED);
+			printf("dfa = %016lx\n", dfa);
+			int64_t dfc = ldxa(mmufsa_dfc_addr, ASI_PHYS_CACHED);
+			printf("dfc = %016lx\n", dfc);
+		}
 #endif
 		
 #if defined(DDB) && defined(DEBUG)



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Feb 11 07:51:46 UTC 2019

Modified Files:
src/sys/arch/sparc64/sparc64: vm_machdep.c

Log Message:
retry timed out IPIs, complain and dump timing info into dmesg
ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc64/sparc64/vm_machdep.c

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-10 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Feb 11 07:51:46 UTC 2019

Modified Files:
src/sys/arch/sparc64/sparc64: vm_machdep.c

Log Message:
retry timed out IPIs, complain and dump timing info into dmesg
ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc64/sparc64/vm_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/sparc64/sparc64/vm_machdep.c
diff -u src/sys/arch/sparc64/sparc64/vm_machdep.c:1.101 src/sys/arch/sparc64/sparc64/vm_machdep.c:1.102
--- src/sys/arch/sparc64/sparc64/vm_machdep.c:1.101	Fri Nov  6 15:30:59 2015
+++ src/sys/arch/sparc64/sparc64/vm_machdep.c	Mon Feb 11 07:51:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.101 2015/11/06 15:30:59 martin Exp $ */
+/*	$NetBSD: vm_machdep.c,v 1.102 2019/02/11 07:51:46 macallan Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.101 2015/11/06 15:30:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.102 2019/02/11 07:51:46 macallan Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -305,12 +305,13 @@ fpusave_lwp(struct lwp *l, bool save)
 	}
 
 	for (ci = cpus; ci != NULL; ci = ci->ci_next) {
-		int spincount;
+		int spincount, retrycount=0;
 
 		if (ci == curcpu() || !CPUSET_HAS(cpus_active, ci->ci_index))
 			continue;
 		if (ci->ci_fplwp != l)
 			continue;
+again:
 		sparc64_send_ipi(ci->ci_cpuid, save ?
  sparc64_ipi_save_fpstate :
  sparc64_ipi_drop_fpstate, (uintptr_t)l, 0);
@@ -319,9 +320,13 @@ fpusave_lwp(struct lwp *l, bool save)
 		while (ci->ci_fplwp == l) {
 			membar_Sync();
 			spincount++;
-			if (spincount > 1000)
-panic("fpusave_lwp ipi didn't");
+			if (spincount > 1000) {
+printf("fpusave_lwp ipi didn't (%d)\n", retrycount);
+retrycount++;
+goto again;
+			}
 		}
+		if (retrycount > 0) printf("spincount %d\n", spincount);
 		break;
 	}
 #else



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 20:34:23 UTC 2019

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

Log Message:
sun4v: Improve comment for next_stick_init() - no functional changes


To generate a diff of this commit:
cvs rdiff -u -r1.418 -r1.419 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.418 src/sys/arch/sparc64/sparc64/locore.s:1.419
--- src/sys/arch/sparc64/sparc64/locore.s:1.418	Fri Feb  8 20:14:51 2019
+++ src/sys/arch/sparc64/sparc64/locore.s	Fri Feb  8 20:34:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.418 2019/02/08 20:14:51 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.419 2019/02/08 20:34:23 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -7513,6 +7513,9 @@ Lstick_ovflw:
  * Sets the %stick_cmpr register to the value retrieved from %stick so
  * next_stick() does not spend too much time in the function when called
  * for the first time.
+ * This has been observed on (at least) a SPARC-T5 (sun4v) system where
+ * the %stick_cmpr ends up being less than the %stick value and then
+ * the stickitr() interrupt is never triggered.
  */
 ENTRY(next_stick_init)
 	rd	STICK, %o0



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 20:34:23 UTC 2019

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

Log Message:
sun4v: Improve comment for next_stick_init() - no functional changes


To generate a diff of this commit:
cvs rdiff -u -r1.418 -r1.419 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 19:45:24 UTC 2019

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

Log Message:
sun4v: introduce macros for handling spill traps from userlevevel @ traplevel 1 
(from OpenBSD) - spill traps at level 1 from userspace now works better


To generate a diff of this commit:
cvs rdiff -u -r1.416 -r1.417 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.416 src/sys/arch/sparc64/sparc64/locore.s:1.417
--- src/sys/arch/sparc64/sparc64/locore.s:1.416	Fri Feb  8 19:26:25 2019
+++ src/sys/arch/sparc64/sparc64/locore.s	Fri Feb  8 19:45:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.416 2019/02/08 19:26:25 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.417 2019/02/08 19:45:24 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -227,6 +227,18 @@
 	LDPTR	[\reg + %lo(CPUINFO_VA + CI_TSB_DMMU)], \reg
 	.endm
 
+	.macro sun4v_tl1_uspill_normal
+	ba,a,pt	%xcc, pcbspill_normals
+	 nop
+	.align 128
+	.endm
+
+	.macro sun4v_tl1_uspill_other
+	ba,a,pt	%xcc, pcbspill_others
+	 nop
+	.align 128
+	.endm
+	
 #endif
 		
 #if 1
@@ -1155,17 +1167,17 @@ _C_LABEL(trapbase_sun4v):
 	sun4v_trap_entry 56	! 0x034-0x06b
 	VTRAP(T_FDMMU_PROT, sun4v_tl1_dtsb_prot)		! 0x06c
 	sun4v_trap_entry 19	! 0x06d-0x07f
-	SPILL64(uspill8_sun4vt1,ASI_AIUS)			! 0x080 spill_0_normal -- save user windows
-	SPILL32(uspill4_sun4vt1,ASI_AIUS)			! 0x084 spill_1_normal
-	SPILLBOTH(uspill8_sun4vt1,uspill4_sun4vt1,ASI_AIUS)	! 0x088 spill_2_normal
+	sun4v_tl1_uspill_normal	! 0x080 spill_0_normal -- save user windows
+	sun4v_tl1_uspill_normal	! 0x084 spill_1_normal
+	sun4v_tl1_uspill_normal	! 0x088 spill_2_normal
 	sun4v_trap_entry_spill_fill_fail 1			! 0x08c spill_3_normal
 	SPILL64(kspill8_sun4vt1,ASI_N)! 0x090 spill_4_normal -- save supervisor windows
 	SPILL32(kspill4_sun4vt1,ASI_N)! 0x094 spill_5_normal
 	SPILLBOTH(kspill8_sun4vt1,kspill4_sun4vt1,ASI_N)	! 0x098 spill_6_normal
 	sun4v_trap_entry_spill_fill_fail 1			! 0x09c spill_7_normal
-	SPILL64(uspillk8_sun4vt1,ASI_AIUS)			! 0x0a0 spill_0_other -- save user windows in nucleus mode
-	SPILL32(uspillk4_sun4vt1,ASI_AIUS)			! 0x0a4 spill_1_other
-	SPILLBOTH(uspillk8_sun4vt1,uspillk4_sun4vt1,ASI_AIUS)	! 0x0a8 spill_2_other
+	sun4v_tl1_uspill_other	! 0x0a0 spill_0_other -- save user windows in nucleus mode
+	sun4v_tl1_uspill_other	! 0x0a4 spill_1_other
+	sun4v_tl1_uspill_other	! 0x0a8 spill_2_other
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0ac spill_3_other
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0b0 spill_4_other
 	sun4v_trap_entry_spill_fill_fail 1			! 0x0b4 spill_5_other



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 19:45:24 UTC 2019

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

Log Message:
sun4v: introduce macros for handling spill traps from userlevevel @ traplevel 1 
(from OpenBSD) - spill traps at level 1 from userspace now works better


To generate a diff of this commit:
cvs rdiff -u -r1.416 -r1.417 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 19:26:25 UTC 2019

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

Log Message:
sun4v: add comment documenting the contents of the %g2 register - no functional 
changes


To generate a diff of this commit:
cvs rdiff -u -r1.415 -r1.416 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.415 src/sys/arch/sparc64/sparc64/locore.s:1.416
--- src/sys/arch/sparc64/sparc64/locore.s:1.415	Sun Nov  4 20:02:07 2018
+++ src/sys/arch/sparc64/sparc64/locore.s	Fri Feb  8 19:26:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.415 2018/11/04 20:02:07 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.416 2019/02/08 19:26:25 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -3034,7 +3034,7 @@ sun4v_tl0_dtsb_prot:
 
 #	btst	SUN4V_TLB_REAL_W|SUN4V_TLB_W, %g4	! Is it a ref fault?
 	mov	1, %g2
-	sllx	%g2, 61, %g2
+	sllx	%g2, 61, %g2			! %g2 is now SUN4V_TLB_REAL_W
 	or	%g2, SUN4V_TLB_W, %g2
 	btst	%g2, %g4
 	bz,pn	%xcc, sun4v_datatrap			! No -- really fault
@@ -3263,7 +3263,7 @@ sun4v_tl1_dtsb_prot:
 
 #	btst	SUN4V_TLB_REAL_W|SUN4V_TLB_W, %g4	! Is it a ref fault?
 	mov	1, %g2
-	sllx	%g2, 61, %g2
+	sllx	%g2, 61, %g2			! %g2 is now SUN4V_TLB_REAL_W
 	or	%g2, SUN4V_TLB_W, %g2
 	btst	%g2, %g4
 	bz,pn	%xcc, sun4v_tl1_ptbl_miss		! No -- really fault



CVS commit: src/sys/arch/sparc64/sparc64

2019-02-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb  8 19:26:25 UTC 2019

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

Log Message:
sun4v: add comment documenting the contents of the %g2 register - no functional 
changes


To generate a diff of this commit:
cvs rdiff -u -r1.415 -r1.416 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2019-01-30 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jan 30 10:11:11 UTC 2019

Modified Files:
src/sys/arch/sparc64/sparc64: netbsd32_machdep_13.c

Log Message:
Make this compile with "options DEBUG".


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

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



  1   2   3   4   5   6   7   >