CVS commit: src/sys/dev

2016-09-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Sep 14 23:16:30 UTC 2016

Modified Files:
src/sys/dev: cgd.c

Log Message:
Fix error handling in cgdstrategy().

- check cgd_softc != NULL, may happen in rare memory shortage situations.
- no longer test geometry, the same check is done in dk_strategy which
  knows to check for an uninitialized geometry.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.110 src/sys/dev/cgd.c:1.111
--- src/sys/dev/cgd.c:1.110	Fri Aug  5 08:24:46 2016
+++ src/sys/dev/cgd.c	Wed Sep 14 23:16:30 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.110 2016/08/05 08:24:46 pgoyette Exp $ */
+/* $NetBSD: cgd.c,v 1.111 2016/09/14 23:16:30 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.110 2016/08/05 08:24:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.111 2016/09/14 23:16:30 mlelstv Exp $");
 
 #include 
 #include 
@@ -305,30 +305,32 @@ cgdclose(dev_t dev, int flags, int fmt, 
 static void
 cgdstrategy(struct buf *bp)
 {
-	struct	cgd_softc *cs = getcgd_softc(bp->b_dev);
-	struct	dk_softc *dksc = >sc_dksc;
-	struct	disk_geom *dg = >sc_dkdev.dk_geom;
+	struct	cgd_softc *cs;
 
 	DPRINTF_FOLLOW(("cgdstrategy(%p): b_bcount = %ld\n", bp,
 	(long)bp->b_bcount));
 
+	cs = getcgd_softc(bp->b_dev);
+	if (!cs) {
+		bp->b_error = ENXIO;
+		goto bail;
+	}
+
 	/*
-	 * Reject unaligned writes.  We can encrypt and decrypt only
-	 * complete disk sectors, and we let the ciphers require their
-	 * buffers to be aligned to 32-bit boundaries.
+	 * Reject unaligned writes.
 	 */
-	if (bp->b_blkno < 0 ||
-	(bp->b_bcount % dg->dg_secsize) != 0 ||
-	((uintptr_t)bp->b_data & 3) != 0) {
+	if (((uintptr_t)bp->b_data & 3) != 0) {
 		bp->b_error = EINVAL;
-		bp->b_resid = bp->b_bcount;
-		biodone(bp);
-		return;
+		goto bail;
 	}
 
-	/* XXXrcd: Should we test for (cs != NULL)? */
 	dk_strategy(>sc_dksc, bp);
 	return;
+
+bail:
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
+	return;
 }
 
 static int



CVS commit: src/sys/dev

2016-09-14 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Sep 14 23:05:05 UTC 2016

Modified Files:
src/sys/dev: dksubr.c

