CVS commit: src/usr.sbin/cpuctl/arch

2018-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 21 06:10:25 UTC 2018

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
- Use ci_feat_val[7] as CPUID 7 %edx to match x86/cpu.h
- AMD also has CPUID 6.
- Remove unused code for coretemp.
- Consistently use descs[] instead of data[].


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.85 src/usr.sbin/cpuctl/arch/i386.c:1.86
--- src/usr.sbin/cpuctl/arch/i386.c:1.85	Wed Jun 20 04:04:50 2018
+++ src/usr.sbin/cpuctl/arch/i386.c	Wed Nov 21 06:10:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.85 2018/06/20 04:04:50 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.86 2018/11/21 06:10:25 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.85 2018/06/20 04:04:50 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.86 2018/11/21 06:10:25 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -98,7 +98,7 @@ struct cpu_info {
 	uint32_t	ci_signature;	 /* X86 cpuid type */
 	uint32_t	ci_family;	 /* from ci_signature */
 	uint32_t	ci_model;	 /* from ci_signature */
-	uint32_t	ci_feat_val[9];	 /* X86 CPUID feature bits
+	uint32_t	ci_feat_val[10]; /* X86 CPUID feature bits
 	  *	[0] basic features %edx
 	  *	[1] basic features %ecx
 	  *	[2] extended features %edx
@@ -106,8 +106,9 @@ struct cpu_info {
 	  *	[4] VIA padlock features
 	  *	[5] structure ext. feat. %ebx
 	  *	[6] structure ext. feat. %ecx
-	  *	[7] XCR0 bits (d:0 %eax)
-	  *	[8] xsave flags (d:1 %eax)
+	  * [7] structure ext. feat. %edx
+	  *	[8] XCR0 bits (d:0 %eax)
+	  *	[9] xsave flags (d:1 %eax)
 	  */
 	uint32_t	ci_cpu_class;	 /* CPU class */
 	uint32_t	ci_brand_id;	 /* Intel brand id */
@@ -1672,19 +1673,20 @@ cpu_probe_base_features(struct cpu_info 
 	x86_cpuid(7, descs);
 	ci->ci_feat_val[5] = descs[1];
 	ci->ci_feat_val[6] = descs[2];
+	ci->ci_feat_val[7] = descs[3];
 
 	if (ci->ci_cpuid_level < 0xd)
 		return;
 
 	/* Get support XCR0 bits */
 	x86_cpuid2(0xd, 0, descs);
-	ci->ci_feat_val[7] = descs[0];	/* Actually 64 bits */
+	ci->ci_feat_val[8] = descs[0];	/* Actually 64 bits */
 	ci->ci_cur_xsave = descs[1];
 	ci->ci_max_xsave = descs[2];
 
 	/* Additional flags (eg xsaveopt support) */
 	x86_cpuid2(0xd, 1, descs);
-	ci->ci_feat_val[8] = descs[0];	 /* Actually 64 bits */
+	ci->ci_feat_val[9] = descs[0];	 /* Actually 64 bits */
 }
 
 static void
@@ -2034,18 +2036,17 @@ identifycpu(int fd, const char *cpuname)
 	if ((cpu_vendor == CPUVENDOR_INTEL) || (cpu_vendor == CPUVENDOR_AMD))
 		print_bits(cpuname, "features5", CPUID_SEF_FLAGS,
 		ci->ci_feat_val[5]);
-	if (cpu_vendor == CPUVENDOR_INTEL)
+	if ((cpu_vendor == CPUVENDOR_INTEL) || (cpu_vendor == CPUVENDOR_AMD))
 		print_bits(cpuname, "features6", CPUID_SEF_FLAGS1,
 		ci->ci_feat_val[6]);
 
-	if ((cpu_vendor == CPUVENDOR_INTEL) && (ci->ci_cpuid_level >= 7)) {
-		x86_cpuid(7, descs);
-		print_bits(cpuname, "SEF edx", CPUID_SEF_FLAGS2, descs[3]);
-	}
+	if (cpu_vendor == CPUVENDOR_INTEL)
+		print_bits(cpuname, "features7", CPUID_SEF_FLAGS2,
+		ci->ci_feat_val[7]);
 
-	print_bits(cpuname, "xsave features", XCR0_FLAGS1, ci->ci_feat_val[7]);
+	print_bits(cpuname, "xsave features", XCR0_FLAGS1, ci->ci_feat_val[8]);
 	print_bits(cpuname, "xsave instructions", CPUID_PES1_FLAGS,
-	ci->ci_feat_val[8]);
+	ci->ci_feat_val[9]);
 
 	if (ci->ci_max_xsave != 0) {
 		aprint_normal("%s: xsave area size: current %d, maximum %d",
@@ -2090,54 +2091,48 @@ identifycpu(int fd, const char *cpuname)
 
 	identifycpu_cpuids(ci);
 
-#ifdef INTEL_CORETEMP
-	if (cpu_vendor == CPUVENDOR_INTEL && ci->ci_cpuid_level >= 0x06)
-		coretemp_register(ci);
-#endif
-
+	if ((ci->ci_cpuid_level >= 6)
+	&& ((cpu_vendor == CPUVENDOR_INTEL)
+		|| (cpu_vendor == CPUVENDOR_AMD))) {
+		x86_cpuid(6, descs);
+		print_bits(cpuname, "DSPM-eax", CPUID_DSPM_FLAGS, descs[0]);
+		print_bits(cpuname, "DSPM-ecx", CPUID_DSPM_FLAGS1, descs[2]);
+	}
 	if (cpu_vendor == CPUVENDOR_AMD) {
-		uint32_t data[4];
-
-		x86_cpuid(0x8000, data);
-		if (data[0] >= 0x8007)
+		x86_cpuid(0x8000, descs);
+		if (descs[0] >= 0x8007)
 			powernow_probe(ci);
 
-		if ((data[0] >= 0x800a)
+		if ((descs[0] >= 0x800a)
 		&& (ci->ci_feat_val[3] & CPUID_SVM) != 0) {
-			x86_cpuid(0x800a, data);
+			x86_cpuid(0x800a, descs);
 			aprint_verbose("%s: SVM Rev. %d\n", cpuname,
-			data[0] & 0xf);
-			aprint_verbose("%s: SVM NASID %d\n", cpuname, data[1]);
+			descs[0] & 0xf);
+			aprint_verbose("%s: SVM NASID %d\n", cpuname,
+			descs[1]);
 			print_bits(cpuname, "SVM features",
-			CPUID_AMD_SVM_FLAGS, 

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

2018-11-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 21 06:09:49 UTC 2018

Modified Files:
src/sys/arch/x86/include: specialreg.h

Log Message:
Modify comment. No functional change:
- AMD also has CPUID 0x06 and 0x0d.
- PCOMMIT was obsoleted.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.132 src/sys/arch/x86/include/specialreg.h:1.133
--- src/sys/arch/x86/include/specialreg.h:1.132	Thu Nov 15 03:50:22 2018
+++ src/sys/arch/x86/include/specialreg.h	Wed Nov 21 06:09:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.132 2018/11/15 03:50:22 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.133 2018/11/21 06:09:49 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1991 The Regents of the University of California.
@@ -282,7 +282,7 @@
 #define CPUID_DCP_COMPLEX	__BIT(2)	/* Complex cache indexing */
 
 /*
- * Intel Digital Thermal Sensor and
+ * Intel/AMD Digital Thermal Sensor and
  * Power Management, Fn_0006 - %eax.
  */
 #define CPUID_DSPM_DTS	__BIT(0)	/* Digital Thermal Sensor */
@@ -313,7 +313,7 @@
 	"25" "HWP_IGNIDL"
 
 /*
- * Intel Digital Thermal Sensor and
+ * Intel/AMD Digital Thermal Sensor and
  * Power Management, Fn_0006 - %ecx.
  */
 #define CPUID_DSPM_HWF	0x0001	/* MSR_APERF/MSR_MPERF available */
@@ -322,7 +322,7 @@
 #define CPUID_DSPM_FLAGS1	"\20" "\1" "HWF" "\4" "EPB"
 
 /*
- * Intel Structured Extended Feature leaf Fn_0007
+ * Intel/AMD Structured Extended Feature leaf Fn_0007
  * %eax == 0: Subleaf 0
  *	%eax: The Maximum input value for supported subleaf.
  *	%ebx: Feature bits.
@@ -353,6 +353,7 @@
 #define CPUID_SEF_ADX		__BIT(19) /* ADCX/ADOX instructions */
 #define CPUID_SEF_SMAP		__BIT(20) /* Supervisor-Mode Access Prevention */
 #define CPUID_SEF_AVX512_IFMA	__BIT(21) /* AVX-512 Integer Fused Multiply Add */
+/* Bit 22 was PCOMMIT */
 #define CPUID_SEF_CLFLUSHOPT	__BIT(23) /* Cache Line FLUSH OPTimized */
 #define CPUID_SEF_CLWB		__BIT(24) /* Cache Line Write Back */
 #define CPUID_SEF_PT		__BIT(25) /* Processor Trace */
@@ -414,7 +415,7 @@
 	"\35" "L1D_FLUSH" "\36" "ARCH_CAP"		"\40" "SSBD"
 
 /*
- * CPUID Processor extended state Enumeration Fn000d
+ * Intel/AMD CPUID Processor extended state Enumeration Fn000d
  *
  * %ecx == 0: supported features info:
  *	%eax: Valid bits of lower 32bits of XCR0



CVS commit: src/lib/libcurses

2018-11-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov 20 22:02:31 UTC 2018

Modified Files:
src/lib/libcurses: cchar.c

Log Message:
Compare pointers to NULL, not to zero.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libcurses/cchar.c

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

Modified files:

Index: src/lib/libcurses/cchar.c
diff -u src/lib/libcurses/cchar.c:1.9 src/lib/libcurses/cchar.c:1.10
--- src/lib/libcurses/cchar.c:1.9	Tue Nov 20 21:42:52 2018
+++ src/lib/libcurses/cchar.c	Tue Nov 20 22:02:31 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: cchar.c,v 1.9 2018/11/20 21:42:52 uwe Exp $ */
+/*   $NetBSD: cchar.c,v 1.10 2018/11/20 22:02:31 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: cchar.c,v 1.9 2018/11/20 21:42:52 uwe Exp $");
+__RCSID("$NetBSD: cchar.c,v 1.10 2018/11/20 22:02:31 uwe Exp $");
 #endif		  /* not lint */
 
 #include 
@@ -66,8 +66,10 @@ getcchar(const cchar_t *wcval, wchar_t *
 
 	if (wch == NULL)
 		return (int)len;
-	if (attrs == 0 || color_pair == 0)
+
+	if (attrs == NULL || color_pair == NULL)
 		return ERR;
+
 	if (len > 0) {
 		*attrs = wcval->attributes;
 		if (__using_color)



CVS commit: src/lib/libcurses

2018-11-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov 20 21:42:52 UTC 2018

Modified Files:
src/lib/libcurses: cchar.c

Log Message:
Drop bogus cast.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libcurses/cchar.c

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

Modified files:

Index: src/lib/libcurses/cchar.c
diff -u src/lib/libcurses/cchar.c:1.8 src/lib/libcurses/cchar.c:1.9
--- src/lib/libcurses/cchar.c:1.8	Tue Nov 20 21:41:31 2018
+++ src/lib/libcurses/cchar.c	Tue Nov 20 21:42:52 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: cchar.c,v 1.8 2018/11/20 21:41:31 uwe Exp $ */
+/*   $NetBSD: cchar.c,v 1.9 2018/11/20 21:42:52 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: cchar.c,v 1.8 2018/11/20 21:41:31 uwe Exp $");
+__RCSID("$NetBSD: cchar.c,v 1.9 2018/11/20 21:42:52 uwe Exp $");
 #endif		  /* not lint */
 
 #include 
@@ -74,7 +74,7 @@ getcchar(const cchar_t *wcval, wchar_t *
 			*color_pair = PAIR_NUMBER(wcval->attributes);
 		else
 			*color_pair = 0;
-		wmemcpy(wch, wcval->vals, (unsigned)len);
+		wmemcpy(wch, wcval->vals, len);
 		wch[len] = L'\0';
 	}
 	return OK;



CVS commit: src/lib/libcurses

2018-11-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov 20 21:41:31 UTC 2018

Modified Files:
src/lib/libcurses: cchar.c

Log Message:
Don't hide assignments inside tests.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/cchar.c

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

Modified files:

Index: src/lib/libcurses/cchar.c
diff -u src/lib/libcurses/cchar.c:1.7 src/lib/libcurses/cchar.c:1.8
--- src/lib/libcurses/cchar.c:1.7	Tue Nov 20 17:48:19 2018
+++ src/lib/libcurses/cchar.c	Tue Nov 20 21:41:31 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $ */
+/*   $NetBSD: cchar.c,v 1.8 2018/11/20 21:41:31 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $");
+__RCSID("$NetBSD: cchar.c,v 1.8 2018/11/20 21:41:31 uwe Exp $");
 #endif		  /* not lint */
 
 #include 
@@ -58,11 +58,11 @@ getcchar(const cchar_t *wcval, wchar_t *
 	wchar_t *wp;
 	size_t len;
 
-	if (opts)
+	if (__predict_false(opts != NULL))
 		return ERR;
 
-	len = (wp = wmemchr(wcval->vals, L'\0', CCHARW_MAX))
-		? wp - wcval->vals : CCHARW_MAX;
+	wp = wmemchr(wcval->vals, L'\0', CCHARW_MAX);
+	len = wp ? wp - wcval->vals : CCHARW_MAX;
 
 	if (wch == NULL)
 		return (int)len;
@@ -95,10 +95,12 @@ setcchar(cchar_t *wcval, const wchar_t *
 	int i;
 	size_t len;
 
-	if (opts || (len = wcslen(wch)) > CCHARW_MAX
-		|| (len > 1 && wcwidth(wch[0]) < 0)) {
+	if (__predict_false(opts != NULL))
+		return ERR;
+
+	len = wcslen(wch);
+	if (len > CCHARW_MAX || (len > 1 && wcwidth(wch[0]) < 0))
 		return ERR;
-	}
 
 	/*
 	 * If we have a following spacing-character, stop at that point.  We



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

2018-11-20 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Nov 20 20:53:50 UTC 2018

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

Log Message:
Implement PMAP_DIRECT / pmap_direct_process() in support of experimental
UBC optimizations (compile-tested only for now)

PR kern/53124


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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/include/pmap.h
diff -u src/sys/arch/aarch64/include/pmap.h:1.17 src/sys/arch/aarch64/include/pmap.h:1.18
--- src/sys/arch/aarch64/include/pmap.h:1.17	Thu Nov  1 20:34:50 2018
+++ src/sys/arch/aarch64/include/pmap.h	Tue Nov 20 20:53:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.17 2018/11/01 20:34:50 maxv Exp $ */
+/* $NetBSD: pmap.h,v 1.18 2018/11/20 20:53:50 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -54,6 +54,16 @@
 #ifndef KASAN
 #define PMAP_MAP_POOLPAGE(pa)		AARCH64_PA_TO_KVA(pa)
 #define PMAP_UNMAP_POOLPAGE(va)		AARCH64_KVA_TO_PA(va)
+
+#define PMAP_DIRECT
+static __inline int
+pmap_direct_process(paddr_t pa, voff_t pgoff, size_t len,
+int (*process)(void *, size_t, void *), void *arg)
+{
+	vaddr_t va = AARCH64_PA_TO_KVA(pa);
+
+	return process((void *)(va + pgoff), len, arg);
+}
 #endif
 
 struct pmap {



CVS commit: src/sys/arch/ia64/ia64

2018-11-20 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Tue Nov 20 20:36:24 UTC 2018

Modified Files:
src/sys/arch/ia64/ia64: genassym.cf locore.S

Log Message:
add IA64_DCR_DEFAULT, more changes from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/ia64/ia64/genassym.cf
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/ia64/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/ia64/ia64/genassym.cf
diff -u src/sys/arch/ia64/ia64/genassym.cf:1.13 src/sys/arch/ia64/ia64/genassym.cf:1.14
--- src/sys/arch/ia64/ia64/genassym.cf:1.13	Thu Aug 10 12:51:22 2017
+++ src/sys/arch/ia64/ia64/genassym.cf	Tue Nov 20 20:36:24 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.13 2017/08/10 12:51:22 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.14 2018/11/20 20:36:24 scole Exp $
 
 #
 # Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -115,6 +115,7 @@ define  IA64_PBVM_PAGE_SHIFT	IA64_PBVM_P
 define	IA64_PSR_DFH		IA64_PSR_DFH
 define	IA64_PBVM_BASE		IA64_PBVM_BASE
 define	IA64_PBVM_PGTBL		IA64_PBVM_PGTBL
+define  IA64_DCR_DEFAULT	IA64_DCR_DEFAULT
 
 define	PTE_PRESENT		PTE_PRESENT
 define	PTE_ACCESSED		PTE_ACCESSED

Index: src/sys/arch/ia64/ia64/locore.S
diff -u src/sys/arch/ia64/ia64/locore.S:1.8 src/sys/arch/ia64/ia64/locore.S:1.9
--- src/sys/arch/ia64/ia64/locore.S:1.8	Wed Nov 14 21:10:59 2018
+++ src/sys/arch/ia64/ia64/locore.S	Tue Nov 20 20:36:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.8 2018/11/14 21:10:59 scole Exp $	*/
+/*	$NetBSD: locore.S,v 1.9 2018/11/20 20:36:24 scole Exp $	*/
 	
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -81,19 +81,37 @@ ENTRY_NOPROFILE(start, 1)
 	movl	r16=pa_bootinfo
 	;;
 }
+{	.mmi	
 	st8	[r16]=r8		// save the PA of the bootinfo block
 	loadrs// invalidate regs
+	mov r17=IA64_DCR_DEFAULT
 	;;
+}
+{	.mmi
+	mov	cr.dcr=r17
 	mov	ar.rsc=3		// turn rse back on
+	nop	0
 	;;
+}
+{	.mmi
+	srlz.d	
 	alloc	r16=ar.pfs,0,0,1,0
-	;;
-	movl	out0=0			// we are linked at the right address 
+	mov	out0=r0			// we are linked at the right address 
 	;;// we just need to process fptrs
-//	br.call.sptk.many rp=_reloc	// XXX:	Look into relocs
-	;;
+	}
+#if 0  /* XXX: Look into relocs */	
+{	.mib
+	nop	0
+	nop	0
+	br.call.sptk.many rp=_reloc
+}
+#endif	
+{	.mib
+	nop	0
+	nop	0
 	br.call.sptk.many rp=ia64_init
 	;;
+}
 /* We have the new bspstore in r8 and the new sp in r9.
Switch onto the new stack and call mi_startup(). */
 {   .mmi
@@ -109,9 +127,13 @@ ENTRY_NOPROFILE(start, 1)
 mov ar.rsc = 3
 nop 0
 ;;
-}	
+}
+{	.mib
+	nop	0
+	nop	0
 	br.call.sptk.many rp=main
 	;;
+}
 	/* NOTREACHED */
 1:	br.cond.sptk.few 1b
 END(start)



CVS commit: src/sys/uvm

2018-11-20 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Nov 20 20:07:20 UTC 2018

Modified Files:
src/sys/uvm: uvm_bio.c

Log Message:
need to use PGO_NOBLOCKALLOC also in ubc_alloc_direct() case, same
as non-direct code - otherwise the code tries to acquire the wapbl
lock again in genfs_getpages(), and panic due to locking against itself

towards PR kern/53124


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/uvm/uvm_bio.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/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.97 src/sys/uvm/uvm_bio.c:1.98
--- src/sys/uvm/uvm_bio.c:1.97	Sat Jun  2 15:24:55 2018
+++ src/sys/uvm/uvm_bio.c	Tue Nov 20 20:07:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.97 2018/06/02 15:24:55 chs Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.98 2018/11/20 20:07:19 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.97 2018/06/02 15:24:55 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.98 2018/11/20 20:07:19 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -814,7 +814,8 @@ ubc_alloc_direct(struct uvm_object *uobj
 {
 	voff_t pgoff;
 	int error;
-	int gpflags = flags | PGO_NOTIMESTAMP | PGO_SYNCIO | PGO_ALLPAGES;
+	int gpflags = flags | PGO_NOTIMESTAMP | PGO_SYNCIO | PGO_ALLPAGES
+	| PGO_NOBLOCKALLOC;
 	int access_type = VM_PROT_READ;
 	UVMHIST_FUNC("ubc_alloc_direct"); UVMHIST_CALLED(ubchist);
 



CVS commit: src/sys/dev/ic

2018-11-20 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Nov 20 19:19:21 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
s/failing/failed/ for the aprint_error()


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/ahcisata_core.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.70 src/sys/dev/ic/ahcisata_core.c:1.71
--- src/sys/dev/ic/ahcisata_core.c:1.70	Tue Nov 20 08:47:55 2018
+++ src/sys/dev/ic/ahcisata_core.c	Tue Nov 20 19:19:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.70 2018/11/20 08:47:55 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.71 2018/11/20 19:19:21 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.70 2018/11/20 08:47:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.71 2018/11/20 19:19:21 jdolecek Exp $");
 
 #include 
 #include 
@@ -999,7 +999,7 @@ ahci_probe_drive(struct ata_channel *chp
 			/* If probe for PMP failed, just fallback to drive 0 */
 			if (error) {
 aprint_error("%s port %d: drive %d reset "
-"failing, disabling PMP\n",
+"failed, disabling PMP\n",
 AHCINAME(sc), chp->ch_channel,
 PMP_PORT_CTL);
 



CVS commit: src/sys/coda

2018-11-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Nov 20 19:05:25 UTC 2018

Modified Files:
src/sys/coda: coda_vnops.c

Log Message:
Fix locking for readdir code (Brett Lymn)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/coda/coda_vnops.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/coda/coda_vnops.c
diff -u src/sys/coda/coda_vnops.c:1.106 src/sys/coda/coda_vnops.c:1.107
--- src/sys/coda/coda_vnops.c:1.106	Fri May 26 10:21:00 2017
+++ src/sys/coda/coda_vnops.c	Tue Nov 20 14:05:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $	*/
 
 /*
  *
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.106 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.107 2018/11/20 19:05:25 christos Exp $");
 
 #include 
 #include 
@@ -1537,6 +1537,7 @@ coda_readdir(void *v)
 /* upcall decl */
 /* locals */
 int error = 0;
+enum vtype saved_type;
 
 MARK_ENTRY(CODA_READDIR_STATS);
 
@@ -1569,7 +1570,13 @@ coda_readdir(void *v)
 	/* Have UFS handle the call. */
 	CODADEBUG(CODA_READDIR, myprintf(("%s: fid = %s, refcnt = %d\n",
 	__func__, coda_f2s(>c_fid), vp->v_usecount)); )
+	saved_type = vp->v_type;
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	vp->v_type = VDIR; /* pretend the container file is a dir */
 	error = VOP_READDIR(vp, uiop, cred, eofflag, cookies, ncookies);
+	vp->v_type = saved_type;
+	VOP_UNLOCK(vp);
+
 	if (error)
 	MARK_INT_FAIL(CODA_READDIR_STATS);
 	else



CVS commit: src/usr.sbin/sysinst

2018-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 20 19:02:07 UTC 2018

Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c label.c mbr.c partman.c run.c

Log Message:
Convert all static menu struct initializiations to C99 name initializer
format - prerequisite for an upcoming evil hack (tm).
No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/label.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/sysinst/mbr.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sysinst/partman.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/sysinst/run.c

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

Modified files:

Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.5 src/usr.sbin/sysinst/bsddisklabel.c:1.6
--- src/usr.sbin/sysinst/bsddisklabel.c:1.5	Thu Nov 15 10:34:21 2018
+++ src/usr.sbin/sysinst/bsddisklabel.c	Tue Nov 20 19:02:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bsddisklabel.c,v 1.5 2018/11/15 10:34:21 martin Exp $	*/
+/*	$NetBSD: bsddisklabel.c,v 1.6 2018/11/20 19:02:07 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -366,8 +366,9 @@ get_ptn_sizes(daddr_t part_start, daddr_
 		{ PART_ANY,	{ '/', 'h', 'o', 'm', 'e', '\0' },	0,
 		  0, 0, 0 },
 	}, {
-		{ NULL, OPT_NOMENU, 0, set_ptn_size },
-		{ MSG_askunits, MENU_sizechoice, OPT_SUB, NULL },
+		{ .opt_menu=OPT_NOMENU, .opt_action=set_ptn_size },
+		{ .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
+		  .opt_flags=OPT_SUB },
 	}, 0, 0, NULL, { 0 } };
 
 	if (maxpart > MAXPARTITIONS)

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.3 src/usr.sbin/sysinst/label.c:1.4
--- src/usr.sbin/sysinst/label.c:1.3	Sun May 10 10:14:02 2015
+++ src/usr.sbin/sysinst/label.c	Tue Nov 20 19:02:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.3 2015/05/10 10:14:02 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.4 2018/11/20 19:02:07 martin Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.3 2015/05/10 10:14:02 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.4 2018/11/20 19:02:07 martin Exp $");
 #endif
 
 #include 
@@ -374,29 +374,31 @@ edit_ptn(menudesc *menu, void *arg)
 {
 	static menu_ent fs_fields[] = {
 #define PTN_MENU_FSKIND		0
-	{NULL, MENU_selfskind, OPT_SUB, NULL},
+	{ .opt_menu=MENU_selfskind, .opt_flags=OPT_SUB },
 #define PTN_MENU_START		1
-	{NULL, OPT_NOMENU, 0, edit_fs_start},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_start },
 #define PTN_MENU_SIZE		2
-	{NULL, OPT_NOMENU, 0, edit_fs_size},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_size },
 #define PTN_MENU_END		3
-	{NULL, OPT_NOMENU, OPT_IGNORE, NULL},	/* displays 'end' */
+	{ .opt_menu=OPT_NOMENU, .opt_flags=OPT_IGNORE },	/* displays 'end' */
 #define PTN_MENU_NEWFS		4
-	{NULL, OPT_NOMENU, 0, edit_fs_preserve},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_preserve },
 #define PTN_MENU_ISIZE		5
-	{NULL, OPT_NOMENU, 0, edit_fs_isize},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_isize },
 #define PTN_MENU_BSIZE		6
-	{NULL, MENU_selbsize, OPT_SUB, NULL},
+	{ .opt_menu=MENU_selbsize, .opt_flags=OPT_SUB },
 #define PTN_MENU_FSIZE		7
-	{NULL, MENU_selfsize, OPT_SUB, NULL},
+	{ .opt_menu=MENU_selfsize, .opt_flags=OPT_SUB },
 #define PTN_MENU_MOUNT		8
-	{NULL, OPT_NOMENU, 0, edit_fs_mount},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mount },
 #define PTN_MENU_MOUNTOPT	9
-	{NULL, MENU_mountoptions, OPT_SUB, NULL},
+	{ .opt_menu=MENU_mountoptions, .opt_flags=OPT_SUB },
 #define PTN_MENU_MOUNTPT	10
-	{NULL, OPT_NOMENU, 0, edit_fs_mountpt},
-	{MSG_askunits, MENU_sizechoice, OPT_SUB, NULL},
-	{MSG_restore, OPT_NOMENU, 0, edit_restore},
+	{ .opt_menu=OPT_NOMENU, .opt_action=edit_fs_mountpt },
+	{ .opt_name=MSG_askunits, .opt_menu=MENU_sizechoice,
+	  .opt_flags=OPT_SUB },
+	{ .opt_name=MSG_restore, .opt_menu=OPT_NOMENU,
+	  .opt_action=edit_restore},
 	};
 	static int fspart_menu = -1;
 	static menu_ent all_fstypes[FSMAXTYPES];

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.8 src/usr.sbin/sysinst/mbr.c:1.9
--- src/usr.sbin/sysinst/mbr.c:1.8	Fri Nov 16 19:55:18 2018
+++ src/usr.sbin/sysinst/mbr.c	Tue Nov 20 19:02:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.8 2018/11/16 19:55:18 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.9 2018/11/20 19:02:07 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -959,24 +959,25 @@ edit_mbr_entry(menudesc *m, void *arg)
 
 	static menu_ent ptn_opts[] = {
 #define PTN_OPT_TYPE		0
-		{NULL, OPT_NOMENU, 0, edit_mbr_type},
+		{ .opt_menu=OPT_NOMENU, .opt_action=edit_mbr_type },
 #define PTN_OPT_START		1
-		{NULL, OPT_NOMENU, 0, edit_mbr_start},
+		{ 

CVS commit: src/lib/libcurses

2018-11-20 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Nov 20 17:48:19 UTC 2018

Modified Files:
src/lib/libcurses: cchar.c

Log Message:
Fix color pair handling.  color_pair argument is a pair number.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libcurses/cchar.c

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

Modified files:

Index: src/lib/libcurses/cchar.c
diff -u src/lib/libcurses/cchar.c:1.6 src/lib/libcurses/cchar.c:1.7
--- src/lib/libcurses/cchar.c:1.6	Fri Jan  6 13:53:18 2017
+++ src/lib/libcurses/cchar.c	Tue Nov 20 17:48:19 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: cchar.c,v 1.6 2017/01/06 13:53:18 roy Exp $ */
+/*   $NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: cchar.c,v 1.6 2017/01/06 13:53:18 roy Exp $");
+__RCSID("$NetBSD: cchar.c,v 1.7 2018/11/20 17:48:19 uwe Exp $");
 #endif		  /* not lint */
 
 #include 
@@ -70,7 +70,10 @@ getcchar(const cchar_t *wcval, wchar_t *
 		return ERR;
 	if (len > 0) {
 		*attrs = wcval->attributes;
-		*color_pair = COLOR_PAIR(wcval ->attributes);
+		if (__using_color)
+			*color_pair = PAIR_NUMBER(wcval->attributes);
+		else
+			*color_pair = 0;
 		wmemcpy(wch, wcval->vals, (unsigned)len);
 		wch[len] = L'\0';
 	}
@@ -110,7 +113,9 @@ setcchar(cchar_t *wcval, const wchar_t *
 
 	memset(wcval, 0, sizeof(*wcval));
 	if (len != 0) {
-		wcval->attributes = attrs | color_pair;
+		wcval->attributes = attrs & ~__COLOR;
+		if (__using_color && color_pair)
+			wcval->attributes |= COLOR_PAIR(color_pair);
 		wcval->elements = 1;
 		memcpy(>vals, wch, len * sizeof(wchar_t));
 	}



CVS commit: [netbsd-8] src/doc

2018-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 20 16:06:49 UTC 2018

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

Log Message:
Ticket #1098 and #1099


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 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.58 src/doc/CHANGES-8.1:1.1.2.59
--- src/doc/CHANGES-8.1:1.1.2.58	Sun Nov 18 19:34:52 2018
+++ src/doc/CHANGES-8.1	Tue Nov 20 16:06:49 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.58 2018/11/18 19:34:52 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.59 2018/11/20 16:06:49 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1721,4 +1721,15 @@ sys/arch/macppc/stand/ofwboot/version		1
 	PR port-macppc/53727.
 	[tsutsui, ticket #1097]
 
+external/bsd/nsd/dist/server.c			1.2
+
+	Fix NSD when built with --enable-recvmmsg.
+	[hannken, ticket #1098]
+
+sys/dev/usb/usb_quirks.c			1.90
+sys/dev/usb/usb_quirks.h			1.29
+sys/dev/usb/usbdi.c1.179,1.180
+
+	Workaround NBP PN533 USB toggle bit bugs.
+	[manu, ticket #1099]
 



CVS commit: [netbsd-8] src/sys/dev/usb

2018-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 20 16:05:38 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-8]: usb_quirks.c usb_quirks.h usbdi.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1099):

sys/dev/usb/usb_quirks.c: revision 1.90
sys/dev/usb/usbdi.c: revision 1.179
sys/dev/usb/usb_quirks.h: revision 1.29
sys/dev/usb/usbdi.c: revision 1.180

Workaround NBP PN533 USB toggle bit bugs

The PN533 is known to mishandle the USB toggle bit, causing replies to
be filtered out by the host controller. As a result, the kernel sees
a timed out operation.

Vendor errata suggests that userland applications should detect the
situation on read timeout, and write a dumy frame to resync the toggle bit.
NFC Tools's libnfc does just that, but in order to succeed, the dummy
frame write must not be reported as timed out.

We therefore introduce a new USB quirk for devices known to miss output
acks. When that occur, we pretend that the operation succeeded, leaving
userland the duty to check that everything went okay.

This workaround lets libnfc recover from interrupted communications
without the need te reboot the system.

 -

Build fix
>From David H. Gutteridge


To generate a diff of this commit:
cvs rdiff -u -r1.86.8.1 -r1.86.8.2 src/sys/dev/usb/usb_quirks.c
cvs rdiff -u -r1.27.10.1 -r1.27.10.2 src/sys/dev/usb/usb_quirks.h
cvs rdiff -u -r1.173.2.3 -r1.173.2.4 src/sys/dev/usb/usbdi.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/usb/usb_quirks.c
diff -u src/sys/dev/usb/usb_quirks.c:1.86.8.1 src/sys/dev/usb/usb_quirks.c:1.86.8.2
--- src/sys/dev/usb/usb_quirks.c:1.86.8.1	Mon Nov 12 16:01:35 2018
+++ src/sys/dev/usb/usb_quirks.c	Tue Nov 20 16:05:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.c,v 1.86.8.1 2018/11/12 16:01:35 martin Exp $	*/
+/*	$NetBSD: usb_quirks.c,v 1.86.8.2 2018/11/20 16:05:38 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.30 2003/01/02 04:15:55 imp Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.86.8.1 2018/11/12 16:01:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_quirks.c,v 1.86.8.2 2018/11/20 16:05:38 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -310,13 +310,24 @@ Static const struct usbd_quirk_entry {
  { USB_VENDOR_ZOOM,		USB_PRODUCT_ZOOM_3095,			ANY,
 	{ UQ_LOST_CS_DESC, NULL }},
 
- /* NXP PN533 corrupts its USB configuration descriptors */
+ /*
+  * NXP PN533 bugs
+  * 
+  * 1. It corrupts its USB descriptors. The quirk is to provide hardcoded
+  *descriptors instead of getting them from the device.
+  * 2. It mishandles the USB toggle bit. This causes some replies to be
+  *filered out by the USB host controller and be reported as timed out.
+  *NFC tool's libnfc workaround this bug by sending a dummy frame to
+  *resync the toggle bit, but in order to succeed, that operation must
+  *not be reported as failed. The quirk is therefore to pretend to 
+  *userland that output timeouts are successes.
+  */
  { USB_VENDOR_PHILIPSSEMI,	USB_PRODUCT_PHILIPSSEMI_PN533,		ANY,
-	{ UQ_DESC_CORRUPT, desc_pn533 }},
+	{ UQ_DESC_CORRUPT | UQ_MISS_OUT_ACK, desc_pn533 }},
  { USB_VENDOR_SHUTTLE,		USB_PRODUCT_SHUTTLE_SCL3711,		ANY,
-	{ UQ_DESC_CORRUPT, desc_pn533 }},
+	{ UQ_DESC_CORRUPT | UQ_MISS_OUT_ACK, desc_pn533 }},
  { USB_VENDOR_SHUTTLE,		USB_PRODUCT_SHUTTLE_SCL3712,		ANY,
-	{ UQ_DESC_CORRUPT, desc_pn533 }},
+	{ UQ_DESC_CORRUPT | UQ_MISS_OUT_ACK, desc_pn533 }},
  { 0, 0, 0, { 0, NULL } }
 };
 

Index: src/sys/dev/usb/usb_quirks.h
diff -u src/sys/dev/usb/usb_quirks.h:1.27.10.1 src/sys/dev/usb/usb_quirks.h:1.27.10.2
--- src/sys/dev/usb/usb_quirks.h:1.27.10.1	Mon Nov 12 16:01:35 2018
+++ src/sys/dev/usb/usb_quirks.h	Tue Nov 20 16:05:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_quirks.h,v 1.27.10.1 2018/11/12 16:01:35 martin Exp $	*/
+/*	$NetBSD: usb_quirks.h,v 1.27.10.2 2018/11/20 16:05:38 martin Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_quirks.h,v 1.9 1999/11/12 23:31:03 n_hibma Exp $	*/
 
 /*
@@ -50,6 +50,7 @@ struct usbd_quirks {
 #define UQ_LOST_CS_DESC 0x1 /* look everywhere for the CS descriptors */
 #define UQ_APPLE_ISO	0x2	/* force ISO layout on Apple keyboards */
 #define UQ_DESC_CORRUPT	0x4	/* may corrupt its config descriptors */
+#define UQ_MISS_OUT_ACK	0x8	/* may fail to ack output */
 	const usb_descriptor_t **desc;	/* Replacement for UQ_DESC_CORRUPT */
 };
 

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.173.2.3 src/sys/dev/usb/usbdi.c:1.173.2.4
--- src/sys/dev/usb/usbdi.c:1.173.2.3	Thu Sep 27 14:52:26 2018
+++ src/sys/dev/usb/usbdi.c	Tue Nov 20 16:05:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.173.2.3 2018/09/27 14:52:26 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.173.2.4 2018/11/20 16:05:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD 

CVS commit: [netbsd-8] src/external/bsd/nsd/dist

2018-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 20 16:02:50 UTC 2018

Modified Files:
src/external/bsd/nsd/dist [netbsd-8]: server.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1098):

external/bsd/nsd/dist/server.c: revision 1.2

Fix NSD when built with --enable-recvmmsg:

When resetting a query with query_reset(queries[i], ...) always restore the
corresponding msgs[i].msg_hdr.msg_namelen from queries[i]->addrlen.

After receiving a message set queries[i]->addrlen to the received msg_namelen.

Reported upstream, will be fixed for 4.1.26


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.8.1 -r1.1.1.1.8.2 src/external/bsd/nsd/dist/server.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/bsd/nsd/dist/server.c
diff -u src/external/bsd/nsd/dist/server.c:1.1.1.1.8.1 src/external/bsd/nsd/dist/server.c:1.1.1.1.8.2
--- src/external/bsd/nsd/dist/server.c:1.1.1.1.8.1	Sat Oct 13 17:30:00 2018
+++ src/external/bsd/nsd/dist/server.c	Tue Nov 20 16:02:50 2018
@@ -2209,6 +2209,7 @@ handle_udp(int fd, short event, void* ar
 	for (i = 0; i < recvcount; i++) {
 	loopstart:
 		received = msgs[i].msg_len;
+		queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
 		q = queries[i];
 		if (received == -1) {
 			log_msg(LOG_ERR, "recvmmsg %d failed %s", i, strerror(
@@ -2217,6 +2218,7 @@ handle_udp(int fd, short event, void* ar
 			/* No zone statup */
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
 			iovecs[i].iov_len = buffer_remaining(q->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 			goto swap_drop;
 		}
 
@@ -2264,6 +2266,7 @@ handle_udp(int fd, short event, void* ar
 		} else {
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
 			iovecs[i].iov_len = buffer_remaining(q->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 		swap_drop:
 			STATUP(data->nsd, dropped);
 			ZTATUP(data->nsd, q->zone, dropped);
@@ -2304,6 +2307,7 @@ handle_udp(int fd, short event, void* ar
 	for(i=0; ipacket);
+		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 	}
 }
 
@@ -2344,13 +2348,15 @@ handle_udp(int fd, short event, void* ar
 	}
 	for (i = 0; i < recvcount; i++) {
 		received = msgs[i].msg_len;
-		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
+		queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
 		if (received == -1) {
 			log_msg(LOG_ERR, "recvmmsg failed");
 			STATUP(data->nsd, rxerr);
 			/* No zone statup */
 			/* the error can be found in msgs[i].msg_hdr.msg_flags */
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+			iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 			continue;
 		}
 		q = queries[i];
@@ -2442,6 +2448,8 @@ handle_udp(int fd, short event, void* ar
 #ifndef NONBLOCKING_IS_BROKEN
 #ifdef HAVE_RECVMMSG
 		query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+		iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 #endif
 	}
 #endif



CVS commit: src/sys/dev/pci

2018-11-20 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Tue Nov 20 15:16:43 UTC 2018

Modified Files:
src/sys/dev/pci: ahcisata_pci.c

Log Message:
Trivial build fix


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/ahcisata_pci.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/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.44 src/sys/dev/pci/ahcisata_pci.c:1.45
--- src/sys/dev/pci/ahcisata_pci.c:1.44	Tue Nov 20 12:23:01 2018
+++ src/sys/dev/pci/ahcisata_pci.c	Tue Nov 20 15:16:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.44 2018/11/20 12:23:01 skrll Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.45 2018/11/20 15:16:43 prlw1 Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.44 2018/11/20 12:23:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.45 2018/11/20 15:16:43 prlw1 Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ahcisata_pci.h"
@@ -326,7 +326,7 @@ alloc_retry:
 			/* The next try is for MSI: Disable MSIX */
 			counts[PCI_INTR_TYPE_INTX] = 1;
 #ifndef AHCISATA_DISABLE_MSI
-			counts[PCI_INTR_TYPE_MSI] = 1;,
+			counts[PCI_INTR_TYPE_MSI] = 1;
 #endif
 			counts[PCI_INTR_TYPE_MSIX] = 0;
 			goto alloc_retry;



CVS commit: src/sys/dev/pci

2018-11-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Nov 20 12:23:02 UTC 2018

Modified Files:
src/sys/dev/pci: ahcisata_pci.c files.pci

Log Message:
Add support for MSI/MSI-X to ahcisata at pci.

The options AHCISATA_DISABLE_MSI and AHCISATA_DISABLE_MSIX are available
if required.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ahcisata_pci.c
cvs rdiff -u -r1.408 -r1.409 src/sys/dev/pci/files.pci

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/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.43 src/sys/dev/pci/ahcisata_pci.c:1.44
--- src/sys/dev/pci/ahcisata_pci.c:1.43	Sun Nov 18 16:34:07 2018
+++ src/sys/dev/pci/ahcisata_pci.c	Tue Nov 20 12:23:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.43 2018/11/18 16:34:07 skrll Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.44 2018/11/20 12:23:01 skrll Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.43 2018/11/18 16:34:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.44 2018/11/20 12:23:01 skrll Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_ahcisata_pci.h"
+#endif
 
 #include 
 #include 
@@ -287,21 +291,62 @@ ahci_pci_attach(device_t parent, device_
 	psc->sc_pcitag = pa->pa_tag;
 
 	pci_aprint_devinfo(pa, "AHCI disk controller");
-	
-	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0) != 0) {
-		aprint_error_dev(self, "couldn't map interrupt\n");
-		return;
+
+
+	/* Allocation settings */
+	int counts[PCI_INTR_TYPE_SIZE] = {
+		[PCI_INTR_TYPE_INTX] = 1,
+#ifndef AHCISATA_DISABLE_MSI
+		[PCI_INTR_TYPE_MSI] = 1,
+#endif
+#ifndef AHCISATA_DISABLE_MSIX
+		[PCI_INTR_TYPE_MSIX] = 1,
+#endif
+	};
+
+alloc_retry:
+	/* Allocate and establish the interrupt. */
+	if (pci_intr_alloc(pa, >sc_pihp, counts, PCI_INTR_TYPE_MSIX)) {
+		aprint_error_dev(self, "can't allocate handler\n");
+		goto fail;
 	}
-	intrstr = pci_intr_string(pa->pa_pc, psc->sc_pihp[0],
-	intrbuf, sizeof(intrbuf));
+
+	intrstr = pci_intr_string(pa->pa_pc, psc->sc_pihp[0], intrbuf,
+	sizeof(intrbuf));
 	psc->sc_ih = pci_intr_establish_xname(pa->pa_pc, psc->sc_pihp[0],
 	IPL_BIO, ahci_intr, sc, device_xname(sc->sc_atac.atac_dev));
 	if (psc->sc_ih == NULL) {
-		pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
-		psc->sc_pihp = NULL;
-
-		aprint_error_dev(self, "couldn't establish interrupt\n");
-		return;
+		const pci_intr_type_t intr_type = pci_intr_type(pa->pa_pc,
+		psc->sc_pihp[0]);
+		pci_intr_release(pa->pa_pc, psc->sc_pihp, 1);
+		psc->sc_ih = NULL;
+		switch (intr_type) {
+#ifndef AHCISATA_DISABLE_MSIX
+		case PCI_INTR_TYPE_MSIX:
+			/* The next try is for MSI: Disable MSIX */
+			counts[PCI_INTR_TYPE_INTX] = 1;
+#ifndef AHCISATA_DISABLE_MSI
+			counts[PCI_INTR_TYPE_MSI] = 1;,
+#endif
+			counts[PCI_INTR_TYPE_MSIX] = 0;
+			goto alloc_retry;
+#endif
+#ifndef AHCISATA_DISABLE_MSI
+		case PCI_INTR_TYPE_MSI:
+			/* The next try is for INTx: Disable MSI */
+			counts[PCI_INTR_TYPE_MSI] = 0;
+			counts[PCI_INTR_TYPE_INTX] = 1;
+			goto alloc_retry;
+#endif
+		case PCI_INTR_TYPE_INTX:
+		default:
+			counts[PCI_INTR_TYPE_INTX] = 1;
+			aprint_error_dev(self, "couldn't establish interrupt");
+			if (intrstr != NULL)
+aprint_error(" at %s", intrstr);
+			aprint_error("\n");
+			goto fail;
+		}
 	}
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
@@ -331,6 +376,20 @@ ahci_pci_attach(device_t parent, device_
 
 	if (!pmf_device_register(self, NULL, ahci_pci_resume))
 		aprint_error_dev(self, "couldn't establish power handler\n");
+
+	return;
+fail:
+	if (psc->sc_pihp != NULL) {
+		pci_intr_release(psc->sc_pc, psc->sc_pihp, 1);
+		psc->sc_pihp = NULL;
+	}
+	if (sc->sc_ahcis) {
+		bus_space_unmap(sc->sc_ahcit, sc->sc_ahcih, sc->sc_ahcis);
+		sc->sc_ahcis = 0;
+	}
+
+	return;
+
 }
 
 static void

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.408 src/sys/dev/pci/files.pci:1.409
--- src/sys/dev/pci/files.pci:1.408	Wed Nov 14 06:56:30 2018
+++ src/sys/dev/pci/files.pci	Tue Nov 20 12:23:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.408 2018/11/14 06:56:30 skrll Exp $
+#	$NetBSD: files.pci,v 1.409 2018/11/20 12:23:01 skrll Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -234,6 +234,8 @@ file	dev/pci/pciide.c		pciide
 # AHCI SATA controllers
 attach	ahcisata at pci with ahcisata_pci
 file	dev/pci/ahcisata_pci.c		ahcisata_pci
+defflag	opt_ahcisata_pci.h		AHCISATA_DISABLE_MSI
+defflag	opt_ahcisata_pci.h		AHCISATA_DISABLE_MSIX
 
 # Acard IDE controllers
 device	acardide: ata, ata_dma, ata_udma, pciide_common, wdc_common



CVS commit: src/external/bsd/nsd/dist

2018-11-20 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue Nov 20 10:03:39 UTC 2018

Modified Files:
src/external/bsd/nsd/dist: server.c

Log Message:
Fix NSD when built with --enable-recvmmsg:

When resetting a query with query_reset(queries[i], ...) always restore the
corresponding msgs[i].msg_hdr.msg_namelen from queries[i]->addrlen.

After receiving a message set queries[i]->addrlen to the received msg_namelen.

Reported upstream, will be fixed for 4.1.26


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/nsd/dist/server.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/bsd/nsd/dist/server.c
diff -u src/external/bsd/nsd/dist/server.c:1.1.1.3 src/external/bsd/nsd/dist/server.c:1.2
--- src/external/bsd/nsd/dist/server.c:1.1.1.3	Mon Sep  3 11:29:15 2018
+++ src/external/bsd/nsd/dist/server.c	Tue Nov 20 10:03:39 2018
@@ -2209,6 +2209,7 @@ handle_udp(int fd, short event, void* ar
 	for (i = 0; i < recvcount; i++) {
 	loopstart:
 		received = msgs[i].msg_len;
+		queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
 		q = queries[i];
 		if (received == -1) {
 			log_msg(LOG_ERR, "recvmmsg %d failed %s", i, strerror(
@@ -2217,6 +2218,7 @@ handle_udp(int fd, short event, void* ar
 			/* No zone statup */
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
 			iovecs[i].iov_len = buffer_remaining(q->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 			goto swap_drop;
 		}
 
@@ -2264,6 +2266,7 @@ handle_udp(int fd, short event, void* ar
 		} else {
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
 			iovecs[i].iov_len = buffer_remaining(q->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 		swap_drop:
 			STATUP(data->nsd, dropped);
 			ZTATUP(data->nsd, q->zone, dropped);
@@ -2304,6 +2307,7 @@ handle_udp(int fd, short event, void* ar
 	for(i=0; ipacket);
+		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 	}
 }
 
@@ -2344,13 +2348,15 @@ handle_udp(int fd, short event, void* ar
 	}
 	for (i = 0; i < recvcount; i++) {
 		received = msgs[i].msg_len;
-		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
+		queries[i]->addrlen = msgs[i].msg_hdr.msg_namelen;
 		if (received == -1) {
 			log_msg(LOG_ERR, "recvmmsg failed");
 			STATUP(data->nsd, rxerr);
 			/* No zone statup */
 			/* the error can be found in msgs[i].msg_hdr.msg_flags */
 			query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+			iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+			msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 			continue;
 		}
 		q = queries[i];
@@ -2442,6 +2448,8 @@ handle_udp(int fd, short event, void* ar
 #ifndef NONBLOCKING_IS_BROKEN
 #ifdef HAVE_RECVMMSG
 		query_reset(queries[i], UDP_MAX_MESSAGE_LEN, 0);
+		iovecs[i].iov_len = buffer_remaining(queries[i]->packet);
+		msgs[i].msg_hdr.msg_namelen = queries[i]->addrlen;
 #endif
 	}
 #endif



CVS commit: src/sys/dev/ic

2018-11-20 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Nov 20 08:47:55 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
also set WDCTL_4BIT for the softreset, seems this one is actually also
required to fully resolve the problem

PR kern/48214 PR kern/53307 PR kern/53524


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/ahcisata_core.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/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.69 src/sys/dev/ic/ahcisata_core.c:1.70
--- src/sys/dev/ic/ahcisata_core.c:1.69	Mon Nov 19 22:05:22 2018
+++ src/sys/dev/ic/ahcisata_core.c	Tue Nov 20 08:47:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.69 2018/11/19 22:05:22 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.70 2018/11/20 08:47:55 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.69 2018/11/19 22:05:22 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.70 2018/11/20 08:47:55 jdolecek Exp $");
 
 #include 
 #include 
@@ -829,7 +829,7 @@ ahci_do_reset_drive(struct ata_channel *
 	memset(cmd_tbl->cmdt_cfis, 0, 64);
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;
 	cmd_tbl->cmdt_cfis[rhd_c] = drive;
-	cmd_tbl->cmdt_cfis[rhd_control] = WDCTL_RST;
+	cmd_tbl->cmdt_cfis[rhd_control] = WDCTL_RST | WDCTL_4BIT;
 	switch (ahci_exec_fis(chp, 100, flags, c_slot)) {
 	case ERR_DF:
 	case TIMEOUT:
@@ -854,7 +854,7 @@ ahci_do_reset_drive(struct ata_channel *
 	memset(cmd_tbl->cmdt_cfis, 0, 64);
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;
 	cmd_tbl->cmdt_cfis[rhd_c] = drive;
-	cmd_tbl->cmdt_cfis[rhd_control] = 0;
+	cmd_tbl->cmdt_cfis[rhd_control] = WDCTL_4BIT;
 	switch (ahci_exec_fis(chp, 310, flags, c_slot)) {
 	case ERR_DF:
 	case TIMEOUT: