CVS commit: src/sys/arch/powerpc/booke

2024-09-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 24 07:29:55 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
Partially fix PMAP_MINIMALTLB compilation. From andvar@


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/booke/booke_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/powerpc/booke

2024-09-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 24 07:29:55 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
Partially fix PMAP_MINIMALTLB compilation. From andvar@


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/booke/booke_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/powerpc/booke/booke_pmap.c
diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.38 src/sys/arch/powerpc/booke/booke_pmap.c:1.39
--- src/sys/arch/powerpc/booke/booke_pmap.c:1.38	Mon Apr 17 06:46:53 2023
+++ src/sys/arch/powerpc/booke/booke_pmap.c	Tue Sep 24 07:29:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_pmap.c,v 1.38 2023/04/17 06:46:53 skrll Exp $	*/
+/*	$NetBSD: booke_pmap.c,v 1.39 2024/09/24 07:29:55 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define __PMAP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.38 2023/04/17 06:46:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.39 2024/09/24 07:29:55 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -125,12 +125,16 @@ pmap_md_direct_mapped_vaddr_to_paddr(vad
 
 #ifdef PMAP_MINIMALTLB
 static pt_entry_t *
-kvtopte(const pmap_segtab_t *stb, vaddr_t va)
+pmap_kvtopte(const pmap_segtab_t *stb, vaddr_t va)
 {
-	pt_entry_t * const ptep = stb->seg_tab[va >> SEGSHIFT];
-	if (ptep == NULL)
+	const vaddr_t segtab_mask = PMAP_SEGTABSIZE - 1;
+	const size_t idx = (va >> SEGSHIFT) & segtab_mask;
+	pmap_ptpage_t * const ppg = stb->seg_ppg[idx];
+	if (ppg == NULL)
 		return NULL;
-	return &ptep[(va & SEGOFSET) >> PAGE_SHIFT];
+	const size_t pte_idx = (va >> PGSHIFT) & (NPTEPG - 1);
+
+	return &ppg->ppg_ptes[pte_idx];
 }
 
 vaddr_t
@@ -138,7 +142,7 @@ pmap_kvptefill(vaddr_t sva, vaddr_t eva,
 {
 	pmap_segtab_t * const stb = &pmap_kern_segtab;
 	KASSERT(sva == trunc_page(sva));
-	pt_entry_t *ptep = kvtopte(stb, sva);
+	pt_entry_t *ptep = pmap_kvtopte(stb, sva);
 	for (; sva < eva; sva += NBPG) {
 		*ptep++ = pt_entry ? (sva | pt_entry) : 0;
 	}
@@ -154,7 +158,7 @@ vaddr_t
 pmap_bootstrap(vaddr_t startkernel, vaddr_t endkernel,
 	phys_ram_seg_t *avail, size_t cnt)
 {
-	pmap_segtab_t * const stp = &pmap_kern_segtab;
+	pmap_segtab_t * const stb = &pmap_kern_segtab;
 
 	KASSERT(endkernel == trunc_page(endkernel));
 
@@ -228,14 +232,14 @@ pmap_bootstrap(vaddr_t startkernel, vadd
 	 * access to be common.
 	 */
 
-	pmap_ptpage_t **ppg_p = &stp->seg_ppg[VM_MIN_KERNEL_ADDRESS >> SEGSHIFT];
+	pmap_ptpage_t **ppg_p = &stb->seg_ppg[VM_MIN_KERNEL_ADDRESS >> SEGSHIFT];
 	pmap_ptpage_t *ppg = (void *)kv_segtabs;
 	memset(ppg, 0, NBPG * kv_nsegtabs);
 	for (size_t i = 0; i < kv_nsegtabs; i++, ppg++) {
 		*ppg_p++ = ppg;
 	}
 
-#if PMAP_MINIMALTLB
+#ifdef PMAP_MINIMALTLB
 	const vsize_t dm_nsegtabs = (physmem + NPTEPG - 1) / NPTEPG;
 	const vaddr_t dm_segtabs = avail[0].start;
 	printf(" dm_nsegtabs=%#"PRIxVSIZE, dm_nsegtabs);