Log Message:
Set b_resid in error path.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/dksubr.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/dksubr.c
diff -u src/sys/dev/dksubr.c:1.88 src/sys/dev/dksubr.c:1.89
--- src/sys/dev/dksubr.c:1.88	Mon Jun 27 18:27:51 2016
+++ src/sys/dev/dksubr.c	Wed Sep 14 23:05:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.88 2016/06/27 18:27:51 christos Exp $ */
+/* $NetBSD: dksubr.c,v 1.89 2016/09/14 23:05:05 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.88 2016/06/27 18:27:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.89 2016/09/14 23:05:05 mlelstv Exp $");
 
 #include 
 #include 
@@ -286,7 +286,8 @@ dk_strategy1(struct dk_softc *dksc, stru
 
 	if (!(dksc->sc_flags & DKF_INITED)) {
 		DPRINTF_FOLLOW(("%s: not inited\n", __func__));
-		bp->b_error  = ENXIO;
+		bp->b_error = ENXIO;
+		bp->b_resid = bp->b_bcount;
 		biodone(bp);
 		return 1;
 	}



CVS commit: src/distrib/sets/lists/man

2016-09-14 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Sep 14 20:05:04 UTC 2016

Modified Files:
src/distrib/sets/lists/man: mi

Log Message:
Add platinumfb man page


To generate a diff of this commit:
cvs rdiff -u -r1.1533 -r1.1534 src/distrib/sets/lists/man/mi

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1533 src/distrib/sets/lists/man/mi:1.1534
--- src/distrib/sets/lists/man/mi:1.1533	Wed Aug 24 22:50:57 2016
+++ src/distrib/sets/lists/man/mi	Wed Sep 14 20:05:04 2016
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1533 2016/08/24 22:50:57 szptvlfn Exp $
+# $NetBSD: mi,v 1.1534 2016/09/14 20:05:04 scole Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1388,6 +1388,7 @@
 ./usr/share/man/cat4/macppc/mesh.0		man-sys-catman		.cat
 ./usr/share/man/cat4/macppc/obio.0		man-sys-catman		.cat
 ./usr/share/man/cat4/macppc/pbms.0		man-sys-catman		.cat
+./usr/share/man/cat4/macppc/platinumfb.0	man-sys-catman		.cat
 ./usr/share/man/cat4/macppc/snapper.0		man-sys-catman		.cat
 ./usr/share/man/cat4/mainbus.0			man-sys-catman		.cat
 ./usr/share/man/cat4/makphy.0			man-sys-catman		.cat
@@ -4435,6 +4436,7 @@
 ./usr/share/man/html4/macppc/mesh.html		man-sys-htmlman		html
 ./usr/share/man/html4/macppc/obio.html		man-sys-htmlman		html
 ./usr/share/man/html4/macppc/pbms.html		man-sys-htmlman		html
+./usr/share/man/html4/macppc/platinumfb.html	man-sys-htmlman		html
 ./usr/share/man/html4/macppc/snapper.html	man-sys-htmlman		html
 ./usr/share/man/html4/mainbus.html		man-sys-htmlman		html
 ./usr/share/man/html4/makphy.html		man-sys-htmlman		html
@@ -7332,6 +7334,7 @@
 ./usr/share/man/man4/macppc/mesh.4		man-sys-man		.man
 ./usr/share/man/man4/macppc/obio.4		man-sys-man		.man
 ./usr/share/man/man4/macppc/pbms.4		man-sys-man		.man
+./usr/share/man/man4/macppc/platinumfb.4	man-sys-man		.man
 ./usr/share/man/man4/macppc/snapper.4		man-sys-man		.man
 ./usr/share/man/man4/mainbus.4			man-sys-man		.man
 ./usr/share/man/man4/makphy.4			man-sys-man		.man



CVS commit: src/share/man/man4/man4.macppc

2016-09-14 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Wed Sep 14 20:04:22 UTC 2016

Modified Files:
src/share/man/man4/man4.macppc: Makefile
Added Files:
src/share/man/man4/man4.macppc: platinumfb.4

Log Message:
Add platinumfb man page


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/man4.macppc/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.macppc/platinumfb.4

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

Modified files:

Index: src/share/man/man4/man4.macppc/Makefile
diff -u src/share/man/man4/man4.macppc/Makefile:1.9 src/share/man/man4/man4.macppc/Makefile:1.10
--- src/share/man/man4/man4.macppc/Makefile:1.9	Tue Dec 12 19:25:54 2006
+++ src/share/man/man4/man4.macppc/Makefile	Wed Sep 14 20:04:22 2016
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.9 2006/12/12 19:25:54 wiz Exp $
+#	$NetBSD: Makefile,v 1.10 2016/09/14 20:04:22 scole Exp $
 
 MAN=		autoconf.4 awacs.4 bm.4 gm.4 intro.4 \
-		mesh.4 obio.4 pbms.4 snapper.4
+		mesh.4 obio.4 pbms.4 platinumfb.4 snapper.4
 
 MANSUBDIR=	/macppc
 

Added files:

Index: src/share/man/man4/man4.macppc/platinumfb.4
diff -u /dev/null src/share/man/man4/man4.macppc/platinumfb.4:1.1
--- /dev/null	Wed Sep 14 20:04:22 2016
+++ src/share/man/man4/man4.macppc/platinumfb.4	Wed Sep 14 20:04:22 2016
@@ -0,0 +1,63 @@
+.\" $NetBSD: platinumfb.4,v 1.1 2016/09/14 20:04:22 scole Exp $
+.\"
+.\" Copyright (c) 2016 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd September 14, 2016
+.Dt PLATINUMFB 4 macppc
+.Os
+.Sh NAME
+.Nm platinumfb
+.Nd Apple Platinum framebuffer driver
+.Sh SYNOPSIS
+.Cd "platinumfb0 at mainbus?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for Apple Platinum graphics devices found in a
+couple early model PowerMacs such as the 7200.
+.Pp
+This driver should support console output (with rastor ops) and X
+(in unaccelerated modes).
+.Pp
+It may be required to set the output-device to 'screen' in Open Firmware.
+.Sh SEE ALSO
+.Xr rasops 4 ,
+.Xr wsdisplay 4
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Nx 7.0 .
+.Sh AUTHORS
+The
+.Nm
+driver was written by Sean Cole.
+.Sh BUGS
+Early PowerMacs with the
+.Nm
+device may not work through Open Firmware.
+.Pp
+.Xr X 7
+is pretty slow.



CVS commit: src/tests/net/if

2016-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:18:31 UTC 2016

Modified Files:
src/tests/net/if: t_ifconfig.sh

Log Message:
Ignore case in deprecated/anycast


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/if/t_ifconfig.sh

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

Modified files:

Index: src/tests/net/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.11 src/tests/net/if/t_ifconfig.sh:1.12
--- src/tests/net/if/t_ifconfig.sh:1.11	Wed Aug 10 18:30:02 2016
+++ src/tests/net/if/t_ifconfig.sh	Wed Sep 14 12:18:31 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.11 2016/08/10 22:30:02 kre Exp $
+# $NetBSD: t_ifconfig.sh,v 1.12 2016/09/14 16:18:31 christos Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,6 +34,9 @@ RUMP_FLAGS="${RUMP_FLAGS} -lrumpdev"
 
 TIMEOUT=3
 
+anycast="[Aa][Nn][Yy][Cc][Aa][Ss][Tt]"
+deprecated="[Dd][Ee][Pp][Rr][Ee][Cc][Aa][Tt][Ee][Dd]"
+
 atf_test_case ifconfig_create_destroy cleanup
 ifconfig_create_destroy_head()
 {
@@ -290,22 +293,22 @@ ifconfig_parameters_body()
 
 	# anycast
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::2 anycast
-	atf_check -s exit:0 -o match:'fc00::2.+anycast' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o match:"fc00::2.+$anycast" rump.ifconfig shmif0 inet6
 
 	# deprecated
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 deprecated
 	# Not deprecated immediately. Need to wait nd6_timer that does it is scheduled.
 	interval=$(sysctl -n net.inet6.icmp6.nd6_prune)
 	atf_check -s exit:0 sleep $((interval + 1))
-	atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 -deprecated
-	atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6
 
 	# pltime
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00::3 pltime 3
-	atf_check -s exit:0 -o not-match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o not-match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6
 	atf_check -s exit:0 sleep 5
-	atf_check -s exit:0 -o match:'fc00::3.+deprecated' rump.ifconfig shmif0 inet6
+	atf_check -s exit:0 -o match:"fc00::3.+$deprecated" rump.ifconfig shmif0 inet6
 
 	# eui64
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 fc00:1::0 eui64



CVS commit: src/sys/netinet6

2016-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:17:17 UTC 2016

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

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/netinet6/in6_var.h

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

Modified files:

Index: src/sys/netinet6/in6_var.h
diff -u src/sys/netinet6/in6_var.h:1.86 src/sys/netinet6/in6_var.h:1.87
--- src/sys/netinet6/in6_var.h:1.86	Mon Sep 12 20:45:15 2016
+++ src/sys/netinet6/in6_var.h	Wed Sep 14 12:17:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_var.h,v 1.86 2016/09/13 00:45:15 christos Exp $	*/
+/*	$NetBSD: in6_var.h,v 1.87 2016/09/14 16:17:17 christos Exp $	*/
 /*	$KAME: in6_var.h,v 1.81 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -499,7 +499,7 @@ struct	in6_rrenumreq {
 #define IN6_IFF_TEMPORARY	0x80	/* temporary (anonymous) address. */
 
 #define IN6_IFFBITS \
