CVS commit: src/bin/pax

2019-03-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Mar 20 03:13:39 UTC 2019

Modified Files:
src/bin/pax: file_subs.c tar.c

Log Message:
pax: fix typos in comments in file_subs.c & tar.c

Stamp out "greengrocers' apostrophes" in various places (arguably there
are still more present, but style guides vary on that, and my energies
spent corralling wayward punctuation marks could be spent elsewhere).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/bin/pax/file_subs.c
cvs rdiff -u -r1.74 -r1.75 src/bin/pax/tar.c

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

Modified files:

Index: src/bin/pax/file_subs.c
diff -u src/bin/pax/file_subs.c:1.63 src/bin/pax/file_subs.c:1.64
--- src/bin/pax/file_subs.c:1.63	Mon Jul 29 17:46:36 2013
+++ src/bin/pax/file_subs.c	Wed Mar 20 03:13:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $	*/
+/*	$NetBSD: file_subs.c,v 1.64 2019/03/20 03:13:39 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)file_subs.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: file_subs.c,v 1.63 2013/07/29 17:46:36 christos Exp $");
+__RCSID("$NetBSD: file_subs.c,v 1.64 2019/03/20 03:13:39 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -895,7 +895,7 @@ set_chflags(char *fnm, u_int32_t flags)
  *	actual storage is quite small (the files are sparse). The problem is
  *	the holes read as all zeros so are probably stored on the archive that
  *	way (there is no way to determine if the file block is really a hole,
- *	we only know that a file block of all zero's can be a hole).
+ *	we only know that a file block of all zeros can be a hole).
  *	At this writing, no major archive format knows how to archive files
  *	with holes. However, on extraction (or during copy, -rw) we have to
  *	deal with these files. Without detecting the holes, the files can
@@ -968,7 +968,7 @@ file_write(int fd, char *str, int cnt, i
 		if (*isempt) {
 			/*
 			 * have not written to this block yet, so we keep
-			 * looking for zero's
+			 * looking for zeros
 			 */
 			pt = st;
 			end = st + wcnt;

Index: src/bin/pax/tar.c
diff -u src/bin/pax/tar.c:1.74 src/bin/pax/tar.c:1.75
--- src/bin/pax/tar.c:1.74	Fri Nov 30 00:53:11 2018
+++ src/bin/pax/tar.c	Wed Mar 20 03:13:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $	*/
+/*	$NetBSD: tar.c,v 1.75 2019/03/20 03:13:39 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.74 2018/11/30 00:53:11 christos Exp $");
+__RCSID("$NetBSD: tar.c,v 1.75 2019/03/20 03:13:39 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -351,7 +351,7 @@ tar_chksm(char *blk, int len)
 	 * checksum field as the sum of 8 blanks (which is pre-computed as
 	 * BLNKSUM).
 	 * ASSUMED: len is greater than CHK_OFFSET. (len is where our 0 padding
-	 * starts, no point in summing zero's)
+	 * starts, no point in summing zeros)
 	 */
 	pt += CHK_LEN;
 	stop = blk + len;
@@ -368,7 +368,7 @@ tar_chksm(char *blk, int len)
  * tar_id()
  *	determine if a block given to us is a valid tar header (and not a USTAR
  *	header). We have to be on the lookout for those pesky blocks of	all
- *	zero's.
+ *	zeros.
  * Return:
  *	0 if a tar header, -1 otherwise
  */
@@ -386,7 +386,7 @@ tar_id(char *blk, int size)
 	uhd = (HD_USTAR *)blk;
 
 	/*
-	 * check for block of zero's first, a simple and fast test, then make
+	 * check for block of zeros first, a simple and fast test, then make
 	 * sure this is not a ustar header by looking for the ustar magic
 	 * cookie. We should use TMAGLEN, but some USTAR archive programs are
 	 * wrong and create archives missing the \0. Last we check the
@@ -769,7 +769,7 @@ ustar_stwr(void)
 /*
  * ustar_id()
  *	determine if a block given to us is a valid ustar header. We have to
- *	be on the lookout for those pesky blocks of all zero's
+ *	be on the lookout for those pesky blocks of all zeros
  * Return:
  *	0 if a ustar header, -1 otherwise
  */
@@ -784,7 +784,7 @@ ustar_id(char *blk, int size)
 	hd = (HD_USTAR *)blk;
 
 	/*
-	 * check for block of zero's first, a simple and fast test then check
+	 * check for block of zeros first, a simple and fast test then check
 	 * ustar magic cookie. We should use TMAGLEN, but some USTAR archive
 	 * programs are fouled up and create archives missing the \0. Last we
 	 * check the checksum. If ok we have to assume it is a valid header.
@@ -1379,7 +1379,7 @@ tar_gnutar_exclude_one(const char *line,
 }
 
 /*
- * deal with GNU tar -X/--exclude-from & --exclude switchs.  basically,
+ * deal with GNU tar -X/--exclude-from & --exclude switches.  basically,
  * we go through each line of the file, building a string from the "glob"
  * lines in the file into RE lines, of 

CVS commit: src/bin/pax

2019-03-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Mar 20 02:50:50 UTC 2019

Modified Files:
src/bin/pax: pat_rep.c

Log Message:
pax: minor adjustments to comments in pat_rep.c

Amend several comments to match present reality (the functionality was
added back in 2007).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/pax/pat_rep.c

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

Modified files:

Index: src/bin/pax/pat_rep.c
diff -u src/bin/pax/pat_rep.c:1.30 src/bin/pax/pat_rep.c:1.31
--- src/bin/pax/pat_rep.c:1.30	Wed Jun 13 15:14:40 2018
+++ src/bin/pax/pat_rep.c	Wed Mar 20 02:50:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $	*/
+/*	$NetBSD: pat_rep.c,v 1.31 2019/03/20 02:50:50 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)pat_rep.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: pat_rep.c,v 1.30 2018/06/13 15:14:40 christos Exp $");
+__RCSID("$NetBSD: pat_rep.c,v 1.31 2019/03/20 02:50:50 gutteridge Exp $");
 #endif
 #endif /* not lint */
 
@@ -85,12 +85,13 @@ static int resub(regex_t *, regmatch_t *
  *	parses the -s replacement string; compiles the regular expression
  *	and stores the compiled value and its replacement string together in
  *	replacement string list. Input to this function is of the form:
- *		/old/new/pg
+ *		/old/new/gps
  *	The first char in the string specifies the delimiter used by this
  *	replacement string. "Old" is a regular expression in "ed" format which
  *	is compiled by regcomp() and is applied to filenames. "new" is the
- *	substitution string; p and g are options flags for printing and global
- *	replacement (over the single filename)
+ *	substitution string; g, p, and s are options flags for global
+ *	replacement (over the single filename), printing, and preventing
+ *	substitutions on symbolic link destinations.
  * Return:
  *	0 if a proper replacement string and regular expression was added to
  *	the list of replacement patterns; -1 otherwise.
@@ -895,7 +896,7 @@ fix_path( char *or_name, int *or_len, ch
  *	namelen the size of the name buffer.
  *	nlen is the length of this name (and is modified to hold the length of
  *	the final string).
- *	prnt is a flag that says whether to print the final result.
+ *	flags contains various options to control behavior.
  * Return:
  *	0 if substitution was successful, 1 if we are to skip the file (the name
  *	ended up empty)



CVS commit: src/external/gpl3/gcc/dist/gcc

2019-03-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar 19 23:55:28 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/gcc: config.gcc

Log Message:
default oabi to strongarm.  fixes build.sh -a arm builds.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/external/gpl3/gcc/dist/gcc/config.gcc

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config.gcc
diff -u src/external/gpl3/gcc/dist/gcc/config.gcc:1.51 src/external/gpl3/gcc/dist/gcc/config.gcc:1.52
--- src/external/gpl3/gcc/dist/gcc/config.gcc:1.51	Sun Feb 10 07:55:57 2019
+++ src/external/gpl3/gcc/dist/gcc/config.gcc	Tue Mar 19 23:55:28 2019
@@ -1134,6 +1134,8 @@ arm*-*-netbsdelf*)
 	*)
 	tm_file="$tm_file arm/netbsd-elf.h"
 	tmake_file="$tmake_file arm/t-netbsd"
+	# NetBSD/arm (non-eabi) is only old platforms
+	with_cpu=${with_cpu:-strongarm}
 	;;
 	esac
 	tm_file="${tm_file} arm/aout.h arm/arm.h"



CVS commit: src/sys/arch

2019-03-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Mar 19 20:30:05 UTC 2019

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