@@ -246,11 +250,11 @@ pmap_bootstrap(vaddr_t startkernel, vadd
 	avail[0].size -= NBPG * dm_nsegtabs;
 	endkernel += NBPG * dm_nsegtabs;
 
-	ptp = stp->seg_tab;
+	ppg_p = stb->seg_ppg;
 	ppg = (void *)dm_segtabs;
 	memset(ppg, 0, NBPG * dm_nsegtabs);
-	for (size_t i = 0; i < dm_nsegtabs; i++, ptp++, ppg++) {
-		*ptp = ppg;
+	for (size_t i = 0; i < dm_nsegtabs; i++, ppg_p++, ppg++) {
+		*ppg_p = ppg;
 	}
 
 	/*



CVS commit: src/sys/arch/powerpc/booke

2024-09-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 15 19:08:34 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: e500_intr.c

Log Message:
remove DIAGNOSTIC guard around ipl definition in e500_extintr().

It is used only for KASSERTMSG() only in this method, but still expects it
to exist, even if DIAGNOSTIC is not enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/powerpc/booke/e500_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/powerpc/booke/e500_intr.c
diff -u src/sys/arch/powerpc/booke/e500_intr.c:1.48 src/sys/arch/powerpc/booke/e500_intr.c:1.49
--- src/sys/arch/powerpc/booke/e500_intr.c:1.48	Sun Sep  8 10:16:04 2024
+++ src/sys/arch/powerpc/booke/e500_intr.c	Sun Sep 15 19:08:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_intr.c,v 1.48 2024/09/08 10:16:04 andvar Exp $	*/
+/*	$NetBSD: e500_intr.c,v 1.49 2024/09/15 19:08:34 andvar Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define __INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.48 2024/09/08 10:16:04 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.49 2024/09/15 19:08:34 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mpc85xx.h"
@@ -982,9 +982,7 @@ e500_extintr(struct trapframe *tf)
 			__func__, tf, __LINE__, old_ipl, 
 			15 - IPL_HIGH, openpic_read(cpu, OPENPIC_CTPR));
 		const uint32_t iack = openpic_read(cpu, OPENPIC_IACK);
-#ifdef DIAGNOSTIC
 		const int ipl = iack & 0xf;
-#endif
 		const int irq = (iack >> 4) - 1;
 #if 0
 		printf("%s: iack=%d ipl=%d irq=%d <%s>\n",



CVS commit: src/sys/arch/powerpc/booke

2024-09-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep 15 19:08:34 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: e500_intr.c

Log Message:
remove DIAGNOSTIC guard around ipl definition in e500_extintr().

It is used only for KASSERTMSG() only in this method, but still expects it
to exist, even if DIAGNOSTIC is not enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/powerpc/booke/e500_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/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:16:05 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: e500_intr.c trap.c
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Use console_debbuger() or DDB guards for Debugger() and db_stack_trace_print().

Should allow to build these files without DDB enabled option.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/powerpc/booke/trap.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/booke/e500_intr.c
diff -u src/sys/arch/powerpc/booke/e500_intr.c:1.47 src/sys/arch/powerpc/booke/e500_intr.c:1.48
--- src/sys/arch/powerpc/booke/e500_intr.c:1.47	Fri Jul 22 19:54:14 2022
+++ src/sys/arch/powerpc/booke/e500_intr.c	Sun Sep  8 10:16:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_intr.c,v 1.47 2022/07/22 19:54:14 thorpej Exp $	*/
+/*	$NetBSD: e500_intr.c,v 1.48 2024/09/08 10:16:04 andvar Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define __INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.47 2022/07/22 19:54:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.48 2024/09/08 10:16:04 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mpc85xx.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: e500_intr.c,
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -561,7 +562,7 @@ e500_splx(int ipl)
 		printf("%s: %p: cpl=%u: ignoring splx(%u) to raise ipl\n",
 		__func__, __builtin_return_address(0), old_ipl, ipl);
 		if (old_ipl == IPL_NONE)
-			Debugger();
+			console_debugger();
 	}
 
 	// const

Index: src/sys/arch/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.40 src/sys/arch/powerpc/booke/trap.c:1.41
--- src/sys/arch/powerpc/booke/trap.c:1.40	Mon Apr 17 06:48:07 2023
+++ src/sys/arch/powerpc/booke/trap.c	Sun Sep  8 10:16:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.41 2024/09/08 10:16:04 andvar Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.41 2024/09/08 10:16:04 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -660,6 +660,7 @@ dump_trapframe(const struct trapframe *t
 	}
 }
 
+#ifdef DDB
 static bool
 ddb_exception(struct trapframe *tf)
 {
@@ -696,6 +697,7 @@ ddb_exception(struct trapframe *tf)
 	return false;
 #endif
 }
+#endif /* DDB */
 
 static bool
 onfaulted(struct trapframe *tf, register_t rv)
@@ -743,7 +745,7 @@ trap(enum ppc_booke_exceptions trap_code
 		printf("%s(entry): pid %d.%d (%s): invalid tf addr %p\n",
 		__func__, p->p_pid, l->l_lid, p->p_comm, tf);
 		dump_trapframe(tf, NULL);
-		Debugger();
+		console_debugger();
 	}
 #endif
 #if 0
@@ -762,7 +764,7 @@ trap(enum ppc_booke_exceptions trap_code
 		trap_names[trap_code], tf->tf_fixreg[1],
 		(uintmax_t)mfspr(SPR_SPRG1));
 		dump_trapframe(tf, NULL);
-		Debugger();
+		console_debugger();
 	}
 
 	if (usertrap && (tf->tf_srr1 & (PSL_DS|PSL_IS)) != (PSL_DS|PSL_IS)) {
@@ -770,7 +772,7 @@ trap(enum ppc_booke_exceptions trap_code
 		__func__, p->p_pid, l->l_lid, p->p_comm,
 		trap_names[trap_code], tf->tf_srr1);
 		dump_trapframe(tf, NULL);
-		Debugger();
+		console_debugger();
 	}
 
 	switch (trap_code) {
@@ -832,7 +834,9 @@ trap(enum ppc_booke_exceptions trap_code
 		rv = embedded_fp_round_exception(tf, &ksi);
 		break;
 	case T_EMBEDDED_PERF_MONITOR:
+#ifdef DDB
 		//db_stack_trace_print(tf->tf_fixreg[1], true, 40, "", printf);
+#endif
 		dump_trapframe(tf, NULL);
 		rv = EPERM;
 		break;
@@ -845,14 +849,14 @@ trap(enum ppc_booke_exceptions trap_code
 			__func__, p->p_pid, l->l_lid, p->p_comm,
 			tf->tf_fixreg[1]);
 			dump_trapframe(tf, NULL);
-			Debugger();
+			console_debugger();
 		}
 		if ((tf->tf_srr1 & (PSL_DS|PSL_IS)) != (PSL_DS|PSL_IS)) {
 			printf("%s(entry): pid %d.%d (%s): %s invalid PSL %#lx\n",
 			__func__, p->p_pid, l->l_lid, p->p_comm,
 			trap_names[trap_code], tf->tf_srr1);
 			dump_trapframe(tf, NULL);
-			Debugger();
+			console_debugger();
 		}
 #if 0
 		if ((mfmsr() & PSL_CE) == 0) {
@@ -868,7 +872,9 @@ trap(enum ppc_booke_exceptions trap_code
 	if (!usertrap) {
 		if (rv != 0) {
 			if (!onfaulted(tf, rv)) {
+#ifdef DDB
 db_stack_trace_print(tf->tf_fixreg[1], true, 40, "", printf);
+#endif
 dump_trapframe(tf, NULL);
 panic("%s: pid %d.%d (%s): %s exception in kernel mode"
 " (tf=%p, dear=%#lx, esr=%#x,"
@@ -930,7 +936,7 @@ trap(enum ppc_booke_exceptions trap_code
 			__func__, p->p_pid, l->l_lid, p->p_

CVS commit: src/sys/arch/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:16:05 UTC 2024

Modified Files:
src/sys/arch/powerpc/booke: e500_intr.c trap.c
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Use console_debbuger() or DDB guards for Debugger() and db_stack_trace_print().

Should allow to build these files without DDB enabled option.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/powerpc/booke/trap.c
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:09:48 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: db_interface.c

Log Message:
juggle around DDB guarded blocks to make them consistent and make code
build with or without DDB/KGDB options enabled for powerpc.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/powerpc/powerpc/db_interface.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/powerpc/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:09:48 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: db_interface.c

Log Message:
juggle around DDB guarded blocks to make them consistent and make code
build with or without DDB/KGDB options enabled for powerpc.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/powerpc/powerpc/db_interface.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/powerpc/powerpc/db_interface.c
diff -u src/sys/arch/powerpc/powerpc/db_interface.c:1.60 src/sys/arch/powerpc/powerpc/db_interface.c:1.61
--- src/sys/arch/powerpc/powerpc/db_interface.c:1.60	Wed Oct 26 23:38:08 2022
+++ src/sys/arch/powerpc/powerpc/db_interface.c	Sun Sep  8 10:09:48 2024
@@ -1,8 +1,8 @@
-/*	$NetBSD: db_interface.c,v 1.60 2022/10/26 23:38:08 riastradh Exp $ */
+/*	$NetBSD: db_interface.c,v 1.61 2024/09/08 10:09:48 andvar Exp $ */
 /*	$OpenBSD: db_interface.c,v 1.2 1996/12/28 06:21:50 rahnds Exp $	*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.60 2022/10/26 23:38:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.61 2024/09/08 10:09:48 andvar Exp $");
 
 #define USERACC
 
@@ -73,6 +73,7 @@ db_regs_t ddb_regs;
 
 void ddb_trap(void);/* Call into trap_subr.S */
 int ddb_trap_glue(struct trapframe *);		/* Called from trap_subr.S */
+#ifdef DDB
 #if defined (PPC_OEA) || defined(PPC_OEA64) || defined (PPC_OEA64_BRIDGE)
 static void db_show_bat(db_expr_t, bool, db_expr_t, const char *);
 static void db_show_mmu(db_expr_t, bool, db_expr_t, const char *);
@@ -102,7 +103,6 @@ static void db_ppcbooke_dumptlb(db_expr_
 static void db_mach_cpu(db_expr_t, bool, db_expr_t, const char *);
 #endif	/* MULTIPROCESSOR */
 
-#ifdef DDB
 const struct db_command db_machine_command_table[] = {
 #if defined (PPC_OEA) || defined(PPC_OEA64) || defined (PPC_OEA64_BRIDGE)
 	{ DDB_ADD_CMD("bat",	db_show_bat,		0,
@@ -252,7 +252,8 @@ kdb_trap(int type, void *v)
 	db_trap(type, 0);
 	cnpollc(0);
 	db_active--;
-#elif defined(KGDB)
+#endif
+#ifdef KGDB
 	if (!kgdb_trap(type, DDB_REGS)) {
 		rv = 0;
 		goto out;
@@ -304,6 +305,7 @@ kdb_trap(int type, void *v)
 	return rv;
 }
 
+#ifdef DDB
 #if defined (PPC_OEA) || defined(PPC_OEA64) || defined (PPC_OEA64_BRIDGE)
 static void
 print_battranslation(struct bat *bat, unsigned int blidx)
@@ -492,6 +494,7 @@ db_show_mmu(db_expr_t addr, bool have_ad
 #endif
 }
 #endif /* PPC_OEA || PPC_OEA64 || PPC_OEA64_BRIDGE */
+#endif /* DDB */
 
 #if defined(PPC_IBM4XX) || defined(PPC_BOOKE)
 db_addr_t
@@ -522,9 +525,8 @@ branch_taken(int inst, db_addr_t pc, db_
 }
 #endif /* PPC_IBM4XX || PPC_BOOKE */
 
-
-#ifdef PPC_IBM4XX
 #ifdef DDB
+#ifdef PPC_IBM4XX
 static void
 db_ppc4xx_ctx(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
 {
@@ -806,8 +808,6 @@ db_ppc4xx_useracc(db_expr_t addr, bool h
 }
 #endif
 
-#endif /* DDB */
-
 #endif /* PPC_IBM4XX */
 
 #ifdef PPC_BOOKE
@@ -904,3 +904,4 @@ db_mach_cpu(db_expr_t addr, bool have_ad
 	}
 }
 #endif	/* MULTIPROCESSOR */
+#endif /* DDB */



CVS commit: src/sys/arch/powerpc/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:02:49 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
include  for the PSL_DR definition (for KGDB enabled build only).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/powerpc/kgdb_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/powerpc/powerpc/kgdb_machdep.c
diff -u src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.25 src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.26
--- src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.25	Tue Oct 24 20:21:12 2023
+++ src/sys/arch/powerpc/powerpc/kgdb_machdep.c	Sun Sep  8 10:02:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.25 2023/10/24 20:21:12 andvar Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.26 2024/09/08 10:02:49 andvar Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.25 2023/10/24 20:21:12 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.26 2024/09/08 10:02:49 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: kgdb_machdep
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #if defined (PPC_OEA) || defined (PPC_OEA601) || defined (PPC_OEA64_BRIDGE)



CVS commit: src/sys/arch/powerpc/powerpc

2024-09-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Sep  8 10:02:49 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
include  for the PSL_DR definition (for KGDB enabled build only).


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/powerpc/kgdb_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/powerpc/powerpc

2024-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 19 15:19:22 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: compat_13_machdep.c compat_16_machdep.c

Log Message:
powerpc64: Provide dummy stubs for compat1[36]

as done for amd64. We haven't had working userland for powerpc64,
and therefore compatible to 1.[36] is only useful for netbsd32.

Fix build failure for evbppc64 for PR kern/58346 (my bug!).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/powerpc/compat_13_machdep.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/powerpc/compat_16_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/powerpc/powerpc

2024-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jun 19 15:19:22 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: compat_13_machdep.c compat_16_machdep.c

Log Message:
powerpc64: Provide dummy stubs for compat1[36]

as done for amd64. We haven't had working userland for powerpc64,
and therefore compatible to 1.[36] is only useful for netbsd32.

Fix build failure for evbppc64 for PR kern/58346 (my bug!).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/powerpc/compat_13_machdep.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/powerpc/compat_16_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/powerpc/powerpc/compat_13_machdep.c
diff -u src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.22 src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.23
--- src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.22	Sun Mar 13 17:50:55 2022
+++ src/sys/arch/powerpc/powerpc/compat_13_machdep.c	Wed Jun 19 15:19:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_13_machdep.c,v 1.22 2022/03/13 17:50:55 andvar Exp $	*/
+/*	$NetBSD: compat_13_machdep.c,v 1.23 2024/06/19 15:19:22 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.22 2022/03/13 17:50:55 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2024/06/19 15:19:22 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -53,6 +53,22 @@ __KERNEL_RCSID(0, "$NetBSD: compat_13_ma
 
 #include 
 
+#ifdef _LP64
+
+/*
+ * COMPAT_13 is useful only with COMPAT_NETBSD32.
+ */
+
+int
+compat_13_sys_sigreturn(struct lwp *l,
+const struct compat_13_sys_sigreturn_args *uap, register_t *retval)
+{
+
+	return ENOSYS;
+}
+
+#else
+
 int
 compat_13_sys_sigreturn(struct lwp *l,
 const struct compat_13_sys_sigreturn_args *uap, register_t *retval)
@@ -104,3 +120,5 @@ compat_13_sys_sigreturn(struct lwp *l,
 
 	return (EJUSTRETURN);
 }
+
+#endif /* !_LP64 */

Index: src/sys/arch/powerpc/powerpc/compat_16_machdep.c
diff -u src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.25 src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.26
--- src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.25	Mon Jun 17 21:57:59 2024
+++ src/sys/arch/powerpc/powerpc/compat_16_machdep.c	Wed Jun 19 15:19:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_16_machdep.c,v 1.25 2024/06/17 21:57:59 pgoyette Exp $	*/
+/*	$NetBSD: compat_16_machdep.c,v 1.26 2024/06/19 15:19:22 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.25 2024/06/17 21:57:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.26 2024/06/19 15:19:22 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -60,6 +60,29 @@ __KERNEL_RCSID(0, "$NetBSD: compat_16_ma
 #include 
 #endif
 
+#ifdef _LP64
+
+/*
+ * COMPAT_16 is useful only with COMPAT_NETBSD32.
+ */
+void
+sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
+{
+
+	printf("sendsig_sigcontext: illegal\n");
+	sigexit(curlwp, SIGILL);
+}
+
+int
+compat_16_sys___sigreturn14(struct lwp *l,
+const struct compat_16_sys___sigreturn14_args *uap, register_t *retval)
+{
+
+	return ENOSYS;
+}
+
+#else
+
 /*
  * Send a signal to process.
  */
@@ -253,3 +276,5 @@ compat_16_sys___sigreturn14(struct lwp *
 
 	return (EJUSTRETURN);
 }
+
+#endif /* !_LP64 */



CVS commit: src/sys/arch/powerpc/powerpc

2024-06-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 17 21:57:59 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: compat_16_machdep.c

Log Message:
Add required include for compat_16 machdep code


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/powerpc/compat_16_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/powerpc/powerpc/compat_16_machdep.c
diff -u src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.24 src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.25
--- src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.24	Sat May 27 21:38:06 2023
+++ src/sys/arch/powerpc/powerpc/compat_16_machdep.c	Mon Jun 17 21:57:59 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_16_machdep.c,v 1.24 2023/05/27 21:38:06 andvar Exp $	*/
+/*	$NetBSD: compat_16_machdep.c,v 1.25 2024/06/17 21:57:59 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.24 2023/05/27 21:38:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.25 2024/06/17 21:57:59 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_16_ma
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/powerpc/powerpc

2024-06-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 17 21:57:59 UTC 2024

Modified Files:
src/sys/arch/powerpc/powerpc: compat_16_machdep.c

Log Message:
Add required include for compat_16 machdep code


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/powerpc/compat_16_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/powerpc/oea

2024-06-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun 15 19:48:13 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: altivec.c

Log Message:
don't do anything in vec_restore_from_mcontext() if no altivec.

fixes a crash seen on netbsd-10 in PR#58283.

XXX: pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/oea/altivec.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/powerpc/oea

2024-06-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jun 15 19:48:13 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: altivec.c

Log Message:
don't do anything in vec_restore_from_mcontext() if no altivec.

fixes a crash seen on netbsd-10 in PR#58283.

XXX: pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/oea/altivec.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/powerpc/oea/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.34 src/sys/arch/powerpc/oea/altivec.c:1.35
--- src/sys/arch/powerpc/oea/altivec.c:1.34	Sat Oct 30 19:44:56 2021
+++ src/sys/arch/powerpc/oea/altivec.c	Sat Jun 15 19:48:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $	*/
+/*	$NetBSD: altivec.c,v 1.35 2024/06/15 19:48:13 mrg Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.35 2024/06/15 19:48:13 mrg Exp $");
 
 #include 
 #include 
@@ -163,6 +163,10 @@ vec_restore_from_mcontext(struct lwp *l,
 
 	KASSERT(l == curlwp);
 
+	/* Nothing to do here. */
+	if (!vec_used_p(l))
+		return;
+
 	/* we don't need to save the state, just drop it */
 	pcu_discard(&vec_ops, l, true);
 



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63	Sat Sep 23 21:26:16 2023
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May 28 11:06:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -113,7 +113,7 @@ struct OF_translation ofw_translations[O
 struct pmap ofw_pmap;
 struct bat ofw_battable[BAT_VA2IDX(0x)+1];
 
-char bootpath[256];
+char bootpath[256] = "";
 char model_name[64];
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 void *startsym, *endsym;
@@ -165,7 +165,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
-	} else {
+	}
+
+	/* if bootpath is still empty, get it from /chosen */
+	if (bootpath[0] == 0) {
 		int chs = OF_finddevice("/chosen");
 		int len;
 



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/include

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 14:21:29 UTC 2024

Modified Files:
src/sys/arch/powerpc/include: limits.h

Log Message:
harmonize with the rest of MD limits files.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/include/limits.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/powerpc/include

2024-04-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  2 14:21:29 UTC 2024

Modified Files:
src/sys/arch/powerpc/include: limits.h

Log Message:
harmonize with the rest of MD limits files.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/include/limits.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/powerpc/include/limits.h
diff -u src/sys/arch/powerpc/include/limits.h:1.20 src/sys/arch/powerpc/include/limits.h:1.21
--- src/sys/arch/powerpc/include/limits.h:1.20	Mon Jan 21 15:28:18 2019
+++ src/sys/arch/powerpc/include/limits.h	Tue Apr  2 10:21:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: limits.h,v 1.20 2019/01/21 20:28:18 dholland Exp $	*/
+/*	$NetBSD: limits.h,v 1.21 2024/04/02 14:21:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -94,18 +94,9 @@
 #define	SIZE_T_MAX	UINT_MAX	/* max value for a size_t */
 #endif
 
-#ifdef _LP64
-/* Quads and longs are the same on LP64. */
-#define	UQUAD_MAX	(ULONG_MAX)
-#define	QUAD_MAX	(LONG_MAX)
-#define	QUAD_MIN	(LONG_MIN)
-#else
-/* GCC requires that quad constants be written as expressions. */
-#define	UQUAD_MAX	((u_quad_t)0-1)	/* max value for a uquad_t */
-	/* max value for a quad_t */
-#define	QUAD_MAX	((quad_t)(UQUAD_MAX >> 1))
-#define	QUAD_MIN	(-QUAD_MAX-1)	/* min value for a quad_t */
-#endif
+#define	UQUAD_MAX	0xULL		/* max unsigned quad */
+#define	QUAD_MAX	0x7fffLL		/* max signed quad */
+#define	QUAD_MIN	(-0x7fffLL-1)	/* min signed quad */
 
 #endif /* _NETBSD_SOURCE */
 #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */



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

2024-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 20 00:35:21 UTC 2024

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

Log Message:
Fix reproducible builds (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/powerpc/conf/Makefile.powerpc

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/powerpc/conf/Makefile.powerpc
diff -u src/sys/arch/powerpc/conf/Makefile.powerpc:1.61 src/sys/arch/powerpc/conf/Makefile.powerpc:1.62
--- src/sys/arch/powerpc/conf/Makefile.powerpc:1.61	Sat Sep 22 08:24:03 2018
+++ src/sys/arch/powerpc/conf/Makefile.powerpc	Tue Mar 19 20:35:21 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.powerpc,v 1.61 2018/09/22 12:24:03 rin Exp $
+#	$NetBSD: Makefile.powerpc,v 1.62 2024/03/20 00:35:21 christos Exp $
 #
 # Makefile for NetBSD
 #
@@ -114,6 +114,9 @@ _OSRELEASE!=		${HOST_SH} $S/conf/osrelea
 MKUBOOTIMAGEARGS=   -A powerpc -T kernel -C gz
 MKUBOOTIMAGEARGS+=  -a ${TEXTADDR:C/$//} -e $(TEXTADDR)
 MKUBOOTIMAGEARGS+=  -n "NetBSD/$(MACHINE) ${_OSRELEASE} ($(KERNEL_BUILD:T))"
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+MKUBOOTIMAGEARGS+=	-t "${MKREPRO_TIMESTAMP}"
+.endif
 
 SYSTEM_LD_TAIL_EXTRA+=; \
 	echo ${TOOL_GZIP_N} -9c $@.bin '>' $@.bin.gz; \



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

2024-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 20 00:35:21 UTC 2024

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

Log Message:
Fix reproducible builds (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/powerpc/conf/Makefile.powerpc

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



CVS commit: src/sys/arch/powerpc/include/oea

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 17:07:31 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
powerpc/hid: fix snprintb format for HID0_970_BITMASK_U


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/include/oea/hid.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/powerpc/include/oea/hid.h
diff -u src/sys/arch/powerpc/include/oea/hid.h:1.14 src/sys/arch/powerpc/include/oea/hid.h:1.15
--- src/sys/arch/powerpc/include/oea/hid.h:1.14	Sat Jan 20 09:47:35 2024
+++ src/sys/arch/powerpc/include/oea/hid.h	Sun Mar 10 17:07:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.14 2024/01/20 09:47:35 jmcneill Exp $	*/
+/*	$NetBSD: hid.h,v 1.15 2024/03/10 17:07:31 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -112,7 +112,7 @@
 "\040EMCP"
 
 #define HID0_970_BITMASK_U "\020" \
-"\040ONEPPC\036DOSNGL\036ISYNCSC\035SERGP\034res\033res\032res\031DEEPNAP" \
+"\040ONEPPC\037DOSNGL\036ISYNCSC\035SERGP\034res\033res\032res\031DEEPNAP" \
 "\030DOZE\027NAP\026res\025DPM\024res\023TG\022HNGDIS\021NHR" \
 "\020INORDER\017res\016TBCTRL\015EXTBEN\014res\013res\012CIABREN\011HDICEEN" \
 "\001ENATTN"



CVS commit: src/sys/arch/powerpc/include/oea

2024-03-10 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Mar 10 17:07:31 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
powerpc/hid: fix snprintb format for HID0_970_BITMASK_U


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/include/oea/hid.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/powerpc/ibm4xx

2024-02-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb  1 22:02:18 UTC 2024

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
s/againt/against/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/ibm4xx/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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.109 src/sys/arch/powerpc/ibm4xx/pmap.c:1.110
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.109	Wed Oct  5 09:03:06 2022
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Feb  1 22:02:18 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.110 2024/02/01 22:02:18 andvar Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2024/02/01 22:02:18 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1207,7 +1207,7 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 
 		/*
 		 * For p != curproc, we cannot rely upon TLB miss handler in
-		 * user context. Therefore, extract pa and operate againt it.
+		 * user context. Therefore, extract pa and operate against it.
 		 *
 		 * Note that va below VM_MIN_KERNEL_ADDRESS is reserved for
 		 * direct mapping.



CVS commit: src/sys/arch/powerpc/ibm4xx

2024-02-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Feb  1 22:02:18 UTC 2024

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
s/againt/against/ in comment.


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

2024-01-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jan 23 04:15:54 UTC 2024

Modified Files:
src/sys/arch/powerpc/include: ieee.h

Log Message:
powerpc/ieee.h: Protect from multiple includes

Fix build failure triggered by import of libm long-double functions.


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

2024-01-22 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jan 23 04:15:54 UTC 2024

Modified Files:
src/sys/arch/powerpc/include: ieee.h

Log Message:
powerpc/ieee.h: Protect from multiple includes

Fix build failure triggered by import of libm long-double functions.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/include/ieee.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/powerpc/include/ieee.h
diff -u src/sys/arch/powerpc/include/ieee.h:1.6 src/sys/arch/powerpc/include/ieee.h:1.7
--- src/sys/arch/powerpc/include/ieee.h:1.6	Wed Oct 22 10:32:50 2014
+++ src/sys/arch/powerpc/include/ieee.h	Tue Jan 23 04:15:54 2024
@@ -1,4 +1,7 @@
-/*	$NetBSD: ieee.h,v 1.6 2014/10/22 10:32:50 joerg Exp $	*/
+/*	$NetBSD: ieee.h,v 1.7 2024/01/23 04:15:54 rin Exp $	*/
+
+#ifndef _POWERPC_IEEE_H_
+#define _POWERPC_IEEE_H_
 
 #include 
 
@@ -16,3 +19,5 @@ union ldbl_u {
 	long double	ldblu_ld;
 	double		ldblu_d[2];
 };
+
+#endif /* !_POWERPC_IEEE_H_ */



CVS commit: src/sys/arch/powerpc/powerpc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 20:49:11 UTC 2024

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

Log Message:
powerpc: fix delay for large (> ~5sec) values

When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/powerpc/clock.c

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

Modified files:

Index: src/sys/arch/powerpc/powerpc/clock.c
diff -u src/sys/arch/powerpc/powerpc/clock.c:1.17 src/sys/arch/powerpc/powerpc/clock.c:1.18
--- src/sys/arch/powerpc/powerpc/clock.c:1.17	Mon Jul  6 10:31:24 2020
+++ src/sys/arch/powerpc/powerpc/clock.c	Sat Jan 20 20:49:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.17 2020/07/06 10:31:24 rin Exp $	*/
+/*	$NetBSD: clock.c,v 1.18 2024/01/20 20:49:11 jmcneill Exp $	*/
 /*  $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.17 2020/07/06 10:31:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.18 2024/01/20 20:49:11 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -232,7 +232,7 @@ delay(unsigned int n)
 #endif /* !_ARCH_PPC64 */
 	{
 		tb = mftb();
-		tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
+		tb += (n * 1000ULL + ns_per_tick - 1) / ns_per_tick;
 #ifdef _ARCH_PPC64
 		__asm volatile ("1: mftb %0; cmpld %0,%1; blt 1b;"
 			  : "=&r"(scratch) : "r"(tb)



CVS commit: src/sys/arch/powerpc/powerpc

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 20:49:11 UTC 2024

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

Log Message:
powerpc: fix delay for large (> ~5sec) values

When calculating the target timebase, promote '1000' on the RHS to ULL
to force 64-bit calculation, otherwise 'n * 1000' will overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/powerpc/clock.c

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



CVS commit: src/sys/arch/powerpc/include/oea

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 09:47:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/oea/hid.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/powerpc/include/oea/hid.h
diff -u src/sys/arch/powerpc/include/oea/hid.h:1.13 src/sys/arch/powerpc/include/oea/hid.h:1.14
--- src/sys/arch/powerpc/include/oea/hid.h:1.13	Mon Jul  6 10:31:23 2020
+++ src/sys/arch/powerpc/include/oea/hid.h	Sat Jan 20 09:47:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.13 2020/07/06 10:31:23 rin Exp $	*/
+/*	$NetBSD: hid.h,v 1.14 2024/01/20 09:47:35 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -81,8 +81,8 @@
 #define HID0_DCE	0x4000  /* Enable d-cache */
 #define HID0_ILOCK	0x2000  /* i-cache lock */
 #define HID0_DLOCK	0x1000  /* d-cache lock */
-#define HID0_ICFI	0x0800  /* i-cache flush invalidate */
-#define HID0_DCFI	0x0400  /* d-cache flush invalidate */
+#define HID0_ICFI	0x0800  /* i-cache flash invalidate */
+#define HID0_DCFI	0x0400  /* d-cache flash invalidate */
 #define HID0_SPD	0x0200  /* Disable speculative cache access */
 #define HID0_IFEM	0x0100  /* Enable M-bit for I-fetch */
 #define HID0_XBSEN	0x0100  /* Extended BAT block size enable (7455+) */



CVS commit: src/sys/arch/powerpc/include/oea

2024-01-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 09:47:35 UTC 2024

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
fix comments: HID0 ICFI/DCFI are "flash invalidate", not "flush invalidate"


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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.108 src/sys/arch/powerpc/oea/cpu_subr.c:1.109
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.108	Sun Mar 21 23:41:52 2021
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Jan 20 00:19:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $");
 
 #include "sysmon_envsys.h"
 
@@ -153,6 +153,19 @@ static const struct fmttab cpu_7450_l3cr
 	{ 0, 0, NULL },
 };
 
+static const struct fmttab cpu_ibm750cl_l2cr_formats[] = {
+	{ L2CR_L2E, 0, " disabled" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
+	{ 0, ~0, " 256KB" },
+	{ L2CR_L2WT, L2CR_L2WT, " WT" },
+	{ L2CR_L2WT, 0, " WB" },
+	{ L2CR_L2PE, L2CR_L2PE, " with ECC" },
+	{ 0, ~0, " L2 cache" },
+	{ 0, 0, NULL }
+};
+
 static const struct fmttab cpu_ibm750_l2cr_formats[] = {
 	{ L2CR_L2E, 0, " disabled" },
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
@@ -1078,10 +1091,13 @@ cpu_config_l2cr(int pvr)
 		break;
 	case MPC750:
 		if ((pvr & 0xff00) == 0x00082200 /* IBM750CX */ ||
-		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */)
+		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */) {
 			cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
-		else
+		} else if ((pvr & 0xf0e0) == 0x00087000 /* IBM750CL */) {
+			cpu_fmttab_print(cpu_ibm750cl_l2cr_formats, l2cr);
+		} else {
 			cpu_fmttab_print(cpu_l2cr_formats, l2cr);
+		}
 		break;
 	case MPC7447A:
 	case MPC7457:



CVS commit: src/sys/arch/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_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/powerpc/oea

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: oea_machdep.c

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_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/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.84 src/sys/arch/powerpc/oea/oea_machdep.c:1.85
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.84	Sun Aug  7 09:37:46 2022
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Jan 20 00:18:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -1064,7 +1064,7 @@ mapiodev(paddr_t pa, psize_t len, bool p
 
 	for (; len > 0; len -= PAGE_SIZE) {
 		pmap_kenter_pa(taddr, faddr, VM_PROT_READ | VM_PROT_WRITE,
-		(prefetchable ? PMAP_MD_PREFETCHABLE : PMAP_NOCACHE));
+		PMAP_NOCACHE | (prefetchable ? PMAP_MD_PREFETCHABLE : 0));
 		faddr += PAGE_SIZE;
 		taddr += PAGE_SIZE;
 	}



CVS commit: src/sys/arch/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:44:00 UTC 2023

Modified Files:
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/powerpc: bus_dma.c vm_machdep.c

Log Message:
powerpc: Make sure direct-mapped buffer fits within correct range

For OEA and OEA64_BRIDGE, only first 3GiB memory is direct-mapped.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/powerpc/bus_dma.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/powerpc/powerpc/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/powerpc/include/pmap.h
diff -u src/sys/arch/powerpc/include/pmap.h:1.42 src/sys/arch/powerpc/include/pmap.h:1.43
--- src/sys/arch/powerpc/include/pmap.h:1.42	Sat May  7 07:10:46 2022
+++ src/sys/arch/powerpc/include/pmap.h	Fri Dec 15 09:43:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.42 2022/05/07 07:10:46 rin Exp $	*/
+/*	$NetBSD: pmap.h,v 1.43 2023/12/15 09:43:59 rin Exp $	*/
 
 #ifndef _POWERPC_PMAP_H_
 #define _POWERPC_PMAP_H_
@@ -20,6 +20,10 @@
 #error unknown PPC variant
 #endif
 
+#ifndef PMAP_DIRECT_MAPPED_LEN
+#define	PMAP_DIRECT_MAPPED_LEN	(~0UL)
+#endif
+
 #endif /* !_MODULE */
 
 #if !defined(_LOCORE) && (defined(MODULAR) || defined(_MODULE))

Index: src/sys/arch/powerpc/powerpc/bus_dma.c
diff -u src/sys/arch/powerpc/powerpc/bus_dma.c:1.55 src/sys/arch/powerpc/powerpc/bus_dma.c:1.56
--- src/sys/arch/powerpc/powerpc/bus_dma.c:1.55	Tue Jul 26 20:08:56 2022
+++ src/sys/arch/powerpc/powerpc/bus_dma.c	Fri Dec 15 09:43:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.55 2022/07/26 20:08:56 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.56 2023/12/15 09:43:59 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #define _POWERPC_BUS_DMA_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.55 2022/07/26 20:08:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.56 2023/12/15 09:43:59 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -707,8 +707,10 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 	if (nsegs == 1 && (flags & BUS_DMA_DONTCACHE) == 0) {
 		KASSERT(size == segs->ds_len);
 		addr = BUS_MEM_TO_PHYS(t, segs->ds_addr);
-		*kvap = (void *)PMAP_MAP_POOLPAGE(addr);
-		return 0;
+		if (__predict_true(addr + size < PMAP_DIRECT_MAPPED_LEN)) {
+			*kvap = (void *)PMAP_MAP_POOLPAGE(addr);
+			return 0;
+		}
 	}
 #endif
 

Index: src/sys/arch/powerpc/powerpc/vm_machdep.c
diff -u src/sys/arch/powerpc/powerpc/vm_machdep.c:1.105 src/sys/arch/powerpc/powerpc/vm_machdep.c:1.106
--- src/sys/arch/powerpc/powerpc/vm_machdep.c:1.105	Mon Dec  5 16:01:03 2022
+++ src/sys/arch/powerpc/powerpc/vm_machdep.c	Fri Dec 15 09:43:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.105 2022/12/05 16:01:03 martin Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.106 2023/12/15 09:43:59 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.105 2022/12/05 16:01:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.106 2023/12/15 09:43:59 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -322,7 +322,8 @@ cpu_uarea_alloc(bool system)
 	 * Allocate a new physically contiguous uarea which can be
 	 * direct-mapped.
 	 */
-	error = uvm_pglistalloc(USPACE, 0, ~0UL, 0, 0, &pglist, 1, 1);
+	error = uvm_pglistalloc(USPACE, 0, PMAP_DIRECT_MAPPED_LEN, 0, 0,
+	&pglist, 1, 1);
 	if (error) {
 		return NULL;
 	}



CVS commit: src/sys/arch/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:44:00 UTC 2023

Modified Files:
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/powerpc: bus_dma.c vm_machdep.c

Log Message:
powerpc: Make sure direct-mapped buffer fits within correct range

For OEA and OEA64_BRIDGE, only first 3GiB memory is direct-mapped.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/powerpc/bus_dma.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/powerpc/powerpc/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/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:42:33 UTC 2023

Modified Files:
src/sys/arch/powerpc/include: vmparam.h
src/sys/arch/powerpc/include/oea: pmap.h
src/sys/arch/powerpc/oea: pmap.c pmap_kernel.c

Log Message:
powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory

As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.

PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/include/vmparam.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/include/oea/pmap.h
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/powerpc/oea/pmap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/oea/pmap_kernel.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/powerpc/include/vmparam.h
diff -u src/sys/arch/powerpc/include/vmparam.h:1.26 src/sys/arch/powerpc/include/vmparam.h:1.27
--- src/sys/arch/powerpc/include/vmparam.h:1.26	Wed May 11 13:58:43 2022
+++ src/sys/arch/powerpc/include/vmparam.h	Fri Dec 15 09:42:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.26 2022/05/11 13:58:43 andvar Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.27 2023/12/15 09:42:33 rin Exp $	*/
 
 #ifndef _POWERPC_VMPARAM_H_
 #define _POWERPC_VMPARAM_H_
@@ -12,7 +12,7 @@
  * These are common for BOOKE, IBM4XX, and OEA
  */
 #define	VM_FREELIST_DEFAULT	0
-#define	VM_FREELIST_FIRST256	1
+#define	VM_FREELIST_DIRECT_MAPPED	1
 #define	VM_FREELIST_FIRST16	2
 #define	VM_NFREELIST		3
 

Index: src/sys/arch/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.38 src/sys/arch/powerpc/include/oea/pmap.h:1.39
--- src/sys/arch/powerpc/include/oea/pmap.h:1.38	Thu Sep 28 06:19:19 2023
+++ src/sys/arch/powerpc/include/oea/pmap.h	Fri Dec 15 09:42:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.38 2023/09/28 06:19:19 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.39 2023/12/15 09:42:33 rin Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -121,6 +121,16 @@ __BEGIN_DECLS
 #include 
 #include 
 
+/*
+ * For OEA and OEA64_BRIDGE, we guarantee that pa below USER_ADDR
+ * (== 3GB < VM_MIN_KERNEL_ADDRESS) is direct-mapped.
+ */
+#if defined(PPC_OEA) || defined(PPC_OEA64_BRIDGE)
+#define	PMAP_DIRECT_MAPPED_SR	(USER_SR - 1)
+#define	PMAP_DIRECT_MAPPED_LEN \
+((vaddr_t)SEGMENT_LENGTH * (PMAP_DIRECT_MAPPED_SR + 1))
+#endif
+
 #if defined (PPC_OEA) || defined (PPC_OEA64_BRIDGE)
 extern register_t iosrtable[];
 #endif
@@ -186,10 +196,13 @@ static __inline paddr_t vtophys (vaddr_t
  * VA==PA all at once.  But pmap_copy_page() and pmap_zero_page() will have
  * this problem, too.
  */
-#if !defined(PPC_OEA64) && !defined (PPC_OEA64_BRIDGE)
+#if !defined(PPC_OEA64)
 #define	PMAP_MAP_POOLPAGE(pa)	(pa)
 #define	PMAP_UNMAP_POOLPAGE(pa)	(pa)
 #define POOL_VTOPHYS(va)	vtophys((vaddr_t) va)
+
+#define	PMAP_ALLOC_POOLPAGE(flags)	pmap_alloc_poolpage(flags)
+struct vm_page *pmap_alloc_poolpage(int);
 #endif
 
 static __inline paddr_t

Index: src/sys/arch/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.120 src/sys/arch/powerpc/oea/pmap.c:1.121
--- src/sys/arch/powerpc/oea/pmap.c:1.120	Fri Dec 15 09:36:35 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:42:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.121 2023/12/15 09:42:33 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.121 2023/12/15 09:42:33 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -342,18 +342,6 @@ struct pvo_tqhead *pmap_pvo_table;	/* pv
 struct pool pmap_pool;		/* pool for pmap structures */
 struct pool pmap_pvo_pool;	/* pool for pvo entries */
 
-/*
- * We keep a cache of unmanaged pages to be used for pvo entries for
- * unmanaged pages.
- */
-struct pvo_page {
-	SIMPLEQ_ENTRY(pvo_page) pvop_link;
-};
-SIMPLEQ_HEAD(pvop_head, pvo_page);
-static struct pvop_head pmap_pvop_head = SIMPLEQ_HEAD_INITIALIZER(pmap_pvop_head);
-static u_long pmap_pvop_free;
-static u_long pmap_pvop_maxfree;
-
 static void *pmap_pool_alloc(struct pool *, int);
 static void pmap_pool_free(struct pool *, void *);
 
@@ -1137,7 +1125,7 @@ pmap_create(void)
 	pmap_t pm;
 
 	pm = pool_get(&pmap_pool, PR_WAITOK | PR_ZERO);
-	KASSERT((vaddr_t)pm < VM_MIN_KERNEL_ADDRESS);
+	KASSERT((vaddr_t)pm < PMAP_DIRECT_MAPPED_LEN);
 	pmap_pinit(pm);
 	
 	DPRINTFN(CREATE, "pmap_create: pm %p:\n"
@@ -1381,7 +1369,7 @@ pmap_pvo_find_va(pmap_t pm, vaddr_t va, 
 
 	TAILQ_FOREACH(pvo, &pmap_pvo_table[ptegidx], pvo_olink) {
 #if defined(DIAGNOSTIC) || defined(DEBUG) || defined(PMAPCHECK)
-		if ((uintptr_t) pvo >= SEGMENT_LE

CVS commit: src/sys/arch/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:42:33 UTC 2023

Modified Files:
src/sys/arch/powerpc/include: vmparam.h
src/sys/arch/powerpc/include/oea: pmap.h
src/sys/arch/powerpc/oea: pmap.c pmap_kernel.c

Log Message:
powerpc: oea: For OEA64_BRIDGE, 1:1 map up to 3GiB memory

As done for OEA. Note that kva over 3GiB is reserved.

Provide PMAP_MAP_POOLPAGE for OEA64_BRIDGE at the same time, by
which direct-mapped memory is utilized in order to work around
starvation of 512MiB kernel virtual space.

PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/include/vmparam.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/include/oea/pmap.h
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/powerpc/oea/pmap.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/oea/pmap_kernel.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/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:36:36 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.119 src/sys/arch/powerpc/oea/pmap.c:1.120
--- src/sys/arch/powerpc/oea/pmap.c:1.119	Fri Dec 15 09:35:29 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:36:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -1136,9 +1136,8 @@ pmap_create(void)
 {
 	pmap_t pm;
 
-	pm = pool_get(&pmap_pool, PR_WAITOK);
+	pm = pool_get(&pmap_pool, PR_WAITOK | PR_ZERO);
 	KASSERT((vaddr_t)pm < VM_MIN_KERNEL_ADDRESS);
-	memset((void *)pm, 0, sizeof *pm);
 	pmap_pinit(pm);
 	
 	DPRINTFN(CREATE, "pmap_create: pm %p:\n"



CVS commit: src/sys/arch/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:36:36 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/powerpc/oea/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/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:35:29 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool

(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.

(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.

(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.118 src/sys/arch/powerpc/oea/pmap.c:1.119
--- src/sys/arch/powerpc/oea/pmap.c:1.118	Fri Dec 15 09:33:29 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:35:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -292,7 +292,7 @@ const struct pmap_ops PMAPNAME(ops) = {
 #endif /* !PMAPNAME */
 
 /*
- * The following structure is aligned to 32 bytes 
+ * The following structure is aligned to 32 bytes, if reasonably possible.
  */
 struct pvo_entry {
 	LIST_ENTRY(pvo_entry) pvo_vlink;	/* Link to common virt page */
@@ -317,7 +317,14 @@ struct pvo_entry {
 #define	PVO_REMOVE		6		/* PVO has been removed */
 #define	PVO_WHERE_MASK		15
 #define	PVO_WHERE_SHFT		8
-} __attribute__ ((aligned (32)));
+};
+
+#if defined(PMAP_OEA) && !defined(DIAGNOSTIC)
+#define	PMAP_PVO_ENTRY_ALIGN	32
+#else
+#define	PMAP_PVO_ENTRY_ALIGN	__alignof(struct pvo_entry)
+#endif
+
 #define	PVO_VADDR(pvo)		((pvo)->pvo_vaddr & ~ADDR_POFF)
 #define	PVO_PTEGIDX_GET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK)
 #define	PVO_PTEGIDX_ISSET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
@@ -3440,7 +3447,7 @@ pmap_bootstrap1(paddr_t kernelstart, pad
 #endif
 
 	pool_init(&pmap_pvo_pool, sizeof(struct pvo_entry),
-	sizeof(struct pvo_entry), 0, 0, "pmap_pvopl",
+	PMAP_PVO_ENTRY_ALIGN, 0, 0, "pmap_pvopl",
 	&pmap_pool_allocator, IPL_VM);
 
 	pool_setlowat(&pmap_pvo_pool, 1008);



CVS commit: src/sys/arch/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:35:29 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool

(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.

(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.

(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/oea/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/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:33:30 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.117 src/sys/arch/powerpc/oea/pmap.c:1.118
--- src/sys/arch/powerpc/oea/pmap.c:1.117	Fri Dec 15 09:32:05 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:33:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -879,48 +879,35 @@ pmap_pte_insert(int ptegidx, struct pte 
  * Tries to spill a page table entry from the overflow area.
  * This runs in either real mode (if dealing with a exception spill)
  * or virtual mode when dealing with manually spilling one of the
- * kernel's pte entries.  In either case, interrupts are already
- * disabled.
+ * kernel's pte entries.
  */
 
 int
-pmap_pte_spill(struct pmap *pm, vaddr_t addr, bool exec)
+pmap_pte_spill(struct pmap *pm, vaddr_t addr, bool isi_p)
 {
-	struct pvo_entry *source_pvo, *victim_pvo, *next_pvo;
-	struct pvo_entry *pvo;
-	/* XXX: gcc -- vpvoh is always set at either *1* or *2* */
-	struct pvo_tqhead *pvoh, *vpvoh = NULL;
-	int ptegidx, i, j;
+	struct pvo_tqhead *spvoh, *vpvoh;
+	struct pvo_entry *pvo, *source_pvo, *victim_pvo;
 	volatile struct pteg *pteg;
 	volatile struct pte *pt;
+	register_t msr, vsid, hash;
+	int ptegidx, hid, i, j;
+	int done = 0;
 
 	PMAP_LOCK();
+	msr = pmap_interrupts_off();
+
+	/* XXXRO paranoid? */
+	if (pm->pm_evictions == 0)
+		goto out;
 
 	ptegidx = va_to_pteg(pm, addr);
 
 	/*
-	 * Have to substitute some entry. Use the primary hash for this.
-	 * Use low bits of timebase as random generator.  Make sure we are
-	 * not picking a kernel pte for replacement.
+	 * Find source pvo.
 	 */
-	pteg = &pmap_pteg_table[ptegidx];
-	i = MFTB() & 7;
-	for (j = 0; j < 8; j++) {
-		pt = &pteg->pt[i];
-		if ((pt->pte_hi & PTE_VALID) == 0)
-			break;
-		if (VSID_TO_HASH((pt->pte_hi & PTE_VSID) >> PTE_VSID_SHFT)
-< PHYSMAP_VSIDBITS)
-			break;
-		i = (i + 1) & 7;
-	}
-	KASSERT(j < 8);
-
+	spvoh = &pmap_pvo_table[ptegidx];
 	source_pvo = NULL;
-	victim_pvo = NULL;
-	pvoh = &pmap_pvo_table[ptegidx];
-	TAILQ_FOREACH(pvo, pvoh, pvo_olink) {
-
+	TAILQ_FOREACH(pvo, spvoh, pvo_olink) {
 		/*
 		 * We need to find pvo entry for this address...
 		 */
@@ -931,101 +918,105 @@ pmap_pte_spill(struct pmap *pm, vaddr_t 
 		 * a valid PTE, then we know we can't find it because all
 		 * evicted PVOs always are first in the list.
 		 */
-		if (source_pvo == NULL && (pvo->pvo_pte.pte_hi & PTE_VALID))
+		if ((pvo->pvo_pte.pte_hi & PTE_VALID) != 0)
 			break;
-		if (source_pvo == NULL && pm == pvo->pvo_pmap &&
-		addr == PVO_VADDR(pvo)) {
 
-			/*
-			 * Now we have found the entry to be spilled into the
-			 * pteg.  Attempt to insert it into the page table.
-			 */
-			j = pmap_pte_insert(ptegidx, &pvo->pvo_pte);
-			if (j >= 0) {
-PVO_PTEGIDX_SET(pvo, j);
-PMAP_PVO_CHECK(pvo);	/* sanity check */
-PVO_WHERE(pvo, SPILL_INSERT);
-pvo->pvo_pmap->pm_evictions--;
-PMAPCOUNT(ptes_spilled);
-PMAPCOUNT2(((pvo->pvo_pte.pte_hi & PTE_HID)
-? pmap_evcnt_ptes_secondary
-: pmap_evcnt_ptes_primary)[j]);
-
-/*
- * Since we keep the evicted entries at the
- * from of the PVO list, we need move this
- * (now resident) PVO after the evicted
- * entries.
- */
-next_pvo = TAILQ_NEXT(pvo, pvo_olink);
-
-/*
- * If we don't have to move (either we were the
- * last entry or the next entry was valid),
- * don't change our position.  Otherwise 
- * move ourselves to the tail of the queue.
- */
-if (next_pvo != NULL &&
-!(next_pvo->pvo_pte.pte_hi & PTE_VALID)) {
-	TAILQ_REMOVE(pvoh, pvo, pvo_olink);
-	TAILQ_INSERT_TAIL(pvoh, pvo, pvo_olink);
-}
-PMAP_UNLOCK();
-return 1;
+		if (pm == pvo->pvo_pmap && addr == PVO_VADDR(pvo)) {
+			if (isi_p) {
+if (!PVO_EXECUTABLE_P(pvo))
+	goto out;
+#if defined(PMAP_OEA) || defined(PMAP_OEA64_BRIDGE)
+int sr __diagused =
+PVO_VADDR(pvo) >> ADDR_SR_SHFT;
+KASSERT((pm->pm_sr[sr] & SR_NOEXEC) == 0);
+#endif
 			}
+			KASSERT(!PVO_PTEGIDX_ISSET(pvo));
+			/* XXXRO where c

CVS commit: src/sys/arch/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:33:30 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/powerpc/oea/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/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:32:05 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.116 src/sys/arch/powerpc/oea/pmap.c:1.117
--- src/sys/arch/powerpc/oea/pmap.c:1.116	Fri Dec  8 21:46:02 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:32:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.116 2023/12/08 21:46:02 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.116 2023/12/08 21:46:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -388,7 +388,7 @@ static void pmap_pvo_free(struct pvo_ent
 static void pmap_pvo_free_list(struct pvo_head *);
 static struct pvo_entry *pmap_pvo_find_va(pmap_t, vaddr_t, int *); 
 static volatile struct pte *pmap_pvo_to_pte(const struct pvo_entry *, int);
-static struct pvo_entry *pmap_pvo_reclaim(struct pmap *);
+static struct pvo_entry *pmap_pvo_reclaim(void);
 static void pvo_set_exec(struct pvo_entry *);
 static void pvo_clear_exec(struct pvo_entry *);
 
@@ -1507,7 +1507,7 @@ pmap_pvo_check(const struct pvo_entry *p
  */
 
 struct pvo_entry *
-pmap_pvo_reclaim(struct pmap *pm)
+pmap_pvo_reclaim(void)
 {
 	struct pvo_tqhead *pvoh;
 	struct pvo_entry *pvo;
@@ -1615,7 +1615,7 @@ pmap_pvo_enter(pmap_t pm, struct pool *p
 	++pmap_pvo_enter_depth;
 #endif
 	if (pvo == NULL) {
-		pvo = pmap_pvo_reclaim(pm);
+		pvo = pmap_pvo_reclaim();
 		if (pvo == NULL) {
 			if ((flags & PMAP_CANFAIL) == 0)
 panic("pmap_pvo_enter: failed");



CVS commit: src/sys/arch/powerpc/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:32:05 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/powerpc/oea/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/powerpc/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:31:03 UTC 2023

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

Log Message:
powerpc/oea: trap: pmap_{pte,ste}_spill() even in the interrupt context

Page table for oea is something like L2 TLB on memory; kernel and
processes share its entries, and process entries can be spilled out.

As done for MMU based on software-managed TLB, we need to restore
such entries even in the interrupt context.

Note that pmap_pte_spill() require no resouce to restore entries.
Still-not-implemented pmap_ste_spill() for OEA64 should also.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/powerpc/powerpc/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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.164 src/sys/arch/powerpc/powerpc/trap.c:1.165
--- src/sys/arch/powerpc/powerpc/trap.c:1.164	Thu Oct  5 19:41:05 2023
+++ src/sys/arch/powerpc/powerpc/trap.c	Fri Dec 15 09:31:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.164 2023/10/05 19:41:05 ad Exp $	*/
+/*	$NetBSD: trap.c,v 1.165 2023/12/15 09:31:02 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,7 +35,7 @@
 #define	__UCAS_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.164 2023/10/05 19:41:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.165 2023/12/15 09:31:02 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -136,42 +136,40 @@ trap(struct trapframe *tf)
 
 		ci->ci_ev_kdsi.ev_count++;
 
-		/*
-		 * Only query UVM if no interrupts are active.
-		 */
-		if (ci->ci_idepth < 0) {
-			if ((va >> ADDR_SR_SHFT) == pcb->pcb_kmapsr) {
-va &= ADDR_PIDX | ADDR_POFF;
-va |= pcb->pcb_umapsr << ADDR_SR_SHFT;
-map = &p->p_vmspace->vm_map;
-#ifdef PPC_OEA64
-if ((tf->tf_dsisr & DSISR_NOTFOUND) &&
-vm_map_pmap(map)->pm_ste_evictions > 0 &&
-pmap_ste_spill(vm_map_pmap(map),
-	trunc_page(va), false)) {
-	return;
-}
+		if ((va >> ADDR_SR_SHFT) == pcb->pcb_kmapsr) {
+			va &= ADDR_PIDX | ADDR_POFF;
+			va |= pcb->pcb_umapsr << ADDR_SR_SHFT;
+			map = &p->p_vmspace->vm_map;
+		}
+#if defined(DIAGNOSTIC) && !defined(PPC_OEA64)
+		else if (__predict_false((va >> ADDR_SR_SHFT) == USER_SR)) {
+			printf("trap: kernel %s DSI trap @ %#lx by %#lx"
+			" (DSISR %#x): USER_SR unset\n",
+			(tf->tf_dsisr & DSISR_STORE)
+? "write" : "read",
+			va, tf->tf_srr0, tf->tf_dsisr);
+			goto brain_damage2;
+		}
 #endif
+		else {
+			map = kernel_map;
+		}
 
-if ((tf->tf_dsisr & DSISR_NOTFOUND) &&
-vm_map_pmap(map)->pm_evictions > 0 &&
-pmap_pte_spill(vm_map_pmap(map),
-	trunc_page(va), false)) {
-	return;
-}
-#if defined(DIAGNOSTIC) && !defined(PPC_OEA64)
-			} else if ((va >> ADDR_SR_SHFT) == USER_SR) {
-printf("trap: kernel %s DSI trap @ %#lx by %#lx"
-" (DSISR %#x): USER_SR unset\n",
-(tf->tf_dsisr & DSISR_STORE)
-	? "write" : "read",
-va, tf->tf_srr0, tf->tf_dsisr);
-goto brain_damage2;
+#ifdef PPC_OEA64
+		if ((tf->tf_dsisr & DSISR_NOTFOUND) &&
+		vm_map_pmap(map)->pm_ste_evictions > 0 &&
+		pmap_ste_spill(vm_map_pmap(map), trunc_page(va), false))
+			return;
 #endif
-			} else {
-map = kernel_map;
-			}
+		if ((tf->tf_dsisr & DSISR_NOTFOUND) &&
+		vm_map_pmap(map)->pm_evictions > 0 &&
+		pmap_pte_spill(vm_map_pmap(map), trunc_page(va), false))
+			return;
 
+		/*
+		 * Only query UVM if no interrupts are active.
+		 */
+		if (ci->ci_idepth < 0) {
 			if (tf->tf_dsisr & DSISR_STORE)
 ftype = VM_PROT_WRITE;
 			else



CVS commit: src/sys/arch/powerpc/powerpc

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:31:03 UTC 2023

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

Log Message:
powerpc/oea: trap: pmap_{pte,ste}_spill() even in the interrupt context

Page table for oea is something like L2 TLB on memory; kernel and
processes share its entries, and process entries can be spilled out.

As done for MMU based on software-managed TLB, we need to restore
such entries even in the interrupt context.

Note that pmap_pte_spill() require no resouce to restore entries.
Still-not-implemented pmap_ste_spill() for OEA64 should also.

Part of PR kern/57621


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

2023-10-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 24 20:21:12 UTC 2023

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
declare batl for PPC_OEA601 only, since it is unused by OEA or OEA64_BRIDGE.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/powerpc/kgdb_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/powerpc/powerpc/kgdb_machdep.c
diff -u src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.24 src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.25
--- src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.24	Mon Jul  6 11:05:54 2020
+++ src/sys/arch/powerpc/powerpc/kgdb_machdep.c	Tue Oct 24 20:21:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.24 2020/07/06 11:05:54 rin Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.25 2023/10/24 20:21:12 andvar Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.24 2020/07/06 11:05:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.25 2023/10/24 20:21:12 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -84,7 +84,10 @@ kgdb_acc(vaddr_t va, size_t len)
 	paddr_t   pa;
 	u_int msr;
 #if defined (PPC_OEA) || defined (PPC_OEA601) || defined (PPC_OEA64_BRIDGE)
-	u_int batu, batl;
+	u_int batu;
+#ifdef PPC_OEA601
+	u_int batl;
+#endif
 #endif
 
 	/* If translation is off, everything is fair game */



CVS commit: src/sys/arch/powerpc/powerpc

2023-10-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Oct 24 20:21:12 UTC 2023

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
declare batl for PPC_OEA601 only, since it is unused by OEA or OEA64_BRIDGE.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/powerpc/kgdb_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/powerpc/oea

2023-10-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  9 13:01:58 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.

pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).

XXX
pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.114 src/sys/arch/powerpc/oea/pmap.c:1.115
--- src/sys/arch/powerpc/oea/pmap.c:1.114	Mon May  9 11:39:44 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Mon Oct  9 13:01:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.115 2023/10/09 13:01:58 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.115 2023/10/09 13:01:58 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -3448,7 +3448,7 @@ pmap_bootstrap1(paddr_t kernelstart, pad
 	pool_setlowat(&pmap_pvo_pool, 1008);
 
 	pool_init(&pmap_pool, sizeof(struct pmap),
-	sizeof(void *), 0, 0, "pmap_pl", &pmap_pool_allocator,
+	sizeof(void *), 0, 0, "pmap_pl", &pool_allocator_nointr,
 	IPL_NONE);
 
 #if defined(PMAP_NEED_MAPKERNEL)



CVS commit: src/sys/arch/powerpc/oea

2023-10-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  9 13:01:58 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.

pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).

XXX
pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/oea/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/powerpc/include/booke

2023-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:24:37 UTC 2023

Modified Files:
src/sys/arch/powerpc/include/booke: pmap.h

Log Message:
#define -> #define for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/include/booke/pmap.h

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

Modified files:

Index: src/sys/arch/powerpc/include/booke/pmap.h
diff -u src/sys/arch/powerpc/include/booke/pmap.h:1.24 src/sys/arch/powerpc/include/booke/pmap.h:1.25
--- src/sys/arch/powerpc/include/booke/pmap.h:1.24	Sun Dec 20 16:38:25 2020
+++ src/sys/arch/powerpc/include/booke/pmap.h	Thu Sep 28 06:24:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.24 2020/12/20 16:38:25 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.25 2023/09/28 06:24:37 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,8 +66,8 @@
 
 #define	NBSEG		(NBPG*NPTEPG)
 #define	SEGSHIFT	(PGSHIFT + PGSHIFT - 2)
-#define SEGOFSET	((1 << SEGSHIFT) - 1)
-#define PMAP_SEGTABSIZE	(1 << (32 - SEGSHIFT))
+#define	SEGOFSET	((1 << SEGSHIFT) - 1)
+#define	PMAP_SEGTABSIZE	(1 << (32 - SEGSHIFT))
 #define	NPTEPG		(NBPG >> 2)
 
 #define	KERNEL_PID	0



CVS commit: src/sys/arch/powerpc/include/booke

2023-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:24:37 UTC 2023

Modified Files:
src/sys/arch/powerpc/include/booke: pmap.h

Log Message:
#define -> #define for consistency


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/include/booke/pmap.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/powerpc/include

2023-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:19:19 UTC 2023

Modified Files:
src/sys/arch/powerpc/include/ibm4xx: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/include/ibm4xx/pmap.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/include/oea/pmap.h

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

Modified files:

Index: src/sys/arch/powerpc/include/ibm4xx/pmap.h
diff -u src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.21 src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.22
--- src/sys/arch/powerpc/include/ibm4xx/pmap.h:1.21	Sat Mar 14 14:05:43 2020
+++ src/sys/arch/powerpc/include/ibm4xx/pmap.h	Thu Sep 28 06:19:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.21 2020/03/14 14:05:43 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.22 2023/09/28 06:19:19 skrll Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #ifndef	_IBM4XX_PMAP_H_
 #define	_IBM4XX_PMAP_H_
 
-#ifdef _LOCORE  
+#ifdef _LOCORE
 #error use assym.h instead
 #endif
 
@@ -132,7 +132,7 @@
 #define	STIDX(v)	((v) >> (PGSHIFT + 12))
 
 
-/* 
+/*
  * Extra flags to pass to pmap_enter() -- make sure they don't conflict
  * w/PMAP_CANFAIL or PMAP_WIRED
  */

Index: src/sys/arch/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.37 src/sys/arch/powerpc/include/oea/pmap.h:1.38
--- src/sys/arch/powerpc/include/oea/pmap.h:1.37	Sat May  7 07:10:46 2022
+++ src/sys/arch/powerpc/include/oea/pmap.h	Thu Sep 28 06:19:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.37 2022/05/07 07:10:46 rin Exp $	*/
+/*	$NetBSD: pmap.h,v 1.38 2023/09/28 06:19:19 skrll Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #ifndef	_POWERPC_OEA_PMAP_H_
 #define	_POWERPC_OEA_PMAP_H_
 
-#ifdef _LOCORE  
+#ifdef _LOCORE
 #error use assym.h instead
 #endif
 



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

2023-09-27 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 28 06:19:19 UTC 2023

Modified Files:
src/sys/arch/powerpc/include/ibm4xx: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/include/ibm4xx/pmap.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/include/oea/pmap.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/powerpc/oea

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c ofwoea_machdep.c

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c ofwoea_machdep.c

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.26
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25	Wed Dec 14 13:19:04 2022
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -82,7 +82,9 @@ static void canonicalize_bootpath(void);
 void
 cpu_configure(void)
 {
+#if NWSDISPLAY > 0
 	rascons_add_rom_font();
+#endif
 	init_interrupt();
 	canonicalize_bootpath();
 

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62	Sun Dec  5 07:13:48 2021
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -270,7 +270,9 @@ ofwoea_initppc(u_int startkernel, u_int 
 
 	restore_ofmap();
 
+#if NWSDISPLAY > 0
 	rascons_finalize();
+#endif
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)((uintptr_t)endsym - (uintptr_t)startsym), startsym, endsym);



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

2023-07-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jul 26 06:36:20 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/powerpc/include/cpu.h

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

Modified files:

Index: src/sys/arch/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.123 src/sys/arch/powerpc/include/cpu.h:1.124
--- src/sys/arch/powerpc/include/cpu.h:1.123	Tue Nov 15 12:43:14 2022
+++ src/sys/arch/powerpc/include/cpu.h	Wed Jul 26 06:36:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.123 2022/11/15 12:43:14 macallan Exp $	*/
+/*	$NetBSD: cpu.h,v 1.124 2023/07/26 06:36:20 skrll Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -134,7 +134,7 @@ struct cpu_info {
 #define	ci_pmap_user_segtab	ci_pmap_segtabs[1]
 	struct pmap_tlb_info *ci_tlb_info;
 #endif /* PPC_BOOKE || ((MODULAR || _MODULE) && !_LP64) */
-	struct cache_info ci_ci;		
+	struct cache_info ci_ci;
 	void *ci_sysmon_cookie;
 	void (*ci_idlespin)(void);
 	uint32_t ci_khz;
@@ -341,7 +341,7 @@ mfrtc(uint32_t *rtcp)
 static __inline uint64_t
 rtc_nanosecs(void)
 {
-/* 
+/*
  * 601 RTC/DEC registers share clock of 7.8125 MHz, 128 ns per tick.
  * DEC has max of 25 bits, FF => 2.14748352 seconds.
  * RTCU is seconds, 32 bits.



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

2023-07-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jul 26 06:36:20 UTC 2023

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/powerpc/include/cpu.h

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



CVS commit: src/sys/arch/powerpc/booke/dev

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 10 00:08:07 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3cfi.c pq3nandfcm.c

Log Message:
powerpc: Use config_detach_children to reduce error branch bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/booke/dev/pq3cfi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/booke/dev/pq3nandfcm.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/powerpc/booke/dev/pq3cfi.c
diff -u src/sys/arch/powerpc/booke/dev/pq3cfi.c:1.7 src/sys/arch/powerpc/booke/dev/pq3cfi.c:1.8
--- src/sys/arch/powerpc/booke/dev/pq3cfi.c:1.7	Mon Jul  6 10:22:44 2020
+++ src/sys/arch/powerpc/booke/dev/pq3cfi.c	Wed May 10 00:08:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3cfi.c,v 1.7 2020/07/06 10:22:44 rin Exp $	*/
+/*	$NetBSD: pq3cfi.c,v 1.8 2023/05/10 00:08:07 riastradh Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3cfi.c,v 1.7 2020/07/06 10:22:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3cfi.c,v 1.8 2023/05/10 00:08:07 riastradh Exp $");
 
 #include "locators.h"
 
@@ -164,14 +164,15 @@ static int
 pq3cfi_detach(device_t self, int flags)
 {
 	struct pq3cfi_softc *sc = device_private(self);
-	int rv = 0;
+	int error;
 
-	pmf_device_deregister(self);
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
-	if (sc->sc_nordev != NULL)
-		rv = config_detach(sc->sc_nordev, flags);
+	pmf_device_deregister(self);
 
 	bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, sc->sc_size);
 
-	return rv;
+	return 0;
 }

Index: src/sys/arch/powerpc/booke/dev/pq3nandfcm.c
diff -u src/sys/arch/powerpc/booke/dev/pq3nandfcm.c:1.4 src/sys/arch/powerpc/booke/dev/pq3nandfcm.c:1.5
--- src/sys/arch/powerpc/booke/dev/pq3nandfcm.c:1.4	Mon Jul  6 10:22:44 2020
+++ src/sys/arch/powerpc/booke/dev/pq3nandfcm.c	Wed May 10 00:08:07 2023
@@ -30,7 +30,7 @@
 #define LBC_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3nandfcm.c,v 1.4 2020/07/06 10:22:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3nandfcm.c,v 1.5 2023/05/10 00:08:07 riastradh Exp $");
 
 #include 
 #include 
@@ -111,16 +111,17 @@ int
 pq3nandfcm_detach(device_t self, int flags)
 {
 	struct pq3nandfcm_softc * const sc = device_private(self);
-	int rv = 0;
+	int error;
 
-	pmf_device_deregister(self);
+	error = config_detach_children(self, flags);
+	if (error)
+		return error;
 
-	if (sc->sc_nanddev != NULL)
-		rv = config_detach(sc->sc_nanddev, flags);
+	pmf_device_deregister(self);
 
 	bus_space_unmap(sc->sc_window_bst, sc->sc_window_bsh,
 	sc->sc_window_size);
-	return rv;
+	return 0;
 }
 void
 pq3nandfcm_command(device_t self, uint8_t command)



CVS commit: src/sys/arch/powerpc/booke/dev

2023-05-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 10 00:08:07 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3cfi.c pq3nandfcm.c

Log Message:
powerpc: Use config_detach_children to reduce error branch bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/booke/dev/pq3cfi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/booke/dev/pq3nandfcm.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/powerpc/booke

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:48:07 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/booke/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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.39 src/sys/arch/powerpc/booke/trap.c:1.40
--- src/sys/arch/powerpc/booke/trap.c:1.39	Wed Oct 26 07:35:20 2022
+++ src/sys/arch/powerpc/booke/trap.c	Mon Apr 17 06:48:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.39 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.39 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -300,7 +300,7 @@ isi_exception(struct trapframe *tf, ksig
 		if (VM_PAGEMD_EXECPAGE_P(mdpg))
 			UVMHIST_LOG(pmapexechist,
 			"srr0=%#x pg=%p (pa %#"PRIxPADDR"): "
-			"no syncicache (already execpage)", 
+			"no syncicache (already execpage)",
 			tf->tf_srr0, (uintptr_t)pg, pa, 0);
 		else
 			UVMHIST_LOG(pmapexechist,
@@ -459,7 +459,7 @@ pgm_exception(struct trapframe *tf, ksig
 
 	UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmapexechist);
 
-	UVMHIST_LOG(pmapexechist, " srr0/1=%#x/%#x esr=%#x pte=%#x", 
+	UVMHIST_LOG(pmapexechist, " srr0/1=%#x/%#x esr=%#x pte=%#x",
 	tf->tf_srr0, tf->tf_srr1, tf->tf_esr,
 	*trap_pte_lookup(tf, trunc_page(tf->tf_srr0), PSL_IS));
 



CVS commit: src/sys/arch/powerpc/booke

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:48:07 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Trailing whitespace


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

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:46:53 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/booke/booke_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/powerpc/booke

2023-04-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr 17 06:46:53 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/booke/booke_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/powerpc/booke/booke_pmap.c
diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.37 src/sys/arch/powerpc/booke/booke_pmap.c:1.38
--- src/sys/arch/powerpc/booke/booke_pmap.c:1.37	Fri Apr  7 12:09:13 2023
+++ src/sys/arch/powerpc/booke/booke_pmap.c	Mon Apr 17 06:46:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_pmap.c,v 1.37 2023/04/07 12:09:13 skrll Exp $	*/
+/*	$NetBSD: booke_pmap.c,v 1.38 2023/04/17 06:46:53 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define __PMAP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.37 2023/04/07 12:09:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.38 2023/04/17 06:46:53 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -249,7 +249,7 @@ pmap_bootstrap(vaddr_t startkernel, vadd
 	ptp = stp->seg_tab;
 	ppg = (void *)dm_segtabs;
 	memset(ppg, 0, NBPG * dm_nsegtabs);
-	for (size_t i = 0; i < dm_nsegtabs; i++, ptp++, ppg ++) {
+	for (size_t i = 0; i < dm_nsegtabs; i++, ptp++, ppg++) {
 		*ptp = ppg;
 	}
 



CVS commit: src/sys/arch/powerpc/powerpc

2023-04-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 13 06:39:23 UTC 2023

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

Log Message:
powerpc/ddb: Fix one more load to use db_read_bytes.

Fix some typos in crash(8) comments too.

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


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/powerpc/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/powerpc/powerpc/db_trace.c
diff -u src/sys/arch/powerpc/powerpc/db_trace.c:1.62 src/sys/arch/powerpc/powerpc/db_trace.c:1.63
--- src/sys/arch/powerpc/powerpc/db_trace.c:1.62	Wed Apr 12 19:47:41 2023
+++ src/sys/arch/powerpc/powerpc/db_trace.c	Thu Apr 13 06:39:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.62 2023/04/12 19:47:41 riastradh Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.63 2023/04/13 06:39:23 riastradh Exp $	*/
 /*	$OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $	*/
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.62 2023/04/12 19:47:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.63 2023/04/13 06:39:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -188,7 +188,7 @@ db_stack_trace_print(db_expr_t addr, boo
 }
 			}
 			(*pr)("lid %d ", R(&l->l_lid));
-			pcb = lwp_getpcb(l);
+			pcb = R(&l->l_addr); /* lwp_getpcb */
 			frame = (db_addr_t)R(&pcb->pcb_sp);
 			(*pr)("at %p\n", frame);
 		} else
@@ -215,7 +215,7 @@ db_stack_trace_print(db_expr_t addr, boo
 
 		(*pr)("0x%08lx: ", frame);
 		if (lr + 4 == (db_addr_t) trapexit ||
-#if !defined(_KERNEL) || defined(PPC_BOOKE) /* XXX crash(*) */
+#if !defined(_KERNEL) || defined(PPC_BOOKE) /* XXX crash(8) */
 		lr + 4 == (db_addr_t) intrcall ||
 #endif
 		lr + 4 == (db_addr_t) sctrapexit) {
@@ -230,14 +230,14 @@ db_stack_trace_print(db_expr_t addr, boo
 			}
 			switch (R(&tf->tf_exc)) {
 			case EXC_DSI:
-#ifdef PPC_OEA			/* XXX crash(*) */
+#ifdef PPC_OEA			/* XXX crash(8) */
 (*pr)("DSI %s trap @ %#x by ",
 (R(&tf->tf_dsisr) & DSISR_STORE
 	? "write"
 	: "read"),
 R(&tf->tf_dar));
 #endif
-#ifdef PPC_IBM4XX		/* XXX crash(*) */
+#ifdef PPC_IBM4XX		/* XXX crash(8) */
 trapstr = "DSI";
 dsi:
 (*pr)("%s %s trap @ %#x by ", trapstr,



CVS commit: src/sys/arch/powerpc/powerpc

2023-04-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 13 06:39:23 UTC 2023

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

Log Message:
powerpc/ddb: Fix one more load to use db_read_bytes.

Fix some typos in crash(8) comments too.

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


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

2023-04-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 12 19:47:41 UTC 2023

Modified Files:
src/sys/arch/powerpc/powerpc: db_disasm.c db_trace.c

Log Message:
powerpc/ddb: Use db_read_bytes, not direct pointer access.

Mark some powerpc-variant ifdefs with XXX crash(8), not sure yet what
to do about them.

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


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/powerpc/db_disasm.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/powerpc/powerpc/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/powerpc/powerpc

2023-04-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 12 19:47:41 UTC 2023

Modified Files:
src/sys/arch/powerpc/powerpc: db_disasm.c db_trace.c

Log Message:
powerpc/ddb: Use db_read_bytes, not direct pointer access.

Mark some powerpc-variant ifdefs with XXX crash(8), not sure yet what
to do about them.

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


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/powerpc/db_disasm.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/powerpc/powerpc/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/powerpc/powerpc/db_disasm.c
diff -u src/sys/arch/powerpc/powerpc/db_disasm.c:1.30 src/sys/arch/powerpc/powerpc/db_disasm.c:1.31
--- src/sys/arch/powerpc/powerpc/db_disasm.c:1.30	Wed Apr 12 17:53:32 2023
+++ src/sys/arch/powerpc/powerpc/db_disasm.c	Wed Apr 12 19:47:41 2023
@@ -1,8 +1,8 @@
-/*	$NetBSD: db_disasm.c,v 1.30 2023/04/12 17:53:32 riastradh Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.31 2023/04/12 19:47:41 riastradh Exp $	*/
 /*	$OpenBSD: db_disasm.c,v 1.2 1996/12/28 06:21:48 rahnds Exp $	*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.30 2023/04/12 17:53:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.31 2023/04/12 19:47:41 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -1059,7 +1059,8 @@ db_disasm(db_addr_t loc, bool extended)
 {
 	int class;
 	instr_t opcode;
-	opcode = *(instr_t *)(loc);
+
+	db_read_bytes(loc, sizeof(opcode), (char *)&opcode);
 	class = opcode >> 26;
 	(opcodes_base[class])(opcode, loc);
 

Index: src/sys/arch/powerpc/powerpc/db_trace.c
diff -u src/sys/arch/powerpc/powerpc/db_trace.c:1.61 src/sys/arch/powerpc/powerpc/db_trace.c:1.62
--- src/sys/arch/powerpc/powerpc/db_trace.c:1.61	Wed Apr 12 17:53:32 2023
+++ src/sys/arch/powerpc/powerpc/db_trace.c	Wed Apr 12 19:47:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.61 2023/04/12 17:53:32 riastradh Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.62 2023/04/12 19:47:41 riastradh Exp $	*/
 /*	$OpenBSD: db_trace.c,v 1.3 1997/03/21 02:10:48 niklas Exp $	*/
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.61 2023/04/12 17:53:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.62 2023/04/12 19:47:41 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
@@ -69,6 +69,13 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 #include 
 
+#define	R(P)  \
+({	  \
+	__typeof__(*(P)) __db_tmp;	  \
+	db_read_bytes((db_addr_t)(P), sizeof(*(P)), (char *)&__db_tmp);	  \
+	__db_tmp;			  \
+})
+
 const struct db_variable db_regs[] = {
 	{ "r0",  (long *)&ddb_regs.r[0],  FCN_NULL, NULL },
 	{ "r1",  (long *)&ddb_regs.r[1],  FCN_NULL, NULL },
@@ -109,7 +116,7 @@ const struct db_variable db_regs[] = {
 	{ "cr",  (long *)&ddb_regs.cr,FCN_NULL, NULL },
 	{ "xer", (long *)&ddb_regs.xer,   FCN_NULL, NULL },
 	{ "mq",  (long *)&ddb_regs.mq,FCN_NULL, NULL },
-#ifdef PPC_IBM4XX
+#ifdef PPC_IBM4XX		/* XXX crash(8) */
 	{ "dear", (long *)&ddb_regs.dear, FCN_NULL, NULL },
 	{ "esr", (long *)&ddb_regs.esr,   FCN_NULL, NULL },
 	{ "pid", (long *)&ddb_regs.pid,   FCN_NULL, NULL },
@@ -165,8 +172,8 @@ db_stack_trace_print(db_expr_t addr, boo
 
 			if (lwpaddr) {
 l = (struct lwp *)addr;
-p = l->l_proc;
-(*pr)("trace: pid %d ", p->p_pid);
+p = R(&l->l_proc);
+(*pr)("trace: pid %d ", R(&p->p_pid));
 			} else {
 (*pr)("trace: pid %d ", (int)addr);
 p = db_proc_find((pid_t)addr);
@@ -174,15 +181,15 @@ db_stack_trace_print(db_expr_t addr, boo
 	(*pr)("not found\n");
 	return;
 }
-l = LIST_FIRST(&p->p_lwps);
+l = R(&LIST_FIRST(&p->p_lwps));
 if (l == NULL) {
 	(*pr)("trace: no LWP?\n");
 	return;
 }
 			}
-			(*pr)("lid %d ", l->l_lid);
+			(*pr)("lid %d ", R(&l->l_lid));
 			pcb = lwp_getpcb(l);
-			frame = (db_addr_t)pcb->pcb_sp;
+			frame = (db_addr_t)R(&pcb->pcb_sp);
 			(*pr)("at %p\n", frame);
 		} else
 			frame = (db_addr_t)addr;
@@ -192,7 +199,7 @@ db_stack_trace_print(db_expr_t addr, boo
 	for (;;) {
 		if (frame < PAGE_SIZE)
 			break;
-		frame = *(db_addr_t *)frame;
+		frame = R((db_addr_t *)frame);
 	next_frame:
 		args = (db_addr_t *)(frame + 8);
 		if (frame < PAGE_SIZE)
@@ -200,7 +207,7 @@ db_stack_trace_print(db_expr_t addr, boo
 	if (count-- == 0)
 			break;
 
-		lr = *(db_addr_t *)(frame + 4) - 4;
+		lr = R((db_addr_t *)(frame + 4)) - 4;
 		if ((lr & 3) || (lr < 0x100)) {
 			(*pr)("saved LR(0x%x) is invalid.", lr);
 			break;
@@ -208,36 +215,42 @@ db_stack_trace_print(db_expr_t addr, boo
 
 		(*pr)("0x%08lx: ", frame);
 		if (lr + 4 == (db_addr_t) trapexit ||
-#if !defined(_KERNEL) || defined(PPC_BOOKE)
+#if !defined(_KERNEL) || defined(PPC_BOOKE) /* XXX crash(*) */
 		lr + 4 == (db_addr_t) intrcall ||
 #endif
 		lr + 4 == (db_addr_t

CVS commit: src/sys/arch/powerpc/booke

2023-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  7 12:09:13 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
Spaces to TAB


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/booke/booke_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/powerpc/booke/booke_pmap.c
diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.36 src/sys/arch/powerpc/booke/booke_pmap.c:1.37
--- src/sys/arch/powerpc/booke/booke_pmap.c:1.36	Wed Oct 26 07:35:20 2022
+++ src/sys/arch/powerpc/booke/booke_pmap.c	Fri Apr  7 12:09:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: booke_pmap.c,v 1.36 2022/10/26 07:35:20 skrll Exp $	*/
+/*	$NetBSD: booke_pmap.c,v 1.37 2023/04/07 12:09:13 skrll Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define __PMAP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.36 2022/10/26 07:35:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.37 2023/04/07 12:09:13 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -406,7 +406,7 @@ bool
 pmap_md_tlb_check_entry(void *ctx, vaddr_t va, tlb_asid_t asid, pt_entry_t pte)
 {
 	pmap_t pm = ctx;
-struct pmap_asid_info * const pai = PMAP_PAI(pm, curcpu()->ci_tlb_info);
+	struct pmap_asid_info * const pai = PMAP_PAI(pm, curcpu()->ci_tlb_info);
 
 	if (asid != pai->pai_asid)
 		return true;



CVS commit: src/sys/arch/powerpc/booke

2023-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Apr  7 12:09:13 UTC 2023

Modified Files:
src/sys/arch/powerpc/booke: booke_pmap.c

Log Message:
Spaces to TAB


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/booke/booke_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/powerpc/powerpc

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

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
powerpc: 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.67 -r1.68 src/sys/arch/powerpc/powerpc/locore_subr.S

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

Modified files:

Index: src/sys/arch/powerpc/powerpc/locore_subr.S
diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.67 src/sys/arch/powerpc/powerpc/locore_subr.S:1.68
--- src/sys/arch/powerpc/powerpc/locore_subr.S:1.67	Thu Feb 23 14:56:11 2023
+++ src/sys/arch/powerpc/powerpc/locore_subr.S	Wed Mar  1 08:18:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.67 2023/02/23 14:56:11 riastradh Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.68 2023/03/01 08:18:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -418,9 +418,13 @@ _ENTRY(softint_fast_dispatch)
 	sync	/* XXX eieio */		/* for mutex_enter; see cpu_switchto */
 #endif
 	stptr	%r3, CI_CURLWP(%r7)
-#ifdef MULTIPROCESSOR
-	sync/* for mutex_enter; see cpu_switchto */
-#endif
+	/*
+	 * 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.
+	 */
 	mr	%r13, %r3
 #ifdef PPC_BOOKE
 	mtsprg2	%r3



CVS commit: src/sys/arch/powerpc/powerpc

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

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
powerpc: 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.67 -r1.68 src/sys/arch/powerpc/powerpc/locore_subr.S

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



CVS commit: src/sys/arch/powerpc/powerpc

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

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
powerpc: 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.66 -r1.67 src/sys/arch/powerpc/powerpc/locore_subr.S

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

Modified files:

Index: src/sys/arch/powerpc/powerpc/locore_subr.S
diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.66 src/sys/arch/powerpc/powerpc/locore_subr.S:1.67
--- src/sys/arch/powerpc/powerpc/locore_subr.S:1.66	Wed Mar 16 09:48:23 2022
+++ src/sys/arch/powerpc/powerpc/locore_subr.S	Thu Feb 23 14:56:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.66 2022/03/16 09:48:23 andvar Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.67 2023/02/23 14:56:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -215,7 +215,32 @@ ENTRY(cpu_switchto)
 	 */
 
 	GET_CPUINFO(%r7)
+
+	/*
+	 * 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.
+	 */
+#ifdef MULTIPROCESSOR
+	sync	/* store-before-store XXX use eieio if available -- cheaper */
+#endif
 	stptr	%r31,CI_CURLWP(%r7)
+#ifdef MULTIPROCESSOR
+	sync	/* store-before-load */
+#endif
 	mr	%r13,%r31
 #ifdef PPC_BOOKE
 	mtsprg2	%r31			/* save curlwp in sprg2 */
@@ -389,7 +414,13 @@ _ENTRY(softint_fast_dispatch)
 	 * to a kernel thread
 	 */
 
+#ifdef MULTIPROCESSOR
+	sync	/* XXX eieio */		/* for mutex_enter; see cpu_switchto */
+#endif
 	stptr	%r3, CI_CURLWP(%r7)
+#ifdef MULTIPROCESSOR
+	sync/* for mutex_enter; see cpu_switchto */
+#endif
 	mr	%r13, %r3
 #ifdef PPC_BOOKE
 	mtsprg2	%r3
@@ -423,7 +454,13 @@ _ENTRY(softint_fast_dispatch)
 #endif
 
 	GET_CPUINFO(%r7)
+#ifdef MULTIPROCESSOR
+	sync	/* XXX eieio */		/* for mutex_enter; see cpu_switchto */
+#endif
 	stptr	%r30, CI_CURLWP(%r7)
+#ifdef MULTIPROCESSOR
+	sync/* for mutex_enter; see cpu_switchto */
+#endif
 	mr	%r13, %r30
 #ifdef PPC_BOOKE
 	mtsprg2	%r30



CVS commit: src/sys/arch/powerpc/powerpc

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

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
powerpc: 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.66 -r1.67 src/sys/arch/powerpc/powerpc/locore_subr.S

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



CVS commit: src/sys/arch/powerpc/oea

2022-12-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 14 13:19:05 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
if we have the ROM font, make it available to wsdisplay
needs testing on non-macppc


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofw_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/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.24 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.24	Wed Nov 27 21:07:32 2019
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Wed Dec 14 13:19:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -61,6 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_autoconf
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 
 #include 
@@ -77,6 +82,7 @@ static void canonicalize_bootpath(void);
 void
 cpu_configure(void)
 {
+	rascons_add_rom_font();
 	init_interrupt();
 	canonicalize_bootpath();
 



CVS commit: src/sys/arch/powerpc/oea

2022-12-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 14 13:19:05 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: ofw_autoconf.c

Log Message:
if we have the ROM font, make it available to wsdisplay
needs testing on non-macppc


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofw_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/powerpc/powerpc

2022-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 12 13:26:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Move the last remaining kernel printf to ofprint.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.35 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.36
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.35	Sat Dec 10 13:15:00 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Mon Dec 12 13:26:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.35 2022/12/10 13:15:00 martin Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.36 2022/12/12 13:26:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.35 2022/12/10 13:15:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.36 2022/12/12 13:26:46 martin Exp $");
 
 #include 
 #include 
@@ -352,7 +352,7 @@ ofw_bootstrap_get_memory(void)
 
 error:
 #if defined (MAMBO)
-	printf("no memory, assuming 512MB\n");
+	ofprint("no memory, assuming 512MB\n");
 
 	OFmem[0].start = 0x0;
 	OFmem[0].size = 0x2000;



CVS commit: src/sys/arch/powerpc/powerpc

2022-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 12 13:26:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Move the last remaining kernel printf to ofprint.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc

2022-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 10 13:15:00 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Move some output to DEBUG-only state


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

2022-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 10 13:15:00 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Move some output to DEBUG-only state


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.34 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.35
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.34	Sat Dec 10 13:06:41 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Sat Dec 10 13:15:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.35 2022/12/10 13:15:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.35 2022/12/10 13:15:00 martin Exp $");
 
 #include 
 #include 
@@ -254,7 +254,7 @@ ofw_bootstrap_get_memory(void)
 #endif
 		OFmem[memcnt].start = addr;
 		OFmem[memcnt].size = size;
-		ofprint("mem region %d start=%"PRIx64" size=%"PRIx64"\n",
+		DPRINTF("mem region %d start=%"PRIx64" size=%"PRIx64"\n",
 		memcnt, addr, size);
 		memcnt++;
 	}
@@ -317,7 +317,7 @@ ofw_bootstrap_get_memory(void)
 #endif
 		OFavail[cnt].start = addr;
 		OFavail[cnt].size = size;
-		ofprint("avail region %d start=%#"PRIx64" size=%#"PRIx64"\n",
+		DPRINTF("avail region %d start=%#"PRIx64" size=%#"PRIx64"\n",
 		cnt, addr, size);
 		cnt++;
 	}
@@ -423,7 +423,7 @@ ofw_bootstrap_get_translations(void)
 			continue;
 		}
 
-		ofprint("translation %d virt=%#"PRIx32
+		DPRINTF("translation %d virt=%#"PRIx32
 		" phys=%#"PRIx64" size=%#"PRIx32" mode=%#"PRIx32"\n",
 		idx, virt, phys, size, mode);
 		
@@ -488,7 +488,7 @@ ofw_bootstrap(void)
 			ofw_real_mode = false;
 		}
 	}
-	ofprint("OpenFirmware running in %s-mode\n",
+	DPRINTF("OpenFirmware running in %s-mode\n",
 	ofw_real_mode ? "real" : "virtual");
 
 	/* Get #address-cells and #size-cells to fetching memory info. */



CVS commit: src/sys/arch/powerpc/powerpc

2022-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 10 13:06:41 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Convert more kernel printfs that might happen very early (before kernel
console is usable) to ofprint.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.33 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.34
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.33	Thu Nov 24 00:13:54 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Sat Dec 10 13:06:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.34 2022/12/10 13:06:41 martin Exp $");
 
 #include 
 #include 
@@ -88,6 +88,11 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_machdep.
 #define DPRINTF while(0) printf
 #endif
 
+#define	ofpanic(FORMAT, ...)	do {\
+		ofprint(FORMAT __VA_OPT__(,) __VA_ARGS__);	\
+		panic(FORMAT __VA_OPT__(,) __VA_ARGS__);	\
+	} while (0)
+
 int	ofw_root;
 int	ofw_chosen;
 
@@ -185,7 +190,7 @@ ofw_bootstrap_console(void)
 
 	return;
  nocons:
-	panic("No /chosen could be found!\n");
+	ofpanic("No /chosen could be found!\n");
 	console_node = -1;
 }
 
@@ -356,7 +361,7 @@ error:
 	OFavail[0].size = 0x2000 - 0x3000;
 
 #else
-	panic("no memory?");
+	ofpanic("no memory?");
 #endif
 	return;
 }
@@ -375,19 +380,19 @@ ofw_bootstrap_get_translations(void)
 
 	if (OF_getprop(ofw_chosen, "mmu", &mmu_ihandle,
 		   sizeof(mmu_ihandle)) <= 0) {
-		aprint_normal("No /chosen/mmu\n");
+		ofprint("No /chosen/mmu\n");
 		return;
 	}
 	mmu_phandle = OF_instance_to_package(mmu_ihandle);
 
 	proplen = OF_getproplen(mmu_phandle, "translations");
 	if (proplen <= 0) {
-		aprint_normal("No translations in /chosen/mmu\n");
+		ofprint("No translations in /chosen/mmu\n");
 		return;
 	}
 
 	if (proplen > sizeof(regs)) {
-		panic("/chosen/mmu translations too large");
+		ofpanic("/chosen/mmu translations too large");
 	}
 
 	proplen = OF_getprop(mmu_phandle, "translations", regs, sizeof(regs));
@@ -406,11 +411,11 @@ ofw_bootstrap_get_translations(void)
 			phys = (phys << 32) | *rp++;
 			break;
 		default:
-			panic("unexpected #address-cells");
+			ofpanic("unexpected #address-cells");
 		}
 		mode = *rp++;
 		if (rp > ®s[nregs]) {
-			panic("unexpected OFW translations format");
+			ofpanic("unexpected OFW translations format");
 		}
 
 		/* Wouldn't expect this, but... */
@@ -418,16 +423,16 @@ ofw_bootstrap_get_translations(void)
 			continue;
 		}
 
-		aprint_normal("translation %d virt=%#"PRIx32
+		ofprint("translation %d virt=%#"PRIx32
 		" phys=%#"PRIx64" size=%#"PRIx32" mode=%#"PRIx32"\n",
 		idx, virt, phys, size, mode);
 		
 		if (sizeof(paddr_t) < 8 && phys >= 0x1ULL) {
-			panic("translation phys out of range");
+			ofpanic("translation phys out of range");
 		}
 
 		if (idx == OFW_MAX_TRANSLATIONS) {
-			panic("too many OFW translations");
+			ofpanic("too many OFW translations");
 		}
 
 		ofw_translations[idx].virt = virt;



CVS commit: src/sys/arch/powerpc/powerpc

2022-12-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Dec 10 13:06:41 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
Convert more kernel printfs that might happen very early (before kernel
console is usable) to ofprint.


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

2022-12-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec  6 01:14:37 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c

Log Message:
convert more seriously early output to ofprint
regular console output needs more of the kernel in working order now, and this
stuff happ0ens long before the banner


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/oea/ofw_consinit.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/powerpc/oea/ofw_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.26 src/sys/arch/powerpc/oea/ofw_consinit.c:1.27
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.26	Thu Nov 24 00:07:49 2022
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Tue Dec  6 01:14:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.27 2022/12/06 01:14:36 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.27 2022/12/06 01:14:36 macallan Exp $");
 
 #include "adb.h"
 #include "adbkbd.h"
@@ -191,7 +191,7 @@ ofwoea_cnprobe_keyboard(void)
 	memset(name, 0, sizeof(name));
 	OF_getprop(node, "name", name, sizeof(name));
 	if (strcmp(name, "keyboard") != 0) {
-		printf("WARNING: stdin is not a keyboard: %s\n", name);
+		ofprint("WARNING: stdin is not a keyboard: %s\n", name);
 		return;
 	}
 
@@ -199,21 +199,21 @@ ofwoea_cnprobe_keyboard(void)
 	OF_getprop(OF_parent(node), "name", name, sizeof(name));
 #if NAKBD > 0
 	if (strcmp(name, "adb") == 0) {
-		printf("console keyboard type: ADB\n");
+		ofprint("console keyboard type: ADB\n");
 		selected_keyboard = akbd_cnattach;
 		goto kbd_found;
 	}
 #endif
 #if NADBKBD > 0
 	if (strcmp(name, "adb") == 0) {
-		printf("console keyboard type: ADB\n");
+		ofprint("console keyboard type: ADB\n");
 		selected_keyboard = adbkbd_cnattach;
 		goto kbd_found;
 	}
 #endif
 #if NPCKBC > 0
 	if (strcmp(name, "isa") == 0) {
-		printf("console keyboard type: PC Keyboard\n");
+		ofprint("console keyboard type: PC Keyboard\n");
 		selected_keyboard = ofwoea_pckbd_cnattach;
 		goto kbd_found;
 	}
@@ -271,7 +271,7 @@ ofwoea_cnprobe_keyboard(void)
 
 		adb_node = OF_finddevice("/pci/mac-io/via-pmu/adb");
 		if (adb_node > 0) {
-			printf("ADB support found\n");
+			ofprint("ADB support found\n");
 #if NAKBD > 0
 			selected_keyboard = akbd_cnattach;
 #endif
@@ -280,7 +280,7 @@ ofwoea_cnprobe_keyboard(void)
 #endif
 		} else {
 			/* must be USB */
-			printf("No ADB support present, assuming USB "
+			ofprint("No ADB support present, assuming USB "
 			   "keyboard\n");
 #if NUKBD > 0
 			selected_keyboard = ukbd_cnattach;
@@ -300,8 +300,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`usb-kbd-ihandles", kstdin, 0, 1, &ukbds) >= 0 &&
 	ukbds != NULL && ukbds->ihandle != 0 &&
 	OF_instance_to_package(ukbds->ihandle) != -1) {
-		printf("usb-kbd-ihandles matches\n");
-		printf("console keyboard type: USB\n");
+		ofprint("usb-kbd-ihandles matches\n");
+		ofprint("console keyboard type: USB\n");
 		selected_keyboard = ukbd_cnattach;
 		goto kbd_found;
 	}
@@ -309,8 +309,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`usb-kbd-ihandle", kstdin, 0, 1, &ukbd) >= 0 &&
 	ukbd != 0 &&
 	OF_instance_to_package(ukbd) != -1) {
-		printf("usb-kbd-ihandle matches\n");
-		printf("console keyboard type: USB\n");
+		ofprint("usb-kbd-ihandle matches\n");
+		ofprint("console keyboard type: USB\n");
 		kstdin = ukbd;
 		selected_keyboard = ukbd_cnattach;
 		goto kbd_found;
@@ -321,8 +321,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`adb-kbd-ihandle", kstdin, 0, 1, &akbd) >= 0 &&
 	akbd != 0 &&
 	OF_instance_to_package(akbd) != -1) {
-		printf("adb-kbd-ihandle matches\n");
-		printf("console keyboard type: ADB\n");
+		ofprint("adb-kbd-ihandle matches\n");
+		ofprint("console keyboard type: ADB\n");
 		kstdin = akbd;
 #if NAKBD > 0
 		selected_keyboard = akbd_cnattach;
@@ -339,8 +339,8 @@ ofwoea_cnprobe_keyboard(void)
 	 * XXX Old firmware does not have `usb-kbd-ihandles method.  Assume
 	 * XXX USB keyboard anyway.
 	 */
-	printf("defaulting to USB...");
-	printf("console keyboard type: USB\n");
+	ofprint("defaulting to USB...");
+	ofprint("console keyboard type: USB\n");
 	selected_keyboard = ukbd_cnattach;
 	goto kbd_found;
 #endif
@@ -348,7 +348,7 @@ ofwoea_cnprobe_keyboard(void)
 	/*
 	 * No keyboard is found.  Just return.
 	 */
-	printf("no console keyboard\n");
+	ofprint("no console keyboard\n");
 	return;
 
 kbd_found:



CVS commit: src/sys/arch/powerpc/oea

2022-12-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec  6 01:14:37 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: ofw_consinit.c

Log Message:
convert more seriously early output to ofprint
regular console output needs more of the kernel in working order now, and this
stuff happ0ens long before the banner


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/oea/ofw_consinit.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/powerpc/powerpc

2022-12-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  5 16:03:50 UTC 2022

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

Log Message:
Do not bother to set PSL_SE in l_md.md_flags - it is not checked anywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/powerpc/powerpc/process_machdep.c

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

Modified files:

Index: src/sys/arch/powerpc/powerpc/process_machdep.c
diff -u src/sys/arch/powerpc/powerpc/process_machdep.c:1.42 src/sys/arch/powerpc/powerpc/process_machdep.c:1.43
--- src/sys/arch/powerpc/powerpc/process_machdep.c:1.42	Sat Mar  6 08:08:19 2021
+++ src/sys/arch/powerpc/powerpc/process_machdep.c	Mon Dec  5 16:03:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.42 2021/03/06 08:08:19 rin Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.43 2022/12/05 16:03:50 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.42 2021/03/06 08:08:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43 2022/12/05 16:03:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -138,10 +138,8 @@ process_sstep(struct lwp *l, int sstep)
 	
 	if (sstep) {
 		tf->tf_srr1 |= PSL_SE;
-		l->l_md.md_flags |= PSL_SE;
 	} else {
 		tf->tf_srr1 &= ~PSL_SE;
-		l->l_md.md_flags &= ~PSL_SE;
 	}
 	return 0;
 #else



CVS commit: src/sys/arch/powerpc/powerpc

2022-12-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  5 16:03:50 UTC 2022

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

Log Message:
Do not bother to set PSL_SE in l_md.md_flags - it is not checked anywhere.


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

2022-12-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  5 16:01:03 UTC 2022

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

Log Message:
Do not copy l_md to the new lwp in cpu_lwp_fork - as discussed on
tech-kern we do not want the child to inherit any of the flags in there.


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

2022-12-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  5 16:01:03 UTC 2022

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

Log Message:
Do not copy l_md to the new lwp in cpu_lwp_fork - as discussed on
tech-kern we do not want the child to inherit any of the flags in there.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/powerpc/powerpc/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/powerpc/powerpc/vm_machdep.c
diff -u src/sys/arch/powerpc/powerpc/vm_machdep.c:1.104 src/sys/arch/powerpc/powerpc/vm_machdep.c:1.105
--- src/sys/arch/powerpc/powerpc/vm_machdep.c:1.104	Mon Jul  6 10:52:12 2020
+++ src/sys/arch/powerpc/powerpc/vm_machdep.c	Mon Dec  5 16:01:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.104 2020/07/06 10:52:12 rin Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.105 2022/12/05 16:01:03 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.104 2020/07/06 10:52:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.105 2022/12/05 16:01:03 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -95,8 +95,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	struct pcb * const pcb1 = lwp_getpcb(l1);
 	struct pcb * const pcb2 = lwp_getpcb(l2);
 
-	/* Copy MD part of lwp and set up user trapframe pointer.  */
-	l2->l_md = l1->l_md;
+	/* Set up user trapframe pointer. */
 	l2->l_md.md_utf = trapframe(l2);
 
 	/* Copy PCB. */



CVS commit: src/sys/arch/powerpc/powerpc

2022-11-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 24 00:13:55 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
in ofprint() only append \r if the last character is \n


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

2022-11-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 24 00:13:55 UTC 2022

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
in ofprint() only append \r if the last character is \n


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.32 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.33
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.32	Thu Nov 24 00:07:48 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Thu Nov 24 00:13:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.33 2022/11/24 00:13:54 macallan Exp $");
 
 #include 
 #include 
@@ -115,7 +115,8 @@ void ofprint(const char *blah, ...)
 	va_end(va);
 	OF_write(console_instance, buf, len);
 	/* Apple OF only does a newline on \n, so add an explicit CR */
-	OF_write(console_instance, "\r", 1);
+	if ((len > 0) && (buf[len - 1] == '\n'))
+		OF_write(console_instance, "\r", 1);
 }
 
 static int



CVS commit: src/sys/arch/powerpc

2022-11-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 24 00:07:49 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: ofw_machdep.h
src/sys/arch/powerpc/oea: ofw_consinit.c
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
move ofprint() to powerpc/ofw_machdep.c and make it official
now that console output uses locks it needs more of the kernel to function, so
for now use direct OF calls for earliest debug output


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/include/ofw_machdep.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_consinit.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/powerpc/ofw_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/powerpc

2022-11-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Nov 24 00:07:49 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: ofw_machdep.h
src/sys/arch/powerpc/oea: ofw_consinit.c
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
move ofprint() to powerpc/ofw_machdep.c and make it official
now that console output uses locks it needs more of the kernel to function, so
for now use direct OF calls for earliest debug output


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/include/ofw_machdep.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_consinit.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/include/ofw_machdep.h
diff -u src/sys/arch/powerpc/include/ofw_machdep.h:1.5 src/sys/arch/powerpc/include/ofw_machdep.h:1.6
--- src/sys/arch/powerpc/include/ofw_machdep.h:1.5	Wed Nov  2 20:38:22 2022
+++ src/sys/arch/powerpc/include/ofw_machdep.h	Thu Nov 24 00:07:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_machdep.h,v 1.5 2022/11/02 20:38:22 andvar Exp $ */
+/* $NetBSD: ofw_machdep.h,v 1.6 2022/11/24 00:07:49 macallan Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -60,6 +60,8 @@ extern int ofw_chosen;		/* cached handle
 extern struct OF_translation ofw_translations[OFW_MAX_TRANSLATIONS];
 
 void	ofw_bootstrap(void);
+void 	ofprint(const char *, ...);
+
 #endif /* _KERNEL */
 
 #endif /* _POWERPC_OFW_MACHDEP_H_ */

Index: src/sys/arch/powerpc/oea/ofw_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.25 src/sys/arch/powerpc/oea/ofw_consinit.c:1.26
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.25	Sun Feb 13 12:24:24 2022
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Thu Nov 24 00:07:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.25 2022/02/13 12:24:24 martin Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.25 2022/02/13 12:24:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $");
 
 #include "adb.h"
 #include "adbkbd.h"
@@ -89,7 +89,7 @@ extern struct consdev consdev_zs;
 #include 
 #endif
 
-extern int console_node, console_instance;
+extern int console_node;
 
 int ofkbd_ihandle = -1;
 
@@ -98,19 +98,6 @@ static void ofwoea_cnprobe_keyboard(void
 /*#define OFDEBUG*/
 
 #ifdef OFDEBUG
-void ofprint(const char *, ...);
-
-void ofprint(const char *blah, ...)
-{
-	va_list va;
-	char buf[256];
-	int len;
-
-	va_start(va, blah);
-	len = vsnprintf(buf, sizeof(buf), blah, va);
-	va_end(va);
-	OF_write(console_instance, buf, len);
-}
 
 #define OFPRINTF ofprint
 #else

Index: src/sys/arch/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.31 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.32
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.31	Wed Oct 12 20:50:43 2022
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Thu Nov 24 00:07:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.31 2022/10/12 20:50:43 andvar Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.31 2022/10/12 20:50:43 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.32 2022/11/24 00:07:48 macallan Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_machdep.
 #include 
 
 #ifdef DEBUG
-#define DPRINTF aprint_error
+#define DPRINTF ofprint
 #else
 #define DPRINTF while(0) printf
 #endif
@@ -104,6 +104,20 @@ bool	ofwbootcons_suppress;
 int	ofw_address_cells;
 int	ofw_size_cells;
 
+void ofprint(const char *blah, ...)
+{
+	va_list va;
+	char buf[256];
+	int len;
+
+	va_start(va, blah);
+	len = vsnprintf(buf, sizeof(buf), blah, va);
+	va_end(va);
+	OF_write(console_instance, buf, len);
+	/* Apple OF only does a newline on \n, so add an explicit CR */
+	OF_write(console_instance, "\r", 1);
+}
+
 static int
 ofwbootcons_cngetc(dev_t dev)
 {
@@ -227,14 +241,14 @@ ofw_bootstrap_get_memory(void)
 #ifndef _LP64
 		if (addr > 0x || size > 0x ||
 			(addr + size) > 0x) {
-			aprint_error("Base addr of %llx or size of %llx too"
+			ofprint("Base addr of %llx or size of %llx too"
 			" large for 32 bit OS. Skipping.", addr, size);
 			continue;
 		}
 #endif
 		OFmem[memcnt].start = addr;
 		OFmem[memcnt].size = size;
-		aprint_normal("mem region %d start=%"PRIx64" size=%"PRIx64"\n",
+		ofprint("mem region %d start=%"PRIx64" size=%"PRIx64"\n",
 		memcnt, addr, size);
 		memcnt++;
 	}
@@ -290,14 +304,14 @@ ofw_bootstrap_get_memory(void)
 #ifndef _LP64
 		if (addr > 0x

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

2022-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov 15 12:43:14 UTC 2022

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

Log Message:
remove workaround for old clang - it's not needed anymore and caused problems
elsewhere


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/powerpc/include/cpu.h

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

Modified files:

Index: src/sys/arch/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.122 src/sys/arch/powerpc/include/cpu.h:1.123
--- src/sys/arch/powerpc/include/cpu.h:1.122	Mon May 30 14:48:08 2022
+++ src/sys/arch/powerpc/include/cpu.h	Tue Nov 15 12:43:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.122 2022/05/30 14:48:08 rin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.123 2022/11/15 12:43:14 macallan Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -240,12 +240,8 @@ curcpu(void)
 	return ci;
 }
 
-#ifdef __clang__
-#define	curlwp			(curcpu()->ci_curlwp)
-#else
 register struct lwp *powerpc_curlwp __asm("r13");
 #define	curlwp			powerpc_curlwp
-#endif
 #define curpcb			(curcpu()->ci_curpcb)
 #define curpm			(curcpu()->ci_curpm)
 



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

2022-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov 15 12:43:14 UTC 2022

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

Log Message:
remove workaround for old clang - it's not needed anymore and caused problems
elsewhere


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/powerpc/include/cpu.h

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



CVS commit: src/sys/arch/powerpc/ibm4xx

2022-10-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Oct  5 09:03:06 UTC 2022

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
ppc4xx_tlb_enter: One more style sync. No binary changes.

Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively,
as done for other functions in pmap.c.


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

2022-10-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Oct  5 09:03:06 UTC 2022

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
ppc4xx_tlb_enter: One more style sync. No binary changes.

Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively,
as done for other functions in pmap.c.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/ibm4xx/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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.108 src/sys/arch/powerpc/ibm4xx/pmap.c:1.109
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.108	Wed Oct  5 08:47:52 2022
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Wed Oct  5 09:03:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1347,7 +1347,7 @@ ppc4xx_tlb_find_victim(void)
 void
 ppc4xx_tlb_enter(int ctx, vaddr_t va, u_int pte)
 {
-	u_long th, tl, i;
+	u_long hi, lo, i;
 	paddr_t pa;
 	int msr, pid, sz;
 
@@ -1355,9 +1355,9 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_
 
 	sz = (pte & TTE_SZ_MASK) >> TTE_SZ_SHIFT;
 	pa = (pte & TTE_RPN_MASK(sz));
-	th = (va & TLB_EPN_MASK) | (sz << TLB_SIZE_SHFT) | TLB_VALID;
-	tl = (pte & ~TLB_RPN_MASK) | pa;
-	tl |= ppc4xx_tlbflags(va, pa);
+	hi = (va & TLB_EPN_MASK) | (sz << TLB_SIZE_SHFT) | TLB_VALID;
+	lo = (pte & ~TLB_RPN_MASK) | pa;
+	lo |= ppc4xx_tlbflags(va, pa);
 
 	i = ppc4xx_tlb_find_victim();
 
@@ -1377,14 +1377,14 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_
 		MFPID(%[pid])			/* Save old PID */
 		MTPID(%[ctx])			/* Load translation ctx */
 		"isync;"
-		"tlbwe	%[tl],%[i],1;"		/* Set TLB */
-		"tlbwe	%[th],%[i],0;"
+		"tlbwe	%[lo],%[i],1;"		/* Set TLB */
+		"tlbwe	%[hi],%[i],0;"
 		"isync;"
 		MTPID(%[pid])			/* Restore PID */
 		"mtmsr	%[msr];"		/* and MSR */
 		"isync;"
 		: [msr] "=&r" (msr), [pid] "=&r" (pid)
-		: [ctx] "r" (ctx), [i] "r" (i), [tl] "r" (tl), [th] "r" (th));
+		: [ctx] "r" (ctx), [i] "r" (i), [lo] "r" (lo), [hi] "r" (hi));
 }
 
 void



  1   2   3   4   5   >