-"\020\1ANYCAST\2TENTATIVE\3DUPLICATED\4DETACHED\5DEPRECAGTED\6NODAD" \
+"\020\1ANYCAST\2TENTATIVE\3DUPLICATED\4DETACHED\5DEPRECATED\6NODAD" \
 "\7AUTOCONF\10TEMPORARY"
 
 



CVS commit: src/tests/net/arp

2016-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:00:10 UTC 2016

Modified Files:
src/tests/net/arp: t_dad.sh

Log Message:
adjust for new ifconfig output.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/arp/t_dad.sh

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

Modified files:

Index: src/tests/net/arp/t_dad.sh
diff -u src/tests/net/arp/t_dad.sh:1.7 src/tests/net/arp/t_dad.sh:1.8
--- src/tests/net/arp/t_dad.sh:1.7	Wed Aug 10 18:05:07 2016
+++ src/tests/net/arp/t_dad.sh	Wed Sep 14 12:00:10 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.7 2016/08/10 22:05:07 kre Exp $
+#	$NetBSD: t_dad.sh,v 1.8 2016/09/14 16:00:10 christos Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -107,10 +107,10 @@ dad_basic_body()
 	$DEBUG && cat ./out
 
 	# The primary address doesn't start with tentative state
-	atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -q tentative"
+	atf_check -s not-exit:0 -x "cat ./out |grep 10.0.0.1 |grep -iq tentative"
 	# The alias address starts with tentative state
 	# XXX we have no stable way to check this, so skip for now