Log Message:
G/C a couple of lingering instances of addupc().  There is still some bit-
rotten profiling code that references it, but that code is already almost
certainly broken for other reasons.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/amiga/amiga/locore.s
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/atari/atari/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.156 src/sys/arch/amiga/amiga/locore.s:1.157
--- src/sys/arch/amiga/amiga/locore.s:1.156	Wed Dec 19 13:57:45 2018
+++ src/sys/arch/amiga/amiga/locore.s	Tue Mar 19 20:30:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.156 2018/12/19 13:57:45 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.157 2019/03/19 20:30:05 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1069,44 +1069,6 @@ Lnoflush:
 #include 
 
 /*
- * update profiling information for the user
- * addupc(pc, _prof, ticks)
- */
-ENTRY(addupc)
-	movl	%a2,%sp@-		| scratch register
-	movl	%sp@(12),%a2		| get _prof
-	movl	%sp@(8),%d0		| get user pc
-	subl	%a2@(8),%d0		| pc -= pr->pr_off
-	jlt	Lauexit			| less than 0, skip it
-	movl	%a2@(12),%d1		| get pr->pr_scale
-	lsrl	#1,%d0			| pc /= 2
-	lsrl	#1,%d1			| scale /= 2
-	mulul	%d1,%d0			| pc /= scale
-	moveq	#14,%d1
-	lsrl	%d1,%d0			| pc >>= 14
-	bclr	#0,%d0			| pc &= ~1
-	cmpl	%a2@(4),%d0		| too big for buffer?
-	jge	Lauexit			| yes, screw it
-	addl	%a2@,%d0		| no, add base
-	movl	%d0,%sp@-		| push address
-	jbsr	_C_LABEL(fusword)	| grab old value
-	movl	%sp@+,%a0		| grab address back
-	cmpl	#-1,%d0			| access ok
-	jeq	Lauerror		| no, skip out
-	addw	%sp@(18),%d0		| add tick to current value
-	movl	%d0,%sp@-		| push value
-	movl	%a0,%sp@-		| push address
-	jbsr	_C_LABEL(susword)	| write back new value
-	addql	#8,%sp			| pop params
-	tstl	%d0			| fault?
-	jeq	Lauexit			| no, all done
-Lauerror:
-	clrl	%a2@(12)		| clear scale (turn off prof)
-Lauexit:
-	movl	%sp@+,%a2		| restore scratch reg
-	rts
-
-/*
  * non-local gotos
  */
 ENTRY(qsetjmp)

Index: src/sys/arch/atari/atari/locore.s
diff -u src/sys/arch/atari/atari/locore.s:1.112 src/sys/arch/atari/atari/locore.s:1.113
--- src/sys/arch/atari/atari/locore.s:1.112	Wed Dec 19 13:57:46 2018
+++ src/sys/arch/atari/atari/locore.s	Tue Mar 19 20:30:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.112 2018/12/19 13:57:46 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.113 2019/03/19 20:30:05 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1059,44 +1059,6 @@ Lnoflush:
 #include 
 
 /*
- * update profiling information for the user
- * addupc(pc, _prof, ticks)
- */
-ENTRY(addupc)
-	movl	%a2,%sp@-		|  scratch register
-	movl	%sp@(12),%a2		|  get _prof
-	movl	%sp@(8),%d0		|  get user pc
-	subl	%a2@(8),%d0		|  pc -= pr->pr_off
-	jlt	Lauexit			|  less than 0, skip it
-	movl	%a2@(12),%d1		|  get pr->pr_scale
-	lsrl	#1,%d0			|  pc /= 2
-	lsrl	#1,%d1			|  scale /= 2
-	mulul	%d1,%d0			|  pc /= scale
-	moveq	#14,%d1
-	lsrl	%d1,%d0			|  pc >>= 14
-	bclr	#0,%d0			|  pc &= ~1
-	cmpl	%a2@(4),%d0		|  too big for buffer?
-	jge	Lauexit			|  yes, screw it
-	addl	%a2@,%d0		|  no, add base
-	movl	%d0,%sp@-		|  push address
-	jbsr	_C_LABEL(fusword)	|  grab old value
-	movl	%sp@+,%a0		|  grab address back
-	cmpl	#-1,%d0			|  access ok
-	jeq	Lauerror		|  no, skip out
-	addw	%sp@(18),%d0		|  add tick to current value
-	movl	%d0,%sp@-		|  push value
-	movl	%a0,%sp@-		|  push address
-	jbsr	_C_LABEL(susword)	|  write back new value
-	addql	#8,%sp			|  pop params
-	tstl	%d0			|  fault?
-	jeq	Lauexit			|  no, all done
-Lauerror:
-	clrl	%a2@(12)		|  clear scale (turn off prof)
-Lauexit:
-	movl	%sp@+,%a2		|  restore scratch reg
-	rts
-
-/*
  * non-local gotos
  */
 ENTRY(qsetjmp)



CVS commit: src/tests/lib/libnvmm

2019-03-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 19 19:23:39 UTC 2019

Modified Files:
src/tests/lib/libnvmm: h_io_assist.c h_io_assist_asm.S h_mem_assist.c
h_mem_assist_asm.S

Log Message:
Add CVS ids, and rename the PTE bits. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libnvmm/h_io_assist.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libnvmm/h_io_assist_asm.S
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libnvmm/h_mem_assist.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libnvmm/h_mem_assist_asm.S

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

Modified files:

Index: src/tests/lib/libnvmm/h_io_assist.c
diff -u src/tests/lib/libnvmm/h_io_assist.c:1.3 src/tests/lib/libnvmm/h_io_assist.c:1.4
--- src/tests/lib/libnvmm/h_io_assist.c:1.3	Tue Feb 26 12:23:12 2019
+++ src/tests/lib/libnvmm/h_io_assist.c	Tue Mar 19 19:23:39 2019
@@ -1,3 +1,5 @@
+/*	$NetBSD: h_io_assist.c,v 1.4 2019/03/19 19:23:39 maxv Exp $	*/
+
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -183,11 +185,11 @@ map_pages(struct nvmm_machine *mach)
 	memset(L2, 0, PAGE_SIZE);
 	memset(L1, 0, PAGE_SIZE);
 
-	L4[0] = PG_V | PG_RW | 0x4000;
-	L3[0] = PG_V | PG_RW | 0x5000;
-	L2[0] = PG_V | PG_RW | 0x6000;
-	L1[0x2000 / PAGE_SIZE] = PG_V | PG_RW | 0x2000;
-	L1[0x1000 / PAGE_SIZE] = PG_V | PG_RW | 0x1000;
+	L4[0] = PTE_P | PTE_W | 0x4000;
+	L3[0] = PTE_P | PTE_W | 0x5000;
+	L2[0] = PTE_P | PTE_W | 0x6000;
+	L1[0x2000 / PAGE_SIZE] = PTE_P | PTE_W | 0x2000;
+	L1[0x1000 / PAGE_SIZE] = PTE_P | PTE_W | 0x1000;
 }
 
 /* -- */

Index: src/tests/lib/libnvmm/h_io_assist_asm.S
diff -u src/tests/lib/libnvmm/h_io_assist_asm.S:1.1 src/tests/lib/libnvmm/h_io_assist_asm.S:1.2
--- src/tests/lib/libnvmm/h_io_assist_asm.S:1.1	Tue Feb  5 13:00:03 2019
+++ src/tests/lib/libnvmm/h_io_assist_asm.S	Tue Mar 19 19:23:39 2019
@@ -1,3 +1,5 @@
+/*	$NetBSD: h_io_assist_asm.S,v 1.2 2019/03/19 19:23:39 maxv Exp $	*/
+
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
  * All rights reserved.

Index: src/tests/lib/libnvmm/h_mem_assist.c
diff -u src/tests/lib/libnvmm/h_mem_assist.c:1.6 src/tests/lib/libnvmm/h_mem_assist.c:1.7
--- src/tests/lib/libnvmm/h_mem_assist.c:1.6	Tue Feb 26 12:23:12 2019
+++ src/tests/lib/libnvmm/h_mem_assist.c	Tue Mar 19 19:23:39 2019
@@ -1,3 +1,5 @@
+/*	$NetBSD: h_mem_assist.c,v 1.7 2019/03/19 19:23:39 maxv Exp $	*/
+
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -172,11 +174,11 @@ map_pages(struct nvmm_machine *mach)
 	memset(L2, 0, PAGE_SIZE);
 	memset(L1, 0, PAGE_SIZE);
 
-	L4[0] = PG_V | PG_RW | 0x4000;
-	L3[0] = PG_V | PG_RW | 0x5000;
-	L2[0] = PG_V | PG_RW | 0x6000;
-	L1[0x2000 / PAGE_SIZE] = PG_V | PG_RW | 0x2000;
-	L1[0x1000 / PAGE_SIZE] = PG_V | PG_RW | 0x1000;
+	L4[0] = PTE_P | PTE_W | 0x4000;
+	L3[0] = PTE_P | PTE_W | 0x5000;
+	L2[0] = PTE_P | PTE_W | 0x6000;
+	L1[0x2000 / PAGE_SIZE] = PTE_P | PTE_W | 0x2000;
+	L1[0x1000 / PAGE_SIZE] = PTE_P | PTE_W | 0x1000;
 }
 
 /* -- */

