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

2020-06-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jun 20 02:27:55 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: autoconf.c machdep.c

Log Message:
Add some rudimentary boot args parsing.  Can handle "root=" as well
normal -1adsqvxz flags.  "root=" is limited to cnmacN devices so far;
should be extended to allow arbitary SD devices (and other devices?).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/cavium/autoconf.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbmips/cavium/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/evbmips/cavium/autoconf.c
diff -u src/sys/arch/evbmips/cavium/autoconf.c:1.6 src/sys/arch/evbmips/cavium/autoconf.c:1.7
--- src/sys/arch/evbmips/cavium/autoconf.c:1.6	Wed Jun 10 07:34:19 2020
+++ src/sys/arch/evbmips/cavium/autoconf.c	Sat Jun 20 02:27:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.6 2020/06/10 07:34:19 simonb Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.7 2020/06/20 02:27:55 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.6 2020/06/10 07:34:19 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.7 2020/06/20 02:27:55 simonb Exp $");
 
 #include 
 #include 
@@ -72,15 +72,17 @@ cpu_configure(void)
 void
 cpu_rootconf(void)
 {
+
+#ifndef MEMORY_DISK_IS_ROOT
 	findroot();
+#endif
 
 	printf("boot device: %s\n",
-		booted_device ? booted_device->dv_xname : "");
+		booted_device ? device_xname(booted_device) : "");
 
 	rootconf();
 }
 
-extern char	bootstring[];
 extern int	netboot;
 
 static void
@@ -92,7 +94,23 @@ findroot(void)
 	if (booted_device)
 		return;
 
-	if ((booted_device == NULL) && netboot == 0) {
+	if (rootspec && *rootspec) {
+		/* XXX hard coded "cnmac" for network boot */
+		if (strncmp(rootspec, "cnmac", 5) == 0) {
+			rootfstype = "nfs";
+			netboot = 1;
+			return;
+		}
+		/*
+		 * XXX
+		 * Assume that if the root spec is not a cnmac, it'll
+		 * be a sd. handled below.  Should be fixed to handle
+		 * multiple sd devices.
+		 */
+	}
+
+	if (netboot == 0) {
+		/* if no root device specified, default to a "sd" device */
 		for (dv = deviter_first(, DEVITER_F_ROOT_FIRST); dv != NULL;
 		 dv = deviter_next()) {
 			if (device_class(dv) == DV_DISK &&
@@ -174,6 +192,7 @@ prop_set_octeon_gmx(device_t dev)
 void
 device_register(device_t dev, void *aux)
 {
+
 	if ((booted_device == NULL) && (netboot == 1))
 		if (device_class(dev) == DV_IFNET)
 			booted_device = dev;

Index: src/sys/arch/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.15 src/sys/arch/evbmips/cavium/machdep.c:1.16
--- src/sys/arch/evbmips/cavium/machdep.c:1.15	Fri Jun 19 12:38:53 2020
+++ src/sys/arch/evbmips/cavium/machdep.c	Sat Jun 20 02:27:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.15 2020/06/19 12:38:53 simonb Exp $	*/
+/*	$NetBSD: machdep.c,v 1.16 2020/06/20 02:27:55 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2020/06/19 12:38:53 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.16 2020/06/20 02:27:55 simonb Exp $");
 
 #include 
 #include 
@@ -157,6 +157,7 @@ static void	mach_init_vector(void);
 static void	mach_init_bus_space(void);
 static void	mach_init_console(void);
 static void	mach_init_memory(void);
+static void	parse_boot_args(void);
 
 #include "com.h"
 #if NCOM > 0
@@ -179,6 +180,7 @@ extern char end[];
 void	mach_init(uint64_t, uint64_t, uint64_t, uint64_t);
 
 struct octeon_config octeon_configuration;
+struct octeon_btdesc octeon_btdesc;
 struct octeon_btinfo octeon_btinfo;
 
 char octeon_nmi_stack[PAGE_SIZE] __section(".data1") __aligned(PAGE_SIZE);
@@ -197,11 +199,18 @@ mach_init(uint64_t arg0, uint64_t arg1, 
 	KASSERT(MIPS_XKPHYS_P(arg3));
 	btinfo_paddr = mips3_ld(arg3 + OCTEON_BTINFO_PADDR_OFFSET);
 
-	/* Should be in first 256MB segment */
-	KASSERT(btinfo_paddr < 256 * 1024 * 1024);
-	memcpy(_btinfo,
-	(struct octeon_btinfo *)MIPS_PHYS_TO_KSEG0(btinfo_paddr),
-	sizeof(octeon_btinfo));
+	/* XXX KASSERT these addresses? */
+	memcpy(_btdesc, (void *)arg3, sizeof(octeon_btdesc));
+	if ((octeon_btdesc.obt_desc_ver == OCTEON_SUPPORTED_DESCRIPTOR_VERSION) &&
+	(octeon_btdesc.obt_desc_size == sizeof(octeon_btdesc))) {
+		btinfo_paddr = MIPS_PHYS_TO_XKPHYS(CCA_CACHEABLE,
+		octeon_btdesc.obt_boot_info_addr);
+	} else {
+		panic("unknown boot descriptor size %u",
+		octeon_btdesc.obt_desc_size);
+	}
+	memcpy(_btinfo, (void *)btinfo_paddr, sizeof(octeon_btinfo));
+	parse_boot_args();
 
 	octeon_cal_timer(octeon_btinfo.obt_eclock_hz);
 
@@ -216,6 +225,12 @@ mach_init(uint64_t arg0, uint64_t arg1, 
 
 	mach_init_console();
 
+#ifdef DEBUG
+	/* Show a couple of boot desc/info params for positive feedback */
+	

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

2020-06-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sat Jun 20 02:01:56 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: octeon_uboot.h

Log Message:
Add the structure of the CVMX boot descriptor.
Extend the U-boot bootinfo descriptor with latest members, add a few comments.
Add a few extra board type IDs.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/cavium/octeon_uboot.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/evbmips/cavium/octeon_uboot.h
diff -u src/sys/arch/evbmips/cavium/octeon_uboot.h:1.2 src/sys/arch/evbmips/cavium/octeon_uboot.h:1.3
--- src/sys/arch/evbmips/cavium/octeon_uboot.h:1.2	Fri Jun  5 07:17:38 2020
+++ src/sys/arch/evbmips/cavium/octeon_uboot.h	Sat Jun 20 02:01:56 2020
@@ -1,12 +1,49 @@
-/*	$NetBSD: octeon_uboot.h,v 1.2 2020/06/05 07:17:38 simonb Exp $	*/
+/*	$NetBSD: octeon_uboot.h,v 1.3 2020/06/20 02:01:56 simonb Exp $	*/
 
 #ifndef _EVBMIPS_OCTEON_UBOOT_H_
-#define _EVBMIPS_OCTEON_UBOOT_H_
+#define	_EVBMIPS_OCTEON_UBOOT_H_
 
-#define OCTEON_BTINFO_PADDR_OFFSET	392
-#define OCTEON_BTINFO_SERIAL_LEN	20
-#define OCTEON_BTINFO_MAJOR_VERSION	1
-#define OCTEON_BTINFO_MINOR_VERSION	2
+#define	OCTEON_BTDESC_ARGV_MAX		64
+#define	OCTEON_BTDESC_SERIAL_LEN	20
+#define	OCTEON_BTDESC_DEP2_LEN		6
+
+#define	OCTEON_BTINFO_PADDR_OFFSET	392
+#define	OCTEON_BTINFO_SERIAL_LEN	20
+#define	OCTEON_BTINFO_MAJOR_VERSION	1
+#define	OCTEON_BTINFO_MINOR_VERSION	2
+
+struct octeon_btdesc {
+	uint32_t	obt_desc_ver;
+	uint32_t	obt_desc_size;
+	uint64_t	obt_stack_top;			/* deprecated */
+	uint64_t	obt_heap_start;
+	uint64_t	obt_heap_end;
+	uint64_t	obt_deprecated17;
+	uint64_t	obt_deprecated16;
+	uint32_t	obt_deprecated18;
+	uint32_t	obt_deprecated15;
+	uint32_t	obt_deprecated14;
+	uint32_t	obt_argc;
+	uint32_t	obt_argv[OCTEON_BTDESC_ARGV_MAX];
+	uint32_t	obt_flags;			/* deprecated */
+	uint32_t	obt_core_mask;			/* deprecated */
+	uint32_t	obt_dram_size;			/* deprecated */
+	uint32_t	obt_phy_mem_desc_addr;		/* deprecated */
+	uint32_t	obt_debugger_flag_addr;
+	uint32_t	obt_eclock;
+	uint32_t	obt_deprecated10;
+	uint32_t	obt_deprecated9;
+	uint16_t	obt_deprecated8;
+	uint8_t		obt_deprecated7;
+	uint8_t		obt_deprecated6;
+	uint16_t	obt_deprecated5;
+	uint8_t		obt_deprecated4;
+	uint8_t		obt_deprecated3;
+	uint8_t		obt_deprecated2[OCTEON_BTDESC_SERIAL_LEN];
+	uint8_t		obt_deprecated1[OCTEON_BTDESC_DEP2_LEN];
+	uint8_t		obt_deprecated0;
+	uint64_t	obt_boot_info_addr;
+};
 
 struct octeon_btinfo {
 	uint32_t	obt_major_version;
@@ -20,12 +57,12 @@ struct octeon_btinfo {
 	uint32_t	obt_ebase_addr;
 	uint32_t	obt_stack_size;
 	uint32_t	obt_flags;
-	uint32_t	obt_core_mask;
+	uint32_t	obt_core_mask;			/* deprecated in v4 */
 	uint32_t	obt_dram_size;			/* in MB */
 	uint32_t	obt_phy_mem_desc_addr;
 	uint32_t	obt_dbg_flags_base_addr;
-	uint32_t	obt_eclock_hz;
-	uint32_t	obt_dclock_hz;
+	uint32_t	obt_eclock_hz;			/* CPU clock speed */
+	uint32_t	obt_dclock_hz;			/* DRAM clock speed */
 	uint32_t	obt_reserved0;
 
 	uint16_t	obt_board_type;
@@ -42,18 +79,40 @@ struct octeon_btinfo {
 	/* version minor 1 or newer */
 	uint64_t	obt_cf_common_base_addr;	/* paddr */
 	uint64_t	obt_cf_attr_base_addr;		/* paddr */
-	uint64_t	obt_led_display_base_addr;
+	uint64_t	obt_led_display_base_addr;	/* deprecated */
 
 	/* version minor 2 or newer */
-	uint32_t	obt_dfa_ref_clock_hz;
+	uint32_t	obt_dfa_ref_clock_hz;		/* DFA ref clock */
 	uint32_t	obt_config_flags;
 
+	/* version minor 3 or newer */
+	uint64_t	obt_fdt_addr;			/* FDT structure */
+
+	/* version minor 4 or newer */
+	uint64_t	obt_ext_core_mask;		/* 64-bit core mask */
 };
 
+extern struct octeon_btdesc octeon_btdesc;
 extern struct octeon_btinfo octeon_btinfo;
 
+#define	OCTEON_SUPPORTED_DESCRIPTOR_VERSION	7
+
 /* obt_board_type */
-#define BOARD_TYPE_UBIQUITI_E100	20002
+#define	BOARD_TYPE_UBIQUITI_E100	20002
+#define	BOARD_TYPE_UBIQUITI_E120		20004
+#define	BOARD_TYPE_UBIQUITI_E200		20003
+#define	BOARD_TYPE_UBIQUITI_E220		20005
+#define	BOARD_TYPE_UBIQUITI_E220		20005
+#define	BOARD_TYPE_UBIQUITI_E1000		20010
+#define	BOARD_TYPE_UBIQUITI_E300		20300
+
+/* obt_config_flags */
+#define	CONFIG_FLAGS_PCI_HOST			__BIT(0)
+#define	CONFIG_FLAGS_PCI_TARGET			__BIT(1)
+#define	CONFIG_FLAGS_DEBUG			__BIT(2)
+#define	CONFIG_FLAGS_NO_MAGIC			__BIT(3)
+#define	CONFIG_FLAGS_OVERSIZE_TLB_MAPPING	__BIT(4)
+#define	CONFIG_FLAGS_BREAK			__BIT(5)
 
 
 struct octeon_bootmem_desc {



CVS commit: src/common/lib/libprop

2020-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 20 00:16:51 UTC 2020

Modified Files:
src/common/lib/libprop: prop_string.c

Log Message:
Fix lint


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/common/lib/libprop/prop_string.c

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

Modified files:

Index: src/common/lib/libprop/prop_string.c
diff -u src/common/lib/libprop/prop_string.c:1.14 src/common/lib/libprop/prop_string.c:1.15
--- src/common/lib/libprop/prop_string.c:1.14	Sat Jun  6 17:25:59 2020
+++ src/common/lib/libprop/prop_string.c	Fri Jun 19 20:16:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_string.c,v 1.14 2020/06/06 21:25:59 thorpej Exp $	*/
+/*	$NetBSD: prop_string.c,v 1.15 2020/06/20 00:16:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -314,6 +314,7 @@ prop_string_create_format(const char *fm
 	prop_string_t ps;
 	char *str = NULL;
 	int len;
+	size_t nlen;
 	va_list ap;
 
 	_PROP_ASSERT(fmt != NULL);
@@ -324,16 +325,17 @@ prop_string_create_format(const char *fm
 
 	if (len < 0)
 		return (NULL);
+	nlen = len + 1;
 
-	str = _PROP_MALLOC(len + 1, M_PROP_STRING);
+	str = _PROP_MALLOC(nlen, M_PROP_STRING);
 	if (str == NULL)
 		return (NULL);
 
 	va_start(ap, fmt);
-	vsnprintf(str, len + 1, fmt, ap);
+	vsnprintf(str, nlen, fmt, ap);
 	va_end(ap);
 
-	ps = _prop_string_instantiate(0, str, len);
+	ps = _prop_string_instantiate(0, str, (size_t)len);
 	if (ps == NULL)
 		_PROP_FREE(str, M_PROP_STRING);
 



CVS commit: src/usr.bin/make

2020-06-19 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Fri Jun 19 21:17:48 UTC 2020

Modified Files:
src/usr.bin/make: job.c main.c make.h

Log Message:
Avoid unnecessary noise when sub-make or sibling dies

When analyzing a build log, the first 'stopped' output
from make, is the end of interesting output.

Normally when a build fails deep down in a parallel build
the log ends with many blockes of error output from make,
with all but the fist being unhelpful.

We add a function dieQuietly() which will return true
if we should supress the error output from make.
If the failing node was a sub-make, we want to die quietly.

Also when we read an abort token we call dieQuietly telling we
want to die quietly.

This behavior is suppressed by -dj or
setting .MAKE.DIE_QUIETLY=no

Reviewed by: christos


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/make/job.c
cvs rdiff -u -r1.274 -r1.275 src/usr.bin/make/main.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/make/make.h

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.197 src/usr.bin/make/job.c:1.198
--- src/usr.bin/make/job.c:1.197	Thu Feb  6 01:13:19 2020
+++ src/usr.bin/make/job.c	Fri Jun 19 21:17:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $	*/
+/*	$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.197 2020/02/06 01:13:19 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.198 2020/06/19 21:17:48 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1042,10 +1042,11 @@ JobFinish(Job *job, int status)
 		meta_job_error(job, job->node, job->flags, WEXITSTATUS(status));
 		}
 #endif
-		(void)printf("*** [%s] Error code %d%s\n",
-job->node->name,
-			   WEXITSTATUS(status),
-			   (job->flags & JOB_IGNERR) ? " (ignored)" : "");
+		if (!dieQuietly(job->node, -1))
+		(void)printf("*** [%s] Error code %d%s\n",
+ job->node->name,
+ WEXITSTATUS(status),
+ (job->flags & JOB_IGNERR) ? " (ignored)" : "");
 		if (job->flags & JOB_IGNERR) {
 		status = 0;
 		} else {
@@ -3020,6 +3021,8 @@ Job_TokenWithdraw(void)
 	/* And put the stopper back */
 	while (write(tokenWaitJob.outPipe, , 1) == -1 && errno == EAGAIN)
 	continue;
+	if (dieQuietly(NULL, 1))
+	exit(2);
 	Fatal("A failure has been detected in another branch of the parallel make");
 }
 

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.274 src/usr.bin/make/main.c:1.275
--- src/usr.bin/make/main.c:1.274	Mon Mar 30 02:41:06 2020
+++ src/usr.bin/make/main.c	Fri Jun 19 21:17:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.275 2020/06/19 21:17:48 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.275 2020/06/19 21:17:48 sjg Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.274 2020/03/30 02:41:06 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.275 2020/06/19 21:17:48 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1855,6 +1855,8 @@ void
 Finish(int errors)
 	   	/* number of errors encountered in Make_Make */
 {
+	if (dieQuietly(NULL, -1))
+		exit(2);
 	Fatal("%d error%s", errors, errors == 1 ? "" : "s");
 }
 
@@ -2009,6 +2011,27 @@ addErrorCMD(void *cmdp, void *gnp)
 return 0;
 }
 
+/*
+ * Return true if we should die without noise.
+ * For example our failing child was a sub-make
+ * or failure happend elsewhere.
+ */
+int
+dieQuietly(GNode *gn, int bf)
+{
+static int quietly = -1;
+
+if (quietly < 0) {
+	if (DEBUG(JOB) || getBoolean(".MAKE.DIE_QUIETLY", 1) == 0)
+	quietly = 0;
+	else if (bf >= 0)
+	quietly = bf;
+	else
+	quietly = (gn) ? ((gn->type  & (OP_MAKE|OP_SUBMAKE)) != 0) : 0;
+}
+return quietly;
+}
+
 void
 PrintOnError(GNode *gn, const char *s)
 {
@@ -2016,6 +2039,10 @@ PrintOnError(GNode *gn, const char *s)
 char tmp[64];
 char *cp;
 
+/* we generally want to keep quiet if a sub-make died */
+if (dieQuietly(gn, -1))
+	return;
+
 if (s)
 	printf("%s", s);
 	

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.107 src/usr.bin/make/make.h:1.108
--- 

CVS commit: src/sys/dev/raidframe

2020-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Jun 19 19:32:03 UTC 2020

Modified Files:
src/sys/dev/raidframe: rf_diskqueue.c

Log Message:
remove unnnecessary splbio() in rf_FreeDiskQueueData()


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/raidframe/rf_diskqueue.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/dev/raidframe/rf_diskqueue.c
diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.57 src/sys/dev/raidframe/rf_diskqueue.c:1.58
--- src/sys/dev/raidframe/rf_diskqueue.c:1.57	Fri Jun 19 19:29:39 2020
+++ src/sys/dev/raidframe/rf_diskqueue.c	Fri Jun 19 19:32:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $	*/
+/*	$NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -66,7 +66,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $");
 
 #include 
 
@@ -405,9 +405,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, 
 void
 rf_FreeDiskQueueData(RF_DiskQueueData_t *p)
 {
-	int s;
-	s = splbio();		/* XXX protect only pool_put, or neither? */
 	putiobuf(p->bp);
 	pool_put(_pools.dqd, p);
-	splx(s);
 }



CVS commit: src/sys/dev/raidframe

2020-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Jun 19 19:29:39 UTC 2020

Modified Files:
src/sys/dev/raidframe: rf_dag.h rf_dagfuncs.c rf_diskqueue.c
rf_diskqueue.h rf_netbsd.h rf_netbsdkintf.c

Log Message:
pass down b_flags B_PHYS|B_RAW|B_MEDIA_FLAGS from bio subsystem
to component I/O

fixes the xbd(4) KASSERT() triggered by raidframe, noted in PR kern/55397
by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_dag.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_dagfuncs.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/raidframe/rf_diskqueue.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/raidframe/rf_diskqueue.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_netbsd.h
cvs rdiff -u -r1.383 -r1.384 src/sys/dev/raidframe/rf_netbsdkintf.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/dev/raidframe/rf_dag.h
diff -u src/sys/dev/raidframe/rf_dag.h:1.20 src/sys/dev/raidframe/rf_dag.h:1.21
--- src/sys/dev/raidframe/rf_dag.h:1.20	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_dag.h	Fri Jun 19 19:29:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_dag.h,v 1.20 2019/10/10 03:43:59 christos Exp $	*/
+/*	$NetBSD: rf_dag.h,v 1.21 2020/06/19 19:29:39 jdolecek Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -178,7 +178,7 @@ struct RF_DagHeader_s {
 	RF_Raid_t *raidPtr;	/* the descriptor for the RAID device this DAG
  * is for */
 	RF_RaidAccessDesc_t *desc;	/* ptr to descriptor for this access */
-	void   *bp;		/* the bp for this I/O passed down from the
+	const struct buf *bp;	/* the bp for this I/O passed down from the
  * file system. ignored outside kernel */
 };
 

Index: src/sys/dev/raidframe/rf_dagfuncs.c
diff -u src/sys/dev/raidframe/rf_dagfuncs.c:1.31 src/sys/dev/raidframe/rf_dagfuncs.c:1.32
--- src/sys/dev/raidframe/rf_dagfuncs.c:1.31	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_dagfuncs.c	Fri Jun 19 19:29:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $	*/
+/*	$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.31 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $");
 
 #include 
 #include 
@@ -272,10 +272,6 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *
 	unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
 	RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_READ : RF_IO_TYPE_NOP;
 	RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues;
-	void   *b_proc = NULL;
-
-	if (node->dagHdr->bp)
-		b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc;
 
 	req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
 	bf, parityStripeID, which_ru, node->wakeFunc, node,
@@ -284,7 +280,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *
 #else
  NULL,
 #endif
-	(void *) (node->dagHdr->raidPtr), 0, b_proc, PR_NOWAIT);
+	(void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp, PR_NOWAIT);
 	if (!req) {
 		(node->wakeFunc) (node, ENOMEM);
 	} else {
@@ -308,10 +304,6 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t 
 	unsigned which_ru = RF_EXTRACT_RU(node->params[3].v);
 	RF_IoType_t iotype = (node->dagHdr->status == rf_enable) ? RF_IO_TYPE_WRITE : RF_IO_TYPE_NOP;
 	RF_DiskQueue_t *dqs = ((RF_Raid_t *) (node->dagHdr->raidPtr))->Queues;
-	void   *b_proc = NULL;
-
-	if (node->dagHdr->bp)
-		b_proc = (void *) ((struct buf *) node->dagHdr->bp)->b_proc;
 
 	/* normal processing (rollaway or forward recovery) begins here */
 	req = rf_CreateDiskQueueData(iotype, pda->startSector, pda->numSector,
@@ -322,7 +314,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t 
 	NULL,
 #endif
 	(void *) (node->dagHdr->raidPtr),
-	0, b_proc, PR_NOWAIT);
+	0, node->dagHdr->bp, PR_NOWAIT);
 
 	if (!req) {
 		(node->wakeFunc) (node, ENOMEM);

Index: src/sys/dev/raidframe/rf_diskqueue.c
diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.56 src/sys/dev/raidframe/rf_diskqueue.c:1.57
--- src/sys/dev/raidframe/rf_diskqueue.c:1.56	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_diskqueue.c	Fri Jun 19 19:29:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $	*/
+/*	$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -66,7 +66,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.56 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.57 2020/06/19 19:29:39 jdolecek Exp $");
 
 #include 
 
@@ 

CVS commit: src/sys/arch/mac68k/mac68k

2020-06-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 19 16:30:31 UTC 2020

Modified Files:
src/sys/arch/mac68k/mac68k: pram.c

Log Message:
KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mac68k/mac68k/pram.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/mac68k/mac68k/pram.c
diff -u src/sys/arch/mac68k/mac68k/pram.c:1.23 src/sys/arch/mac68k/mac68k/pram.c:1.24
--- src/sys/arch/mac68k/mac68k/pram.c:1.23	Wed Mar 26 17:46:04 2014
+++ src/sys/arch/mac68k/mac68k/pram.c	Fri Jun 19 16:30:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pram.c,v 1.23 2014/03/26 17:46:04 christos Exp $	*/
+/*	$NetBSD: pram.c,v 1.24 2020/06/19 16:30:31 tsutsui Exp $	*/
 
 /*-
  * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pram.c,v 1.23 2014/03/26 17:46:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pram.c,v 1.24 2020/06/19 16:30:31 tsutsui Exp $");
 
 #include "opt_adb.h"
 
@@ -54,107 +54,102 @@ __KERNEL_RCSID(0, "$NetBSD: pram.c,v 1.2
 #if DEBUG
 static const char *convtime(unsigned long t)
 {
-  static long daypmon[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
-  static const char *monstr[] = {"January","February","March","April","May",
-"June","July","August","September","October","November","December" };
-  static char s[200];
-  long year,month,day,hour,minute,seconds,i,dayperyear;
-
-  year=1904;
-  month=0;  /* Jan */
-  day=1;
-  hour=0;
-  minute=0;
-  seconds=0;
-
-  if(t == 0x)
- return("");
-
-  while (t > 0)
-  {
-if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
-{
-  dayperyear=366;
-  daypmon[1]=29;
-}
-else
-{
-  dayperyear=365;
-  daypmon[1]=28;
-}
-i=dayperyear*60*60*24;
-if (t >= i)
-{
-  t-=i;
-  year++;
-  continue;
-}
-i=daypmon[month]*60*60*24;
-if (t >= i)
-{
-  t-=i;
-  month++;
-  continue;
-}
-i=60*60*24;
-if (t >= i)
-{
-  t-=i;
-  day++;
-  continue;
-}
-i=60*60;
-if (t >= i)
-{
-  t-=i;
-  hour++;
-  continue;
-}
-i=60;
-if (t >= i)
-{
-  t-=i;
-  minute++;
-  continue;
-}
-seconds=t;
-t=0;
-  }
+	static long daypmon[] =
+	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+	static const char *monstr[] = {
+	"January", "February", "March", "April", "May", "June",
+	"July", "August", "September", "October", "November", "December"
+	};
+	static char s[200];
+	long year, month, day, hour, minute, seconds, i, dayperyear;
+
+	year = 1904;
+	month = 0;	/* Jan */
+	day = 1;
+	hour = 0;
+	minute = 0;
+	seconds = 0;
+
+	if (t == 0x)
+		return "";
+
+	while (t > 0) {
+		if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
+			dayperyear = 366;
+			daypmon[1] = 29;
+		} else {
+			dayperyear = 365;
+			daypmon[1] = 28;
+		}
+		i = dayperyear * 60 * 60 * 24;
+		if (t >= i) {
+			t -= i;
+			year++;
+			continue;
+		}
+		i = daypmon[month] * 60 * 60 * 24;
+		if (t >= i) {
+			t -= i;
+			month++;
+			continue;
+		}
+		i = 60 * 60 * 24;
+		if (t >= i) {
+			t -= i;
+			day++;
+			continue;
+		}
+		i = 60 * 60;
+		if (t >= i) {
+			t -= i;
+			hour++;
+			continue;
+		}
+		i = 60;
+		if (t >= i) {
+			t -= i;
+			minute++;
+			continue;
+		}
+		seconds = t;
+		t = 0;
+	}
 
-  snprintf(s, sizeof(s), "%s %ld, %ld   %ld:%ld:%ld",
-  monstr[month], day, year, hour, minute, seconds);
+	snprintf(s, sizeof(s), "%s %ld, %ld   %ld:%ld:%ld",
+	monstr[month], day, year, hour, minute, seconds);
 
-  return s;
+	return s;
 }
 #endif
 
 unsigned long
 pram_readtime(void)
 {
-   unsigned long	timedata;
+	unsigned long	timedata;
 
 #ifdef MRG_ADB
-   if (0 == jClkNoMem)
-	timedata = 0;	/* cause comparision of MacOS boottime */
-			/* and PRAM time to fail */
-   else
+	if (0 == jClkNoMem)
+		timedata = 0;	/* cause comparision of MacOS boottime */
+/* and PRAM time to fail */
+	else
 #endif
 	timedata = getPramTime();
 #if DEBUG
-   printf("time read from PRAM: 0x%lx\n", timedata);
-   printf("Date and time: %s\n",convtime(timedata));
+	printf("time read from PRAM: 0x%lx\n", timedata);
+	printf("Date and time: %s\n",convtime(timedata));
 #endif
 
-   return(timedata);
+	return timedata;
 }
 
 void
 pram_settime(unsigned long curtime)
 {
+
 #ifdef MRG_ADB
-   if (0 == jClkNoMem)
-	return;
-   else
+	if (0 == jClkNoMem)
+		return;
+	else
 #endif
 	return setPramTime(curtime);
 }
@@ -211,6 +206,7 @@ getPramTime(void)
 void
 setPramTime(unsigned long curtime)
 {
+
 	switch (adbHardware) {
 	case ADB_HW_IOP:
 	case ADB_HW_II:		/* access PRAM via ADB interface */



CVS commit: src/sys/arch/x86

2020-06-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jun 19 16:20:22 UTC 2020

Modified Files:
src/sys/arch/x86/include: cpu.h sysarch.h
src/sys/arch/x86/x86: sys_machdep.c

Log Message:
localify


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/include/sysarch.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/x86/x86/sys_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/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.125 src/sys/arch/x86/include/cpu.h:1.126
--- src/sys/arch/x86/include/cpu.h:1.125	Sat May  2 16:44:35 2020
+++ src/sys/arch/x86/include/cpu.h	Fri Jun 19 16:20:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.125 2020/05/02 16:44:35 bouyer Exp $	*/
+/*	$NetBSD: cpu.h,v 1.126 2020/06/19 16:20:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -565,12 +565,6 @@ void	cpu_probe_features(struct cpu_info 
 void	cpu_proc_fork(struct proc *, struct proc *);
 paddr_t	kvtop(void *);
 
-#ifdef USER_LDT
-/* sys_machdep.h */
-int	x86_get_ldt(struct lwp *, void *, register_t *);
-int	x86_set_ldt(struct lwp *, void *, register_t *);
-#endif
-
 /* isa_machdep.c */
 void	isa_defaultirq(void);
 int	isa_nmi(void);

Index: src/sys/arch/x86/include/sysarch.h
diff -u src/sys/arch/x86/include/sysarch.h:1.14 src/sys/arch/x86/include/sysarch.h:1.15
--- src/sys/arch/x86/include/sysarch.h:1.14	Fri Jul 13 09:37:32 2018
+++ src/sys/arch/x86/include/sysarch.h	Fri Jun 19 16:20:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysarch.h,v 1.14 2018/07/13 09:37:32 maxv Exp $	*/
+/*	$NetBSD: sysarch.h,v 1.15 2020/06/19 16:20:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -125,11 +125,7 @@ struct mtrr;
 
 #ifdef _KERNEL
 int x86_iopl(struct lwp *, void *, register_t *);
-int x86_get_mtrr(struct lwp *, void *, register_t *);
-int x86_set_mtrr(struct lwp *, void *, register_t *);
-int x86_get_ldt(struct lwp *, void *, register_t *);
 int x86_get_ldt1(struct lwp *, struct x86_get_ldt_args *, union descriptor *);
-int x86_set_ldt(struct lwp *, void *, register_t *);
 int x86_set_ldt1(struct lwp *, struct x86_set_ldt_args *, union descriptor *);
 int x86_set_sdbase(void *, char, lwp_t *, bool);
 int x86_get_sdbase(void *, char);

Index: src/sys/arch/x86/x86/sys_machdep.c
diff -u src/sys/arch/x86/x86/sys_machdep.c:1.55 src/sys/arch/x86/x86/sys_machdep.c:1.56
--- src/sys/arch/x86/x86/sys_machdep.c:1.55	Sat Apr 25 15:26:18 2020
+++ src/sys/arch/x86/x86/sys_machdep.c	Fri Jun 19 16:20:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_machdep.c,v 1.55 2020/04/25 15:26:18 bouyer Exp $	*/
+/*	$NetBSD: sys_machdep.c,v 1.56 2020/06/19 16:20:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.55 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.56 2020/06/19 16:20:22 maxv Exp $");
 
 #include "opt_mtrr.h"
 #include "opt_user_ldt.h"
@@ -75,16 +75,15 @@ __KERNEL_RCSID(0, "$NetBSD: sys_machdep.
 
 extern struct vm_map *kernel_map;
 
-int x86_get_ioperm(struct lwp *, void *, register_t *);
-int x86_set_ioperm(struct lwp *, void *, register_t *);
-int x86_get_mtrr(struct lwp *, void *, register_t *);
-int x86_set_mtrr(struct lwp *, void *, register_t *);
-int x86_set_sdbase32(void *, char, lwp_t *, bool);
+static int x86_get_ioperm(struct lwp *, void *, register_t *);
+static int x86_set_ioperm(struct lwp *, void *, register_t *);
+static int x86_set_sdbase32(void *, char, lwp_t *, bool);
 int x86_set_sdbase(void *, char, lwp_t *, bool);
-int x86_get_sdbase32(void *, char);
+static int x86_get_sdbase32(void *, char);
 int x86_get_sdbase(void *, char);
 
-int
+#ifdef i386
+static int
 x86_get_ldt(struct lwp *l, void *args, register_t *retval)
 {
 #ifndef USER_LDT
@@ -113,6 +112,7 @@ x86_get_ldt(struct lwp *l, void *args, r
 	return error;
 #endif
 }
+#endif
 
 int
 x86_get_ldt1(struct lwp *l, struct x86_get_ldt_args *ua, union descriptor *cp)
@@ -175,7 +175,8 @@ x86_get_ldt1(struct lwp *l, struct x86_g
 #endif
 }
 
-int
+#ifdef i386
+static int
 x86_set_ldt(struct lwp *l, void *args, register_t *retval)
 {
 #ifndef USER_LDT
@@ -201,6 +202,7 @@ x86_set_ldt(struct lwp *l, void *args, r
 	return error;
 #endif
 }
+#endif
 
 int
 x86_set_ldt1(struct lwp *l, struct x86_set_ldt_args *ua,
@@ -388,7 +390,7 @@ x86_iopl(struct lwp *l, void *args, regi
 	return 0;
 }
 
-int
+static int
 x86_get_ioperm(struct lwp *l, void *args, register_t *retval)
 {
 #ifdef IOPERM
@@ -421,7 +423,7 @@ x86_get_ioperm(struct lwp *l, void *args
 #endif
 }
 
-int
+static int
 x86_set_ioperm(struct lwp *l, void *args, register_t *retval)
 {
 #ifdef IOPERM
@@ -467,7 +469,7 @@ x86_set_ioperm(struct lwp *l, void *args
 #endif
 }
 
-int
+static int
 

CVS commit: src/sys/arch/arm/imx

2020-06-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 19 16:11:15 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imx6_ccm.c imx6_ccmvar.h

Log Message:
Spell GENERIC correctly.  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/imx/imx6_ccm.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/imx6_ccmvar.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/arm/imx/imx6_ccm.c
diff -u src/sys/arch/arm/imx/imx6_ccm.c:1.18 src/sys/arch/arm/imx/imx6_ccm.c:1.19
--- src/sys/arch/arm/imx/imx6_ccm.c:1.18	Mon Jun  8 07:48:57 2020
+++ src/sys/arch/arm/imx/imx6_ccm.c	Fri Jun 19 16:11:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccm.c,v 1.18 2020/06/08 07:48:57 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccm.c,v 1.19 2020/06/19 16:11:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 2010-2012, 2014  Genetec Corporation.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.18 2020/06/08 07:48:57 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ccm.c,v 1.19 2020/06/19 16:11:14 skrll Exp $");
 
 #include "opt_cputypes.h"
 
@@ -661,7 +661,7 @@ static struct imx6_clk imx6_clks[] = {
 	CLK_PFD("pll3_pfd3_454m", "pll3_usb_otg", PFD_480, 3),
 
 	CLK_PLL("pll1", "osc", SYS, PLL_ARM, DIV_SELECT, POWERDOWN, 0),
-	CLK_PLL("pll2", "osc", GENNERIC, PLL_SYS, DIV_SELECT, POWERDOWN, 0),
+	CLK_PLL("pll2", "osc", GENERIC, PLL_SYS, DIV_SELECT, POWERDOWN, 0),
 	CLK_PLL("pll3", "osc", USB, PLL_USB1, DIV_SELECT, POWER, 0),
 	CLK_PLL("pll4", "osc", AUDIO_VIDEO, PLL_AUDIO, DIV_SELECT, POWERDOWN, 0),
 	CLK_PLL("pll5", "osc", AUDIO_VIDEO, PLL_VIDEO, DIV_SELECT, POWERDOWN, 0),
@@ -1035,7 +1035,7 @@ imxccm_clk_get_rate_pll_generic(struct i
 	struct imx6_clk_pll *pll = >clk.pll;
 	uint64_t freq = rate_parent;
 
-	KASSERT((pll->type == IMX6_CLK_PLL_GENNERIC) ||
+	KASSERT((pll->type == IMX6_CLK_PLL_GENERIC) ||
 	(pll->type == IMX6_CLK_PLL_USB));
 
 	uint32_t v = bus_space_read_4(sc->sc_iot, sc->sc_ioh_analog, pll->reg);
@@ -1124,7 +1124,7 @@ imxccm_clk_get_rate_pll(struct imxccm_so
 	uint64_t rate_parent = imxccm_clk_get_rate(sc, >base);
 
 	switch(pll->type) {
-	case IMX6_CLK_PLL_GENNERIC:
+	case IMX6_CLK_PLL_GENERIC:
 		return imxccm_clk_get_rate_pll_generic(sc, iclk, rate_parent);
 	case IMX6_CLK_PLL_SYS:
 		return imxccm_clk_get_rate_pll_sys(sc, iclk, rate_parent);

Index: src/sys/arch/arm/imx/imx6_ccmvar.h
diff -u src/sys/arch/arm/imx/imx6_ccmvar.h:1.7 src/sys/arch/arm/imx/imx6_ccmvar.h:1.8
--- src/sys/arch/arm/imx/imx6_ccmvar.h:1.7	Wed Jul 24 11:58:00 2019
+++ src/sys/arch/arm/imx/imx6_ccmvar.h	Fri Jun 19 16:11:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ccmvar.h,v 1.7 2019/07/24 11:58:00 hkenken Exp $	*/
+/*	$NetBSD: imx6_ccmvar.h,v 1.8 2020/06/19 16:11:14 skrll Exp $	*/
 /*
  * Copyright (c) 2012,2019  Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -326,7 +326,7 @@ enum imx6_clk_reg {
 };
 
 enum imx6_clk_pll_type {
-	IMX6_CLK_PLL_GENNERIC,
+	IMX6_CLK_PLL_GENERIC,
 	IMX6_CLK_PLL_SYS,
 	IMX6_CLK_PLL_USB,
 	IMX6_CLK_PLL_AUDIO_VIDEO,



CVS commit: src/sys/netinet6

2020-06-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Jun 19 16:08:06 UTC 2020

Modified Files:
src/sys/netinet6: ip6_input.c ip6_var.h

Log Message:
localify


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.83 -r1.84 src/sys/netinet6/ip6_var.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/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.216 src/sys/netinet6/ip6_input.c:1.217
--- src/sys/netinet6/ip6_input.c:1.216	Fri Jun 12 11:04:45 2020
+++ src/sys/netinet6/ip6_input.c	Fri Jun 19 16:08:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.216 2020/06/12 11:04:45 roy Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.217 2020/06/19 16:08:06 maxv Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.216 2020/06/12 11:04:45 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.217 2020/06/19 16:08:06 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -135,9 +135,14 @@ percpu_t *ip6stat_percpu;
 percpu_t *ip6_forward_rt_percpu __cacheline_aligned;
 
 static void ip6intr(void *);
+static void ip6_input(struct mbuf *, struct ifnet *);
 static bool ip6_badaddr(struct ip6_hdr *);
 static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *);
 
+static struct m_tag *ip6_addaux(struct mbuf *);
+static struct m_tag *ip6_findaux(struct mbuf *);
+static void ip6_delaux(struct mbuf *);
+
 static int ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *,
 u_int32_t *);
 static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int);
@@ -225,7 +230,7 @@ ip6intr(void *arg __unused)
 	SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
 }
 
-void
+static void
 ip6_input(struct mbuf *m, struct ifnet *rcvif)
 {
 	struct ip6_hdr *ip6;
@@ -1479,7 +1484,7 @@ ip6_lasthdr(struct mbuf *m, int off, int
 	}
 }
 
-struct m_tag *
+static struct m_tag *
 ip6_addaux(struct mbuf *m)
 {
 	struct m_tag *mtag;
@@ -1496,7 +1501,7 @@ ip6_addaux(struct mbuf *m)
 	return mtag;
 }
 
-struct m_tag *
+static struct m_tag *
 ip6_findaux(struct mbuf *m)
 {
 	struct m_tag *mtag;
@@ -1505,7 +1510,7 @@ ip6_findaux(struct mbuf *m)
 	return mtag;
 }
 
-void
+static void
 ip6_delaux(struct mbuf *m)
 {
 	struct m_tag *mtag;

Index: src/sys/netinet6/ip6_var.h
diff -u src/sys/netinet6/ip6_var.h:1.83 src/sys/netinet6/ip6_var.h:1.84
--- src/sys/netinet6/ip6_var.h:1.83	Fri Jun 12 11:04:45 2020
+++ src/sys/netinet6/ip6_var.h	Fri Jun 19 16:08:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_var.h,v 1.83 2020/06/12 11:04:45 roy Exp $	*/
+/*	$NetBSD: ip6_var.h,v 1.84 2020/06/19 16:08:06 maxv Exp $	*/
 /*	$KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $	*/
 
 /*
@@ -276,7 +276,6 @@ int	icmp6_ctloutput(int, struct socket *
 
 struct mbuf;
 void	ip6_init(void);
-void	ip6_input(struct mbuf *, struct ifnet *);
 const struct ip6aux *ip6_getdstifaddr(struct mbuf *);
 void	ip6_freepcbopts(struct ip6_pktopts *);
 void	ip6_freemoptions(struct ip6_moptions *);
@@ -285,9 +284,6 @@ int	ip6_get_prevhdr(struct mbuf *, int);
 int	ip6_nexthdr(struct mbuf *, int, int, int *);
 int	ip6_lasthdr(struct mbuf *, int, int, int *);
 
-struct m_tag *ip6_addaux(struct mbuf *);
-struct m_tag *ip6_findaux(struct mbuf *);
-void	ip6_delaux(struct mbuf *);
 struct ip6_hdr;
 int	ip6_mforward(struct ip6_hdr *, struct ifnet *, struct mbuf *);
 int	ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *);



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Jun 19 14:13:23 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zio.c

Log Message:
use pool_cache for (meta)data buffers also on NetBSD

this should generally slightly improve performance on MP systems, and
specifically for xbd(4) storage avoids slow unaligned I/O buffer handling

this change requires updated kernel, to allow up to SPA_MAXBLOCKSHIFT item
size for pools

fixes PR kern/55397 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c:1.6	Tue May  7 08:49:59 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zio.c	Fri Jun 19 14:13:23 2020
@@ -46,7 +46,7 @@
 SYSCTL_DECL(_vfs_zfs);
 SYSCTL_NODE(_vfs_zfs, OID_AUTO, zio, CTLFLAG_RW, 0, "ZFS ZIO");
 #ifdef __NetBSD__
-const int zio_use_uma = 0;
+const int zio_use_uma = 1;
 #else
 #if defined(__amd64__)
 static int zio_use_uma = 1;
@@ -156,7 +156,6 @@ zio_init(void)
 	zio_link_cache = kmem_cache_create("zio_link_cache",
 	sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0);
 
-#ifndef __NetBSD__
 	if (!zio_use_uma)
 		goto out;
 
@@ -220,7 +219,6 @@ zio_init(void)
 			zio_data_buf_cache[c - 1] = zio_data_buf_cache[c];
 	}
 out:
-#endif /* __NetBSD__ */
 
 	zio_inject_init();
 
@@ -242,7 +240,6 @@ zio_fini(void)
 	kmem_cache_t *last_cache = NULL;
 	kmem_cache_t *last_data_cache = NULL;
 
-#ifndef __NetBSD__	
 	for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) {
 		if (zio_buf_cache[c] != last_cache) {
 			last_cache = zio_buf_cache[c];
@@ -256,7 +253,6 @@ zio_fini(void)
 		}
 		zio_data_buf_cache[c] = NULL;
 	}
-#endif /* __NetBSD__ */
 
 	kmem_cache_destroy(zio_link_cache);
 	kmem_cache_destroy(zio_cache);



CVS commit: src/sys/sys

2020-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Jun 19 13:52:40 UTC 2020

Modified Files:
src/sys/sys: param.h

Log Message:
bump version - maximum item size for pool_init()/pool_cache_init() changed

PR kern/55397


To generate a diff of this commit:
cvs rdiff -u -r1.670 -r1.671 src/sys/sys/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/sys/param.h
diff -u src/sys/sys/param.h:1.670 src/sys/sys/param.h:1.671
--- src/sys/sys/param.h:1.670	Sat Jun 13 23:59:16 2020
+++ src/sys/sys/param.h	Fri Jun 19 13:52:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.670 2020/06/13 23:59:16 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.671 2020/06/19 13:52:40 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999006700	/* NetBSD 9.99.67 */
+#define	__NetBSD_Version__	999006800	/* NetBSD 9.99.68 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/kern

2020-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Jun 19 13:49:38 UTC 2020

Modified Files:
src/sys/kern: subr_pool.c

Log Message:
bump the limit on max item size for pool_init()/pool_cache_init() up
to 1 << 24, so that the pools can be used for ZFS block allocations, which
are up to SPA_MAXBLOCKSHIFT (1 << 24)

part of PR kern/55397 by Frank Kardel


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/sys/kern/subr_pool.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/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.272 src/sys/kern/subr_pool.c:1.273
--- src/sys/kern/subr_pool.c:1.272	Sun Jun 14 23:17:01 2020
+++ src/sys/kern/subr_pool.c	Fri Jun 19 13:49:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.272 2020/06/14 23:17:01 ad Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.273 2020/06/19 13:49:38 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.272 2020/06/14 23:17:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.273 2020/06/19 13:49:38 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -223,6 +223,26 @@ static struct pool_allocator pool_alloca
 		.pa_alloc = pool_page_alloc,
 		.pa_free = pool_page_free,
 		.pa_pagesz = 1 << (POOL_ALLOCATOR_BIG_BASE + 7),
+	},
+	{
+		.pa_alloc = pool_page_alloc,
+		.pa_free = pool_page_free,
+		.pa_pagesz = 1 << (POOL_ALLOCATOR_BIG_BASE + 8),
+	},
+	{
+		.pa_alloc = pool_page_alloc,
+		.pa_free = pool_page_free,
+		.pa_pagesz = 1 << (POOL_ALLOCATOR_BIG_BASE + 9),
+	},
+	{
+		.pa_alloc = pool_page_alloc,
+		.pa_free = pool_page_free,
+		.pa_pagesz = 1 << (POOL_ALLOCATOR_BIG_BASE + 10),
+	},
+	{
+		.pa_alloc = pool_page_alloc,
+		.pa_free = pool_page_free,
+		.pa_pagesz = 1 << (POOL_ALLOCATOR_BIG_BASE + 11),
 	}
 };
 



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

2020-06-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Jun 19 12:38:54 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: machdep.c

Log Message:
Don't include now non-existant "opt_cavium.h".


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbmips/cavium/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/evbmips/cavium/machdep.c
diff -u src/sys/arch/evbmips/cavium/machdep.c:1.14 src/sys/arch/evbmips/cavium/machdep.c:1.15
--- src/sys/arch/evbmips/cavium/machdep.c:1.14	Mon Jun 15 07:48:12 2020
+++ src/sys/arch/evbmips/cavium/machdep.c	Fri Jun 19 12:38:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.14 2020/06/15 07:48:12 simonb Exp $	*/
+/*	$NetBSD: machdep.c,v 1.15 2020/06/19 12:38:53 simonb Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -112,10 +112,9 @@
  */
 
 #include "opt_multiprocessor.h"
-#include "opt_cavium.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.14 2020/06/15 07:48:12 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.15 2020/06/19 12:38:53 simonb Exp $");
 
 #include 
 #include 



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

2020-06-19 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Jun 19 12:24:39 UTC 2020

Modified Files:
src/sys/arch/evbmips/conf: files.octeon

Log Message:
OCTEON_MEMSIZE isn't used now, remove declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbmips/conf/files.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/evbmips/conf/files.octeon
diff -u src/sys/arch/evbmips/conf/files.octeon:1.6 src/sys/arch/evbmips/conf/files.octeon:1.7
--- src/sys/arch/evbmips/conf/files.octeon:1.6	Wed Dec 28 03:27:08 2016
+++ src/sys/arch/evbmips/conf/files.octeon	Fri Jun 19 12:24:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.octeon,v 1.6 2016/12/28 03:27:08 mrg Exp $
+#	$NetBSD: files.octeon,v 1.7 2020/06/19 12:24:39 simonb Exp $
 
 file	arch/evbmips/cavium/autoconf.c
 file	arch/evbmips/cavium/machdep.c
@@ -18,6 +18,3 @@ include	"external/bsd/sljit/conf/files.s
 
 # Memory Disk
 file	dev/md_root.cmemory_disk_hooks
-
-# workaround Cavium 50x0 problem vs uvm freelists
-defparam opt_cavium.h		OCTEON_MEMSIZE



CVS commit: src/sys/dev/usb

2020-06-19 Thread Felix Deichmann
Module Name:src
Committed By:   flxd
Date:   Fri Jun 19 11:52:42 UTC 2020

Modified Files:
src/sys/dev/usb: umass_quirks.c usbdevs

Log Message:
Add umass quirk for Alcor AU6366 multi-card reader.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/umass_quirks.c
cvs rdiff -u -r1.782 -r1.783 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/umass_quirks.c
diff -u src/sys/dev/usb/umass_quirks.c:1.101 src/sys/dev/usb/umass_quirks.c:1.102
--- src/sys/dev/usb/umass_quirks.c:1.101	Mon Apr 13 09:26:43 2020
+++ src/sys/dev/usb/umass_quirks.c	Fri Jun 19 11:52:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_quirks.c,v 1.101 2020/04/13 09:26:43 jdolecek Exp $	*/
+/*	$NetBSD: umass_quirks.c,v 1.102 2020/06/19 11:52:42 flxd Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass_quirks.c,v 1.101 2020/04/13 09:26:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_quirks.c,v 1.102 2020/06/19 11:52:42 flxd Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -330,6 +330,19 @@ Static const struct umass_quirk umass_qu
 	  UMATCH_VENDOR_PRODUCT,
 	  NULL, NULL
 	},
+
+	/*
+	 * Fix Alcor multi-card readers in many HP machines (like net-tops).
+	 * FreeBSD applies the no-sync-cache quirk for /all/ Alcor usb devices
+	 * as well as a no-test-unit-ready quirk. Mine works without the latter.
+	 */
+	{ { USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6366 },
+	  UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
+	  0,
+	  PQUIRK_NOSYNCCACHE,
+	  UMATCH_VENDOR_PRODUCT,
+	  NULL, NULL
+	},
 };
 
 const struct umass_quirk *

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.782 src/sys/dev/usb/usbdevs:1.783
--- src/sys/dev/usb/usbdevs:1.782	Wed Apr 29 08:05:10 2020
+++ src/sys/dev/usb/usbdevs	Fri Jun 19 11:52:42 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.782 2020/04/29 08:05:10 nia Exp $
+$NetBSD: usbdevs,v 1.783 2020/06/19 11:52:42 flxd Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -803,6 +803,7 @@ product ALCATELT ST121G		0x0121	SpeedTou
 /* Alcor Micro, Inc. products */
 product ALCOR2 KBD_HUB		0x2802	Kbd Hub
 
+product ALCOR AU6366		0x6366	AU6366 USB2.0 Single LUN Multiple Flash Card Reader Controller
 product ALCOR MA_KBD_HUB	0x9213	MacAlly Kbd Hub
 product ALCOR AU9814		0x9215	AU9814 Hub
 product ALCOR SM_KBD		0x9410	MicroConnectors/StrongMan Keyboard



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

2020-06-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jun 19 10:35:11 UTC 2020

Modified Files:
src/sys/arch/sun3/conf: DISKLESS DISKLESS3X GENERIC GENERIC3X INSTALL
INSTALL3X RAMDISK RAMDISK3X

Log Message:
Use "-fno-unwind-tables" to shrink binaries more.

sun3 GENERIC -Os
   textdata bss dec hex filename
1762862   75292   93032 1931186  1d77b2 netbsd

sun3 GENERIC -Os -fno-unwind-tables
   textdata bss dec hex filename
1545726   75292   93032 1714050  1a2782 netbsd

GENERIC is tested on TME.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/sun3/conf/DISKLESS
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sun3/conf/DISKLESS3X \
src/sys/arch/sun3/conf/INSTALL3X
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/sun3/conf/GENERIC
cvs rdiff -u -r1.134 -r1.135 src/sys/arch/sun3/conf/GENERIC3X
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/sun3/conf/INSTALL
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/sun3/conf/RAMDISK
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sun3/conf/RAMDISK3X

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

Modified files:

Index: src/sys/arch/sun3/conf/DISKLESS
diff -u src/sys/arch/sun3/conf/DISKLESS:1.76 src/sys/arch/sun3/conf/DISKLESS:1.77
--- src/sys/arch/sun3/conf/DISKLESS:1.76	Wed Dec 19 13:57:50 2018
+++ src/sys/arch/sun3/conf/DISKLESS	Fri Jun 19 10:35:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: DISKLESS,v 1.76 2018/12/19 13:57:50 maxv Exp $
+# $NetBSD: DISKLESS,v 1.77 2020/06/19 10:35:11 tsutsui Exp $
 
 # DISKLESS - Root and swap on NFS
 # Desktop machines only (3/50, 3/60, 3/110)
@@ -9,7 +9,7 @@ include "arch/sun3/conf/std.sun3"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-makeoptions	COPTS="-Os"		# bootloader has size limit (~2MB)
+makeoptions	COPTS="-Os -fno-unwind-tables"	# bootloader has size limit (~2MB)
 
 # Machines to be supported by this kernel
 options 	FPU_EMULATE

Index: src/sys/arch/sun3/conf/DISKLESS3X
diff -u src/sys/arch/sun3/conf/DISKLESS3X:1.60 src/sys/arch/sun3/conf/DISKLESS3X:1.61
--- src/sys/arch/sun3/conf/DISKLESS3X:1.60	Wed Aug  1 20:04:14 2018
+++ src/sys/arch/sun3/conf/DISKLESS3X	Fri Jun 19 10:35:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: DISKLESS3X,v 1.60 2018/08/01 20:04:14 maxv Exp $
+# $NetBSD: DISKLESS3X,v 1.61 2020/06/19 10:35:11 tsutsui Exp $
 
 # DISKLESS - Root and swap on NFS
 # Desktop machines only (3/80)
@@ -9,7 +9,7 @@ include "arch/sun3/conf/std.sun3x"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-makeoptions	COPTS="-Os"	# bootloader has size limit (~2MB)
+makeoptions	COPTS="-Os -fno-unwind-tables"	# bootloader has size limit (~2MB)
 
 # Machines to be supported by this kernel
 # options 	FPU_EMULATE	# XXX - Ever needed?
Index: src/sys/arch/sun3/conf/INSTALL3X
diff -u src/sys/arch/sun3/conf/INSTALL3X:1.60 src/sys/arch/sun3/conf/INSTALL3X:1.61
--- src/sys/arch/sun3/conf/INSTALL3X:1.60	Wed Aug  1 20:04:14 2018
+++ src/sys/arch/sun3/conf/INSTALL3X	Fri Jun 19 10:35:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL3X,v 1.60 2018/08/01 20:04:14 maxv Exp $
+# $NetBSD: INSTALL3X,v 1.61 2020/06/19 10:35:11 tsutsui Exp $
 #
 # INSTALL3X - Installation kernel for the Sun3X
 #
@@ -11,7 +11,7 @@ include "arch/sun3/conf/std.sun3x"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-makeoptions	COPTS="-Os"	# Optimise for space. Implies -O2
+makeoptions	COPTS="-Os -fno-unwind-tables"	# Optimise for space. Implies -O2
 
 # Machines to be supported by this kernel
 # options 	FPU_EMULATE	# XXX - Ever needed?

Index: src/sys/arch/sun3/conf/GENERIC
diff -u src/sys/arch/sun3/conf/GENERIC:1.181 src/sys/arch/sun3/conf/GENERIC:1.182
--- src/sys/arch/sun3/conf/GENERIC:1.181	Fri Apr 26 22:46:04 2019
+++ src/sys/arch/sun3/conf/GENERIC	Fri Jun 19 10:35:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.181 2019/04/26 22:46:04 sevan Exp $
+# $NetBSD: GENERIC,v 1.182 2020/06/19 10:35:11 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -25,9 +25,9 @@ include 	"arch/sun3/conf/std.sun3"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.181 $"
+#ident		"GENERIC-$Revision: 1.182 $"
 
-makeoptions	COPTS="-Os"		# bootloader has size limit (~2MB)
+makeoptions	COPTS="-Os -fno-unwind-tables"	# bootloader has size limit (~2MB)
 
 # Machines to be supported by this kernel
 options 	FPU_EMULATE

Index: src/sys/arch/sun3/conf/GENERIC3X
diff -u src/sys/arch/sun3/conf/GENERIC3X:1.134 src/sys/arch/sun3/conf/GENERIC3X:1.135
--- src/sys/arch/sun3/conf/GENERIC3X:1.134	Fri Apr 26 22:46:04 2019
+++ src/sys/arch/sun3/conf/GENERIC3X	Fri Jun 19 10:35:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC3X,v 1.134 2019/04/26 22:46:04 sevan Exp $
+# $NetBSD: GENERIC3X,v 1.135 2020/06/19 10:35:11 tsutsui Exp $
 
 # GENERIC Sun3X (3/80, 3/470)
 # Supports root on: ie0, le0, sd*, ...
@@ -7,9 +7,9 @@ include 	"arch/sun3/conf/std.sun3x"
 
 #options 	INCLUDE_CONFIG_FILE	# 

CVS commit: src/sys/dev/scsipi

2020-06-19 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Jun 19 10:30:27 UTC 2020

Modified Files:
src/sys/dev/scsipi: if_se.c

Log Message:
First pass at making this work again.
Remove spl and add some locking around network access (needs more work).
Make sure that we consistently use the channel lock for scsipi commands.
Remove the preference for send over receive, as this can lead to deadlocks
- we only advertise 1 opening, but we can try to send before the receive is
complete in this case.
Don't use XS_CTL_ASYNC because we don't provide a buffer.
Tested on UP sparc and compile-tested on atari.
Tested with LOCKDEBUG.
Still fails with DIAGNOSTIC because we can call into the scsipi routines
from a softint.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/scsipi/if_se.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/dev/scsipi/if_se.c
diff -u src/sys/dev/scsipi/if_se.c:1.104 src/sys/dev/scsipi/if_se.c:1.105
--- src/sys/dev/scsipi/if_se.c:1.104	Wed Jan 29 05:59:50 2020
+++ src/sys/dev/scsipi/if_se.c	Fri Jun 19 10:30:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_se.c,v 1.104 2020/01/29 05:59:50 thorpej Exp $	*/
+/*	$NetBSD: if_se.c,v 1.105 2020/06/19 10:30:27 jdc Exp $	*/
 
 /*
  * Copyright (c) 1997 Ian W. Dall 
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.104 2020/01/29 05:59:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.105 2020/06/19 10:30:27 jdc Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -83,6 +83,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -142,7 +144,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.
 #define SE_POLL0 10		/* default in milliseconds */
 int se_poll = 0;		/* Delay in ticks set at attach time */
 int se_poll0 = 0;
+#ifdef SE_DEBUG
 int se_max_received = 0;	/* Instrumentation */
+#endif
 
 #define	PROTOCMD(p, d) \
 	((d) = (p))
@@ -175,6 +179,8 @@ struct se_softc {
 
 	struct callout sc_ifstart_ch;
 	struct callout sc_recv_ch;
+	struct kmutex sc_iflock;
+	struct if_percpuq *sc_ipq;
 
 	char *sc_tbuf;
 	char *sc_rbuf;
@@ -186,7 +192,6 @@ struct se_softc {
 #define PROTO_AARP	0x10
 	int sc_debug;
 	int sc_flags;
-#define SE_NEED_RECV 0x1
 	int sc_last_timeout;
 	int sc_enabled;
 };
@@ -250,7 +255,7 @@ const struct cdevsw se_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
-	.d_flag = D_OTHER
+	.d_flag = D_OTHER | D_MPSAFE
 };
 
 const struct scsipi_periphsw se_switch = {
@@ -319,8 +324,9 @@ seattach(device_t parent, device_t self,
 	printf("\n");
 	SC_DEBUG(periph, SCSIPI_DB2, ("seattach: "));
 
-	callout_init(>sc_ifstart_ch, 0);
-	callout_init(>sc_recv_ch, 0);
+	callout_init(>sc_ifstart_ch, CALLOUT_MPSAFE);
+	callout_init(>sc_recv_ch, CALLOUT_MPSAFE);
+	mutex_init(>sc_iflock, MUTEX_DEFAULT, IPL_SOFTNET);
 
 	/*
 	 * Store information needed to contact our base driver
@@ -360,13 +366,17 @@ seattach(device_t parent, device_t self,
 		free(sc->sc_tbuf, M_DEVBUF);
 		callout_destroy(>sc_ifstart_ch);
 		callout_destroy(>sc_recv_ch);
+		mutex_destroy(>sc_iflock);
 		return; /* Error */
 	}
+	sc->sc_ipq = if_percpuq_create(>sc_ethercom.ec_if);
 	ether_ifattach(ifp, myaddr);
 	if_register(ifp);
 }
 
-
+/*
+ * Send a command to the device
+ */
 static inline int
 se_scsipi_cmd(struct scsipi_periph *periph, struct scsipi_generic *cmd,
 int cmdlen, u_char *data_addr, int datalen, int retries, int timeout,
@@ -374,21 +384,24 @@ se_scsipi_cmd(struct scsipi_periph *peri
 {
 	int error;
 
+	KASSERT(!mutex_owned(chan_mtx(periph->periph_channel)));
+
 	error = scsipi_command(periph, cmd, cmdlen, data_addr,
 	datalen, retries, timeout, bp, flags);
 	return (error);
 }
 
-/* Start routine for calling from scsi sub system */
+/*
+ * Start routine for calling from scsi sub system
+ * Called with the channel lock held
+ */
 static void
 sestart(struct scsipi_periph *periph)
 {
 	struct se_softc *sc = device_private(periph->periph_dev);
 	struct ifnet *ifp = >sc_ethercom.ec_if;
-	int s = splnet();
 
 	se_ifstart(ifp);
-	(void) splx(s);
 }
 
 static void
@@ -396,19 +409,18 @@ se_delayed_ifstart(void *v)
 {
 	struct ifnet *ifp = v;
 	struct se_softc *sc = ifp->if_softc;
-	int s;
 
-	s = splnet();
+	mutex_enter(chan_mtx(sc->sc_periph->periph_channel));
 	if (sc->sc_enabled) {
 		ifp->if_flags &= ~IFF_OACTIVE;
 		se_ifstart(ifp);
 	}
-	splx(s);
+	mutex_exit(chan_mtx(sc->sc_periph->periph_channel));
 }
 
 /*
  * Start transmission on the interface.
- * Always called at splnet().
+ * Must be called with the scsipi channel lock held
  */
 static void
 se_ifstart(struct ifnet *ifp)
@@ -426,6 +438,9 @@ se_ifstart(struct ifnet *ifp)
 	IFQ_DEQUEUE(>if_snd, m0);
 	if (m0 == 0)
 		return;
+
+	KASSERT(mutex_owned(chan_mtx(sc->sc_periph->periph_channel)));
+
 	/* If BPF is listening on this interface, let it see the

CVS commit: src/sys/arch/amiga/amiga

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:43:38 UTC 2020

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

Log Message:
Keep the top of stack zero as other m68k ports do
(and required by System V ABI).


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/arch/amiga/amiga/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/amiga/amiga/locore.s
diff -u src/sys/arch/amiga/amiga/locore.s:1.157 src/sys/arch/amiga/amiga/locore.s:1.158
--- src/sys/arch/amiga/amiga/locore.s:1.157	Tue Mar 19 20:30:05 2019
+++ src/sys/arch/amiga/amiga/locore.s	Fri Jun 19 07:43:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.157 2019/03/19 20:30:05 thorpej Exp $	*/
+/*	$NetBSD: locore.s,v 1.158 2020/06/19 07:43:37 rin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -983,7 +983,7 @@ LMMUenable_end:
 
 /* set kernel stack, user SP */
 	movl	_C_LABEL(lwp0uarea),%a1	| grab lwp0 uarea 
-	lea	%a1@(USPACE),%sp	| set kernel stack to end of area
+	lea	%a1@(USPACE-4),%sp	| set kernel stack to end of area
 	movl	#USRSTACK-4,%a2
 	movl	%a2,%usp		| init user SP
 	movl	%a2,%a1@(PCB_USP)	| and save it



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

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:31:59 UTC 2020

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

Log Message:
Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/ibm4xx/copyinstr.c \
src/sys/arch/powerpc/ibm4xx/copyoutstr.c
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/powerpc/ibm4xx/pmap.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/powerpc/ibm4xx/trap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.13 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.14
--- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.13	Thu Mar  5 01:15:35 2020
+++ src/sys/arch/powerpc/ibm4xx/copyinstr.c	Fri Jun 19 07:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyinstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $	*/
+/*	$NetBSD: copyinstr.c,v 1.14 2020/06/19 07:31:59 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.14 2020/06/19 07:31:59 rin Exp $");
 
 #include 
 #include 
@@ -75,22 +75,22 @@ copyinstr(const void *udaddr, void *kadd
 		"mfmsr %0;"			/* Save MSR */
 		"li %1,0x20;"
 		"andc %1,%0,%1; mtmsr %1;"	/* Disable IMMU */
+		"isync;"
 		"mfpid %1;"			/* Save old PID */
-		"sync; isync;"
 
 		"1: "
-		"mtpid %4; sync;"		/* Load user ctx */
+		"mtpid %4; isync;"		/* Load user ctx */
 		"lbz %2,0(%5); addi %5,%5,1;"	/* Load byte */
-		"sync; isync;"
-		"mtpid %1; sync;"
+		"sync;"
+		"mtpid %1; isync;"
 		"stb %2,0(%6); dcbst 0,%6; addi %6,%6,1;"
 		/* Store kernel byte */
-		"sync; isync;"
 		"or. %2,%2,%2;"
+		"sync;"
 		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
 
 		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
-		"sync; isync;"
+		"isync;"
 		"mfctr %3;"			/* Restore resid */
 		: "=" (msr), "=" (pid), "=" (data), "+r" (resid)
 		: "r" (ctx), "b" (udaddr), "b" (kaddr));
Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c
diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.13 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.14
--- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.13	Thu Mar  5 01:15:35 2020
+++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c	Fri Jun 19 07:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: copyoutstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $	*/
+/*	$NetBSD: copyoutstr.c,v 1.14 2020/06/19 07:31:59 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.13 2020/03/05 01:15:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.14 2020/06/19 07:31:59 rin Exp $");
 
 #include 
 #include 
@@ -75,22 +75,22 @@ copyoutstr(const void *kaddr, void *udad
 		"mfmsr %0;"			/* Save MSR */
 		"li %1,0x20;"
 		"andc %1,%0,%1; mtmsr %1;"	/* Disable IMMU */
+		"isync;"
 		"mfpid %1;"			/* Save old PID */
-		"sync; isync;"
 
 		"1:"
-		"mtpid %1; sync;"
+		"mtpid %1; isync;"
 		"lbz %2,0(%6); addi %6,%6,1;"	/* Store kernel byte */
-		"sync; isync;"
-		"mtpid %4; sync;"		/* Load user ctx */
+		"sync;"
+		"mtpid %4; isync;"		/* Load user ctx */
 		"stb %2,0(%5); dcbst 0,%5; addi %5,%5,1;"
 		/* Load byte */
-		"sync; isync;"
 		"or. %2,%2,%2;"
+		"sync;"
 		"bdnzf 2,1b;"			/* while(ctr-- && !zero) */
 
 		"mtpid %1; mtmsr %0;"		/* Restore PID, MSR */
-		"sync; isync;"
+		"isync;"
 		"mfctr %3;"			/* Restore resid */
 		: "=" (msr), "=" (pid), "=" (data), "+r" (resid)
 		: "r" (ctx), "b" (udaddr), "b" (kaddr));

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.87 src/sys/arch/powerpc/ibm4xx/pmap.c:1.88
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.87	Fri Jun 19 07:15:21 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Fri Jun 19 07:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.87 2020/06/19 07:15:21 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.88 2020/06/19 07:31:59 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2020/06/19 07:15:21 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2020/06/19 07:31:59 rin Exp $");
 
 #include 
 #include 
@@ -1178,19 +1178,20 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 		"li %1, 

CVS commit: src/share/man/man9

2020-06-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Jun 19 07:25:20 UTC 2020

Modified Files:
src/share/man/man9: kmem.9

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/share/man/man9/kmem.9

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

Modified files:

Index: src/share/man/man9/kmem.9
diff -u src/share/man/man9/kmem.9:1.25 src/share/man/man9/kmem.9:1.26
--- src/share/man/man9/kmem.9:1.25	Thu Jun 18 23:30:51 2020
+++ src/share/man/man9/kmem.9	Fri Jun 19 07:25:20 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kmem.9,v 1.25 2020/06/18 23:30:51 kamil Exp $
+.\"	$NetBSD: kmem.9,v 1.26 2020/06/19 07:25:20 wiz Exp $
 .\"
 .\" Copyright (c)2006 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -195,7 +195,7 @@ function is a simplified version of
 .Fn kmem_strdupsize
 that does not return the size of the allocation.
 .Pp
-The 
+The
 .Fn kmem_strndup
 function is variation of
 .Fn kmem_strdup



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

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:24:41 UTC 2020

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

Log Message:
Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/powerpc/ibm4xx/trap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/trap.c
diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.79 src/sys/arch/powerpc/ibm4xx/trap.c:1.80
--- src/sys/arch/powerpc/ibm4xx/trap.c:1.79	Fri Jun 19 07:19:19 2020
+++ src/sys/arch/powerpc/ibm4xx/trap.c	Fri Jun 19 07:24:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.79 2020/06/19 07:19:19 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.80 2020/06/19 07:24:41 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.79 2020/06/19 07:19:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.80 2020/06/19 07:24:41 rin Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -247,16 +247,28 @@ out:
 			break;
 		}
 		KSI_INIT_TRAP();
-		ksi.ksi_signo = SIGSEGV;
 		ksi.ksi_trap = EXC_DSI;
 		ksi.ksi_addr = (void *)tf->tf_dear;
-		if (rv == ENOMEM) {
-			printf("UVM: pid %d (%s) lid %d, uid %d killed: "
-			"out of swap\n",
-			p->p_pid, p->p_comm, l->l_lid,
-			l->l_cred ?
-			kauth_cred_geteuid(l->l_cred) : -1);
+vm_signal:
+		switch (rv) {
+		case EINVAL:
+			ksi.ksi_signo = SIGBUS;
+			ksi.ksi_code = BUS_ADRERR;
+			break;
+		case EACCES:
+			ksi.ksi_signo = SIGSEGV;
+			ksi.ksi_code = SEGV_ACCERR;
+			break;
+		case ENOMEM:
 			ksi.ksi_signo = SIGKILL;
+			printf("UVM: pid %d.%d (%s), uid %d killed: "
+			   "out of swap\n", p->p_pid, l->l_lid, p->p_comm,
+			   l->l_cred ? kauth_cred_geteuid(l->l_cred) : -1);
+			break;
+		default:
+			ksi.ksi_signo = SIGSEGV;
+			ksi.ksi_code = SEGV_MAPERR;
+			break;
 		}
 		trapsignal(l, );
 		break;
@@ -274,11 +286,9 @@ out:
 			break;
 		}
 		KSI_INIT_TRAP();
-		ksi.ksi_signo = SIGSEGV;
 		ksi.ksi_trap = EXC_ISI;
 		ksi.ksi_addr = (void *)tf->tf_srr0;
-		ksi.ksi_code = (rv == EACCES ? SEGV_ACCERR : SEGV_MAPERR);
-		trapsignal(l, );
+		goto vm_signal;
 		break;
 
 	case EXC_AST|EXC_USER:



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

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:19:19 UTC 2020

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

Log Message:
Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/ibm4xx/trap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/trap.c
diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.78 src/sys/arch/powerpc/ibm4xx/trap.c:1.79
--- src/sys/arch/powerpc/ibm4xx/trap.c:1.78	Fri Feb 21 15:15:48 2020
+++ src/sys/arch/powerpc/ibm4xx/trap.c	Fri Jun 19 07:19:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78 2020/02/21 15:15:48 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.79 2020/06/19 07:19:19 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.78 2020/02/21 15:15:48 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.79 2020/06/19 07:19:19 rin Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -221,7 +221,7 @@ out:
 tf->tf_cr = fb->fb_cr;
 tf->tf_fixreg[1] = fb->fb_sp;
 tf->tf_fixreg[2] = fb->fb_r2;
-tf->tf_fixreg[3] = 1; /* Return TRUE */
+tf->tf_fixreg[3] = rv;
 memcpy(>tf_fixreg[13], fb->fb_fixreg,
 sizeof(fb->fb_fixreg));
 return;



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

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:15:21 UTC 2020

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

Log Message:
Oops, commit log was missing. It should be:

Revert rev 1.85:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85

Not clearly documented in reference manual, but the previous code seems
correct; the operations must be carried out with DMMU disabled. Otherwise,
WIP software single step for userland does not work correctly (stalled
indefinitely at pmap_procwr()).

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/powerpc/ibm4xx/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.86 src/sys/arch/powerpc/ibm4xx/pmap.c:1.87
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.86	Fri Jun 19 07:14:19 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Fri Jun 19 07:15:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.86 2020/06/19 07:14:19 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.87 2020/06/19 07:15:21 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2020/06/19 07:14:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2020/06/19 07:15:21 rin Exp $");
 
 #include 
 #include 



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

2020-06-19 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jun 19 07:14:20 UTC 2020

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


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/powerpc/ibm4xx/pmap.c

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

Modified files:

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.85 src/sys/arch/powerpc/ibm4xx/pmap.c:1.86
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.85	Thu Mar  5 11:44:54 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Fri Jun 19 07:14:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.85 2020/03/05 11:44:54 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.86 2020/06/19 07:14:19 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.85 2020/03/05 11:44:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2020/06/19 07:14:19 rin Exp $");
 
 #include 
 #include 
@@ -1175,9 +1175,8 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 	}
 	__asm volatile(
 		"mfmsr %0;"
-		"li %1,0x20;"		/* Turn off IMMU */
+		"li %1, %7;"
 		"andc %1,%0,%1;"
-		"ori %1,%1,0x10;"	/* Turn on DMMU for sure */
 		"mtmsr %1;"
 		"sync;isync;"
 		"mfpid %1;"
@@ -1193,7 +1192,8 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 		"mtmsr %0;"
 		"sync; isync"
 		: "=" (msr), "=" (opid)
-		: "r" (ctx), "r" (va), "r" (len), "r" (step), "r" (-step));
+		: "r" (ctx), "r" (va), "r" (len), "r" (step), "r" (-step),
+		  "K" (PSL_IR | PSL_DR));
 }