CVS commit: src/doc

2016-09-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  3 23:31:53 UTC 2016

Modified Files:
src/doc: 3RDPARTY

Log Message:
Update llvm info.


To generate a diff of this commit:
cvs rdiff -u -r1.1356 -r1.1357 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1356 src/doc/3RDPARTY:1.1357
--- src/doc/3RDPARTY:1.1356	Sat Sep  3 23:01:57 2016
+++ src/doc/3RDPARTY	Sat Sep  3 23:31:53 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1356 2016/09/03 23:01:57 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1357 2016/09/03 23:31:53 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -737,7 +737,7 @@ Notes:
   .so'ing only. Copy the rest to man.
 
 Package:	llvm
-Version:	3.4rc1 (r195771)
+Version:	3.8.1+ (r280599)
 Current Vers.:	3.9.0
 Maintainer:	llvm...@cs.uiuc.edu
 Home Page:	http://llvm.org



CVS commit: src/external/bsd/llvm

2016-09-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Sep  3 23:22:38 UTC 2016

Modified Files:
src/external/bsd/llvm: Makefile.inc

Log Message:
Update LLVM and Clang to 3.8.1+ r280599. The most relevant changes for
NetBSD are driver logic for PIE linkage and a number of SPARC fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/external/bsd/llvm/Makefile.inc

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

Modified files:

Index: src/external/bsd/llvm/Makefile.inc
diff -u src/external/bsd/llvm/Makefile.inc:1.80 src/external/bsd/llvm/Makefile.inc:1.81
--- src/external/bsd/llvm/Makefile.inc:1.80	Sat Feb 27 21:47:30 2016
+++ src/external/bsd/llvm/Makefile.inc	Sat Sep  3 23:22:38 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.80 2016/02/27 21:47:30 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.81 2016/09/03 23:22:38 joerg Exp $
 
 .if !defined(LLVM_TOPLEVEL_MK)
 LLVM_TOPLEVEL_MK=
@@ -8,7 +8,7 @@ LLVM_TOPLEVEL_MK=
 SVN_ROOT=		http://llvm.org/svn/llvm-project
 SVN_BRANCH=		branches/release_38
 
-COMMON_REVISION=	r261930
+COMMON_REVISION=	r280599
 CLANG_REVISION=		${COMMON_REVISION}
 LLD_REVISION=		${COMMON_REVISION}
 LLDB_REVISION=		${COMMON_REVISION}



CVS commit: src/doc

2016-09-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  3 23:01:57 UTC 2016

Modified Files:
src/doc: 3RDPARTY

Log Message:
llvm-3.9.0 out.


To generate a diff of this commit:
cvs rdiff -u -r1.1355 -r1.1356 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1355 src/doc/3RDPARTY:1.1356
--- src/doc/3RDPARTY:1.1355	Wed Aug 31 09:34:04 2016
+++ src/doc/3RDPARTY	Sat Sep  3 23:01:57 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1355 2016/08/31 09:34:04 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1356 2016/09/03 23:01:57 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -738,7 +738,7 @@ Notes:
 
 Package:	llvm
 Version:	3.4rc1 (r195771)
-Current Vers.:	3.7.1
+Current Vers.:	3.9.0
 Maintainer:	llvm...@cs.uiuc.edu
 Home Page:	http://llvm.org
 Responsible:	joerg



CVS commit: src/share/mk

2016-09-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Sep  3 16:10:35 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch shark to Xorg server 1.18.

The igs driver no longer builds against 1.10.


