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

2021-06-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jun 23 15:11:40 UTC 2021

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

Log Message:
Remove an unused #define.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/mips/include/vmparam.h

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

Modified files:

Index: src/sys/arch/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.65 src/sys/arch/mips/include/vmparam.h:1.66
--- src/sys/arch/mips/include/vmparam.h:1.65	Fri Feb 26 02:18:29 2021
+++ src/sys/arch/mips/include/vmparam.h	Wed Jun 23 15:11:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.65 2021/02/26 02:18:29 simonb Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.66 2021/06/23 15:11:40 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -198,7 +198,6 @@
 
 /* VM_PHYSSEG_MAX defined by platform-dependent code. */
 #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
-#define	VM_PHYSSEG_NOADD	/* can add RAM after vm_mem_init */
 
 #ifndef VM_NFREELIST
 #define	VM_NFREELIST		16	/* 16 distinct memory segments */



CVS commit: src/sys/arch/mips/mips

2021-06-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Jun  2 00:00:39 UTC 2021

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
s/leading spaces/tabs/


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.301 src/sys/arch/mips/mips/mips_machdep.c:1.302
--- src/sys/arch/mips/mips/mips_machdep.c:1.301	Tue Mar 23 13:22:40 2021
+++ src/sys/arch/mips/mips/mips_machdep.c	Wed Jun  2 00:00:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.301 2021/03/23 13:22:40 simonb Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.302 2021/06/02 00:00:39 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.301 2021/03/23 13:22:40 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.302 2021/06/02 00:00:39 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -1785,9 +1785,9 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   CTL_MACHDEP, CPU_ROOT_DEVICE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
-   CTLTYPE_INT, "llsc", NULL,
-   NULL, MIPS_HAS_LLSC, NULL, 0,
-   CTL_MACHDEP, CPU_LLSC, CTL_EOL);
+		   CTLTYPE_INT, "llsc", NULL,
+		   NULL, MIPS_HAS_LLSC, NULL, 0,
+		   CTL_MACHDEP, CPU_LLSC, CTL_EOL);
 #ifdef MIPS3_LOONGSON2
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
@@ -1797,8 +1797,8 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 #endif
 	sysctl_createv(clog, 0, NULL, NULL,
 		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
-   CTLTYPE_INT, "fpu_present", NULL,
-   NULL,
+		   CTLTYPE_INT, "fpu_present", NULL,
+		   NULL,
 #ifdef NOFPU
 		   0,
 #else



CVS commit: src/sys/arch/mips

2021-05-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat May 29 12:35:27 UTC 2021

Modified Files:
src/sys/arch/mips/include: cpuregs.h
src/sys/arch/mips/mips: fp.S locore.S mips_emul.c mips_fpu.c
mips_fputrap.c

Log Message:
Update the FPU register names and bit definitions to something somewhat
modern (MIPS32/MIPS64) and convert to __BIT/__BITS.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/mips/fp.S
cvs rdiff -u -r1.227 -r1.228 src/sys/arch/mips/mips/locore.S
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/mips/mips_emul.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/mips/mips_fpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/mips_fputrap.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/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.110 src/sys/arch/mips/include/cpuregs.h:1.111
--- src/sys/arch/mips/include/cpuregs.h:1.110	Wed Mar 17 11:05:37 2021
+++ src/sys/arch/mips/include/cpuregs.h	Sat May 29 12:35:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.110 2021/03/17 11:05:37 simonb Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.111 2021/05/29 12:35:27 simonb Exp $	*/
 
 /*
  * Copyright (c) 2009 Miodrag Vallat.
@@ -704,40 +704,41 @@
 /*
  * The floating point version and status registers.
  */
-#define	MIPS_FPU_ID	$0
-#define	MIPS_FPU_CSR	$31
+#define	MIPS_FIR	$0	/* FP Implementation and Revision Register */
+#define	MIPS_FCSR	$31	/* FP Control/Status Register */
 
 /*
  * The floating point coprocessor status register bits.
  */
-#define	MIPS_FPU_ROUNDING_BITS		0x0003
-#define	MIPS_FPU_ROUND_RN		0x
-#define	MIPS_FPU_ROUND_RZ		0x0001
-#define	MIPS_FPU_ROUND_RP		0x0002
-#define	MIPS_FPU_ROUND_RM		0x0003
-#define	MIPS_FPU_STICKY_BITS		0x007c
-#define	MIPS_FPU_STICKY_INEXACT		0x0004
-#define	MIPS_FPU_STICKY_UNDERFLOW	0x0008
-#define	MIPS_FPU_STICKY_OVERFLOW	0x0010
-#define	MIPS_FPU_STICKY_DIV0		0x0020
-#define	MIPS_FPU_STICKY_INVALID		0x0040
-#define	MIPS_FPU_ENABLE_BITS		0x0f80
-#define	MIPS_FPU_ENABLE_INEXACT		0x0080
-#define	MIPS_FPU_ENABLE_UNDERFLOW	0x0100
-#define	MIPS_FPU_ENABLE_OVERFLOW	0x0200
-#define	MIPS_FPU_ENABLE_DIV0		0x0400
-#define	MIPS_FPU_ENABLE_INVALID		0x0800
-#define	MIPS_FPU_EXCEPTION_BITS		0x0003f000
-#define	MIPS_FPU_EXCEPTION_INEXACT	0x1000
-#define	MIPS_FPU_EXCEPTION_UNDERFLOW	0x2000
-#define	MIPS_FPU_EXCEPTION_OVERFLOW	0x4000
-#define	MIPS_FPU_EXCEPTION_DIV0		0x8000
-#define	MIPS_FPU_EXCEPTION_INVALID	0x0001
-#define	MIPS_FPU_EXCEPTION_UNIMPL	0x0002
-#define	MIPS_FPU_COND_BIT		0x0080
-#define	MIPS_FPU_FLUSH_BIT		0x0100	/* r4k,	 MBZ on r3k */
-#define	MIPS1_FPC_MBZ_BITS		0xff7c
-#define	MIPS3_FPC_MBZ_BITS		0xfe7c
+#define	MIPS_FCSR_RM		__BITS(1,0)
+#define	  MIPS_FCSR_RM_RN	  0	/* round to nearest */
+#define	  MIPS_FCSR_RM_RZ	  1	/* round toward zerO */
+#define	  MIPS_FCSR_RM_RP	  2	/* round towards +infinity */
+#define	  MIPS_FCSR_RM_RM	  3	/* round towards -infinity */
+#define	MIPS_FCSR_FLAGS		__BITS(6,2)
+#define	  MIPS_FCSR_FLAGS_I	  __BIT(2)	/* inexact */
+#define	  MIPS_FCSR_FLAGS_U	  __BIT(3)	/* underflow */
+#define	  MIPS_FCSR_FLAGS_O	  __BIT(4)	/* overflow */
+#define	  MIPS_FCSR_FLAGS_Z	  __BIT(5)	/* divide by zero */
+#define	  MIPS_FCSR_FLAGS_V	  __BIT(6)	/* invalid operation */
+#define	MIPS_FCSR_ENABLES	__BITS(11,7)
+#define	  MIPS_FCSR_ENABLES_I	  __BIT(7)	/* inexact */
+#define	  MIPS_FCSR_ENABLES_U	  __BIT(8)	/* underflow */
+#define	  MIPS_FCSR_ENABLES_O	  __BIT(9)	/* overflow */
+#define	  MIPS_FCSR_ENABLES_Z	  __BIT(10)	/* divide by zero */
+#define	  MIPS_FCSR_ENABLES_V	  __BIT(11)	/* invalid operation */
+#define	MIPS_FCSR_CAUSE		__BITS(17,12)
+#define	  MIPS_FCSR_CAUSE_I	  __BIT(12)	/* inexact */
+#define	  MIPS_FCSR_CAUSE_U	  __BIT(13)	/* underflow */
+#define	  MIPS_FCSR_CAUSE_O	  __BIT(14)	/* overflow */
+#define	  MIPS_FCSR_CAUSE_Z	  __BIT(15)	/* divide by zero */
+#define	  MIPS_FCSR_CAUSE_V	  __BIT(16)	/* invalid operation */
+#define	  MIPS_FCSR_CAUSE_E	  __BIT(17)	/* unimplemented operation */
+#define	MIPS_FCSR_NAN_2008	__BIT(18)
+#define	MIPS_FCSR_ABS_2008	__BIT(19)
+#define	MIPS_FCSR_FCC0		__BIT(23)
+#define	MIPS_FCSR_FCC		(MIPS_FPU_COND_BIT | __BITS(31,25))
+#define	MIPS_FCSR_FS		__BIT(24)	/* r4k+ */
 
 
 /*

Index: src/sys/arch/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.57 src/sys/arch/mips/mips/fp.S:1.58
--- src/sys/arch/mips/mips/fp.S:1.57	Mon May 24 07:27:39 2021
+++ src/sys/arch/mips/mips/fp.S	Sat May 29 12:35:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.57 2021/05/24 07:27:39 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.58 2021/05/29 12:35:27 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -143,10 +143,10 @@ NESTED(mips_emul_fp, CALLFRAME_SIZ, ra)
 	PTR_L	a3, fmt_tbl(

CVS commit: src/sys/arch/mips

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri May 28 00:18:27 UTC 2021

Modified Files:
src/sys/arch/mips: README.models

Log Message:
Update R6000 description.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/README.models

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/mips/README.models
diff -u src/sys/arch/mips/README.models:1.6 src/sys/arch/mips/README.models:1.7
--- src/sys/arch/mips/README.models:1.6	Sat Aug 15 05:41:57 2020
+++ src/sys/arch/mips/README.models	Fri May 28 00:18:27 2021
@@ -1,4 +1,4 @@
-# $NetBSD: README.models,v 1.6 2020/08/15 05:41:57 mrg Exp $
+# $NetBSD: README.models,v 1.7 2021/05/28 00:18:27 simonb Exp $
 
 MIPS models and architecture levels
 ---
@@ -51,7 +51,7 @@ which have model numbers with fewer zero
 	R4400		MIPS-III (64-bit)	[idt96 A-197]
 	R4600		MIPS-III (64-bit)	[idt96 A-197]
 	R5000		MIPS-IV (64-bit)	[idt96 1-5]
-	R6000		MIPS-II ??
+	R6000		MIPS-II (32-bit) with 64-bit FPU regs
 	R8000		MIPS-IV (64-bit)	[idt96 1-5]
 	R1		MIPS-IV (64-bit)	[idt96 1-5]
 	R1x000		MIPS-IV (64-bit)



CVS commit: src/sys/arch/mips

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 15:00:02 UTC 2021

Modified Files:
src/sys/arch/mips/include: locore.h
src/sys/arch/mips/mips: mips_emul.c

Log Message:
Rename the unhelpfully named mips_emul_lwc0() and mips_emul_swc0() to
mips_emul_ll() and mips_emul_sc(); make these static to mips_emul.c.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/mips/include/locore.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/mips/mips_emul.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.118 src/sys/arch/mips/include/locore.h:1.119
--- src/sys/arch/mips/include/locore.h:1.118	Wed May 12 03:53:37 2021
+++ src/sys/arch/mips/include/locore.h	Thu May 27 15:00:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.118 2021/05/12 03:53:37 simonb Exp $ */
+/* $NetBSD: locore.h,v 1.119 2021/05/27 15:00:02 simonb Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -347,8 +347,6 @@ void	mips_emul_inst(uint32_t, uint32_t, 
 void	mips_emul_fp(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_branchdelayslot(uint32_t, struct trapframe *, uint32_t);
 
-void	mips_emul_lwc0(uint32_t, struct trapframe *, uint32_t);
-void	mips_emul_swc0(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_special(uint32_t, struct trapframe *, uint32_t);
 void	mips_emul_special3(uint32_t, struct trapframe *, uint32_t);
 

Index: src/sys/arch/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.28 src/sys/arch/mips/mips/mips_emul.c:1.29
--- src/sys/arch/mips/mips/mips_emul.c:1.28	Thu May 27 13:32:54 2021
+++ src/sys/arch/mips/mips/mips_emul.c	Thu May 27 15:00:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.29 2021/05/27 15:00:02 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.29 2021/05/27 15:00:02 simonb Exp $");
 
 #include 
 #include 
@@ -47,6 +47,9 @@ static inline void	send_sigsegv(intptr_t
 			uint32_t);
 static inline void	update_pc(struct trapframe *, uint32_t);
 
+static void	mips_emul_ll(uint32_t, struct trapframe *, uint32_t);
+static void	mips_emul_sc(uint32_t, struct trapframe *, uint32_t);
+
 /*
  * MIPS2 LL instruction emulation state
  */
@@ -198,11 +201,11 @@ mips_emul_inst(uint32_t status, uint32_t
 		inst = mips_ufetch32((uint32_t *)opc);
 
 	switch (((InstFmt)inst).FRType.op) {
-	case OP_LWC0:
-		mips_emul_lwc0(inst, tf, cause);
+	case OP_LL:
+		mips_emul_ll(inst, tf, cause);
 		break;
-	case OP_SWC0:
-		mips_emul_swc0(inst, tf, cause);
+	case OP_SC:
+		mips_emul_sc(inst, tf, cause);
 		break;
 	case OP_SPECIAL:
 		mips_emul_special(inst, tf, cause);
@@ -289,7 +292,7 @@ update_pc(struct trapframe *tf, uint32_t
  * MIPS2 LL instruction
  */
 void
-mips_emul_lwc0(uint32_t inst, struct trapframe *tf, uint32_t cause)
+mips_emul_ll(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
 	intptr_t	vaddr;
 	int16_t		offset;
@@ -322,7 +325,7 @@ mips_emul_lwc0(uint32_t inst, struct tra
  * MIPS2 SC instruction
  */
 void
-mips_emul_swc0(uint32_t inst, struct trapframe *tf, uint32_t cause)
+mips_emul_sc(uint32_t inst, struct trapframe *tf, uint32_t cause)
 {
 	intptr_t	vaddr;
 	uint32_t	value;



CVS commit: src/sys/arch/mips/mips

2021-05-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 13:32:54 UTC 2021

Modified Files:
src/sys/arch/mips/mips: mips_emul.c

Log Message:
Print the CP0 status register too in the debug trap code.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/mips/mips/mips_emul.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/mips/mips/mips_emul.c
diff -u src/sys/arch/mips/mips/mips_emul.c:1.27 src/sys/arch/mips/mips/mips_emul.c:1.28
--- src/sys/arch/mips/mips/mips_emul.c:1.27	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/mips_emul.c	Thu May 27 13:32:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_emul.c,v 1.27 2019/04/06 03:06:26 thorpej Exp $ */
+/*	$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $ */
 
 /*
  * Copyright (c) 1999 Shuichiro URATA.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.27 2019/04/06 03:06:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_emul.c,v 1.28 2021/05/27 13:32:54 simonb Exp $");
 
 #include 
 #include 
@@ -240,7 +240,10 @@ mips_emul_inst(uint32_t status, uint32_t
 #endif
 	default:
 #ifdef DEBUG
-		printf("pid %d (%s): trap: bad insn @ %#"PRIxVADDR" cause %#x insn %#x code %d\n", curproc->p_pid, curproc->p_comm, opc, cause, inst, code);
+		printf("pid %d (%s): trap: bad insn @ %#"PRIxVADDR
+		" cause %#x status %#"PRIxREGISTER" insn %#x code %d\n",
+		curproc->p_pid, curproc->p_comm, opc,
+		cause, tf->tf_regs[_R_SR], inst, code);
 #endif
 		tf->tf_regs[_R_CAUSE] = cause;
 		tf->tf_regs[_R_BADVADDR] = opc;



CVS commit: src/sys/arch/mips/cavium/dev

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 03:23:29 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Move the send queue checking to a new function, and also call this
in the rx interrupt path.  Measureable improvement on a NFS "create
small files" test.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/dev/if_cnmac.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/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25	Thu May 27 01:43:32 2021
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 03:23:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -122,6 +122,7 @@ static inline void cnmac_send_queue_flus
 static inline void cnmac_send_queue_flush_fetch(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush_sync(struct cnmac_softc *);
+static void cnmac_send_queue_check_and_flush(struct cnmac_softc *);
 static inline int cnmac_send_queue_is_full(struct cnmac_softc *);
 static inline void cnmac_send_queue_add(struct cnmac_softc *, struct mbuf *,
 uint64_t *);
@@ -604,6 +605,23 @@ cnmac_send_queue_is_full(struct cnmac_so
 	return 0;
 }
 
+static void
+cnmac_send_queue_check_and_flush(struct cnmac_softc *sc)
+{
+	int s;
+
+	/* XXX XXX XXX */
+	s = splnet();
+	if (sc->sc_soft_req_cnt > 0) {
+		cnmac_send_queue_flush_prefetch(sc);
+		cnmac_send_queue_flush_fetch(sc);
+		cnmac_send_queue_flush(sc);
+		cnmac_send_queue_flush_sync(sc);
+	}
+	splx(s);
+	/* XXX XXX XXX */
+}
+
 /*
  * (Ab)use m_nextpkt and m_paddr to maintain mbuf chain and pointer to gather
  * buffer.  Other mbuf members may be used by m_freem(), so don't touch them!
@@ -1299,6 +1317,8 @@ cnmac_intr(void *arg)
 		}
 
 		(void)cnmac_recv(sc, work);
+
+		cnmac_send_queue_check_and_flush(sc);
 	}
 
 	_POW_WR8(sc->sc_pow, POW_WQ_INT_OFFSET, wqmask);
@@ -1326,21 +1346,11 @@ cnmac_tick_free(void *arg)
 {
 	struct cnmac_softc *sc = arg;
 	int timo;
-	int s;
 
-	s = splnet();
-	/* XXX XXX XXX */
-	if (sc->sc_soft_req_cnt > 0) {
-		cnmac_send_queue_flush_prefetch(sc);
-		cnmac_send_queue_flush_fetch(sc);
-		cnmac_send_queue_flush(sc);
-		cnmac_send_queue_flush_sync(sc);
-	}
-	/* XXX XXX XXX */
+	cnmac_send_queue_check_and_flush(sc);
 
 	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(&sc->sc_tick_free_ch, timo);
-	splx(s);
 }
 
 /*



CVS commit: src/sys/arch/mips/cavium/dev

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 01:43:32 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Schedule the send cleanup function for next tick in cnmac_start().  In
the send cleanup function, schedule for the next tick instead of waiting
for HZ ticks if there are still send requests outstanding.  Greatly
increases NFS throughput, perhaps other types of network traffic.

Use callout_setfunc() after callout_init() instead of callout_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/cavium/dev/if_cnmac.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/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24	Tue Jun 23 05:17:13 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 01:43:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -278,7 +278,10 @@ cnmac_attach(device_t parent, device_t s
 	octgmx_stats_init(sc->sc_gmx_port);
 
 	callout_init(&sc->sc_tick_misc_ch, 0);
+	callout_setfunc(&sc->sc_tick_misc_ch, cnmac_tick_misc, sc);
+
 	callout_init(&sc->sc_tick_free_ch, 0);
+	callout_setfunc(&sc->sc_tick_free_ch, cnmac_tick_free, sc);
 
 	const int dv_unit = device_unit(self);
 	octfau_op_init(&sc->sc_fau_done,
@@ -998,6 +1001,7 @@ cnmac_start(struct ifnet *ifp)
 			if (wdc > 0)
 octpko_op_doorbell_write(sc->sc_port,
 sc->sc_port, wdc);
+			callout_schedule(&sc->sc_tick_free_ch, 1);
 			return;
 		}
 		/* XXX XXX XXX */
@@ -1031,6 +1035,7 @@ cnmac_start(struct ifnet *ifp)
 
 last:
 	cnmac_send_queue_flush_fetch(sc);
+	callout_schedule(&sc->sc_tick_free_ch, 1);
 }
 
 static void
@@ -1073,8 +1078,8 @@ cnmac_init(struct ifnet *ifp)
 
 	octgmx_set_filter(sc->sc_gmx_port);
 
-	callout_reset(&sc->sc_tick_misc_ch, hz, cnmac_tick_misc, sc);
-	callout_reset(&sc->sc_tick_free_ch, hz, cnmac_tick_free, sc);
+	callout_schedule(&sc->sc_tick_misc_ch, hz);
+	callout_schedule(&sc->sc_tick_free_ch, hz);
 
 	SET(ifp->if_flags, IFF_RUNNING);
 	CLR(ifp->if_flags, IFF_OACTIVE);
@@ -1097,7 +1102,6 @@ cnmac_stop(struct ifnet *ifp, int disabl
 	/* Mark the interface as down and cancel the watchdog timer. */
 	CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
 	ifp->if_timer = 0;
-
 }
 
 /*  misc */
@@ -1334,13 +1338,8 @@ cnmac_tick_free(void *arg)
 	}
 	/* XXX XXX XXX */
 
-	/* XXX XXX XXX */
-	/* ??? */
-	timo = hz - (100 * sc->sc_ext_callback_cnt);
-	if (timo < 10)
-		 timo = 10;
+	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(&sc->sc_tick_free_ch, timo);
-	/* XXX XXX XXX */
 	splx(s);
 }
 



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

2021-05-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 25 09:19:28 UTC 2021

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

Log Message:
Alignment nit.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/mips/conf/files.mips

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/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.83 src/sys/arch/mips/conf/files.mips:1.84
--- src/sys/arch/mips/conf/files.mips:1.83	Tue Mar 23 13:22:40 2021
+++ src/sys/arch/mips/conf/files.mips	Tue May 25 09:19:28 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mips,v 1.83 2021/03/23 13:22:40 simonb Exp $
+#	$NetBSD: files.mips,v 1.84 2021/05/25 09:19:28 simonb Exp $
 #
 
 defflag	opt_cputype.h		NOFPU FPEMUL
@@ -75,7 +75,7 @@ file	arch/mips/mips/cache_ls2.c		mips3_l
 file	arch/mips/mips/cache_r4k.c		mips3 | mips4
 file	arch/mips/mips/cache_r5k.c		mips3 | mips4
 file	arch/mips/mips/cache_r5k_subr.S		mips3 | mips4
-file	arch/mips/mips/cache_r10k.c	(mips3|mips4) & enable_mips4_cache_r10k
+file	arch/mips/mips/cache_r10k.c		(mips3|mips4) & enable_mips4_cache_r10k
 file	arch/mips/mips/cache_octeon.c		mips64_octeon
 file	arch/mips/mips/cache_mipsNN.c		mips32|mips32r2|mips64|mips64r2
 file	arch/mips/mips/cache_r4k_pcache16.S	mips3|mips4|mips32|mips32r2|mips64|mips64r2



CVS commit: src/sys/arch/mips/mips

2021-05-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon May 24 07:27:39 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Whitespace alignment nit.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.56 src/sys/arch/mips/mips/fp.S:1.57
--- src/sys/arch/mips/mips/fp.S:1.56	Thu May 13 06:15:29 2021
+++ src/sys/arch/mips/mips/fp.S	Mon May 24 07:27:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.56 2021/05/13 06:15:29 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.57 2021/05/24 07:27:39 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -773,7 +773,7 @@ branchc1:
 
 	.rdata
 branchc1_tbl:
-	PTR_WORD bcfalse		# br 0
+	PTR_WORD bcfalse	# br 0
 	PTR_WORD bctrue		# br 1
 	PTR_WORD bcfalse_l	# br 2
 	PTR_WORD bctrue_l	# br 3



CVS commit: src/sys/arch/mips

2021-05-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun May 23 23:24:45 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_param.h netbsd32_machdep.h
src/sys/arch/mips/mips: cpu_exec.c netbsd32_machdep.c

Log Message:
fix "uname -p" on mips n32.

this has been returning "mipsn64eb" on my edgerouter4 with the
32 bit uname binary.

introduce o32, n32, and n64 versions of MACHINE_ARCH, and use
them appropriately in PROC_MACHINE_ARCH32().  now o32, n32 and
n64 "uname -p" all return different values.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/include/netbsd32_machdep.h
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/mips/cpu_exec.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/mips/netbsd32_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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.49 src/sys/arch/mips/include/mips_param.h:1.50
--- src/sys/arch/mips/include/mips_param.h:1.49	Sat May  8 13:09:58 2021
+++ src/sys/arch/mips/include/mips_param.h	Sun May 23 23:24:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.49 2021/05/08 13:09:58 skrll Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.50 2021/05/23 23:24:45 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,19 +38,28 @@
 # error neither __MIPSEL__ nor __MIPSEB__ are defined.
 #endif
 
+#define	___MACHINE32_OARCH		mips##_MACHINE_SUFFIX
+#define	__MACHINE32_OARCH		"mips" MACHINE_SUFFIX
+#define	___MACHINE32_NARCH		mips64##_MACHINE_SUFFIX
+#define	__MACHINE32_NARCH		"mips64" MACHINE_SUFFIX
+#define	___MACHINE64_NARCH		mipsn64##_MACHINE_SUFFIX
+#define	__MACHINE64_NARCH		"mipsn64" MACHINE_SUFFIX
+
 #if defined(__mips_n32) || defined(__mips_n64)
 # if defined(__mips_n32)
-#  define	_MACHINE_ARCH	mips64##_MACHINE_SUFFIX
-#  define	MACHINE_ARCH	"mips64" MACHINE_SUFFIX
+#  define	_MACHINE_ARCH		___MACHINE32_NARCH
+#  define	MACHINE_ARCH		__MACHINE32_NARCH
 # else /* __mips_n64 */
-#  define	_MACHINE_ARCH	mipsn64##_MACHINE_SUFFIX
-#  define	MACHINE_ARCH	"mipsn64" MACHINE_SUFFIX
+#  define	_MACHINE_ARCH		___MACHINE64_NARCH
+#  define	MACHINE_ARCH		__MACHINE64_NARCH
+#  define	_MACHINE32_NARCH	___MACHINE32_NARCH
+#  define	MACHINE32_NARCH		__MACHINE32_NARCH
 # endif
-# define	_MACHINE32_ARCH	mips##_MACHINE_SUFFIX
-# define	MACHINE32_ARCH	"mips" MACHINE_SUFFIX
+# define	_MACHINE32_OARCH	___MACHINE32_OARCH
+# define	MACHINE32_OARCH		__MACHINE32_OARCH
 #else /* o32 */
-# define	_MACHINE_ARCH	mips##_MACHINE_SUFFIX
-# define	MACHINE_ARCH	"mips" MACHINE_SUFFIX
+# define	_MACHINE_ARCH		___MACHINE32_OARCH
+# define	MACHINE_ARCH		__MACHINE32_OARCH
 #endif
 
 /*

Index: src/sys/arch/mips/include/netbsd32_machdep.h
diff -u src/sys/arch/mips/include/netbsd32_machdep.h:1.6 src/sys/arch/mips/include/netbsd32_machdep.h:1.7
--- src/sys/arch/mips/include/netbsd32_machdep.h:1.6	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/netbsd32_machdep.h	Sun May 23 23:24:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.h,v 1.6 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: netbsd32_machdep.h,v 1.7 2021/05/23 23:24:45 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -44,10 +44,17 @@ typedef struct { NETBSD32_POINTER_TYPE i
 
 typedef netbsd32_pointer_t			netbsd32_sigcontextp_t;
 
-/* Support varying ABI names for netbsd32 */
-extern const char machine_arch32[];
+/* Support varying ABI names for netbsd32/ABI */
+extern const char machine_archo32[];
+#if defined(__mips_n64)
+extern const char machine_archn32[];
 #define	PROC_MACHINE_ARCH32(P)	((P)->p_md.md_abi == _MIPS_BSD_API_O32) ? \
-	__UNCONST(machine_arch32) : machine_arch
+	__UNCONST(machine_archo32) : ((P)->p_md.md_abi == _MIPS_BSD_API_N32) ? \
+	__UNCONST(machine_archn32) : machine_arch
+#else
+#define	PROC_MACHINE_ARCH32(P)	((P)->p_md.md_abi == _MIPS_BSD_API_O32) ? \
+	__UNCONST(machine_archo32) : machine_arch
+#endif
 
 /*
  * The sigcode is ABI neutral.

Index: src/sys/arch/mips/mips/cpu_exec.c
diff -u src/sys/arch/mips/mips/cpu_exec.c:1.67 src/sys/arch/mips/mips/cpu_exec.c:1.68
--- src/sys/arch/mips/mips/cpu_exec.c:1.67	Sun Aug 19 10:33:49 2018
+++ src/sys/arch/mips/mips/cpu_exec.c	Sun May 23 23:24:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_exec.c,v 1.67 2018/08/19 10:33:49 mrg Exp $	*/
+/*	$NetBSD: cpu_exec.c,v 1.68 2021/05/23 23:24:45 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.67 2018/08/19 10:33:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.68 2021/05/23 23:24:45 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_ultrix.h"
@@ -201,7 +201,7 @@ coredump_elf32_setup(struct lwp *l, void
 		eh->e_flags |= EF_MIPS_ABI2;
 		break;
 	case _MIPS_BSD_API_O32:
-		eh->e_flags |=EF_MIPS_ABI_O32; 
+		eh->e_flags |= EF_

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

2021-05-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 18 06:38:24 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
Remove argument names from function declaration prototypes.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.37 src/sys/arch/mips/include/db_machdep.h:1.38
--- src/sys/arch/mips/include/db_machdep.h:1.37	Mon Mar 29 03:09:41 2021
+++ src/sys/arch/mips/include/db_machdep.h	Tue May 18 06:38:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.37 2021/03/29 03:09:41 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.38 2021/05/18 06:38:24 skrll Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -91,7 +91,7 @@ db_addr_t	db_disasm_insn(int insn, db_ad
  * Entrypoints to DDB for kernel, keyboard drivers, init hook
  */
 void 	kdb_kbd_trap(db_regs_t *);
-int 	kdb_trap(int type, struct reg *);
+int 	kdb_trap(int, struct reg *);
 
 static inline void
 db_set_ddb_regs(int type, struct reg *regs)
@@ -103,7 +103,7 @@ db_set_ddb_regs(int type, struct reg *re
  * Helper functions for fetching 32-bit and 64-bit kernel memory.
  */
 bool		kdbpeek(vaddr_t, unsigned *);
-mips_reg_t	kdbrpeek(vaddr_t addr, size_t n);
+mips_reg_t	kdbrpeek(vaddr_t, size_t);
 
 
 /*



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

2021-05-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat May 15 02:37:07 UTC 2021

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

Log Message:
The MIPS O64 ABI uses full 64-bit FP regs.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.75 src/sys/arch/mips/include/types.h:1.76
--- src/sys/arch/mips/include/types.h:1.75	Mon Mar 29 02:07:43 2021
+++ src/sys/arch/mips/include/types.h	Sat May 15 02:37:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.75 2021/03/29 02:07:43 simonb Exp $	*/
+/*	$NetBSD: types.h,v 1.76 2021/05/15 02:37:07 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -49,13 +49,10 @@ typedef __uint64_t		__fpregister64_t;
 typedef	unsigned int		__cpu_simple_lock_nv_t;
 #if defined(__mips_o32)
 typedef __register32_t		__register_t;
+typedef __fpregister32_t	__fpregister_t;
 #else
 typedef __register64_t		__register_t;
-#endif
-#if defined(__mips_o64) || defined(__mips_o32)
-typedef	__fpregister32_t	__fpregister_t;
-#else
-typedef	__fpregister64_t	__fpregister_t;
+typedef __fpregister64_t	__fpregister_t;
 #endif
 
 /*



CVS commit: src/sys/arch/mips/cavium/dev

2021-05-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri May 14 13:36:28 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_gmx.c

Log Message:
Fix a missed bitmask to __SHIFTOUT conversion in rev 1.12.

Fixes negotiation problems on non-gige switches.  Problem discovered and
tested by riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/cavium/dev/octeon_gmx.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/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.19
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18	Wed May  5 06:47:29 2021
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Fri May 14 13:36:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $");
 
 #include 
 #include 
@@ -834,7 +834,7 @@ octgmx_rgmii_speed_speed(struct octgmx_p
 
 	prt_cfg = _GMX_PORT_RD8(sc, GMX0_PRT0_CFG);
 
-	switch (sc->sc_link & RXN_RX_INBND_SPEED) {
+	switch (__SHIFTOUT(sc->sc_link, RXN_RX_INBND_SPEED)) {
 	case RXN_RX_INBND_SPEED_2_5:
 		/* 10Mbps */
 		/*



CVS commit: src/sys/arch/mips/mips

2021-05-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 06:15:29 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Update ISA for some "L" variant instructions after checking the R4400 UM.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.55 src/sys/arch/mips/mips/fp.S:1.56
--- src/sys/arch/mips/mips/fp.S:1.55	Thu May 13 04:55:12 2021
+++ src/sys/arch/mips/mips/fp.S	Thu May 13 06:15:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.55 2021/05/13 04:55:12 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.56 2021/05/13 06:15:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -350,7 +350,7 @@ func_single_tbl:
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_s	# func 36 44	CVT.W.S
-	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS64r2
+	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS3/MIPS64
 	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S	MIPS32r2
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
@@ -387,10 +387,10 @@ func_double_tbl:
 	PTR_WORD abs_d		# func  5 05	ABS.D
 	PTR_WORD mov_d		# func  6 06	MOV.D
 	PTR_WORD neg_d		# func  7 07	NEG.D 
-	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS64r2
-	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS64r2
-	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS64r2
-	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS64r2
+	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS3/MIPS64
+	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS3/MIPS64
+	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS3/MIPS64
+	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS3/MIPS64
 	PTR_WORD round_w_d	# func 12 14	ROUND.W.D
 	PTR_WORD trunc_w_d	# func 13 15	TRUNC.W.D
 	PTR_WORD ceil_w_d	# func 14 16	CEIL.W.D
@@ -416,7 +416,7 @@ func_double_tbl:
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_d	# func 36 44	CVT.W.D
-	PTR_WORD cvt_l_d	# func 37 45	CVT.L.D		MIPS64r2
+	PTR_WORD cvt_l_d	# func 37 45	CVT.L.D		MIPS3/MIPS64
 	PTR_WORD ill		# func 38 46
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
@@ -543,8 +543,8 @@ func_long_fixed_tbl:
 	PTR_WORD ill		# func 29 35
 	PTR_WORD ill		# func 30 36
 	PTR_WORD ill		# func 31 37
-	PTR_WORD cvt_s_l	# func 32 40	CVT.S.L		MIPS32r2
-	PTR_WORD cvt_d_l	# func 33 41	CVT.D.L		MIPS32r2
+	PTR_WORD cvt_s_l	# func 32 40	CVT.S.L		MIPS3/MIPS64
+	PTR_WORD cvt_d_l	# func 33 41	CVT.D.L		MIPS3/MIPS64
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD ill		# func 36 44



CVS commit: src/sys/arch/mips/mips

2021-05-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 04:55:12 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Note which ISA the unimplemented instructions belong to.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.54 src/sys/arch/mips/mips/fp.S:1.55
--- src/sys/arch/mips/mips/fp.S:1.54	Thu Apr 29 08:45:29 2021
+++ src/sys/arch/mips/mips/fp.S	Thu May 13 04:55:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.54 2021/04/29 08:45:29 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.55 2021/05/13 04:55:12 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -282,14 +282,14 @@ fmt_tbl:
 	PTR_WORD mfromc1	# sub 0		mfc1
 	PTR_WORD dmfromc1	# sub 1		dmfc1
 	PTR_WORD cfromc1	# sub 2		cfc1
-	PTR_WORD ill		# sub 3		mfhc1
+	PTR_WORD ill		# sub 3		mfhc1		MIPS32r2
 	PTR_WORD mtoc1		# sub 4		mtc1
 	PTR_WORD dmtoc1		# sub 5		dmtc1
 	PTR_WORD ctoc1		# sub 6		ctc1
-	PTR_WORD ill		# sub 7		mthc1
+	PTR_WORD ill		# sub 7		mthc1		MIPS32r2
 	PTR_WORD branchc1	# sub 8		bc1
-	PTR_WORD branchc1any2	# sub 9		bc1any2
-	PTR_WORD branchc1any4	# sub 10	bc1any4
+	PTR_WORD branchc1any2	# sub 9		bc1any2		MIPS-3D ASE
+	PTR_WORD branchc1any4	# sub 10	bc1any4		MIPS-3D ASE
 	PTR_WORD ill		# sub 11
 	PTR_WORD ill		# sub 12
 	PTR_WORD ill		# sub 13
@@ -321,37 +321,37 @@ func_single_tbl:
 	PTR_WORD abs_s		# func  5 05	ABS.S
 	PTR_WORD mov_s		# func  6 06	MOV.S
 	PTR_WORD neg_s		# func  7 07	NEG.S 
-	PTR_WORD round_l_s	# func  8 10	ROUND.L.S
-	PTR_WORD trunc_l_s	# func  9 11	TRUNC.L.S
-	PTR_WORD ceil_l_s	# func 10 12	CEIL.L.S
-	PTR_WORD floor_l_s	# func 11 13	FLOOR.L.S
+	PTR_WORD round_l_s	# func  8 10	ROUND.L.S	MIPS3/MIPS64
+	PTR_WORD trunc_l_s	# func  9 11	TRUNC.L.S	MIPS3/MIPS64
+	PTR_WORD ceil_l_s	# func 10 12	CEIL.L.S	MIPS3/MIPS64
+	PTR_WORD floor_l_s	# func 11 13	FLOOR.L.S	MIPS3/MIPS64
 	PTR_WORD round_w_s	# func 12 14	ROUND.W.S
 	PTR_WORD trunc_w_s	# func 13 15	TRUNC.W.S
 	PTR_WORD ceil_w_s	# func 14 16	CEIL.W.S
 	PTR_WORD floor_w_s	# func 15 17	FLOOR.W.S
 	PTR_WORD ill		# func 16 20
-	PTR_WORD movcf_s	# func 17 21	MOVCF.S
-	PTR_WORD movz_s		# func 18 22	MOVZ.S
-	PTR_WORD movn_s		# func 19 23	MOVN.S
+	PTR_WORD movcf_s	# func 17 21	MOVCF.S		MIPS32
+	PTR_WORD movz_s		# func 18 22	MOVZ.S		MIPS32
+	PTR_WORD movn_s		# func 19 23	MOVN.S		MIPS32
 	PTR_WORD ill		# func 20 24
-	PTR_WORD recip_s	# func 21 25	RECIP.S
-	PTR_WORD rsqrt_s	# func 22 26	RSQRT.S
+	PTR_WORD recip_s	# func 21 25	RECIP.S		MIPS32r2
+	PTR_WORD rsqrt_s	# func 22 26	RSQRT.S		MIPS32r2
 	PTR_WORD ill		# func 23 27
 	PTR_WORD ill		# func 24 30
 	PTR_WORD ill		# func 25 31
 	PTR_WORD ill		# func 26 32
 	PTR_WORD ill		# func 27 33
-	PTR_WORD recip2_s	# func 28 34	RECIP2.S
-	PTR_WORD recip1_s	# func 29 35	RECIP1.S
-	PTR_WORD rsqrt1_s	# func 30 36	RSQRT1.S
-	PTR_WORD rsqrt2_s	# func 31 37	RSQRT2.S
+	PTR_WORD recip2_s	# func 28 34	RECIP2.S	MIPS-3D ASE
+	PTR_WORD recip1_s	# func 29 35	RECIP1.S	MIPS-3D ASE
+	PTR_WORD rsqrt1_s	# func 30 36	RSQRT1.S	MIPS-3D ASE
+	PTR_WORD rsqrt2_s	# func 31 37	RSQRT2.S	MIPS-3D ASE
 	PTR_WORD ill		# func 32 40
 	PTR_WORD cvt_d_s	# func 33 41	CVT.D.S
 	PTR_WORD ill		# func 34 42
 	PTR_WORD ill		# func 35 43
 	PTR_WORD cvt_w_s	# func 36 44	CVT.W.S
-	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S
-	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S
+	PTR_WORD cvt_l_s	# func 37 45	CVT.L.S		MIPS64r2
+	PTR_WORD cvt_ps_s	# func 38 46	CVT.PS.S	MIPS32r2
 	PTR_WORD ill		# func 39 47
 	PTR_WORD ill		# func 40 50
 	PTR_WORD ill		# func 41 51
@@ -387,36 +387,36 @@ func_double_tbl:
 	PTR_WORD abs_d		# func  5 05	ABS.D
 	PTR_WORD mov_d		# func  6 06	MOV.D
 	PTR_WORD neg_d		# func  7 07	NEG.D 
-	PTR_WORD round_l_d	# func  8 10	ROUND.L.D
-	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D
-	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D
-	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D
+	PTR_WORD round_l_d	# func  8 10	ROUND.L.D	MIPS64r2
+	PTR_WORD trunc_l_d	# func  9 11	TRUNC.L.D	MIPS64r2
+	PTR_WORD ceil_l_d	# func 10 12	CEIL.L.D	MIPS64r2
+	PTR_WORD floor_l_d	# func 11 13	FLOOR.L.D	MIPS64r2
 	PTR_WORD round_w_d	# func 12 14	ROUND.W.D
 	PTR_WORD trunc_w_d	# func 13 15	TRUNC.W.D
 	PTR_WORD ceil_w_d	# func 14 16	CEIL.W.D
 	PTR_WORD floor_w_d	# func 15 17	FLOOR.W.D
 	PTR_WORD ill		# func 16 20
-	PTR_WORD movcf_d	# func 17 21	MOVCF.D
-	PTR_WORD movz_d		# func 18 22	MOVZ.D
-	PTR_WORD movn_d		# func 19 23	MOVN.D
+	PTR_WORD movcf_d	# func 17 21	MOVCF.D		MIPS32
+	PTR_WORD movz_d		# func 18 22	MOVZ.D		MIPS32
+	PTR_WORD movn_d		# func 19 23	MOVN.D		MIPS32
 	PTR_WORD ill		# func 20 24
-	PTR_WORD recip_d	# func 21 25	RECIP.D
-	PTR_WORD rsqrt_d	# func 22 26	RSQRT.D
+	PTR_WORD recip_d	# func 21 25	RECIP.D		MIPS32r2
+	PTR_WORD rsqrt_d	# func 22 26	RSQRT.D		MIPS32r2
 	PTR_WORD ill		# func 23 27
 	PTR_WORD ill		# func 24 30
 	PTR_WORD ill		# func 25 31
 	PTR_WO

CVS commit: src/sys/arch/mips/mips

2021-05-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 13 03:41:46 UTC 2021

Modified Files:
src/sys/arch/mips/mips: mips_fputrap.c

Log Message:
If we're going to print a number in hex, at least put a 0x in front of it.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/mips/mips_fputrap.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/mips/mips/mips_fputrap.c
diff -u src/sys/arch/mips/mips/mips_fputrap.c:1.10 src/sys/arch/mips/mips/mips_fputrap.c:1.11
--- src/sys/arch/mips/mips/mips_fputrap.c:1.10	Sat Feb 26 15:41:32 2011
+++ src/sys/arch/mips/mips/mips_fputrap.c	Thu May 13 03:41:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_fputrap.c,v 1.10 2011/02/26 15:41:32 tsutsui Exp $ */
+/* $NetBSD: mips_fputrap.c,v 1.11 2021/05/13 03:41:46 simonb Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -47,7 +47,7 @@ mips_fpuexcept(struct lwp *l, uint32_t f
 	ksiginfo_t ksi;
 
 #ifdef FPEMUL_DEBUG
-	printf("%s(%x,%#"PRIxREGISTER")\n",
+	printf("%s(%#x,%#"PRIxREGISTER")\n",
 	   __func__, fpustat, l->l_md.md_utf->tf_regs[_R_PC]);
 #endif
 
@@ -64,7 +64,7 @@ mips_fpuillinst(struct lwp *l, uint32_t 
 	ksiginfo_t ksi;
 
 #ifdef FPEMUL_DEBUG
-	printf("%s(%x,%#"PRIxREGISTER")\n",
+	printf("%s(%#x,%#"PRIxREGISTER")\n",
 	   __func__, opcode, l->l_md.md_utf->tf_regs[_R_PC]);
 #endif
 



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

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed May 12 03:53:37 UTC 2021

Modified Files:
src/sys/arch/mips/include: locore.h

Log Message:
Whitespace nit.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/mips/include/locore.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.117 src/sys/arch/mips/include/locore.h:1.118
--- src/sys/arch/mips/include/locore.h:1.117	Tue Mar  2 08:16:52 2021
+++ src/sys/arch/mips/include/locore.h	Wed May 12 03:53:37 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.117 2021/03/02 08:16:52 skrll Exp $ */
+/* $NetBSD: locore.h,v 1.118 2021/05/12 03:53:37 simonb Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -306,7 +306,7 @@ struct mips_options {
 #endif
 #define	MIPS_HAS_LLADDR		((mips_options.mips_cpu_flags & CPU_MIPS_NO_LLADDR) == 0)
 #define	MIPS_HAS_DSP		(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_DSP)
-# define MIPS_HAS_USERLOCAL	(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_USERLOCAL)
+#define MIPS_HAS_USERLOCAL	(mips_options.mips_cpu_flags & CPU_MIPS_HAVE_USERLOCAL)
 
 /* This test is ... rather bogus */
 #define	CPUISMIPS3	((mips_options.mips_cpu_arch & \



CVS commit: src/sys/arch/mips/mips

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 11 14:41:08 UTC 2021

Modified Files:
src/sys/arch/mips/mips: mips_fpu.c

Log Message:
Use "static" in the function intro if the function is static.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/mips/mips_fpu.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/mips/mips/mips_fpu.c
diff -u src/sys/arch/mips/mips/mips_fpu.c:1.15 src/sys/arch/mips/mips/mips_fpu.c:1.16
--- src/sys/arch/mips/mips/mips_fpu.c:1.15	Sun May  7 05:45:07 2017
+++ src/sys/arch/mips/mips/mips_fpu.c	Tue May 11 14:41:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fpu.c,v 1.15 2017/05/07 05:45:07 skrll Exp $	*/
+/*	$NetBSD: mips_fpu.c,v 1.16 2021/05/11 14:41:08 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.15 2017/05/07 05:45:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_fpu.c,v 1.16 2021/05/11 14:41:08 simonb Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ fpu_used_p(const lwp_t *l)
 	return pcu_valid_p(&mips_fpu_ops, l);
 }
 
-void
+static void
 mips_fpu_state_save(lwp_t *l)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
@@ -206,7 +206,7 @@ mips_fpu_state_save(lwp_t *l)
 	__asm volatile ("mtc0 %0, $%1" :: "r"(status), "n"(MIPS_COP_0_STATUS));
 }
 
-void
+static void
 mips_fpu_state_load(lwp_t *l, u_int flags)
 {
 	struct trapframe * const tf = l->l_md.md_utf;
@@ -350,7 +350,7 @@ mips_fpu_state_load(lwp_t *l, u_int flag
 		"n"(MIPS_COP_0_STATUS));
 }
 
-void
+static void
 mips_fpu_state_release(lwp_t *l)
 {
 	l->l_md.md_utf->tf_regs[_R_SR] &= ~MIPS_SR_COP_1_BIT;



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

2021-05-11 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue May 11 09:21:25 UTC 2021

Modified Files:
src/sys/arch/mips/conf: std.octeon

Log Message:
Revert rev 1.5 - put the NOFPU option back.  Older cnMIPS cores don't
have an FPU.


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

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/mips/conf/std.octeon
diff -u src/sys/arch/mips/conf/std.octeon:1.5 src/sys/arch/mips/conf/std.octeon:1.6
--- src/sys/arch/mips/conf/std.octeon:1.5	Sun Apr 18 12:05:29 2021
+++ src/sys/arch/mips/conf/std.octeon	Tue May 11 09:21:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.octeon,v 1.5 2021/04/18 12:05:29 simonb Exp $
+#	$NetBSD: std.octeon,v 1.6 2021/05/11 09:21:24 simonb Exp $
 
 machine evbmips mips
 include 	"conf/std"	# MI standard options
@@ -10,6 +10,7 @@ options 	MIPS3_ENABLE_CLOCK_INTR
 makeoptions	LP64="yes"
 
 options 	MIPS64R2
+options 	NOFPU		# No FPU
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_ELF64	# exec ELF64 binaries
 options 	COMPAT_NETBSD32



CVS commit: src/sys/arch/mips/cavium

2021-05-10 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon May 10 23:58:52 UTC 2021

Modified Files:
src/sys/arch/mips/cavium: mainbus.c

Log Message:
Specify the "fdt" interface attribute when configuring via FDT, since
mainbus also carries the "mainbus" interface attribute.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/mainbus.c

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

Modified files:

Index: src/sys/arch/mips/cavium/mainbus.c
diff -u src/sys/arch/mips/cavium/mainbus.c:1.7 src/sys/arch/mips/cavium/mainbus.c:1.8
--- src/sys/arch/mips/cavium/mainbus.c:1.7	Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/cavium/mainbus.c	Mon May 10 23:58:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.7 2021/04/24 23:36:42 thorpej Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.8 2021/05/10 23:58:52 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2021/05/10 23:58:52 thorpej Exp $");
 
 #define	_MIPS_BUS_DMA_PRIVATE
 
@@ -149,7 +149,9 @@ mainbus_attach_devicetree(device_t self)
 	}
 
 	faa.faa_phandle = OF_peer(0);
-	config_found(self, &faa, NULL, CFARG_EOL);
+	config_found(self, &faa, NULL,
+	CFARG_IATTR, "fdt",
+	CFARG_EOL);
 }
 
 static int



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

2021-05-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May  8 13:09:58 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_param.h

Log Message:
KNG


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/mips/include/mips_param.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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.48 src/sys/arch/mips/include/mips_param.h:1.49
--- src/sys/arch/mips/include/mips_param.h:1.48	Mon Apr 26 13:29:51 2021
+++ src/sys/arch/mips/include/mips_param.h	Sat May  8 13:09:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.48 2021/04/26 13:29:51 christos Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.49 2021/05/08 13:09:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
 
 #define	SEGSHIFT	(PGSHIFT + PTPLENGTH)	/* LOG2(NBSEG) */
 #define	NBSEG		(1 << SEGSHIFT)	/* bytes/segment */
-#define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
+#define	SEGOFSET	(NBSEG - 1)	/* byte offset into segment */
 
 #ifdef _LP64
 #define	SEGLENGTH	(PGSHIFT - 3)



CVS commit: src/sys/arch/mips/cavium/dev

2021-05-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed May  5 06:47:29 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_cib.c octeon_gmx.c octeon_intc.c

Log Message:
Sprinkle some static.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_cib.c \
src/sys/arch/mips/cavium/dev/octeon_intc.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.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/mips/cavium/dev/octeon_cib.c
diff -u src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6 src/sys/arch/mips/cavium/dev/octeon_cib.c:1.7
--- src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6	Wed Jan 27 03:10:21 2021
+++ src/sys/arch/mips/cavium/dev/octeon_cib.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -53,7 +53,7 @@ static bool	octeon_cib_intrstr(device_t,
 
 static int	octeon_cib_intr(void *);
 
-struct fdtbus_interrupt_controller_func octeon_cib_funcs = {
+static struct fdtbus_interrupt_controller_func octeon_cib_funcs = {
 	.establish = octeon_cib_establish,
 	.disestablish = octeon_cib_disestablish,
 	.intrstr = octeon_cib_intrstr
Index: src/sys/arch/mips/cavium/dev/octeon_intc.c
diff -u src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6 src/sys/arch/mips/cavium/dev/octeon_intc.c:1.7
--- src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6	Wed Jan 27 03:10:21 2021
+++ src/sys/arch/mips/cavium/dev/octeon_intc.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ static void *	octeon_intc_establish(devi
 static void	octeon_intc_disestablish(device_t, void *);
 static bool	octeon_intc_intrstr(device_t, u_int *, char *, size_t);
 
-struct fdtbus_interrupt_controller_func octeon_intc_funcs = {
+static struct fdtbus_interrupt_controller_func octeon_intc_funcs = {
 	.establish = octeon_intc_establish,
 	.disestablish = octeon_intc_disestablish,
 	.intrstr = octeon_intc_intrstr

Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17	Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Wed May  5 06:47:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $");
 
 #include 
 #include 
@@ -138,33 +138,33 @@ static const int	octgmx_rx_adr_cam_regs[
 	GMX0_RX0_ADR_CAM3, GMX0_RX0_ADR_CAM4, GMX0_RX0_ADR_CAM5
 };
 
-struct octgmx_port_ops octgmx_port_ops_mii = {
+static struct octgmx_port_ops octgmx_port_ops_mii = {
 	/* XXX not implemented */
 };
 
-struct octgmx_port_ops octgmx_port_ops_gmii = {
+static struct octgmx_port_ops octgmx_port_ops_gmii = {
 	.port_ops_enable = octgmx_rgmii_enable,
 	.port_ops_speed = octgmx_rgmii_speed,
 	.port_ops_timing = octgmx_rgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_rgmii = {
+static struct octgmx_port_ops octgmx_port_ops_rgmii = {
 	.port_ops_enable = octgmx_rgmii_enable,
 	.port_ops_speed = octgmx_rgmii_speed,
 	.port_ops_timing = octgmx_rgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_sgmii = {
+static struct octgmx_port_ops octgmx_port_ops_sgmii = {
 	.port_ops_enable = octgmx_sgmii_enable,
 	.port_ops_speed = octgmx_sgmii_speed,
 	.port_ops_timing = octgmx_sgmii_timing,
 };
 
-struct octgmx_port_ops octgmx_port_ops_spi42 = {
+static struct octgmx_port_ops octgmx_port_ops_spi42 = {
 	/* XXX not implemented */
 };
 
-struct octgmx_port_ops *octgmx_port_ops[] = {
+static struct octgmx_port_ops *octgmx_port_ops[] = {
 	[GMX_MII_PORT] = &octgmx_port_ops_mii,
 	[GMX_GMII_PORT] = &octgmx_port_ops_gmii,
 	[GMX_RGMII_PORT] = &octgmx_port_ops_rgmii,



CVS commit: src/sys/arch/mips/mips

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:45:29 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Fix another misplaced label for cvt_s_w() but use a named local label
and redo fix for cvt_d_w() in rev 1.52 the same way.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.53 src/sys/arch/mips/mips/fp.S:1.54
--- src/sys/arch/mips/mips/fp.S:1.53	Thu Apr 29 08:14:08 2021
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:45:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.53 2021/04/29 08:14:08 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.54 2021/04/29 08:45:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1754,17 +1754,18 @@ cvt_s_d:
  */
 cvt_s_w:
 	jal	_C_LABEL(get_fs_int)
-	bne	t2, zero, 1f			# check for zero
+	bne	t2, zero, .Lcvtswnot0		# check for zero
 	move	t1, zero
 	b	result_fs_s
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
+.Lcvtswnot0:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else
 	.set	noat
-1:
+
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16
@@ -1843,18 +1844,19 @@ cvt_d_s:
  */
 cvt_d_w:
 	jal	_C_LABEL(get_fs_int)
-	bne	t2, zero, 1f			# check for zero
+	bne	t2, zero, .Lcvtdwnot0		# check for zero
 	move	t1, zero			# result=0
 	move	t3, zero
 	b	result_fs_d
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
-1:
+.Lcvtdwnot0:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else /* __mips == 32 || __mips == 64 */
 	.set	noat
+
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16



CVS commit: src/sys/arch/mips/mips

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:14:08 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Move a comment slighty so that it's before two #ifdef blocks that do the
same thing instead of in the middle of them.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.52 src/sys/arch/mips/mips/fp.S:1.53
--- src/sys/arch/mips/mips/fp.S:1.52	Thu Apr 29 08:11:38 2021
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:14:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.52 2021/04/29 08:11:38 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.53 2021/04/29 08:14:08 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -4411,13 +4411,14 @@ END(renorm_fs_d)
  *
  */
 STATIC_LEAF(renorm_ft_s)
+/*
+ * Find out how many leading zero bits are in ta2 and put in v1.
+ */
 #if __mips == 32 || __mips == 64
 	clz	v1, ta2
 #else
 	.set	noat
-/*
- * Find out how many leading zero bits are in ta2 and put in v1.
- */
+
 	move	v0, ta2
 	move	v1, zero
 	srl	AT, v0, 16



CVS commit: src/sys/arch/mips/mips

2021-04-29 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 29 08:11:38 UTC 2021

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Move a branch target in cvt_d_w() to where it will be hit for either
case of an #ifdef block of code.  Fixes an FP emulation problem if
compiled with -mips32 or -mips64.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.51 src/sys/arch/mips/mips/fp.S:1.52
--- src/sys/arch/mips/mips/fp.S:1.51	Thu Jun 25 11:48:39 2020
+++ src/sys/arch/mips/mips/fp.S	Thu Apr 29 08:11:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.51 2020/06/25 11:48:39 simonb Exp $	*/
+/*	$NetBSD: fp.S,v 1.52 2021/04/29 08:11:38 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1850,11 +1850,11 @@ cvt_d_w:
 /*
  * Find out how many leading zero bits are in t2 and put in v1.
  */
+1:
 #if __mips == 32 || __mips == 64
 	clz	v1, t2
 #else /* __mips == 32 || __mips == 64 */
 	.set	noat
-1:
 	move	v0, t2
 	move	v1, zero
 	srl	AT, v0, 16



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

2021-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 26 13:29:51 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_param.h

Log Message:
Make MACHINE_ARCH for n64 binaries mipsn64e[bl] instead of mips64e[bl] to
differentiate them from n32/o32 binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/mips/include/mips_param.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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.47 src/sys/arch/mips/include/mips_param.h:1.48
--- src/sys/arch/mips/include/mips_param.h:1.47	Wed Aug 26 06:51:45 2020
+++ src/sys/arch/mips/include/mips_param.h	Mon Apr 26 09:29:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.47 2020/08/26 10:51:45 simonb Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.48 2021/04/26 13:29:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -29,27 +29,28 @@
  * No reason this can't be common
  */
 #if defined(__MIPSEB__)
-# if defined(__mips_n32) || defined(__mips_n64)
-#  define	_MACHINE_ARCH	mips64eb
-#  define	MACHINE_ARCH	"mips64eb"
-#  define	_MACHINE32_ARCH	mipseb
-#  define	MACHINE32_ARCH	"mipseb"
-# else
-#  define	_MACHINE_ARCH	mipseb
-#  define	MACHINE_ARCH	"mipseb"
-# endif
+# define _MACHINE_SUFFIX eb
+# define MACHINE_SUFFIX "eb"
 #elif defined(__MIPSEL__)
-# if defined(__mips_n32) || defined(__mips_n64)
-#  define	_MACHINE_ARCH	mips64el
-#  define	MACHINE_ARCH	"mips64el"
-#  define	_MACHINE32_ARCH	mipsel
-#  define	MACHINE32_ARCH	"mipsel"
-# else
-#  define	_MACHINE_ARCH	mipsel
-#  define	MACHINE_ARCH	"mipsel"
-#endif
+# define _MACHINE_SUFFIX el
+# define MACHINE_SUFFIX "el"
 #else
-#error neither __MIPSEL__ nor __MIPSEB__ are defined.
+# error neither __MIPSEL__ nor __MIPSEB__ are defined.
+#endif
+
+#if defined(__mips_n32) || defined(__mips_n64)
+# if defined(__mips_n32)
+#  define	_MACHINE_ARCH	mips64##_MACHINE_SUFFIX
+#  define	MACHINE_ARCH	"mips64" MACHINE_SUFFIX
+# else /* __mips_n64 */
+#  define	_MACHINE_ARCH	mipsn64##_MACHINE_SUFFIX
+#  define	MACHINE_ARCH	"mipsn64" MACHINE_SUFFIX
+# endif
+# define	_MACHINE32_ARCH	mips##_MACHINE_SUFFIX
+# define	MACHINE32_ARCH	"mips" MACHINE_SUFFIX
+#else /* o32 */
+# define	_MACHINE_ARCH	mips##_MACHINE_SUFFIX
+# define	MACHINE_ARCH	"mips" MACHINE_SUFFIX
 #endif
 
 /*



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

2021-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 26 00:28:01 UTC 2021

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

Log Message:
Produce elf32 images for mipsn64eb too


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/mips/conf/Makefile.mips

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/mips/conf/Makefile.mips
diff -u src/sys/arch/mips/conf/Makefile.mips:1.71 src/sys/arch/mips/conf/Makefile.mips:1.72
--- src/sys/arch/mips/conf/Makefile.mips:1.71	Sun Apr 25 19:24:00 2021
+++ src/sys/arch/mips/conf/Makefile.mips	Sun Apr 25 20:28:01 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mips,v 1.71 2021/04/25 23:24:00 christos Exp $
+#	$NetBSD: Makefile.mips,v 1.72 2021/04/26 00:28:01 christos Exp $
 
 # Makefile for NetBSD
 #
@@ -58,7 +58,7 @@ CFLAGS+=	${GP} -mno-abicalls -msoft-floa
 CFLAGS+=	-msym32 -mabi=64
 AFLAGS+=	-msym32 -mabi=64
 .endif
-.if ${MACHINE_ARCH} == "mips64eb"
+.if !empty(MACHINE_ARCH:Mmips*64eb)
 LDFLAGS+=	-Wl,-m,elf64btsmip
 LINKFORMAT+=	-m elf64btsmip
 SYSTEM_LD_TAIL_EXTRA+= \



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

2021-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 25 23:24:00 UTC 2021

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

Log Message:
use ${MACHINE_MIPS64}


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mips/conf/Makefile.mips

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/mips/conf/Makefile.mips
diff -u src/sys/arch/mips/conf/Makefile.mips:1.70 src/sys/arch/mips/conf/Makefile.mips:1.71
--- src/sys/arch/mips/conf/Makefile.mips:1.70	Tue Jan  1 14:41:04 2019
+++ src/sys/arch/mips/conf/Makefile.mips	Sun Apr 25 19:24:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mips,v 1.70 2019/01/01 19:41:04 christos Exp $
+#	$NetBSD: Makefile.mips,v 1.71 2021/04/25 23:24:00 christos Exp $
 
 # Makefile for NetBSD
 #
@@ -54,7 +54,7 @@ AFLAGS.fp.S+=		-Wa,-mhard-float
 
 CFLAGS+=	${GP} -mno-abicalls -msoft-float -ffixed-24
 .if defined(LP64) && ${LP64} == "yes"
-.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
+.if ${MACHINE_MIPS64}
 CFLAGS+=	-msym32 -mabi=64
 AFLAGS+=	-msym32 -mabi=64
 .endif
@@ -65,7 +65,7 @@ SYSTEM_LD_TAIL_EXTRA+= \
 		;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \
 		${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32
 .endif
-.if ${MACHINE_ARCH} == "mips64el"
+.if !empty(MACHINE_ARCH:Mmips*64el)
 LDFLAGS+=	-Wl,-m,elf64ltsmip
 LINKFORMAT+=	-m elf64ltsmip
 SYSTEM_LD_TAIL_EXTRA+= \
@@ -96,7 +96,7 @@ locore_machdep.o: ${THISMIPS}/${MACHINE}
 ##
 ## (5) link settings
 ##
-.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
+.if ${MACHINE_MIPS64}
 TEXTADDR?=  ${DEFTEXTADDR:C/0x8/0x8/}
 .else   
 TEXTADDR?=		${DEFTEXTADDR}



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

2021-04-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun Apr 18 12:05:29 UTC 2021

Modified Files:
src/sys/arch/mips/conf: std.octeon

Log Message:
Delete the NOFPU option.  These CPUs do have an FPU.  Allows o32
binaries to work now.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/std.octeon

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/mips/conf/std.octeon
diff -u src/sys/arch/mips/conf/std.octeon:1.4 src/sys/arch/mips/conf/std.octeon:1.5
--- src/sys/arch/mips/conf/std.octeon:1.4	Mon Jun  1 22:55:12 2015
+++ src/sys/arch/mips/conf/std.octeon	Sun Apr 18 12:05:29 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.octeon,v 1.4 2015/06/01 22:55:12 matt Exp $
+#	$NetBSD: std.octeon,v 1.5 2021/04/18 12:05:29 simonb Exp $
 
 machine evbmips mips
 include 	"conf/std"	# MI standard options
@@ -10,7 +10,6 @@ options 	MIPS3_ENABLE_CLOCK_INTR
 makeoptions	LP64="yes"
 
 options 	MIPS64R2
-options 	NOFPU		# No FPU
 options 	EXEC_ELF32	# exec ELF32 binaries
 options 	EXEC_ELF64	# exec ELF64 binaries
 options 	COMPAT_NETBSD32



CVS commit: src/sys/arch/mips/mips

2021-04-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 18 10:40:34 UTC 2021

Modified Files:
src/sys/arch/mips/mips: locore.S

Log Message:
move softint_cleanup, which is a part of softint_fast_dispatch(),
into the section of code known as softint_fast_dispatch().

previous:

db> x/i softint_cleanup
netbsd:cpu_switchto+0xd4:   ld  t0,0(t8)

except that cpu_switchto() ends at cpu_switchto+0xd0.

now:

db> x/i softint_cleanup
netbsd:softint_fast_dispatch+0xa4:  ld  t0,0(t8)

tested on OCTEON.


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/arch/mips/mips/locore.S

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

Modified files:

Index: src/sys/arch/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.226 src/sys/arch/mips/mips/locore.S:1.227
--- src/sys/arch/mips/mips/locore.S:1.226	Sat Sep 26 08:21:10 2020
+++ src/sys/arch/mips/mips/locore.S	Sun Apr 18 10:40:34 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.226 2020/09/26 08:21:10 simonb Exp $	*/
+/*	$NetBSD: locore.S,v 1.227 2021/04/18 10:40:34 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: locore.S,v 1.226 2020/09/26 08:21:10 simonb Exp $")
+RCSID("$NetBSD: locore.S,v 1.227 2021/04/18 10:40:34 mrg Exp $")
 
 #include "assym.h"
 
@@ -351,36 +351,6 @@ END(cpu_switchto)
  *
  * called at IPL_HIGH
  *
- */
-softint_cleanup:
-#ifdef PARANOIA
-	mfc0	t1, MIPS_COP_0_STATUS
-	MFC0_HAZARD
-	and	v0, t1, MIPS_SR_INT_IE
-#if __mips >= 32
-	teqi	v0, 0
-#else
-1:	beqz	v0, 1b
-	 nop
-#endif
-#endif /* PARANOIA */
-	PTR_L	t0, L_CPU(MIPS_CURLWP)
-	NOP_L	# load delay
-	INT_L	t1, CPU_INFO_MTX_COUNT(t0)
-	NOP_L	# load delay
-	INT_ADDU t1, 1
-	INT_S	t1, CPU_INFO_MTX_COUNT(t0)
-	REG_L	ra, CALLFRAME_RA(sp)
-	REG_L	v0, CALLFRAME_S0(sp)		# get softint lwp
-	NOP_L	# load delay
-#if IPL_SCHED != IPL_HIGH
-	j	_C_LABEL(splhigh_noprof)
-#else
-	jr	ra
-#endif
-	 PTR_ADDU sp, CALLFRAME_SIZ
-
-/*
  * Arguments:
  *	a0	the LWP to switch to
  *	a1	IPL to execute at
@@ -463,6 +433,34 @@ NESTED(softint_fast_dispatch, CALLFRAME_
 	 */
 	jr	ra
 	 PTR_ADDU sp, CALLFRAME_SIZ
+
+softint_cleanup:
+#ifdef PARANOIA
+	mfc0	t1, MIPS_COP_0_STATUS
+	MFC0_HAZARD
+	and	v0, t1, MIPS_SR_INT_IE
+#if __mips >= 32
+	teqi	v0, 0
+#else
+1:	beqz	v0, 1b
+	 nop
+#endif
+#endif /* PARANOIA */
+	PTR_L	t0, L_CPU(MIPS_CURLWP)
+	NOP_L	# load delay
+	INT_L	t1, CPU_INFO_MTX_COUNT(t0)
+	NOP_L	# load delay
+	INT_ADDU t1, 1
+	INT_S	t1, CPU_INFO_MTX_COUNT(t0)
+	REG_L	ra, CALLFRAME_RA(sp)
+	REG_L	v0, CALLFRAME_S0(sp)		# get softint lwp
+	NOP_L	# load delay
+#if IPL_SCHED != IPL_HIGH
+	j	_C_LABEL(splhigh_noprof)
+#else
+	jr	ra
+#endif
+	 PTR_ADDU sp, CALLFRAME_SIZ
 END(softint_fast_dispatch)
 #endif /* __HAVE_FAST_SOFTINTS */
 



CVS commit: src/sys/arch/mips/mips

2021-04-12 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr 12 11:35:22 UTC 2021

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

Log Message:
Print target addresses similar to aarch64 as "address "
instead of " [addr:address]".  Uses less columns, a bit
easier on the eyes.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.41 src/sys/arch/mips/mips/db_disasm.c:1.42
--- src/sys/arch/mips/mips/db_disasm.c:1.41	Wed Apr  7 14:27:39 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr 12 11:35:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.42 2021/04/12 11:35:22 simonb Exp $");
 
 #include 
 #include 
@@ -910,13 +910,11 @@ print_addr(db_addr_t loc)
 	sym = db_search_symbol(loc, DB_STGY_ANY, &diff);
 	db_symbol_values(sym, &symname, 0);
 
+	db_printf("%#"PRIxVADDR, loc);
 	if (symname) {
-		if (diff == 0)
-			db_printf("%s", symname);
-		else
-			db_printf("<%s+%#"DDB_EXPR_FMT"x>", symname, diff);
-		db_printf("\t[addr:%#"PRIxVADDR"]", loc);
-	} else {
-		db_printf("%#"PRIxVADDR, loc);
+		db_printf(" <%s", symname);
+		if (diff != 0)
+			db_printf("+%#"DDB_EXPR_FMT"x", diff);
+		db_printf(">");
 	}
 }



CVS commit: src/sys/arch/mips/mips

2021-04-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 12 02:23:41 UTC 2021

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

Log Message:
avoid duplicate "ddb_regs" in crash with GCC 10 and -fcommon default.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/mips/mips/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/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.92 src/sys/arch/mips/mips/db_interface.c:1.93
--- src/sys/arch/mips/mips/db_interface.c:1.92	Tue Feb 23 07:13:52 2021
+++ src/sys/arch/mips/mips/db_interface.c	Mon Apr 12 02:23:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.92 2021/02/23 07:13:52 mrg Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.93 2021/04/12 02:23:41 mrg Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.92 2021/02/23 07:13:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.93 2021/04/12 02:23:41 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -74,7 +74,9 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface
 volatile u_int ddb_cpu = NOCPU;
 
 int		db_active = 0;
+#ifdef _KERNEL
 db_regs_t	ddb_regs;
+#endif
 
 #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
 static void db_watch_cmd(db_expr_t, bool, db_expr_t, const char *);



CVS commit: src/sys/arch/mips/mips

2021-04-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 14:27:39 UTC 2021

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

Log Message:
Add a # to a %x printf format to get some 0x hex number prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.40 src/sys/arch/mips/mips/db_disasm.c:1.41
--- src/sys/arch/mips/mips/db_disasm.c:1.40	Mon Apr  5 07:28:19 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Wed Apr  7 14:27:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.41 2021/04/07 14:27:39 simonb Exp $");
 
 #include 
 #include 
@@ -914,7 +914,7 @@ print_addr(db_addr_t loc)
 		if (diff == 0)
 			db_printf("%s", symname);
 		else
-			db_printf("<%s+%"DDB_EXPR_FMT"x>", symname, diff);
+			db_printf("<%s+%#"DDB_EXPR_FMT"x>", symname, diff);
 		db_printf("\t[addr:%#"PRIxVADDR"]", loc);
 	} else {
 		db_printf("%#"PRIxVADDR, loc);



CVS commit: src/sys/arch/mips/mips

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Apr  7 02:59:01 UTC 2021

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

Log Message:
Basic dtrace trap support.

Mostly from FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.260 src/sys/arch/mips/mips/trap.c:1.261
--- src/sys/arch/mips/mips/trap.c:1.260	Mon Mar 29 03:22:17 2021
+++ src/sys/arch/mips/mips/trap.c	Wed Apr  7 02:59:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $	*/
+/*	$NetBSD: trap.c,v 1.261 2021/04/07 02:59:01 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.261 2021/04/07 02:59:01 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -83,6 +83,16 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2
 #include 
 #endif
 
+#ifdef KDTRACE_HOOKS
+#include 
+
+/* Not used for now, but needed for dtrace/fbt modules */
+dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
+dtrace_trap_func_t		dtrace_trap_func = NULL;
+
+int(* dtrace_invop_jump_addr)(struct trapframe *);
+#endif /* KDTRACE_HOOKS */
+
 const char * const trap_names[] = {
 	"external interrupt",
 	"TLB modification",
@@ -187,6 +197,30 @@ trap(uint32_t status, uint32_t cause, va
 		LWP_CACHE_CREDS(l, p);
 	}
 
+#ifdef KDTRACE_HOOKS
+	/*
+	 * A trap can occur while DTrace executes a probe. Before
+	 * executing the probe, DTrace blocks re-scheduling and sets
+	 * a flag in its per-cpu flags to indicate that it doesn't
+	 * want to fault. On returning from the probe, the no-fault
+	 * flag is cleared and finally re-scheduling is enabled.
+	 *
+	 * If the DTrace kernel module has registered a trap handler,
+	 * call it and if it returns non-zero, assume that it has
+	 * handled the trap and modified the trap frame so that this
+	 * function can return normally.
+	 */
+	/*
+	 * XXXDTRACE: add pid probe handler here (if ever)
+	 */
+	if (!USERMODE(status)) {
+		if ((dtrace_trap_func != NULL) &&
+		((*dtrace_trap_func)(tf, type) != 0)) {
+			return;
+		}
+	}
+#endif /* KDTRACE_HOOKS */
+
 	switch (type) {
 	default:
 	dopanic:
@@ -518,8 +552,15 @@ trap(uint32_t status, uint32_t cause, va
 		}
 		break; /* SIGNAL */
 
-	case T_WATCH:
 	case T_BREAK:
+#ifdef KDTRACE_HOOKS
+		if ((dtrace_invop_jump_addr != NULL) &&
+		(dtrace_invop_jump_addr(tf) == 0)) {
+			return;
+		}
+#endif /* KDTRACE_HOOKS */
+		/* FALLTHROUGH */
+	case T_WATCH:
 #if defined(DDB)
 		kdb_trap(type, &tf->tf_registers);
 		return;	/* KERN */
@@ -805,16 +846,6 @@ mips_singlestep(struct lwp *l)
 	return 0;
 }
 
-#ifdef KDTRACE_HOOKS
-#include 
-
-/* Not used for now, but needed for dtrace/fbt modules */
-dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
-dtrace_trap_func_t		dtrace_trap_func = NULL;
-
-int(* dtrace_invop_jump_addr)(struct trapframe *);
-#endif /* KDTRACE_HOOKS */
-
 #ifdef TRAP_SIGDEBUG
 static void
 frame_dump(const struct trapframe *tf, struct pcb *pcb)



CVS commit: src/sys/arch/mips/mips

2021-04-06 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Apr  6 13:11:22 UTC 2021

Modified Files:
src/sys/arch/mips/mips: mips_stacktrace.c

Log Message:
If we're going to print a number in hex, at least put a 0x in front of
it so we can cut'n'paste it into gdb directly.  This has only annoyed
me for 25 or so years...

Wrap a long long while here.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/mips/mips_stacktrace.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/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.8 src/sys/arch/mips/mips/mips_stacktrace.c:1.9
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.8	Mon Mar 29 03:09:42 2021
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Tue Apr  6 13:11:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.9 2021/04/06 13:11:22 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.9 2021/04/06 13:11:22 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -504,10 +504,12 @@ mips3_eret:
 done:
 	if (mask & (1 << _R_RA))
 		ra = regs[_R_RA];
-	(*printfn)("%#"PRIxVADDR": %s+%"PRIxVADDR" (%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER") ra %"PRIxVADDR" sz %d\n",
-		sp, fn_name(subr), pc - subr,
-		regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
-		ra, stksize);
+	(*printfn)("%#"PRIxVADDR": %s+%#"PRIxVADDR" (%#"PRIxREGISTER","
+	"%#"PRIxREGISTER",%#"PRIxREGISTER",%#"PRIxREGISTER") "
+	"ra %#"PRIxVADDR" sz %d\n",
+	sp, fn_name(subr), pc - subr,
+	regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
+	ra, stksize);
 
 	if (ra) {
 		if (pc == ra && stksize == 0)



CVS commit: src/sys/arch/mips

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:28:19 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_opcode.h
src/sys/arch/mips/mips: db_disasm.c

Log Message:
Some QED instructions are included in MIPS32 and MIPS64 instruction sets.
Update a few comments.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.25 src/sys/arch/mips/include/mips_opcode.h:1.26
--- src/sys/arch/mips/include/mips_opcode.h:1.25	Mon Apr  5 07:00:06 2021
+++ src/sys/arch/mips/include/mips_opcode.h	Mon Apr  5 07:28:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.25 2021/04/05 07:00:06 simonb Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.26 2021/04/05 07:28:19 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -169,7 +169,7 @@ typedef union {
 #define	OP_LDL		032		/* MIPS-II, for r4000 port */
 #define	OP_LDR		033		/* MIPS-II, for r4000 port */
 
-#define	OP_SPECIAL2	034		/* QED opcodes */
+#define	OP_SPECIAL2	034		/* QED and MIPS32/MIPS64 opcodes */
 #define	OP_JALX		035
 #define	OP_MDMX		036
 #define	OP_SPECIAL3	037
@@ -303,9 +303,9 @@ typedef union {
 /*
  * Values for the 'func' field when 'op' == OP_SPECIAL2.
  */
-#define	OP_MADD		000		/* QED */
-#define	OP_MADDU	001		/* QED */
-#define	OP_MUL		002		/* QED */
+#define	OP_MADD		000		/* QED, MIPS32/64 */
+#define	OP_MADDU	001		/* QED, MIPS32/64 */
+#define	OP_MUL		002		/* QED, MIPS32/64 */
 #define	OP_CVM_DMUL	003		/* OCTEON */
 #define	OP_MSUB		004		/* MIPS32/64 */
 #define	OP_MSUBU	005		/* MIPS32/64 */

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.39 src/sys/arch/mips/mips/db_disasm.c:1.40
--- src/sys/arch/mips/mips/db_disasm.c:1.39	Mon Apr  5 07:27:11 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:28:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.40 2021/04/05 07:28:19 simonb Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@ static const char * const spec_name[64] 
 /*56 */ "dsll","spec71","dsrl","dsra","dsll32","spec75","dsrl32","dsra32"
 };
 
-static const char * const spec2_name[64] = {	/* QED RM4650, R5000, etc. */
+static const char * const spec2_name[64] = {	/* QED, MIPS32/64, etc. */
 	[OP_MADD] = "madd",
 	[OP_MADDU] = "maddu",
 	[OP_MUL] = "mul",



CVS commit: src/sys/arch/mips/mips

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:27:11 UTC 2021

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

Log Message:
Fix cut'n'paste typo - OP_CVM_DMUL is dmul, not baddu.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.38 src/sys/arch/mips/mips/db_disasm.c:1.39
--- src/sys/arch/mips/mips/db_disasm.c:1.38	Mon Apr  5 07:00:06 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:27:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.39 2021/04/05 07:27:11 simonb Exp $");
 
 #include 
 #include 
@@ -85,7 +85,7 @@ static const char * const spec2_name[64]
 	[OP_MADDU] = "maddu",
 	[OP_MUL] = "mul",
 #ifdef __OCTEON__
-	[OP_CVM_DMUL] = "baddu",
+	[OP_CVM_DMUL] = "dmul",
 #endif
 	[OP_MSUB] = "msub",
 	[OP_MSUBU] = "msubu",



CVS commit: src/sys/arch/mips

2021-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 07:00:06 UTC 2021

Modified Files:
src/sys/arch/mips/include: mips_opcode.h
src/sys/arch/mips/mips: db_disasm.c

Log Message:
Tidy up NOP disassembly, handle "pause" as well.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/include/mips_opcode.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.24 src/sys/arch/mips/include/mips_opcode.h:1.25
--- src/sys/arch/mips/include/mips_opcode.h:1.24	Mon Aug 17 03:14:08 2020
+++ src/sys/arch/mips/include/mips_opcode.h	Mon Apr  5 07:00:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.24 2020/08/17 03:14:08 mrg Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.25 2021/04/05 07:00:06 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -292,6 +292,15 @@ typedef union {
 #define	OP_DSRA32	077		/* MIPS-II, for r4000 port */
 
 /*
+ * Subvalues for SLL where the source and destination registers
+ * are both zero.
+ */
+#define	OP_SLL_NOP	0
+#define	OP_SLL_SSNOP	1
+#define	OP_SLL_EHB	3
+#define	OP_SLL_PAUSE	5
+
+/*
  * Values for the 'func' field when 'op' == OP_SPECIAL2.
  */
 #define	OP_MADD		000		/* QED */

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.37 src/sys/arch/mips/mips/db_disasm.c:1.38
--- src/sys/arch/mips/mips/db_disasm.c:1.37	Mon Apr  5 06:38:01 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 07:00:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.38 2021/04/05 07:00:06 simonb Exp $");
 
 #include 
 #include 
@@ -265,18 +265,32 @@ db_disasm_insn(int insn, db_addr_t loc, 
 	switch (i.JType.op) {
 	case OP_SPECIAL: {
 		const char *name = spec_name[i.RType.func];
-		if (i.word == 0) {
-			db_printf("nop");
-			break;
-		}
-		if (i.word == (1 << 6)) {
-			db_printf("ssnop");
-			break;
-		}
-		if (i.word == (3 << 6)) {
-			db_printf("ehb");
+
+		/* Handle varations of NOPs */
+		if ((i.RType.func == OP_SLL) &&
+		(i.RType.rs == 0) &&
+		(i.RType.rt == 0) &&
+		(i.RType.rd == 0)) {
+			switch (i.RType.shamt) {
+			case OP_SLL_NOP:
+db_printf("nop");
+break;
+			case OP_SLL_SSNOP:
+db_printf("ssnop");
+break;
+			case OP_SLL_EHB:
+db_printf("ehb");
+break;
+			case OP_SLL_PAUSE:
+db_printf("pause");
+break;
+			default:
+db_printf("nop *");	/* "undefined" NOP */
+break;
+			}
 			break;
 		}
+
 		/*
 		 * The following are equivalents of a "move dst,src":
 		 *	addu	dst,src,zero	(in 32-bit mode)
@@ -296,6 +310,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 			reg_name[i.RType.rs]);
 			break;
 		}
+
 		if ((i.RType.func == OP_SRL || i.RType.func == OP_SRLV)
 		&& i.RType.rs == 1) {
 			name = (i.RType.func == OP_SRL) ? "rotr" : "rotrv";



CVS commit: src/sys/arch/mips/mips

2021-04-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:38:01 UTC 2021

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

Log Message:
gcc/gas also emits "or ...,zero" as well as "addu/daddu ...,zero" for a
"move" pseudo instruction.  Disassemble the "or" case as a "move" too.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.36 src/sys/arch/mips/mips/db_disasm.c:1.37
--- src/sys/arch/mips/mips/db_disasm.c:1.36	Mon Apr  5 06:35:04 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:38:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $");
 
 #include 
 #include 
@@ -277,16 +277,19 @@ db_disasm_insn(int insn, db_addr_t loc, 
 			db_printf("ehb");
 			break;
 		}
-		/* XXX
-		 * "addu" is a "move" only in 32-bit mode.  What's the correct
-		 * answer - never decode addu/daddu as "move"?
+		/*
+		 * The following are equivalents of a "move dst,src":
+		 *	addu	dst,src,zero	(in 32-bit mode)
+		 *	daddu	dst,src,zero	(in 64-bit mode)
+		 *	or	dst,src,zero	(in 32- and 64-bit modes)
 		 */
-		if (true
 #ifdef __mips_o32
-		&& i.RType.func == OP_ADDU
+#define	OP_MOVE_ADDU	OP_ADDU
 #else
-		&& i.RType.func == OP_DADDU
+#define	OP_MOVE_ADDU	OP_DADDU
 #endif
+		if (true &&
+		((i.RType.func == OP_OR) || (i.RType.func == OP_MOVE_ADDU))
 		&& i.RType.rt == 0) {
 			db_printf("move\t%s,%s",
 			reg_name[i.RType.rd],



CVS commit: src/sys/arch/mips/mips

2021-04-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:35:04 UTC 2021

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

Log Message:
Allow disassembly in XKSEG for LP64 kernels.  Can now x/i on modules
with an N64 kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.35 src/sys/arch/mips/mips/db_disasm.c:1.36
--- src/sys/arch/mips/mips/db_disasm.c:1.35	Mon Apr  5 06:28:31 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:35:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $");
 
 #include 
 #include 
@@ -218,6 +218,11 @@ static void print_addr(db_addr_t);
  * "next instruction" does NOT mean the next instruction to
  * be executed but the 'linear' next instruction.
  */
+#ifdef _LP64
+#define	DISASM_KERN_START	MIPS_XKSEG_START
+#else
+#define	DISASM_KERN_START	MIPS_KSEG0_START
+#endif
 db_addr_t
 db_disasm(db_addr_t loc, bool altfmt)
 {
@@ -225,9 +230,10 @@ db_disasm(db_addr_t loc, bool altfmt)
 
 	/*
 	 * Take some care with addresses to not UTLB here as it
-	 * loses the current debugging context.  KSEG2 not checked.
+	 * loses the current debugging context.  KSEG2 and XKSEG
+	 * are not checked.
 	 */
-	if (loc < (db_addr_t)MIPS_KSEG0_START) {
+	if (loc < (db_addr_t)DISASM_KERN_START) {
 #ifdef _KERNEL
 		if (ufetch_32((void *)loc, &instr) != 0) {
 			db_printf("invalid address.\n");



CVS commit: src/sys/arch/mips/mips

2021-04-04 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Apr  5 06:28:31 UTC 2021

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

Log Message:
For bc{0,1,2}{t,f} check for the TRUE value not the MASK value (even
though they're the same).


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.34 src/sys/arch/mips/mips/db_disasm.c:1.35
--- src/sys/arch/mips/mips/db_disasm.c:1.34	Tue Mar 16 07:34:44 2021
+++ src/sys/arch/mips/mips/db_disasm.c	Mon Apr  5 06:28:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.35 2021/04/05 06:28:31 simonb Exp $");
 
 #include 
 #include 
@@ -593,7 +593,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCy:
 
 			db_printf("bc0%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:
@@ -644,7 +644,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCx:
 		case OP_BCy:
 			db_printf("bc1%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:
@@ -708,7 +708,7 @@ db_disasm_insn(int insn, db_addr_t loc, 
 		case OP_BCx:
 		case OP_BCy:
 			db_printf("bc2%c\t",
-			"ft"[i.RType.rt & COPz_BC_TF_MASK]);
+			"ft"[i.RType.rt & COPz_BC_TRUE]);
 			goto pr_displ;
 
 		case OP_MT:



CVS commit: src/sys/arch/mips/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:22:18 UTC 2021

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

Log Message:
(Very) minimal kernel support for dtrace on MIPS; enough to system call
tracing to work for example.


To generate a diff of this commit:
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.259 src/sys/arch/mips/mips/trap.c:1.260
--- src/sys/arch/mips/mips/trap.c:1.259	Wed Mar 17 11:05:37 2021
+++ src/sys/arch/mips/mips/trap.c	Mon Mar 29 03:22:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $	*/
+/*	$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,10 +39,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.260 2021/03/29 03:22:17 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
+#include "opt_dtrace.h"
 #include "opt_kgdb.h"
 #include "opt_multiprocessor.h"
 
@@ -804,6 +805,16 @@ mips_singlestep(struct lwp *l)
 	return 0;
 }
 
+#ifdef KDTRACE_HOOKS
+#include 
+
+/* Not used for now, but needed for dtrace/fbt modules */
+dtrace_doubletrap_func_t	dtrace_doubletrap_func = NULL;
+dtrace_trap_func_t		dtrace_trap_func = NULL;
+
+int(* dtrace_invop_jump_addr)(struct trapframe *);
+#endif /* KDTRACE_HOOKS */
+
 #ifdef TRAP_SIGDEBUG
 static void
 frame_dump(const struct trapframe *tf, struct pcb *pcb)
@@ -863,4 +874,4 @@ sigdebug(const struct trapframe *tf, con
 	e);
 	frame_dump(tf, lwp_getpcb(l));
 }
-#endif
+#endif /* TRAP_SIGDEBUG */



CVS commit: src/sys/arch/mips

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:09:42 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h
src/sys/arch/mips/mips: mips_stacktrace.c

Log Message:
Expose kdbpeek() and kdbrpeek() for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/mips_stacktrace.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/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.36 src/sys/arch/mips/include/db_machdep.h:1.37
--- src/sys/arch/mips/include/db_machdep.h:1.36	Mon Mar 29 03:07:33 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:09:41 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.36 2021/03/29 03:07:33 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.37 2021/03/29 03:09:41 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -99,6 +99,12 @@ db_set_ddb_regs(int type, struct reg *re
 	ddb_regs = *regs;
 }
 
+/*
+ * Helper functions for fetching 32-bit and 64-bit kernel memory.
+ */
+bool		kdbpeek(vaddr_t, unsigned *);
+mips_reg_t	kdbrpeek(vaddr_t addr, size_t n);
+
 
 /*
  * Constants for KGDB.

Index: src/sys/arch/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.7 src/sys/arch/mips/mips/mips_stacktrace.c:1.8
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.7	Thu Sep 24 03:17:18 2020
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Mon Mar 29 03:09:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.8 2021/03/29 03:09:42 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -191,7 +191,7 @@ static const struct { void *addr; const 
 };
 
 
-static bool
+bool
 kdbpeek(vaddr_t addr, unsigned *valp)
 {
 	if (addr & 3) {
@@ -211,7 +211,7 @@ kdbpeek(vaddr_t addr, unsigned *valp)
 	}
 }
 
-static mips_reg_t
+mips_reg_t
 kdbrpeek(vaddr_t addr, size_t n)
 {
 	mips_reg_t rc = 0;



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

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:07:33 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
Move the cpu_reset_address() declaration inside #ifdef _KERNEL, add a
comment.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.35 src/sys/arch/mips/include/db_machdep.h:1.36
--- src/sys/arch/mips/include/db_machdep.h:1.35	Mon Mar 29 03:03:48 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:07:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.35 2021/03/29 03:03:48 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.36 2021/03/29 03:07:33 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -128,10 +128,15 @@ bool ddb_running_on_any_cpu_p(void);
 void db_resume_others(void);
 void db_mips_stack_trace(void *, void *, void (*pr)(const char *, ...));
 
-extern void (*cpu_reset_address)(void);
 
 #ifdef _KERNEL
 /*
+ * Optional function to perform machine- or cpu-specific reset.
+ * Called from ddb "machine reset".
+ */
+extern void (*cpu_reset_address)(void);
+
+/*
  * We have machine-dependent commands.
  */
 #define	DB_MACHINE_COMMANDS



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

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 03:03:48 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/include/db_machdep.h

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

Modified files:

Index: src/sys/arch/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.34 src/sys/arch/mips/include/db_machdep.h:1.35
--- src/sys/arch/mips/include/db_machdep.h:1.34	Wed Feb 10 07:19:54 2021
+++ src/sys/arch/mips/include/db_machdep.h	Mon Mar 29 03:03:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.34 2021/02/10 07:19:54 simonb Exp $ */
+/* $NetBSD: db_machdep.h,v 1.35 2021/03/29 03:03:48 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -83,11 +83,10 @@ extern db_regs_t	ddb_regs;	/* register s
 #define	IS_WATCHPOINT_TRAP(type, code)	(0)	/* XXX mips3 watchpoint */
 
 /*
- * Interface to  disassembly (shared with mdb)
+ * Interface to disassembly (shared with mdb)
  */
 db_addr_t	db_disasm_insn(int insn, db_addr_t loc, bool altfmt);
 
-
 /*
  * Entrypoints to DDB for kernel, keyboard drivers, init hook
  */



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

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 02:07:43 UTC 2021

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

Log Message:
Provide vm_offset_t and vm_size_t typedefs - used by dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.74 src/sys/arch/mips/include/types.h:1.75
--- src/sys/arch/mips/include/types.h:1.74	Sat Jan 23 19:38:53 2021
+++ src/sys/arch/mips/include/types.h	Mon Mar 29 02:07:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.74 2021/01/23 19:38:53 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.75 2021/03/29 02:07:43 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -98,6 +98,9 @@ typedef __uint32_t	vsize_t;
 #define	PRIdVSIZE	PRId32
 #endif
 
+typedef	vaddr_t	vm_offset_t;	/* deprecated (cddl/FreeBSD compat) */
+typedef	vsize_t	vm_size_t;	/* deprecated (cddl/FreeBSD compat) */
+
 
 typedef int		mips_prid_t;
 /* Make sure this is signed; we need pointers to be sign-extended. */



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

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:47:46 UTC 2021

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

Log Message:
Include #include  to get lwp_trapframe() definition.
Needed for dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/mips/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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.131 src/sys/arch/mips/include/cpu.h:1.132
--- src/sys/arch/mips/include/cpu.h:1.131	Mon Aug 17 03:19:35 2020
+++ src/sys/arch/mips/include/cpu.h	Mon Mar 29 01:47:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.131 2020/08/17 03:19:35 mrg Exp $	*/
+/*	$NetBSD: cpu.h,v 1.132 2021/03/29 01:47:45 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -53,6 +53,8 @@
 #include "opt_multiprocessor.h"
 #endif
 
+#include 
+
 #include 
 #include 
 #include 



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

2021-03-28 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Mar 29 01:46:26 UTC 2021

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

Log Message:
Add an lwp_trapframe() interface to return an LWP's user trapframe.
Needed by dtrace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/include/frame.h

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

Modified files:

Index: src/sys/arch/mips/include/frame.h
diff -u src/sys/arch/mips/include/frame.h:1.11 src/sys/arch/mips/include/frame.h:1.12
--- src/sys/arch/mips/include/frame.h:1.11	Wed Mar 24 05:35:05 2021
+++ src/sys/arch/mips/include/frame.h	Mon Mar 29 01:46:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.11 2021/03/24 05:35:05 simonb Exp $	*/
+/*	$NetBSD: frame.h,v 1.12 2021/03/29 01:46:26 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -42,6 +42,8 @@
 #include 
 
 void *getframe(struct lwp *, int, int *);
+#define	lwp_trapframe(l)	((l)->l_md.md_utf)
+
 #if defined(COMPAT_16) || defined(COMPAT_ULTRIX)
 void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
 #endif



CVS commit: src/sys/arch/mips/cavium/dev

2021-03-24 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Mar 24 08:10:14 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_fpa.c

Log Message:
Remove somewhat dubious empty octfpa_desc structure.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_fpa.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/mips/cavium/dev/octeon_fpa.c
diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.10
--- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9	Mon Jan  4 17:22:59 2021
+++ src/sys/arch/mips/cavium/dev/octeon_fpa.c	Wed Mar 24 08:10:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $	*/
+/*	$NetBSD: octeon_fpa.c,v 1.10 2021/03/24 08:10:14 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,7 +29,7 @@
 #undef	FPADEBUG
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.10 2021/03/24 08:10:14 simonb Exp $");
 
 #include 
 #include 
@@ -54,10 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c
 #define	_DMA_NSEGS	1
 #define	_DMA_BUFLEN	0x0100
 
-/* pool descriptor */
-struct octfpa_desc {
-};
-
 struct octfpa_softc {
 	int			sc_initialized;
 
@@ -68,8 +64,6 @@ struct octfpa_softc {
 	bus_space_handle_t	sc_opsh;
 
 	bus_dma_tag_t		sc_dmat;
-
-	struct octfpa_desc	sc_descs[8];
 };
 
 void			octfpa_bootstrap(struct octeon_config *);



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

2021-03-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Mar 24 05:35:06 UTC 2021

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

Log Message:
We don't really need a comment at the end of the file saying "this is
the end of the file".


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/frame.h

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

Modified files:

Index: src/sys/arch/mips/include/frame.h
diff -u src/sys/arch/mips/include/frame.h:1.10 src/sys/arch/mips/include/frame.h:1.11
--- src/sys/arch/mips/include/frame.h:1.10	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/frame.h	Wed Mar 24 05:35:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.10 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: frame.h,v 1.11 2021/03/24 05:35:05 simonb Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -49,5 +49,3 @@ void sendsig_sigcontext(const ksiginfo_t
 #endif /* _LOCORE */
 
 #endif /* _MIPS_FRAME_H_ */
-
-/* End of frame.h */



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

2021-03-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Mar 23 11:56:55 UTC 2021

Modified Files:
src/sys/arch/mips/include: Makefile.inc

Log Message:
Remove addition of -msym32 to CFLAGS. Hinders rather than helps build
MIPS modules.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/Makefile.inc

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/mips/include/Makefile.inc
diff -u src/sys/arch/mips/include/Makefile.inc:1.10 src/sys/arch/mips/include/Makefile.inc:1.11
--- src/sys/arch/mips/include/Makefile.inc:1.10	Thu Jun  9 05:43:51 2016
+++ src/sys/arch/mips/include/Makefile.inc	Tue Mar 23 11:56:55 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.10 2016/06/09 05:43:51 martin Exp $
+# $NetBSD: Makefile.inc,v 1.11 2021/03/23 11:56:55 simonb Exp $
 
 CFLAGS+=	-G 0 -ffixed-24
 
@@ -8,8 +8,4 @@ CFLAGS+=	-mno-abicalls
 AFLAGS+=	-mno-abicalls
 .endif
 
-.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
-CFLAGS+=	-msym32
-.endif
-
 AFLAGS+=	-x assembler-with-cpp ${AOPTS}



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

2021-03-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Mar 23 11:41:53 UTC 2021

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

Log Message:
Remove duplicate out-of-place comment.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/mips/conf/files.mips

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/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.81 src/sys/arch/mips/conf/files.mips:1.82
--- src/sys/arch/mips/conf/files.mips:1.81	Wed Oct 21 13:31:51 2020
+++ src/sys/arch/mips/conf/files.mips	Tue Mar 23 11:41:53 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mips,v 1.81 2020/10/21 13:31:51 christos Exp $
+#	$NetBSD: files.mips,v 1.82 2021/03/23 11:41:53 simonb Exp $
 #
 
 defflag	opt_cputype.h		NOFPU FPEMUL
@@ -106,8 +106,6 @@ file	arch/mips/mips/netbsd32_machdep_13.
 file	arch/mips/mips/netbsd32_machdep_16.c	compat_netbsd32 & compat_16
 include "compat/netbsd32/files.netbsd32"
 
-# Binary compatibility with previous NetBSD releases (COMPAT_XX)
-
 # Ultrix Binary Compatibility (COMPAT_ULTRIX)
 include "compat/ultrix/files.ultrix"
 



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

2021-03-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Mar 18 23:18:36 UTC 2021

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

Log Message:
Add PTRACE_ILLEGAL_ASM using the MIPS32r6/MIPS64r6 backwards and
forwards compatible "sigrie" instruction to generate a Reserved
Instruction trap.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/include/ptrace.h

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

Modified files:

Index: src/sys/arch/mips/include/ptrace.h
diff -u src/sys/arch/mips/include/ptrace.h:1.18 src/sys/arch/mips/include/ptrace.h:1.19
--- src/sys/arch/mips/include/ptrace.h:1.18	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/ptrace.h	Thu Mar 18 23:18:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.18 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.19 2021/03/18 23:18:36 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -67,6 +67,21 @@
 #define	PTRACE_REG_SP(r)	(r)->r_regs[29]
 #define	PTRACE_REG_INTRV(r)	(r)->r_regs[2]
 
+/*
+ * The sigrie is defined in the MIPS32r6 and MIPS64r6 specs to
+ * generate a Reserved Instruction trap but uses a previously
+ * reserved instruction encoding and is thus both backwards and
+ * forwards compatible.
+ */
+#define	PTRACE_ILLEGAL_ASM	do {	\
+		asm volatile(		\
+			".set	push;		"			\
+			".set	mips32r6;	"			\
+			"sigrie	0;		"			\
+			".set	pop;		"			\
+		);			\
+	} while (0);
+
 #define	PTRACE_BREAKPOINT	((const uint8_t[]) { 0x00, 0x00, 0x00, 0x0d })
 #define	PTRACE_BREAKPOINT_ASM	__asm __volatile("break")
 #define	PTRACE_BREAKPOINT_SIZE	4



CVS commit: src/sys/arch/mips

2021-03-17 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Mar 17 11:05:37 UTC 2021

Modified Files:
src/sys/arch/mips/include: cpuregs.h
src/sys/arch/mips/mips: trap.c

Log Message:
Handle gas/gcc generating a break/trap 6 for integer overflow and
break/trap 7 for integer divide by zero and setting the SIGFPE
si_code of FPE_INTOVF or FPE_INTDIV respectively.  The break/trap
6/7 seems to have existed since the early days of MIPS but not
well documented anywhere.

Fixes ATF lib/libc/gen/t_siginfo::sigfpe_int .


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.258 -r1.259 src/sys/arch/mips/mips/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/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.109 src/sys/arch/mips/include/cpuregs.h:1.110
--- src/sys/arch/mips/include/cpuregs.h:1.109	Sat Aug 22 03:41:33 2020
+++ src/sys/arch/mips/include/cpuregs.h	Wed Mar 17 11:05:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.109 2020/08/22 03:41:33 simonb Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.110 2021/03/17 11:05:37 simonb Exp $	*/
 
 /*
  * Copyright (c) 2009 Miodrag Vallat.
@@ -679,6 +679,8 @@
 #define	MIPS_BREAK_INSTR	0x000d
 #define	MIPS_BREAK_VAL_MASK	0x03ff
 #define	MIPS_BREAK_VAL_SHIFT	16
+#define	MIPS_BREAK_INTOVERFLOW	  6 /* used by gas to indicate int overflow */
+#define	MIPS_BREAK_INTDIVZERO	  7 /* used by gas/gcc to indicate int div by zero */
 #define	MIPS_BREAK_KDB_VAL	512
 #define	MIPS_BREAK_SSTEP_VAL	513
 #define	MIPS_BREAK_BRKPT_VAL	514

Index: src/sys/arch/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.258 src/sys/arch/mips/mips/trap.c:1.259
--- src/sys/arch/mips/mips/trap.c:1.258	Sat Mar 13 17:14:11 2021
+++ src/sys/arch/mips/mips/trap.c	Wed Mar 17 11:05:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.258 2021/03/13 17:14:11 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.258 2021/03/13 17:14:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.259 2021/03/17 11:05:37 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -159,7 +159,6 @@ void
 trap(uint32_t status, uint32_t cause, vaddr_t vaddr, vaddr_t pc,
 struct trapframe *tf)
 {
-	int type;
 	struct lwp * const l = curlwp;
 	struct proc * const p = curproc;
 	struct trapframe * const utf = l->l_md.md_utf;
@@ -168,6 +167,9 @@ trap(uint32_t status, uint32_t cause, va
 	ksiginfo_t ksi;
 	extern void fswintrberr(void);
 	void *onfault;
+	InstFmt insn;
+	uint32_t instr;
+	int type;
 	int rv = 0;
 
 	KSI_INIT_TRAP(&ksi);
@@ -547,21 +549,46 @@ trap(uint32_t status, uint32_t cause, va
 		goto dopanic;
 #endif
 	case T_BREAK+T_USER: {
-		uint32_t instr;
-
 		/* compute address of break instruction */
 		vaddr_t va = pc + (cause & MIPS_CR_BR_DELAY ? sizeof(int) : 0);
 
 		/* read break instruction */
 		instr = mips_ufetch32((void *)va);
+		insn.word = instr;
 
 		if (l->l_md.md_ss_addr != va || instr != MIPS_BREAK_SSTEP) {
+			bool advance_pc = false;
+
 			ksi.ksi_trap = type & ~T_USER;
 			ksi.ksi_signo = SIGTRAP;
 			ksi.ksi_addr = (void *)va;
 			ksi.ksi_code = TRAP_TRACE;
-			/* we broke, skip it to avoid infinite loop */
-			if (instr == MIPS_BREAK_INSTR)
+
+			if ((insn.JType.op == OP_SPECIAL) &&
+			(insn.RType.func == OP_BREAK)) {
+int code = (insn.RType.rs << 5) | insn.RType.rt;
+switch (code) {
+case 0:
+	/* we broke, skip it to avoid infinite loop */
+	advance_pc = true;
+	break;
+case MIPS_BREAK_INTOVERFLOW:
+	ksi.ksi_signo = SIGFPE;
+	ksi.ksi_code = FPE_INTOVF;
+	advance_pc = true;
+	break;
+case MIPS_BREAK_INTDIVZERO:
+	ksi.ksi_signo = SIGFPE;
+	ksi.ksi_code = FPE_INTDIV;
+	advance_pc = true;
+	break;
+default:
+	/* do nothing */
+	break;
+}
+			}
+
+			if (advance_pc)
 tf->tf_regs[_R_PC] += 4;
 			break;
 		}
@@ -627,12 +654,40 @@ trap(uint32_t status, uint32_t cause, va
 		userret(l);
 		return; /* GEN */
 	case T_OVFLOW+T_USER:
-	case T_TRAP+T_USER:
+	case T_TRAP+T_USER: {
+		/* compute address of trap/faulting instruction */
+		vaddr_t va = pc + (cause & MIPS_CR_BR_DELAY ? sizeof(int) : 0);
+		bool advance_pc = false;
+
+		/* read break instruction */
+		instr = mips_ufetch32((void *)va);
+		insn.word = instr;
+
 		ksi.ksi_trap = type & ~T_USER;
 		ksi.ksi_signo = SIGFPE;
 		ksi.ksi_addr = (void *)(intptr_t)pc /*utf->tf_regs[_R_PC]*/;
 		ksi.ksi_code = FPE_FLTOVF; /* XXX */
+
+		if ((insn.JType.op == OP_SPECIAL) &&
+		(insn.RType.func == OP_TEQ)) {
+			int code = (insn.RType.rd << 5) | insn.RType.shamt;
+			switch (code) {
+			case MIPS_BREAK_INTOVERFLOW:
+ksi.ksi_code = FPE_INTOVF;
+advance_p

CVS commit: src/sys/arch/mips/mips

2021-03-16 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Mar 16 07:34:44 UTC 2021

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

Log Message:
Disassemble TEQ correctly.

XXX: May be others that use this format?


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mips/mips/db_disasm.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_disasm.c
diff -u src/sys/arch/mips/mips/db_disasm.c:1.33 src/sys/arch/mips/mips/db_disasm.c:1.34
--- src/sys/arch/mips/mips/db_disasm.c:1.33	Mon Aug 17 03:14:08 2020
+++ src/sys/arch/mips/mips/db_disasm.c	Tue Mar 16 07:34:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.33 2020/08/17 03:14:08 mrg Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.33 2020/08/17 03:14:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.34 2021/03/16 07:34:44 simonb Exp $");
 
 #include 
 #include 
@@ -365,6 +365,13 @@ db_disasm_insn(int insn, db_addr_t loc, 
 			db_printf("\t%d", (i.RType.rs << 5) | i.RType.rt);
 			break;
 
+		case OP_TEQ:
+			db_printf("\t%s,%s,%#x",
+			reg_name[i.RType.rs],
+			reg_name[i.RType.rt],
+			(i.RType.rd << 5) | i.RType.shamt);
+			break;
+
 		default:
 			db_printf("\t%s,%s,%s",
 			reg_name[i.RType.rd],



CVS commit: src/sys/arch/mips/mips

2021-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  7 15:10:06 UTC 2021

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

Log Message:
add TRAP_SIGDEBUG support to mips.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.256 src/sys/arch/mips/mips/trap.c:1.257
--- src/sys/arch/mips/mips/trap.c:1.256	Sat Aug 15 03:42:07 2020
+++ src/sys/arch/mips/mips/trap.c	Sun Mar  7 10:10:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.256 2020/08/15 07:42:07 mrg Exp $	*/
+/*	$NetBSD: trap.c,v 1.257 2021/03/07 15:10:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.256 2020/08/15 07:42:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.257 2021/03/07 15:10:05 christos Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -120,6 +120,14 @@ const char * const trap_names[] = {
 void trap(uint32_t, uint32_t, vaddr_t, vaddr_t, struct trapframe *);
 void ast(void);
 
+#ifdef TRAP_SIGDEBUG
+static void sigdebug(const struct trapframe *, const ksiginfo_t *, int,
+vaddr_t);
+#define SIGDEBUG(a, b, c, d) sigdebug(a, b, c, d)
+#else
+#define SIGDEBUG(a, b, c, d)
+#endif
+
 /*
  * fork syscall returns directly to user process via lwp_trampoline(),
  * which will be called the very first time when child gets running.
@@ -160,7 +168,7 @@ trap(uint32_t status, uint32_t cause, va
 	ksiginfo_t ksi;
 	extern void fswintrberr(void);
 	void *onfault;
-	int rv;
+	int rv = 0;
 
 	KSI_INIT_TRAP(&ksi);
 
@@ -628,20 +636,7 @@ trap(uint32_t status, uint32_t cause, va
 	}
 	utf->tf_regs[_R_CAUSE] = cause;
 	utf->tf_regs[_R_BADVADDR] = vaddr;
-#if defined(DEBUG)
-	printf("trap: pid %d(%s): sig %d: cause=%#x epc=%#"PRIxREGISTER
-	" va=%#"PRIxVADDR"\n",
-	p->p_pid, p->p_comm, ksi.ksi_signo, cause,
-	utf->tf_regs[_R_PC], vaddr);
-	printf("registers:\n");
-	for (size_t i = 0; i < 32; i += 4) {
-		printf(
-		"[%2zu]=%08"PRIxREGISTER" [%2zu]=%08"PRIxREGISTER
-		" [%2zu]=%08"PRIxREGISTER" [%2zu]=%08"PRIxREGISTER "\n",
-		i+0, utf->tf_regs[i+0], i+1, utf->tf_regs[i+1],
-		i+2, utf->tf_regs[i+2], i+3, utf->tf_regs[i+3]);
-	}
-#endif
+	SIGDEBUG(utf, &ksi, rv, pc);
 	(*p->p_emul->e_trapsignal)(l, &ksi);
 	if ((type & T_USER) == 0) {
 #ifdef DDB
@@ -753,3 +748,64 @@ mips_singlestep(struct lwp *l)
 #endif
 	return 0;
 }
+
+#ifdef TRAP_SIGDEBUG
+static void
+frame_dump(const struct trapframe *tf, struct pcb *pcb)
+{
+
+	printf("trapframe %p\n", tf);
+	printf("ast %#018lx   v0 %#018lx   v1 %#018lx\n",
+	tf->tf_regs[_R_AST], tf->tf_regs[_R_V0], tf->tf_regs[_R_V1]);
+	printf(" a0 %#018lx   a1 %#018lx   a2 %#018lx\n",
+	tf->tf_regs[_R_A0], tf->tf_regs[_R_A1], tf->tf_regs[_R_A2]);
+#if defined(__mips_n32) || defined(__mips_n64)
+	printf(" a3 %#018lx   a4  %#018lx  a5  %#018lx\n",
+	tf->tf_regs[_R_A3], tf->tf_regs[_R_A4], tf->tf_regs[_R_A5]);
+	printf(" a6 %#018lx   a7  %#018lx  t0  %#018lx\n",
+	tf->tf_regs[_R_A6], tf->tf_regs[_R_A7], tf->tf_regs[_R_T0]);
+	printf(" t1 %#018lx   t2  %#018lx  t3  %#018lx\n",
+	tf->tf_regs[_R_T1], tf->tf_regs[_R_T2], tf->tf_regs[_R_T3]);
+#else
+	printf(" a3 %#018lx   t0  %#018lx  t1  %#018lx\n",
+	tf->tf_regs[_R_A3], tf->tf_regs[_R_T0], tf->tf_regs[_R_T1]);
+	printf(" t2 %#018lx   t3  %#018lx  t4  %#018lx\n",
+	tf->tf_regs[_R_T2], tf->tf_regs[_R_T3], tf->tf_regs[_R_T4]);
+	printf(" t5 %#018lx   t6  %#018lx  t7  %#018lx\n",
+	tf->tf_regs[_R_T5], tf->tf_regs[_R_T6], tf->tf_regs[_R_T7]);
+#endif
+	printf(" s0 %#018lx   s1  %#018lx  s2  %#018lx\n",
+	tf->tf_regs[_R_S0], tf->tf_regs[_R_S1], tf->tf_regs[_R_S2]);
+	printf(" s3 %#018lx   s4  %#018lx  s5  %#018lx\n",
+	tf->tf_regs[_R_S3], tf->tf_regs[_R_S4], tf->tf_regs[_R_S5]);
+	printf(" s6 %#018lx   s7  %#018lx  t8  %#018lx\n",
+	tf->tf_regs[_R_S6], tf->tf_regs[_R_S7], tf->tf_regs[_R_T8]);
+	printf(" t9 %#018lx   k0  %#018lx  k1  %#018lx\n",
+	tf->tf_regs[_R_T9], tf->tf_regs[_R_K0], tf->tf_regs[_R_K1]);
+	printf(" gp %#018lx   sp  %#018lx  s8  %#018lx\n",
+	tf->tf_regs[_R_GP], tf->tf_regs[_R_SP], tf->tf_regs[_R_S8]);
+	printf(" ra %#018lx   sr  %#018lx  pc  %#018lx\n",
+	tf->tf_regs[_R_RA], tf->tf_regs[_R_SR], tf->tf_regs[_R_PC]);
+	printf(" mullo %#018lx mulhi %#018lx\n",
+	tf->tf_regs[_R_MULLO], tf->tf_regs[_R_MULHI]);
+	printf(" badvaddr  %#018lx cause %#018lx\n",
+	tf->tf_regs[_R_BADVADDR], tf->tf_regs[_R_CAUSE]);
+	printf("\n");
+	hexdump(printf, "Stack dump", tf, 256);
+}
+
+static void
+sigdebug(const struct trapframe *tf, const ksiginfo_t *ksi, int e,
+vaddr_t pc)
+{
+	struct lwp *l = curlwp;
+	struct proc *p = l->l_proc;
+
+	printf("pid %d.%d (%s): signal %d 

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

2021-03-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar  2 08:16:53 UTC 2021

Modified Files:
src/sys/arch/mips/include: locore.h

Log Message:
Ensure the "memory" clobber is on inline assembly store operations

No binary change of note with this change in MALTA32


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/mips/include/locore.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.116 src/sys/arch/mips/include/locore.h:1.117
--- src/sys/arch/mips/include/locore.h:1.116	Sat Aug 22 09:08:21 2020
+++ src/sys/arch/mips/include/locore.h	Tue Mar  2 08:16:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.116 2020/08/22 09:08:21 simonb Exp $ */
+/* $NetBSD: locore.h,v 1.117 2021/03/02 08:16:52 skrll Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -539,7 +539,7 @@ static inline void
 mips_sb(register_t addr, uint8_t val)
 {
 #if defined(__mips_n32)
-	__asm volatile("sb\t%1, 0(%0)" :: "d"(addr), "r"(val));
+	__asm volatile("sb\t%1, 0(%0)" :: "d"(addr), "r"(val) : "memory");
 #else
 	*(volatile uint8_t *)addr = val;
 #endif
@@ -549,7 +549,7 @@ static inline void
 mips_sh(register_t addr, uint16_t val)
 {
 #if defined(__mips_n32)
-	__asm volatile("sh\t%1, 0(%0)" :: "d"(addr), "r"(val));
+	__asm volatile("sh\t%1, 0(%0)" :: "d"(addr), "r"(val) : "memory");
 #else
 	*(volatile uint16_t *)addr = val;
 #endif
@@ -559,7 +559,7 @@ static inline void
 mips_sw(register_t addr, uint32_t val)
 {
 #if defined(__mips_n32)
-	__asm volatile("sw\t%1, 0(%0)" :: "d"(addr), "r"(val));
+	__asm volatile("sw\t%1, 0(%0)" :: "d"(addr), "r"(val) : "memory");
 #else
 	*(volatile uint32_t *)addr = val;
 #endif
@@ -570,7 +570,7 @@ static inline void
 mips3_sd(register_t addr, uint64_t val)
 {
 #if defined(__mips_n32)
-	__asm volatile("sd\t%1, 0(%0)" :: "d"(addr), "r"(val));
+	__asm volatile("sd\t%1, 0(%0)" :: "d"(addr), "r"(val) : "memory");
 #else
 	*(volatile uint64_t *)addr = val;
 #endif



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

2021-02-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb 18 20:37:02 UTC 2021

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

Log Message:
Revert previous... somehow the register names aren't available apparently


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

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

Modified files:

Index: src/sys/arch/mips/include/profile.h
diff -u src/sys/arch/mips/include/profile.h:1.24 src/sys/arch/mips/include/profile.h:1.25
--- src/sys/arch/mips/include/profile.h:1.24	Wed Feb 17 08:09:22 2021
+++ src/sys/arch/mips/include/profile.h	Thu Feb 18 20:37:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.24 2021/02/17 08:09:22 skrll Exp $	*/
+/*	$NetBSD: profile.h,v 1.25 2021/02/18 20:37:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@
 #ifdef _KERNEL
 # define _PROF_CPLOAD	""
 #else
-# define _PROF_CPLOAD	".cpload t9;"
+# define _PROF_CPLOAD	".cpload $25;"
 #endif
 
 



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

2021-02-18 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Feb 18 12:28:02 UTC 2021

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
Add an abicalls version of asm mcount prologue.  XXX not tested because
profiled programs fail to link, but fixes build.  Thanks dholland@ for
help analysing this.

While here, rename _KERN_MCOUNT to _MIPS_ASM_MCOUNT - it's not kernel
specific.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.64 src/sys/arch/mips/include/asm.h:1.65
--- src/sys/arch/mips/include/asm.h:1.64	Tue Feb 16 06:06:58 2021
+++ src/sys/arch/mips/include/asm.h	Thu Feb 18 12:28:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.64 2021/02/16 06:06:58 simonb Exp $	*/
+/*	$NetBSD: asm.h,v 1.65 2021/02/18 12:28:01 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -76,9 +76,9 @@
 /*
  * The old ABI version must also decrement two less words off the
  * stack and the final addiu to t9 must always equal the size of this
- * _KERN_MCOUNT.
+ * _MIPS_ASM_MCOUNT.
  */
-#define	_KERN_MCOUNT		\
+#define	_MIPS_ASM_MCOUNT	\
 	.set	push;		\
 	.set	noreorder;	\
 	.set	noat;		\
@@ -98,9 +98,25 @@
 #else/* New (n32/n64) ABI */
 /*
  * The new ABI version just needs to put the return address in AT and
- * call _mcount().
+ * call _mcount().  For the no abicalls case, skip the reloc dance.
  */
-#define	_KERN_MCOUNT		\
+#ifdef __mips_abicalls
+#define	_MIPS_ASM_MCOUNT	\
+	.set	push;		\
+	.set	noreorder;	\
+	.set	noat;		\
+	subu	sp,16;		\
+	sw	t9,8(sp);	\
+	move	AT,ra;		\
+	lui	t9,%hi(_mcount); \
+	addiu	t9,t9,%lo(_mcount);\
+	jalr	t9;		\
+	 nop;			\
+	lw	t9,8(sp);	\
+	addiu	sp,16;		\
+	.set	pop;
+#else /* !__mips_abicalls */
+#define	_MIPS_ASM_MCOUNT	\
 	.set	push;		\
 	.set	noreorder;	\
 	.set	noat;		\
@@ -108,10 +124,11 @@
 	jal	_mcount;	\
 	 nop;			\
 	.set	pop;
+#endif /* !__mips_abicalls */
 #endif /* n32/n64 */
 
 #ifdef GPROF
-#define	MCOUNT _KERN_MCOUNT
+#define	MCOUNT _MIPS_ASM_MCOUNT
 #else
 #define	MCOUNT
 #endif



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

2021-02-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb 17 08:09:22 UTC 2021

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

Log Message:
Use the register name and not its number in _PROF_CPLOAD.

"yes please!" from simon@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mips/include/profile.h

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

Modified files:

Index: src/sys/arch/mips/include/profile.h
diff -u src/sys/arch/mips/include/profile.h:1.23 src/sys/arch/mips/include/profile.h:1.24
--- src/sys/arch/mips/include/profile.h:1.23	Tue Feb 16 06:06:58 2021
+++ src/sys/arch/mips/include/profile.h	Wed Feb 17 08:09:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.23 2021/02/16 06:06:58 simonb Exp $	*/
+/*	$NetBSD: profile.h,v 1.24 2021/02/17 08:09:22 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@
 #ifdef _KERNEL
 # define _PROF_CPLOAD	""
 #else
-# define _PROF_CPLOAD	".cpload $25;"
+# define _PROF_CPLOAD	".cpload t9;"
 #endif
 
 



CVS commit: src/sys/arch/mips

2021-02-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Feb 16 06:06:58 UTC 2021

Modified Files:
src/sys/arch/mips/include: asm.h profile.h
src/sys/arch/mips/mips: mipsX_subr.S mips_fixup.c

Log Message:
Working kernel profiling for n32/n64:
 - Different MCOUNT and _KERN_MCOUNT macros for n32/n64.
 - Don't profile mipsXX_lwp_trampoline().
 - Allow a few new instructions in the stub fixups.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/mips/include/asm.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/include/profile.h
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/mips/mips/mipsX_subr.S
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mips/mips/mips_fixup.c

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

Modified files:

Index: src/sys/arch/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.63 src/sys/arch/mips/include/asm.h:1.64
--- src/sys/arch/mips/include/asm.h:1.63	Thu Feb  4 08:51:42 2021
+++ src/sys/arch/mips/include/asm.h	Tue Feb 16 06:06:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.63 2021/02/04 08:51:42 skrll Exp $	*/
+/*	$NetBSD: asm.h,v 1.64 2021/02/16 06:06:58 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,6 +57,10 @@
 #include 		/* for API selection */
 #include 
 
+#if defined(_KERNEL_OPT)
+#include "opt_gprof.h"
+#endif
+
 #define	__BIT(n)	(1 << (n))
 #define	__BITS(hi,lo)	((~((~0)<<((hi)+1)))&((~0)<<(lo)))
 
@@ -66,24 +70,45 @@
 
 /*
  * Define -pg profile entry code.
- * Must always be noreorder, must never use a macro instruction
- * Final addiu to t9 must always equal the size of this _KERN_MCOUNT
+ * Must always be noreorder, must never use a macro instruction.
+ */
+#if defined(__mips_o32)		/* Old 32-bit ABI */
+/*
+ * The old ABI version must also decrement two less words off the
+ * stack and the final addiu to t9 must always equal the size of this
+ * _KERN_MCOUNT.
  */
 #define	_KERN_MCOUNT		\
 	.set	push;		\
 	.set	noreorder;	\
 	.set	noat;		\
-	subu	sp,sp,16;	\
+	subu	sp,16;		\
 	sw	t9,12(sp);	\
 	move	AT,ra;		\
 	lui	t9,%hi(_mcount); \
 	addiu	t9,t9,%lo(_mcount);\
 	jalr	t9;		\
-	nop;			\
+	 nop;			\
 	lw	t9,4(sp);	\
-	addiu	sp,sp,8;	\
-	addiu	t9,t9,40;	\
+	addiu	sp,8;		\
+	addiu	t9,40;		\
+	.set	pop;
+#elif defined(__mips_o64)	/* Old 64-bit ABI */
+# error yeahnah
+#else/* New (n32/n64) ABI */
+/*
+ * The new ABI version just needs to put the return address in AT and
+ * call _mcount().
+ */
+#define	_KERN_MCOUNT		\
+	.set	push;		\
+	.set	noreorder;	\
+	.set	noat;		\
+	move	AT,ra;		\
+	jal	_mcount;	\
+	 nop;			\
 	.set	pop;
+#endif /* n32/n64 */
 
 #ifdef GPROF
 #define	MCOUNT _KERN_MCOUNT

Index: src/sys/arch/mips/include/profile.h
diff -u src/sys/arch/mips/include/profile.h:1.22 src/sys/arch/mips/include/profile.h:1.23
--- src/sys/arch/mips/include/profile.h:1.22	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/profile.h	Tue Feb 16 06:06:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: profile.h,v 1.22 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: profile.h,v 1.23 2021/02/16 06:06:58 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -37,6 +37,10 @@
 #ifndef _MIPS_PROFILE_H_
 #define	_MIPS_PROFILE_H_
 
+#if defined(_KERNEL_OPT)
+#include "opt_gprof.h"
+#endif
+
 #ifdef _KERNEL
  /*
   *  Declare non-profiled _splhigh() /_splx() entrypoints for _mcount.
@@ -61,35 +65,78 @@
 _KERNEL_MCOUNT_DECL \
 void __attribute__((unused)) __mcount
 
+#ifdef __mips_o32	/* 32-bit version */
+#define	MCOUNT \
+	__asm(".globl _mcount;" \
+	  ".type _mcount,@function;" \
+	  "_mcount:;" \
+	  ".set noreorder;" \
+	  ".set noat;" \
+	  _PROF_CPLOAD \
+	  "addu $29,$29,-16;" \
+	  "sw $4,8($29);" \
+	  "sw $5,12($29);" \
+	  "sw $6,16($29);" \
+	  "sw $7,20($29);" \
+	  "sw $1,0($29);" \
+	  "sw $31,4($29);" \
+	  "move $5,$31;" \
+	  "move $4,$1;" \
+	  "jal __mcount;" \
+	  " nop;" \
+	  "lw $4,8($29);" \
+	  "lw $5,12($29);" \
+	  "lw $6,16($29);" \
+	  "lw $7,20($29);" \
+	  "lw $31,4($29);" \
+	  "lw $1,0($29);" \
+	  "addu $29,$29,24;" \
+	  "j $31;" \
+	  " move $31,$1;" \
+	  ".set reorder;" \
+	  ".set at");
+#else /* 64-bit */
+#ifdef __mips_o64
+# error yeahnah
+#endif
 #define	MCOUNT \
 	__asm(".globl _mcount;" \
-	".type _mcount,@function;" \
-	"_mcount:;" \
-	".set noreorder;" \
-	".set noat;" \
-	_PROF_CPLOAD \
-	"addu $29,$29,-16;" \
-	"sw $4,8($29);" \
-	"sw $5,12($29);" \
-	"sw $6,16($29);" \
-	"sw $7,20($29);" \
-	"sw $1,0($29);" \
-	"sw $31,4($29);" \
-	"move $5,$31;" \
-	"move $4,$1;" \
-	"jal __mcount;" \
-	"nop;" \
-	"lw $4,8($29);" \
-	"lw $5,12($29);" \
-	"lw $6,16($29);" \
-	"lw $7,20($29);" \
-	"lw $31,4($29);" \
-	"lw $1,0($29);" \
-	"addu $29,$29,24;" \
-	"j $31;" \
-	"move $31,$1;" \
-	".set reorder;" \
-	".set at");
+	  ".

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

2021-02-15 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Feb 16 05:11:27 UTC 2021

Modified Files:
src/sys/arch/mips/include: intr.h

Log Message:
Add no-profiled attribute for splhigh_noprof() and splx_noprof().


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/include/intr.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/mips/include/intr.h
diff -u src/sys/arch/mips/include/intr.h:1.12 src/sys/arch/mips/include/intr.h:1.13
--- src/sys/arch/mips/include/intr.h:1.12	Mon Aug 17 14:17:49 2020
+++ src/sys/arch/mips/include/intr.h	Tue Feb 16 05:11:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.12 2020/08/17 14:17:49 skrll Exp $ */
+/* $NetBSD: intr.h,v 1.13 2021/02/16 05:11:26 simonb Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@ extern	struct ipl_sr_map ipl_sr_map;
 #endif /* __INTR_PRIVATE */
 
 int	splhigh(void);
-int	splhigh_noprof(void);
+int	__noprofile splhigh_noprof(void);
 int	splsched(void);
 int	splvm(void);
 int	splsoftserial(void);
@@ -134,7 +134,7 @@ int	splsoftbio(void);
 int	splsoftclock(void);
 int	splraise(int);
 void	splx(int);
-void	splx_noprof(int);
+void	__noprofile splx_noprof(int);
 void	spl0(void);
 int	splintr(uint32_t *);
 void	_setsoftintr(uint32_t);



CVS commit: src/sys/arch/mips

2021-02-09 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Feb 10 07:19:54 UTC 2021

Modified Files:
src/sys/arch/mips/include: db_machdep.h
src/sys/arch/mips/mips: db_trace.c

Log Message:
On MIPS use a helper function to work out the current PC and then
call stacktrace_subr() directly for displaying a stacktrace with
db_stacktrace() and friends.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mips/include/db_machdep.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mips/mips/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/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.33 src/sys/arch/mips/include/db_machdep.h:1.34
--- src/sys/arch/mips/include/db_machdep.h:1.33	Mon Aug 17 03:19:35 2020
+++ src/sys/arch/mips/include/db_machdep.h	Wed Feb 10 07:19:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.33 2020/08/17 03:19:35 mrg Exp $ */
+/* $NetBSD: db_machdep.h,v 1.34 2021/02/10 07:19:54 simonb Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -127,6 +127,7 @@ db_addr_t next_instr_address(db_addr_t p
 bool ddb_running_on_this_cpu_p(void);
 bool ddb_running_on_any_cpu_p(void);
 void db_resume_others(void);
+void db_mips_stack_trace(void *, void *, void (*pr)(const char *, ...));
 
 extern void (*cpu_reset_address)(void);
 
@@ -137,4 +138,8 @@ extern void (*cpu_reset_address)(void);
 #define	DB_MACHINE_COMMANDS
 #endif
 
+#define	db_stacktrace_print(prfunc) \
+db_mips_stack_trace(__builtin_return_address(0), \
+	__builtin_frame_address(0), prfunc)
+
 #endif	/* _MIPS_DB_MACHDEP_H_ */

Index: src/sys/arch/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.49 src/sys/arch/mips/mips/db_trace.c:1.50
--- src/sys/arch/mips/mips/db_trace.c:1.49	Tue Feb  9 13:28:47 2021
+++ src/sys/arch/mips/mips/db_trace.c	Wed Feb 10 07:19:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.49 2021/02/09 13:28:47 simonb Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.50 2021/02/10 07:19:54 simonb Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.49 2021/02/09 13:28:47 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.50 2021/02/10 07:19:54 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -74,10 +74,6 @@ db_sym_t localsym(db_sym_t sym, bool isr
  */
 struct mips_saved_state *db_cur_exc_frame = 0;
 
-/*
- * Stack trace helper.
- */
-void db_mips_stack_trace(int, vaddr_t, vaddr_t, vaddr_t, int, vaddr_t);
 int db_mips_variable_func(const struct db_variable *, db_expr_t *, int);
 
 #define DB_SETF_REGS db_mips_variable_func
@@ -289,12 +285,24 @@ db_stack_trace_print(db_expr_t addr, boo
 #endif
 }
 
+/*
+ * Helper function for db_stacktrace() and friends, used to get the
+ * pc via the return address.
+ */
 void
-db_mips_stack_trace(int count, vaddr_t stackp, vaddr_t the_pc, vaddr_t the_ra,
-int flags, vaddr_t kstackp)
+db_mips_stack_trace(void *ra, void *fp, void (*pr)(const char *, ...))
 {
+	vaddr_t pc;
 
-	/* nothing... */
+	/*
+	 * The jal instruction for our caller is two insns before the
+	 * return address.
+	 */
+	pc = (vaddr_t)__builtin_return_address(0) - sizeof(uint32_t) * 2;
+
+	stacktrace_subr(0, 0, 0, 0,	/* no args known */
+	pc, (intptr_t)fp, (intptr_t)fp, (intptr_t)ra,
+	pr);
 }
 
 int



CVS commit: src/sys/arch/mips/mips

2021-02-09 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Feb  9 13:28:47 UTC 2021

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

Log Message:
Remove a macro that has never been used.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/mips/mips/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/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.48 src/sys/arch/mips/mips/db_trace.c:1.49
--- src/sys/arch/mips/mips/db_trace.c:1.48	Tue Feb  9 13:26:25 2021
+++ src/sys/arch/mips/mips/db_trace.c	Tue Feb  9 13:28:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.48 2021/02/09 13:26:25 simonb Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.49 2021/02/09 13:28:47 simonb Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.48 2021/02/09 13:26:25 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.49 2021/02/09 13:28:47 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -81,7 +81,6 @@ void db_mips_stack_trace(int, vaddr_t, v
 int db_mips_variable_func(const struct db_variable *, db_expr_t *, int);
 
 #define DB_SETF_REGS db_mips_variable_func
-#define DBREGS_REG()
 
 const struct db_variable db_regs[] = {
 	{ "at",	(long *)&ddb_regs.r_regs[_R_AST],  DB_SETF_REGS, NULL },



CVS commit: src/sys/arch/mips/mips

2021-02-09 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Feb  9 13:26:25 UTC 2021

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

Log Message:
Trailing whitespace, remove extra blank line.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/mips/mips/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/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.47 src/sys/arch/mips/mips/db_trace.c:1.48
--- src/sys/arch/mips/mips/db_trace.c:1.47	Sat Sep 26 20:38:27 2020
+++ src/sys/arch/mips/mips/db_trace.c	Tue Feb  9 13:26:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.48 2021/02/09 13:26:25 simonb Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.48 2021/02/09 13:26:25 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -182,7 +182,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		struct lwp lstore;
 
 		db_read_bytes(addr, sizeof(lstore), (char *)&lstore);
-		db_read_bytes((db_addr_t)lstore.l_proc, sizeof(pstore), 
+		db_read_bytes((db_addr_t)lstore.l_proc, sizeof(pstore),
 		(char *)&pstore);
 		(*pr)("pid %d.%d ", pstore.p_pid, lstore.l_lid);
 		pcb = lwp_getpcb(&lstore);
@@ -198,7 +198,7 @@ db_stack_trace_print(db_expr_t addr, boo
 		if (p == NULL) {
 			(*pr)("not found\n");
 			return;
-		}	
+		}
 		l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
 		pcb = lwp_getpcb(l);
 #else
@@ -298,9 +298,8 @@ db_mips_stack_trace(int count, vaddr_t s
 	/* nothing... */
 }
 
-
 int
-db_mips_variable_func (const struct db_variable *vp, db_expr_t *valuep,
+db_mips_variable_func(const struct db_variable *vp, db_expr_t *valuep,
 int db_var_fcn)
 {
 



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

2021-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Feb  4 08:51:42 UTC 2021

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
Use t9 instead of $25 in the SETUP_GP64 macro to hopefully make things
a bit clearer.  Same libc binary after.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.62 src/sys/arch/mips/include/asm.h:1.63
--- src/sys/arch/mips/include/asm.h:1.62	Sat Sep 26 08:19:11 2020
+++ src/sys/arch/mips/include/asm.h	Thu Feb  4 08:51:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.62 2020/09/26 08:19:11 simonb Exp $	*/
+/*	$NetBSD: asm.h,v 1.63 2021/02/04 08:51:42 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -619,7 +619,7 @@ _C_LABEL(x):
 #define	SETUP_GPX(r)		/* o32 specific */
 #define	SETUP_GPX_L(r,lbl)	/* o32 specific */
 #define	SAVE_GP(x)		/* o32 specific */
-#define	SETUP_GP64(a,b)		.cpsetup $25, a, b
+#define	SETUP_GP64(a,b)		.cpsetup t9, a, b
 #define	SETUP_GPX64(a,b)	\
 .set push;			\
 move	b,ra;			\



CVS commit: src/sys/arch/mips/mips

2021-01-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan  7 17:28:20 UTC 2021

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

Log Message:
Fix build for non-_MIPS_NEED_BUS_DMA_BOUNCE platforms


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/mips/mips/bus_dma.c

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

Modified files:

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.43 src/sys/arch/mips/mips/bus_dma.c:1.44
--- src/sys/arch/mips/mips/bus_dma.c:1.43	Mon Jan  4 18:09:01 2021
+++ src/sys/arch/mips/mips/bus_dma.c	Thu Jan  7 17:28:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.43 2021/01/04 18:09:01 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.44 2021/01/07 17:28:20 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.43 2021/01/04 18:09:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.44 2021/01/07 17:28:20 skrll Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -293,6 +293,7 @@ _bus_dmamap_mapsize(int const nsegments)
 	(sizeof(bus_dma_segment_t) * (nsegments - 1));
 }
 
+#ifdef _MIPS_NEED_BUS_DMA_BOUNCE
 static size_t
 _bus_dmamap_cookiesize(int const nsegments)
 {
@@ -300,6 +301,7 @@ _bus_dmamap_cookiesize(int const nsegmen
 	return sizeof(struct mips_bus_dma_cookie) +
 	(sizeof(bus_dma_segment_t) * nsegments);
 }
+#endif
 
 /*
  * Common function for DMA map creation.  May be called by bus-specific



CVS commit: src/sys/arch/mips/adm5120/dev

2021-01-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan  5 16:30:37 UTC 2021

Modified Files:
src/sys/arch/mips/adm5120/dev: ahci.c

Log Message:
Misc KNF.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/adm5120/dev/ahci.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/mips/adm5120/dev/ahci.c
diff -u src/sys/arch/mips/adm5120/dev/ahci.c:1.22 src/sys/arch/mips/adm5120/dev/ahci.c:1.23
--- src/sys/arch/mips/adm5120/dev/ahci.c:1.22	Sun Apr  5 20:59:38 2020
+++ src/sys/arch/mips/adm5120/dev/ahci.c	Tue Jan  5 16:30:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahci.c,v 1.22 2020/04/05 20:59:38 skrll Exp $	*/
+/*	$NetBSD: ahci.c,v 1.23 2021/01/05 16:30:37 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.22 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.23 2021/01/05 16:30:37 skrll Exp $");
 
 #include 
 #include 
@@ -889,7 +889,7 @@ ahci_device_ctrl_start(struct usbd_xfer 
 	ep->control =  pipe->up_dev->ud_addr | \
 		((pipe->up_dev->ud_speed==USB_SPEED_FULL)?ADMHCD_ED_SPEED:0) | \
 		((UGETW(pipe->up_endpoint->ue_edesc->wMaxPacketSize))up_dev->ud_speed);
@@ -1236,16 +1236,17 @@ ahci_device_bulk_start(struct usbd_xfer 
 
 	i = 0;
 	offset = 0;
-	while ((len>0) || (i==0)) {
+	while (len > 0) || i == 0) {
 		tlen = uimin(len,4096);
-		td[i]->buffer = DMAADDR(&xfer->ux_dmabuf,offset) | 0xa000;
-		td[i]->buflen=tlen;
-		td[i]->control=(isread?ADMHCD_TD_IN:ADMHCD_TD_OUT) | toggle | ADMHCD_TD_OWN | short_ok;
-		td[i]->len=tlen;
+		td[i]->buffer = DMAADDR(&xfer->ux_dmabuf, offset) | 0xa000;
+		td[i]->buflen = tlen;
+		td[i]->control = (isread ? ADMHCD_TD_IN : ADMHCD_TD_OUT) |
+		toggle | ADMHCD_TD_OWN | short_ok;
+		td[i]->len = tlen;
 		toggle = ADMHCD_TD_TOGGLE;
 		len -= tlen;
 		offset += tlen;
-		td[i]->next = td[i+1];
+		td[i]->next = td[i + 1];
 		i++;
 	};
 



CVS commit: src/sys/arch/mips/sibyte/dev

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 18:19:53 UTC 2021

Modified Files:
src/sys/arch/mips/sibyte/dev: sbjcn.c sbscn.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mips/sibyte/dev/sbjcn.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/mips/sibyte/dev/sbscn.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/mips/sibyte/dev/sbjcn.c
diff -u src/sys/arch/mips/sibyte/dev/sbjcn.c:1.31 src/sys/arch/mips/sibyte/dev/sbjcn.c:1.32
--- src/sys/arch/mips/sibyte/dev/sbjcn.c:1.31	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mips/sibyte/dev/sbjcn.c	Mon Jan  4 18:19:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sbjcn.c,v 1.31 2019/11/10 21:16:30 chs Exp $ */
+/* $NetBSD: sbjcn.c,v 1.32 2021/01/04 18:19:53 thorpej Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.31 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.32 2021/01/04 18:19:53 thorpej Exp $");
 
 #define	SBJCN_DEBUG
 
@@ -123,7 +123,7 @@ __KERNEL_RCSID(0, "$NetBSD: sbjcn.c,v 1.
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -322,7 +322,7 @@ sbjcn_attach_channel(struct sbjcn_softc 
 	tp->t_hwiflow = sbjcn_hwiflow;
 
 	ch->ch_tty = tp;
-	ch->ch_rbuf = malloc(sbjcn_rbuf_size << 1, M_DEVBUF, M_WAITOK);
+	ch->ch_rbuf = kmem_alloc(sbjcn_rbuf_size << 1, KM_SLEEP);
 	ch->ch_ebuf = ch->ch_rbuf + (sbjcn_rbuf_size << 1);
 
 	tty_attach(tp);

Index: src/sys/arch/mips/sibyte/dev/sbscn.c
diff -u src/sys/arch/mips/sibyte/dev/sbscn.c:1.44 src/sys/arch/mips/sibyte/dev/sbscn.c:1.45
--- src/sys/arch/mips/sibyte/dev/sbscn.c:1.44	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mips/sibyte/dev/sbscn.c	Mon Jan  4 18:19:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscn.c,v 1.44 2019/11/10 21:16:30 chs Exp $ */
+/* $NetBSD: sbscn.c,v 1.45 2021/01/04 18:19:53 thorpej Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -109,7 +109,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.44 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.45 2021/01/04 18:19:53 thorpej Exp $");
 
 #define	SBSCN_DEBUG
 
@@ -133,7 +133,7 @@ __KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -352,7 +352,7 @@ sbscn_attach_channel(struct sbscn_softc 
 	tp->t_hwiflow = sbscn_hwiflow;
 
 	ch->ch_tty = tp;
-	ch->ch_rbuf = malloc(sbscn_rbuf_size << 1, M_DEVBUF, M_WAITOK);
+	ch->ch_rbuf = kmem_alloc(sbscn_rbuf_size << 1, KM_SLEEP);
 	ch->ch_ebuf = ch->ch_rbuf + (sbscn_rbuf_size << 1);
 
 	tty_attach(tp);



CVS commit: src/sys/arch/mips/ralink

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 18:14:38 UTC 2021

Modified Files:
src/sys/arch/mips/ralink: ralink_intr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/ralink/ralink_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/mips/ralink/ralink_intr.c
diff -u src/sys/arch/mips/ralink/ralink_intr.c:1.6 src/sys/arch/mips/ralink/ralink_intr.c:1.7
--- src/sys/arch/mips/ralink/ralink_intr.c:1.6	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mips/ralink/ralink_intr.c	Mon Jan  4 18:14:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ralink_intr.c,v 1.6 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: ralink_intr.c,v 1.7 2021/01/04 18:14:38 thorpej Exp $	*/
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -29,14 +29,14 @@
 #define __INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ralink_intr.c,v 1.6 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ralink_intr.c,v 1.7 2021/01/04 18:14:38 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -267,7 +267,7 @@ ra_intr_establish(int intr, int (*func)(
 {
 	struct evbmips_intrhand *ih;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = intr;
@@ -310,7 +310,7 @@ ra_intr_disestablish(void *arg)
 
 	splx(s);
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 /*



CVS commit: src/sys/arch/mips/adm5120

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 18:11:26 UTC 2021

Modified Files:
src/sys/arch/mips/adm5120: adm5120_intr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/adm5120/adm5120_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/mips/adm5120/adm5120_intr.c
diff -u src/sys/arch/mips/adm5120/adm5120_intr.c:1.8 src/sys/arch/mips/adm5120/adm5120_intr.c:1.9
--- src/sys/arch/mips/adm5120/adm5120_intr.c:1.8	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/adm5120/adm5120_intr.c	Mon Jan  4 18:11:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: adm5120_intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $	*/
+/*	$NetBSD: adm5120_intr.c,v 1.9 2021/01/04 18:11:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -67,14 +67,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm5120_intr.c,v 1.8 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm5120_intr.c,v 1.9 2021/01/04 18:11:26 thorpej Exp $");
 
 #include "opt_ddb.h"
 #define __INTR_PRIVATE
 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -191,7 +191,7 @@ adm5120_intr_establish(int irq, int prio
 	if (irq < 0 || irq >= NIRQS)
 		panic("adm5120_intr_establish: bogus IRQ %d", irq);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -259,7 +259,7 @@ adm5120_intr_disestablish(void *cookie)
 
 	splx(s);
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 void
 evbmips_iointr(int ipl, uint32_t ipending, struct clockframe *cf)



CVS commit: src/sys/arch/mips/mips

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

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

Log Message:
malloc(9) -> kmem(9)


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

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

Modified files:

Index: src/sys/arch/mips/mips/bus_dma.c
diff -u src/sys/arch/mips/mips/bus_dma.c:1.42 src/sys/arch/mips/mips/bus_dma.c:1.43
--- src/sys/arch/mips/mips/bus_dma.c:1.42	Thu Jul 16 13:32:05 2020
+++ src/sys/arch/mips/mips/bus_dma.c	Mon Jan  4 18:09:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.42 2020/07/16 13:32:05 simonb Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.43 2021/01/04 18:09:01 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.42 2020/07/16 13:32:05 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.43 2021/01/04 18:09:01 thorpej Exp $");
 
 #define _MIPS_BUS_DMA_PRIVATE
 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -285,6 +285,22 @@ _bus_dma_load_bouncebuf(bus_dma_tag_t t,
 }
 #endif /* _MIPS_NEED_BUS_DMA_BOUNCE */
 
+static size_t 
+_bus_dmamap_mapsize(int const nsegments)
+{ 
+	KASSERT(nsegments > 0);
+	return sizeof(struct mips_bus_dmamap) +
+	(sizeof(bus_dma_segment_t) * (nsegments - 1));
+}
+
+static size_t
+_bus_dmamap_cookiesize(int const nsegments)
+{
+	KASSERT(nsegments > 0);
+	return sizeof(struct mips_bus_dma_cookie) +
+	(sizeof(bus_dma_segment_t) * nsegments);
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -295,9 +311,8 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct mips_bus_dmamap *map;
 	void *mapstore;
-	size_t mapsize;
-	const int mallocflags = M_ZERO |
-	((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
+	const int allocflags =
+	((flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP);
 
 	int error = 0;
 
@@ -313,9 +328,8 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
 	 * the (nsegments - 1).
 	 */
-	mapsize = sizeof(struct mips_bus_dmamap) +
-	(sizeof(bus_dma_segment_t) * (nsegments - 1));
-	if ((mapstore = malloc(mapsize, M_DMAMAP, mallocflags)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	 allocflags)) == NULL)
 		return (ENOMEM);
 
 	map = mapstore;
@@ -336,7 +350,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	struct mips_bus_dma_cookie *cookie;
 	int cookieflags;
 	void *cookiestore;
-	size_t cookiesize;
 
 	if (t->_bounce_thresh == 0 || _BUS_AVAIL_END <= t->_bounce_thresh)
 		map->_dm_bounce_thresh = 0;
@@ -356,13 +369,11 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 		return 0;
 	}
 
-	cookiesize = sizeof(struct mips_bus_dma_cookie) +
-	(sizeof(bus_dma_segment_t) * map->_dm_segcnt);
-
 	/*
 	 * Allocate our cookie.
 	 */
-	if ((cookiestore = malloc(cookiesize, M_DMAMAP, mallocflags)) == NULL) {
+	if ((cookiestore = kmem_zalloc(_bus_dmamap_cookiesize(nsegments),
+	 allocflags)) == NULL) {
 		error = ENOMEM;
 		goto out;
 	}
@@ -403,13 +414,13 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus
 		if (cookie->id_flags & _BUS_DMA_HAS_BOUNCE)
 			_bus_dma_free_bouncebuf(t, map);
 		STAT_INCR(bounced_destroys);
-		free(cookie, M_DMAMAP);
+		kmem_free(cookie, _bus_dmamap_cookiesize(map->_dm_segcnt));
 	} else
 #endif
 	STAT_INCR(destroys);
 	if (map->dm_nsegs > 0)
 		STAT_INCR(unloads);
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*
@@ -1325,8 +1336,8 @@ _bus_dmatag_subregion(bus_dma_tag_t tag,
 		return 0;
 	}
 
-	if ((*newtag = malloc(sizeof(struct mips_bus_dma_tag), M_DMAMAP,
-	(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((*newtag = kmem_alloc(sizeof(struct mips_bus_dma_tag),
+	(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return ENOMEM;
 
 	**newtag = *tag;
@@ -1354,7 +1365,7 @@ _bus_dmatag_destroy(bus_dma_tag_t tag)
 	case 0:
 		break;/* not allocated with malloc */
 	case 1:
-		free(tag, M_DMAMAP);		/* last reference to tag */
+		kmem_free(tag, sizeof(*tag));	/* last reference to tag */
 		break;
 	default:
 		(tag->_tag_needs_free)--;	/* one less reference */



CVS commit: src/sys/arch/mips/atheros

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

Modified Files:
src/sys/arch/mips/atheros: ar_intr.c
src/sys/arch/mips/atheros/dev: arspi.c athflash.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/atheros/ar_intr.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/atheros/dev/arspi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/atheros/dev/athflash.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/mips/atheros/ar_intr.c
diff -u src/sys/arch/mips/atheros/ar_intr.c:1.6 src/sys/arch/mips/atheros/ar_intr.c:1.7
--- src/sys/arch/mips/atheros/ar_intr.c:1.6	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/atheros/ar_intr.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $ */
+/* $NetBSD: ar_intr.c,v 1.7 2021/01/04 17:42:29 thorpej Exp $ */
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.7 2021/01/04 17:42:29 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -110,7 +110,7 @@ genath_cpu_intr_establish(int intr, int 
 {
 	struct atheros_intrhand	*ih;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = intr;
@@ -138,7 +138,7 @@ genath_cpu_intr_disestablish(void *arg)
 	LIST_REMOVE(ih, ih_q);
 
 	splx(s);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 static void *
@@ -150,7 +150,7 @@ genath_misc_intr_establish(int irq, int 
 	int s;
 
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -188,7 +188,7 @@ genath_misc_intr_disestablish(void *arg)
 	}
 
 	splx(s);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 

Index: src/sys/arch/mips/atheros/dev/arspi.c
diff -u src/sys/arch/mips/atheros/dev/arspi.c:1.12 src/sys/arch/mips/atheros/dev/arspi.c:1.13
--- src/sys/arch/mips/atheros/dev/arspi.c:1.12	Tue Aug 13 17:03:11 2019
+++ src/sys/arch/mips/atheros/dev/arspi.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: arspi.c,v 1.12 2019/08/13 17:03:11 tnn Exp $ */
+/* $NetBSD: arspi.c,v 1.13 2021/01/04 17:42:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.12 2019/08/13 17:03:11 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.13 2021/01/04 17:42:29 thorpej Exp $");
 
 #include "locators.h"
 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -260,8 +260,9 @@ arspi_transfer(void *cookie, struct spi_
 	st->st_busprivate = NULL;
 	if ((rv = arspi_make_job(st)) != 0) {
 		if (st->st_busprivate) {
-			free(st->st_busprivate, M_DEVBUF);
+			struct arspi_job *job = st->st_busprivate;
 			st->st_busprivate = NULL;
+			kmem_free(job, sizeof(*job));
 		}
 		spi_done(st, rv);
 		return rv;
@@ -382,7 +383,7 @@ arspi_done(struct arspi_softc *sc, int e
 			sc->sc_transfer = NULL;
 			st->st_busprivate = NULL;
 			spi_done(st, err);
-			free(job, M_DEVBUF);
+			kmem_free(job, sizeof(*job));
 		}
 	}
 done:
@@ -470,10 +471,7 @@ arspi_make_job(struct spi_transfer *st)
 	uint8_t byte;
 	int i, rv;
 
-	job = malloc(sizeof (struct arspi_job), M_DEVBUF, M_ZERO);
-	if (job == NULL) {
-		return ENOMEM;
-	}
+	job = kmem_zalloc(sizeof (struct arspi_job), KM_SLEEP);
 
 	st->st_busprivate = job;
 

Index: src/sys/arch/mips/atheros/dev/athflash.c
diff -u src/sys/arch/mips/atheros/dev/athflash.c:1.11 src/sys/arch/mips/atheros/dev/athflash.c:1.12
--- src/sys/arch/mips/atheros/dev/athflash.c:1.11	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mips/atheros/dev/athflash.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $ */
+/* $NetBSD: athflash.c,v 1.12 2021/01/04 17:42:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -82,13 +82,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.12 2021/01/04 17:42:29 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -251,7 +251,7 @@ flash_attach(device_t parent, device_t s
 	sc->sc_size = flash_ids[i].flash_size;
 	sc->sc_sector_size = flash_ids[i].sector_size;
 
-	sc->sc_buf = malloc(sc->sc_sector_size, M_DEVBUF, M_WAITOK);
+	sc

CVS commit: src/sys/arch/mips/alchemy

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 17:35:12 UTC 2021

Modified Files:
src/sys/arch/mips/alchemy: au_himem_space.c au_icu.c au_wired_space.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/alchemy/au_himem_space.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/alchemy/au_icu.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/alchemy/au_wired_space.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/mips/alchemy/au_himem_space.c
diff -u src/sys/arch/mips/alchemy/au_himem_space.c:1.15 src/sys/arch/mips/alchemy/au_himem_space.c:1.16
--- src/sys/arch/mips/alchemy/au_himem_space.c:1.15	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/alchemy/au_himem_space.c	Mon Jan  4 17:35:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: au_himem_space.c,v 1.15 2019/11/10 21:16:29 chs Exp $ */
+/* $NetBSD: au_himem_space.c,v 1.16 2021/01/04 17:35:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.15 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au_himem_space.c,v 1.16 2021/01/04 17:35:12 thorpej Exp $");
 
 /*
  * This provides mappings for the upper I/O regions used on some
@@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: au_himem_spa
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -692,8 +692,7 @@ au_himem_space_init(bus_space_tag_t bst,
 {
 	au_himem_cookie_t	*c;
 
-	c = malloc(sizeof (struct au_himem_cookie), M_DEVBUF,
-	M_WAITOK | M_ZERO);
+	c = kmem_zalloc(sizeof (struct au_himem_cookie), KM_SLEEP);
 	c->c_name = name;
 	c->c_start = start;
 	c->c_end = end;

Index: src/sys/arch/mips/alchemy/au_icu.c
diff -u src/sys/arch/mips/alchemy/au_icu.c:1.30 src/sys/arch/mips/alchemy/au_icu.c:1.31
--- src/sys/arch/mips/alchemy/au_icu.c:1.30	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/alchemy/au_icu.c	Mon Jan  4 17:35:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: au_icu.c,v 1.30 2019/11/10 21:16:29 chs Exp $	*/
+/*	$NetBSD: au_icu.c,v 1.31 2021/01/04 17:35:12 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: au_icu.c,v 1.30 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au_icu.c,v 1.31 2021/01/04 17:35:12 thorpej Exp $");
 
 #include "opt_ddb.h"
 #define __INTR_PRIVATE
@@ -78,7 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: au_icu.c,v 1
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -199,7 +199,7 @@ au_intr_establish(int irq, int req, int 
 	if (req > 1)
 		panic("au_intr_establish: bogus request %d", req);
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -305,7 +305,7 @@ au_intr_disestablish(void *cookie)
 
 	splx(s);
 
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 void

Index: src/sys/arch/mips/alchemy/au_wired_space.c
diff -u src/sys/arch/mips/alchemy/au_wired_space.c:1.10 src/sys/arch/mips/alchemy/au_wired_space.c:1.11
--- src/sys/arch/mips/alchemy/au_wired_space.c:1.10	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/alchemy/au_wired_space.c	Mon Jan  4 17:35:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: au_wired_space.c,v 1.10 2019/11/10 21:16:29 chs Exp $ */
+/* $NetBSD: au_wired_space.c,v 1.11 2021/01/04 17:35:12 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: au_wired_space.c,v 1.10 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: au_wired_space.c,v 1.11 2021/01/04 17:35:12 thorpej Exp $");
 
 /*
  * This provides mappings for the upper I/O regions used on some
@@ -72,7 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: au_wired_spa
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -632,8 +632,7 @@ au_wired_space_init(bus_space_tag_t bst,
 {
 	au_wired_cookie_t	*c;
 
-	c = malloc(sizeof (struct au_wired_cookie), M_DEVBUF,
-	M_WAITOK | M_ZERO);
+	c = kmem_zalloc(sizeof (struct au_wired_cookie), KM_SLEEP);
 	c->c_pbase = paddr;
 	c->c_name = name;
 	c->c_start = start;



CVS commit: src/sys/arch/mips/cavium/dev

2021-01-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jan  4 17:22:59 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_asx.c octeon_fpa.c octeon_gmx.c
octeon_ipd.c octeon_pip.c octeon_pko.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_asx.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_fpa.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_ipd.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_pip.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/dev/octeon_pko.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/mips/cavium/dev/octeon_asx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_asx.c:1.4 src/sys/arch/mips/cavium/dev/octeon_asx.c:1.5
--- src/sys/arch/mips/cavium/dev/octeon_asx.c:1.4	Tue Jun 23 05:14:18 2020
+++ src/sys/arch/mips/cavium/dev/octeon_asx.c	Mon Jan  4 17:22:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $	*/
+/*	$NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -43,7 +43,7 @@ octasx_init(struct octasx_attach_args *a
 	struct octasx_softc *sc;
 	int status;
 
-	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
+	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
 	if (sc == NULL)
 		panic("can't allocate memory: %s", __func__);
 

Index: src/sys/arch/mips/cavium/dev/octeon_fpa.c
diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.8 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9
--- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.8	Tue Jun 23 05:14:18 2020
+++ src/sys/arch/mips/cavium/dev/octeon_fpa.c	Mon Jan  4 17:22:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $	*/
+/*	$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,12 +29,12 @@
 #undef	FPADEBUG
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -113,10 +113,8 @@ octfpa_buf_init(int poolno, size_t size,
 	paddr_t paddr;
 
 	nsegs = 1/* XXX */;
-	fb = malloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs, M_DEVBUF,
-	M_WAITOK | M_ZERO);
-	if (fb == NULL)
-		return 1;
+	fb = kmem_zalloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs,
+	KM_SLEEP);
 	fb->fb_poolno = poolno;
 	fb->fb_size = size;
 	fb->fb_nelems = nelems;

Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c
diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.15 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.16
--- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.15	Tue Jun 23 05:17:13 2020
+++ src/sys/arch/mips/cavium/dev/octeon_gmx.c	Mon Jan  4 17:22:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $	*/
+/*	$NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $");
 
 #include 
 #include 
@@ -36,7 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -218,8 +218,8 @@ octgmx_attach(device_t parent, device_t 
 
 	octgmx_init(sc);
 
-	sc->sc_ports = malloc(sizeof(*sc->sc_ports) * sc->sc_nports, M_DEVBUF,
-	M_WAITOK | M_ZERO);
+	sc->sc_ports = kmem_zalloc(sizeof(*sc->sc_ports) * sc->sc_nports,
+	KM_SLEEP);
 
 	for (i = 0; i < sc->sc_nports; i++) {
 		port = GMX_PORT_NUM(sc->sc_unitno, i);

Index: src/sys/arch/mips/cavium/dev/octeon_ipd.c
diff -u src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.7 src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.8
--- src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.7	Tue Jun 23 05:15:33 2020
+++ src/sys/arch/mips/cavium/dev/octeon_ipd.c	Mon Jan  4 17:22:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $	*/
+/*	$NetBSD: octeon_ipd.c,v 1.8 2021/01/04 17:22:59 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $");
+__KERNEL_RCSID(0, "$Net

CVS commit: src/sys/arch/mips/mips

2020-12-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 20 15:59:28 UTC 2020

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Remove bogus KASSERT - can't assert a spin mutex is !mutex_owned.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mips/mips/pmap_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/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.31 src/sys/arch/mips/mips/pmap_machdep.c:1.32
--- src/sys/arch/mips/mips/pmap_machdep.c:1.31	Sun Dec 20 12:27:20 2020
+++ src/sys/arch/mips/mips/pmap_machdep.c	Sun Dec 20 15:59:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.31 2020/12/20 12:27:20 skrll Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.32 2020/12/20 15:59:28 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.31 2020/12/20 12:27:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.32 2020/12/20 15:59:28 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -1025,7 +1025,6 @@ pmap_md_vca_remove(struct vm_page *pg, v
 		return;
 
 	KASSERT(kpreempt_disabled());
-	KASSERT(!VM_PAGEMD_PVLIST_LOCKED_P(mdpg));
 	KASSERT((va & PAGE_MASK) == 0);
 
 	/*



CVS commit: src/sys/arch/mips/mips

2020-12-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec 20 12:27:20 UTC 2020

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Remove old part of comment


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/mips/pmap_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/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.30 src/sys/arch/mips/mips/pmap_machdep.c:1.31
--- src/sys/arch/mips/mips/pmap_machdep.c:1.30	Thu Sep 10 17:26:38 2020
+++ src/sys/arch/mips/mips/pmap_machdep.c	Sun Dec 20 12:27:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.31 2020/12/20 12:27:20 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.31 2020/12/20 12:27:20 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -333,7 +333,6 @@ pmap_md_ok_to_steal_p(const uvm_physseg_
 
 /*
  *	Bootstrap the system enough to run with virtual memory.
- *	firstaddr is the first unused kseg0 address (not page aligned).
  */
 void
 pmap_bootstrap(void)



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

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

Modified Files:
src/sys/arch/mips/include: proc.h types.h

Log Message:
don't expose vaddr_t to userland.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mips/include/proc.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/mips/include/types.h

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

Modified files:

Index: src/sys/arch/mips/include/proc.h
diff -u src/sys/arch/mips/include/proc.h:1.32 src/sys/arch/mips/include/proc.h:1.33
--- src/sys/arch/mips/include/proc.h:1.32	Fri Sep  4 04:17:53 2020
+++ src/sys/arch/mips/include/proc.h	Sat Dec  5 22:46:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.32 2020/09/04 08:17:53 mrg Exp $	*/
+/*	$NetBSD: proc.h,v 1.33 2020/12/06 03:46:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -49,7 +49,7 @@ struct trapframe;
 
 struct mdlwp {
 	struct trapframe *md_utf;	/* trapframe from userspace */
-	vaddr_t	md_ss_addr;		/* single step address for ptrace */
+	__vaddr_t md_ss_addr;		/* single step address for ptrace */
 	int	md_ss_instr;		/* single step instruction for ptrace */
 	volatile int md_astpending;	/* AST pending on return to userland */
 	int	md_upte[UPAGES_MAX];	/* ptes for mapping u page */
@@ -57,7 +57,7 @@ struct mdlwp {
 
 struct mdproc {
 	/* syscall entry for this process */
-	void	(*md_syscall)(struct lwp *, u_int, u_int, vaddr_t);
+	void	(*md_syscall)(struct lwp *, u_int, u_int, __vaddr_t);
 	int	md_abi;			/* which ABI is this process using? */
 };
 

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.72 src/sys/arch/mips/include/types.h:1.73
--- src/sys/arch/mips/include/types.h:1.72	Sun Aug 16 23:19:35 2020
+++ src/sys/arch/mips/include/types.h	Sat Dec  5 22:46:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.72 2020/08/17 03:19:35 mrg Exp $	*/
+/*	$NetBSD: types.h,v 1.73 2020/12/06 03:46:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -64,6 +64,11 @@ typedef	__fpregister64_t	__fpregister_t;
  * the rest of the operating system as possible.
  */
 
+#ifdef _LP64
+typedef __uint64_t	__vaddr_t;
+#else
+typedef __uint32_t	__vaddr_t;
+#endif
 
 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)



CVS commit: src/sys/arch/mips/adm5120/dev

2020-12-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Dec  3 08:48:06 UTC 2020

Modified Files:
src/sys/arch/mips/adm5120/dev: wdc_extio.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/adm5120/dev/wdc_extio.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/mips/adm5120/dev/wdc_extio.c
diff -u src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11 src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.12
--- src/sys/arch/mips/adm5120/dev/wdc_extio.c:1.11	Mon Sep  9 22:01:23 2019
+++ src/sys/arch/mips/adm5120/dev/wdc_extio.c	Thu Dec  3 08:48:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $ */
+/*	$NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $ */
 
 /*-
  * Copyright (c) 2007 David Young.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.11 2019/09/09 22:01:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.12 2020/12/03 08:48:06 skrll Exp $");
 
 #include 
 #include 
@@ -245,10 +245,7 @@ wdc_extio_match(device_t parent, cfdata_
 
 	WDC_EXTIO_DPRINTF("%s: enter\n", __func__);
 
-	memset(&wdc, 0, sizeof(wdc));
-	memset(&ch, 0, sizeof(ch));
-	ch.ch_atac = &wdc.sc_atac;
-	wdc.regs = &wdr;
+#if 0
 	wdc.datain_pio = wdc_extio_datain;
 	wdc.dataout_pio = wdc_extio_dataout;
 	if (cf->cf_flags != -1) {
@@ -257,6 +254,7 @@ wdc_extio_match(device_t parent, cfdata_
 		wdc.cap |= cf->cf_flags &
 		(WDC_CAPABILITY_PREATA|WDC_CAPABILITY_NO_EXTRA_RESETS);
 	}
+#endif
 
 	if (wdc_extio_map(ea, &wdr, &gpio, &pm) == -1)
 		return 0;



CVS commit: src/sys/arch/mips/rmi

2020-12-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec  1 08:39:39 UTC 2020

Modified Files:
src/sys/arch/mips/rmi: rmixl_spl.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/rmi/rmixl_spl.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/mips/rmi/rmixl_spl.S
diff -u src/sys/arch/mips/rmi/rmixl_spl.S:1.5 src/sys/arch/mips/rmi/rmixl_spl.S:1.6
--- src/sys/arch/mips/rmi/rmixl_spl.S:1.5	Sun Jul 26 07:48:07 2020
+++ src/sys/arch/mips/rmi/rmixl_spl.S	Tue Dec  1 08:39:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_spl.S,v 1.5 2020/07/26 07:48:07 simonb Exp $	*/
+/*	$NetBSD: rmixl_spl.S,v 1.6 2020/12/01 08:39:39 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: rmixl_spl.S,v 1.5 2020/07/26 07:48:07 simonb Exp $");
+RCSID("$NetBSD: rmixl_spl.S,v 1.6 2020/12/01 08:39:39 skrll Exp $");
 
 #include "assym.h"
 
@@ -50,7 +50,7 @@ RCSID("$NetBSD: rmixl_spl.S,v 1.5 2020/0
 
 	.set noreorder
 
-/* 
+/*
  * Array of mask of bits to set in the EIMR when we go to a
  * given hardware interrupt priority level.
  * The softint bits in [IPL_NONE] and [IPL_SOFTCLOCK] should stay constant



CVS commit: src/sys/arch/mips/cavium/dev

2020-10-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct 15 09:32:40 UTC 2020

Modified Files:
src/sys/arch/mips/cavium/dev: octeon_xhci.c

Log Message:
Initialise xhci_softc sc_ios


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_xhci.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/mips/cavium/dev/octeon_xhci.c
diff -u src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.2 src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.3
--- src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.2	Fri Jul 17 08:06:02 2020
+++ src/sys/arch/mips/cavium/dev/octeon_xhci.c	Thu Oct 15 09:32:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_xhci.c,v 1.2 2020/07/17 08:06:02 simonb Exp $ */
+/*	$NetBSD: octeon_xhci.c,v 1.3 2020/10/15 09:32:40 jmcneill Exp $ */
 /*	$OpenBSD: octxhci.c,v 1.4 2019/09/29 04:32:23 visa Exp $	*/
 
 /*
@@ -115,6 +115,7 @@ octxhci_attach(device_t parent, device_t
 	sc->sc_bus.ub_hcpriv = sc;
 	sc->sc_bus.ub_dmatag = faa->faa_dmat;
 	sc->sc_iot = &octxhci_bus_tag;
+	sc->sc_ios = size;
 
 	child = of_find_bycompat(phandle, "synopsys,dwc3");
 	if (child == -1) {



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

2020-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  3 09:56:00 UTC 2020

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

Log Message:
Add missing __BEGIN_DECLS/__END_DECLS to force function declarations into
the "C" namespace.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mips/include/mcontext.h

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

Modified files:

Index: src/sys/arch/mips/include/mcontext.h
diff -u src/sys/arch/mips/include/mcontext.h:1.23 src/sys/arch/mips/include/mcontext.h:1.24
--- src/sys/arch/mips/include/mcontext.h:1.23	Sun Jul 26 08:08:41 2020
+++ src/sys/arch/mips/include/mcontext.h	Sat Oct  3 09:56:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.23 2020/07/26 08:08:41 simonb Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.24 2020/10/03 09:56:00 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -196,6 +196,8 @@ typedef struct {
 __CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb) < 0x8000);
 __CTASSERT(TLS_TP_OFFSET % sizeof(struct tls_tcb) == 0);
 
+__BEGIN_DECLS
+
 static __inline struct tls_tcb *
 __lwp_gettcb_fast(void)
 {
@@ -233,6 +235,7 @@ __lwp_settcb(struct tls_tcb *__tcb)
 	__tcb += TLS_TP_OFFSET / sizeof(*__tcb) + 1;
 	_lwp_setprivate(__tcb);
 }
+__END_DECLS
 #endif
 
 #endif	/* _MIPS_MCONTEXT_H_ */



CVS commit: src/sys/arch/mips/cavium

2020-09-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Sep 28 12:14:47 UTC 2020

Modified Files:
src/sys/arch/mips/cavium: mainbus.c

Log Message:
faa_a4x_bst is gone


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/mainbus.c

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

Modified files:

Index: src/sys/arch/mips/cavium/mainbus.c
diff -u src/sys/arch/mips/cavium/mainbus.c:1.5 src/sys/arch/mips/cavium/mainbus.c:1.6
--- src/sys/arch/mips/cavium/mainbus.c:1.5	Tue Aug 18 10:35:51 2020
+++ src/sys/arch/mips/cavium/mainbus.c	Mon Sep 28 12:14:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.5 2020/08/18 10:35:51 simonb Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.6 2020/09/28 12:14:47 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2007
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2020/08/18 10:35:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.6 2020/09/28 12:14:47 jmcneill Exp $");
 
 #define	_MIPS_BUS_DMA_PRIVATE
 
@@ -125,7 +125,6 @@ mainbus_attach_devicetree(device_t self)
 	simplebus_bus_io_init(&simplebus_bus_tag, NULL);
 
 	faa.faa_bst = &simplebus_bus_tag;
-	faa.faa_a4x_bst = NULL;		/* XXX */
 	faa.faa_dmat = &simplebus_dma_tag;
 	faa.faa_name = "";
 



CVS commit: src/sys/arch/mips/mips

2020-09-27 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 27 10:35:57 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
only look for cpunode.h on OCTEON.  that's the only direct
caller of *_kern_nonmaskable_intr().


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mips/mips/mipsX_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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.111 src/sys/arch/mips/mips/mipsX_subr.S:1.112
--- src/sys/arch/mips/mips/mipsX_subr.S:1.111	Thu Sep 24 08:14:08 2020
+++ src/sys/arch/mips/mips/mipsX_subr.S	Sun Sep 27 10:35:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.112 2020/09/27 10:35:57 mrg Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -117,7 +117,7 @@
  */
 
 #include 
-RCSID("$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $")
+RCSID("$NetBSD: mipsX_subr.S,v 1.112 2020/09/27 10:35:57 mrg Exp $")
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -137,7 +137,7 @@ RCSID("$NetBSD: mipsX_subr.S,v 1.111 202
 
 #include "assym.h"
 
-#if defined(MIPS64_OCTEON) || defined(MIPS64_XLR) || defined(MIPS64_XLS)
+#if defined(MIPS64_OCTEON)
 #include "cpunode.h"			/* for NWDOG */
 #else
 #define NWDOG 0



CVS commit: src/sys/arch/mips/mips

2020-09-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Sep 26 20:38:27 UTC 2020

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

Log Message:
redo much of rev 1.45 and make the _KERNEL path look like it
used to before.

while it uses less total lines of code and looks less ugly,
the merged crash+ddb code here is less correct and harder to
follow for the kernel path.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/mips/mips/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/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.46 src/sys/arch/mips/mips/db_trace.c:1.47
--- src/sys/arch/mips/mips/db_trace.c:1.46	Sat Sep 26 04:11:48 2020
+++ src/sys/arch/mips/mips/db_trace.c	Sat Sep 26 20:38:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -141,8 +141,6 @@ db_stack_trace_print(db_expr_t addr, boo
 {
 #ifndef DDB_TRACE
 	struct pcb *pcb;
-	struct proc p;
-	struct lwp l;
 	const char *cp = modif;
 	char c;
 	bool lwpaddr = false;
@@ -173,27 +171,42 @@ db_stack_trace_print(db_expr_t addr, boo
 	}
 
 	if (lwpaddr) {
-		db_read_bytes(addr, sizeof(l), (char *)&l);
-		db_read_bytes((db_addr_t)l.l_proc, sizeof(p), (char *)&p);
-		(*pr)("pid %d.%d ", p.p_pid, l.l_lid);
+#ifdef _KERNEL
+		struct lwp *l;
+
+		l = (struct lwp *)(intptr_t)addr;
+		(*pr)("pid %d.%d ", l->l_proc->p_pid, l->l_lid);
+		pcb = lwp_getpcb(l);
+#else
+		struct proc pstore;
+		struct lwp lstore;
+
+		db_read_bytes(addr, sizeof(lstore), (char *)&lstore);
+		db_read_bytes((db_addr_t)lstore.l_proc, sizeof(pstore), 
+		(char *)&pstore);
+		(*pr)("pid %d.%d ", pstore.p_pid, lstore.l_lid);
+		pcb = lwp_getpcb(&lstore);
+#endif
 	} else {
 		/* "trace/t" */
 
 		(*pr)("pid %d ", (int)addr);
 #ifdef _KERNEL
-		struct proc *p2 = proc_find_raw(addr);
-		if (p2 == NULL) {
+		struct lwp *l;
+		struct proc *p = proc_find_raw(addr);
+
+		if (p == NULL) {
 			(*pr)("not found\n");
 			return;
 		}	
-		l = *LIST_FIRST(&p2->p_lwps); /* XXX NJWLWP */
+		l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
+		pcb = lwp_getpcb(l);
 #else
 		(*pr)("no proc_find_raw() in crash\n");
 		return;
 #endif
 	}
 
-	pcb = lwp_getpcb(&l);
 	(*pr)("at %p\n", pcb);
 
 #ifdef _KERNEL



CVS commit: src/sys/arch/mips/mips

2020-09-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Sep 26 08:21:27 UTC 2020

Modified Files:
src/sys/arch/mips/mips: lock_stubs_llsc.S lock_stubs_ras.S

Log Message:
Expose the atomicvec vectors via EXPORT_OBJECT so ksyms(4) address
lookups can find them.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/mips/lock_stubs_llsc.S
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/mips/lock_stubs_ras.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/mips/mips/lock_stubs_llsc.S
diff -u src/sys/arch/mips/mips/lock_stubs_llsc.S:1.12 src/sys/arch/mips/mips/lock_stubs_llsc.S:1.13
--- src/sys/arch/mips/mips/lock_stubs_llsc.S:1.12	Sun Aug  9 08:33:52 2020
+++ src/sys/arch/mips/mips/lock_stubs_llsc.S	Sat Sep 26 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_llsc.S,v 1.12 2020/08/09 08:33:52 skrll Exp $	*/
+/*	$NetBSD: lock_stubs_llsc.S,v 1.13 2020/09/26 08:21:27 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_llsc.S,v 1.12 2020/08/09 08:33:52 skrll Exp $")
+RCSID("$NetBSD: lock_stubs_llsc.S,v 1.13 2020/09/26 08:21:27 simonb Exp $")
 
 #include "assym.h"
 
@@ -341,7 +341,7 @@ END(llsc_mutex_spin_exit)
 #endif	/* !LOCKDEBUG */
 
 	.rdata
-EXPORT(mips_llsc_locore_atomicvec)
+EXPORT_OBJECT(mips_llsc_locore_atomicvec)
 	PTR_WORD 	llsc_atomic_cas_uint
 	PTR_WORD 	llsc_atomic_cas_ulong
 	PTR_WORD	llsc_ucas_32

Index: src/sys/arch/mips/mips/lock_stubs_ras.S
diff -u src/sys/arch/mips/mips/lock_stubs_ras.S:1.10 src/sys/arch/mips/mips/lock_stubs_ras.S:1.11
--- src/sys/arch/mips/mips/lock_stubs_ras.S:1.10	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/lock_stubs_ras.S	Sat Sep 26 08:21:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs_ras.S,v 1.10 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: lock_stubs_ras.S,v 1.11 2020/09/26 08:21:27 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include 
 
-RCSID("$NetBSD: lock_stubs_ras.S,v 1.10 2019/04/06 03:06:26 thorpej Exp $")
+RCSID("$NetBSD: lock_stubs_ras.S,v 1.11 2020/09/26 08:21:27 simonb Exp $")
 
 #include "assym.h"
 
@@ -482,7 +482,7 @@ END(ras_mutex_spin_exit)
 #endif	/* !LOCKDEBUG */
 
 	.data
-EXPORT(mips_locore_atomicvec)
+EXPORT_OBJECT(mips_locore_atomicvec)
 	PTR_WORD 	ras_atomic_cas_uint
 	PTR_WORD 	ras_atomic_cas_ulong
 	PTR_WORD	ras_ucas_32



CVS commit: src/sys/arch/mips/mips

2020-09-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Sep 26 08:21:10 UTC 2020

Modified Files:
src/sys/arch/mips/mips: locore.S

Log Message:
Use EXPORT for start and EXPORT_OBJECT for kernel_text instead of
by-hand exporting.  Using EXPORT_OBJECT for kernel_text also fixes
"bt/a" from DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/sys/arch/mips/mips/locore.S

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

Modified files:

Index: src/sys/arch/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.225 src/sys/arch/mips/mips/locore.S:1.226
--- src/sys/arch/mips/mips/locore.S:1.225	Fri Jul 31 20:04:18 2020
+++ src/sys/arch/mips/mips/locore.S	Sat Sep 26 08:21:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.225 2020/07/31 20:04:18 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.226 2020/09/26 08:21:10 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,16 +63,14 @@
 #include 
 #include 
 
-RCSID("$NetBSD: locore.S,v 1.225 2020/07/31 20:04:18 skrll Exp $")
+RCSID("$NetBSD: locore.S,v 1.226 2020/09/26 08:21:10 simonb Exp $")
 
 #include "assym.h"
 
 	.set	noreorder
 
-	.globl	start
-	.globl	_C_LABEL(kernel_text)		# libkvm refers this
-start:
-_C_LABEL(kernel_text):
+EXPORT(start)
+EXPORT_OBJECT(kernel_text)			# libkvm refers this
 	/* First disable the interrupts only, for safety */
 	mfc0	k0, MIPS_COP_0_STATUS
 	MFC0_HAZARD



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

2020-09-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Sep 26 08:19:11 UTC 2020

Modified Files:
src/sys/arch/mips/include: asm.h

Log Message:
Add EXPORT_OBJECT - export definition of symbol of symbol type Object,
visible to ksyms(4) address search.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/mips/include/asm.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/mips/include/asm.h
diff -u src/sys/arch/mips/include/asm.h:1.61 src/sys/arch/mips/include/asm.h:1.62
--- src/sys/arch/mips/include/asm.h:1.61	Wed Aug 12 08:56:37 2020
+++ src/sys/arch/mips/include/asm.h	Sat Sep 26 08:19:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.61 2020/08/12 08:56:37 skrll Exp $	*/
+/*	$NetBSD: asm.h,v 1.62 2020/09/26 08:19:11 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -237,6 +237,14 @@ _C_LABEL(x):
 _C_LABEL(x):
 
 /*
+ * EXPORT_OBJECT -- export definition of symbol of symbol
+ * type Object, visible to ksyms(4) address search.
+ */
+#define	EXPORT_OBJECT(x)		\
+	EXPORT(x);			\
+	.type	_C_LABEL(x), @object;
+
+/*
  * VECTOR
  *	exception vector entrypoint
  *	XXX: regmask should be used to generate .mask



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

2020-09-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Sep 26 04:31:53 UTC 2020

Modified Files:
src/sys/arch/mips/include: pcb.h

Log Message:
Whitespace consistency nit.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mips/include/pcb.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/mips/include/pcb.h
diff -u src/sys/arch/mips/include/pcb.h:1.26 src/sys/arch/mips/include/pcb.h:1.27
--- src/sys/arch/mips/include/pcb.h:1.26	Mon Aug 17 04:15:33 2020
+++ src/sys/arch/mips/include/pcb.h	Sat Sep 26 04:31:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.26 2020/08/17 04:15:33 mrg Exp $	*/
+/*	$NetBSD: pcb.h,v 1.27 2020/09/26 04:31:53 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -57,7 +57,7 @@ struct pcb_faultinfo {
  */
 struct pcb {
 	mips_label_t pcb_context;	/* kernel context for resume */
-	void *	pcb_onfault;		/* for copyin/copyout faults */
+	void *pcb_onfault;		/* for copyin/copyout faults */
 	uint32_t pcb_ppl;		/* previous priority level */
 	struct fpreg pcb_fpregs;	/* saved floating point registers */
 	struct dspreg pcb_dspregs;	/* saved DSP registers */



CVS commit: src/sys/arch/mips/mips

2020-09-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Sep 26 04:11:48 UTC 2020

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

Log Message:
Including  once should be sufficient.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mips/mips/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/mips/mips/db_trace.c
diff -u src/sys/arch/mips/mips/db_trace.c:1.45 src/sys/arch/mips/mips/db_trace.c:1.46
--- src/sys/arch/mips/mips/db_trace.c:1.45	Mon Aug 17 04:15:34 2020
+++ src/sys/arch/mips/mips/db_trace.c	Sat Sep 26 04:11:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_trace.c,v 1.45 2020/08/17 04:15:34 mrg Exp $	*/
+/*	$NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.45 2020/08/17 04:15:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -46,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_trace.c,v
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/mips/mips

2020-09-24 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 24 08:14:08 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
fix build on non rmx or octeon systems.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/mips/mips/mipsX_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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.110 src/sys/arch/mips/mips/mipsX_subr.S:1.111
--- src/sys/arch/mips/mips/mipsX_subr.S:1.110	Thu Sep 24 02:12:01 2020
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Sep 24 08:14:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -117,9 +117,8 @@
  */
 
 #include 
-RCSID("$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $")
+RCSID("$NetBSD: mipsX_subr.S,v 1.111 2020/09/24 08:14:08 mrg Exp $")
 
-#include "cpunode.h"			/* for NWDOG */
 #include "opt_cputype.h"
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -138,6 +137,12 @@ RCSID("$NetBSD: mipsX_subr.S,v 1.110 202
 
 #include "assym.h"
 
+#if defined(MIPS64_OCTEON) || defined(MIPS64_XLR) || defined(MIPS64_XLS)
+#include "cpunode.h"			/* for NWDOG */
+#else
+#define NWDOG 0
+#endif
+
 #if defined(MIPS1) || defined(MIPS2)
 #error use locore_mips1.S
 #endif



CVS commit: src/sys/arch/mips/mips

2020-09-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 24 03:17:18 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_stacktrace.c

Log Message:
skip kernel-only code on crash.

XXX: we could make verylocore work with a symbol look for crash.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/mips/mips_stacktrace.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/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.6 src/sys/arch/mips/mips/mips_stacktrace.c:1.7
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.6	Wed Sep 23 09:56:33 2020
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Thu Sep 24 03:17:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.7 2020/09/24 03:17:18 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -291,10 +291,6 @@ stacktrace_subr(mips_reg_t a0, mips_reg_
 		[_R_A0] = a0, [_R_A1] = a1, [_R_A2] = a2, [_R_A3] = a3,
 		[_R_RA] = ra,
 	};
-#ifdef DDB
-	db_expr_t diff;
-	db_sym_t sym;
-#endif
 
 /* Jump here when done with a frame, to start a new one */
 loop:
@@ -322,8 +318,11 @@ loop:
 		goto done;
 	}
 
-#ifdef DDB
+#if defined(DDB) && defined(_KERNEL)
 	if (ksyms_available()) {
+		db_expr_t diff;
+		db_sym_t sym;
+
 		/*
 		 * Check the kernel symbol table to see the beginning of
 		 * the current subroutine.
@@ -348,7 +347,7 @@ loop:
 		}
 		va = pc - diff;
 	} else {
-#endif /* DDB */
+#endif /* DDB && _KERNEL */
 		/*
 		 * Find the beginning of the current subroutine by
 		 * scanning backwards from the current PC for the end
@@ -362,8 +361,10 @@ loop:
 		va = pc;
 		do {
 			va -= sizeof(int);
+#ifdef _KERNEL /* XXX crash */
 			if (va <= (vaddr_t)verylocore)
 goto finish;
+#endif
 			if (!kdbpeek(va, &instr))
 return;
 			if (instr == MIPS_ERET)
@@ -380,9 +381,9 @@ mips3_eret:
 return;
 			va += sizeof(int);
 		}
-#ifdef DDB
+#if defined(DDB) && defined(_KERNEL)
 	}
-#endif /* DDB */
+#endif /* DDB && _KERNEL */
 	subr = va;
 
 	/* scan forwards to find stack size and any saved registers */



CVS commit: src/sys/arch/mips/mips

2020-09-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep 24 02:12:01 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
fix octeon !DDB builds.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/mips/mips/mipsX_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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.109 src/sys/arch/mips/mips/mipsX_subr.S:1.110
--- src/sys/arch/mips/mips/mipsX_subr.S:1.109	Sun Aug 23 10:23:38 2020
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Sep 24 02:12:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.109 2020/08/23 10:23:38 simonb Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -115,6 +115,11 @@
  *
  *	@(#)locore.s	8.5 (Berkeley) 1/4/94
  */
+
+#include 
+RCSID("$NetBSD: mipsX_subr.S,v 1.110 2020/09/24 02:12:01 mrg Exp $")
+
+#include "cpunode.h"			/* for NWDOG */
 #include "opt_cputype.h"
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -125,7 +130,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #if defined(MIPS3)
 #include 
@@ -906,7 +910,7 @@ MIPSX(kern_return):
 	.set	at
 END(MIPSX(kern_gen_exception))
 
-#ifdef DDB
+#if NWDOG > 0 || defined(DDB)
 /*
  * mipsN_kern_nonmaskable_intr
  *
@@ -1044,7 +1048,7 @@ NESTED_NOPROFILE(MIPSX(kern_nonmaskable_
 	 nop
 	.set	at
 END(MIPSX(kern_nonmaskable_intr))
-#endif /* DDB */
+#endif /* NWDOG > 0 || DDB */
 
 /*
  * mipsN_kern_intr



CVS commit: src/sys/arch/mips/mips

2020-09-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Sep 23 09:56:33 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_stacktrace.c

Log Message:
make !DDB kernels build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/mips/mips_stacktrace.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/mips/mips/mips_stacktrace.c
diff -u src/sys/arch/mips/mips/mips_stacktrace.c:1.5 src/sys/arch/mips/mips/mips_stacktrace.c:1.6
--- src/sys/arch/mips/mips/mips_stacktrace.c:1.5	Wed Sep 23 09:52:02 2020
+++ src/sys/arch/mips/mips/mips_stacktrace.c	Wed Sep 23 09:56:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_stacktrace.c,v 1.5 2020/09/23 09:52:02 simonb Exp $	*/
+/*	$NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.5 2020/09/23 09:52:02 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_stacktrace.c,v 1.6 2020/09/23 09:56:33 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: mips_stacktr
 
 #include 
 #include 
+#include 
 #include 
 
 #if defined(_KMEMUSER) && !defined(DDB)
@@ -228,13 +229,13 @@ kdbrpeek(vaddr_t addr, size_t n)
 	} else {
 		if (sizeof(mips_reg_t) == 8 && n == 8)
 #if _KERNEL
-			db_read_bytes((db_addr_t)addr, sizeof(int64_t), (char *)&rc);
-		else
-			db_read_bytes((db_addr_t)addr, sizeof(int32_t), (char *)&rc);
-#else
 			rc = *(int64_t *)addr;
  		else
 			rc = *(int32_t *)addr;
+#else
+			db_read_bytes((db_addr_t)addr, sizeof(int64_t), (char *)&rc);
+		else
+			db_read_bytes((db_addr_t)addr, sizeof(int32_t), (char *)&rc);
 #endif
 	}
 	return rc;



CVS commit: src/sys/arch/mips/mips

2020-09-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Sep 10 17:26:38 UTC 2020

Modified Files:
src/sys/arch/mips/mips: pmap_machdep.c

Log Message:
Typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/mips/mips/pmap_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/mips/mips/pmap_machdep.c
diff -u src/sys/arch/mips/mips/pmap_machdep.c:1.29 src/sys/arch/mips/mips/pmap_machdep.c:1.30
--- src/sys/arch/mips/mips/pmap_machdep.c:1.29	Tue Aug 18 11:21:25 2020
+++ src/sys/arch/mips/mips/pmap_machdep.c	Thu Sep 10 17:26:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_machdep.c,v 1.29 2020/08/18 11:21:25 simonb Exp $	*/
+/*	$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.29 2020/08/18 11:21:25 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.30 2020/09/10 17:26:38 skrll Exp $");
 
 /*
  *	Manages physical address maps.
@@ -398,7 +398,7 @@ pmap_bootstrap(void)
 	/* XXX: else runs out of space on 256MB sbmips!! */
 	sysmap_size += 2;
 #endif
-	/* Rounup to a even number of pte page tables */
+	/* Roundup to a even number of pte page tables */
 	sysmap_size = (sysmap_size + NPTEPG - 1) & -NPTEPG;
 
 	/*



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

2020-09-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Sep  4 08:17:53 UTC 2020

Modified Files:
src/sys/arch/mips/include: proc.h

Log Message:
include machine/vmparam.h vs mips/vmparam.h to make sure we get
platform-specific defines first.

fixes build issue for playstation2.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/mips/include/proc.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/mips/include/proc.h
diff -u src/sys/arch/mips/include/proc.h:1.31 src/sys/arch/mips/include/proc.h:1.32
--- src/sys/arch/mips/include/proc.h:1.31	Wed Aug 26 10:51:45 2020
+++ src/sys/arch/mips/include/proc.h	Fri Sep  4 08:17:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.31 2020/08/26 10:51:45 simonb Exp $	*/
+/*	$NetBSD: proc.h,v 1.32 2020/09/04 08:17:53 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #define	_MIPS_PROC_H_
 
 #include 
-#include 
+#include 
 
 struct lwp;
 



CVS commit: src/sys/arch/mips/atheros/dev

2020-09-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Sep  2 08:26:05 UTC 2020

Modified Files:
src/sys/arch/mips/atheros/dev: if_ae.c

Log Message:
 Id -> NetBSD in comment. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mips/atheros/dev/if_ae.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/mips/atheros/dev/if_ae.c
diff -u src/sys/arch/mips/atheros/dev/if_ae.c:1.39 src/sys/arch/mips/atheros/dev/if_ae.c:1.40
--- src/sys/arch/mips/atheros/dev/if_ae.c:1.39	Tue Feb  4 05:18:36 2020
+++ src/sys/arch/mips/atheros/dev/if_ae.c	Wed Sep  2 08:26:05 2020
@@ -1,4 +1,4 @@
-/* $Id: if_ae.c,v 1.39 2020/02/04 05:18:36 thorpej Exp $ */
+/* $NetBSD: if_ae.c,v 1.40 2020/09/02 08:26:05 msaitoh Exp $ */
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -98,7 +98,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.39 2020/02/04 05:18:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.40 2020/09/02 08:26:05 msaitoh Exp $");
 
 
 #include 



CVS commit: src/sys/arch/mips/mips

2020-09-01 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Sep  2 01:33:27 UTC 2020

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
Octeon CN70XX CPUs have a COP0 config5 register.
XXX: The presense of these are defined by the MIPS architecture, should probe.


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.299 src/sys/arch/mips/mips/mips_machdep.c:1.300
--- src/sys/arch/mips/mips/mips_machdep.c:1.299	Mon Aug 17 03:22:13 2020
+++ src/sys/arch/mips/mips/mips_machdep.c	Wed Sep  2 01:33:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.299 2020/08/17 03:22:13 mrg Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.300 2020/09/02 01:33:27 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 			/* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.299 2020/08/17 03:22:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.300 2020/09/02 01:33:27 simonb Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -672,10 +672,10 @@ static const struct pridtab cputab[] = {
 
 	{ MIPS_PRID_CID_CAVIUM, MIPS_CN70XX, -1, -1, -1, 0,
 	  MIPS64_FLAGS | CPU_MIPS_D_CACHE_COHERENT | CPU_MIPS_NO_LLADDR,
-	  MIPS_CP0FL_USE |
-	  MIPS_CP0FL_EBASE | MIPS_CP0FL_CONFIG |
-	  MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 | MIPS_CP0FL_CONFIG3 |
-	  MIPS_CP0FL_CONFIG4 | MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7,
+	  MIPS_CP0FL_USE | MIPS_CP0FL_EBASE |
+	  MIPS_CP0FL_CONFIG  | MIPS_CP0FL_CONFIG1 | MIPS_CP0FL_CONFIG2 |
+	  MIPS_CP0FL_CONFIG3 | MIPS_CP0FL_CONFIG4 | MIPS_CP0FL_CONFIG5 |
+	  MIPS_CP0FL_CONFIG6 | MIPS_CP0FL_CONFIG7,
 	  0,
 	  "CN70xx/CN71xx"	},
 



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

2020-08-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Aug 26 10:51:45 UTC 2020

Modified Files:
src/sys/arch/mips/include: mips_param.h proc.h

Log Message:
Define a UPAGES_MAX constant to size the a md_upte array in MIPS's
struct mdlwp.  This is exposed to userland, so we can't use something
based on PAGE_SIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/mips/include/mips_param.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mips/include/proc.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/mips/include/mips_param.h
diff -u src/sys/arch/mips/include/mips_param.h:1.46 src/sys/arch/mips/include/mips_param.h:1.47
--- src/sys/arch/mips/include/mips_param.h:1.46	Sun Aug 23 10:23:38 2020
+++ src/sys/arch/mips/include/mips_param.h	Wed Aug 26 10:51:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_param.h,v 1.46 2020/08/23 10:23:38 simonb Exp $	*/
+/*	$NetBSD: mips_param.h,v 1.47 2020/08/26 10:51:45 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -130,6 +130,7 @@
 #define	USPACE		MAX(__MIN_USPACE, PAGE_SIZE)
 #define	UPAGES		(USPACE / PAGE_SIZE) /* number of pages for u-area */
 #define	USPACE_ALIGN	USPACE		/* make sure it starts on a even VA */
+#define	UPAGES_MAX	8		/* a (constant) max for userland use */
 
 /*
  * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized

Index: src/sys/arch/mips/include/proc.h
diff -u src/sys/arch/mips/include/proc.h:1.30 src/sys/arch/mips/include/proc.h:1.31
--- src/sys/arch/mips/include/proc.h:1.30	Sun Aug 23 10:23:38 2020
+++ src/sys/arch/mips/include/proc.h	Wed Aug 26 10:51:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.30 2020/08/23 10:23:38 simonb Exp $	*/
+/*	$NetBSD: proc.h,v 1.31 2020/08/26 10:51:45 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -52,7 +52,7 @@ struct mdlwp {
 	vaddr_t	md_ss_addr;		/* single step address for ptrace */
 	int	md_ss_instr;		/* single step instruction for ptrace */
 	volatile int md_astpending;	/* AST pending on return to userland */
-	int	md_upte[UPAGES];	/* ptes for mapping u page */
+	int	md_upte[UPAGES_MAX];	/* ptes for mapping u page */
 };
 
 struct mdproc {



  1   2   3   4   5   6   7   8   9   10   >