-	#atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -q tentative"
+	#atf_check -s exit:0 -x "cat ./out |grep 10.0.0.2 |grep -iq tentative"
 
 	atf_check -s exit:0 sleep 2
 	extract_new_packets > ./out
@@ -134,7 +134,7 @@ dad_basic_body()
 	pkt=$(make_pkt_str 10.0.0.2 10.0.0.2)
 	atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
 	# The alias address left tentative
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -q tentative"
+	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.2 |grep -iq tentative"
 
 	#
 	# Add a new address on the fly
@@ -143,7 +143,7 @@ dad_basic_body()
 
 	# The new address starts with tentative state
 	# XXX we have no stable way to check this, so skip for now
-	#atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative"
+	#atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative"
 
 	# Check DAD probe packets
 	atf_check -s exit:0 sleep 2
@@ -163,7 +163,7 @@ dad_basic_body()
 	pkt=$(make_pkt_str 10.0.0.3 10.0.0.3)
 	atf_check -s exit:0 -x "cat ./out |grep -q '$pkt'"
 	# The new address left tentative
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -q tentative"
+	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep 10.0.0.3 |grep -iq tentative"
 }
 
 dad_duplicated_body()
@@ -181,7 +181,7 @@ dad_duplicated_body()
 	export RUMP_SERVER=$SOCKLOCAL
 
 	# The primary address isn't marked as duplicated
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -q duplicated"
+	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip1 |grep -iq duplicated"
 
 	#
 	# Add a new address duplicated with the peer server
@@ -190,12 +190,12 @@ dad_duplicated_body()
 	atf_check -s exit:0 sleep 1
 
 	# The new address is marked as duplicated
-	atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -q duplicated"
+	atf_check -s exit:0 -x "rump.ifconfig shmif0 |grep $peerip |grep -iq duplicated"
 
 	# A unique address isn't marked as duplicated
 	atf_check -s exit:0 rump.ifconfig shmif0 inet $localip2 alias
 	atf_check -s exit:0 sleep 1
-	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -q duplicated"
+	atf_check -s not-exit:0 -x "rump.ifconfig shmif0 |grep $localip2 |grep -iq duplicated"
 }
 
 cleanup()



CVS commit: src/sys/net

2016-09-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 14 11:54:42 UTC 2016

Modified Files:
src/sys/net: if_spppsubr.c

Log Message:
Call ifmedia_delete_instance() for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/if_spppsubr.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/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.150 src/sys/net/if_spppsubr.c:1.151
--- src/sys/net/if_spppsubr.c:1.150	Wed Sep 14 10:58:38 2016
+++ src/sys/net/if_spppsubr.c	Wed Sep 14 11:54:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.150 2016/09/14 10:58:38 roy Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.151 2016/09/14 11:54:42 roy Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.150 2016/09/14 10:58:38 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.151 2016/09/14 11:54:42 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -967,6 +967,9 @@ sppp_detach(struct ifnet *ifp)
 	if (sp->myauth.secret) free(sp->myauth.secret, M_DEVBUF);
 	if (sp->hisauth.name) free(sp->hisauth.name, M_DEVBUF);
 	if (sp->hisauth.secret) free(sp->hisauth.secret, M_DEVBUF);