To generate a diff of this commit:
cvs rdiff -u -r1.951 -r1.952 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.951 src/share/mk/bsd.own.mk:1.952
--- src/share/mk/bsd.own.mk:1.951	Sat Sep  3 12:32:12 2016
+++ src/share/mk/bsd.own.mk	Sat Sep  3 16:10:34 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.951 2016/09/03 12:32:12 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.952 2016/09/03 16:10:34 jakllsch Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1399,7 +1399,11 @@ X11SRCDIR.${_proto}proto?=		${X11SRCDIRM
 .endfor
 
 # During transition from xorg-server 1.10 to 1.18
+.if ${MACHINE} == "shark"
+HAVE_XORG_SERVER_VER?=118
+.else
 HAVE_XORG_SERVER_VER?=110
+.endif
 
 .if ${HAVE_XORG_SERVER_VER} == "118"
 XORG_SERVER_SUBDIR?=xorg-server



CVS commit: src/external/gpl3/gcc/usr.bin/backend

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 15:47:54 UTC 2016

Modified Files:
src/external/gpl3/gcc/usr.bin/backend: Makefile

Log Message:
gcc generates incorrect jump tables with -fPIE


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/external/gpl3/gcc/usr.bin/backend/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/gpl3/gcc/usr.bin/backend/Makefile
diff -u src/external/gpl3/gcc/usr.bin/backend/Makefile:1.32 src/external/gpl3/gcc/usr.bin/backend/Makefile:1.33
--- src/external/gpl3/gcc/usr.bin/backend/Makefile:1.32	Thu Jun 16 23:27:50 2016
+++ src/external/gpl3/gcc/usr.bin/backend/Makefile	Sat Sep  3 11:47:54 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2016/06/17 03:27:50 skrll Exp $
+#	$NetBSD: Makefile,v 1.33 2016/09/03 15:47:54 christos Exp $
 
 LIBISPRIVATE=	yes
 
@@ -511,7 +511,9 @@ CFLAGS+=	-Wno-stack-protector
 
 .if ${GCC_MACHINE_ARCH} == "m68000" || ${GCC_MACHINE_ARCH} == "m68k" || \
 	${GCC_MACHINE_ARCH} == "coldfire"
-COPTS.tree-loop-distribution.c=	-O2
+COPTS.tree-loop-distribution.c+=-O2
+COPTS.generic-match.c+=-fno-jump-tables
+COPTS.gimple-match.c+=-fno-jump-tables
 .endif
 
 



CVS commit: src/sys/arch/sun68k/stand

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 15:18:21 UTC 2016

Modified Files:
src/sys/arch/sun68k/stand: Makefile.inc

Log Message:
NOSSP/NOPIE


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun68k/stand/Makefile.inc

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

Modified files:

Index: src/sys/arch/sun68k/stand/Makefile.inc
diff -u src/sys/arch/sun68k/stand/Makefile.inc:1.26 src/sys/arch/sun68k/stand/Makefile.inc:1.27
--- src/sys/arch/sun68k/stand/Makefile.inc:1.26	Sat Mar 12 20:06:51 2016
+++ src/sys/arch/sun68k/stand/Makefile.inc	Sat Sep  3 11:18:21 2016
@@ -1,5 +1,7 @@
-#	$NetBSD: Makefile.inc,v 1.26 2016/03/13 01:06:51 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.27 2016/09/03 15:18:21 christos Exp $
 
+NOSSP=	# defined
+NOPIE=	# defined
 # Must have S=/usr/src/sys (or equivalent)
 # But note: this is w.r.t. a subdirectory
 S=	${.CURDIR}/../../../..



CVS commit: src/doc

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 12:39:41 UTC 2016

Modified Files:
src/doc: TODO.8

Log Message:
update for sh3 arm and mips


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/doc/TODO.8

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

Modified files:

Index: src/doc/TODO.8
diff -u src/doc/TODO.8:1.3 src/doc/TODO.8:1.4
--- src/doc/TODO.8:1.3	Sat Jul 30 02:20:14 2016
+++ src/doc/TODO.8	Sat Sep  3 08:39:41 2016
@@ -1,4 +1,4 @@
-$NetBSD: TODO.8,v 1.3 2016/07/30 06:20:14 dholland Exp $
+$NetBSD: TODO.8,v 1.4 2016/09/03 12:39:41 christos Exp $
 
 Items we (currently) plan to finish before branching netbsd-8:
 
@@ -25,59 +25,57 @@ arc
 arm
 atari
 bebox		Y	Y	Y
-cats		Y	Y	Y
+cats		Y	Y	Y	Y
 cesfic
 cobalt
-dreamcast
-emips
+dreamcast	Y	Y	Y	Y
+emips		Y	Y	Y	Y
 epoc32
 evbarm		Y	Y	Y	Y	Y	Y
 evbarm64	N	Y	
 evbcf
-evbmips
+evbmips		Y	Y	Y	Y
 evbppc		Y	Y	Y
-evbsh3
+evbsh3		Y	Y	Y	Y
 evbsh5
-ews4800mips
+ews4800mips	Y	Y	Y	Y
 hp300
 hp700		Y	Y
 hpc
 hpcarm		Y	Y	Y
-hpcmips
-hpcsh
+hpcmips		Y	Y	Y	Y
+hpcsh		Y	Y	Y	Y
 hppa		Y	Y
 i386		Y	Y	Y	Y	Y	Y
 ia64		Y	Y
 ibmnws
 iyonix
-landisk
+landisk		Y	Y	Y	Y	Y	Y
 luna68k
 m68k
 mac68k
 macppc		Y	Y
 mips
 mipsco
-mmeyeY
+mmeye		Y	Y	Y	Y	Y	Y
 mvme68k
 mvmeppc		Y	Y	Y
 netwinder
 news68k
-newsmips
+newsmips	Y	Y	Y	Y
 next68k
 ofppc		Y	Y	Y
 or1k
 playstation2	Y	Y	Y
-pmax
+pmax		Y	Y	Y	Y	Y	Y
 pmppc		Y	Y	Y
 powerpc		Y	Y	Y
 prep		Y	Y	Y
 riscv
 rs6000		Y	Y	Y
 sandpoint	Y	Y	Y
-sbmips
-sgimipsY
-sh3Y
-sh5
+sbmips		Y	Y	Y	Y
+sgimips		Y	Y	Y	Y
 shark		Y	Y	Y	Y	Y	Y
 sparc		Y	Y	Y	Y	Y	N
 sparc64		Y	Y	Y	Y	Y	N



CVS commit: src/share/mk

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 12:32:12 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch mips32 to new binutils/gcc/gdb/pie. Tested with gxemul+pmax


To generate a diff of this commit:
cvs rdiff -u -r1.950 -r1.951 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.950 src/share/mk/bsd.own.mk:1.951
--- src/share/mk/bsd.own.mk:1.950	Sat Sep  3 05:08:28 2016
+++ src/share/mk/bsd.own.mk	Sat Sep  3 08:32:12 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.950 2016/09/03 09:08:28 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.951 2016/09/03 12:32:12 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -78,6 +78,7 @@ HAVE_GCC?=	0
 ${MACHINE_CPU} == "arm" || \
 ${MACHINE_CPU} == "sh3" || \
 ${MACHINE_CPU} == "powerpc" || \
+${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
 ${MACHINE_ARCH} == "vax"
 HAVE_GCC?=	53
 .else
@@ -158,7 +159,7 @@ USE_SSP?=	yes
 ${MACHINE_CPU} == "arm" || \
 ${MACHINE_CPU} == "powerpc" || \
 ${MACHINE_CPU} == "sh3" || \
-${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
+${MACHINE_CPU} == "mips"
 HAVE_GDB?=	710
 .else
 HAVE_GDB?=	79
@@ -184,6 +185,7 @@ EXTERNAL_GDB_SUBDIR=		gdb
 ${MACHINE} == "vax" || \
 ${MACHINE_CPU} == "arm" || \
 ${MACHINE_CPU} == "sh3" || \
+${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel" || \
 ${MACHINE_ARCH} == "powerpc"
 HAVE_BINUTILS?=	226
 .else
@@ -1076,6 +1078,7 @@ MKCTF?=		yes
 #
 .if ${MACHINE_ARCH} == "i386" || \
 ${MACHINE_ARCH} == "x86_64" || \
+${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
 ${MACHINE_CPU} == "arm" || \
 ${MACHINE_CPU} == "sh3" || \
 ${MACHINE} == "sparc64"



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

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 12:27:35 UTC 2016

Modified Files:
src/sys/arch/pmax/conf: GENERIC

Log Message:
add aslr/mprotect et.al.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/pmax/conf/GENERIC

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/pmax/conf/GENERIC
diff -u src/sys/arch/pmax/conf/GENERIC:1.185 src/sys/arch/pmax/conf/GENERIC:1.186
--- src/sys/arch/pmax/conf/GENERIC:1.185	Sun Nov 16 11:01:42 2014
+++ src/sys/arch/pmax/conf/GENERIC	Sat Sep  3 08:27:35 2016
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.185 2014/11/16 16:01:42 manu Exp $
+# $NetBSD: GENERIC,v 1.186 2016/09/03 12:27:35 christos Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/pmax/conf/std.pmax"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.185 $"
+#ident		"GENERIC-$Revision: 1.186 $"
 
 maxusers	64
 
@@ -321,18 +321,24 @@ pseudo-device	ksyms			# /dev/ksyms
 pseudo-device	wsfont			# wsfont control device
 pseudo-device	wsmux			# wsmux control device
 
+options 	FILEASSOC		# fileassoc(9) - required for Veriexec
+
 # Veriexec
-#
-# a pseudo device needed for veriexec
-#pseudo-device	veriexec
+pseudo-device	veriexec
 #
 # Uncomment the fingerprint methods below that are desired. Note that
 # removing fingerprint methods will have almost no impact on the kernel
 # code size.
 #
-#options VERIFIED_EXEC_FP_RMD160
-#options VERIFIED_EXEC_FP_SHA256
-#options VERIFIED_EXEC_FP_SHA384
-#options VERIFIED_EXEC_FP_SHA512
-#options VERIFIED_EXEC_FP_SHA1
-#options VERIFIED_EXEC_FP_MD5
+options 	VERIFIED_EXEC_FP_RMD160
+options 	VERIFIED_EXEC_FP_SHA256
+options 	VERIFIED_EXEC_FP_SHA384
+options 	VERIFIED_EXEC_FP_SHA512
+options 	VERIFIED_EXEC_FP_SHA1
+options 	VERIFIED_EXEC_FP_MD5
+
+options 	PAX_ASLR_DEBUG=1	# PaX ASLR debug
+options 	PAX_SEGVGUARD=0		# PaX Segmentation fault guard
+options 	PAX_MPROTECT=1		# PaX mprotect(2) restrictions
+options 	PAX_MPROTECT_DEBUG=1	# PaX mprotect debug
+options 	PAX_ASLR=1		# PaX Address Space Layout Randomization



CVS commit: src/sys

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 12:20:58 UTC 2016

Modified Files:
src/sys/kern: kern_pax.c
src/sys/sys: pax.h

Log Message:
vsize_t is not always u_long :-)


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/kern/kern_pax.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/pax.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/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.55 src/sys/kern/kern_pax.c:1.56
--- src/sys/kern/kern_pax.c:1.55	Fri May 27 12:35:16 2016
+++ src/sys/kern/kern_pax.c	Sat Sep  3 08:20:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.55 2016/05/27 16:35:16 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.56 2016/09/03 12:20:58 christos Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.55 2016/05/27 16:35:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.56 2016/09/03 12:20:58 christos Exp $");
 
 #include "opt_pax.h"
 
@@ -632,7 +632,7 @@ pax_aslr_rtld_offset(struct exec_package
 }
 
 void
-pax_aslr_stack(struct exec_package *epp, u_long *max_stack_size)
+pax_aslr_stack(struct exec_package *epp, vsize_t *max_stack_size)
 {
 	if (!pax_aslr_epp_active(epp))
 		return;

Index: src/sys/sys/pax.h
diff -u src/sys/sys/pax.h:1.24 src/sys/sys/pax.h:1.25
--- src/sys/sys/pax.h:1.24	Wed May 25 16:07:54 2016
+++ src/sys/sys/pax.h	Sat Sep  3 08:20:58 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: pax.h,v 1.24 2016/05/25 20:07:54 christos Exp $ */
+/* $NetBSD: pax.h,v 1.25 2016/09/03 12:20:58 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Elad Efrat 
@@ -88,7 +88,7 @@ int pax_segvguard(struct lwp *, struct v
 
 #ifdef PAX_ASLR
 void pax_aslr_init_vm(struct lwp *, struct vmspace *, struct exec_package *);
-void pax_aslr_stack(struct exec_package *, u_long *);
+void pax_aslr_stack(struct exec_package *, vsize_t *);
 uint32_t pax_aslr_stack_gap(struct exec_package *);
 vaddr_t pax_aslr_exec_offset(struct exec_package *, vaddr_t);
 voff_t pax_aslr_rtld_offset(struct exec_package *, vaddr_t, int);



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 12:07:42 UTC 2016

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Fix "spurious event" when command ring rolls over.
When the enqueue pointer of command ring points at the last TRB,
address of Link TRB was stored in sc_command_addr.
It should be address of 0th TRB of ring.

>From t-hash


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/xhci.c

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.66 src/sys/dev/usb/xhci.c:1.67
--- src/sys/dev/usb/xhci.c:1.66	Sat Sep  3 12:06:50 2016
+++ src/sys/dev/usb/xhci.c	Sat Sep  3 12:07:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.67 2016/09/03 12:07:41 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.67 2016/09/03 12:07:41 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2498,7 +2498,14 @@ xhci_do_command_locked(struct xhci_softc
 
 	/* XXX KASSERT may fire when cv_timedwait unlocks sc_lock */
 	KASSERT(sc->sc_command_addr == 0);
-	sc->sc_command_addr = xhci_ring_trbp(cr, cr->xr_ep);
+	/*
+	 * If enqueue pointer points at last of ring, it's Link TRB,
+	 * command TRB will be stored in 0th TRB.
+	 */
+	if (cr->xr_ep == cr->xr_ntrb - 1)
+		sc->sc_command_addr = xhci_ring_trbp(cr, 0);
+	else
+		sc->sc_command_addr = xhci_ring_trbp(cr, cr->xr_ep);
 
 	mutex_enter(&cr->xr_lock);
 	xhci_ring_put(sc, cr, NULL, trb, 1);



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 12:06:50 UTC 2016

Modified Files:
src/sys/dev/usb: xhci.c

Log Message:
Suppress stopping-endpoint in xhci_close_pipe if the endpoint is
already stopped.

>From t-hash


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/xhci.c

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.65 src/sys/dev/usb/xhci.c:1.66
--- src/sys/dev/usb/xhci.c:1.65	Thu Aug 18 07:18:52 2016
+++ src/sys/dev/usb/xhci.c	Sat Sep  3 12:06:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.65 2016/08/18 07:18:52 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.65 2016/08/18 07:18:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.66 2016/09/03 12:06:50 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1511,11 +1511,8 @@ xhci_close_pipe(struct usbd_pipe *pipe)
 		return;
 	}
 
-	/*
-	 * This may fail in the case that xhci_close_pipe is called after
-	 * xhci_abort_xfer e.g. usbd_kill_pipe.
-	 */
-	(void)xhci_stop_endpoint(pipe);
+	if (xhci_get_epstate(sc, xs, dci) != XHCI_EPSTATE_STOPPED)
+		(void)xhci_stop_endpoint(pipe);
 
 	/*
 	 * set appropriate bit to be dropped.



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 12:05:36 UTC 2016

Modified Files:
src/sys/dev/usb: xhcireg.h

Log Message:
Fix some typos.  From t-hash.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/xhcireg.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/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.7 src/sys/dev/usb/xhcireg.h:1.8
--- src/sys/dev/usb/xhcireg.h:1.7	Sun Aug 28 16:41:30 2016
+++ src/sys/dev/usb/xhcireg.h	Sat Sep  3 12:05:36 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.7 2016/08/28 16:41:30 skrll Exp $ */
+/* $NetBSD: xhcireg.h,v 1.8 2016/09/03 12:05:36 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -79,7 +79,7 @@
 #define	 XHCI_HCC_LHRC(x)	(((x) >> 5) & 0x1)	/* light HC reset */
 #define	 XHCI_HCC_LTC(x)	(((x) >> 6) & 0x1)	/* latency tolerance msg */
 #define	 XHCI_HCC_NSS(x)	(((x) >> 7) & 0x1)	/* no secondary sid */
-#define	 XHCI_HCC_PAE(x)	(((x) >> 8) & 0x1)	/* Pase All Event Data */
+#define	 XHCI_HCC_PAE(x)	(((x) >> 8) & 0x1)	/* Parse All Event Data */
 #define	 XHCI_HCC_SPC(x)	(((x) >> 9) & 0x1)	/* Short packet */
 #define	 XHCI_HCC_SEC(x)	(((x) >> 10) & 0x1)	/* Stopped EDTLA */
 #define	 XHCI_HCC_CFC(x)	(((x) >> 11) & 0x1)	/* Configuous Frame ID */
@@ -232,7 +232,7 @@
 
 /* XHCI extended capability ID's */
 #define	XHCI_ID_USB_LEGACY	0x0001	/* USB Legacy Support */
-#define	 XHCI_XECP_USBLESUP	0x	/* Legacy Support Capability Reg */
+#define	 XHCI_XECP_USBLEGSUP	0x	/* Legacy Support Capability Reg */
 #define	 XHCI_XECP_USBLEGCTLSTS	0x0004	/* Legacy Support Ctrl & Status Reg */
 #define	XHCI_ID_PROTOCOLS	0x0002	/* Supported Protocol */
 #define	XHCI_ID_POWER_MGMT	0x0003	/* Extended Power Management */



CVS commit: [netbsd-6] src/doc

2016-09-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  3 11:36:54 UTC 2016

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1367 has been reverted


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.262 -r1.1.2.263 src/doc/CHANGES-6.2

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-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.262 src/doc/CHANGES-6.2:1.1.2.263
--- src/doc/CHANGES-6.2:1.1.2.262	Wed Aug 31 15:16:28 2016
+++ src/doc/CHANGES-6.2	Sat Sep  3 11:36:54 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.262 2016/08/31 15:16:28 bouyer Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.263 2016/09/03 11:36:54 bouyer Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -14603,20 +14603,6 @@ libexec/mail.local/mail.local.c			1.28
 	Fix error checks in open(2) calls.
 	[shm, ticket #1392]
 
-sys/miscfs/kernfs/kernfs_vnops.c		1.151
-	>From Ilya Zykov: Unbreak kernfs which was broken by this commit
-
-	|Make the spec_node table implementation private to spec_vnops.c.
-	|To retrieve a spec_node, two new lookup functions (by device or
-	| by mount) are implemented.  Both return a referenced vnode,
-	| for an opened block device the opened vnode is returned so
-	| further diagnostic checks "vp == ... sd_bdevvp" will not fire.
-	| Otherwise any vnode matching the criteria gets returned.
-	|No objections on tech-kern.
-
-	The effect was that ls /kernfs appeared empty in most cases.
-	[is, ticket #1367]
-
 etc/Makefile	1.403
 
 	spwd.db should be 0600 (Brooks Davis)



CVS commit: [netbsd-6] src/sys/miscfs/kernfs

2016-09-03 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  3 11:36:03 UTC 2016

Modified Files:
src/sys/miscfs/kernfs [netbsd-6]: kernfs_vnops.c

Log Message:
Revert ticket 1367, it causes a kernel panic in test lib/libc/gen/t_getcwd
as seen in e.g.
http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/netbsd-6/i386/201608291710Z_anita.txt

lib/libc/gen/t_getcwd (206/500): 2 test cases
getcwd_err: [0.006614s] Passed.
getcwd_fts: uvm_fault(0xc0e221b0, 0, 1) -> 0xe
fatal page fault in supervisor mode
trap type 6 code 0 eip c023ba9f cs 9 eflags 10246 cr2 1c ilevel 0
panic: trap
cpu1: Begin traceback...
panic(c04616d0,cdcfb938,cdcfb938,c023ba9f,9,10246,1c,0,1c,0) at 
netbsd:panic+0x18
trap() at netbsd:trap+0xb51
--- trap (number 6) ---
kernfs_readdir(cdcfbc0c,1,c11ce0b4,c0439f60,c11ce0b4,cdcfbc58,c0cc0cc0,cdcfbc7c,0,0)
 at netbsd:kernfs_readdir+0x98f
VOP_READDIR(c11ce0b4,cdcfbc58,c0cc0cc0,cdcfbc7c,0,0,c19287e0,1,cdcfbc58,cdcfbc74)
 at netbsd:VOP_READDIR+0x68
vn_readdir(c14c3000,bb512000,0,1000,cdcfbcbc,c19287e0,0,0,c14c3000,0) at 
netbsd:vn_readdir+0xbd
sys___getdents30(c19287e0,cdcfbd00,cdcfbd28,186,bb516000,0,cdcfbd00,c1199bf4,2,bb7a4fe7)
 at netbsd:sys___getdents30+0x8c
syscall(cdcfbd48,bb6b00b3,ab,bf7f001f,bb6b001f,0,bb5010d0,bf7fe764,bb7c4be0,0) 
at netbsd:syscall+0xaa
cpu1: End traceback...


To generate a diff of this commit:
cvs rdiff -u -r1.144.2.1 -r1.144.2.2 src/sys/miscfs/kernfs/kernfs_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/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.144.2.1 src/sys/miscfs/kernfs/kernfs_vnops.c:1.144.2.2
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.144.2.1	Sat Aug 27 13:13:31 2016
+++ src/sys/miscfs/kernfs/kernfs_vnops.c	Sat Sep  3 11:36:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vnops.c,v 1.144.2.1 2016/08/27 13:13:31 bouyer Exp $	*/
+/*	$NetBSD: kernfs_vnops.c,v 1.144.2.2 2016/09/03 11:36:03 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.144.2.1 2016/08/27 13:13:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.144.2.2 2016/09/03 11:36:03 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ipsec.h"
@@ -63,7 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_vnops
 
 #include 
 #include 
-#include 
 
 #ifdef IPSEC
 #include 
@@ -860,11 +859,6 @@ kernfs_getattr(void *v)
 		vap->va_bytes = vap->va_size = DEV_BSIZE;
 		break;
 
-	case KFSdevice:
-		vap->va_nlink = 1;
-		vap->va_rdev = ap->a_vp->v_rdev;
-		break;
-
 	case KFSroot:
 		vap->va_nlink = 1;
 		vap->va_bytes = vap->va_size = DEV_BSIZE;
@@ -882,6 +876,7 @@ kernfs_getattr(void *v)
 	case KFSstring:
 	case KFShostname:
 	case KFSavenrun:
+	case KFSdevice:
 	case KFSmsgbuf:
 #ifdef IPSEC
 	case KFSipsecsa:
@@ -1055,8 +1050,18 @@ kernfs_setdirentfileno_kt(struct dirent 
 	if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt->kt_tag, kt,
 	value)) != 0)
 		return error;
-	kfs = VTOKERN(vp);
-	d->d_fileno = kfs->kfs_fileno;
+	if (kt->kt_tag == KFSdevice) {
+		struct vattr va;
+
+		error = VOP_GETATTR(vp, &va, ap->a_cred);
+		if (error != 0) {
+			return error;
+		}
+		d->d_fileno = va.va_fileid;
+	} else {
+		kfs = VTOKERN(vp);
+		d->d_fileno = kfs->kfs_fileno;
+	}
 	vput(vp);
 	return 0;
 }



CVS commit: src/usr.bin/elf2ecoff

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 11:35:24 UTC 2016

Modified Files:
src/usr.bin/elf2ecoff: elf2ecoff.c

Log Message:
ignore the abiflags section


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.bin/elf2ecoff/elf2ecoff.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.bin/elf2ecoff/elf2ecoff.c
diff -u src/usr.bin/elf2ecoff/elf2ecoff.c:1.29 src/usr.bin/elf2ecoff/elf2ecoff.c:1.30
--- src/usr.bin/elf2ecoff/elf2ecoff.c:1.29	Sun Nov 10 12:14:25 2013
+++ src/usr.bin/elf2ecoff/elf2ecoff.c	Sat Sep  3 07:35:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2ecoff.c,v 1.29 2013/11/10 17:14:25 christos Exp $	*/
+/*	$NetBSD: elf2ecoff.c,v 1.30 2016/09/03 11:35:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Jonathan Stone
@@ -217,23 +217,25 @@ usage:
 	(int (*) (const void *, const void *)) phcmp);
 
 	for (i = 0; i < ex.e_phnum; i++) {
-		/* Section types we can ignore... */
-		if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE ||
-		ph[i].p_type == PT_PHDR ||
-		ph[i].p_type == PT_MIPS_REGINFO) {
-
+		switch (ph[i].p_type) {
+		case PT_NOTE:
+		case PT_NULL:
+		case PT_PHDR:
+		case PT_MIPS_ABIFLAGS:
+		case PT_MIPS_REGINFO:
+			/* Section types we can ignore... */
 			if (debug) {
-fprintf(stderr, "  skipping PH %zu type %d "
-"flags 0x%x\n",
+fprintf(stderr, "  skipping PH %zu type %#x "
+"flags %#x\n",
 i, ph[i].p_type, ph[i].p_flags);
 			}
 			continue;
-		}
-		/* Section types we can't handle... */
-		else
+		default:
+			/* Section types we can't handle... */
 			if (ph[i].p_type != PT_LOAD)
-errx(1, "Program header %zu type %d can't be "
+errx(1, "Program header %zu type %#x can't be "
 "converted", i, ph[i].p_type);
+		}
 		/* Writable (data) segment? */
 		if (ph[i].p_flags & PF_W) {
 			struct sect ndata, nbss;



CVS commit: src/sys/arch/pmax/stand

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 11:34:47 UTC 2016

Modified Files:
src/sys/arch/pmax/stand: Makefile.booters

Log Message:
Add NOPIE


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

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/pmax/stand/Makefile.booters
diff -u src/sys/arch/pmax/stand/Makefile.booters:1.61 src/sys/arch/pmax/stand/Makefile.booters:1.62
--- src/sys/arch/pmax/stand/Makefile.booters:1.61	Tue Mar 22 04:25:22 2016
+++ src/sys/arch/pmax/stand/Makefile.booters	Sat Sep  3 07:34:47 2016
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.booters,v 1.61 2016/03/22 08:25:22 mrg Exp $
+# $NetBSD: Makefile.booters,v 1.62 2016/09/03 11:34:47 christos Exp $
 
 NOMAN=		# defined
+NOPIE=		# defined
 
 .include 
 



CVS commit: src/tools/mips-elf2ecoff

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 11:34:05 UTC 2016

Modified Files:
src/tools/mips-elf2ecoff: Makefile
Removed Files:
src/tools/mips-elf2ecoff/sys: exec_ecoff.h exec_elf.h

Log Message:
use the nbcompat copies for those files


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tools/mips-elf2ecoff/Makefile
cvs rdiff -u -r1.1 -r0 src/tools/mips-elf2ecoff/sys/exec_ecoff.h
cvs rdiff -u -r1.5 -r0 src/tools/mips-elf2ecoff/sys/exec_elf.h

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

Modified files:

Index: src/tools/mips-elf2ecoff/Makefile
diff -u src/tools/mips-elf2ecoff/Makefile:1.2 src/tools/mips-elf2ecoff/Makefile:1.3
--- src/tools/mips-elf2ecoff/Makefile:1.2	Sun Dec  8 15:20:02 2002
+++ src/tools/mips-elf2ecoff/Makefile	Sat Sep  3 07:34:05 2016
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.2 2002/12/08 20:20:02 thorpej Exp $
+#	$NetBSD: Makefile,v 1.3 2016/09/03 11:34:05 christos Exp $
 
 HOSTPROGNAME=	${_TOOL_PREFIX}mips-elf2ecoff
 HOST_SRCDIR=	usr.bin/elf2ecoff
 HOST_CPPFLAGS=	-I${.CURDIR}
 
+.include "${.CURDIR}/../Makefile.nbincludes"
 .include "${.CURDIR}/../Makefile.host"



CVS commit: src/sys/sys

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 11:18:28 UTC 2016

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

Log Message:
Add mips abiflags section


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/sys/exec_elf.h

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

Modified files:

Index: src/sys/sys/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.155 src/sys/sys/exec_elf.h:1.156
--- src/sys/sys/exec_elf.h:1.155	Tue May 31 16:02:16 2016
+++ src/sys/sys/exec_elf.h	Sat Sep  3 07:18:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.155 2016/05/31 20:02:16 christos Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.156 2016/09/03 11:18:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -364,6 +364,7 @@ typedef struct {
 #define PT_HIPROC	0x7fff
 
 #define PT_MIPS_REGINFO 0x7000
+#define PT_MIPS_ABIFLAGS 0x7003
 
 /* p_flags */
 #define PF_R		0x4		/* Segment is readable */



CVS commit: src/crypto/external/bsd/netpgp/dist/src/netpgpverify

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 09:31:22 UTC 2016

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgpverify: libverify.c

Log Message:
Fix the error handling so that we print the earliest error message.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.11 src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.12
--- src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c:1.11	Sun Aug 28 11:52:22 2016
+++ src/crypto/external/bsd/netpgp/dist/src/netpgpverify/libverify.c	Sat Sep  3 05:31:22 2016
@@ -2085,8 +2085,10 @@ setup_data(pgpv_cursor_t *cursor, pgpv_t
 {
 	FILE		*fp;
 	char		 buf[BUFSIZ];
+	int		 rv;
 
 	if (cursor == NULL || pgp == NULL || p == NULL) {
+		snprintf(cursor->why, sizeof(cursor->why), "No input data");
 		return 0;
 	}
 	memset(cursor, 0x0, sizeof(*cursor));
@@ -2104,19 +2106,19 @@ setup_data(pgpv_cursor_t *cursor, pgpv_t
 			return 0;
 		}
 		if (is_armored(buf, sizeof(buf))) {
-			read_ascii_armor_file(cursor, p);
+			rv = read_ascii_armor_file(cursor, p);
 		} else {
-			read_binary_file(pgp, "signature", "%s", (const char *)p);
+			rv = read_binary_file(pgp, "signature", "%s", (const char *)p);
 		}
 		fclose(fp);
 	} else {
 		if (is_armored(p, (size_t)size)) {
-			read_ascii_armor_memory(cursor, p, (size_t)size);
+			rv = read_ascii_armor_memory(cursor, p, (size_t)size);
 		} else {
-			read_binary_memory(pgp, "signature", p, (size_t)size);
+			rv = read_binary_memory(pgp, "signature", p, (size_t)size);
 		}
 	}
-	return 1;
+	return rv;
 }
 
 /* get the data and size from litdata packet */
@@ -2780,7 +2782,6 @@ pgpv_verify(pgpv_cursor_t *cursor, pgpv_
 		return 0;
 	}
 	if (!setup_data(cursor, pgp, p, size)) {
-		snprintf(cursor->why, sizeof(cursor->why), "No input data");
 		return 0;
 	}
 	if (ARRAY_COUNT(cursor->pgp->pkts) == ARRAY_LAST(cursor->pgp->datastarts) + 1) {



CVS commit: src/share/mk

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 09:08:29 UTC 2016

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
gcc-5.3 for sh3


To generate a diff of this commit:
cvs rdiff -u -r1.949 -r1.950 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.949 src/share/mk/bsd.own.mk:1.950
--- src/share/mk/bsd.own.mk:1.949	Wed Aug 31 13:31:22 2016
+++ src/share/mk/bsd.own.mk	Sat Sep  3 05:08:28 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.949 2016/08/31 17:31:22 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.950 2016/09/03 09:08:28 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -76,6 +76,7 @@ HAVE_GCC?=	0
 ${MACHINE} == "sparc" || \
 ${MACHINE} == "sparc64" || \
 ${MACHINE_CPU} == "arm" || \
+${MACHINE_CPU} == "sh3" || \
 ${MACHINE_CPU} == "powerpc" || \
 ${MACHINE_ARCH} == "vax"
 HAVE_GCC?=	53



CVS commit: src/sys/arch/sh3

2016-09-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep  3 09:07:54 UTC 2016

Modified Files:
src/sys/arch/sh3/include: pmap.h vmparam.h
src/sys/arch/sh3/sh3: pmap.c

Log Message:
Fix pmap_prefer for topdown and turn topdown on.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sh3/include/pmap.h
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sh3/include/vmparam.h
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/sh3/sh3/pmap.c

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

Modified files:

Index: src/sys/arch/sh3/include/pmap.h
diff -u src/sys/arch/sh3/include/pmap.h:1.35 src/sys/arch/sh3/include/pmap.h:1.36
--- src/sys/arch/sh3/include/pmap.h:1.35	Sun Nov 14 08:33:22 2010
+++ src/sys/arch/sh3/include/pmap.h	Sat Sep  3 05:07:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.35 2010/11/14 13:33:22 uebayasi Exp $	*/
+/*	$NetBSD: pmap.h,v 1.36 2016/09/03 09:07:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -72,8 +72,8 @@ pmap_remove_all(struct pmap *pmap)
  * which have the virtually-indexed cache.
  */
 #ifdef SH4
-#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va))
-void pmap_prefer(vaddr_t, vaddr_t *);
+#define PMAP_PREFER(pa, va, sz, td) pmap_prefer((pa), (va), (td))
+void pmap_prefer(vaddr_t, vaddr_t *, int);
 #endif /* SH4 */
 
 #define	PMAP_MAP_POOLPAGE(pa)		SH3_PHYS_TO_P1SEG((pa))

Index: src/sys/arch/sh3/include/vmparam.h
diff -u src/sys/arch/sh3/include/vmparam.h:1.21 src/sys/arch/sh3/include/vmparam.h:1.22
--- src/sys/arch/sh3/include/vmparam.h:1.21	Sun Nov 14 08:33:22 2010
+++ src/sys/arch/sh3/include/vmparam.h	Sat Sep  3 05:07:53 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.21 2010/11/14 13:33:22 uebayasi Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.22 2016/09/03 09:07:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -31,8 +31,11 @@
 
 #ifndef _SH3_VMPARAM_H_
 #define	_SH3_VMPARAM_H_
+
 #include 
 
+#define __USE_TOPDOWN_VM
+
 /*
  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
  * to be compile-time constants.
@@ -51,7 +54,7 @@
 /* top of stack */
 #define	USRSTACK		VM_MAXUSER_ADDRESS
 
-/* Virtual memory resoruce limit. */
+/* Virtual memory resource limit. */
 #define	MAXTSIZ			(64 * 1024 * 1024)	/* max text size */
 #ifndef MAXDSIZ
 #define	MAXDSIZ			(512 * 1024 * 1024)	/* max data size */

Index: src/sys/arch/sh3/sh3/pmap.c
diff -u src/sys/arch/sh3/sh3/pmap.c:1.77 src/sys/arch/sh3/sh3/pmap.c:1.78
--- src/sys/arch/sh3/sh3/pmap.c:1.77	Fri Nov 12 02:59:27 2010
+++ src/sys/arch/sh3/sh3/pmap.c	Sat Sep  3 05:07:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.77 2010/11/12 07:59:27 uebayasi Exp $	*/
+/*	$NetBSD: pmap.c,v 1.78 2016/09/03 09:07:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2010/11/12 07:59:27 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2016/09/03 09:07:54 christos Exp $");
 
 #include 
 #include 
@@ -904,15 +904,21 @@ pmap_phys_address(paddr_t cookie)
  * a virtual cache alias against vaddr_t foff.
  */
 void
-pmap_prefer(vaddr_t foff, vaddr_t *vap)
+pmap_prefer(vaddr_t foff, vaddr_t *vap, int td)
 {
-	vaddr_t va;
+	if (!SH_HAS_VIRTUAL_ALIAS) 
+		return;
 
-	if (SH_HAS_VIRTUAL_ALIAS) {
-		va = *vap;
+	vaddr_t va = *vap;
+	vsize_t d = (foff - va) & sh_cache_prefer_mask;
 
-		*vap = va + ((foff - va) & sh_cache_prefer_mask);
-	}
+	if (d == 0)
+		return;
+
+	if (td)
+		*vap = va - ((-d) & sh_cache_prefer_mask);
+	else
+		*vap = va + d;
 }
 #endif /* SH4 */
 



CVS commit: src/regress/sys/arch/i386/ldt

2016-09-03 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Sep  3 08:47:38 UTC 2016

Modified Files:
src/regress/sys/arch/i386/ldt: testldt.c

Log Message:
Fix the mmap call, KNF, and make the output more readable.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/regress/sys/arch/i386/ldt/testldt.c

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

Modified files:

Index: src/regress/sys/arch/i386/ldt/testldt.c
diff -u src/regress/sys/arch/i386/ldt/testldt.c:1.15 src/regress/sys/arch/i386/ldt/testldt.c:1.16
--- src/regress/sys/arch/i386/ldt/testldt.c:1.15	Fri Mar 18 03:06:21 2011
+++ src/regress/sys/arch/i386/ldt/testldt.c	Sat Sep  3 08:47:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: testldt.c,v 1.15 2011/03/18 03:06:21 joerg Exp $	*/
+/*	$NetBSD: testldt.c,v 1.16 2016/09/03 08:47:38 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1993 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ check_desc(int desc)
 {
 	unsigned int sel = LSEL(desc, SEL_UPL);
 	set_fs(sel);
-	return(get_fs_byte((char *) 0));
+	return get_fs_byte((char *)0);
 }
 
 static void
@@ -89,14 +89,14 @@ make_sd(void *basep, unsigned limit, int
 	d.sd.sd_lobase  = base & 0x00ff;
 	d.sd.sd_type= type & 0x01f;
 	d.sd.sd_dpl = dpl & 0x3;
-	d.sd.sd_p	 = 1;
+	d.sd.sd_p   = 1;
 	d.sd.sd_hilimit = (limit & 0x00ff) >> 16;
-	d.sd.sd_xx	 = 0;
+	d.sd.sd_xx  = 0;
 	d.sd.sd_def32   = seg32?1:0;
 	d.sd.sd_gran= inpgs?1:0;
 	d.sd.sd_hibase  = (base & 0xff00) >> 24;
 
-	return (&d);
+	return &d;
 }
 
 static union descriptor *
@@ -110,10 +110,10 @@ make_gd(void *func, unsigned int sel, un
 	d.gd.gd_stkcpy   = stkcpy & 0x1ff;
 	d.gd.gd_type = type & 0x1ff;
 	d.gd.gd_dpl  = dpl & 0x3;
-	d.gd.gd_p	  = 1;
+	d.gd.gd_p= 1;
 	d.gd.gd_hioffset = (offset & 0x) >> 16;
 
-	return(&d);
+	return &d;
 }
 
 static const char *
@@ -133,10 +133,9 @@ segtype(unsigned int type)
 {
 	if (type >= 32)
 		return "Out of range";
-	
+
 	return seg_type_name[type];
 }
-	
 
 static void
 print_ldt(union descriptor *dp)
@@ -145,8 +144,8 @@ print_ldt(union descriptor *dp)
 	unsigned int type, dpl;
 	unsigned long lp[2];
 
-	(void) memcpy(lp, dp, sizeof(lp));
-
+	memcpy(lp, dp, sizeof(lp));
+
 	base_addr = dp->sd.sd_lobase | (dp->sd.sd_hibase << 24);
 	limit = dp->sd.sd_lolimit | (dp->sd.sd_hilimit << 16);
 	offset = dp->gd.gd_looffset | (dp->gd.gd_hioffset << 16);
@@ -157,13 +156,11 @@ print_ldt(union descriptor *dp)
 
 	if (type == SDT_SYS386CGT || type == SDT_SYS286CGT)
 		printf("LDT: Gate Off %8.8lx, Sel   %5.5x, Stkcpy %lu DPL %d,"
-		" Type %d/%s\n",
-		offset, dp->gd.gd_selector, stack_copy, dpl,
+		" Type %d/%s\n", offset, dp->gd.gd_selector, stack_copy, dpl,
 		type, segtype(type));
 	else
 		printf("LDT: Seg Base %8.8lx, Limit %5.5lx, DPL %d, "
-		"Type %d/%s\n",
-		base_addr, limit, dpl,
+		"Type %d/%s\n", base_addr, limit, dpl,
 		type, segtype(type));
 	printf("	  ");
 	if (type & 0x1)
@@ -188,7 +185,6 @@ print_ldt(union descriptor *dp)
 	printf("	  Raw descriptor: %08lx %08lx\n", lp[0], lp[1]);
 }
 
-/* ARGSUSED */
 static void
 busfault(int signo)
 {
@@ -196,12 +192,13 @@ busfault(int signo)
 }
 
 static void
-usage(int status)
+usage(void)
 {
-	errx(status, "Usage: testldt [-v]");
+	errx(1, "Usage: testldt [-v]");
 }
 
 #define MAX_USER_LDT 1024
+#define DATA_ADDR ((void *)0x005f)
 
 int
 main(int argc, char *argv[])
@@ -226,21 +223,20 @@ main(int argc, char *argv[])
 			verbose++;
 			break;
 		default:
-			usage(1);
+			usage();
 			break;
 		}
 	}
 
-	printf("Testing i386_get_ldt...\n");
+	printf("Testing i386_get_ldt\n");
 	if ((num = i386_get_ldt(0, ldt, MAX_USER_LDT)) < 0)
 		err(2, "get_ldt");
-
 	if (num == 0)
 		errx(1, "i386_get_ldt() returned empty initial LDT");
 
 	if (verbose) {
 		printf("Got %d (initial) LDT entries\n", num);
-		for (n=0; n < num; n++) {
+		for (n = 0; n < num; n++) {
 			printf("Entry %d: ", n);
 			print_ldt(&ldt[n]);
 		}
@@ -249,24 +245,20 @@ main(int argc, char *argv[])
 	/*
 	 * mmap a data area and assign an LDT to it
 	 */
-	printf("Testing i386_set_ldt...\n");
-	data = (void *) mmap( (char *)0x005f, 0x0fff,
-	PROT_EXEC | PROT_READ | PROT_WRITE,
+	printf("Testing i386_set_ldt\n");
+	data = (void *)mmap(DATA_ADDR, 4096, PROT_READ | PROT_WRITE,
 	MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, (off_t)0);
-	if (data == NULL)
+	if (data != DATA_ADDR)
 		err(1, "mmap");
 
-	if (verbose)
-		printf("data address: %p\n", data);
-
 	*data = 0x97;
 
 	/* Get the next free LDT and set it to the allocated data. */
 	sd = make_sd(data, 2048, SDT_MEMRW, SEL_UPL, 0, 0);
 	if ((num = i386_set_ldt(1024, sd, 1)) < 0)
 		err(1, "set_ldt");
-
-	if (verbose) printf("setldt returned: %d\n", num);
+	if (verbose)
+		printf("setldt returned: %d\n", num);
 	if ((n = i386_get_ldt(num, ldt, 1)) < 0)
 		err(1, "get_ldt");
 
@@ -281,13 +273,13 @@ main(int argc, char *argv[])
 	if (

CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 07:29:16 UTC 2016

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Style.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.214 src/sys/dev/usb/usb_subr.c:1.215
--- src/sys/dev/usb/usb_subr.c:1.214	Sat Sep  3 07:23:27 2016
+++ src/sys/dev/usb/usb_subr.c	Sat Sep  3 07:29:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.214 2016/09/03 07:23:27 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.215 2016/09/03 07:29:16 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.214 2016/09/03 07:23:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.215 2016/09/03 07:29:16 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1545,10 +1545,8 @@ usbd_fill_deviceinfo(struct usbd_device 
 		return;
 	}
 
-	for (i = 0;
-	 i < __arraycount(di->udi_ports) &&
-		 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
-	 i++) {
+	const int nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+	for (i = 0; i < __arraycount(di->udi_ports) && i < nports; i++) {
 		p = &dev->ud_hub->uh_ports[i];
 		if (p->up_dev)
 			err = p->up_dev->ud_addr;
@@ -1573,7 +1571,7 @@ usbd_fill_deviceinfo(struct usbd_device 
 		}
 		di->udi_ports[i] = err;
 	}
-	di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+	di->udi_nports = nports;
 }
 
 #ifdef COMPAT_30
@@ -1621,9 +1619,9 @@ usbd_fill_deviceinfo_old(struct usbd_dev
 		di->udi_nports = 0;
 		return;
 	}
-	for (i = 0;
-	 i < __arraycount(di->udi_ports) &&
-		 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
+
+	const int nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+	for (i = 0; i < __arraycount(di->udi_ports) && i < nports;
 	 i++) {
 		p = &dev->ud_hub->uh_ports[i];
 		if (p->up_dev)
@@ -1641,7 +1639,7 @@ usbd_fill_deviceinfo_old(struct usbd_dev
 		}
 		di->udi_ports[i] = err;
 	}
-	di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+	di->udi_nports = nports;
 }
 #endif
 



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 07:23:27 UTC 2016

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Reduce scope of a variable.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.213 src/sys/dev/usb/usb_subr.c:1.214
--- src/sys/dev/usb/usb_subr.c:1.213	Sat Sep  3 07:20:12 2016
+++ src/sys/dev/usb/usb_subr.c	Sat Sep  3 07:23:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.213 2016/09/03 07:20:12 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.214 2016/09/03 07:23:27 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.213 2016/09/03 07:20:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.214 2016/09/03 07:23:27 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1489,7 +1489,7 @@ usbd_fill_deviceinfo(struct usbd_device 
 		 int usedev)
 {
 	struct usbd_port *p;
-	int i, j, err, s;
+	int i, j, err;
 
 	di->udi_bus = device_unit(dev->ud_bus->ub_usbctl);
 	di->udi_addr = dev->ud_addr;
@@ -1553,7 +1553,7 @@ usbd_fill_deviceinfo(struct usbd_device 
 		if (p->up_dev)
 			err = p->up_dev->ud_addr;
 		else {
-			s = UGETW(p->up_status.wPortStatus);
+			int s = UGETW(p->up_status.wPortStatus);
 			if (s & UPS_PORT_ENABLED)
 err = USB_PORT_ENABLED;
 			else if (s & UPS_SUSPEND)
@@ -1582,7 +1582,7 @@ usbd_fill_deviceinfo_old(struct usbd_dev
  int usedev)
 {
 	struct usbd_port *p;
-	int i, j, err, s;
+	int i, j, err;
 
 	di->udi_bus = device_unit(dev->ud_bus->ub_usbctl);
 	di->udi_addr = dev->ud_addr;
@@ -1629,7 +1629,7 @@ usbd_fill_deviceinfo_old(struct usbd_dev
 		if (p->up_dev)
 			err = p->up_dev->ud_addr;
 		else {
-			s = UGETW(p->up_status.wPortStatus);
+			int s = UGETW(p->up_status.wPortStatus);
 			if (s & UPS_PORT_ENABLED)
 err = USB_PORT_ENABLED;
 			else if (s & UPS_SUSPEND)



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 07:20:12 UTC 2016

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Bail out early from usbd_fill_devinfo if we're not a hub to use less
indentation in the code.

No functional change.  Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.212 src/sys/dev/usb/usb_subr.c:1.213
--- src/sys/dev/usb/usb_subr.c:1.212	Sat Sep  3 07:14:19 2016
+++ src/sys/dev/usb/usb_subr.c	Sat Sep  3 07:20:12 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.212 2016/09/03 07:14:19 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.213 2016/09/03 07:20:12 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.212 2016/09/03 07:14:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.213 2016/09/03 07:20:12 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1540,38 +1540,40 @@ usbd_fill_deviceinfo(struct usbd_device 
 	for (/* j is set */; j < USB_MAX_DEVNAMES; j++)
 		di->udi_devnames[j][0] = 0; /* empty */
 
-	if (dev->ud_hub) {
-		for (i = 0;
-		 i < __arraycount(di->udi_ports) &&
-			 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
-		 i++) {
-			p = &dev->ud_hub->uh_ports[i];
-			if (p->up_dev)
-err = p->up_dev->ud_addr;
-			else {
-s = UGETW(p->up_status.wPortStatus);
-if (s & UPS_PORT_ENABLED)
-	err = USB_PORT_ENABLED;
-else if (s & UPS_SUSPEND)
-	err = USB_PORT_SUSPENDED;
-/*
- * Note: UPS_PORT_POWER_SS is available only
- * on 3.x, and UPS_PORT_POWER is available
- * only on 2.0 or 1.1.
- */
-else if (USB_IS_SS(dev->ud_speed) &&
-(s & UPS_PORT_POWER_SS))
-	err = USB_PORT_POWERED;
-else if (s & UPS_PORT_POWER)
-	err = USB_PORT_POWERED;
-else
-	err = USB_PORT_DISABLED;
-			}
-			di->udi_ports[i] = err;
-		}
-		di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
-	} else
+	if (!dev->ud_hub) {
 		di->udi_nports = 0;
+		return;
+	}
+
+	for (i = 0;
+	 i < __arraycount(di->udi_ports) &&
+		 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
+	 i++) {
+		p = &dev->ud_hub->uh_ports[i];
+		if (p->up_dev)
+			err = p->up_dev->ud_addr;
+		else {
+			s = UGETW(p->up_status.wPortStatus);
+			if (s & UPS_PORT_ENABLED)
+err = USB_PORT_ENABLED;
+			else if (s & UPS_SUSPEND)
+err = USB_PORT_SUSPENDED;
+			/*
+			 * Note: UPS_PORT_POWER_SS is available only
+			 * on 3.x, and UPS_PORT_POWER is available
+			 * only on 2.0 or 1.1.
+			 */
+			else if (USB_IS_SS(dev->ud_speed) &&
+			(s & UPS_PORT_POWER_SS))
+err = USB_PORT_POWERED;
+			else if (s & UPS_PORT_POWER)
+err = USB_PORT_POWERED;
+			else
+err = USB_PORT_DISABLED;
+		}
+		di->udi_ports[i] = err;
+	}
+	di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
 }
 
 #ifdef COMPAT_30
@@ -1615,30 +1617,31 @@ usbd_fill_deviceinfo_old(struct usbd_dev
 	for (/* j is set */; j < USB_MAX_DEVNAMES; j++)
 		di->udi_devnames[j][0] = 0;		 /* empty */
 
-	if (dev->ud_hub) {
-		for (i = 0;
-		 i < __arraycount(di->udi_ports) &&
-			 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
-		 i++) {
-			p = &dev->ud_hub->uh_ports[i];
-			if (p->up_dev)
-err = p->up_dev->ud_addr;
-			else {
-s = UGETW(p->up_status.wPortStatus);
-if (s & UPS_PORT_ENABLED)
-	err = USB_PORT_ENABLED;
-else if (s & UPS_SUSPEND)
-	err = USB_PORT_SUSPENDED;
-else if (s & UPS_PORT_POWER)
-	err = USB_PORT_POWERED;
-else
-	err = USB_PORT_DISABLED;
-			}
-			di->udi_ports[i] = err;
-		}
-		di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
-	} else
+	if (!dev->ud_hub) {
 		di->udi_nports = 0;
+		return;
+	}
+	for (i = 0;
+	 i < __arraycount(di->udi_ports) &&
+		 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
+	 i++) {
+		p = &dev->ud_hub->uh_ports[i];
+		if (p->up_dev)
+			err = p->up_dev->ud_addr;
+		else {
+			s = UGETW(p->up_status.wPortStatus);
+			if (s & UPS_PORT_ENABLED)
+err = USB_PORT_ENABLED;
+			else if (s & UPS_SUSPEND)
+err = USB_PORT_SUSPENDED;
+			else if (s & UPS_PORT_POWER)
+err = USB_PORT_POWERED;
+			else
+err = USB_PORT_DISABLED;
+		}
+		di->udi_ports[i] = err;
+	}
+	di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
 }
 #endif
 



CVS commit: src/sys/dev/usb

2016-09-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep  3 07:14:19 UTC 2016

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Use __arraycount.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.211 src/sys/dev/usb/usb_subr.c:1.212
--- src/sys/dev/usb/usb_subr.c:1.211	Mon May  2 11:55:21 2016
+++ src/sys/dev/usb/usb_subr.c	Sat Sep  3 07:14:19 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.211 2016/05/02 11:55:21 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.212 2016/09/03 07:14:19 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.211 2016/05/02 11:55:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.212 2016/09/03 07:14:19 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1542,7 +1542,7 @@ usbd_fill_deviceinfo(struct usbd_device 
 
 	if (dev->ud_hub) {
 		for (i = 0;
-		 i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) &&
+		 i < __arraycount(di->udi_ports) &&
 			 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
 		 i++) {
 			p = &dev->ud_hub->uh_ports[i];
@@ -1617,7 +1617,7 @@ usbd_fill_deviceinfo_old(struct usbd_dev
 
 	if (dev->ud_hub) {
 		for (i = 0;
-		 i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) &&
+		 i < __arraycount(di->udi_ports) &&
 			 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
 		 i++) {
 			p = &dev->ud_hub->uh_ports[i];