Index: src/tests/lib/libnvmm/h_mem_assist_asm.S
diff -u src/tests/lib/libnvmm/h_mem_assist_asm.S:1.5 src/tests/lib/libnvmm/h_mem_assist_asm.S:1.6
--- src/tests/lib/libnvmm/h_mem_assist_asm.S:1.5	Thu Feb  7 10:58:45 2019
+++ src/tests/lib/libnvmm/h_mem_assist_asm.S	Tue Mar 19 19:23:39 2019
@@ -1,3 +1,5 @@
+/*	$NetBSD: h_mem_assist_asm.S,v 1.6 2019/03/19 19:23:39 maxv Exp $	*/
+
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
  * All rights reserved.



CVS commit: src/sys/arch/amd64/stand/prekern

2019-03-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 19 19:15:57 UTC 2019

Modified Files:
src/sys/arch/amd64/stand/prekern: locore.S prekern.c trap.S

Log Message:
Fix/remove some half-baked stuff I left in the prekern:

 - Page-align the idt store, to be extra sure.
 - Remove unneeded prototypes.
 - Drop the TSS, we don't care and aren't even using it.
 - Initialize %ss with a default value.
 - Fix three exception handlers, no need to push an error code.

No actual impact, because these things are used only when returning from
exceptions received in the prekern; these exceptions are not supposed to
be ever received, never are, and if they were we wouldn't return anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/stand/prekern/locore.S \
src/sys/arch/amd64/stand/prekern/prekern.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/trap.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/amd64/stand/prekern/locore.S
diff -u src/sys/arch/amd64/stand/prekern/locore.S:1.10 src/sys/arch/amd64/stand/prekern/locore.S:1.11
--- src/sys/arch/amd64/stand/prekern/locore.S:1.10	Sat Mar  9 08:42:25 2019
+++ src/sys/arch/amd64/stand/prekern/locore.S	Tue Mar 19 19:15:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.10 2019/03/09 08:42:25 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.11 2019/03/19 19:15:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2007, 2008, 2016, 2017 The NetBSD Foundation, Inc.
@@ -193,8 +193,6 @@ LABEL(gdt64_start)
 	.quad 0x	/* always empty */
 	.quad 0x00af9a00	/* kernel CS */
 	.quad 0x00cf9200	/* kernel DS */
-	.quad 0x	/* kernel TSS [1/2] */
-	.quad 0x	/* kernel TSS [2/2] */
 END(gdt64_start)
 gdt64_end:
 
@@ -569,6 +567,9 @@ longmode:
 	movw	%ax,%gs
 	movw	%ax,%fs
 
+	movw	$GSEL(GDATA_SEL, SEL_KPL),%ax
+	movw	%ax,%ss
+
 	/* The first physical page available. */
 	leaq	(TABLESIZE)(%rsi),%rdi
 
Index: src/sys/arch/amd64/stand/prekern/prekern.c
diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.10 src/sys/arch/amd64/stand/prekern/prekern.c:1.11
--- src/sys/arch/amd64/stand/prekern/prekern.c:1.10	Sun Aug 12 12:42:54 2018
+++ src/sys/arch/amd64/stand/prekern/prekern.c	Tue Mar 19 19:15:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.c,v 1.10 2018/08/12 12:42:54 maxv Exp $	*/
+/*	$NetBSD: prekern.c,v 1.11 2019/03/19 19:15:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -46,15 +46,7 @@ struct bootinfo bootinfo;
 
 extern paddr_t kernpa_start, kernpa_end;
 
-static uint8_t idtstore[PAGE_SIZE];
-static uint8_t faultstack[PAGE_SIZE];
-static struct x86_64_tss prekern_tss;
-
-/* GDT offsets */
-#define PREKERN_GDT_NUL_OFF	(0 * 8)
-#define PREKERN_GDT_CS_OFF	(1 * 8)
-#define PREKERN_GDT_DS_OFF	(2 * 8)
-#define PREKERN_GDT_TSS_OFF	(3 * 8)
+static uint8_t idtstore[PAGE_SIZE] __aligned(PAGE_SIZE);
 
 #define IDTVEC(name) __CONCAT(X, name)
 typedef void (vector)(void);
@@ -83,14 +75,6 @@ struct smallframe {
 	uint64_t sf_ss;
 };
 
-static void setregion(struct region_descriptor *, void *, uint16_t);
-static void setgate(struct gate_descriptor *, void *, int, int, int, int);
-static void set_sys_segment(struct sys_segment_descriptor *, void *,
-size_t, int, int, int);
-static void set_sys_gdt(int, void *, size_t, int, int, int);
-static void init_tss(void);
-static void init_idt(void);
-
 void trap(struct smallframe *);
 
 static char *trap_type[] = {
@@ -142,6 +126,8 @@ trap(struct smallframe *sf)
 	while (1);
 }
 
+/* -- */
+
 static void
 setregion(struct region_descriptor *rd, void *base, uint16_t limit)
 {
@@ -167,42 +153,6 @@ setgate(struct gate_descriptor *gd, void
 }
 
 static void
-set_sys_segment(struct sys_segment_descriptor *sd, void *base, size_t limit,
-int type, int dpl, int gran)
-{
-	memset(sd, 0, sizeof(*sd));
-	sd->sd_lolimit = (unsigned)limit;
-	sd->sd_lobase = (uint64_t)base;
-	sd->sd_type = type;
-	sd->sd_dpl = dpl;
-	sd->sd_p = 1;
-	sd->sd_hilimit = (unsigned)limit >> 16;
-	sd->sd_gran = gran;
-	sd->sd_hibase = (uint64_t)base >> 24;
-}
-
-static void
-set_sys_gdt(int slotoff, void *base, size_t limit, int type, int dpl, int gran)
-{
-	struct sys_segment_descriptor sd;
-	extern uint64_t *gdt64_start;
-
-	set_sys_segment(, base, limit, type, dpl, gran);
-
-	memcpy(_start + slotoff, , sizeof(sd));
-}
-
-static void
-init_tss(void)
-{
-	memset(_tss, 0, sizeof(prekern_tss));
-	prekern_tss.tss_ist[0] = (uintptr_t)([PAGE_SIZE-1]) & ~0xf;
-
-	set_sys_gdt(PREKERN_GDT_TSS_OFF, _tss,
-	sizeof(struct x86_64_tss) - 1, SDT_SYS386TSS, SEL_KPL, 0);
-}
-
-static void
 init_idt(void)
 {
 	struct region_descriptor region;
@@ -331,10 +281,9 @@ init_prekern(paddr_t pa_start)
 	mm_init(pa_start);
 
 	/*
-	 * Init the TSS and IDT. We mostly don't 

CVS commit: src/sys/dev/ata

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 16:56:29 UTC 2019

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
The NCQ support added a private request queue to the wd driver. This
makes the regular buffer queue ineffective, it also allowed to queue
an unlimited number of requests.

Fix this by limiting the number of requests queued to the driver to
the possible number of concurrent NCQ transactions.


To generate a diff of this commit:
cvs rdiff -u -r1.445 -r1.446 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.445 src/sys/dev/ata/wd.c:1.446
--- src/sys/dev/ata/wd.c:1.445	Tue Mar 19 06:51:05 2019
+++ src/sys/dev/ata/wd.c	Tue Mar 19 16:56:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $ */
+/*	$NetBSD: wd.c,v 1.446 2019/03/19 16:56:29 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.446 2019/03/19 16:56:29 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -321,6 +321,7 @@ wdattach(device_t parent, device_t self,
 	SLIST_INIT(>sc_bslist);
 #endif
 	wd->atabus = adev->adev_bustype;
+	wd->inflight = 0;
 	wd->drvp = adev->adev_drv_data;
 
 	wd->drvp->drv_openings = 1;
@@ -729,6 +730,7 @@ wdstart1(struct wd_softc *wd, struct buf
 		xfer->c_bio.flags |= ATA_FUA;
 	}
 
+	wd->inflight++;
 	switch (wd->atabus->ata_bio(wd->drvp, xfer)) {
 	case ATACMD_TRY_AGAIN:
 		panic("wdstart1: try again");
@@ -749,10 +751,25 @@ wd_diskstart(device_t dev, struct buf *b
 	struct dk_softc *dksc = >sc_dksc;
 #endif
 	struct ata_xfer *xfer;
+	struct ata_channel *chp;
+	unsigned openings;
 
 	mutex_enter(>sc_lock);
 
-	xfer = ata_get_xfer(wd->drvp->chnl_softc, false);
+	chp = wd->drvp->chnl_softc;
+
+	ata_channel_lock(chp);
+	openings = ata_queue_openings(chp);
+	ata_channel_unlock(chp);
+
+	openings = uimin(openings, wd->drvp->drv_openings);
+
+	if (wd->inflight >= openings) {
+		mutex_exit(>sc_lock);
+		return EAGAIN;
+	}
+
+	xfer = ata_get_xfer(chp, false);
 	if (xfer == NULL) {
 		ATADEBUG_PRINT(("wd_diskstart %s no xfer\n",
 		dksc->sc_xname), DEBUG_XFERS);
@@ -952,7 +969,9 @@ noerror:	if ((xfer->c_bio.flags & ATA_CO
 
 	ata_free_xfer(wd->drvp->chnl_softc, xfer);
 
+	wd->inflight--;
 	dk_done(dksc, bp);
+	dk_start(dksc, NULL);
 }
 
 static void



CVS commit: src/sys/arch/aarch64

2019-03-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 19 16:45:28 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: db_machdep.c pmap.c
src/sys/arch/aarch64/include: pmap.h

Log Message:
- add ddb command "machine ttbr" to dump MMU tables.
- tidy up descriptions, usages and messages.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/aarch64/db_machdep.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/include/pmap.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/db_machdep.c
diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.14 src/sys/arch/aarch64/aarch64/db_machdep.c:1.15
--- src/sys/arch/aarch64/aarch64/db_machdep.c:1.14	Sun Jan 27 02:08:36 2019
+++ src/sys/arch/aarch64/aarch64/db_machdep.c	Tue Mar 19 16:45:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.14 2019/01/27 02:08:36 pgoyette Exp $ */
+/* $NetBSD: db_machdep.c,v 1.15 2019/03/19 16:45:28 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.14 2019/01/27 02:08:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.15 2019/03/19 16:45:28 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_machdep.c
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,6 +69,7 @@ void db_md_frame_cmd(db_expr_t, bool, db
 void db_md_lwp_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_pte_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_tlbi_cmd(db_expr_t, bool, db_expr_t, const char *);
+void db_md_ttbr_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_sysreg_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_watch_cmd(db_expr_t, bool, db_expr_t, const char *);
 #if defined(_KERNEL) && defined(MULTIPROCESSOR)
@@ -87,28 +89,28 @@ const struct db_command db_machine_comma
 	{
 		DDB_ADD_CMD(
 		"cpuinfo", db_md_cpuinfo_cmd, 0,
-		"Displays the cpuinfo",
+		"Displays the current cpuinfo",
 		NULL, NULL)
 	},
 	{
 		DDB_ADD_CMD(
 		"frame", db_md_frame_cmd, 0,
 		"Displays the contents of a trapframe",
-		"",
-		"\taddress:\taddress of trapfame to display")
+		"address",
+		"\taddress:\taddress of trapframe to display")
 	},
 	{
 		DDB_ADD_CMD(
 		"lwp", db_md_lwp_cmd, 0,
 		"Displays the lwp",
-		"",
+		"address",
 		"\taddress:\taddress of lwp to display")
 	},
 	{
 		DDB_ADD_CMD(
 		"pte", db_md_pte_cmd, 0,
 		"Display information of pte",
-		"",
+		"address",
 		"\taddress:\tvirtual address of page")
 	},
 	{
@@ -125,16 +127,26 @@ const struct db_command db_machine_comma
 	},
 	{
 		DDB_ADD_CMD(
+		"ttbr", db_md_ttbr_cmd, 0,
+		"Dump or count TTBR table",
+		"[/apc] address | pid",
+		"\taddress:\taddress of pmap to display\n"
+		"\tpid:\t\tpid of pmap to display")
+	},
+	{
+		DDB_ADD_CMD(
 		"watch", db_md_watch_cmd, 0,
 		"set or clear watchpoint",
-		"",
-		"\tparam:  | <#>")
+		"[/12345678] [address|#]",
+		"\taddress: watchpoint address to set\n"
+		"\t#: watchpoint number to remove"
+		"\t/1..8: size of data\n")
 	},
 #endif
 	{
 		DDB_ADD_CMD(NULL, NULL, 0,
 		NULL,
-		NULL,NULL)
+		NULL, NULL)
 	}
 };
 
@@ -290,7 +302,7 @@ db_md_frame_cmd(db_expr_t addr, bool hav
 	struct trapframe *tf;
 
 	if (!have_addr) {
-		db_printf("frame: \n");
+		db_printf("frame address must be specified\n");
 		return;
 	}
 
@@ -306,7 +318,7 @@ db_md_lwp_cmd(db_expr_t addr, bool have_
 	struct pcb *pcb;
 
 	if (!have_addr) {
-		db_printf("lwp: \n");
+		db_printf("lwp address must be specified\n");
 		return;
 	}
 	l = (lwp_t *)addr;
@@ -339,7 +351,7 @@ db_md_pte_cmd(db_expr_t addr, bool have_
 const char *modif)
 {
 	if (!have_addr) {
-		db_printf("pte: \n");
+		db_printf("pte address must be specified\n");
 		return;
 	}
 	pmap_db_pteinfo(addr, db_printf);
@@ -353,6 +365,48 @@ db_md_tlbi_cmd(db_expr_t addr, bool have
 }
 
 void
+db_md_ttbr_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+const char *modif)
+{
+	bool countmode = false, by_pid = true;
+
+	if (!have_addr) {
+		db_printf("usage: machine ttbr [/a] [/p] [/c] address|pid\n");
+		db_printf("\t/a == argument is an address of any pmap_t\n");
+		db_printf("\t/p == argument is a pid [default]\n");
+		db_printf("\t/c == count TLB entries\n");
+		return;
+	}
+
+	if (modif != NULL) {
+		for (; *modif != '\0'; modif++) {
+			switch (*modif) {
+			case 'c':
+countmode = true;
+break;
+			case 'a':
+by_pid = false;
+break;
+			case 'p':
+by_pid = true;
+break;
+			}
+		}
+	}
+
+	if (by_pid) {
+		proc_t *p = db_proc_find((pid_t)addr);
+		if (p == NULL) {
+			

CVS commit: src/sys/arch/aarch64

2019-03-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 19 16:05:49 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: pmap.c
src/sys/arch/aarch64/include: asan.h pmap.h

Log Message:
- free L1-L3 pages that has been emptied by pmap_remove().
- if no memories, pmap_enter will return correctly ENOMEM if PMAP_CANFAIL, or 
wait until available any memories if !PMAP_CANFAIL.

These changes improves the stability when we use a huge virtual memory spaces 
with mmap.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/asan.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/include/pmap.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.35 src/sys/arch/aarch64/aarch64/pmap.c:1.36
--- src/sys/arch/aarch64/aarch64/pmap.c:1.35	Wed Feb  6 05:33:41 2019
+++ src/sys/arch/aarch64/aarch64/pmap.c	Tue Mar 19 16:05:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.35 2019/02/06 05:33:41 ryo Exp $	*/
+/*	$NetBSD: pmap.c,v 1.36 2019/03/19 16:05:49 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.35 2019/02/06 05:33:41 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.36 2019/03/19 16:05:49 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -191,11 +191,15 @@ struct pv_entry {
 
 #define L3INDEXMASK	(L3_SIZE * Ln_ENTRIES - 1)
 
+void atomic_add_16(volatile uint16_t *, int16_t);
+uint16_t atomic_add_16_nv(volatile uint16_t *, int16_t);
+
 static pt_entry_t *_pmap_pte_lookup_l3(struct pmap *, vaddr_t);
 static pt_entry_t *_pmap_pte_lookup_bs(struct pmap *, vaddr_t, vsize_t *);
 static pt_entry_t _pmap_pte_adjust_prot(pt_entry_t, vm_prot_t, vm_prot_t, bool);
 static pt_entry_t _pmap_pte_adjust_cacheflags(pt_entry_t, u_int);
-static void _pmap_remove(struct pmap *, vaddr_t, vaddr_t, bool, struct pv_entry **);
+static void _pmap_remove(struct pmap *, vaddr_t, vaddr_t, bool,
+struct pv_entry **);
 static int _pmap_enter(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int, bool);
 
 static struct pmap kernel_pmap;
@@ -434,8 +438,19 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 	kpm->pm_l0table = l0;
 	kpm->pm_l0table_pa = l0pa;
 	kpm->pm_activated = true;
-	SLIST_INIT(>pm_vmlist);
+	TAILQ_INIT(>pm_vmlist);
 	mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_VM);
+
+	CTASSERT(sizeof(kpm->pm_stats.wired_count) == sizeof(long));
+	CTASSERT(sizeof(kpm->pm_stats.resident_count) == sizeof(long));
+#define PMSTAT_INC_WIRED_COUNT(pm)	\
+	atomic_inc_ulong(&(pm)->pm_stats.wired_count)
+#define PMSTAT_DEC_WIRED_COUNT(pm)	\
+	atomic_dec_ulong(&(pm)->pm_stats.wired_count)
+#define PMSTAT_INC_RESIDENT_COUNT(pm)	\
+	atomic_inc_ulong(&(pm)->pm_stats.resident_count)
+#define PMSTAT_DEC_RESIDENT_COUNT(pm)	\
+	atomic_dec_ulong(&(pm)->pm_stats.resident_count)
 }
 
 inline static int
@@ -544,39 +559,61 @@ pmap_reference(struct pmap *pm)
 	atomic_inc_uint(>pm_refcnt);
 }
 
-pd_entry_t *
-pmap_alloc_pdp(struct pmap *pm, paddr_t *pap)
+paddr_t
+pmap_alloc_pdp(struct pmap *pm, struct vm_page **pgp, bool waitok)
 {
 	paddr_t pa;
+	struct vm_page *pg;
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLED(pmaphist);
 
 	if (uvm.page_init_done) {
-		struct vm_page *pg;
-
+ retry:
 		pg = uvm_pagealloc(NULL, 0, NULL,
 		UVM_PGA_USERESERVE | UVM_PGA_ZERO);
-		if (pg == NULL)
-			panic("%s: cannot allocate L3 table", __func__);
-		pa = VM_PAGE_TO_PHYS(pg);
+		if (pg == NULL) {
+			if (waitok) {
+uvm_wait("pmap_alloc_pdp");
+goto retry;
+			}
+			return POOL_PADDR_INVALID;
+		}
 
-		SLIST_INSERT_HEAD(>pm_vmlist, pg, mdpage.mdpg_vmlist);
+		TAILQ_INSERT_HEAD(>pm_vmlist, pg, mdpage.mdpg_vmlist);
+		pg->flags &= ~PG_BUSY;	/* never busy */
+		pg->wire_count = 1;	/* max = 1 + Ln_ENTRIES = 513 */
+		pa = VM_PAGE_TO_PHYS(pg);
 		PMAP_COUNT(pdp_alloc);
 
+		VM_PAGE_TO_MD(pg)->mdpg_ptep_parent = NULL;
+
 	} else {
 		/* uvm_pageboot_alloc() returns AARCH64 KSEG address */
+		pg = NULL;
 		pa = AARCH64_KVA_TO_PA(
 		uvm_pageboot_alloc(Ln_TABLE_SIZE));
 		PMAP_COUNT(pdp_alloc_boot);
 	}
-	if (pap != NULL)
-		*pap = pa;
+	if (pgp != NULL)
+		*pgp = pg;
 
-	UVMHIST_LOG(pmaphist, "pa=%llx, va=%llx",
-	pa, AARCH64_PA_TO_KVA(pa), 0, 0);
+	UVMHIST_LOG(pmaphist, "pa=%llx, pg=%llx",
+	pa, pg, 0, 0);
 
-	return (void *)AARCH64_PA_TO_KVA(pa);
+	return pa;
+}
+
+static void
+pmap_free_pdp(struct pmap *pm, struct vm_page *pg)
+{
+	TAILQ_REMOVE(>pm_vmlist, pg, mdpage.mdpg_vmlist);
+	pg->flags |= PG_BUSY;
+	pg->wire_count = 0;
+	VM_MDPAGE_INIT(pg);
+
+	uvm_pagefree(pg);
+	PMAP_COUNT(pdp_free);
 }
 
 static void