+
+	/* Safety - shouldn't be needed as there is no media to set. */
+	ifmedia_delete_instance(>pp_im, IFM_INST_ANY);
 }
 
 /*



CVS commit: src/sbin/ifconfig

2016-09-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 14 11:46:43 UTC 2016

Modified Files:
src/sbin/ifconfig: media.c

Log Message:
Don't bail if SIOGIFMEDIA doesn't return any media lists because we
can still report link status.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/ifconfig/media.c

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

Modified files:

Index: src/sbin/ifconfig/media.c
diff -u src/sbin/ifconfig/media.c:1.6 src/sbin/ifconfig/media.c:1.7
--- src/sbin/ifconfig/media.c:1.6	Mon Aug 29 14:35:00 2011
+++ src/sbin/ifconfig/media.c	Wed Sep 14 11:46:43 2016
@@ -1,6 +1,6 @@
 #include 
 #ifndef lint
-__RCSID("$NetBSD: media.c,v 1.6 2011/08/29 14:35:00 joerg Exp $");
+__RCSID("$NetBSD: media.c,v 1.7 2016/09/14 11:46:43 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -371,27 +371,27 @@ media_status(prop_dictionary_t env, prop
 		return;
 	}
 
-	if (ifmr.ifm_count == 0) {
-		warnx("%s: no media types?", ifname);
-		return;
-	}
-
-	media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
-	if (media_list == NULL)
-		err(EXIT_FAILURE, "malloc");
-	ifmr.ifm_ulist = media_list;
-
-	if (prog_ioctl(s, SIOCGIFMEDIA, ) == -1)
-		err(EXIT_FAILURE, "SIOCGIFMEDIA");
-
-	printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
-	print_media_word(ifmr.ifm_current, " ");
-	if (ifmr.ifm_active != ifmr.ifm_current) {
-		printf(" (");
-		print_media_word(ifmr.ifm_active, " ");
-		printf(")");
-	}
-	printf("\n");
+	/* Interface link status is queried through SIOCGIFMEDIA.
+	 * Not all interfaces have actual media. */
+	if (ifmr.ifm_count != 0) {
+		media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
+		if (media_list == NULL)
+			err(EXIT_FAILURE, "malloc");
+		ifmr.ifm_ulist = media_list;
+
+		if (prog_ioctl(s, SIOCGIFMEDIA, ) == -1)
+			err(EXIT_FAILURE, "SIOCGIFMEDIA");
+
+		printf("\tmedia: %s ", get_media_type_string(ifmr.ifm_current));
+		print_media_word(ifmr.ifm_current, " ");
+		if (ifmr.ifm_active != ifmr.ifm_current) {
+			printf(" (");
+			print_media_word(ifmr.ifm_active, " ");
+			printf(")");
+		}
+		printf("\n");
+	} else
+		media_list = NULL;
 
 	if (ifmr.ifm_status & IFM_STATUS_VALID) {
 		const struct ifmedia_status_description *ifms;



CVS commit: src/sys/net

2016-09-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 14 11:43:08 UTC 2016

Modified Files:
src/sys/net: if_media.h

Log Message:
Introduce IFM_GENERIC.
This allows use of the media interface, but without media as such.
It's sole purpose is to facilitate the reporting of the link status.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/net/if_media.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/net/if_media.h
diff -u src/sys/net/if_media.h:1.56 src/sys/net/if_media.h:1.57
--- src/sys/net/if_media.h:1.56	Thu Oct 25 10:59:43 2012
+++ src/sys/net/if_media.h	Wed Sep 14 11:43:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.56 2012/10/25 10:59:43 msaitoh Exp $	*/
+/*	$NetBSD: if_media.h,v 1.57 2016/09/14 11:43:08 roy Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -157,6 +157,11 @@ void		ifmedia_removeall(struct ifmedia *
  */
 
 /*
+ * Generic, only used for link status reporting.
+ */
+#define	IFM_GENERIC	0x
+
+/*
  * Ethernet
  */
 #define	IFM_ETHER	0x0020
@@ -614,6 +619,9 @@ struct ifmedia_status_description {
 	(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
 
 #define	IFM_STATUS_DESCRIPTIONS {	\
+	{ IFM_GENERIC,		IFM_AVALID,	IFM_ACTIVE,		\
+	  { "no network", "active" } },	\
+	\
 	{ IFM_ETHER,		IFM_AVALID,	IFM_ACTIVE,		\
 	  { "no carrier", "active" } },	\
 	\



CVS commit: src/sys/net

2016-09-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Sep 14 10:58:38 UTC 2016

Modified Files:
src/sys/net: if_spppsubr.c if_spppvar.h

Log Message:
Add interface media for sppp consumers.
While there is no actual media to select,
the ioctl is used to query link status from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net/if_spppvar.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/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.149 src/sys/net/if_spppsubr.c:1.150
--- src/sys/net/if_spppsubr.c:1.149	Tue Sep 13 19:51:12 2016
+++ src/sys/net/if_spppsubr.c	Wed Sep 14 10:58:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.149 2016/09/13 19:51:12 joerg Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.150 2016/09/14 10:58:38 roy Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.149 2016/09/13 19:51:12 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.150 2016/09/14 10:58:38 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -861,6 +861,31 @@ sppp_output(struct ifnet *ifp, struct mb
 	return error;
 }
 
+static int
+sppp_mediachange(struct ifnet *ifp)
+{
+
+	return (0);
+}
+
+static void
+sppp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
+{
+
+	switch (ifp->if_link_state) {
+	case LINK_STATE_UP:
+		imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
+		break;
+	case LINK_STATE_DOWN:
+		imr->ifm_status = IFM_AVALID;
+		break;
+	default:
+		/* Should be impossible as we set link state down in attach. */
+		imr->ifm_status = 0;
+		break;
+	}
+}
+
 void
 sppp_attach(struct ifnet *ifp)
 {
@@ -897,6 +922,11 @@ sppp_attach(struct ifnet *ifp)
 
 	if_alloc_sadl(ifp);
 
+	/* Lets not beat about the bush, we know we're down. */
+	ifp->if_link_state = LINK_STATE_DOWN;
+	/* There is no media for PPP, but it's needed to report link status. */
+	ifmedia_init(>pp_im, 0, sppp_mediachange, sppp_mediastatus);
+
 	memset(>myauth, 0, sizeof sp->myauth);
 	memset(>hisauth, 0, sizeof sp->hisauth);
 	sppp_lcp_init(sp);
@@ -1101,6 +1131,10 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 		error = sppp_params(sp, cmd, data);
 		break;
 
+	case SIOCGIFMEDIA:
+		error = ifmedia_ioctl(ifp, ifr, >pp_im, cmd);
+		break;
+
 	default:
 		error = ifioctl_common(ifp, cmd, data);
 		break;

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.16 src/sys/net/if_spppvar.h:1.17
--- src/sys/net/if_spppvar.h:1.16	Mon Oct  5 21:27:36 2009
+++ src/sys/net/if_spppvar.h	Wed Sep 14 10:58:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.16 2009/10/05 21:27:36 dyoung Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.17 2016/09/14 10:58:38 roy Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -26,6 +26,8 @@
  * From: Id: if_sppp.h,v 1.7 1998/12/01 20:20:19 hm Exp
  */
 
+#include 
+
 #define IDX_LCP 0		/* idx into state table */
 
 struct slcp {
@@ -79,6 +81,7 @@ struct sauth {
 struct sppp {
 	/* NB: pp_if _must_ be first */
 	struct  ifnet pp_if;/* network interface data */
+	struct	ifmedia pp_im;	/* interface media, to report link status */
 	struct  ifqueue pp_fastq; /* fast output queue */
 	struct	ifqueue pp_cpq;	/* PPP control protocol queue */
 	struct  sppp *pp_next;  /* next interface in keepalive list */



CVS commit: [netbsd-7-nhusb] src/sys/rump/dev/lib/libusb

2016-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 14 09:21:37 UTC 2016

Modified Files:
src/sys/rump/dev/lib/libusb [netbsd-7-nhusb]: Makefile

Log Message:
Update for branch


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.36.1 src/sys/rump/dev/lib/libusb/Makefile

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

Modified files:

Index: src/sys/rump/dev/lib/libusb/Makefile
diff -u src/sys/rump/dev/lib/libusb/Makefile:1.6 src/sys/rump/dev/lib/libusb/Makefile:1.6.36.1
--- src/sys/rump/dev/lib/libusb/Makefile:1.6	Mon Jan 31 00:10:06 2011
+++ src/sys/rump/dev/lib/libusb/Makefile	Wed Sep 14 09:21:37 2016
@@ -1,23 +1,22 @@
-#	$NetBSD: Makefile,v 1.6 2011/01/31 00:10:06 christos Exp $
+#	$NetBSD: Makefile,v 1.6.36.1 2016/09/14 09:21:37 skrll Exp $
 #
 
 .PATH:	${.CURDIR}/../../../../dev/usb
 
 LIB=	rumpdev_usb
+COMMENT=USB support
 
 .if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
 IOCONF= USB.ioconf
+RUMP_COMPONENT=ioconf
 
 SRCS=	usb.c usbdi.c usbdi_util.c usb_mem.c usb_subr.c usb_quirks.c	\
-	uhub.c usbroothub_subr.c usb_verbose.c
-SRCS+=	usb_at_ugenhc.c
+	uhub.c usbroothub.c usb_verbose.c
 .else
 SRCS=	dummy.c
 .endif
 
 #CPPFLAGS+= -DUHUB_DEBUG
 
-CPPFLAGS+=	-I${.CURDIR}/opt
-
 .include 
 .include 



CVS commit: [netbsd-7-nhusb] src/sys/dev/pci

2016-09-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 14 08:19:24 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7-nhusb]: ehci_pci.c ohci_pci.c uhci_pci.c

Log Message:
Use IPL_USB for interrupt handler


To generate a diff of this commit:
cvs rdiff -u -r1.58.8.1 -r1.58.8.2 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.52.8.1 -r1.52.8.2 src/sys/dev/pci/ohci_pci.c
cvs rdiff -u -r1.57.8.1 -r1.57.8.2 src/sys/dev/pci/uhci_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/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.58.8.1 src/sys/dev/pci/ehci_pci.c:1.58.8.2
--- src/sys/dev/pci/ehci_pci.c:1.58.8.1	Tue Sep  6 20:33:08 2016
+++ src/sys/dev/pci/ehci_pci.c	Wed Sep 14 08:19:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.58.8.1 2016/09/06 20:33:08 skrll Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.58.8.2 2016/09/14 08:19:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.58.8.1 2016/09/06 20:33:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.58.8.2 2016/09/14 08:19:23 skrll Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ ehci_pci_attach(device_t parent, device_
 	 * Allocate IRQ
 	 */
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-	sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, ehci_intr, sc);
+	sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, ehci_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)

Index: src/sys/dev/pci/ohci_pci.c
diff -u src/sys/dev/pci/ohci_pci.c:1.52.8.1 src/sys/dev/pci/ohci_pci.c:1.52.8.2
--- src/sys/dev/pci/ohci_pci.c:1.52.8.1	Tue Sep  6 20:33:08 2016
+++ src/sys/dev/pci/ohci_pci.c	Wed Sep 14 08:19:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci_pci.c,v 1.52.8.1 2016/09/06 20:33:08 skrll Exp $	*/
+/*	$NetBSD: ohci_pci.c,v 1.52.8.2 2016/09/14 08:19:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.52.8.1 2016/09/06 20:33:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.52.8.2 2016/09/14 08:19:23 skrll Exp $");
 
 #include "ehci.h"
 
@@ -143,7 +143,7 @@ ohci_pci_attach(device_t parent, device_
 	 * Allocate IRQ
 	 */
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-	sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, ohci_intr, sc);
+	sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, ohci_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)

Index: src/sys/dev/pci/uhci_pci.c
diff -u src/sys/dev/pci/uhci_pci.c:1.57.8.1 src/sys/dev/pci/uhci_pci.c:1.57.8.2
--- src/sys/dev/pci/uhci_pci.c:1.57.8.1	Tue Sep  6 20:33:08 2016
+++ src/sys/dev/pci/uhci_pci.c	Wed Sep 14 08:19:23 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci_pci.c,v 1.57.8.1 2016/09/06 20:33:08 skrll Exp $	*/
+/*	$NetBSD: uhci_pci.c,v 1.57.8.2 2016/09/14 08:19:23 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.57.8.1 2016/09/06 20:33:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.57.8.2 2016/09/14 08:19:23 skrll Exp $");
 
 #include "ehci.h"
 
@@ -133,7 +133,7 @@ uhci_pci_attach(device_t parent, device_
 		return;
 	}
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-	sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, uhci_intr, sc);
+	sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, uhci_intr, sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)