CVS commit: [netbsd-7] src/doc

2015-05-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May 16 04:40:31 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
tickets 761, 773, 779.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.298 -r1.1.2.299 src/doc/CHANGES-7.0

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-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.298 src/doc/CHANGES-7.0:1.1.2.299
--- src/doc/CHANGES-7.0:1.1.2.298	Fri May 15 04:16:23 2015
+++ src/doc/CHANGES-7.0	Sat May 16 04:40:31 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.298 2015/05/15 04:16:23 snj Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.299 2015/05/16 04:40:31 snj Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -23196,3 +23196,29 @@ sys/external/bsd/dwc2/dwc2.c			1.32
 	Fix various clang warnings.
 	[joerg, ticket #772]
 
+usr.sbin/postinstall/postinstall		1.184, 1.187
+
+	Handle removing obsolete modules from /stand for directories
+	other than the main ones for an architechure.
+	[jnemeth, ticket #773]
+
+sys/arch/sgimips/dev/scn.c			1.8
+sys/arch/sgimips/mace/macekbc.c			1.8
+sys/dev/hpc/hpcfb.c1.59
+sys/dev/i2c/i2c.c1.47
+sys/dev/ic/mfi.c1.57
+sys/dev/if_ndis/if_ndis_pci.c			1.21
+sys/dev/sysmon/sysmon_power.c			1.50-1.52
+sys/dev/usb/umass_isdata.c			1.31
+
+	Fix 8 memory leaks and 1 double free.
+	[maxv, ticket #761]
+
+etc/rc.d/modules1.2
+
+	Parse /etc/modules.conf like ifconfig.if(5).  First word is
+	always the module name, followed by options.
+	Load modules right after root filesystem is checked and before
+	it becomes writable.
+	[mlelstv, ticket #779]
+



CVS commit: [netbsd-7] src/etc/rc.d

2015-05-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May 16 04:37:04 UTC 2015

Modified Files:
src/etc/rc.d [netbsd-7]: modules

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #779):
etc/rc.d/modules: revision 1.2
Parse config file like ifconfig.if(5).
First word is always the module name, followed by options.
Load modules right after root filesystem is checked and before it
becomes writable.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/etc/rc.d/modules

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

Modified files:

Index: src/etc/rc.d/modules
diff -u src/etc/rc.d/modules:1.1.2.2 src/etc/rc.d/modules:1.1.2.3
--- src/etc/rc.d/modules:1.1.2.2	Thu Mar 26 10:54:35 2015
+++ src/etc/rc.d/modules	Sat May 16 04:37:04 2015
@@ -1,10 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: modules,v 1.1.2.2 2015/03/26 10:54:35 martin Exp $
+# $NetBSD: modules,v 1.1.2.3 2015/05/16 04:37:04 snj Exp $
 #
 
 # PROVIDE: modules
-# BEFORE:  securelevel
+# REQUIRE: fsck_root
+# BEFORE: root
 
 $_rc_subr_loaded . /etc/rc.subr
 
@@ -17,12 +18,19 @@ modules_start()
 {
 	if [ -f /etc/modules.conf ]; then
 		echo "Loading modules."
-		cat /etc/modules.conf |
-		while read -r args; do
-			args=${args%%#*}		# strip comments
-			test -z "$args" && continue
-			/sbin/modload $args
-		done
+		while read name args; do
+			case $name in
+			''|"#"*)
+;;
+			*)
+(
+	set -o noglob
+	eval set -- $args
+	modload "$@" "$name"
+)
+;;
+			esac
+		done < /etc/modules.conf
 	fi
 }
 



CVS commit: [netbsd-7] src/sys

2015-05-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May 16 04:06:05 UTC 2015

Modified Files:
src/sys/arch/sgimips/dev [netbsd-7]: scn.c
src/sys/arch/sgimips/mace [netbsd-7]: macekbc.c
src/sys/dev/hpc [netbsd-7]: hpcfb.c
src/sys/dev/i2c [netbsd-7]: i2c.c
src/sys/dev/ic [netbsd-7]: mfi.c
src/sys/dev/if_ndis [netbsd-7]: if_ndis_pci.c
src/sys/dev/sysmon [netbsd-7]: sysmon_power.c
src/sys/dev/usb [netbsd-7]: umass_isdata.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #761):
sys/arch/sgimips/dev/scn.c: revision 1.8
sys/arch/sgimips/mace/macekbc.c: revision 1.8
sys/dev/hpc/hpcfb.c: revision 1.59
sys/dev/i2c/i2c.c: revision 1.47
sys/dev/ic/mfi.c: revision 1.57
sys/dev/if_ndis/if_ndis_pci.c: revision 1.21
sys/dev/sysmon/sysmon_power.c: revisions 1.50-1.52
sys/dev/usb/umass_isdata.c: revision 1.31
fix double free, found by Brainy.
--
Free cmd on error if we allocated it.
Found by Brainy, reported by maxv@.
--
don't leak rl (but there are other leaks), found by Brainy.
--
Free ped if we can't hand it to the power daemon.
Found by Brainy, reported by maxv@.
--
don't forget to free the dictionary.
--
another missing free dict.
--
fix leak, found by Brainy.
--
don't malloc a tiny, fixed size buffer to scribble into, then not use it
and never free it either
found by Brainy
--
malloc() -> kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason
found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/arch/sgimips/dev/scn.c
cvs rdiff -u -r1.7 -r1.7.12.1 src/sys/arch/sgimips/mace/macekbc.c
cvs rdiff -u -r1.58 -r1.58.34.1 src/sys/dev/hpc/hpcfb.c
cvs rdiff -u -r1.44.2.1 -r1.44.2.2 src/sys/dev/i2c/i2c.c
cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.19.12.1 -r1.19.12.2 src/sys/dev/if_ndis/if_ndis_pci.c
cvs rdiff -u -r1.47.2.1 -r1.47.2.2 src/sys/dev/sysmon/sysmon_power.c
cvs rdiff -u -r1.29 -r1.29.4.1 src/sys/dev/usb/umass_isdata.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/sgimips/dev/scn.c
diff -u src/sys/arch/sgimips/dev/scn.c:1.7 src/sys/arch/sgimips/dev/scn.c:1.7.2.1
--- src/sys/arch/sgimips/dev/scn.c:1.7	Fri Jul 25 08:10:34 2014
+++ src/sys/arch/sgimips/dev/scn.c	Sat May 16 04:06:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: scn.c,v 1.7 2014/07/25 08:10:34 dholland Exp $ */
+/*	$NetBSD: scn.c,v 1.7.2.1 2015/05/16 04:06:04 snj Exp $ */
 
 /*
  * Resurrected from the old pc532 port 1/18/2009.
@@ -92,7 +92,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scn.c,v 1.7 2014/07/25 08:10:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scn.c,v 1.7.2.1 2015/05/16 04:06:04 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -815,7 +815,6 @@ scn_attach(device_t parent, device_t sel
 	u_char mr1, mr2;
 	enum scntype scntype = SCNUNK;
 	const char *duart_type = "Unknown";
-	char *intrname;
 	bool console, first;
 	devmajor_t major;
 
@@ -906,9 +905,6 @@ scn_attach(device_t parent, device_t sel
 		ch_base[CH_MR] = mr2;
 		splx(s);
 
-		intrname = malloc(sizeof("scnXX"), M_DEVBUF, M_NOWAIT);
-		snprintf(intrname, sizeof("scnXX"), "scn%d", unit);
-
 		/*
 		 * On IP6 the console chip is duart1. The keyboard/mouse
 		 * is duart0. Each chip has two channels and the channels

Index: src/sys/arch/sgimips/mace/macekbc.c
diff -u src/sys/arch/sgimips/mace/macekbc.c:1.7 src/sys/arch/sgimips/mace/macekbc.c:1.7.12.1
--- src/sys/arch/sgimips/mace/macekbc.c:1.7	Sat Oct 27 17:18:10 2012
+++ src/sys/arch/sgimips/mace/macekbc.c	Sat May 16 04:06:04 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $ */
+/* $NetBSD: macekbc.c,v 1.7.12.1 2015/05/16 04:06:04 snj Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -31,12 +31,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: macekbc.c,v 1.7.12.1 2015/05/16 04:06:04 snj Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -125,7 +125,7 @@ macekbc_attach(device_t parent, device_t
 	aprint_normal(": PS2 controller\n");
 	aprint_naive("\n");
 
-	t = malloc(sizeof(struct macekbc_internal), M_DEVBUF, M_NOWAIT|M_ZERO);
+	t = kmem_alloc(sizeof(struct macekbc_internal), KM_NOSLEEP);
 	if (t == NULL) {
 		aprint_error("%s: not enough memory\n", device_xname(self));
 		return;
@@ -137,20 +137,20 @@ macekbc_attach(device_t parent, device_t
 	0, &t->t_ioh[PCKBPORT_KBD_SLOT]) != 0) {
 		aprint_error("%s: couldn't map kbd registers\n",
 		device_xname(self));
-		return;
+		goto bork;
 	}
 	if (bus_space_subregion(t->t_iot, maa->maa_sh, maa->maa_offset + 32,
 	0, &t->t_ioh[PCKBPORT_AUX_SLOT]) != 0) {
 		aprint_error("%s: couldn't map aux registers\n",
 		device_xname(self));
-		

CVS commit: [netbsd-7] src/usr.sbin/postinstall

2015-05-15 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May 16 03:45:21 UTC 2015

Modified Files:
src/usr.sbin/postinstall [netbsd-7]: postinstall

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #773):
usr.sbin/postinstall/postinstall: revisions 1.184, 1.187
Handle obsolete xen/pae-xen kernel modules; reported by John D. Baker.
--
add powerpc variants to the list of potentially obsolete modules to check


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.4 -r1.175.2.5 src/usr.sbin/postinstall/postinstall

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/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.175.2.4 src/usr.sbin/postinstall/postinstall:1.175.2.5
--- src/usr.sbin/postinstall/postinstall:1.175.2.4	Sat Apr 18 09:39:17 2015
+++ src/usr.sbin/postinstall/postinstall	Sat May 16 03:45:21 2015
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.175.2.4 2015/04/18 09:39:17 martin Exp $
+# $NetBSD: postinstall,v 1.175.2.5 2015/05/16 03:45:21 snj Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -641,7 +641,7 @@ obsolete_stand()
 	local dir="$1"
 	local subdir
 
-	if ! [ -d "${DEST_DIR}/${dir}" ]; then
+	if ! [ -d "${DEST_DIR}${dir}" ]; then
 		msg "${DEST_DIR}${dir} doesn't exist; can't check for obsolete files"
 		return 1
 	fi
@@ -652,7 +652,7 @@ obsolete_stand()
 	| tail -n +2 \
 	| while read subdir ; do
 		subdir="${subdir%/.}"
-		find "${DEST_DIR}/${dir#/}/${subdir}" -depth -print
+		find "${DEST_DIR}${dir}/${subdir}" -depth -print
 	done \
 	| unprefix "${DEST_DIR}"
 }
@@ -2008,7 +2008,15 @@ do_obsolete_stand()
 	op="$1"
 	failed=0
 
-	obsolete_stand "/stand/${MACHINE}" | obsolete_paths "${op}"
+	for dir in \
+	/stand/${MACHINE} \
+	/stand/${MACHINE}-4xx \
+	/stand/${MACHINE}-booke \
+	/stand/${MACHINE}-xen \
+	/stand/${MACHINE}pae-xen
+	do
+		[ -d "${DESTDIR}${dir}" ] && obsolete_stand "${dir}"
+	done | obsolete_paths "${op}"
 	failed=$(( ${failed} + $? ))
 
 	return ${failed}



CVS commit: src/usr.bin/crunch/crunchgen

2015-05-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat May 16 02:33:12 UTC 2015

Modified Files:
src/usr.bin/crunch/crunchgen: crunchgen.c

Log Message:
Use :Q instead of " to quote make vars DBG and LDSTATIC


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/usr.bin/crunch/crunchgen/crunchgen.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/crunch/crunchgen/crunchgen.c
diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.82 src/usr.bin/crunch/crunchgen/crunchgen.c:1.83
--- src/usr.bin/crunch/crunchgen/crunchgen.c:1.82	Sat Jan  4 08:58:51 2014
+++ src/usr.bin/crunch/crunchgen/crunchgen.c	Sat May 16 02:33:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $	*/
+/*	$NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $	*/
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $");
 #endif
 
 #include 
@@ -1003,7 +1003,7 @@ prog_makefile_rules(FILE *outmk, prog_t 
 	fprintf(outmk, "%s\\n", lst->str);
 	fprintf(outmk, "'\\\n");
 #define MAKECMD \
-"\t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=\"${DBG}\" LDSTATIC=\"${LDSTATIC}\" "
+"\t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=${DBG:Q} LDSTATIC=${LDSTATIC:Q} "
 	fprintf(outmk, MAKECMD "depend");
 	fprintf(outmk, " )\n");
 	fprintf(outmk, "\t( cd %s; printf '.PATH: ${%s_SRCDIR}\\n"



CVS commit: src/sys/netinet

2015-05-15 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Sat May 16 01:15:34 UTC 2015

Modified Files:
src/sys/netinet: tcp_output.c

Log Message:
Don't put segment on the wire if security request can't be fulfilled


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/netinet/tcp_output.c

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

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.182 src/sys/netinet/tcp_output.c:1.183
--- src/sys/netinet/tcp_output.c:1.182	Mon Apr 27 16:50:17 2015
+++ src/sys/netinet/tcp_output.c	Sat May 16 01:15:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.182 2015/04/27 16:50:17 christos Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.183 2015/05/16 01:15:34 kefren Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.182 2015/04/27 16:50:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.183 2015/05/16 01:15:34 kefren Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1238,7 +1238,10 @@ send:
 		*bp++ = TCPOPT_NOP;
 		*bp++ = TCPOPT_EOL;
  		optlen += 2;
- 	}
+ 	} else if ((tp->t_flags & TF_SIGNATURE) != 0) {
+		error = ECONNABORTED;
+		goto out;
+	}
 #endif /* TCP_SIGNATURE */
 
 	hdrlen += optlen;



CVS commit: src/sys/dev/iscsi

2015-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 18:28:36 UTC 2015

Modified Files:
src/sys/dev/iscsi: iscsi_main.c

Log Message:
Don't pre-compute string sizes in a relatively cold function.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/iscsi/iscsi_main.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/iscsi/iscsi_main.c
diff -u src/sys/dev/iscsi/iscsi_main.c:1.13 src/sys/dev/iscsi/iscsi_main.c:1.14
--- src/sys/dev/iscsi/iscsi_main.c:1.13	Fri May 15 16:24:30 2015
+++ src/sys/dev/iscsi/iscsi_main.c	Fri May 15 18:28:36 2015
@@ -228,28 +228,19 @@ iscsi_detach(device_t self, int flags)
 
 typedef struct quirktab_t {
 	const char	*tgt;
-	size_t		 tgtlen;
 	const char	*iqn;
-	size_t		 iqnlen;
 	uint32_t	 quirks;
 } quirktab_t;
 
 static const quirktab_t	quirktab[] = {
-	{ "StarWind",	8,
-		"iqn.2008-08.com.starwindsoftware",	32,
-		PQUIRK_ONLYBIG	},
-	{ "UNH",	3,
-		"iqn.2002-10.edu.unh.",	20,
-		PQUIRK_NOBIGMODESENSE |
-		PQUIRK_NOMODESENSE |
-		PQUIRK_NOSYNCCACHE },
-	{ "NetBSD",	6,
-		"iqn.1994-04.org.netbsd.",	23,
-		0	},
-	{ "Unknown",	7,
-		"unknown",	7,
-		0	},
-	{ NULL,		0,	NULL,	0,	0	}
+	{ "StarWind", "iqn.2008-08.com.starwindsoftware", PQUIRK_ONLYBIG },
+	{ "UNH", "iqn.2002-10.edu.unh.",
+	PQUIRK_NOBIGMODESENSE |
+	PQUIRK_NOMODESENSE |
+	PQUIRK_NOSYNCCACHE },
+	{ "NetBSD", "iqn.1994-04.org.netbsd.", 0 },
+	{ "Unknown", "unknown", 0 },
+	{ NULL, NULL, 0 }
 };
 
 /* loop through the quirktab looking for a match on target name */
@@ -257,14 +248,17 @@ static const quirktab_t *
 getquirks(const char *iqn)
 {
 	const quirktab_t	*qp;
+	size_t iqnlen, quirklen;
 
-	if (iqn == NULL) {
+	if (iqn == NULL)
 		iqn = "unknown";
-	}
+	iqnlen = strlen(iqn);
 	for (qp = quirktab ; qp->iqn ; qp++) {
-		if (strncmp(qp->iqn, iqn, qp->iqnlen) == 0) {
+		quirklen = strlen(qp->iqn);
+		if (quirklen > iqnlen)
+			continue;
+		if (memcmp(qp->iqn, iqn, quirklen) == 0)
 			break;
-		}
 	}
 	return qp;
 }



CVS commit: src/sys/netinet

2015-05-15 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Fri May 15 18:03:45 UTC 2015

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Don't try to do PCB lookup for bad checksummed segments
Fixes PR/43510 and PR/48452


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/sys/netinet/tcp_input.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.339 src/sys/netinet/tcp_input.c:1.340
--- src/sys/netinet/tcp_input.c:1.339	Sat May  2 17:18:03 2015
+++ src/sys/netinet/tcp_input.c	Fri May 15 18:03:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.339 2015/05/02 17:18:03 rtr Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.339 2015/05/02 17:18:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1394,6 +1394,12 @@ tcp_input(struct mbuf *m, ...)
 	tiflags = th->th_flags;
 
 	/*
+	 * Checksum extended TCP header and data
+	 */
+	if (tcp_input_checksum(af, m, th, toff, off, tlen))
+		goto badcsum;
+
+	/*
 	 * Locate pcb for segment.
 	 */
 findpcb:
@@ -1564,12 +1570,6 @@ findpcb:
 	KASSERT(so->so_lock == softnet_lock);
 	KASSERT(solocked(so));
 
-	/*
-	 * Checksum extended TCP header and data.
-	 */
-	if (tcp_input_checksum(af, m, th, toff, off, tlen))
-		goto badcsum;
-
 	tcp_fields_to_host(th);
 
 	/* Unscale the window into a 32-bit value. */



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

2015-05-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May 15 17:43:36 UTC 2015

Added Files:
src/sys/arch/arm/nvidia: tegra_ahcisatareg.h

Log Message:
Tegra SATA registers


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/nvidia/tegra_ahcisatareg.h

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

Added files:

Index: src/sys/arch/arm/nvidia/tegra_ahcisatareg.h
diff -u /dev/null src/sys/arch/arm/nvidia/tegra_ahcisatareg.h:1.1
--- /dev/null	Fri May 15 17:43:36 2015
+++ src/sys/arch/arm/nvidia/tegra_ahcisatareg.h	Fri May 15 17:43:35 2015
@@ -0,0 +1,95 @@
+/* $NetBSD: tegra_ahcisatareg.h,v 1.1 2015/05/15 17:43:35 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill 
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef _ARM_TEGRA_AHCISATAREG_H
+#define _ARM_TEGRA_AHCISATAREG_H
+
+#define TEGRA_SATA_FPCI_BAR5_REG		0x94
+
+#define TEGRA_SATA_FPCI_BAR_START			__BITS(31,4)
+#define TEGRA_SATA_FPCI_BAR_ACCESS_TYPE			__BIT(0)
+
+#define TEGRA_SATA_CONFIGURATION_REG		0x180
+#define TEGRA_SATA_CONFIGURATION_EN_FPCI		__BIT(0)
+
+#define TEGRA_SATA_INTR_MASK_REG		0x188
+#define TEGRA_SATA_INTR_MASK_IP_INT			__BIT(16)
+#define TEGRA_SATA_INTR_MASK_MSI			__BIT(8)
+#define TEGRA_SATA_INTR_MASK_INT			__BIT(0)
+
+#define TEGRA_T_SATA0_CFG1_REG			0x1004
+#define TEGRA_T_SATA0_CFG1_INTR_DISABLE			__BIT(10)
+#define TEGRA_T_SATA0_CFG1_SERR__BIT(8)
+#define TEGRA_T_SATA0_CFG1_BUS_MASTER			__BIT(2)
+#define TEGRA_T_SATA0_CFG1_MEM_SPACE			__BIT(1)
+#define TEGRA_T_SATA0_CFG1_IO_SPACE			__BIT(0)
+
+#define TEGRA_T_SATA0_CFG9_REG			0x1024
+#define TEGRA_T_SATA0_CFG9_BASE_ADDRESS			__BITS(31,13) 
+#define TEGRA_T_SATA0_CFG9_SPACE_TYPE			__BIT(0)
+
+#define TEGRA_T_SATA0_BKDOOR_CC_REG		0x14a4
+#define TEGRA_T_SATA0_BKDOOR_CC_CLASS_CODE		__BITS(31,16)
+#define TEGRA_T_SATA0_BKDOOR_CC_PROG_IF			__BITS(15,8)
+
+#define TEGRA_T_SATA0_CFG_POWER_GATE_REG	0x14ac
+#define TEGRA_T_SATA0_CFG_POWER_GATE_SSTS_RESTORED	__BIT(23)
+
+#define TEGRA_T_SATA0_CFG_SATA_REG		0x154c
+#define TEGRA_T_SATA0_CFG_SATA_BACKDOOR_PROG_IF_EN	__BIT(12)
+
+#define TEGRA_T_SATA0_INDEX_REG			0x1680
+#define TEGRA_T_SATA0_INDEX_CH4__BIT(3)
+#define TEGRA_T_SATA0_INDEX_CH3__BIT(2)
+#define TEGRA_T_SATA0_INDEX_CH2__BIT(1)
+#define TEGRA_T_SATA0_INDEX_CH1__BIT(0)
+
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_REG	0x1690
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_DRV_CNTL	__BITS(27,24)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_PEAK_PRE	__BITS(23,20)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_CMADJ	__BITS(19,16)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_PEAK	__BITS(15,8)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_AMP		__BITS(7,0)
+
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_REG	0x1694
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_DRV_CNTL	__BITS(27,24)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_PEAK_PRE	__BITS(23,20)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_PEAK	__BITS(19,12)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_CMADJ	__BITS(11,8)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_AMP		__BITS(7,0)
+
+#define TEGRA_T_SATA0_CHX_PHY_CTRL2_REG		0x169c
+#define TEGRA_T_SATA0_CHX_PHY_CTRL2_CDR_CNTL_GEN3	__BITS(23,16)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL2_CDR_CNTL_GEN2	__BITS(15,8)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL2_CDR_CNTL_GEN1	__BITS(7,0)
+
+#define TEGRA_T_SATA0_CHX_PHY_CTRL11_REG	0x16d0
+#define TEGRA_T_SATA0_CHX_PHY_CTRL11_GEN2_RX_EQ		__BITS(31,16)
+#define TEGRA_T_SATA0_CHX_PHY_CTRL11_GEN1_RX_EQ		__BITS(15,0)
+
+#endif /* _ARM_TEGRA_AHCISATAREG_H */



CVS commit: src/sys/dev/iscsi

2015-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 16:25:50 UTC 2015

Modified Files:
src/sys/dev/iscsi: iscsi_text.c

Log Message:
Drop conditional support for writing large numbers as hex.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/iscsi/iscsi_text.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/iscsi/iscsi_text.c
diff -u src/sys/dev/iscsi/iscsi_text.c:1.7 src/sys/dev/iscsi/iscsi_text.c:1.8
--- src/sys/dev/iscsi/iscsi_text.c:1.7	Fri Mar 28 02:15:56 2014
+++ src/sys/dev/iscsi/iscsi_text.c	Fri May 15 16:25:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_text.c,v 1.7 2014/03/28 02:15:56 christos Exp $	*/
+/*	$NetBSD: iscsi_text.c,v 1.8 2015/05/15 16:25:50 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -34,9 +34,6 @@
 #include 
 #include 
 
-/* define to send T_BIGNUM in hex format instead of base64 */
-/* #define ISCSI_HEXBIGNUMS */
-
 #define isdigit(x) ((x) >= '0' && (x) <= '9')
 #define toupper(x) ((x) & ~0x20)
 
@@ -639,22 +636,7 @@ my_strcpy(uint8_t *dest, const uint8_t *
 STATIC unsigned
 put_bignumval(negotiation_parameter_t *par, uint8_t *buf)
 {
-#ifdef ISCSI_HEXBIGNUMS
-	int k, c;
-
-	my_strcpy(buf, "0x");
-	for (k=0; klist_num; ++k) {
-		c = par->val.sval[k] >> 4;
-		buf[2+2*k] = c < 10 ? '0' + c : 'a' + (c-10);
-		c = par->val.sval[k] & 0xf;
-		buf[2+2*k+1] = c < 10 ? '0' + c : 'a' + (c-10);
-	}
-	buf[2+2*k] = '\0';
-
-	return 2+2*par->list_num;
-#else
 	return base64_encode(par->val.sval, par->list_num, buf);
-#endif
 }
 
 /*
@@ -835,11 +817,7 @@ parameter_size(negotiation_parameter_t *
 
 		case T_BIGNUM:
 			/* list_num holds value size */
-#ifdef ISCSI_HEXBIGNUMS
-			size += 2 + 2*par->list_num;
-#else
 			size += base64_enclen(par->list_num);
-#endif
 			i = par->list_num;
 			break;
 



CVS commit: src/sys/dev/iscsi

2015-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 16:24:30 UTC 2015

Modified Files:
src/sys/dev/iscsi: iscsi_globals.h iscsi_ioctl.c iscsi_main.c
iscsi_rcv.c iscsi_send.c iscsi_utils.c

Log Message:
Remove conditionals for NetBSD before 4.0.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/iscsi/iscsi_globals.h \
src/sys/dev/iscsi/iscsi_ioctl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/iscsi/iscsi_rcv.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/iscsi/iscsi_send.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/iscsi/iscsi_utils.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/iscsi/iscsi_globals.h
diff -u src/sys/dev/iscsi/iscsi_globals.h:1.7 src/sys/dev/iscsi/iscsi_globals.h:1.8
--- src/sys/dev/iscsi/iscsi_globals.h:1.7	Mon Apr 13 16:33:24 2015
+++ src/sys/dev/iscsi/iscsi_globals.h	Fri May 15 16:24:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_globals.h,v 1.7 2015/04/13 16:33:24 riastradh Exp $	*/
+/*	$NetBSD: iscsi_globals.h,v 1.8 2015/05/15 16:24:30 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -328,13 +328,6 @@ typedef struct ccb_list_s ccb_list_t;
 /*
Per connection data: the connection structure
 */
-#if (__NetBSD_Version__ >= 399000900)
-typedef struct lwp *PTHREADOBJ;
-#else
-typedef struct proc *PTHREADOBJ;
-#endif
-
-
 struct connection_s {
 	TAILQ_ENTRY(connection_s)	connections;
 
@@ -374,7 +367,7 @@ struct connection_s {
 
 	conn_state_t			state; /* State of connection */
 
-	PTHREADOBJ			threadobj;
+	struct lwp			*threadobj;
 		/* proc/thread pointer of socket owner */
 	struct file			*sock;	/* the connection's socket */
 	session_t			*session;
@@ -681,45 +674,20 @@ sn_a_le_b(uint32_t a, uint32_t b)
 
 
 /* Version dependencies */
-
-
-#if (__NetBSD_Version__ >= 399000900)
-#define PROCP(obj)	(obj->l_proc)
-#else
-#define PROCP(obj)	obj
-#define UIO_SETUP_SYSSPACE(uio) (uio)->uio_segflg = UIO_SYSSPACE
-#endif
-
-#if (__NetBSD_Version__ >= 10600)
-#  ifdef ISCSI_TEST_MODE
+#ifdef ISCSI_TEST_MODE
 #define SET_CCB_TIMEOUT(conn, ccb, tout) do {\
 	if (test_ccb_timeout (conn)) {	\
 		callout_schedule(&ccb->timeout, tout);			\
 	}\
 } while (/*CONSTCOND*/ 0)
-#  else
-#define SET_CCB_TIMEOUT(conn, ccb, tout) callout_schedule(&ccb->timeout, tout)
-#  endif
-#else
-/* no test mode for 1.5 */
-#define SET_CCB_TIMEOUT(conn, ccb, tout)\
-	callout_reset(&ccb->timeout, tout, ccb_timeout, ccb)
-#endif
-
-#if (__NetBSD_Version__ >= 10600)
-#  ifdef ISCSI_TEST_MODE
 #define SET_CONN_TIMEOUT(conn, tout) do {\
 	if (test_conn_timeout (conn)) {	\
 		callout_schedule(&conn->timeout, tout);			\
 	}\
-} while (/*CONSTCOND*/0)
-#  else
-#define SET_CONN_TIMEOUT(conn, tout) callout_schedule(&conn->timeout, tout)
-#  endif
+} while (/*CONSTCOND*/ 0)
 #else
-/* no test mode for 1.5 */
-#define SET_CONN_TIMEOUT(conn, tout)	\
-	callout_reset(&conn->timeout, tout, connection_timeout, conn)
+#define SET_CCB_TIMEOUT(conn, ccb, tout) callout_schedule(&ccb->timeout, tout)
+#define SET_CONN_TIMEOUT(conn, tout) callout_schedule(&conn->timeout, tout)
 #endif
 
 /* in iscsi_ioctl.c */
@@ -742,7 +710,7 @@ void iscsi_cleanup_thread(void *);
 uint32_t map_databuf(struct proc *, void **, uint32_t);
 void unmap_databuf(struct proc *, void *, uint32_t);
 #endif
-int iscsiioctl(dev_t, u_long, void *, int, PTHREADOBJ);
+int iscsiioctl(dev_t, u_long, void *, int, struct lwp *);
 
 session_t *find_session(uint32_t);
 connection_t *find_connection(session_t *, uint32_t);
Index: src/sys/dev/iscsi/iscsi_ioctl.c
diff -u src/sys/dev/iscsi/iscsi_ioctl.c:1.7 src/sys/dev/iscsi/iscsi_ioctl.c:1.8
--- src/sys/dev/iscsi/iscsi_ioctl.c:1.7	Sun May  3 15:07:12 2015
+++ src/sys/dev/iscsi/iscsi_ioctl.c	Fri May 15 16:24:30 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_ioctl.c,v 1.7 2015/05/03 15:07:12 joerg Exp $	*/
+/*	$NetBSD: iscsi_ioctl.c,v 1.8 2015/05/15 16:24:30 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -606,7 +606,7 @@ kill_session(session_t *session, uint32_
  *Parameter:
  *  par  IN/OUT: The login parameters
  *  session  IN: The owning session
- *  pIN: The proc pointer of the caller
+ *  lIN: The lwp pointer of the caller
  *
  *Returns:0 on success
  *>0 on failure, connection structure deleted
@@ -615,7 +615,7 @@ kill_session(session_t *session, uint32_
 
 STATIC int
 create_connection(iscsi_login_parameters_t *par, session_t *session,
-  PTHREADOBJ p)
+  struct lwp *l)
 {
 	connection_t *connection;
 	int rc, s;
@@ -672,7 +672,7 @@ create_connection(iscsi_login_parameters
 	/* close the file descriptor */
 	fd_close(par->socket);
 
-	connection->threadobj = p;
+	connection->threadobj = l;
 	connection->login_par = 

CVS commit: src/lib/libc/net

2015-05-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 15 14:26:02 UTC 2015

Modified Files:
src/lib/libc/net: getnameinfo.c

Log Message:
Don't create a weak alias in the !RUMPACTION case.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libc/net/getnameinfo.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/libc/net/getnameinfo.c
diff -u src/lib/libc/net/getnameinfo.c:1.55 src/lib/libc/net/getnameinfo.c:1.56
--- src/lib/libc/net/getnameinfo.c:1.55	Fri May 15 06:58:59 2015
+++ src/lib/libc/net/getnameinfo.c	Fri May 15 14:26:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: getnameinfo.c,v 1.55 2015/05/15 06:58:59 ozaki-r Exp $	*/
+/*	$NetBSD: getnameinfo.c,v 1.56 2015/05/15 14:26:02 joerg Exp $	*/
 /*	$KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $	*/
 
 /*
@@ -47,7 +47,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getnameinfo.c,v 1.55 2015/05/15 06:58:59 ozaki-r Exp $");
+__RCSID("$NetBSD: getnameinfo.c,v 1.56 2015/05/15 14:26:02 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
@@ -74,9 +74,11 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.55 2
 #include "servent.h"
 #include "hostent.h"
 
+#ifndef RUMP_ACTION
 #ifdef __weak_alias
 __weak_alias(getnameinfo,_getnameinfo)
 #endif
+#endif
 
 static const struct afd {
 	int		a_af;



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

2015-05-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May 15 12:18:48 UTC 2015

Modified Files:
src/sys/arch/evbarm/conf: JETSONTK1

Log Message:
enable SATA, maybe it will inspire someone to fix it


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/conf/JETSONTK1

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/evbarm/conf/JETSONTK1
diff -u src/sys/arch/evbarm/conf/JETSONTK1:1.18 src/sys/arch/evbarm/conf/JETSONTK1:1.19
--- src/sys/arch/evbarm/conf/JETSONTK1:1.18	Fri May 15 11:49:58 2015
+++ src/sys/arch/evbarm/conf/JETSONTK1	Fri May 15 12:18:48 2015
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: JETSONTK1,v 1.18 2015/05/15 11:49:58 jmcneill Exp $
+#	$NetBSD: JETSONTK1,v 1.19 2015/05/15 12:18:48 jmcneill Exp $
 #
 #	NVIDIA Jetson TK1 - Tegra K1 development kit
 #	https://developer.nvidia.com/jetson-tk1
@@ -102,10 +102,10 @@ sdmmc2		at sdhc2
 ld1		at sdmmc2		# SD card
 
 # SATA
-#ahcisata0	at tegraio?		# SATA
-#atabus*		at ata?
-#atapibus*	at atapi?
-#wd*		at atabus? drive ?
+ahcisata0	at tegraio?		# SATA
+atabus*		at ata?
+atapibus*	at atapi?
+wd*		at atabus? drive ?
 #cd*		at atapibus? drive ?
 
 # HDA



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

2015-05-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May 15 11:50:30 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: tegra_ahcisata.c tegra_car.c tegra_pmc.c
tegra_pmcreg.h tegra_var.h

Log Message:
more Tegra SATA init


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra_ahcisata.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/nvidia/tegra_car.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/nvidia/tegra_pmc.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nvidia/tegra_pmcreg.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/nvidia/tegra_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/arch/arm/nvidia/tegra_ahcisata.c
diff -u src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.4 src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.5
--- src/sys/arch/arm/nvidia/tegra_ahcisata.c:1.4	Thu May 14 00:00:44 2015
+++ src/sys/arch/arm/nvidia/tegra_ahcisata.c	Fri May 15 11:50:30 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ahcisata.c,v 1.4 2015/05/14 00:00:44 jmcneill Exp $ */
+/* $NetBSD: tegra_ahcisata.c,v 1.5 2015/05/15 11:50:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.4 2015/05/14 00:00:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_ahcisata.c,v 1.5 2015/05/15 11:50:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -89,7 +89,7 @@ tegra_ahcisata_attach(device_t parent, d
 	bus_space_subregion(tio->tio_bst, tio->tio_bsh,
 	loc->loc_offset + TEGRA_AHCISATA_OFFSET,
 	loc->loc_size - TEGRA_AHCISATA_OFFSET, &sc->sc.sc_ahcih);
-	sc->sc.sc_ahci_ports = 1;
+	sc->sc.sc_ahci_quirks = AHCI_QUIRK_BADPMP;
 
 	aprint_naive("\n");
 	aprint_normal(": SATA\n");
@@ -102,6 +102,8 @@ tegra_ahcisata_attach(device_t parent, d
 
 	tegra_car_periph_sata_enable();
 
+	tegra_xusbpad_sata_enable();
+
 	tegra_ahcisata_init(sc);
 
 	sc->sc_ih = intr_establish(loc->loc_intr, IPL_BIO, IST_LEVEL,
@@ -122,10 +124,34 @@ tegra_ahcisata_init(struct tegra_ahcisat
 	bus_space_tag_t bst = sc->sc_bst;
 	bus_space_handle_t bsh = sc->sc_bsh;
 
+	const u_int gen1_tx_amp = 0x18;
+	const u_int gen1_tx_peak = 0x04;
+	const u_int gen2_tx_amp = 0x18;
+	const u_int gen2_tx_peak = 0x0a;
+
 	/* Enable IFPS device block */
 	tegra_reg_set_clear(bst, bsh, TEGRA_SATA_CONFIGURATION_REG,
 	TEGRA_SATA_CONFIGURATION_EN_FPCI, 0);
 
+	/* PHY config */
+	bus_space_write_4(bst, bsh, TEGRA_T_SATA0_INDEX_REG,
+	TEGRA_T_SATA0_INDEX_CH1);
+	tegra_reg_set_clear(bst, bsh, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_REG,
+	__SHIFTIN(gen1_tx_amp, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_AMP) |
+	__SHIFTIN(gen1_tx_peak, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_PEAK),
+	TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_AMP |
+	TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN1_TX_PEAK);
+	tegra_reg_set_clear(bst, bsh, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_REG,
+	__SHIFTIN(gen2_tx_amp, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_AMP) |
+	__SHIFTIN(gen2_tx_peak, TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_PEAK),
+	TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_AMP |
+	TEGRA_T_SATA0_CHX_PHY_CTRL1_GEN2_TX_PEAK);
+	bus_space_write_4(bst, bsh, TEGRA_T_SATA0_CHX_PHY_CTRL11_REG,
+	__SHIFTIN(0x2800, TEGRA_T_SATA0_CHX_PHY_CTRL11_GEN2_RX_EQ));
+	bus_space_write_4(bst, bsh, TEGRA_T_SATA0_CHX_PHY_CTRL2_REG,
+	__SHIFTIN(0x23, TEGRA_T_SATA0_CHX_PHY_CTRL2_CDR_CNTL_GEN1));
+	bus_space_write_4(bst, bsh, TEGRA_T_SATA0_INDEX_REG, 0);
+
 	/* Backdoor update the programming interface field and class code */
 	tegra_reg_set_clear(bst, bsh, TEGRA_T_SATA0_CFG_SATA_REG,
 	TEGRA_T_SATA0_CFG_SATA_BACKDOOR_PROG_IF_EN, 0);

Index: src/sys/arch/arm/nvidia/tegra_car.c
diff -u src/sys/arch/arm/nvidia/tegra_car.c:1.13 src/sys/arch/arm/nvidia/tegra_car.c:1.14
--- src/sys/arch/arm/nvidia/tegra_car.c:1.13	Thu May 14 10:23:03 2015
+++ src/sys/arch/arm/nvidia/tegra_car.c	Fri May 15 11:50:30 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_car.c,v 1.13 2015/05/14 10:23:03 jmcneill Exp $ */
+/* $NetBSD: tegra_car.c,v 1.14 2015/05/15 11:50:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.13 2015/05/14 10:23:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.14 2015/05/15 11:50:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -462,39 +462,51 @@ tegra_car_periph_sata_enable(void)
 
 	tegra_car_get_bs(&bst, &bsh);
 
-	const u_int pllp_rate = tegra_car_pllp0_rate();
+	/* Assert resets */
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_SATA);
+	bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, CAR_DEV_W_SATACOLD);
+
+	/* Disable software control of SATA PLL */
+	tegra_reg_set_clear(bst, bsh, CAR_SATA_PLL_CFG0_REG,
+	0, CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL);
 
 	/* Set SATA_OOB clock source to PLLP, 204MHz */
-	const u_int sataoob_div = pllp_rate

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

2015-05-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May 15 11:49:58 UTC 2015

Modified Files:
src/sys/arch/evbarm/conf: JETSONTK1

Log Message:
enable XUSB PADCTL


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/conf/JETSONTK1

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/evbarm/conf/JETSONTK1
diff -u src/sys/arch/evbarm/conf/JETSONTK1:1.17 src/sys/arch/evbarm/conf/JETSONTK1:1.18
--- src/sys/arch/evbarm/conf/JETSONTK1:1.17	Wed May 13 11:07:28 2015
+++ src/sys/arch/evbarm/conf/JETSONTK1	Fri May 15 11:49:58 2015
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: JETSONTK1,v 1.17 2015/05/13 11:07:28 jmcneill Exp $
+#	$NetBSD: JETSONTK1,v 1.18 2015/05/15 11:49:58 jmcneill Exp $
 #
 #	NVIDIA Jetson TK1 - Tegra K1 development kit
 #	https://developer.nvidia.com/jetson-tk1
@@ -53,6 +53,9 @@ gpio*		at gpiobus?
 # MPIO / Pinmux
 tegrampio0	at tegraio?		# MPIO
 
+# XUSB PADCTL
+tegraxusbpad0	at tegraio?		# XUSB PADCTL
+
 # PCIE
 tegrapcie0	at tegraio?		# PCIE
 pci*		at tegrapcie0



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

2015-05-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri May 15 11:49:11 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: files.tegra tegra_io.c
Added Files:
src/sys/arch/arm/nvidia: tegra_xusbpad.c tegra_xusbpadreg.h

Log Message:
Tegra XUSB PADCTL driver


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/nvidia/tegra_io.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/nvidia/tegra_xusbpad.c \
src/sys/arch/arm/nvidia/tegra_xusbpadreg.h

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

Modified files:

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.10 src/sys/arch/arm/nvidia/files.tegra:1.11
--- src/sys/arch/arm/nvidia/files.tegra:1.10	Wed May 13 11:06:13 2015
+++ src/sys/arch/arm/nvidia/files.tegra	Fri May 15 11:49:10 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.10 2015/05/13 11:06:13 jmcneill Exp $
+#	$NetBSD: files.tegra,v 1.11 2015/05/15 11:49:10 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -47,6 +47,11 @@ device	tegrampio
 attach	tegrampio at tegraio with tegra_mpio
 file	arch/arm/nvidia/tegra_mpio.c		tegra_mpio
 
+# XUSB PADCTL
+device	tegraxusbpad
+attach	tegraxusbpad at tegraio with tegra_xusbpad
+file	arch/arm/nvidia/tegra_xusbpad.c		tegra_xusbpad
+
 # UART
 attach	com at tegraio with tegra_com
 file	arch/arm/nvidia/tegra_com.c		tegra_com needs-flag

Index: src/sys/arch/arm/nvidia/tegra_io.c
diff -u src/sys/arch/arm/nvidia/tegra_io.c:1.8 src/sys/arch/arm/nvidia/tegra_io.c:1.9
--- src/sys/arch/arm/nvidia/tegra_io.c:1.8	Sun May 10 23:50:21 2015
+++ src/sys/arch/arm/nvidia/tegra_io.c	Fri May 15 11:49:10 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_io.c,v 1.8 2015/05/10 23:50:21 jmcneill Exp $ */
+/* $NetBSD: tegra_io.c,v 1.9 2015/05/15 11:49:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_tegra.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_io.c,v 1.8 2015/05/10 23:50:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_io.c,v 1.9 2015/05/15 11:49:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -73,6 +73,8 @@ static const struct tegra_locators tegra
 TEGRA_MC_OFFSET, TEGRA_MC_SIZE, NOPORT, NOINTR },
   { "tegrapmc",
 TEGRA_PMC_OFFSET, TEGRA_PMC_SIZE, NOPORT, NOINTR },
+  { "tegraxusbpad",
+TEGRA_XUSB_PADCTL_OFFSET, TEGRA_XUSB_PADCTL_SIZE, NOPORT, NOINTR },
   { "tegrampio",
 TEGRA_MPIO_OFFSET, TEGRA_MPIO_SIZE, NOPORT, NOINTR },
   { "tegrai2c",

Added files:

Index: src/sys/arch/arm/nvidia/tegra_xusbpad.c
diff -u /dev/null src/sys/arch/arm/nvidia/tegra_xusbpad.c:1.1
--- /dev/null	Fri May 15 11:49:11 2015
+++ src/sys/arch/arm/nvidia/tegra_xusbpad.c	Fri May 15 11:49:10 2015
@@ -0,0 +1,136 @@
+/* $NetBSD: tegra_xusbpad.c,v 1.1 2015/05/15 11:49:10 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2015 Jared D. McNeill 
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+#include "locators.h"
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: tegra_xusbpad.c,v 1.1 2015/05/15 11:49:10 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+static int	tegra_xusbpad_match(device_t, cfdata_t, void *);
+static void	tegra_xusbpad_attach(device_t, device_t, void *);
+
+struct tegra_xusbpad_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+};
+
+static struct tegra_xusbpad_softc *xusbpad_softc = NULL;
+
+CFATTACH_DECL_NEW(tegra_xusbpad, sizeof(struct tegra_xusbpad_softc),
+	tegra_xusbpad_match, tegra_xusbpad_attach, NULL, NULL);
+
+static int
+tegra_xusbpad_match(device_t pa

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

2015-05-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri May 15 10:57:55 UTC 2015

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S

Log Message:
Make sure TLB is invalidated and ACTLR.SMP is set on ARM A15.  ACTLR.SMP
enables the processor to receive instruction cache, BTB and TLB main-
tenance operations from other processors


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/cortex/a9_mpsubr.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/arm/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.36 src/sys/arch/arm/cortex/a9_mpsubr.S:1.37
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.36	Sun May  3 16:18:51 2015
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Fri May 15 10:57:55 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.36 2015/05/03 16:18:51 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.37 2015/05/15 10:57:55 skrll Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -450,7 +450,7 @@ cortex_init:
 	XPUTC(#'2')
 #endif /* CORTEXA5 || CORTEXA9 */
 
-#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA17)
+#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
 	//
 	// The MMU is off.  Make sure the TLB is invalidated before
 	// turning on SMP.
@@ -461,8 +461,8 @@ cortex_init:
 
 	// For the A7, SMP must be on ldrex/strex to work.
 	//
-#if defined(MULTIPROCESSOR) || defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA17)
-#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA17)
+#if defined(MULTIPROCESSOR) || defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
+#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7) || defined(CPU_CORTEXA9) || defined(CPU_CORTEXA15) || defined(CPU_CORTEXA17)
 	//
 	// Step 4a, set ACTLR.SMP=1
 	//
@@ -485,7 +485,7 @@ cortex_init:
 	mcr	p15, 0, r0, c1, c0, 1		// ACTLR write
 	isb
 	dsb
-#endif	/* A5 || A7 || A9 || A17 */
+#endif	/* A5 || A7 || A9 || A15 || A17 */
 #endif	/* MULTIPROCESSOR */
 
 	//



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

2015-05-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri May 15 10:53:58 UTC 2015

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

Log Message:
Add missing rump flag to net/route test files


To generate a diff of this commit:
cvs rdiff -u -r1.620 -r1.621 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.620 src/distrib/sets/lists/tests/mi:1.621
--- src/distrib/sets/lists/tests/mi:1.620	Wed May 13 10:04:44 2015
+++ src/distrib/sets/lists/tests/mi	Fri May 15 10:53:58 2015
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.620 2015/05/13 10:04:44 ozaki-r Exp $
+# $NetBSD: mi,v 1.621 2015/05/15 10:53:58 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3176,9 +3176,9 @@
 ./usr/tests/net/npf/npftest.conf	tests-net-tests		atf,rump
 ./usr/tests/net/npf/t_npf		tests-net-tests		atf,rump
 ./usr/tests/net/routetests-net-tests
-./usr/tests/net/route/Atffile			tests-net-tests		atf
-./usr/tests/net/route/Kyuafile			tests-net-tests		atf,kyua
-./usr/tests/net/route/t_change		tests-net-tests		atf
+./usr/tests/net/route/Atffile			tests-net-tests		atf,rump
+./usr/tests/net/route/Kyuafile			tests-net-tests		atf,rump,kyua
+./usr/tests/net/route/t_change			tests-net-tests		atf,rump
 ./usr/tests/net/systests-net-tests
 ./usr/tests/net/sys/Atffile			tests-net-tests		atf
 ./usr/tests/net/sys/Kyuafile			tests-net-tests		atf,kyua



CVS commit: src/sys/dev/pci

2015-05-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 15 08:44:15 UTC 2015

Modified Files:
src/sys/dev/pci: if_iwm.c if_iwmvar.h

Log Message:
if_iwm use unified establish API.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_iwm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_iwmvar.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/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.32 src/sys/dev/pci/if_iwm.c:1.33
--- src/sys/dev/pci/if_iwm.c:1.32	Wed Apr 29 03:35:09 2015
+++ src/sys/dev/pci/if_iwm.c	Fri May 15 08:44:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.32 2015/04/29 03:35:09 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.33 2015/05/15 08:44:15 knakahara Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp	*/
 
 /*
@@ -105,7 +105,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.32 2015/04/29 03:35:09 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.33 2015/05/15 08:44:15 knakahara Exp $");
 
 #include 
 #include 
@@ -6679,14 +6679,10 @@ iwm_attach(device_t parent, device_t sel
 	}
 
 	/* Install interrupt handler. */
-	sc->sc_intr_type = IWM_INTR_INTX;
 #ifdef __HAVE_PCI_MSI_MSIX
 	error = ENODEV;
-	if (pci_msi_count(pa) > 0) {
+	if (pci_msi_count(pa) > 0)
 		error = pci_msi_alloc_exact(pa, &sc->sc_pihp, 1);
-		if (error == 0)
-			sc->sc_intr_type = IWM_INTR_MSI;
-	}
 	if (error != 0) {
 		if (pci_intx_alloc(pa, &sc->sc_pihp)) {
 			aprint_error_dev(self, "can't map interrupt\n");
@@ -6704,17 +6700,8 @@ iwm_attach(device_t parent, device_t sel
 #ifdef __HAVE_PCI_MSI_MSIX
 	intrstr = pci_intr_string(sc->sc_pct, sc->sc_pihp[0], intrbuf,
 	sizeof(intrbuf));
-	switch (sc->sc_intr_type) {
-	case IWM_INTR_MSI:
-		sc->sc_ih = pci_msi_establish(sc->sc_pct, sc->sc_pihp[0],
-		IPL_NET, iwm_intr, sc);
-		break;
-
-	case IWM_INTR_INTX:
-		sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0],
-		IPL_NET, iwm_intr, sc);
-		break;
-	}
+	sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0], IPL_NET,
+	iwm_intr, sc);
 #else	/* !__HAVE_PCI_MSI_MSIX */
 	intrstr = pci_intr_string(sc->sc_pct, ih, intrbuf, sizeof(intrbuf));
 	sc->sc_ih = pci_intr_establish(sc->sc_pct, ih, IPL_NET, iwm_intr, sc);