@@ -584,9 +621,8 @@ _pmap_free_pdp_all(struct pmap *pm)
 {
 	struct vm_page *pg, *tmp;
 
-	SLIST_FOREACH_SAFE(pg, >pm_vmlist, mdpage.mdpg_vmlist, tmp) {
-		uvm_pagefree(pg);
-		

CVS commit: [netbsd-8] src/doc

2019-03-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 19 13:43:42 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Ticket #1218


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.118 -r1.1.2.119 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.118 src/doc/CHANGES-8.1:1.1.2.119
--- src/doc/CHANGES-8.1:1.1.2.118	Fri Mar 15 14:51:53 2019
+++ src/doc/CHANGES-8.1	Tue Mar 19 13:43:42 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.118 2019/03/15 14:51:53 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.119 2019/03/19 13:43:42 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2733,3 +2733,9 @@ sys/dev/pci/mpii.c1.22
 	fully processed data must not post an error.
 	[kardel, ticket #1217]
 
+sys/netinet/ip_carp.c1.102
+
+	carp(4): fix a bug that would make it sometimes skip
+	pserialize_read_enter and ifa_release.
+	[ozaki-r, ticket #1218]
+



CVS commit: [netbsd-8] src/sys/netinet

2019-03-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 19 13:42:55 UTC 2019

Modified Files:
src/sys/netinet [netbsd-8]: ip_carp.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1218):

sys/netinet/ip_carp.c: revision 1.102

carp: don't skip pserialize_read_enter and ifa_release


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.3 -r1.90.2.4 src/sys/netinet/ip_carp.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/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.90.2.3 src/sys/netinet/ip_carp.c:1.90.2.4
--- src/sys/netinet/ip_carp.c:1.90.2.3	Tue Jan  2 10:20:34 2018
+++ src/sys/netinet/ip_carp.c	Tue Mar 19 13:42:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.90.2.3 2018/01/02 10:20:34 snj Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.90.2.4 2019/03/19 13:42:54 martin Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.90.2.3 2018/01/02 10:20:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.90.2.4 2019/03/19 13:42:54 martin Exp $");
 
 /*
  * TODO:
@@ -410,7 +410,7 @@ carp_setroute(struct carp_softc *sc, int
 ifatoia(ifa), CARP_COUNT_MASTER);
 if ((cmd == RTM_ADD && count != 1) ||
 (cmd == RTM_DELETE && count != 0))
-	continue;
+	goto next;
 			}
 
 			/* Remove the existing host route, if any */
@@ -485,6 +485,7 @@ carp_setroute(struct carp_softc *sc, int
 		default:
 			break;
 		}
+	next:
 		s = pserialize_read_enter();
 		ifa_release(ifa, );
 	}



CVS commit: src/sys/netinet6

2019-03-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar 19 13:38:54 UTC 2019

Modified Files:
src/sys/netinet6: ip6protosw.h

Log Message:
Fix typos in comment:
- s/paylaod/payload/
- s/dstination/destination/


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/netinet6/ip6protosw.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/ip6protosw.h
diff -u src/sys/netinet6/ip6protosw.h:1.26 src/sys/netinet6/ip6protosw.h:1.27
--- src/sys/netinet6/ip6protosw.h:1.26	Wed Sep 27 10:05:05 2017
+++ src/sys/netinet6/ip6protosw.h	Tue Mar 19 13:38:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6protosw.h,v 1.26 2017/09/27 10:05:05 ozaki-r Exp $	*/
+/*	$NetBSD: ip6protosw.h,v 1.27 2019/03/19 13:38:53 msaitoh Exp $	*/
 /*	$KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $	*/
 
 /*
@@ -85,7 +85,7 @@ struct in6_addr;
  * argument type for the last arg of pr_ctlinput().
  * should be consulted only with AF_INET6 family.
  *
- * IPv6 ICMP IPv6 [exthdrs] finalhdr paylaod
+ * IPv6 ICMP IPv6 [exthdrs] finalhdr payload
  * ^^^  ^
  * ||ip6c_ip6   ip6c_off
  * |ip6c_icmp6
@@ -93,7 +93,7 @@ struct in6_addr;
  *
  * ip6c_finaldst usually points to ip6c_ip6->ip6_dst.  if the original
  * (internal) packet carries a routing header, it may point the final
- * dstination address in the routing header.
+ * destination address in the routing header.
  *
  * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6
  *	(beware of flowlabel, if you try to compare it against others)



CVS commit: src/share/man/man9

2019-03-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 19 10:17:35 UTC 2019

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

Log Message:
New sentence, new line. Fix Dd argument.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/share/man/man9/RUN_ONCE.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/RUN_ONCE.9
diff -u src/share/man/man9/RUN_ONCE.9:1.10 src/share/man/man9/RUN_ONCE.9:1.11
--- src/share/man/man9/RUN_ONCE.9:1.10	Tue Mar 19 08:16:51 2019
+++ src/share/man/man9/RUN_ONCE.9	Tue Mar 19 10:17:35 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: RUN_ONCE.9,v 1.10 2019/03/19 08:16:51 ryo Exp $
+.\"	$NetBSD: RUN_ONCE.9,v 1.11 2019/03/19 10:17:35 wiz Exp $
 .\"
 .\" Copyright (c)2005 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" 
-.Dd Mar 19, 2019
+.Dd March 19, 2019
 .Dt RUN_ONCE 9
 .Os
 .\" 
@@ -33,7 +33,7 @@
 .Nm RUN_ONCE ,
 .Nm INIT_ONCE ,
 .Nm FINI_ONCE
-.Nd Run a function exactly once
+.Nd run a function exactly once
 .\" 
 .Sh SYNOPSIS
 .In sys/once.h
@@ -72,7 +72,7 @@ can sleep if it's called concurrently.
 is used in pair with
 .Fn FINI_ONCE .
 .Fn INIT_ONCE
-will only be run once similar with
+will only be run once similar to
 .Fn RUN_ONCE .
 .Fn FINI_ONCE
 will only be run at last time if it is called as many times as calling
@@ -81,7 +81,8 @@ When
 .Fn FINI_ONCE
 is executed, the next call to
 .Fn INIT_ONCE
-will be executed again. That is,
+will be executed again.
+That is,
 .Fn INIT_ONCE
 and
 .Fn FINI_ONCE



CVS commit: src/bin/pax

2019-03-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 19 10:14:46 UTC 2019

Modified Files:
src/bin/pax: tar.1

Log Message:
Whitespace nits.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/pax/tar.1

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

Modified files:

Index: src/bin/pax/tar.1
diff -u src/bin/pax/tar.1:1.38 src/bin/pax/tar.1:1.39
--- src/bin/pax/tar.1:1.38	Tue Mar 19 00:36:14 2019
+++ src/bin/pax/tar.1	Tue Mar 19 10:14:46 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: tar.1,v 1.38 2019/03/19 00:36:14 gutteridge Exp $
+.\" $NetBSD: tar.1,v 1.39 2019/03/19 10:14:46 wiz Exp $
 .\"
 .\" Copyright (c) 1996 SigmaSoft, Th. Lockert
 .\" All rights reserved.
@@ -107,10 +107,10 @@ then the archive will be processed using
 .It Fl h , Fl Fl dereference
 Follow symbolic links as if they were normal files
 or directories.
-.It Fl J, Fl Fl xz
+.It Fl J , Fl Fl xz
 Compress/decompress archive using
 .Xr xz 1 .
-.It Fl j, Fl Fl bzip2, Fl Fl bunzip2
+.It Fl j , Fl Fl bzip2 , Fl Fl bunzip2
 Use
 .Xr bzip2 1
 for compression of the archive.



CVS commit: src/sys/external/bsd

2019-03-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 19 08:17:46 UTC 2019

Modified Files:
src/sys/external/bsd/common/linux: linux_work.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
- dwc2 need calling linux_workqueue_init() to avoid panic.
- use INIT_ONCE/FINI_ONCE to linux_workqueue_{init,fini}() for being called 
from dwc2.

TODO: dwc2 should be written as kernel module depenging on a linux module.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/external/bsd/common/linux/linux_work.c
cvs rdiff -u -r1.58 -r1.59 src/sys/external/bsd/dwc2/dwc2.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/external/bsd/common/linux/linux_work.c
diff -u src/sys/external/bsd/common/linux/linux_work.c:1.43 src/sys/external/bsd/common/linux/linux_work.c:1.44
--- src/sys/external/bsd/common/linux/linux_work.c:1.43	Mon Aug 27 15:25:43 2018
+++ src/sys/external/bsd/common/linux/linux_work.c	Tue Mar 19 08:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_work.c,v 1.43 2018/08/27 15:25:43 riastradh Exp $	*/
+/*	$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.43 2018/08/27 15:25:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.44 2019/03/19 08:17:46 ryo Exp $");
 
 #include 
 #include 
@@ -41,6 +41,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_work.c
 #include 
 #include 
 #include 
+#ifndef _MODULE
+#include 
+#endif
 #include 
 #include 
 
@@ -130,8 +133,8 @@ atomic_cas_uintptr(volatile uintptr_t *p
  *	Initialize the Linux workqueue subsystem.  Return 0 on success,
  *	NetBSD error on failure.
  */
-int
-linux_workqueue_init(void)
+static int
+linux_workqueue_init0(void)
 {
 	int error;
 
@@ -173,8 +176,8 @@ fail0:	KASSERT(error);
  *
  *	Destroy the Linux workqueue subsystem.  Never fails.
  */
-void
-linux_workqueue_fini(void)
+static void
+linux_workqueue_fini0(void)
 {
 
 	destroy_workqueue(system_power_efficient_wq);
@@ -182,6 +185,30 @@ linux_workqueue_fini(void)
 	destroy_workqueue(system_wq);
 	lwp_specific_key_delete(workqueue_key);
 }
+
+#ifndef _MODULE
+static ONCE_DECL(linux_workqueue_init_once);
+#endif
+
+int
+linux_workqueue_init(void)
+{
+#ifdef _MODULE
+	return linux_workqueue_init0();
+#else
+	return INIT_ONCE(_workqueue_init_once, _workqueue_init0);
+#endif
+}
+
+void
+linux_workqueue_fini(void)
+{
+#ifdef _MODULE
+	return linux_workqueue_fini0();
+#else
+	return FINI_ONCE(_workqueue_init_once, _workqueue_fini0);
+#endif
+}
 
 /*
  * Workqueues

Index: src/sys/external/bsd/dwc2/dwc2.c
diff -u src/sys/external/bsd/dwc2/dwc2.c:1.58 src/sys/external/bsd/dwc2/dwc2.c:1.59
--- src/sys/external/bsd/dwc2/dwc2.c:1.58	Sun Feb 17 04:17:52 2019
+++ src/sys/external/bsd/dwc2/dwc2.c	Tue Mar 19 08:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $	*/
+/*	$NetBSD: dwc2.c,v 1.59 2019/03/19 08:17:46 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.58 2019/02/17 04:17:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.59 2019/03/19 08:17:46 ryo Exp $");
 
 #include "opt_usb.h"
 
@@ -1273,6 +1273,10 @@ dwc2_init(struct dwc2_softc *sc)
 {
 	int err = 0;
 
+	err = linux_workqueue_init();
+	if (err)
+		return err;
+
 	sc->sc_bus.ub_hcpriv = sc;
 	sc->sc_bus.ub_revision = USBREV_2_0;
 	sc->sc_bus.ub_methods = _bus_methods;



CVS commit: src

2019-03-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Mar 19 08:16:51 UTC 2019

Modified Files:
src/share/man/man9: RUN_ONCE.9
src/sys/kern: subr_once.c
src/sys/sys: once.h param.h

Log Message:
add INIT_ONCE(9), FINI_ONCE(9) with changing once_t.

Welcome to 8.99.36


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/RUN_ONCE.9
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_once.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/once.h
cvs rdiff -u -r1.583 -r1.584 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/share/man/man9/RUN_ONCE.9
diff -u src/share/man/man9/RUN_ONCE.9:1.9 src/share/man/man9/RUN_ONCE.9:1.10
--- src/share/man/man9/RUN_ONCE.9:1.9	Mon Jul  3 21:28:48 2017
+++ src/share/man/man9/RUN_ONCE.9	Tue Mar 19 08:16:51 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: RUN_ONCE.9,v 1.9 2017/07/03 21:28:48 wiz Exp $
+.\"	$NetBSD: RUN_ONCE.9,v 1.10 2019/03/19 08:16:51 ryo Exp $
 .\"
 .\" Copyright (c)2005 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -25,12 +25,14 @@
 .\" SUCH DAMAGE.
 .\"
 .\" 
-.Dd July 7, 2010
+.Dd Mar 19, 2019
 .Dt RUN_ONCE 9
 .Os
 .\" 
 .Sh NAME
-.Nm RUN_ONCE
+.Nm RUN_ONCE ,
+.Nm INIT_ONCE ,
+.Nm FINI_ONCE
 .Nd Run a function exactly once
 .\" 
 .Sh SYNOPSIS
@@ -41,6 +43,12 @@
 .Ft int
 .Fn RUN_ONCE \
 "once_t *control" "int (*init_func)(void)"
+.Ft int
+.Fn INIT_ONCE \
+"once_t *control" "int (*init_func)(void)"
+.Ft void
+.Fn FINI_ONCE \
+"once_t *control" "void (*fini_func)(void)"
 .\" 
 .Sh DESCRIPTION
 .Fn RUN_ONCE
@@ -59,6 +67,25 @@ will try again each time it is called.
 .Pp
 .Fn RUN_ONCE
 can sleep if it's called concurrently.
+.Pp
+.Fn INIT_ONCE
+is used in pair with
+.Fn FINI_ONCE .
+.Fn INIT_ONCE
+will only be run once similar with
+.Fn RUN_ONCE .
+.Fn FINI_ONCE
+will only be run at last time if it is called as many times as calling
+.Fn INIT_ONCE .
+When
+.Fn FINI_ONCE
+is executed, the next call to
+.Fn INIT_ONCE
+will be executed again. That is,
+.Fn INIT_ONCE
+and
+.Fn FINI_ONCE
+can be nested.
 .\" 
 .Sh RETURN VALUES
 On failure,

Index: src/sys/kern/subr_once.c
diff -u src/sys/kern/subr_once.c:1.6 src/sys/kern/subr_once.c:1.7
--- src/sys/kern/subr_once.c:1.6	Sun Mar 15 17:14:40 2009
+++ src/sys/kern/subr_once.c	Tue Mar 19 08:16:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_once.c,v 1.6 2009/03/15 17:14:40 cegger Exp $	*/
+/*	$NetBSD: subr_once.c,v 1.7 2019/03/19 08:16:51 ryo Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_once.c,v 1.6 2009/03/15 17:14:40 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_once.c,v 1.7 2019/03/19 08:16:51 ryo Exp $");
 
 #include 
 #include 
@@ -48,13 +48,17 @@ once_init(void)
 }
 
 int
-_run_once(once_t *o, int (*fn)(void))
+_init_once(once_t *o, int (*fn)(void))
 {
-
 	/* Fastpath handled by RUN_ONCE() */
 
+	int error;
+
 	mutex_enter();
-	if (o->o_status == ONCE_VIRGIN) {
+	while (o->o_status == ONCE_RUNNING)
+		cv_wait(, );
+
+	if (o->o_refcnt++ == 0) {
 		o->o_status = ONCE_RUNNING;
 		mutex_exit();
 		o->o_error = fn();
@@ -62,10 +66,32 @@ _run_once(once_t *o, int (*fn)(void))
 		o->o_status = ONCE_DONE;
 		cv_broadcast();
 	}
-	while (o->o_status != ONCE_DONE)
+	KASSERT(o->o_refcnt != 0);	/* detect overflow */
+
+	while (o->o_status == ONCE_RUNNING)
 		cv_wait(, );
+	error = o->o_error;
 	mutex_exit();
 
-	KASSERT(o->o_status == ONCE_DONE);
-	return o->o_error;
+	return error;
+}
+
+void
+_fini_once(once_t *o, void (*fn)(void))
+{
+	mutex_enter();
+	while (o->o_status == ONCE_RUNNING)
+		cv_wait(, );
+
+	KASSERT(o->o_refcnt != 0);	/* we need to call _init_once() once */
+	if (--o->o_refcnt == 0) {
+		o->o_status = ONCE_RUNNING;
+		mutex_exit();
+		fn();
+		mutex_enter();
+		o->o_status = ONCE_VIRGIN;
+		cv_broadcast();
+	}
+
+	mutex_exit();
 }

Index: src/sys/sys/once.h
diff -u src/sys/sys/once.h:1.6 src/sys/sys/once.h:1.7
--- src/sys/sys/once.h:1.6	Sat Mar  3 19:21:59 2018
+++ src/sys/sys/once.h	Tue Mar 19 08:16:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: once.h,v 1.6 2018/03/03 19:21:59 jdolecek Exp $	*/
+/*	$NetBSD: once.h,v 1.7 2019/03/19 08:16:51 ryo Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -31,23 +31,29 @@
 #define	_SYS_ONCE_H_
 
 typedef struct {
-	unsigned o_status;
 	int o_error;
+	uint16_t o_refcnt;
+	uint16_t o_status;
 #define	ONCE_VIRGIN	0
 #define	ONCE_RUNNING	1
 #define	ONCE_DONE	2
 } once_t;
 
 void once_init(void);
-int _run_once(once_t *, int (*)(void));
+int _init_once(once_t *, int (*)(void));
+void _fini_once(once_t *, void (*)(void));
 
 #define	ONCE_DECL(o) \
-	once_t (o) 

CVS commit: src/sys/dev/sdmmc

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 07:08:43 UTC 2019

Modified Files:
src/sys/dev/sdmmc: ld_sdmmc.c

Log Message:
Provide CID data (manufacturer/product id/product name) as disk type.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/sdmmc/ld_sdmmc.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/sdmmc/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.35 src/sys/dev/sdmmc/ld_sdmmc.c:1.36
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.35	Fri Nov  9 14:39:19 2018
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Tue Mar 19 07:08:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.35 2018/11/09 14:39:19 jmcneill Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.36 2019/03/19 07:08:43 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.35 2018/11/09 14:39:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.36 2019/03/19 07:08:43 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -92,6 +92,7 @@ struct ld_sdmmc_softc {
 	struct sdmmc_function *sc_sf;
 	struct ld_sdmmc_task sc_task[LD_SDMMC_MAXTASKCNT];
 	pcq_t *sc_freeq;
+	char *sc_typename;
 
 	struct evcnt sc_ev_discard;	/* discard counter */
 	struct evcnt sc_ev_discarderr;	/* discard error counter */
@@ -146,6 +147,9 @@ ld_sdmmc_attach(device_t parent, device_
 	sa->sf->cid.rev, sa->sf->cid.psn, sa->sf->cid.mdt);
 	aprint_naive("\n");
 
+	sc->sc_typename = kmem_asprintf("0x%02x:0x%04x:%s",
+	sa->sf->cid.mid, sa->sf->cid.oid, sa->sf->cid.pnm);
+
 	evcnt_attach_dynamic(>sc_ev_discard, EVCNT_TYPE_MISC,
 	NULL, device_xname(self), "sdmmc discard count");
 	evcnt_attach_dynamic(>sc_ev_discarderr, EVCNT_TYPE_MISC,
@@ -176,6 +180,7 @@ ld_sdmmc_attach(device_t parent, device_
 	ld->sc_start = ld_sdmmc_start;
 	ld->sc_discard = ld_sdmmc_discard;
 	ld->sc_ioctl = ld_sdmmc_ioctl;
+	ld->sc_typename = sc->sc_typename;
 
 	/*
 	 * Defer attachment of ld + disk subsystem to a thread.
@@ -242,6 +247,7 @@ ld_sdmmc_detach(device_t dev, int flags)
 	evcnt_detach(>sc_ev_discard);
 	evcnt_detach(>sc_ev_discarderr);
 	evcnt_detach(>sc_ev_discardbusy);
+	kmem_free(sc->sc_typename, strlen(sc->sc_typename) + 1);
 
 	return 0;
 }



CVS commit: src/sys/dev

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 07:01:15 UTC 2019

Modified Files:
src/sys/dev: ld.c ldvar.h

Log Message:
Let backend provide a disk type. The information can be queried through
drvctl(4).


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/ld.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ldvar.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/dev/ld.c
diff -u src/sys/dev/ld.c:1.105 src/sys/dev/ld.c:1.106
--- src/sys/dev/ld.c:1.105	Sat Oct 13 14:24:35 2018
+++ src/sys/dev/ld.c	Tue Mar 19 07:01:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld.c,v 1.105 2018/10/13 14:24:35 mlelstv Exp $	*/
+/*	$NetBSD: ld.c,v 1.106 2019/03/19 07:01:14 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.105 2018/10/13 14:24:35 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.106 2019/03/19 07:01:14 mlelstv Exp $");
 
 #include 
 #include 
@@ -587,7 +587,7 @@ ld_set_geometry(struct ld_softc *sc)
 	dg->dg_ntracks = sc->sc_nheads;
 	dg->dg_ncylinders = sc->sc_ncylinders;
 
-	disk_set_info(dksc->sc_dev, >sc_dkdev, NULL);
+	disk_set_info(dksc->sc_dev, >sc_dkdev, sc->sc_typename);
 }
 
 static void

Index: src/sys/dev/ldvar.h
diff -u src/sys/dev/ldvar.h:1.32 src/sys/dev/ldvar.h:1.33
--- src/sys/dev/ldvar.h:1.32	Sun Aug 20 15:58:43 2017
+++ src/sys/dev/ldvar.h	Tue Mar 19 07:01:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldvar.h,v 1.32 2017/08/20 15:58:43 mlelstv Exp $	*/
+/*	$NetBSD: ldvar.h,v 1.33 2019/03/19 07:01:14 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -57,6 +57,7 @@ struct ld_softc {
 	int		sc_secsize;	/* sector size in bytes */
 	int		sc_maxxfer;	/* max xfer size in bytes */
 	int		sc_maxqueuecnt;	/* maximum h/w queue depth */
+	char		*sc_typename;	/* inquiry data */
 
 	int		(*sc_dump)(struct ld_softc *, void *, int, int);
 	int		(*sc_ioctl)(struct ld_softc *, u_long, void *, int32_t, bool);



CVS commit: src/sys/dev/scsipi

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 06:59:40 UTC 2019

Modified Files:
src/sys/dev/scsipi: sd.c sdvar.h

Log Message:
Set disk product name as disk type. The information can be queried through
drvctl(4).


To generate a diff of this commit:
cvs rdiff -u -r1.326 -r1.327 src/sys/dev/scsipi/sd.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/scsipi/sdvar.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/dev/scsipi/sd.c
diff -u src/sys/dev/scsipi/sd.c:1.326 src/sys/dev/scsipi/sd.c:1.327
--- src/sys/dev/scsipi/sd.c:1.326	Sun Oct  7 18:14:32 2018
+++ src/sys/dev/scsipi/sd.c	Tue Mar 19 06:59:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.326 2018/10/07 18:14:32 christos Exp $	*/
+/*	$NetBSD: sd.c,v 1.327 2019/03/19 06:59:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.326 2018/10/07 18:14:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.327 2019/03/19 06:59:40 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -256,6 +256,8 @@ sdattach(device_t parent, device_t self,
 	sd->type = (sa->sa_inqbuf.type & SID_TYPE);
 	strncpy(sd->name, sa->sa_inqbuf.product, sizeof(sd->name));
 
+	strncpy(sd->typename, sa->sa_inqbuf.product, sizeof(sd->typename));
+
 	if (sd->type == T_SIMPLE_DIRECT)
 		periph->periph_quirks |= PQUIRK_ONLYBIG | PQUIRK_NOBIGMODESENSE;
 
@@ -1936,5 +1938,5 @@ sd_set_geometry(struct sd_softc *sd)
 	dg->dg_ntracks = sd->params.heads;
 	dg->dg_ncylinders = sd->params.cyls;
 
-	disk_set_info(dksc->sc_dev, >sc_dkdev, NULL);
+	disk_set_info(dksc->sc_dev, >sc_dkdev, sd->typename);
 }

Index: src/sys/dev/scsipi/sdvar.h
diff -u src/sys/dev/scsipi/sdvar.h:1.38 src/sys/dev/scsipi/sdvar.h:1.39
--- src/sys/dev/scsipi/sdvar.h:1.38	Sat Dec 10 10:26:38 2016
+++ src/sys/dev/scsipi/sdvar.h	Tue Mar 19 06:59:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdvar.h,v 1.38 2016/12/10 10:26:38 mlelstv Exp $	*/
+/*	$NetBSD: sdvar.h,v 1.39 2019/03/19 06:59:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -88,6 +88,7 @@ struct sd_softc {
 	callout_t sc_callout;
 	u_int8_t type;
 	char name[16]; /* product name, for default disklabel */
+	char typename[128+4+1]; /* stored in disk info */
 };
 
 #define	SDGP_RESULT_OK		0	/* parameters obtained */



CVS commit: src/sys/dev/ata

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 06:51:05 UTC 2019

Modified Files:
src/sys/dev/ata: wd.c wdvar.h

Log Message:
Set disk model name as disk type. The information can be queried through
drvctl(4).


To generate a diff of this commit:
cvs rdiff -u -r1.444 -r1.445 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ata/wdvar.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/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.444 src/sys/dev/ata/wd.c:1.445
--- src/sys/dev/ata/wd.c:1.444	Tue Mar 19 06:47:12 2019
+++ src/sys/dev/ata/wd.c	Tue Mar 19 06:51:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $ */
+/*	$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.445 2019/03/19 06:51:05 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -309,7 +309,7 @@ wdattach(device_t parent, device_t self,
 	struct dk_softc *dksc = >sc_dksc;
 	struct ata_device *adev= aux;
 	int i, blank;
-	char tbuf[41], pbuf[9], c, *p, *q;
+	char tbuf[41],pbuf[9], c, *p, *q;
 	const struct wd_quirk *wdq;
 	int dtype = DKTYPE_UNKNOWN;
 
@@ -359,7 +359,8 @@ wdattach(device_t parent, device_t self,
 	}
 	*q++ = '\0';
 
-	aprint_normal_dev(self, "<%s>\n", tbuf);
+	wd->sc_typename = kmem_asprintf("%s", tbuf);
+	aprint_normal_dev(self, "<%s>\n", wd->sc_typename);
 
 	wdq = wd_lookup_quirks(tbuf);
 	if (wdq != NULL)
@@ -555,6 +556,10 @@ wddetach(device_t self, int flags)
 	}
 	wd->sc_bscount = 0;
 #endif
+	if (wd->sc_typename != NULL) {
+		kmem_free(wd->sc_typename, strlen(wd->sc_typename) + 1);
+		wd->sc_typename = NULL;
+	}
 
 	pmf_device_deregister(self);
 
@@ -1608,7 +1613,7 @@ wd_set_geometry(struct wd_softc *wd)
 	if ((wd->sc_flags & WDF_LBA) == 0)
 		dg->dg_ncylinders = wd->sc_params.atap_cylinders;
 
-	disk_set_info(dksc->sc_dev, >sc_dkdev, NULL);
+	disk_set_info(dksc->sc_dev, >sc_dkdev, wd->sc_typename);
 }
 
 int

Index: src/sys/dev/ata/wdvar.h
diff -u src/sys/dev/ata/wdvar.h:1.47 src/sys/dev/ata/wdvar.h:1.48
--- src/sys/dev/ata/wdvar.h:1.47	Mon Oct 22 20:13:47 2018
+++ src/sys/dev/ata/wdvar.h	Tue Mar 19 06:51:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdvar.h,v 1.47 2018/10/22 20:13:47 jdolecek Exp $	*/
+/*	$NetBSD: wdvar.h,v 1.48 2019/03/19 06:51:05 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -86,6 +86,8 @@ struct wd_softc {
 	int drv_chaos_freq;		/* frequency of simulated bio errors */
 	int drv_chaos_cnt;		/* count of processed bio read xfers */
 #endif
+	unsigned inflight;
+	char *sc_typename;
 };
 
 #endif /* _DEV_ATA_WDVAR_H_ */



CVS commit: src/sys/dev/ata

2019-03-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Mar 19 06:47:12 UTC 2019

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
Move standby on detach after wedges deletion in case wedges trigger
I/O on the parent disk. Add debug messages.


To generate a diff of this commit:
cvs rdiff -u -r1.443 -r1.444 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.443 src/sys/dev/ata/wd.c:1.444
--- src/sys/dev/ata/wd.c:1.443	Wed Oct 24 19:46:44 2018
+++ src/sys/dev/ata/wd.c	Tue Mar 19 06:47:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.443 2018/10/24 19:46:44 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.443 2018/10/24 19:46:44 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.444 2019/03/19 06:47:12 mlelstv Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -534,12 +534,12 @@ wddetach(device_t self, int flags)
 
 	bufq_free(dksc->sc_bufq);
 
-	if (flags & DETACH_POWEROFF)
-		wd_standby(wd, AT_POLL);
-
 	/* Delete all of our wedges. */
 	dkwedge_delall(>sc_dkdev);
 
+	if (flags & DETACH_POWEROFF)
+		wd_standby(wd, AT_POLL);
+
 	/* Detach from the disk list. */
 	disk_detach(>sc_dkdev);
 	disk_destroy(>sc_dkdev);
@@ -1729,6 +1729,7 @@ wd_standby(struct wd_softc *wd, int flag
 	struct ata_xfer *xfer;
 	int error;
 
+	aprint_debug_dev(dksc->sc_dev, "standby immediate\n");
 	xfer = ata_get_xfer(wd->drvp->chnl_softc, true);
 
 	xfer->c_ata_c.r_command = WDCC_STANDBY_IMMED;
@@ -1745,6 +1746,8 @@ wd_standby(struct wd_softc *wd, int flag
 	if (xfer->c_ata_c.flags & AT_ERROR) {
 		if (xfer->c_ata_c.r_error == WDCE_ABRT) {
 			/* command not supported */
+			aprint_debug_dev(dksc->sc_dev,
+"standby immediate not supported\n");
 			error = ENODEV;
 			goto out;
 		}



CVS commit: src/external/mit/xorg/lib

2019-03-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar 19 06:19:44 UTC 2019

Modified Files:
src/external/mit/xorg/lib: Makefile
src/external/mit/xorg/lib/libXaw: Makefile

Log Message:
libvdpau depends upon libXext and libX11, so make sure they're built first.

fixes x86 and evbarm builds.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/external/mit/xorg/lib/Makefile
cvs rdiff -u -r1.12 -r1.13 src/external/mit/xorg/lib/libXaw/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/Makefile
diff -u src/external/mit/xorg/lib/Makefile:1.47 src/external/mit/xorg/lib/Makefile:1.48
--- src/external/mit/xorg/lib/Makefile:1.47	Sun Mar 10 11:18:02 2019
+++ src/external/mit/xorg/lib/Makefile	Tue Mar 19 06:19:44 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.47 2019/03/10 11:18:02 mrg Exp $
+#	$NetBSD: Makefile,v 1.48 2019/03/19 06:19:44 mrg Exp $
 
 # build libraries for xorg
 
@@ -12,7 +12,7 @@ SUBDIR=	libfontenc freetype libFS libICE
 SUBDIR+=libdrm_intel libdrm_amdgpu
 .endif
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm"
-SUBDIR+=libdrm_nouveau libvdpau
+SUBDIR+=libdrm_nouveau
 .endif
 SUBDIR+=libdrm_radeon pixman
 .if !defined(MLIBDIR)
@@ -27,9 +27,13 @@ SUBDIR+=fontconfig libSM libX11 \
 	.WAIT \
 	libXcomposite libXdamage libXext libXfixes libXt \
 	libxkbfile libepoxy \
-	.WAIT \
-	libXi libXxf86vm \
-	.WAIT \
+	.WAIT
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "evbarm"
+# libvdpau depends upon libX11 and libXext
+SUBDIR+=libvdpau \
+	.WAIT
+.endif
+SUBDIR+=libXi libXxf86vm \
 	libGL${OLD_PREFIX} libXScrnSaver libXTrap libXevie libXfont libXfont2 \
 	libXinerama libXmu libXmuu libXpm libXrender \
 	libXres libXtst libXvMC libXvMCW libXv libXxf86dga libXxf86misc \

Index: src/external/mit/xorg/lib/libXaw/Makefile
diff -u src/external/mit/xorg/lib/libXaw/Makefile:1.12 src/external/mit/xorg/lib/libXaw/Makefile:1.13
--- src/external/mit/xorg/lib/libXaw/Makefile:1.12	Mon Mar 11 06:25:55 2019
+++ src/external/mit/xorg/lib/libXaw/Makefile	Tue Mar 19 06:19:44 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2019/03/11 06:25:55 mrg Exp $
+#	$NetBSD: Makefile,v 1.13 2019/03/19 06:19:44 mrg Exp $
 
 .include 
 
@@ -26,7 +26,7 @@ SRCS=	Actions.c AllWidgets.c AsciiSink.c
 	SimpleMenu.c Sme.c SmeBSB.c SmeLine.c StripChart.c \
 	Text.c TextSink.c TextSrc.c TextAction.c TextPop.c \
 	TextTr.c Tip.c Toggle.c Tree.c Vendor.c Viewport.c \
-	XawIm.c XawInit.c XawI18n.c sharedlib.c
+	XawIm.c XawInit.c XawI18n.c
 
 .PATH:	${X11SRCDIR.Xaw}/man
 MAN=	Xaw.3