Index: src/sys/dev/pci/if_iwmvar.h
diff -u src/sys/dev/pci/if_iwmvar.h:1.6 src/sys/dev/pci/if_iwmvar.h:1.7
--- src/sys/dev/pci/if_iwmvar.h:1.6	Tue Apr 28 15:38:02 2015
+++ src/sys/dev/pci/if_iwmvar.h	Fri May 15 08:44:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwmvar.h,v 1.6 2015/04/28 15:38:02 nonaka Exp $	*/
+/*	$NetBSD: if_iwmvar.h,v 1.7 2015/05/15 08:44:15 knakahara Exp $	*/
 /*	OpenBSD: if_iwmvar.h,v 1.7 2015/03/02 13:51:10 jsg Exp 	*/
 
 /*
@@ -363,11 +363,6 @@ struct iwm_bf_data {
 	int last_cqm_event;
 };
 
-enum iwm_intr_type {
-	IWM_INTR_INTX,
-	IWM_INTR_MSI
-};
-
 struct iwm_softc {
 	device_t sc_dev;
 	struct ethercom sc_ec;
@@ -381,7 +376,6 @@ struct iwm_softc {
 
 	bus_space_tag_t sc_st;
 	bus_space_handle_t sc_sh;
-	enum iwm_intr_type sc_intr_type;
 #ifdef __HAVE_PCI_MSI_MSIX
 	pci_intr_handle_t *sc_pihp;
 #endif



CVS commit: src/sys/dev/ic

2015-05-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 15 08:44:24 UTC 2015

Modified Files:
src/sys/dev/ic: spdmem.c spdmemvar.h

Log Message:
 Print operable voltage with aprint_verbose(). OK'ed by pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/spdmemvar.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/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.13 src/sys/dev/ic/spdmem.c:1.14
--- src/sys/dev/ic/spdmem.c:1.13	Mon Apr 20 02:55:14 2015
+++ src/sys/dev/ic/spdmem.c	Fri May 15 08:44:24 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.13 2015/04/20 02:55:14 pgoyette Exp $ */
+/* $NetBSD: spdmem.c,v 1.14 2015/05/15 08:44:24 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.13 2015/04/20 02:55:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.14 2015/05/15 08:44:24 msaitoh Exp $");
 
 #include 
 #include 
@@ -763,6 +763,19 @@ decode_ddr3(const struct sysctlnode *nod
 		s->sm_ddr3.ddr3_tCKmin);
 
 #undef	__DDR3_CYCLES
+
+	/* For DDR3, Voltage is written in another area */
+	if (!s->sm_ddr3.ddr3_NOT15V || s->sm_ddr3.ddr3_135V
+	|| s->sm_ddr3.ddr3_125V) {
+		aprint_verbose("%s:", device_xname(self));
+		if (!s->sm_ddr3.ddr3_NOT15V)
+			aprint_verbose(" 1.5V");
+		if (s->sm_ddr3.ddr3_135V)
+			aprint_verbose(" 1.35V");
+		if (s->sm_ddr3.ddr3_125V)
+			aprint_verbose(" 1.25V");
+		aprint_verbose(" operable\n");
+	}
 }
 
 static void

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.6 src/sys/dev/ic/spdmemvar.h:1.7
--- src/sys/dev/ic/spdmemvar.h:1.6	Mon Apr 20 07:51:36 2015
+++ src/sys/dev/ic/spdmemvar.h	Fri May 15 08:44:24 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.6 2015/04/20 07:51:36 ozaki-r Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.7 2015/05/15 08:44:24 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -437,7 +437,7 @@ struct spdmem_ddr3 {/* Dual Data Rat
 	SPD_BITFIELD(\
 		uint8_t ddr3_NOT15V:1,		\
 		uint8_t ddr3_135V:1,		\
-		uint8_t ddr3_12XV:1,		\
+		uint8_t ddr3_125V:1,		\
 		uint8_t	ddr3_unused2:5		\
 	);
 	/* chipwidth in bits offset by 2: 0 = X4, 1 = X8, 2 = X16 */



CVS commit: src/share/man/man9

2015-05-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 15 08:39:14 UTC 2015

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

Log Message:
update man.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/pci_msi.9

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

Modified files:

Index: src/share/man/man9/pci_msi.9
diff -u src/share/man/man9/pci_msi.9:1.2 src/share/man/man9/pci_msi.9:1.3
--- src/share/man/man9/pci_msi.9:1.2	Mon Apr 27 10:37:20 2015
+++ src/share/man/man9/pci_msi.9	Fri May 15 08:39:14 2015
@@ -1,4 +1,4 @@
-.\" $NetBSD: pci_msi.9,v 1.2 2015/04/27 10:37:20 wiz Exp $
+.\" $NetBSD: pci_msi.9,v 1.3 2015/05/15 08:39:14 knakahara Exp $
 .\"
 .\" Copyright (c) 2015 Internet Initiative Japan Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 8, 2015
+.Dd May 11, 2015
 .Dt PCI_MSI 9
 .Os
 .Sh NAME
@@ -33,19 +33,12 @@
 .Nm pci_msi_count ,
 .Nm pci_msi_alloc ,
 .Nm pci_msi_alloc_exact ,
-.Nm pci_msi_release ,
-.Nm pci_msi_establish ,
-.Nm pci_msi_disestablish ,
-.Nm pci_msi_string
 .Nm pci_msix_count ,
 .Nm pci_msix_alloc ,
 .Nm pci_msix_alloc_exact ,
 .Nm pci_msix_alloc_map ,
-.Nm pci_msix_release ,
-.Nm pci_msix_establish ,
-.Nm pci_msix_disestablish ,
 .Nm pci_intx_alloc ,
-.Nm pci_intx_release
+.Nm pci_intr_release
 .Nd PCI MSI{,-X} manipulation functions
 .Sh SYNOPSIS
 .Ft int
@@ -56,16 +49,6 @@
 .Ft int
 .Fn pci_msi_alloc_exect "struct pci_attach_args *pa" \
 "pci_intr_handle_t **ihps" "int count"
-.Ft void
-.Fn pci_msi_release "pci_intr_handle_t **pihs" "int count"
-.Ft void *
-.Fn pci_msi_establish "pci_chipset_tag_t pc" "pci_intr_handle_t ih" \
-"int level" "int (*func)(void *)" "void *arg"
-.Ft void
-.Fn pci_msi_disestablish "pci_chipset_tag_t pc" "void *cookie"
-.Ft const char *
-.Ft pci_msi_string "pci_chipset_tag_t pc" \
-"pci_intr_handle_t, char *buf" "size_t len"
 .Ft int
 .Fn pci_msix_count "struct pci_attach_args *pa"
 .Ft int
@@ -77,17 +60,12 @@
 .Ft int
 .Fn pci_msix_alloc_map "struct pci_attach_args *pa" \
 "pci_intr_handle_t **ihps" "u_int *table_indexes" "int count"
-.Ft void
-.Fn pci_msix_release "pci_intr_handle_t **pihs" "int count"
-.Ft void *
-.Fn pci_msix_establish "pci_chipset_tag_t pc" "pci_intr_handle_t ih" \
-"int level" "int (*func)(void *)" "void *arg"
-.Fn pci_msix_disestablish "pci_chipset_tag_t pc" "void *cookie"
 .Ft int
 .Fn pci_intx_alloc  "struct pci_attach_args *pa" \
 "pci_intr_handle_t **ihp"
 .Ft void
-.Fn pci_intx_release "pci_intr_handle_t *pih"
+.Fn pci_intr_release "pci_chipset_tag_t pc" \
+"pci_intr_handle_t *pih" "int count"
 .Sh DESCRIPTION
 The
 .Nm
@@ -142,34 +120,34 @@ can not decrement
 .Pp
 If the driver wishes to refer to the MSI source in an attach or
 error message, it should use the value returned by
-.Fn pci_msi_string .
+.Fn pci_intr_string
+the same as INTx.
 The buffer passed to
-.Fn pci_msi_string
+.Fn pci_intr_string
 should be at least
 .Dv PCI_INTRSTR_LEN
 bytes long.
 .Pp
 Subsequently, when the driver is prepared to receive MSIs, it
 should call
-.Fn pci_msi_establish
-to actually establish the handler; when the device interrupts,
+.Fn pci_intr_establish
+the same as INTx to actually establish the handler;
+when the device interrupts,
 .Fa intrhand
 will be called with a single argument
 .Fa intrarg ,
 and will run at the interrupt priority level
 .Fa ipl .
-This is the same as
-.Fn pci_intr_establish .
 .Pp
 The return value of
-.Fn pci_msi_establish
+.Fn pci_intr_establish
 may be saved and passed to
-.Fn pci_msi_disestablish
-to disable the interrupt handler
+.Fn pci_intr_disestablish
+to disable the interrupt handler the same as INTx
 when the driver is no longer interested in MSIs from the device.
 After that, the driver should also call
-.Fn pci_msi_release
-to free resources about MSI.
+.Fn pci_intr_release
+to free resources about MSI as well as INTx and MSI-X.
 .Pp
 If a driver wishes to establish an MSI-X handler for the device,
 it is almost the same as MSI.
@@ -195,7 +173,7 @@ this way:
 If the driver wants to fall back to INTx, the driver should use
 .Fn pci_intx_alloc
 and
-.Fn pci_intx_release
+.Fn pci_intr_release
 instead of
 .Fn pci_intr_map
 to resolve contradiction of the interrupt handler ownership.
@@ -207,3 +185,5 @@ in contrast,
 and
 .Fn pci_msix_alloc
 have (the functions allocate memory for interrupt handlers).
+.Sh SEE ALSO
+.Xr pci_intr 9



CVS commit: src/sys/arch/x86

2015-05-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 15 08:36:41 UTC 2015

Modified Files:
src/sys/arch/x86/include: pci_machdep_common.h
src/sys/arch/x86/pci: pci_intr_machdep.c pci_msi_machdep.c
pci_msi_machdep.h
src/sys/arch/x86/x86: intr.c

Log Message:
pci_msi_string() must be used by MD code only.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/include/pci_machdep_common.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/pci/pci_msi_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/pci_msi_machdep.h
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/x86/x86/intr.c

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

Modified files:

Index: src/sys/arch/x86/include/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.17 src/sys/arch/x86/include/pci_machdep_common.h:1.18
--- src/sys/arch/x86/include/pci_machdep_common.h:1.17	Fri May 15 08:26:44 2015
+++ src/sys/arch/x86/include/pci_machdep_common.h	Fri May 15 08:36:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep_common.h,v 1.17 2015/05/15 08:26:44 knakahara Exp $	*/
+/*	$NetBSD: pci_machdep_common.h,v 1.18 2015/05/15 08:36:41 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -129,7 +129,6 @@ int		pci_intx_alloc(const struct pci_att
 		pci_intr_handle_t **);
 
 /* experimental MSI support */
-const char	*pci_msi_string(pci_chipset_tag_t, pci_intr_handle_t, char *, size_t);
 int		pci_msi_count(const struct pci_attach_args *);
 int		pci_msi_alloc(const struct pci_attach_args *,
 		pci_intr_handle_t **, int *);

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.32 src/sys/arch/x86/pci/pci_intr_machdep.c:1.33
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.32	Fri May 15 08:29:33 2015
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Fri May 15 08:36:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.33 2015/05/15 08:36:41 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.33 2015/05/15 08:36:41 knakahara Exp $");
 
 #include 
 #include 
@@ -226,9 +226,6 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 {
 	pci_chipset_tag_t ipc;
 
-	if (INT_VIA_MSI(ih))
-		return pci_msi_string(pc, ih, buf, len);
-
 	for (ipc = pc; ipc != NULL; ipc = ipc->pc_super) {
 		if ((ipc->pc_present & PCI_OVERRIDE_INTR_STRING) == 0)
 			continue;
@@ -236,6 +233,9 @@ pci_intr_string(pci_chipset_tag_t pc, pc
 		buf, len);
 	}
 
+	if (INT_VIA_MSI(ih))
+		return x86_pci_msi_string(pc, ih, buf, len);
+
 	return intr_string(ih & ~MPSAFE_MASK, buf, len);
 }
 

Index: src/sys/arch/x86/pci/pci_msi_machdep.c
diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.4 src/sys/arch/x86/pci/pci_msi_machdep.c:1.5
--- src/sys/arch/x86/pci/pci_msi_machdep.c:1.4	Fri May 15 08:29:33 2015
+++ src/sys/arch/x86/pci/pci_msi_machdep.c	Fri May 15 08:36:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_msi_machdep.c,v 1.4 2015/05/15 08:29:33 knakahara Exp $	*/
+/*	$NetBSD: pci_msi_machdep.c,v 1.5 2015/05/15 08:36:41 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.4 2015/05/15 08:29:33 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.5 2015/05/15 08:36:41 knakahara Exp $");
 
 #include 
 #include 
@@ -65,28 +65,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_msi_mach
 #define DPRINTF(msg)
 #endif
 
-/*
- * Return intrid for a MSI/MSI-X device.
- * "buf" must be allocated by caller.
- */
-const char *
-pci_msi_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf,
-size_t len)
-{
-	int dev, vec;
-
-	KASSERT(INT_VIA_MSI(ih));
-
-	dev = MSI_INT_DEV(ih);
-	vec = MSI_INT_VEC(ih);
-	if (MSI_INT_IS_MSIX(ih))
-		snprintf(buf, len, "msix%d vec %d", dev, vec);
-	else
-		snprintf(buf, len, "msi%d vec %d", dev, vec);
-
-	return buf;
-}
-
 static pci_intr_handle_t
 pci_msi_calculate_handle(struct pic *msi_pic, int vector)
 {
@@ -134,7 +112,7 @@ pci_msi_alloc_vectors(struct pic *msi_pi
 
 		pih = pci_msi_calculate_handle(msi_pic, table_index);
 
-		intrstr = pci_msi_string(NULL, pih, intrstr_buf,
+		intrstr = x86_pci_msi_string(NULL, pih, intrstr_buf,
 		sizeof(intrstr_buf));
 		isp = intr_allocate_io_intrsource(intrstr);
 		if (isp == NULL) {
@@ -162,7 +140,7 @@ pci_msi_free_vectors(struct pic *msi_pic
 	mutex_enter(&cpu_lock);
 	for (i = 0; i < count; i++) {
 		pih = pci_msi_calculate_handle(msi_pic, i);
-		intrstr = pci_msi_string(NULL, pih, intrstr_buf,
+		intrstr = x86_pci_msi_s

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

2015-05-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 15 08:29:33 UTC 2015

Modified Files:
src/sys/arch/x86/pci: pci_intr_machdep.c pci_msi_machdep.c

Log Message:
refactor: change function names and move them.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/pci/pci_msi_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.31 src/sys/arch/x86/pci/pci_intr_machdep.c:1.32
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.31	Fri May 15 08:26:44 2015
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Fri May 15 08:29:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.31 2015/05/15 08:26:44 knakahara Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.31 2015/05/15 08:26:44 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.32 2015/05/15 08:29:33 knakahara Exp $");
 
 #include 
 #include 
@@ -350,6 +350,20 @@ pci_intr_distribute(void *cookie, const 
 }
 
 #if NIOAPIC > 0
+static void
+x86_pci_intx_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih)
+{
+	char intrstr_buf[INTRIDBUF];
+	const char *intrstr;
+
+	intrstr = pci_intr_string(NULL, *pih, intrstr_buf, sizeof(intrstr_buf));
+	mutex_enter(&cpu_lock);
+	intr_free_io_intrsource(intrstr);
+	mutex_exit(&cpu_lock);
+
+	kmem_free(pih, sizeof(*pih));
+}
+
 int
 pci_intx_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **pih)
 {
@@ -390,20 +404,6 @@ error:
 	return error;
 }
 
-static void
-x86_pci_intx_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih)
-{
-	char intrstr_buf[INTRIDBUF];
-	const char *intrstr;
-
-	intrstr = pci_intr_string(NULL, *pih, intrstr_buf, sizeof(intrstr_buf));
-	mutex_enter(&cpu_lock);
-	intr_free_io_intrsource(intrstr);
-	mutex_exit(&cpu_lock);
-
-	kmem_free(pih, sizeof(*pih));
-}
-
 void
 pci_intr_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih, int count)
 {

Index: src/sys/arch/x86/pci/pci_msi_machdep.c
diff -u src/sys/arch/x86/pci/pci_msi_machdep.c:1.3 src/sys/arch/x86/pci/pci_msi_machdep.c:1.4
--- src/sys/arch/x86/pci/pci_msi_machdep.c:1.3	Fri May 15 08:26:44 2015
+++ src/sys/arch/x86/pci/pci_msi_machdep.c	Fri May 15 08:29:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_msi_machdep.c,v 1.3 2015/05/15 08:26:44 knakahara Exp $	*/
+/*	$NetBSD: pci_msi_machdep.c,v 1.4 2015/05/15 08:29:33 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.3 2015/05/15 08:26:44 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.4 2015/05/15 08:29:33 knakahara Exp $");
 
 #include 
 #include 
@@ -172,7 +172,7 @@ pci_msi_free_vectors(struct pic *msi_pic
 }
 
 static int
-pci_msi_alloc_md_common(pci_intr_handle_t **ihps, int *count,
+pci_msi_alloc_common(pci_intr_handle_t **ihps, int *count,
 const struct pci_attach_args *pa, bool exact)
 {
 	struct pic *msi_pic;
@@ -226,35 +226,6 @@ pci_msi_alloc_md_common(pci_intr_handle_
 	return 0;
 }
 
-static int
-pci_msi_alloc_md(pci_intr_handle_t **ihps, int *count,
-const struct pci_attach_args *pa)
-{
-
-	return pci_msi_alloc_md_common(ihps, count, pa, false);
-}
-
-static int
-pci_msi_alloc_exact_md(pci_intr_handle_t **ihps, int count,
-const struct pci_attach_args *pa)
-{
-
-	return pci_msi_alloc_md_common(ihps, &count, pa, true);
-}
-
-static void
-pci_msi_release_md(pci_intr_handle_t *pihs, int count)
-{
-	struct pic *pic;
-
-	pic = msipic_find_msi_pic(MSI_INT_DEV(pihs[0]));
-	if (pic == NULL)
-		return;
-
-	pci_msi_free_vectors(pic, pihs, count);
-	msipic_destruct_msi_pic(pic);
-}
-
 static void *
 pci_msi_common_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih,
 int level, int (*func)(void *), void *arg, struct pic *pic)
@@ -280,7 +251,7 @@ pci_msi_common_disestablish(pci_chipset_
 }
 
 static int
-pci_msix_alloc_md_common(pci_intr_handle_t **ihps, u_int *table_indexes,
+pci_msix_alloc_common(pci_intr_handle_t **ihps, u_int *table_indexes,
 int *count, const struct pci_attach_args *pa, bool exact)
 {
 	struct pic *msix_pic;
@@ -334,31 +305,60 @@ pci_msix_alloc_md_common(pci_intr_handle
 }
 
 static int
-pci_msix_alloc_md(pci_intr_handle_t **ihps, int *count,
+x86_pci_msi_alloc(pci_intr_handle_t **ihps, int *count,
 const struct pci_attach_args *pa)
 {
 
-	return pci_msix_alloc_md_common(ihps, NULL, count, pa, false);
+	return pci_msi_alloc_common(ihps, count, pa, false);
 }
 
 static int
-pci_msix_alloc_exact_md(pci_intr_handle_t **ihps, int count,
+x86_pci_msi_alloc_exact(pci_intr_handle_t **ihps, int count,
 const struct pci_a

CVS commit: src/sys/arch/x86

2015-05-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 15 08:26:44 UTC 2015

Modified Files:
src/sys/arch/x86/include: pci_machdep_common.h
src/sys/arch/x86/pci: pci_intr_machdep.c pci_msi_machdep.c
Added Files:
src/sys/arch/x86/pci: pci_msi_machdep.h

Log Message:
unify INTx, MSI and MSI-X APIs without alloc. (alloc API is under discussion)


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/pci_machdep_common.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/pci/pci_intr_machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/pci_msi_machdep.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/pci/pci_msi_machdep.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/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.16 src/sys/arch/x86/include/pci_machdep_common.h:1.17
--- src/sys/arch/x86/include/pci_machdep_common.h:1.16	Fri May  8 04:27:48 2015
+++ src/sys/arch/x86/include/pci_machdep_common.h	Fri May 15 08:26:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep_common.h,v 1.16 2015/05/08 04:27:48 knakahara Exp $	*/
+/*	$NetBSD: pci_machdep_common.h,v 1.17 2015/05/15 08:26:44 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -127,7 +127,6 @@ int		pci_intr_distribute(void *, const k
  */
 int		pci_intx_alloc(const struct pci_attach_args *,
 		pci_intr_handle_t **);
-void		pci_intx_release(pci_chipset_tag_t, pci_intr_handle_t *);
 
 /* experimental MSI support */
 const char	*pci_msi_string(pci_chipset_tag_t, pci_intr_handle_t, char *, size_t);
@@ -136,10 +135,6 @@ int		pci_msi_alloc(const struct pci_atta
 		pci_intr_handle_t **, int *);
 int		pci_msi_alloc_exact(const struct pci_attach_args *,
 		pci_intr_handle_t **, int);
-void		pci_msi_release(pci_chipset_tag_t, pci_intr_handle_t **, int);
-void		*pci_msi_establish(pci_chipset_tag_t, pci_intr_handle_t,
-		int, int (*)(void *), void *);
-void		pci_msi_disestablish(pci_chipset_tag_t, void *);
 
 /* experimental MSI-X support */
 int		pci_msix_count(const struct pci_attach_args *);
@@ -149,10 +144,9 @@ int		pci_msix_alloc_exact(const struct p
 		pci_intr_handle_t **, int);
 int		pci_msix_alloc_map(const struct pci_attach_args *,
 		pci_intr_handle_t **, u_int *, int);
-void		pci_msix_release(pci_chipset_tag_t, pci_intr_handle_t **, int);
-void		*pci_msix_establish(pci_chipset_tag_t, pci_intr_handle_t,
-		int, int (*)(void *), void *);
-void		pci_msix_disestablish(pci_chipset_tag_t, void *);
+
+void		pci_intr_release(pci_chipset_tag_t, pci_intr_handle_t *,
+		int);
 
 /*
  * ALL OF THE FOLLOWING ARE MACHINE-DEPENDENT, AND SHOULD NOT BE USED

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.30 src/sys/arch/x86/pci/pci_intr_machdep.c:1.31
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.30	Mon Apr 27 07:03:58 2015
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Fri May 15 08:26:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.30 2015/04/27 07:03:58 knakahara Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.31 2015/05/15 08:26:44 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.30 2015/04/27 07:03:58 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.31 2015/05/15 08:26:44 knakahara Exp $");
 
 #include 
 #include 
@@ -102,6 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_intr_mac
 #include 
 #include 
 #include 
+#include 
 #endif
 
 #ifdef MPBIOS
@@ -292,6 +293,13 @@ pci_intr_establish(pci_chipset_tag_t pc,
 		pc, ih, level, func, arg);
 	}
 
+	if (INT_VIA_MSI(ih)) {
+		if (MSI_INT_IS_MSIX(ih))
+			return x86_pci_msix_establish(pc, ih, level, func, arg);
+		else
+			return x86_pci_msi_establish(pc, ih, level, func, arg);
+	}
+
 	pic = &i8259_pic;
 	pin = irq = APIC_IRQ_LEGACY_IRQ(ih);
 	mpsafe = ((ih & MPSAFE_MASK) != 0);
@@ -328,6 +336,7 @@ pci_intr_disestablish(pci_chipset_tag_t 
 		return;
 	}
 
+	/* MSI/MSI-X processing is switched in intr_disestablish(). */
 	intr_disestablish(cookie);
 }
 
@@ -381,15 +390,12 @@ error:
 	return error;
 }
 
-void
-pci_intx_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih)
+static void
+x86_pci_intx_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih)
 {
 	char intrstr_buf[INTRIDBUF];
 	const char *intrstr;
 
-	if (pih == NULL)
-		return;
-
 	intrstr = pci_intr_string(NULL, *pih, intrstr_buf, sizeof(intrstr_buf));
 	mutex_enter(&cpu_lock);
 	intr_free_io_intrsource(intrstr);
@@ -397,4 +403,22 @@ pci_intx_release(pci_chipset_tag_t pc, p
 
 	kmem_free(pih, sizeof(*pih));
 }
+
+void
+pci_intr_release(pci_chipset_tag_t pc, pci_intr_handle_t *pih, int count)
+{
+	if (pih == NULL)
+		return;
+
+	if (INT_VIA_MSI(*pih)) {
+		if (MSI_INT_IS_MSIX(*pih))
+			return

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

2015-05-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri May 15 08:19:48 UTC 2015

Modified Files:
src/sys/arch/evbmips/conf: ERLITE

Log Message:
Enable ktrace by default


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/conf/ERLITE

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

Modified files:

Index: src/sys/arch/evbmips/conf/ERLITE
diff -u src/sys/arch/evbmips/conf/ERLITE:1.4 src/sys/arch/evbmips/conf/ERLITE:1.5
--- src/sys/arch/evbmips/conf/ERLITE:1.4	Fri May  8 07:45:53 2015
+++ src/sys/arch/evbmips/conf/ERLITE	Fri May 15 08:19:48 2015
@@ -1,11 +1,11 @@
-#	$NetBSD: ERLITE,v 1.4 2015/05/08 07:45:53 martin Exp $
+#	$NetBSD: ERLITE,v 1.5 2015/05/15 08:19:48 martin Exp $
 
 include 	"arch/mips/conf/std.octeon"
 include 	"arch/evbmips/conf/files.octeon"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ERLITE-$Revision: 1.4 $"
+#ident 		"ERLITE-$Revision: 1.5 $"
 
 maxusers	32
 
@@ -23,7 +23,7 @@ maxusers	32
 #options 	SOSEND_NO_LOAN
 
 # Standard system options
-#options 	KTRACE		# system call tracing support
+options 	KTRACE		# system call tracing support
 #options 	SYSVMSG		# System V message queues
 #options 	SYSVSEM		# System V semaphores
 #options 	SYSVSHM		# System V shared memory



CVS commit: src/sbin/ping6

2015-05-15 Thread Mihai Chelaru
Module Name:src
Committed By:   kefren
Date:   Fri May 15 08:02:39 UTC 2015

Modified Files:
src/sbin/ping6: ping6.8 ping6.c

Log Message:
Add options -X for deadline and -x for reply maxwait (flag names matching
FreeBSD). Unline FreeBSD, currently -x doesn't count late packets to statistics.
After discussion with, and help from ozaki-r@
Should fix PR/49896


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sbin/ping6/ping6.8
cvs rdiff -u -r1.86 -r1.87 src/sbin/ping6/ping6.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/ping6/ping6.8
diff -u src/sbin/ping6/ping6.8:1.29 src/sbin/ping6/ping6.8:1.30
--- src/sbin/ping6/ping6.8:1.29	Fri Apr 24 00:42:56 2015
+++ src/sbin/ping6/ping6.8	Fri May 15 08:02:39 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ping6.8,v 1.29 2015/04/24 00:42:56 christos Exp $
+.\"	$NetBSD: ping6.8,v 1.30 2015/05/15 08:02:39 kefren Exp $
 .\"	$KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $
 .\"
 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -55,6 +55,8 @@ packets to network hosts
 .Op Fl P Ar policy
 .Op Fl S Ar sourceaddr
 .Op Fl s Ar packetsize
+.Op Fl x Ar maxwait
+.Op Fl X Ar deadline
 .Op Ar hops ...
 .Ar host
 .Sh DESCRIPTION
@@ -269,6 +271,11 @@ This option is present for backward comp
 has no effect if
 .Fl w
 is specified.
+.It Fl x Ar maxwait
+Time in milliseconds to wait for a reply for each packet sent.
+.It Fl X Ar deadline
+Specify a timeout, in seconds, before ping exits regardless of
+how many packets have been received.
 .It Ar hops
 IPv6 addresses for intermediate nodes,
 which will be put into type 0 routing header.

Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.86 src/sbin/ping6/ping6.c:1.87
--- src/sbin/ping6/ping6.c:1.86	Fri Apr 24 00:42:56 2015
+++ src/sbin/ping6/ping6.c	Fri May 15 08:02:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping6.c,v 1.86 2015/04/24 00:42:56 christos Exp $	*/
+/*	$NetBSD: ping6.c,v 1.87 2015/05/15 08:02:39 kefren Exp $	*/
 /*	$KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $	*/
 
 /*
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c	8.1 (
 #else
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.86 2015/04/24 00:42:56 christos Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.87 2015/05/15 08:02:39 kefren Exp $");
 #endif
 #endif
 
@@ -235,6 +235,8 @@ static double tmin = 9.0;	/* min
 static double tmax = 0.0;		/* maximum round trip time */
 static double tsum = 0.0;		/* sum of all times, for doing average */
 static double tsumsq = 0.0;		/* sum of all times squared, for std. dev. */
+static double maxwait = 0.0;		/* maxwait for reply in ms */
+static double deadline = 0.0;		/* max running time in seconds */
 
 /* for node addresses */
 static u_short naflags;
@@ -278,6 +280,7 @@ static void	 summary(void);
 static void	 tvsub(struct timeval *, struct timeval *);
 static int	 setpolicy(int, char *);
 static char	*nigroup(char *);
+static double	timespec_to_sec(const struct timespec *tp);
 __dead static void	 usage(void);
 
 int
@@ -311,6 +314,8 @@ main(int argc, char *argv[])
 #ifdef IPV6_USE_MIN_MTU
 	int mflag = 0;
 #endif
+	struct timespec now;
+	double exitat = 0.0;
 
 	/* just to be sure */
 	memset(&smsghdr, 0, sizeof(smsghdr));
@@ -328,7 +333,7 @@ main(int argc, char *argv[])
 #endif /*IPSEC_POLICY_IPSEC*/
 #endif
 	while ((ch = getopt(argc, argv,
-	"a:b:c:dfHg:h:I:i:l:mnNop:qRS:s:tvwW" ADDOPTS)) != -1) {
+	"a:b:c:dfHg:h:I:i:l:mnNop:qRS:s:tvwWx:X:" ADDOPTS)) != -1) {
 #undef ADDOPTS
 		switch (ch) {
 		case 'a':
@@ -532,6 +537,18 @@ main(int argc, char *argv[])
 			options &= ~F_NOUSERDATA;
 			options |= F_FQDNOLD;
 			break;
+		case 'x':
+			maxwait = strtod(optarg, &e);
+			if (*e != '\0' || maxwait <= 0)
+errx(EXIT_FAILURE, "Bad/invalid maxwait time: "
+"%s", optarg);
+			break;
+		case 'X':
+			deadline = strtod(optarg, &e);
+			if (*e != '\0' || deadline <= 0)
+errx(EXIT_FAILURE, "Bad/invalid deadline time: "
+"%s", optarg);
+break;
 #ifdef IPSEC
 #ifdef IPSEC_POLICY_IPSEC
 		case 'P':
@@ -790,7 +807,7 @@ main(int argc, char *argv[])
 }
 #endif /*ICMP6_FILTER*/
 
-	/* let the kerel pass extension headers of incoming packets */
+	/* let the kernel pass extension headers of incoming packets */
 	if ((options & F_VERBOSE) != 0) {
 		int opton = 1;
 
@@ -1019,6 +1036,11 @@ main(int argc, char *argv[])
 			retransmit();
 	}
 
+	if (deadline > 0) {
+		clock_gettime(CLOCK_MONOTONIC, &now);
+		exitat = timespec_to_sec(&now) + deadline;
+	}
+
 	seenalrm = seenint = 0;
 #ifdef SIGINFO
 	seeninfo = 0;
@@ -1029,6 +1051,13 @@ main(int argc, char *argv[])
 		u_char buf[1024];
 		struct iovec iov[2];
 
+		/* check deadline */
+		if (exitat > 0) {
+			clock_gettime(CLOCK_MONOTONIC, &now);
+			if (exitat <= timespec_to_sec(&now))
+break;
+		}
+
 		/* signal handling */
 		if (seenalrm) {
 			retransmit();
@@ -1047,10 

CVS commit: src/sys/dev/pci

2015-05-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 15 07:59:00 UTC 2015

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_wmreg.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/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.69 src/sys/dev/pci/if_wmreg.h:1.70
--- src/sys/dev/pci/if_wmreg.h:1.69	Mon May  4 10:10:42 2015
+++ src/sys/dev/pci/if_wmreg.h	Fri May 15 07:59:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.69 2015/05/04 10:10:42 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.70 2015/05/15 07:59:00 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -315,7 +315,7 @@ struct livengood_tcpip_ctxdesc {
 #define	CTRL_EXT_SPD_BYPS	(1U << 15) /* speed select bypass */
 #define	CTRL_EXT_IPS1		(1U << 16) /* invert power state bit 1 */
 #define	CTRL_EXT_RO_DIS		(1U << 17) /* relaxed ordering disabled */
-#define	CTRL_EXT_DMA_DYN_CLK	(1U << 19) /* DMA Dymamic Gating Enable */
+#define	CTRL_EXT_DMA_DYN_CLK	(1U << 19) /* DMA Dynamic Gating Enable */
 #define	CTRL_EXT_LINK_MODE_MASK		0x00C0
 #define	CTRL_EXT_LINK_MODE_GMII		0x
 #define	CTRL_EXT_LINK_MODE_KMRN		0x



CVS commit: src/sys/compat/netbsd32

2015-05-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 15 07:56:25 UTC 2015

Modified Files:
src/sys/compat/netbsd32: netbsd32_lwp.c

Log Message:
Simplify a tiny bit.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/compat/netbsd32/netbsd32_lwp.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/compat/netbsd32/netbsd32_lwp.c
diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.17 src/sys/compat/netbsd32/netbsd32_lwp.c:1.18
--- src/sys/compat/netbsd32/netbsd32_lwp.c:1.17	Fri May 15 07:52:51 2015
+++ src/sys/compat/netbsd32/netbsd32_lwp.c	Fri May 15 07:56:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_lwp.c,v 1.17 2015/05/15 07:52:51 matt Exp $	*/
+/*	$NetBSD: netbsd32_lwp.c,v 1.18 2015/05/15 07:56:25 matt Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2006, 2007 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.17 2015/05/15 07:52:51 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.18 2015/05/15 07:56:25 matt Exp $");
 
 #include 
 #include 
@@ -291,6 +291,5 @@ netbsd32__lwp_ctl(struct lwp *l, const s
 	if ((error = lwp_ctl_alloc(&vaddr)) != 0)
 		return error;
 	NETBSD32PTR32(vaddr32, (void *)vaddr);
-	return copyout(&vaddr32, SCARG_P32(uap, address),
-	sizeof(netbsd32_pointer_t));
+	return copyout(&vaddr32, SCARG_P32(uap, address), sizeof(vaddr32));
 }



CVS commit: src/sys/compat/netbsd32

2015-05-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 15 07:52:51 UTC 2015

Modified Files:
src/sys/compat/netbsd32: netbsd32_lwp.c

Log Message:
In lwp_ctl, convert ptr to 32 bits before copyout.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/netbsd32/netbsd32_lwp.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/compat/netbsd32/netbsd32_lwp.c
diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.16 src/sys/compat/netbsd32/netbsd32_lwp.c:1.17
--- src/sys/compat/netbsd32/netbsd32_lwp.c:1.16	Fri May 15 07:45:15 2015
+++ src/sys/compat/netbsd32/netbsd32_lwp.c	Fri May 15 07:52:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_lwp.c,v 1.16 2015/05/15 07:45:15 matt Exp $	*/
+/*	$NetBSD: netbsd32_lwp.c,v 1.17 2015/05/15 07:52:51 matt Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2006, 2007 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.16 2015/05/15 07:45:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.17 2015/05/15 07:52:51 matt Exp $");
 
 #include 
 #include 
@@ -280,6 +280,7 @@ netbsd32__lwp_ctl(struct lwp *l, const s
 		syscallarg(int) features;
 		syscallarg(netbsd32_pointer_t) address;
 	} */
+	netbsd32_pointer_t vaddr32;
 	int error, features;
 	vaddr_t vaddr;
 
@@ -289,6 +290,7 @@ netbsd32__lwp_ctl(struct lwp *l, const s
 		return ENODEV;
 	if ((error = lwp_ctl_alloc(&vaddr)) != 0)
 		return error;
-	return copyout(&vaddr, SCARG_P32(uap, address),
+	NETBSD32PTR32(vaddr32, (void *)vaddr);
+	return copyout(&vaddr32, SCARG_P32(uap, address),
 	sizeof(netbsd32_pointer_t));
 }



CVS commit: src/sys/compat/netbsd32

2015-05-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri May 15 07:45:16 UTC 2015

Modified Files:
src/sys/compat/netbsd32: netbsd32_lwp.c

Log Message:
Fix _lwp_ctl for big endian 64-bit platforms.  (little-endian too but not
as noticable).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/compat/netbsd32/netbsd32_lwp.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/compat/netbsd32/netbsd32_lwp.c
diff -u src/sys/compat/netbsd32/netbsd32_lwp.c:1.15 src/sys/compat/netbsd32/netbsd32_lwp.c:1.16
--- src/sys/compat/netbsd32/netbsd32_lwp.c:1.15	Fri Mar 29 01:04:30 2013
+++ src/sys/compat/netbsd32/netbsd32_lwp.c	Fri May 15 07:45:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_lwp.c,v 1.15 2013/03/29 01:04:30 christos Exp $	*/
+/*	$NetBSD: netbsd32_lwp.c,v 1.16 2015/05/15 07:45:15 matt Exp $	*/
 
 /*
  *  Copyright (c) 2005, 2006, 2007 The NetBSD Foundation.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.15 2013/03/29 01:04:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_lwp.c,v 1.16 2015/05/15 07:45:15 matt Exp $");
 
 #include 
 #include 
@@ -280,9 +280,15 @@ netbsd32__lwp_ctl(struct lwp *l, const s
 		syscallarg(int) features;
 		syscallarg(netbsd32_pointer_t) address;
 	} */
-	struct sys__lwp_ctl_args ua;
+	int error, features;
+	vaddr_t vaddr;
 
-	NETBSD32TO64_UAP(features);
-	NETBSD32TOP_UAP(address, struct lwpctl *);
-	return sys__lwp_ctl(l, &ua, retval);
+	features = SCARG(uap, features);
+	features &= ~(LWPCTL_FEATURE_CURCPU | LWPCTL_FEATURE_PCTR);
+	if (features != 0)
+		return ENODEV;
+	if ((error = lwp_ctl_alloc(&vaddr)) != 0)
+		return error;
+	return copyout(&vaddr, SCARG_P32(uap, address),
+	sizeof(netbsd32_pointer_t));
 }