From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 01:34:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A06E4106566C; Sun, 20 Dec 2009 01:34:12 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E6C48FC17; Sun, 20 Dec 2009 01:34:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBK1YCNI048943; Sun, 20 Dec 2009 01:34:12 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBK1YCAA048942; Sun, 20 Dec 2009 01:34:12 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912200134.nBK1YCAA048942@svn.freebsd.org> From: Doug Barton Date: Sun, 20 Dec 2009 01:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 01:34:12 -0000 Author: dougb Date: Sun Dec 20 01:34:12 2009 New Revision: 200743 URL: http://svn.freebsd.org/changeset/base/200743 Log: The service command is an easy interface to the rc.d system. Its primary purpose is to start and stop services provided by the rc.d scripts, however it can also be used to list the scripts using various criteria. Added: head/usr.sbin/service/ head/usr.sbin/service/Makefile (contents, props changed) head/usr.sbin/service/service.8 (contents, props changed) head/usr.sbin/service/service.sh (contents, props changed) Modified: head/usr.sbin/Makefile Modified: head/usr.sbin/Makefile ============================================================================== --- head/usr.sbin/Makefile Sun Dec 20 01:00:41 2009 (r200742) +++ head/usr.sbin/Makefile Sun Dec 20 01:34:12 2009 (r200743) @@ -167,6 +167,7 @@ SUBDIR= ${_ac} \ ${_sa} \ ${_sade} \ ${_sendmail} \ + service \ setfib \ setfmac \ setpmac \ Added: head/usr.sbin/service/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/service/Makefile Sun Dec 20 01:34:12 2009 (r200743) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +SCRIPTS=service.sh +MAN= service.8 + +.include + Added: head/usr.sbin/service/service.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/service/service.8 Sun Dec 20 01:34:12 2009 (r200743) @@ -0,0 +1,114 @@ +.\" Copyright (c) 2009 Douglas Barton +.\" 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 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 AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd December 19, 2009 +.Dt service 8 +.Os +.Sh NAME +.Nm service +.Nd "service command manual page" +.Sh SYNOPSIS +.Nm +.Fl e +.Nm +.Op Fl v +.Fl l|r +.Nm +.Op Fl v +.Ar start|stop|etc. +.Sh DESCRIPTION +The +.Nm +command is an easy interface to the rc.d system. +Its primary purpose is to start and stop services provided +by the rc.d scripts, however it can also be used to list +the scripts using various criteria. +.Pp +The options are as follows: +.Bl -tag -width F1 +.It Fl e +List services that are enabled. +The list of scripts to check is compiled using +.Xr rcorder 8 +the same way that it is done in +.Xr rc 8 , +then that list of scripts is checked for an +.Qq rcvar +assignment. +If present the script is checked to see if it is enabled. +.It Fl l +List all files in +.Pa /etc/rc.d +and the local startup directories. +As described in +.Xr rc.conf 5 +this is usually +.Pa /usr/local/etc/rc.d . +All files will be listed whether they are an actual +rc.d script or not. +.It Fl r +Generate the +.Xr rcorder 8 +as in +.Fl e +above, but list all of the files, not just what is enabled. +.It Fl v +Be slightly more verbose +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +The following are examples of typical usage of the +.Nm +command: +.Pp +.Dl "service named status" +.Dl "service -rv" +.Pp +The following programmable completion entry can be use in +.Xr bash 1 +for the names of the rc.d scripts: +.Dl "_service () {" +.Dl " local cur" +.Dl " cur=${COMP_WORDS[COMP_CWORD]}" +.Dl " COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )" +.Dl " return 0" +.Dl "}" +.Dl "complete -F _service service" +.Sh SEE ALSO +.Xr bash 1 , +.Xr rc.conf 5 . +.Xr rc 8 , +.Xr rcorder 8 +.Sh HISTORY +The +.Nm +manual page service first appeared in +.Fx 7.3 . +.Sh AUTHORS +This +manual page was written by +.An Douglas Barton . Added: head/usr.sbin/service/service.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/service/service.sh Sun Dec 20 01:34:12 2009 (r200743) @@ -0,0 +1,120 @@ +#!/bin/sh + +# $FreeBSD$ + +# Copyright (c) 2009 Douglas Barton +# 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 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 AUTHOR 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. + +. /etc/rc.subr +load_rc_config 'XXX' + +usage () { + echo '' + echo 'Usage:' + echo "${0##*/} -e" + echo "${0##*/} [-v] -l|r" + echo "${0##*/} [-v] start|stop|etc." + echo "${0##*/} -h" + echo '' + echo '-e Show services that are enabled' + echo "-l List all scripts in /etc/rc.d and $local_startup" + echo '-r Show the results of boot time rcorder' + echo '-v Verbose' + echo '' +} + +while getopts 'ehlrv' COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + e) ENABLED=eopt ;; + h) usage ; exit 0 ;; + l) LIST=lopt ;; + r) RCORDER=ropt ;; + v) VERBOSE=vopt ;; + *) usage ; exit 1 ;; + esac +done +shift $(( $OPTIND - 1 )) + +if [ -n "$ENABLED" -o -n "$RCORDER" ]; then + # Copied from /etc/rc + skip="-s nostart" + if [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ]; then + skip="$skip -s nojail" + fi + [ -n "$local_startup" ] && find_local_scripts_new + files=`rcorder ${skip} /etc/rc.d/* ${local_rc} 2>/dev/null` +fi + +if [ -n "$ENABLED" ]; then + for file in $files; do + if grep -q ^rcvar $file; then + eval `grep ^name= $file` + eval `grep ^rcvar $file` + checkyesno $rcvar 2>/dev/null && echo $file + fi + done + exit 0 +fi + +if [ -n "$LIST" ]; then + for dir in /etc/rc.d $local_startup; do + [ -n "$VERBOSE" ] && echo "From ${dir}:" + cd $dir && for file in *; do echo $file; done + done + exit 0 +fi + +if [ -n "$RCORDER" ]; then + for file in $files; do + echo $file + if [ -n "$VERBOSE" ]; then + case "$file" in + */${early_late_divider}) + echo '========= Early/Late Divider =========' ;; + esac + fi + done + exit 0 +fi + +if [ $# -gt 1 ]; then + script=$1 + shift +else + usage + exit 1 +fi + +for dir in /etc/rc.d $local_startup; do + if [ -x "$dir/$script" ]; then + [ -n "$VERBOSE" ] && echo "$script is located in $dir" + $dir/$script $* + exit $? + fi +done + +# If the script was not found +echo "$script does not exist in /etc/rc.d or the local startup" +echo "directories (${local_startup})" +exit 1 From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 04:51:16 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB0B0106568B; Sun, 20 Dec 2009 04:51:16 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from asuka.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id EADAA8FC08; Sun, 20 Dec 2009 04:51:15 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=CRAM-MD5 bits=0) by asuka.mahoroba.org (8.14.3/8.14.3) with ESMTP/inet6 id nBK4ou9e073116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Dec 2009 13:51:00 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sun, 20 Dec 2009 13:50:55 +0900 Message-ID: From: Hajimu UMEMOTO To: Doug Barton In-Reply-To: <200912200134.nBK1YCAA048942@svn.freebsd.org> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> User-Agent: xcite1.58> Wanderlust/2.15.7 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sun_Dec_20_13:50:55_2009-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (asuka.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sun, 20 Dec 2009 13:51:00 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on asuka.mahoroba.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 04:51:17 -0000 --Multipart_Sun_Dec_20_13:50:55_2009-1 Content-Type: text/plain; charset=US-ASCII Hi, >>>>> On Sun, 20 Dec 2009 01:34:12 +0000 (UTC) >>>>> Doug Barton said: dougb> Author: dougb dougb> Date: Sun Dec 20 01:34:12 2009 dougb> New Revision: 200743 dougb> URL: http://svn.freebsd.org/changeset/base/200743 dougb> Log: dougb> The service command is an easy interface to the rc.d system. dougb> Its primary purpose is to start and stop services provided by dougb> the rc.d scripts, however it can also be used to list the scripts dougb> using various criteria. dougb> Added: dougb> head/usr.sbin/service/ dougb> head/usr.sbin/service/Makefile (contents, props changed) dougb> head/usr.sbin/service/service.8 (contents, props changed) dougb> head/usr.sbin/service/service.sh (contents, props changed) dougb> Modified: dougb> head/usr.sbin/Makefile I believe this addition is useful. I'm using similar script locally. However, we should consider the environment variables and the current directory, IMO. Could you include the attached patch? Sincerely, --Multipart_Sun_Dec_20_13:50:55_2009-1 Content-Type: text/x-patch; type=patch; charset=US-ASCII Content-Disposition: attachment; filename="service-env.diff" Content-Transfer-Encoding: 7bit Index: usr.sbin/service/service.sh diff -u usr.sbin/service/service.sh.orig usr.sbin/service/service.sh --- usr.sbin/service/service.sh.orig 2009-12-20 13:14:14.000000000 +0900 +++ usr.sbin/service/service.sh 2009-12-20 13:17:44.420246627 +0900 @@ -106,11 +106,15 @@ exit 1 fi +HOME=/ +PATH=/sbin:/bin:/usr/sbin:/usr/bin +export HOME PATH +cd $HOME + for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - $dir/$script $* - exit $? + exec env -i HOME=$HOME PATH=$PATH $dir/$script $* fi done --Multipart_Sun_Dec_20_13:50:55_2009-1 Content-Type: text/plain; charset=US-ASCII -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ --Multipart_Sun_Dec_20_13:50:55_2009-1-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 05:51:11 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FFCA106566B for ; Sun, 20 Dec 2009 05:51:11 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id A634C8FC14 for ; Sun, 20 Dec 2009 05:51:10 +0000 (UTC) Received: (qmail 2643 invoked by uid 399); 20 Dec 2009 05:51:09 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 05:51:09 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2DBB51.9060002@FreeBSD.org> Date: Sat, 19 Dec 2009 21:51:13 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Hajimu UMEMOTO References: <200912200134.nBK1YCAA048942@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 05:51:11 -0000 Hajimu UMEMOTO wrote: > I believe this addition is useful. Thanks. :) > I'm using similar script locally. > However, we should consider the environment variables and the current > directory, IMO. Could you include the attached patch? Other than the removal of "exit $?" I'm not necessarily opposed to that idea, but I'm wondering what value this change would have in the "system is already up and running" case (when it will be executed) vs. at boot time (such as in /etc/rc where the code is copied from). Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 07:09:19 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CE591065670; Sun, 20 Dec 2009 07:09:19 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from asuka.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id E7B048FC12; Sun, 20 Dec 2009 07:09:18 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=CRAM-MD5 bits=0) by asuka.mahoroba.org (8.14.3/8.14.3) with ESMTP/inet6 id nBK79BOT055083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Dec 2009 16:09:12 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sun, 20 Dec 2009 16:09:11 +0900 Message-ID: From: Hajimu UMEMOTO To: Doug Barton In-Reply-To: <4B2DBB51.9060002@FreeBSD.org> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> User-Agent: xcite1.58> Wanderlust/2.15.7 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (asuka.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sun, 20 Dec 2009 16:09:12 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on asuka.mahoroba.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 07:09:19 -0000 Hi, >>>>> On Sat, 19 Dec 2009 21:51:13 -0800 >>>>> Doug Barton said: dougb> Other than the removal of "exit $?" I'm not necessarily opposed to dougb> that idea, but I'm wondering what value this change would have in the dougb> "system is already up and running" case (when it will be executed) vs. dougb> at boot time (such as in /etc/rc where the code is copied from). I don't just remove "exit $?". Since the script is kicked by "exec", the return value from the script is returned to the process which kicked service(8), directly. About the value this change, I think it should be same as the values at boot time. I cannot imagine that someone want to restart the system daemons under the user environment. Even if someone want to do so, he still can kick /etc/rc.d/foo, directly. Further, it seems service(8) does similar thing on CentOS. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 07:30:38 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1BD11065679 for ; Sun, 20 Dec 2009 07:30:38 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 0EBD98FC19 for ; Sun, 20 Dec 2009 07:30:38 +0000 (UTC) Received: (qmail 18185 invoked by uid 399); 20 Dec 2009 07:30:37 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 07:30:37 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2DD2A1.8060907@FreeBSD.org> Date: Sat, 19 Dec 2009 23:30:41 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Hajimu UMEMOTO References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------020409080105060805010202" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 07:30:38 -0000 This is a multi-part message in MIME format. --------------020409080105060805010202 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I've reattached your original patch and included the freebsd-rc list. Hajimu UMEMOTO wrote: > Hi, > >>>>>> On Sat, 19 Dec 2009 21:51:13 -0800 >>>>>> Doug Barton said: > > dougb> Other than the removal of "exit $?" I'm not necessarily opposed to > dougb> that idea, but I'm wondering what value this change would have in the > dougb> "system is already up and running" case (when it will be executed) vs. > dougb> at boot time (such as in /etc/rc where the code is copied from). > > I don't just remove "exit $?". Since the script is kicked by "exec", > the return value from the script is returned to the process which > kicked service(8), directly. Good point, I did not read your patch carefully enough, sorry. > About the value this change, I think it should be same as the values > at boot time. I cannot imagine that someone want to restart the > system daemons under the user environment. I can actually, especially for ports. > Even if someone want to do > so, he still can kick /etc/rc.d/foo, directly. The point of adding a service(8) is to avoid needing to do that. :) > Further, it seems service(8) does similar thing on CentOS. I've already made one too-hasty comment on your suggestion, so I will take a step back and let other's chime in. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ --------------020409080105060805010202 Content-Type: text/plain; name="service-env.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="service-env.diff" Index: usr.sbin/service/service.sh diff -u usr.sbin/service/service.sh.orig usr.sbin/service/service.sh --- usr.sbin/service/service.sh.orig 2009-12-20 13:14:14.000000000 +0900 +++ usr.sbin/service/service.sh 2009-12-20 13:17:44.420246627 +0900 @@ -106,11 +106,15 @@ exit 1 fi +HOME=/ +PATH=/sbin:/bin:/usr/sbin:/usr/bin +export HOME PATH +cd $HOME + for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - $dir/$script $* - exit $? + exec env -i HOME=$HOME PATH=$PATH $dir/$script $* fi done --------------020409080105060805010202-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 09:32:05 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 509DD1065692; Sun, 20 Dec 2009 09:32:05 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from asuka.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 082888FC17; Sun, 20 Dec 2009 09:32:04 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=CRAM-MD5 bits=0) by asuka.mahoroba.org (8.14.3/8.14.3) with ESMTP/inet6 id nBK9Vu6T082261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Dec 2009 18:31:56 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sun, 20 Dec 2009 18:31:56 +0900 Message-ID: From: Hajimu UMEMOTO To: Doug Barton In-Reply-To: <4B2DD2A1.8060907@FreeBSD.org> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> User-Agent: xcite1.58> Wanderlust/2.15.7 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (asuka.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sun, 20 Dec 2009 18:31:56 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on asuka.mahoroba.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 09:32:05 -0000 Hi, >>>>> On Sat, 19 Dec 2009 23:30:41 -0800 >>>>> Doug Barton said: > About the value this change, I think it should be same as the values > at boot time. I cannot imagine that someone want to restart the > system daemons under the user environment. dougb> I can actually, especially for ports. Yup, I often do restart the services installed from ports, too. I meant that I don't want that the values of user environment are inherited to the services which is started from the user environment. > Even if someone want to do > so, he still can kick /etc/rc.d/foo, directly. dougb> The point of adding a service(8) is to avoid needing to do that. :) Yes, I hope so.:) The merit of using service(8) should be that there are more additional thing than just kicking /etc/rc.d/foo; don't inherit the values of user environment, IMO. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 10:58:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CEF81065679; Sun, 20 Dec 2009 10:58:35 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2694F8FC17; Sun, 20 Dec 2009 10:58:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKAwZia062109; Sun, 20 Dec 2009 10:58:35 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKAwZa7062108; Sun, 20 Dec 2009 10:58:35 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200912201058.nBKAwZa7062108@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 20 Dec 2009 10:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200751 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 10:58:35 -0000 Author: jh Date: Sun Dec 20 10:58:34 2009 New Revision: 200751 URL: http://svn.freebsd.org/changeset/base/200751 Log: Add fork(2), getegid(2), geteuid(2), getgid(2), getpid(2), getpgid(2), getpgrp(2), getppid(2), getsid(2) and getuid(2) to syscall table to decode their arguments correctly. OK'ed by: delphij Approved by: trasz (mentor) Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sun Dec 20 04:49:29 2009 (r200750) +++ head/usr.bin/truss/syscalls.c Sun Dec 20 10:58:34 2009 (r200751) @@ -92,6 +92,18 @@ static const char rcsid[] = struct syscall syscalls[] = { { .name = "fcntl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, + { .name = "fork", .ret_type = 1, .nargs = 0 }, + { .name = "getegid", .ret_type = 1, .nargs = 0 }, + { .name = "geteuid", .ret_type = 1, .nargs = 0 }, + { .name = "getgid", .ret_type = 1, .nargs = 0 }, + { .name = "getpid", .ret_type = 1, .nargs = 0 }, + { .name = "getpgid", .ret_type = 1, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "getpgrp", .ret_type = 1, .nargs = 0 }, + { .name = "getppid", .ret_type = 1, .nargs = 0 }, + { .name = "getsid", .ret_type = 1, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "getuid", .ret_type = 1, .nargs = 0 }, { .name = "readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 } , { Readlinkres | OUT, 1 }, { Int, 2 } } }, { .name = "lseek", .ret_type = 2, .nargs = 3, From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 11:00:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C07D01065670; Sun, 20 Dec 2009 11:00:53 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF66C8FC0A; Sun, 20 Dec 2009 11:00:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKB0r8R062214; Sun, 20 Dec 2009 11:00:53 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKB0rFr062212; Sun, 20 Dec 2009 11:00:53 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200912201100.nBKB0rFr062212@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 20 Dec 2009 11:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200752 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 11:00:53 -0000 Author: jh Date: Sun Dec 20 11:00:53 2009 New Revision: 200752 URL: http://svn.freebsd.org/changeset/base/200752 Log: Avoid sharing the file descriptor of the output file with traced processes by setting the FD_CLOEXEC flag for the output file. PR: bin/140493 Submitted by: Erik Lax OK'ed by: delphij Approved by: trasz (mentor) Modified: head/usr.bin/truss/main.c Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Sun Dec 20 10:58:34 2009 (r200751) +++ head/usr.bin/truss/main.c Sun Dec 20 11:00:53 2009 (r200752) @@ -239,6 +239,12 @@ main(int ac, char **av) if ((trussinfo->outfile = fopen(fname, "w")) == NULL) errx(1, "cannot open %s", fname); } + /* + * Set FD_CLOEXEC, so that the output file is not shared with + * the traced process. + */ + if (fcntl(fileno(trussinfo->outfile), F_SETFD, FD_CLOEXEC) == -1) + warn("fcntl()"); /* * If truss starts the process itself, it will ignore some signals -- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 11:58:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 03C58106566C; Sun, 20 Dec 2009 11:58:45 +0000 (UTC) (envelope-from nork@FreeBSD.org) Date: Sun, 20 Dec 2009 20:58:45 +0900 From: Norikatsu Shigemura To: Doug Barton Message-Id: <20091220205845.7de335cc.nork@FreeBSD.org> In-Reply-To: References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.4; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-rc@freebsd.org, Hajimu UMEMOTO Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 11:58:47 -0000 On Sun, 20 Dec 2009 18:31:56 +0900 Hajimu UMEMOTO wrote: > > About the value this change, I think it should be same as the values > > at boot time. I cannot imagine that someone want to restart the > > system daemons under the user environment. > dougb> I can actually, especially for ports. > Yup, I often do restart the services installed from ports, too. > I meant that I don't want that the values of user environment are > inherited to the services which is started from the user environment. Yes, me too. I hope to restart daemons (installed from ports and/or system) like 'on boot'. > > Even if someone want to do > > so, he still can kick /etc/rc.d/foo, directly. > dougb> The point of adding a service(8) is to avoid needing to do that. :) > Yes, I hope so.:) > The merit of using service(8) should be that there are more additional > thing than just kicking /etc/rc.d/foo; don't inherit the values of > user environment, IMO. I always kick like 'cd /; env - HOME=/ PATH=$PATH /etc/rc.d/foo'. So I want service(8) like 'cd /; env - ...'. Thank you. From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 12:10:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00D1D10656A4; Sun, 20 Dec 2009 12:10:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 32DD28FC08; Sun, 20 Dec 2009 12:10:28 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id nBKCAMwe061311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Dec 2009 14:10:22 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id nBKCALIt006360; Sun, 20 Dec 2009 14:10:21 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id nBKCAL38006359; Sun, 20 Dec 2009 14:10:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 20 Dec 2009 14:10:19 +0200 From: Kostik Belousov To: Hajimu UMEMOTO Message-ID: <20091220121019.GJ2170@deviant.kiev.zoral.com.ua> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Rmm1Stw9KgbdL9/H" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, freebsd-rc@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 12:10:30 -0000 --Rmm1Stw9KgbdL9/H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 20, 2009 at 06:31:56PM +0900, Hajimu UMEMOTO wrote: > Hi, >=20 > >>>>> On Sat, 19 Dec 2009 23:30:41 -0800 > >>>>> Doug Barton said: >=20 > > About the value this change, I think it should be same as the values > > at boot time. I cannot imagine that someone want to restart the > > system daemons under the user environment.=20 >=20 > dougb> I can actually, especially for ports. >=20 > Yup, I often do restart the services installed from ports, too. > I meant that I don't want that the values of user environment are > inherited to the services which is started from the user environment. >=20 > > Even if someone want to do > > so, he still can kick /etc/rc.d/foo, directly. >=20 > dougb> The point of adding a service(8) is to avoid needing to do that. :) >=20 > Yes, I hope so.:) > The merit of using service(8) should be that there are more additional > thing than just kicking /etc/rc.d/foo; don't inherit the values of > user environment, IMO. I fully support this. I always have to do the env -u games with several variables, LANG in particular. --Rmm1Stw9KgbdL9/H Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAksuFCsACgkQC3+MBN1Mb4j08ACgqrCLjqWS/inGPsljwVK2F+us 0A0An2jZQ76655Dks2qbYr1XHECIH2uq =vdXH -----END PGP SIGNATURE----- --Rmm1Stw9KgbdL9/H-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 14:34:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C48F1106566C; Sun, 20 Dec 2009 14:34:09 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 84A438FC0A; Sun, 20 Dec 2009 14:34:09 +0000 (UTC) Received: from toad.stack.nl (toad.stack.nl [IPv6:2001:610:1108:5010::135]) by mx1.stack.nl (Postfix) with ESMTP id DBC621DD413; Sun, 20 Dec 2009 15:34:08 +0100 (CET) Received: by toad.stack.nl (Postfix, from userid 1677) id C7B3B73FA1; Sun, 20 Dec 2009 15:34:08 +0100 (CET) Date: Sun, 20 Dec 2009 15:34:08 +0100 From: Jilles Tjoelker To: Doug Barton Message-ID: <20091220143408.GB46060@stack.nl> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B2DD2A1.8060907@FreeBSD.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org, Hajimu UMEMOTO Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 14:34:09 -0000 On Sat, Dec 19, 2009 at 11:30:41PM -0800, Doug Barton wrote: > Index: usr.sbin/service/service.sh > diff -u usr.sbin/service/service.sh.orig usr.sbin/service/service.sh > --- usr.sbin/service/service.sh.orig 2009-12-20 13:14:14.000000000 +0900 > +++ usr.sbin/service/service.sh 2009-12-20 13:17:44.420246627 +0900 > @@ -106,11 +106,15 @@ > exit 1 > fi > > +HOME=/ > +PATH=/sbin:/bin:/usr/sbin:/usr/bin > +export HOME PATH > +cd $HOME > + > for dir in /etc/rc.d $local_startup; do > if [ -x "$dir/$script" ]; then > [ -n "$VERBOSE" ] && echo "$script is located in $dir" > - $dir/$script $* > - exit $? > + exec env -i HOME=$HOME PATH=$PATH $dir/$script $* > fi > done The $* should be changed to "$@" here, to avoid inappropriate IFS splitting. (Even though rc.subr is broken in this way as well.) By the way, I agree with adding this utility. -- Jilles Tjoelker From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 15:03:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16953106566B; Sun, 20 Dec 2009 15:03:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 059908FC0A; Sun, 20 Dec 2009 15:03:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKF3vI4067751; Sun, 20 Dec 2009 15:03:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKF3v0n067749; Sun, 20 Dec 2009 15:03:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912201503.nBKF3v0n067749@svn.freebsd.org> From: Alexander Motin Date: Sun, 20 Dec 2009 15:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200753 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 15:03:58 -0000 Author: mav Date: Sun Dec 20 15:03:57 2009 New Revision: 200753 URL: http://svn.freebsd.org/changeset/base/200753 Log: Fairly set master/slave shared PIO/WDMA timings on ITE 821x controllers. Previous implementation could only limit mode, but not rise it back. Modified: head/sys/dev/ata/chipsets/ata-ite.c Modified: head/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c Sun Dec 20 11:00:53 2009 (r200752) +++ head/sys/dev/ata/chipsets/ata-ite.c Sun Dec 20 15:03:57 2009 (r200753) @@ -105,6 +105,8 @@ ata_ite_chipinit(device_t dev) pci_write_config(dev, 0x56, 0x31, 1); ctlr->setmode = ata_ite_821x_setmode; + /* No timing restrictions initally. */ + ctlr->chipset_data = (void *)0; } ctlr->ch_attach = ata_ite_ch_attach; return 0; @@ -129,6 +131,7 @@ ata_ite_821x_setmode(device_t dev, int t struct ata_channel *ch = device_get_softc(dev); int devno = (ch->unit << 1) + target; int piomode; + uint8_t *timings = (uint8_t*)(&ctlr->chipset_data); u_int8_t udmatiming[] = { 0x44, 0x42, 0x31, 0x21, 0x11, 0xa2, 0x91 }; u_int8_t chtiming[] = @@ -158,11 +161,10 @@ ata_ite_821x_setmode(device_t dev, int t (1 << (devno + 3)), 1); piomode = mode; } + timings[devno] = chtiming[ata_mode2idx(piomode)]; /* set active and recover timing (shared between master & slave) */ - if (pci_read_config(parent, 0x54 + (ch->unit << 2), 1) < - chtiming[ata_mode2idx(piomode)]) - pci_write_config(parent, 0x54 + (ch->unit << 2), - chtiming[ata_mode2idx(piomode)], 1); + pci_write_config(parent, 0x54 + (ch->unit << 2), + max(timings[ch->unit << 1], timings[(ch->unit << 1) + 1]), 1); return (mode); } From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 16:23:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0167D106566C; Sun, 20 Dec 2009 16:23:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E468C8FC0C; Sun, 20 Dec 2009 16:23:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKGNBWf069251; Sun, 20 Dec 2009 16:23:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKGNBpZ069248; Sun, 20 Dec 2009 16:23:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912201623.nBKGNBpZ069248@svn.freebsd.org> From: Alexander Motin Date: Sun, 20 Dec 2009 16:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200754 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 16:23:12 -0000 Author: mav Date: Sun Dec 20 16:23:11 2009 New Revision: 200754 URL: http://svn.freebsd.org/changeset/base/200754 Log: Add VIA CX700/VX800 chipsets SATA/PATA support. PR: kern/121521 Tested by: Alex Deiter Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Sun Dec 20 15:03:57 2009 (r200753) +++ head/sys/dev/ata/ata-pci.h Sun Dec 20 16:23:11 2009 (r200754) @@ -482,6 +482,11 @@ struct ata_pci_controller { #define ATA_VIA6410 0x31641106 #define ATA_VIA6420 0x31491106 #define ATA_VIA6421 0x32491106 +#define ATA_VIACX700IDE 0x05811106 +#define ATA_VIACX700 0x83241106 +#define ATA_VIASATAIDE 0x53241106 +#define ATA_VIAVX800 0x83531106 +#define ATA_VIAVX855 0x84091106 /* global prototypes ata-pci.c */ int ata_pci_probe(device_t dev); Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Sun Dec 20 15:03:57 2009 (r200753) +++ head/sys/dev/ata/chipsets/ata-via.c Sun Dec 20 16:23:11 2009 (r200754) @@ -59,6 +59,9 @@ static void ata_via_reset(device_t dev); static int ata_via_old_setmode(device_t dev, int target, int mode); static void ata_via_southbridge_fixup(device_t dev); static int ata_via_new_setmode(device_t dev, int target, int mode); +static int ata_via_sata_ch_attach(device_t dev); +static int ata_via_sata_getrev(device_t dev, int target); +static int ata_via_sata_setmode(device_t dev, int target, int mode); /* misc defines */ #define VIA33 0 @@ -70,6 +73,7 @@ static int ata_via_new_setmode(device_t #define VIABUG 0x02 #define VIABAR 0x04 #define VIAAHCI 0x08 +#define VIASATA 0x10 /* @@ -98,6 +102,9 @@ ata_via_probe(device_t dev) { ATA_VIA8237_5372, 0x00, VIA133, 0x00, ATA_UDMA6, "8237" }, { ATA_VIA8237_7372, 0x00, VIA133, 0x00, ATA_UDMA6, "8237" }, { ATA_VIA8251, 0x00, VIA133, 0x00, ATA_UDMA6, "8251" }, + { ATA_VIACX700, 0x00, VIA133, VIASATA, ATA_SA150, "CX700" }, + { ATA_VIAVX800, 0x00, VIA133, VIASATA, ATA_SA150, "VX800" }, + { ATA_VIAVX855, 0x00, VIA133, 0x00, ATA_UDMA6, "VX855" }, { 0, 0, 0, 0, 0, 0 }}; static struct ata_chip_id new_ids[] = {{ ATA_VIA6410, 0x00, 0, 0x00, ATA_UDMA6, "6410" }, @@ -113,7 +120,9 @@ ata_via_probe(device_t dev) if (pci_get_vendor(dev) != ATA_VIA_ID) return ENXIO; - if (pci_get_devid(dev) == ATA_VIA82C571) { + if (pci_get_devid(dev) == ATA_VIA82C571 || + pci_get_devid(dev) == ATA_VIACX700IDE || + pci_get_devid(dev) == ATA_VIASATAIDE) { if (!(ctlr->chip = ata_find_chip(dev, ids, -99))) return ENXIO; } @@ -134,12 +143,21 @@ ata_via_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; - - if (ctlr->chip->max_dma >= ATA_SA150) { - /* do we have AHCI capability ? */ - if ((ctlr->chip->cfg2 == VIAAHCI) && ata_ahci_chipinit(dev) != ENXIO) - return 0; + /* AHCI SATA */ + if (ctlr->chip->cfg2 & VIAAHCI) { + if (ata_ahci_chipinit(dev) != ENXIO) + return (0); + } + /* 2 SATA without SATA registers on first channel + 1 PATA on second */ + if (ctlr->chip->cfg2 & VIASATA) { + ctlr->ch_attach = ata_via_sata_ch_attach; + ctlr->setmode = ata_via_sata_setmode; + ctlr->getrev = ata_via_sata_getrev; + return 0; + } + /* Legacy SATA/SATA+PATA with SATA registers in BAR(5). */ + if (ctlr->chip->max_dma >= ATA_SA150) { ctlr->r_type2 = SYS_RES_IOPORT; ctlr->r_rid2 = PCIR_BAR(5); if ((ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, @@ -148,7 +166,6 @@ ata_via_chipinit(device_t dev) ctlr->ch_detach = ata_via_ch_detach; ctlr->reset = ata_via_reset; } - if (ctlr->chip->cfg2 & VIABAR) { ctlr->channels = 3; ctlr->setmode = ata_via_new_setmode; @@ -365,5 +382,37 @@ ata_via_southbridge_fixup(device_t dev) free(children, M_TEMP); } +static int +ata_via_sata_ch_attach(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_pci_ch_attach(dev)) + return ENXIO; + if (ch->unit == 0) + ch->flags |= ATA_SATA; + return (0); +} + +static int +ata_via_sata_getrev(device_t dev, int target) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ch->unit == 0) + return (1); + return (0); +} + +static int +ata_via_sata_setmode(device_t dev, int target, int mode) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ch->unit == 0) + return (mode); + return (ata_via_old_setmode(dev, target, mode)); +} + ATA_DECLARE_DRIVER(ata_via); MODULE_DEPEND(ata_via, ata_ahci, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 18:36:35 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A984C1065672; Sun, 20 Dec 2009 18:36:35 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 54FD78FC1D; Sun, 20 Dec 2009 18:36:35 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id nBKIZJDg065480; Sun, 20 Dec 2009 12:35:19 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id nBKIZJam065479; Sun, 20 Dec 2009 12:35:19 -0600 (CST) (envelope-from brooks) Date: Sun, 20 Dec 2009 12:35:19 -0600 From: Brooks Davis To: Hajimu UMEMOTO Message-ID: <20091220183519.GB64667@lor.one-eyed-alien.net> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bKyqfOwhbdpXa4YI" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Sun, 20 Dec 2009 12:35:19 -0600 (CST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Doug Barton , freebsd-rc@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 18:36:35 -0000 --bKyqfOwhbdpXa4YI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 20, 2009 at 06:31:56PM +0900, Hajimu UMEMOTO wrote: > Hi, >=20 > >>>>> On Sat, 19 Dec 2009 23:30:41 -0800 > >>>>> Doug Barton said: >=20 > > About the value this change, I think it should be same as the values > > at boot time. I cannot imagine that someone want to restart the > > system daemons under the user environment.=20 >=20 > dougb> I can actually, especially for ports. >=20 > Yup, I often do restart the services installed from ports, too. > I meant that I don't want that the values of user environment are > inherited to the services which is started from the user environment. This is where the value of service(8) would lie for me. The ability to not have things work by accident due to my environment and then break at reboot would be be very helful. -- Brooks --bKyqfOwhbdpXa4YI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFLLm5nXY6L6fI4GtQRAsamAJ9Uc/eysoLMLu5gR20go7rttMNSBACeOlj0 ShlIyRT3bWXfI95LECx09wY= =YbaP -----END PGP SIGNATURE----- --bKyqfOwhbdpXa4YI-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 18:51:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 129631065670; Sun, 20 Dec 2009 18:51:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DBDED8FC15; Sun, 20 Dec 2009 18:51:48 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 7619D46B2C; Sun, 20 Dec 2009 13:51:48 -0500 (EST) Date: Sun, 20 Dec 2009 18:51:48 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Brooks Davis In-Reply-To: <20091220183519.GB64667@lor.one-eyed-alien.net> Message-ID: References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> <20091220183519.GB64667@lor.one-eyed-alien.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Doug Barton , freebsd-rc@FreeBSD.org, Hajimu UMEMOTO , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 18:51:49 -0000 On Sun, 20 Dec 2009, Brooks Davis wrote: >>> About the value this change, I think it should be same as the values at >>> boot time. I cannot imagine that someone want to restart the system >>> daemons under the user environment. >> >> dougb> I can actually, especially for ports. >> >> Yup, I often do restart the services installed from ports, too. I meant >> that I don't want that the values of user environment are inherited to the >> services which is started from the user environment. > > This is where the value of service(8) would lie for me. The ability to not > have things work by accident due to my environment and then break at reboot > would be be very helful. There are several other types of context we've historically not properly set/restored when managing service state, such as: - Full user credential context (user IDs, group IDs, etc) - Additional login class state, such as resource limits and MAC labels - User audit state With Apple's launchd, service descriptions can include user credentials that will be set before the service is started. Being able to do that here as well would be great, especially in a future where part of our supplemental user credential will be additional system privileges. Robert N M Watson Computer Laboratory University of Cambridge From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 18:53:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA0D61065695; Sun, 20 Dec 2009 18:53:34 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B990F8FC1C; Sun, 20 Dec 2009 18:53:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKIrYKx072137; Sun, 20 Dec 2009 18:53:34 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKIrY9F072135; Sun, 20 Dec 2009 18:53:34 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912201853.nBKIrY9F072135@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 20 Dec 2009 18:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200756 - head/sys/dev/vge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 18:53:34 -0000 Author: yongari Date: Sun Dec 20 18:53:34 2009 New Revision: 200756 URL: http://svn.freebsd.org/changeset/base/200756 Log: Correct fragment bit definition in comments. Modified: head/sys/dev/vge/if_vgereg.h Modified: head/sys/dev/vge/if_vgereg.h ============================================================================== --- head/sys/dev/vge/if_vgereg.h Sun Dec 20 17:53:35 2009 (r200755) +++ head/sys/dev/vge/if_vgereg.h Sun Dec 20 18:53:34 2009 (r200756) @@ -761,8 +761,8 @@ struct vge_rx_desc { #define VGE_RDSTS_OWN 0x80000000 /* own bit. */ #define VGE_RXPKT_ONEFRAG 0x00000000 /* only one fragment */ -#define VGE_RXPKT_EOF 0x00000100 /* first frag in frame */ -#define VGE_RXPKT_SOF 0x00000200 /* last frag in frame */ +#define VGE_RXPKT_EOF 0x00000100 /* last frag in frame */ +#define VGE_RXPKT_SOF 0x00000200 /* first frag in frame */ #define VGE_RXPKT_MOF 0x00000300 /* intermediate frag */ #define VGE_RDCTL_VLANID 0x0000FFFF /* VLAN ID info */ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 19:11:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDB57106568D; Sun, 20 Dec 2009 19:11:32 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCBA08FC1D; Sun, 20 Dec 2009 19:11:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKJBWX1072670; Sun, 20 Dec 2009 19:11:32 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKJBWtt072669; Sun, 20 Dec 2009 19:11:32 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912201911.nBKJBWtt072669@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 20 Dec 2009 19:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200758 - head/sys/dev/vge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 19:11:32 -0000 Author: yongari Date: Sun Dec 20 19:11:32 2009 New Revision: 200758 URL: http://svn.freebsd.org/changeset/base/200758 Log: VT6130 datasheet was wrong. If VT6130 receive a jumbo frame the controller will split the jumbo frame into multiple RX buffers. However it seems the hardware always dma the frame to 8 bytes boundary for the split frames. Only the first part of the fragment can have 4 byte alignment and subsequent buffers should be 8 bytes aligned. Change RX buffer the alignment requirement to 8 bytes from 4 bytes. Modified: head/sys/dev/vge/if_vgevar.h Modified: head/sys/dev/vge/if_vgevar.h ============================================================================== --- head/sys/dev/vge/if_vgevar.h Sun Dec 20 18:57:43 2009 (r200757) +++ head/sys/dev/vge/if_vgevar.h Sun Dec 20 19:11:32 2009 (r200758) @@ -39,7 +39,7 @@ #define VGE_TX_RING_ALIGN 64 #define VGE_RX_RING_ALIGN 64 #define VGE_MAXTXSEGS 6 -#define VGE_RX_BUF_ALIGN sizeof(uint32_t) +#define VGE_RX_BUF_ALIGN sizeof(uint64_t) /* * VIA Velocity allows 64bit DMA addressing but high 16bits From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 19:45:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3B62106566C; Sun, 20 Dec 2009 19:45:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2D858FC1A; Sun, 20 Dec 2009 19:45:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKJjkKm073330; Sun, 20 Dec 2009 19:45:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKJjkWo073327; Sun, 20 Dec 2009 19:45:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912201945.nBKJjkWo073327@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 20 Dec 2009 19:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200759 - head/sys/dev/vge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 19:45:46 -0000 Author: yongari Date: Sun Dec 20 19:45:46 2009 New Revision: 200759 URL: http://svn.freebsd.org/changeset/base/200759 Log: Disable jumbo frame support for PCIe VT6130/VT6132 controllers. Quite contrary to VT6130 datasheet which says it supports up to 8K jumbo frame, VT6130 does not seem to send jumbo frame that is larger than 4K in length. Trying to send a frame that is larger than 4K cause TX MAC hang. Even though it's possible to allow 4K jumbo frame for VT6130, I think it's meaningless to allow 4K jumbo frame. I'm not sure VT6132 also has the same limitation but I guess it uses the same MAC of VT6130. Modified: head/sys/dev/vge/if_vge.c head/sys/dev/vge/if_vgevar.h Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Sun Dec 20 19:11:32 2009 (r200758) +++ head/sys/dev/vge/if_vge.c Sun Dec 20 19:45:46 2009 (r200759) @@ -1013,7 +1013,8 @@ vge_attach(device_t dev) if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) { sc->vge_flags |= VGE_FLAG_PCIE; sc->vge_expcap = cap; - } + } else + sc->vge_flags |= VGE_FLAG_JUMBO; if (pci_find_extcap(dev, PCIY_PMG, &cap) == 0) { sc->vge_flags |= VGE_FLAG_PMCAP; sc->vge_pmcap = cap; @@ -2221,9 +2222,17 @@ vge_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFMTU: - if (ifr->ifr_mtu > VGE_JUMBO_MTU) + VGE_LOCK(sc); + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VGE_JUMBO_MTU) error = EINVAL; - ifp->if_mtu = ifr->ifr_mtu; + else if (ifp->if_mtu != ifr->ifr_mtu) { + if (ifr->ifr_mtu > ETHERMTU && + (sc->vge_flags & VGE_FLAG_JUMBO) == 0) + error = EINVAL; + else + ifp->if_mtu = ifr->ifr_mtu; + } + VGE_UNLOCK(sc); break; case SIOCSIFFLAGS: VGE_LOCK(sc); Modified: head/sys/dev/vge/if_vgevar.h ============================================================================== --- head/sys/dev/vge/if_vgevar.h Sun Dec 20 19:11:32 2009 (r200758) +++ head/sys/dev/vge/if_vgevar.h Sun Dec 20 19:45:46 2009 (r200759) @@ -187,6 +187,7 @@ struct vge_softc { #define VGE_FLAG_PCIE 0x0001 #define VGE_FLAG_MSI 0x0002 #define VGE_FLAG_PMCAP 0x0004 +#define VGE_FLAG_JUMBO 0x0008 #define VGE_FLAG_SUSPENDED 0x4000 #define VGE_FLAG_LINK 0x8000 int vge_expcap; From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 19:50:07 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7E8A106568B for ; Sun, 20 Dec 2009 19:50:07 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id E78C98FC08 for ; Sun, 20 Dec 2009 19:50:06 +0000 (UTC) Received: (qmail 31165 invoked by uid 399); 20 Dec 2009 19:50:06 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 19:50:06 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2E7FF2.1010603@FreeBSD.org> Date: Sun, 20 Dec 2009 11:50:10 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Jilles Tjoelker References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> <20091220143408.GB46060@stack.nl> In-Reply-To: <20091220143408.GB46060@stack.nl> X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org, Hajimu UMEMOTO Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 19:50:07 -0000 Jilles Tjoelker wrote: >> + exec env -i HOME=$HOME PATH=$PATH $dir/$script $* >> fi >> done > > The $* should be changed to "$@" here, to avoid inappropriate IFS > splitting. (Even though rc.subr is broken in this way as well.) In concept I agree with you, however I want to remain bug-compatible with rc.subr, particularly in the light of the overwhelming response to make service(8) work just like things do at boot time. > By the way, I agree with adding this utility. Thank you. :) -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 20:10:52 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3D321065670 for ; Sun, 20 Dec 2009 20:10:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 963418FC1C for ; Sun, 20 Dec 2009 20:10:51 +0000 (UTC) Received: (qmail 24714 invoked by uid 399); 20 Dec 2009 20:10:50 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 20:10:50 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2E84CF.2060902@FreeBSD.org> Date: Sun, 20 Dec 2009 12:10:55 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Hajimu UMEMOTO References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------060103070006030401020109" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 20:10:52 -0000 This is a multi-part message in MIME format. --------------060103070006030401020109 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hajimu UMEMOTO wrote: > Yup, I often do restart the services installed from ports, too. > I meant that I don't want that the values of user environment are > inherited to the services which is started from the user environment. And I meant that I see the ability to start services AND inherit the user environment as a feature, however the people have spoken! :) I agree to making the change you suggested, but I would like to quibble over the format. Isn't the attached patch equivalent, and simpler? What is the value of setting HOME and PATH in the environment if we're just going to use 'env -i HOME PATH' anyway? Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ --------------060103070006030401020109 Content-Type: text/plain; name="service-env.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="service-env.diff" Index: service.8 =================================================================== --- service.8 (revision 200757) +++ service.8 (working copy) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2009 +.Dd December 20, 2009 .Dt service 8 .Os .Sh NAME @@ -44,7 +44,10 @@ .Nm command is an easy interface to the rc.d system. Its primary purpose is to start and stop services provided -by the rc.d scripts, however it can also be used to list +by the rc.d scripts. +When used for this purpose it will set the same restricted +environment that is in use at boot time (see below). +It can also be used to list the scripts using various criteria. .Pp The options are as follows: @@ -78,6 +81,20 @@ .It Fl v Be slightly more verbose .El +.Sh ENVIRONMENT +When used to run rc.d scripts the +.Nm +command sets +.Ev HOME +to +.Pa / +and +.Ev PATH +to +.Pa /sbin:/bin:/usr/sbin:/usr/bin +which is how they are set in +.Pa /etc/rc +at boot time. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Index: service.sh =================================================================== --- service.sh (revision 200757) +++ service.sh (working copy) @@ -106,11 +106,11 @@ exit 1 fi +cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - $dir/$script $* - exit $? + exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $* fi done --------------060103070006030401020109-- From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 21:31:00 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0BED106568F for ; Sun, 20 Dec 2009 21:31:00 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 453618FC2F for ; Sun, 20 Dec 2009 21:31:00 +0000 (UTC) Received: (qmail 2661 invoked by uid 399); 20 Dec 2009 21:30:59 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 20 Dec 2009 21:30:59 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2E9797.5000004@FreeBSD.org> Date: Sun, 20 Dec 2009 13:31:03 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Robert Watson References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> <20091220183519.GB64667@lor.one-eyed-alien.net> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Brooks Davis , freebsd-rc@FreeBSD.org, Hajimu UMEMOTO , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 21:31:00 -0000 Robert Watson wrote: > With Apple's launchd, service descriptions can include user credentials > that will be set before the service is started. Being able to do that > here as well would be great, especially in a future where part of our > supplemental user credential will be additional system privileges. I look forward to reviewing your patches to accomplish this. :) Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Sun Dec 20 22:55:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 845D11065676; Sun, 20 Dec 2009 22:55:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7350E8FC0C; Sun, 20 Dec 2009 22:55:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBKMtRDm077123; Sun, 20 Dec 2009 22:55:27 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBKMtRVm077121; Sun, 20 Dec 2009 22:55:27 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200912202255.nBKMtRVm077121@svn.freebsd.org> From: Ed Schouten Date: Sun, 20 Dec 2009 22:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200761 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Dec 2009 22:55:27 -0000 Author: ed Date: Sun Dec 20 22:55:27 2009 New Revision: 200761 URL: http://svn.freebsd.org/changeset/base/200761 Log: Fix indentation. Modified: head/sys/kern/subr_turnstile.c Modified: head/sys/kern/subr_turnstile.c ============================================================================== --- head/sys/kern/subr_turnstile.c Sun Dec 20 20:51:20 2009 (r200760) +++ head/sys/kern/subr_turnstile.c Sun Dec 20 22:55:27 2009 (r200761) @@ -686,7 +686,7 @@ turnstile_wait(struct turnstile *ts, str */ tc = TC_LOOKUP(ts->ts_lockobj); if (ts == td->td_turnstile) { - mtx_assert(&tc->tc_lock, MA_OWNED); + mtx_assert(&tc->tc_lock, MA_OWNED); #ifdef TURNSTILE_PROFILING tc->tc_depth++; if (tc->tc_depth > tc->tc_max_depth) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 03:28:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7056F106566B; Mon, 21 Dec 2009 03:28:05 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F8E08FC0A; Mon, 21 Dec 2009 03:28:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBL3S5Rx082712; Mon, 21 Dec 2009 03:28:05 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBL3S5fg082710; Mon, 21 Dec 2009 03:28:05 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200912210328.nBL3S5fg082710@svn.freebsd.org> From: Robert Noland Date: Mon, 21 Dec 2009 03:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200764 - head/sys/dev/agp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 03:28:05 -0000 Author: rnoland Date: Mon Dec 21 03:28:05 2009 New Revision: 200764 URL: http://svn.freebsd.org/changeset/base/200764 Log: Fix a handful of issues with via agp support. * Read the pci capability register to identify AGP 3 support * Add missing smaller aperture sizes for AGP3 chips. * Fix the aperture size calculation on AGP2 chips. All sizes between 32M and 256M reported as 256M. * Add \n to error string. This all seems to get the CLE266 EPIA-M board agp working properly, now back to work on drm. MFC after: 2 weeks Modified: head/sys/dev/agp/agp_via.c Modified: head/sys/dev/agp/agp_via.c ============================================================================== --- head/sys/dev/agp/agp_via.c Mon Dec 21 03:11:21 2009 (r200763) +++ head/sys/dev/agp/agp_via.c Mon Dec 21 03:28:05 2009 (r200764) @@ -165,39 +165,16 @@ agp_via_attach(device_t dev) struct agp_gatt *gatt; int error; u_int32_t agpsel; + u_int32_t capid; - /* XXX: This should be keying off of whether the bridge is AGP3 capable, - * rather than a bunch of device ids for chipsets that happen to do 8x. - */ - switch (pci_get_devid(dev)) { - case 0x01981106: - case 0x02591106: - case 0x02691106: - case 0x02961106: - case 0x03141106: - case 0x03241106: - case 0x03271106: - case 0x03641106: - case 0x31231106: - case 0x31681106: - case 0x31891106: - case 0x32051106: - case 0x32581106: - case 0xb1981106: - /* The newer VIA chipsets will select the AGP version based on - * what AGP versions the card supports. We still have to - * program it using the v2 registers if it has chosen to use - * compatibility mode. - */ + sc->regs = via_v2_regs; + + /* Look at the capability register to see if we handle AGP3 */ + capid = pci_read_config(dev, agp_find_caps(dev) + AGP_CAPID, 4); + if (((capid >> 20) & 0x0f) >= 3) { agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1); if ((agpsel & (1 << 1)) == 0) sc->regs = via_v3_regs; - else - sc->regs = via_v2_regs; - break; - default: - sc->regs = via_v2_regs; - break; } error = agp_generic_attach(dev); @@ -235,7 +212,7 @@ agp_via_attach(device_t dev) pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4); /* Enable the aperture. */ - gartctrl = pci_read_config(dev, sc->regs[REG_ATTBASE], 4); + gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4); pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4); } @@ -268,7 +245,7 @@ agp_via_get_aperture(device_t dev) u_int32_t apsize; if (sc->regs == via_v2_regs) { - apsize = pci_read_config(dev, sc->regs[REG_APSIZE], 1) & 0x1f; + apsize = pci_read_config(dev, sc->regs[REG_APSIZE], 1); /* * The size is determined by the number of low bits of @@ -295,8 +272,14 @@ agp_via_get_aperture(device_t dev) return 0x04000000; case 0xf38: return 0x02000000; + case 0xf3c: + return 0x01000000; + case 0xf3e: + return 0x00800000; + case 0xf3f: + return 0x00400000; default: - device_printf(dev, "Invalid aperture setting 0x%x", + device_printf(dev, "Invalid aperture setting 0x%x\n", pci_read_config(dev, sc->regs[REG_APSIZE], 2)); return 0; } @@ -345,6 +328,15 @@ agp_via_set_aperture(device_t dev, u_int case 0x02000000: key = 0xf38; break; + case 0x01000000: + key = 0xf3c; + break; + case 0x00800000: + key = 0xf3e; + break; + case 0x00400000: + key = 0xf3f; + break; default: device_printf(dev, "Invalid aperture size (%dMb)\n", aperture / 1024 / 1024); From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 11:05:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8F11065670; Mon, 21 Dec 2009 11:05:41 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id EE6CC8FC13; Mon, 21 Dec 2009 11:05:40 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 75CF86D41B; Mon, 21 Dec 2009 11:05:39 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 1B6D684530; Mon, 21 Dec 2009 12:05:39 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Doug Barton References: <200912161717.nBGHHeQZ005541@svn.freebsd.org> <200912161541.53834.jhb@freebsd.org> <868wd0cyjd.fsf@ds4.des.no> <4B2C127A.8060509@FreeBSD.org> Date: Mon, 21 Dec 2009 12:05:39 +0100 In-Reply-To: <4B2C127A.8060509@FreeBSD.org> (Doug Barton's message of "Fri, 18 Dec 2009 15:38:34 -0800") Message-ID: <86aaxcsi2k.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh , John Baldwin Subject: Re: svn commit: r200606 - in head/sys: compat/freebsd32 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 11:05:41 -0000 Doug Barton writes: > Trying to look at this from the user perspective, it's kind of silly > that if what I want is COMPAT5 I also need to add COMPAT. > > I don't know the issues in the code so I don't know what the solution > should be on the back end, but on the front end what needs to work is > that I specify the compat level I want in my kernel config, then the > code does what's necessary to make that work. So basically #ifdef FREEBSD_COMPAT4 #ifndef FREEBSD_COMPAT5 #define FREEBSD_COMPAT5 #endif #endif #ifdef FREEBSD_COMPAT5 #ifndef FREEBSD_COMPAT6 #define FREEBSD_COMPAT6 #endif #endif #ifdef FREEBSD_COMPAT6 #ifndef FREEBSD_COMPAT7 #define FREEBSD_COMPAT7 #endif #endif etc. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 12:29:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7B951065670; Mon, 21 Dec 2009 12:29:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6B6B8FC0C; Mon, 21 Dec 2009 12:29:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLCTclh027587; Mon, 21 Dec 2009 12:29:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLCTclO027581; Mon, 21 Dec 2009 12:29:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912211229.nBLCTclO027581@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 21 Dec 2009 12:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200770 - in head/sys: kern sys ufs/ffs vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 12:29:39 -0000 Author: kib Date: Mon Dec 21 12:29:38 2009 New Revision: 200770 URL: http://svn.freebsd.org/changeset/base/200770 Log: VI_OBJDIRTY vnode flag mirrors the state of OBJ_MIGHTBEDIRTY vm object flag. Besides providing the redundand information, need to update both vnode and object flags causes more acquisition of vnode interlock. OBJ_MIGHTBEDIRTY is only checked for vnode-backed vm objects. Remove VI_OBJDIRTY and make sure that OBJ_MIGHTBEDIRTY is set only for vnode-backed vm objects. Suggested and reviewed by: alc Tested by: pho MFC after: 3 weeks Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h head/sys/ufs/ffs/ffs_rawread.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Dec 21 11:29:30 2009 (r200769) +++ head/sys/kern/vfs_subr.c Mon Dec 21 12:29:38 2009 (r200770) @@ -2689,14 +2689,12 @@ vn_printf(struct vnode *vp, const char * strlcat(buf, "|VI_DOOMED", sizeof(buf)); if (vp->v_iflag & VI_FREE) strlcat(buf, "|VI_FREE", sizeof(buf)); - if (vp->v_iflag & VI_OBJDIRTY) - strlcat(buf, "|VI_OBJDIRTY", sizeof(buf)); if (vp->v_iflag & VI_DOINGINACT) strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); flags = vp->v_iflag & ~(VI_MOUNT | VI_AGE | VI_DOOMED | VI_FREE | - VI_OBJDIRTY | VI_DOINGINACT | VI_OWEINACT); + VI_DOINGINACT | VI_OWEINACT); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); @@ -3190,7 +3188,8 @@ vfs_msync(struct mount *mp, int flags) MNT_ILOCK(mp); MNT_VNODE_FOREACH(vp, mp, mvp) { VI_LOCK(vp); - if ((vp->v_iflag & VI_OBJDIRTY) && + obj = vp->v_object; + if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0 && (flags == MNT_WAIT || VOP_ISLOCKED(vp) == 0)) { MNT_IUNLOCK(mp); if (!vget(vp, Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Mon Dec 21 11:29:30 2009 (r200769) +++ head/sys/sys/vnode.h Mon Dec 21 12:29:38 2009 (r200770) @@ -237,7 +237,6 @@ struct xvnode { #define VI_AGE 0x0040 /* Insert vnode at head of free list */ #define VI_DOOMED 0x0080 /* This vnode is being recycled */ #define VI_FREE 0x0100 /* This vnode is on the freelist */ -#define VI_OBJDIRTY 0x0400 /* object might be dirty */ #define VI_DOINGINACT 0x0800 /* VOP_INACTIVE is in progress */ #define VI_OWEINACT 0x1000 /* Need to call inactive */ Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Mon Dec 21 11:29:30 2009 (r200769) +++ head/sys/ufs/ffs/ffs_rawread.c Mon Dec 21 12:29:38 2009 (r200770) @@ -101,6 +101,7 @@ ffs_rawread_sync(struct vnode *vp) int upgraded; struct bufobj *bo; struct mount *mp; + vm_object_t obj; /* Check for dirty mmap, pending writes and dirty buffers */ bo = &vp->v_bufobj; @@ -108,7 +109,8 @@ ffs_rawread_sync(struct vnode *vp) VI_LOCK(vp); if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0 || - (vp->v_iflag & VI_OBJDIRTY) != 0) { + ((obj = vp->v_object) != NULL && + (obj->flags & OBJ_MIGHTBEDIRTY) != 0)) { VI_UNLOCK(vp); BO_UNLOCK(bo); @@ -138,13 +140,12 @@ ffs_rawread_sync(struct vnode *vp) return (EIO); } /* Attempt to msync mmap() regions to clean dirty mmap */ - if ((vp->v_iflag & VI_OBJDIRTY) != 0) { + if ((obj = vp->v_object) != NULL && + (obj->flags & OBJ_MIGHTBEDIRTY) != 0) { VI_UNLOCK(vp); - if (vp->v_object != NULL) { - VM_OBJECT_LOCK(vp->v_object); - vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC); - VM_OBJECT_UNLOCK(vp->v_object); - } + VM_OBJECT_LOCK(obj); + vm_object_page_clean(obj, 0, 0, OBJPC_SYNC); + VM_OBJECT_UNLOCK(obj); } else VI_UNLOCK(vp); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Mon Dec 21 11:29:30 2009 (r200769) +++ head/sys/vm/vm_object.c Mon Dec 21 12:29:38 2009 (r200770) @@ -773,9 +773,9 @@ vm_object_page_clean(vm_object_t object, int curgeneration; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if (object->type != OBJT_VNODE || - (object->flags & OBJ_MIGHTBEDIRTY) == 0) + if ((object->flags & OBJ_MIGHTBEDIRTY) == 0) return; + KASSERT(object->type == OBJT_VNODE, ("Not a vnode object")); pagerflags = (flags & (OBJPC_SYNC | OBJPC_INVAL)) ? VM_PAGER_PUT_SYNC : VM_PAGER_CLUSTER_OK; pagerflags |= (flags & OBJPC_INVAL) ? VM_PAGER_PUT_INVAL : 0; @@ -875,18 +875,8 @@ vm_object_page_clean(vm_object_t object, pmap_remove_write(p); } - if (clearobjflags && (tstart == 0) && (tend == object->size)) { - struct vnode *vp; - + if (clearobjflags && (tstart == 0) && (tend == object->size)) vm_object_clear_flag(object, OBJ_MIGHTBEDIRTY); - if (object->type == OBJT_VNODE && - (vp = (struct vnode *)object->handle) != NULL) { - VI_LOCK(vp); - if (vp->v_iflag & VI_OBJDIRTY) - vp->v_iflag &= ~VI_OBJDIRTY; - VI_UNLOCK(vp); - } - } rescan: curgeneration = object->generation; @@ -2148,18 +2138,12 @@ vm_object_coalesce(vm_object_t prev_obje void vm_object_set_writeable_dirty(vm_object_t object) { - struct vnode *vp; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - if ((object->flags & OBJ_MIGHTBEDIRTY) != 0) + if (object->type != OBJT_VNODE || + (object->flags & OBJ_MIGHTBEDIRTY) != 0) return; vm_object_set_flag(object, OBJ_MIGHTBEDIRTY); - if (object->type == OBJT_VNODE && - (vp = (struct vnode *)object->handle) != NULL) { - VI_LOCK(vp); - vp->v_iflag |= VI_OBJDIRTY; - VI_UNLOCK(vp); - } } #include "opt_ddb.h" Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Mon Dec 21 11:29:30 2009 (r200769) +++ head/sys/vm/vm_object.h Mon Dec 21 12:29:38 2009 (r200770) @@ -154,7 +154,7 @@ struct vm_object { #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ -#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty */ +#define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_CLEANING 0x0200 #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 12:32:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC9F41065697; Mon, 21 Dec 2009 12:32:13 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC8038FC16; Mon, 21 Dec 2009 12:32:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLCWDu0027688; Mon, 21 Dec 2009 12:32:13 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLCWDlw027686; Mon, 21 Dec 2009 12:32:13 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200912211232.nBLCWDlw027686@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 21 Dec 2009 12:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200771 - head/share/examples/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 12:32:13 -0000 Author: ru Date: Mon Dec 21 12:32:13 2009 New Revision: 200771 URL: http://svn.freebsd.org/changeset/base/200771 Log: Removed one more Alpha leftover. Modified: head/share/examples/etc/make.conf Modified: head/share/examples/etc/make.conf ============================================================================== --- head/share/examples/etc/make.conf Mon Dec 21 12:29:38 2009 (r200770) +++ head/share/examples/etc/make.conf Mon Dec 21 12:32:13 2009 (r200771) @@ -36,7 +36,6 @@ # pentium3m pentium3 pentium-m pentium2 # pentiumpro pentium-mmx pentium i486 i386 # (Via CPUs) c3 c3-2 -# Alpha/AXP architecture: ev67 ev6 pca56 ev56 ev5 ev45 ev4 # AMD64 architecture: opteron, athlon64, nocona, prescott, core2 # Intel ia64 architecture: itanium2, itanium # From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 12:44:37 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E20041065672; Mon, 21 Dec 2009 12:44:37 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from asuka.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 5D7998FC15; Mon, 21 Dec 2009 12:44:37 +0000 (UTC) Received: from yuga.mahoroba.org (ume@yuga.mahoroba.org [IPv6:2001:2f0:104:8010:21b:d3ff:fe38:5381]) (user=ume mech=CRAM-MD5 bits=0) by asuka.mahoroba.org (8.14.3/8.14.3) with ESMTP/inet6 id nBLCiRie093782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Dec 2009 21:44:27 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Mon, 21 Dec 2009 21:44:27 +0900 Message-ID: From: Hajimu UMEMOTO To: Doug Barton In-Reply-To: <4B2E84CF.2060902@FreeBSD.org> References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> <4B2E84CF.2060902@FreeBSD.org> User-Agent: xcite1.58> Wanderlust/2.15.7 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (asuka.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Mon, 21 Dec 2009 21:44:28 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on asuka.mahoroba.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 12:44:38 -0000 Hi, >>>>> On Sun, 20 Dec 2009 12:10:55 -0800 >>>>> Doug Barton said: dougb> I agree to making the change you suggested, but I would like to dougb> quibble over the format. Isn't the attached patch equivalent, and dougb> simpler? What is the value of setting HOME and PATH in the environment dougb> if we're just going to use 'env -i HOME PATH' anyway? Yup, your attached patch is equivalent. However, I prefer the previous one. In anyway, I don't have a strong opinion around here. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/ From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 13:35:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 185A91065676; Mon, 21 Dec 2009 13:35:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DC2468FC17; Mon, 21 Dec 2009 13:35:57 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 940D446B32; Mon, 21 Dec 2009 08:35:57 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C3C388A021; Mon, 21 Dec 2009 08:35:55 -0500 (EST) From: John Baldwin To: "Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?=" Date: Fri, 18 Dec 2009 09:31:05 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912161717.nBGHHeQZ005541@svn.freebsd.org> <200912161541.53834.jhb@freebsd.org> <868wd0cyjd.fsf@ds4.des.no> In-Reply-To: <868wd0cyjd.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <200912180931.05406.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 21 Dec 2009 08:35:56 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh Subject: Re: svn commit: r200606 - in head/sys: compat/freebsd32 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 13:35:58 -0000 On Friday 18 December 2009 6:27:34 am Dag-Erling Sm=C3=B8rgrav wrote: > John Baldwin writes: > > Warner Losh writes: > > > Log: > > > Fix compiling FREEBSD_COMPAT[4,5,6] without FREEBSD_COMPAT7. > > > =20 > > > Note: Not sure this is the right way to do compat, but it makes the > > > headers consistent with the implementations. > > Please revert. I think this has already been reverted once before. >=20 > Yep, that was me... we concluded back then that this is a perfectly > reasonable dependency; perhaps we should simply add the appropriate > #ifndef / #error constructs so you can't define FREEBSD_COMPAT(n) > without FREEBSD_COMPAT(n+1). Yes, we probably should do that. =2D-=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 14:39:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FFA2106566B; Mon, 21 Dec 2009 14:39:46 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F3E68FC15; Mon, 21 Dec 2009 14:39:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLEdkjZ030774; Mon, 21 Dec 2009 14:39:46 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLEdkuw030772; Mon, 21 Dec 2009 14:39:46 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200912211439.nBLEdkuw030772@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 21 Dec 2009 14:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200774 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 14:39:46 -0000 Author: ru Date: Mon Dec 21 14:39:46 2009 New Revision: 200774 URL: http://svn.freebsd.org/changeset/base/200774 Log: - Eliminated hard sentence breaks. - Fixed spelling of EINVAL. - Sorted sections. Modified: head/share/man/man4/watchdog.4 Modified: head/share/man/man4/watchdog.4 ============================================================================== --- head/share/man/man4/watchdog.4 Mon Dec 21 14:03:40 2009 (r200773) +++ head/share/man/man4/watchdog.4 Mon Dec 21 14:39:46 2009 (r200774) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2003 +.Dd December 21, 2009 .Dt WATCHDOG 4 .Os .Sh NAME @@ -62,8 +62,10 @@ The .Xr ioctl 2 call will return success if just one of the available .Xr watchdog 9 -implementations supports setting the timeout to the specified timeout. This -means that at least one watchdog is armed. If the call fails, for instance if +implementations supports setting the timeout to the specified timeout. +This +means that at least one watchdog is armed. +If the call fails, for instance if none of .Xr watchdog 9 implementations support the timeout length, all watchdogs are disabled and must @@ -71,7 +73,8 @@ be explicitly re-enabled. .Pp To disable the watchdogs pass .Dv WD_TO_NEVER . -If disarming the watchdog(s) failed an error is returned. The watchdog might +If disarming the watchdog(s) failed an error is returned. +The watchdog might still be armed! .Sh RETURN VALUES The ioctl returns zero on success and non-zero on failure. @@ -80,9 +83,9 @@ The ioctl returns zero on success and no No watchdog present in the kernel (timeout value other than 0). .It Bq Er EOPNOTSUPP Watchdog could not be disabled (timeout value of 0). -.It Bq Er EINVALID +.It Bq Er EINVAL Invalid flag combination passed. -.It Bq Er EINVALID +.It Bq Er EINVAL None of the watchdogs supports the requested timeout value. .El .Sh EXAMPLES @@ -94,7 +97,7 @@ None of the watchdogs supports the reque int wdfd = -1; static void -wd_init(void) +wd_init(void) { wdfd = open(WDPATH, O_RDWR); if (wdfd == -1) @@ -116,9 +119,7 @@ wd_reset(WD_TO_NEVER); .Pp Enables a watchdog to recover from a potentially freezing piece of code. .Pp -.Bd -literal -offset indent -options SW_WATCHDOG -.Ed +.Dl "options SW_WATCHDOG" .Pp in your kernel config adds a software watchdog in the kernel, dropping to KDB or panic-ing when firing. @@ -130,10 +131,6 @@ The .Nm code first appeared in .Fx 5.1 . -.Sh BUGS -The -.Dv WD_PASSIVE -option has not yet been implemented. .Sh AUTHORS .An -nosplit The @@ -144,3 +141,7 @@ The software watchdog code and this manu .An Sean Kelly Aq smkelly@FreeBSD.org . Some contributions were made by .An Jeff Roberson Aq jeff@FreeBSD.org . +.Sh BUGS +The +.Dv WD_PASSIVE +option has not yet been implemented. From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 14:42:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9FFF1065679; Mon, 21 Dec 2009 14:42:35 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9031A8FC12; Mon, 21 Dec 2009 14:42:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLEgZDc030874; Mon, 21 Dec 2009 14:42:35 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLEgZdR030872; Mon, 21 Dec 2009 14:42:35 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200912211442.nBLEgZdR030872@svn.freebsd.org> From: Ken Smith Date: Mon, 21 Dec 2009 14:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200775 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 14:42:35 -0000 Author: kensmith Date: Mon Dec 21 14:42:35 2009 New Revision: 200775 URL: http://svn.freebsd.org/changeset/base/200775 Log: Add "FreeBSD-" to the beginning of the filenames for the ISO images. People who collect ISOs from more than just us have been requesting this for a while. MFC after: 1 week Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Mon Dec 21 14:39:46 2009 (r200774) +++ head/release/Makefile Mon Dec 21 14:42:35 2009 (r200775) @@ -1128,36 +1128,36 @@ iso.1: .if defined(CD_BOOT) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_bootonly \ - ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT} + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT} .endif @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_Install \ - ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \ + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \ ${CD_DISC1_PKGS} @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ FreeBSD_Packages \ - ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \ + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \ ${CD_DISC2_PKGS} .if defined(MAKE_DVD) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_Install \ - ${CD}/${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \ + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \ ${CD_DVD1_PKGS} .endif .if !defined(NODOC) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ FreeBSD_Documentation \ - ${CD}/${BUILDNAME}-${TARGET}-disc3.iso ${CD_DOCS} \ + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-disc3.iso ${CD_DOCS} \ ${CD_DOCS_PKGS} .endif .if defined(SEPARATE_LIVEFS) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_LiveFS \ - ${CD}/${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS} + ${CD}/FreeBSD-${BUILDNAME}-${TARGET}-livefs.iso ${CD_LIVEFS} .endif @echo "Generating MD5 and SHA256 sums..." - @(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5) - @(cd ${CD} && sha256 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256) + @(cd ${CD} && md5 *.iso > FreeBSD-${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5) + @(cd ${CD} && sha256 *.iso > FreeBSD-${BUILDNAME}-${TARGET}-iso.CHECKSUM.SHA256) touch ${.TARGET} .else @echo "Do not know how to create an ISO for ${TARGET_ARCH}." From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 14:59:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99A77106568D; Mon, 21 Dec 2009 14:59:23 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88E818FC16; Mon, 21 Dec 2009 14:59:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLExNDn031212; Mon, 21 Dec 2009 14:59:23 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLExN2i031210; Mon, 21 Dec 2009 14:59:23 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200912211459.nBLExN2i031210@svn.freebsd.org> From: Takahashi Yoshihiro Date: Mon, 21 Dec 2009 14:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200776 - head/sys/boot/pc98/kgzldr X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 14:59:23 -0000 Author: nyan Date: Mon Dec 21 14:59:23 2009 New Revision: 200776 URL: http://svn.freebsd.org/changeset/base/200776 Log: Move cursor position after putting a character. MFC after: 1 week Modified: head/sys/boot/pc98/kgzldr/crt.s Modified: head/sys/boot/pc98/kgzldr/crt.s ============================================================================== --- head/sys/boot/pc98/kgzldr/crt.s Mon Dec 21 14:42:35 2009 (r200775) +++ head/sys/boot/pc98/kgzldr/crt.s Mon Dec 21 14:59:23 2009 (r200776) @@ -75,5 +75,15 @@ crt_putchr.3: cmpw $SCR_ROW*SCR_COL*2,%d stosw # line movw $(SCR_ROW-1)*SCR_COL*2,%dx crt_putchr.4: movw %dx,(%ebx) # Update position + shrw $1,%dx +crt_putchr.5: inb $0x60,%al # Move cursor + testb $0x04,%al + jz crt_putchr.5 + movb $0x49,%al + outb %al,$0x62 + movb %dl,%al + outb %al,$0x60 + movb %dh,%al + outb %al,$0x60 popa # Restore ret # To caller From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 15:12:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C27A0106566C; Mon, 21 Dec 2009 15:12:56 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1E6D8FC20; Mon, 21 Dec 2009 15:12:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLFCuOM031524; Mon, 21 Dec 2009 15:12:56 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLFCuZG031522; Mon, 21 Dec 2009 15:12:56 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200912211512.nBLFCuZG031522@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 21 Dec 2009 15:12:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200777 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 15:12:56 -0000 Author: ru Date: Mon Dec 21 15:12:56 2009 New Revision: 200777 URL: http://svn.freebsd.org/changeset/base/200777 Log: If none of the watchdogs supports the requested timeout value, the code returns EOPNOTSUPP, not EINVAL. Modified: head/share/man/man4/watchdog.4 Modified: head/share/man/man4/watchdog.4 ============================================================================== --- head/share/man/man4/watchdog.4 Mon Dec 21 14:59:23 2009 (r200776) +++ head/share/man/man4/watchdog.4 Mon Dec 21 15:12:56 2009 (r200777) @@ -80,13 +80,13 @@ still be armed! The ioctl returns zero on success and non-zero on failure. .Bl -tag -width Er .It Bq Er EOPNOTSUPP -No watchdog present in the kernel (timeout value other than 0). +No watchdog present in the kernel or +none of the watchdogs supports the requested timeout value +(timeout value other than 0). .It Bq Er EOPNOTSUPP Watchdog could not be disabled (timeout value of 0). .It Bq Er EINVAL Invalid flag combination passed. -.It Bq Er EINVAL -None of the watchdogs supports the requested timeout value. .El .Sh EXAMPLES .Bd -literal -offset indent From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 15:50:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78981106566C; Mon, 21 Dec 2009 15:50:37 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 680FE8FC13; Mon, 21 Dec 2009 15:50:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLFobi7032320; Mon, 21 Dec 2009 15:50:37 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLFobL7032318; Mon, 21 Dec 2009 15:50:37 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <200912211550.nBLFobL7032318@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 21 Dec 2009 15:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200778 - head/usr.sbin/watchdogd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 15:50:37 -0000 Author: ru Date: Mon Dec 21 15:50:37 2009 New Revision: 200778 URL: http://svn.freebsd.org/changeset/base/200778 Log: Don't hide an error if the initial attempt to program a watchdog from within watchdogd(8) fails. This is also consistent with watchdog(8). Modified: head/usr.sbin/watchdogd/watchdogd.c Modified: head/usr.sbin/watchdogd/watchdogd.c ============================================================================== --- head/usr.sbin/watchdogd/watchdogd.c Mon Dec 21 15:12:56 2009 (r200777) +++ head/usr.sbin/watchdogd/watchdogd.c Mon Dec 21 15:50:37 2009 (r200778) @@ -95,7 +95,7 @@ main(int argc, char *argv[]) if (is_daemon) { if (watchdog_onoff(1) == -1) - exit(EX_SOFTWARE); + err(EX_OSERR, "patting the dog"); pfh = pidfile_open(pidfile, 0600, &otherpid); if (pfh == NULL) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:23:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F0EA1065672; Mon, 21 Dec 2009 17:23:05 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F206F8FC12; Mon, 21 Dec 2009 17:23:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLHN4MG034530; Mon, 21 Dec 2009 17:23:04 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLHN4RR034528; Mon, 21 Dec 2009 17:23:04 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200912211723.nBLHN4RR034528@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 21 Dec 2009 17:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200779 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:23:05 -0000 Author: des Date: Mon Dec 21 17:23:04 2009 New Revision: 200779 URL: http://svn.freebsd.org/changeset/base/200779 Log: Note that sockstat(1) does not display kernel-owned sockets. Submitted by: infofarmer@ MFC after: 2 weeks Modified: head/usr.bin/sockstat/sockstat.1 Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Mon Dec 21 15:50:37 2009 (r200778) +++ head/usr.bin/sockstat/sockstat.1 Mon Dec 21 17:23:04 2009 (r200779) @@ -167,3 +167,10 @@ The .Nm command and this manual page were written by .An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org . +.Sh BUGS +Unlike +.Xr netstat 1 , +.Nm +lists sockets by walking file descriptor tables and will not output +the ones owned by the kernel, e.g. NLM sockets created by +.Xr rpc.lockd 8 . From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:36:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0338710656B2; Mon, 21 Dec 2009 17:36:23 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-pw0-f44.google.com (mail-pw0-f44.google.com [209.85.160.44]) by mx1.freebsd.org (Postfix) with ESMTP id A60D68FC0C; Mon, 21 Dec 2009 17:36:22 +0000 (UTC) Received: by pwi15 with SMTP id 15so3621096pwi.3 for ; Mon, 21 Dec 2009 09:36:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WC+dixwzUSwspN5fJmvCpG5Ue+I4nyMCe0d21ehRaZ8=; b=CmCuJ0TsxjCt/ajaoU+Z8JNbbSPGp/2TiJuGBSowD48rL4dXVQw6YEPynZ8c7K6n6g XT0VzlZ8SXxDSzO41uZs7+cj6PIgafne1K0D8FPnShlidmtKDE79NZzsFiQOo36deBXm ZE2dNc8X5yjlrJ5nYInN2Hxfsq/SziN0oEhwk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=o0aKrYp2O4lTIVehhn2dEWB9u/FwdKYSEkcYfguvdf4+m22Qf3l4yYJFZVyPyY1oRQ 78GVPk9UUQERCwuE0mZRNpbUwXEhrktrjBewSee4z/mI1aWLCrtBITV+M6TnxjRsVldk pKunM6oCN4tP9RUNIKp/nCUvz4pLST/u3dvJI= MIME-Version: 1.0 Received: by 10.115.81.24 with SMTP id i24mr5124936wal.194.1261416982064; Mon, 21 Dec 2009 09:36:22 -0800 (PST) In-Reply-To: <200912211723.nBLHN4RR034528@svn.freebsd.org> References: <200912211723.nBLHN4RR034528@svn.freebsd.org> Date: Mon, 21 Dec 2009 09:36:21 -0800 Message-ID: From: Xin LI To: Dag-Erling Smorgrav Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200779 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:36:23 -0000 On Mon, Dec 21, 2009 at 9:23 AM, Dag-Erling Smorgrav wrot= e: > Author: des > Date: Mon Dec 21 17:23:04 2009 > New Revision: 200779 > URL: http://svn.freebsd.org/changeset/base/200779 > > Log: > =C2=A0Note that sockstat(1) does not display kernel-owned sockets. Just curious - is this easily fixable? (Perhaps not since sockstat(1) does not use libkvm?) Cheers, --=20 Xin LI http://www.delphij.net From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:38:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6308E10656A8; Mon, 21 Dec 2009 17:38:13 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51E578FC0A; Mon, 21 Dec 2009 17:38:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLHcDgR034835; Mon, 21 Dec 2009 17:38:13 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLHcD82034831; Mon, 21 Dec 2009 17:38:13 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200912211738.nBLHcD82034831@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 21 Dec 2009 17:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200780 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:38:13 -0000 Author: jh Date: Mon Dec 21 17:38:13 2009 New Revision: 200780 URL: http://svn.freebsd.org/changeset/base/200780 Log: Remove non-working special case for pipe(2) from amd64-fbsd32.c and i386-fbsd.c. Add pipe(2) to syscall table to decode it's pointer argument properly and re-add special handling for pipe(2) return value to print_syscall_ret(). PR: bin/120870 Approved by: trasz (mentor) Modified: head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd32.c Mon Dec 21 17:23:04 2009 (r200779) +++ head/usr.bin/truss/amd64-fbsd32.c Mon Dec 21 17:38:13 2009 (r200780) @@ -315,19 +315,6 @@ amd64_fbsd32_syscall_exit(struct trussin } } - /* - * The pipe syscall returns its fds in two registers and has assembly glue - * to provide the libc API, so it cannot be handled like regular syscalls. - * The nargs check is so we don't have to do yet another strcmp on every - * syscall. - */ - if (!errorp && fsc.nargs == 0 && fsc.name && strcmp(fsc.name, "pipe") == 0) { - fsc.nargs = 1; - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - asprintf(&fsc.s_args[0], "[%d,%d]", (int)retval, (int)regs.r_rdx); - retval = 0; - } - if (fsc.name != NULL && (!strcmp(fsc.name, "freebsd32_execve") || !strcmp(fsc.name, "exit"))) { trussinfo->curthread->in_syscall = 1; Modified: head/usr.bin/truss/i386-fbsd.c ============================================================================== --- head/usr.bin/truss/i386-fbsd.c Mon Dec 21 17:23:04 2009 (r200779) +++ head/usr.bin/truss/i386-fbsd.c Mon Dec 21 17:38:13 2009 (r200780) @@ -305,19 +305,6 @@ i386_syscall_exit(struct trussinfo *trus } } - /* - * The pipe syscall returns its fds in two registers and has assembly glue - * to provide the libc API, so it cannot be handled like regular syscalls. - * The nargs check is so we don't have to do yet another strcmp on every - * syscall. - */ - if (!errorp && fsc.nargs == 0 && fsc.name && strcmp(fsc.name, "pipe") == 0) { - fsc.nargs = 1; - fsc.s_args = malloc((1+fsc.nargs) * sizeof(char*)); - asprintf(&fsc.s_args[0], "[%d,%d]", (int)retval, regs.r_edx); - retval = 0; - } - if (fsc.name != NULL && (!strcmp(fsc.name, "execve") || !strcmp(fsc.name, "exit"))) { trussinfo->curthread->in_syscall = 1; Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Mon Dec 21 17:23:04 2009 (r200779) +++ head/usr.bin/truss/syscalls.c Mon Dec 21 17:38:13 2009 (r200780) @@ -242,6 +242,8 @@ struct syscall syscalls[] = { .args = { { Name | IN, 0 }, { Hex, 1 } } }, { .name = "pathconf", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Pathconf, 1 } } }, + { .name = "pipe", .ret_type = 1, .nargs = 1, + .args = { { Ptr, 0 } } }, { .name = "truncate", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, { .name = "ftruncate", .ret_type = 1, .nargs = 3, @@ -1137,6 +1139,12 @@ print_syscall_ret(struct trussinfo *trus if (errorp) { fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval, strerror(retval)); } else { + /* + * Because pipe(2) has a special assembly glue to provide the + * libc API, we have to adjust retval. + */ + if (name != NULL && !strcmp(name, "pipe")) + retval = 0; fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval, retval); } } From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:40:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8E831065693; Mon, 21 Dec 2009 17:40:52 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 988278FC17; Mon, 21 Dec 2009 17:40:52 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 81B3F1FFC1E; Mon, 21 Dec 2009 17:40:51 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 4F144844E9; Mon, 21 Dec 2009 18:40:51 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Xin LI References: <200912211723.nBLHN4RR034528@svn.freebsd.org> Date: Mon, 21 Dec 2009 18:40:51 +0100 In-Reply-To: (Xin LI's message of "Mon, 21 Dec 2009 09:36:21 -0800") Message-ID: <86tyvkrzrw.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200779 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:40:53 -0000 Xin LI writes: > Dag-Erling Smorgrav writes: > > Note that sockstat(1) does not display kernel-owned sockets. > Just curious - is this easily fixable? Not without kernel support. > (Perhaps not since sockstat(1) does not use libkvm?) *shudder* DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:41:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCE6710656CC; Mon, 21 Dec 2009 17:41:57 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABDA18FC0A; Mon, 21 Dec 2009 17:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLHfvGm034939; Mon, 21 Dec 2009 17:41:57 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLHfvxW034937; Mon, 21 Dec 2009 17:41:57 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200912211741.nBLHfvxW034937@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 21 Dec 2009 17:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200781 - head/usr.bin/truss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:41:57 -0000 Author: jh Date: Mon Dec 21 17:41:57 2009 New Revision: 200781 URL: http://svn.freebsd.org/changeset/base/200781 Log: Cast time_t values to intmax_t and use %jd with printf. OK'ed by: delphij Approved by: trasz (mentor) Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Mon Dec 21 17:38:13 2009 (r200780) +++ head/usr.bin/truss/syscalls.c Mon Dec 21 17:41:57 2009 (r200781) @@ -1161,15 +1161,15 @@ print_summary(struct trussinfo *trussinf ncall = nerror = 0; for (sc = syscalls; sc->name != NULL; sc++) if (sc->ncalls) { - fprintf(trussinfo->outfile, "%-20s%5d.%09ld%8d%8d\n", - sc->name, sc->time.tv_sec, sc->time.tv_nsec, - sc->ncalls, sc->nerror); + fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n", + sc->name, (intmax_t)sc->time.tv_sec, + sc->time.tv_nsec, sc->ncalls, sc->nerror); timespecadd(&total, &sc->time, &total); ncall += sc->ncalls; nerror += sc->nerror; } fprintf(trussinfo->outfile, "%20s%15s%8s%8s\n", "", "-------------", "-------", "-------"); - fprintf(trussinfo->outfile, "%-20s%5d.%09ld%8d%8d\n", - "", total.tv_sec, total.tv_nsec, ncall, nerror); + fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n", + "", (intmax_t)total.tv_sec, total.tv_nsec, ncall, nerror); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 17:55:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40FC7106568D; Mon, 21 Dec 2009 17:55:14 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 168298FC18; Mon, 21 Dec 2009 17:55:14 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id B7B2746B2D; Mon, 21 Dec 2009 12:55:13 -0500 (EST) Date: Mon, 21 Dec 2009 17:55:13 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Xin LI In-Reply-To: Message-ID: References: <200912211723.nBLHN4RR034528@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="621616949-2080532969-1261418113=:73550" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dag-Erling Smorgrav Subject: Re: svn commit: r200779 - head/usr.bin/sockstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 17:55:14 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-2080532969-1261418113=:73550 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 21 Dec 2009, Xin LI wrote: > On Mon, Dec 21, 2009 at 9:23 AM, Dag-Erling Smorgrav wrote: >> Author: des >> Date: Mon Dec 21 17:23:04 2009 >> New Revision: 200779 >> URL: http://svn.freebsd.org/changeset/base/200779 >> >> Log: >>  Note that sockstat(1) does not display kernel-owned sockets. > > Just curious - is this easily fixable? (Perhaps not since sockstat(1) does > not use libkvm?) Not really, and it's not 100% clear to me it's desirable to fix. sockstat, fstat, and procstat work by walking the list of processes, and for each process, then walking its file descriptor table. This means that a single socket may not appear if it's not in use by any process (as with nlm, NFS server, etc, where the sockets don't even have file descriptors), or it may appear multiple times (if it's in use by more than one process -- think apache listen sockets). To list sockets that have no process linkage, you'd need to change its underlying model of operation, and right now we simply don't keep global lists of sockets (because global lists are expensive and unnecessary). I'm actually not sure I consider this a bug, so perhaps the comment should be moved to the IMPLEMENTATION NOTES section. The point of these tools is to generate lists by process. netstat works in a completely different way, by walking the connection lists in the TCP/IP code, and therefore will list them, since they have full socket state at that layer. Robert N M Watson Computer Laboratory University of Cambridge --621616949-2080532969-1261418113=:73550-- From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:15:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4D13106566B; Mon, 21 Dec 2009 19:15:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3C0A8FC19; Mon, 21 Dec 2009 19:15:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJFUrm037745; Mon, 21 Dec 2009 19:15:30 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJFU2w037743; Mon, 21 Dec 2009 19:15:30 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211915.nBLJFU2w037743@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200793 - head/usr.bin/finger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:15:30 -0000 Author: delphij Date: Mon Dec 21 19:15:30 2009 New Revision: 200793 URL: http://svn.freebsd.org/changeset/base/200793 Log: Plug a memory leak. PR: bin/141836 Submitted by: Henning Petersen MFC after: 2 weeks Modified: head/usr.bin/finger/finger.c Modified: head/usr.bin/finger/finger.c ============================================================================== --- head/usr.bin/finger/finger.c Mon Dec 21 18:56:55 2009 (r200792) +++ head/usr.bin/finger/finger.c Mon Dec 21 19:15:30 2009 (r200793) @@ -373,6 +373,7 @@ net: for (p = nargv; *p;) { printf("\n"); } + free(used); if (entries == 0) return; From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:18:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FBB91065697; Mon, 21 Dec 2009 19:18:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB178FC1E; Mon, 21 Dec 2009 19:18:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJIRiF037835; Mon, 21 Dec 2009 19:18:27 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJIRYY037833; Mon, 21 Dec 2009 19:18:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211918.nBLJIRYY037833@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200794 - head/bin/pax X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:18:27 -0000 Author: delphij Date: Mon Dec 21 19:18:27 2009 New Revision: 200794 URL: http://svn.freebsd.org/changeset/base/200794 Log: Plug a memory leak. PR: bin/141835 Submitted by: Henning Petersen MFC after: 2 weeks Modified: head/bin/pax/sel_subs.c Modified: head/bin/pax/sel_subs.c ============================================================================== --- head/bin/pax/sel_subs.c Mon Dec 21 19:15:30 2009 (r200793) +++ head/bin/pax/sel_subs.c Mon Dec 21 19:18:27 2009 (r200794) @@ -396,6 +396,7 @@ trng_add(char *str) default: paxwarn(1, "Bad option %c with time range %s", *flgpt, str); + free(pt); goto out; } ++flgpt; From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:27:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17C82106566B; Mon, 21 Dec 2009 19:27:53 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E13D98FC15; Mon, 21 Dec 2009 19:27:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJRqJN038069; Mon, 21 Dec 2009 19:27:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJRqCm038066; Mon, 21 Dec 2009 19:27:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211927.nBLJRqCm038066@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200795 - head/usr.sbin/burncd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:27:53 -0000 Author: delphij Date: Mon Dec 21 19:27:52 2009 New Revision: 200795 URL: http://svn.freebsd.org/changeset/base/200795 Log: Add support of using environment variable BURNCD_SPEED to specify recodring speed. PR: bin/140530 Submitted by: Alexander Best MFC after: 1 month Modified: head/usr.sbin/burncd/burncd.8 head/usr.sbin/burncd/burncd.c Modified: head/usr.sbin/burncd/burncd.8 ============================================================================== --- head/usr.sbin/burncd/burncd.8 Mon Dec 21 19:18:27 2009 (r200794) +++ head/usr.sbin/burncd/burncd.8 Mon Dec 21 19:27:52 2009 (r200795) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2005 +.Dd December 21, 2009 .Os .Dt BURNCD 8 .Sh NAME @@ -158,7 +158,11 @@ refers to stdin, and can only be used on .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : -.Bl -tag -width ".Ev CDROM" +.Bl -tag -width ".Ev BURNCD_SPEED" +.It Ev BURNCD_SPEED +The write speed to use if one is not specified with the +.Fl s +flag. .It Ev CDROM The CD device to use if one is not specified with the .Fl f Modified: head/usr.sbin/burncd/burncd.c ============================================================================== --- head/usr.sbin/burncd/burncd.c Mon Dec 21 19:18:27 2009 (r200794) +++ head/usr.sbin/burncd/burncd.c Mon Dec 21 19:27:52 2009 (r200795) @@ -80,11 +80,13 @@ main(int argc, char **argv) int dao = 0, eject = 0, fixate = 0, list = 0, multi = 0, preemp = 0; int nogap = 0, speed = 4 * 177, test_write = 0, force = 0; int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0; - const char *dev; + const char *dev, *env_speed; if ((dev = getenv("CDROM")) == NULL) dev = "/dev/acd0"; + env_speed = getenv("BURNCD_SPEED"); + while ((ch = getopt(argc, argv, "def:Flmnpqs:tv")) != -1) { switch (ch) { case 'd': @@ -124,12 +126,7 @@ main(int argc, char **argv) break; case 's': - if (strcasecmp("max", optarg) == 0) - speed = CDR_MAX_SPEED; - else - speed = atoi(optarg) * 177; - if (speed <= 0) - errx(EX_USAGE, "Invalid speed: %s", optarg); + env_speed = optarg; break; case 't': @@ -147,6 +144,15 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (env_speed == NULL) + ; + else if (strcasecmp("max", env_speed) == 0) + speed = CDR_MAX_SPEED; + else + speed = atoi(env_speed) * 177; + if (speed <= 0) + errx(EX_USAGE, "Invalid speed: %s", optarg); + if (argc == 0) usage(); From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:39:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D8D1065672; Mon, 21 Dec 2009 19:39:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FE458FC24; Mon, 21 Dec 2009 19:39:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJdApn038321; Mon, 21 Dec 2009 19:39:10 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJdAl5038307; Mon, 21 Dec 2009 19:39:10 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912211939.nBLJdAl5038307@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 21 Dec 2009 19:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200796 - in head: sbin/dumpfs sbin/mount sbin/tunefs sys/sys sys/ufs/ffs sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:39:10 -0000 Author: trasz Date: Mon Dec 21 19:39:10 2009 New Revision: 200796 URL: http://svn.freebsd.org/changeset/base/200796 Log: Implement NFSv4 ACL support for UFS. Reviewed by: rwatson Modified: head/sbin/dumpfs/dumpfs.c head/sbin/mount/mntopts.h head/sbin/mount/mount.8 head/sbin/mount/mount.c head/sbin/tunefs/tunefs.8 head/sbin/tunefs/tunefs.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c head/sys/ufs/ffs/fs.h head/sys/ufs/ufs/acl.h head/sys/ufs/ufs/ufs_acl.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/dumpfs/dumpfs.c Mon Dec 21 19:39:10 2009 (r200796) @@ -251,8 +251,11 @@ dumpfs(const char *name) printf("gjournal "); if (fsflags & FS_FLAGS_UPDATED) printf("fs_flags expanded "); + if (fsflags & FS_NFS4ACLS) + printf("nfsv4acls "); fsflags &= ~(FS_UNCLEAN | FS_DOSOFTDEP | FS_NEEDSFSCK | FS_INDEXDIRS | - FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED); + FS_ACLS | FS_MULTILABEL | FS_GJOURNAL | FS_FLAGS_UPDATED | + FS_NFS4ACLS); if (fsflags != 0) printf("unknown flags (%#x)", fsflags); putchar('\n'); Modified: head/sbin/mount/mntopts.h ============================================================================== --- head/sbin/mount/mntopts.h Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/mount/mntopts.h Mon Dec 21 19:39:10 2009 (r200796) @@ -54,6 +54,7 @@ struct mntopt { #define MOPT_SNAPSHOT { "snapshot", 0, MNT_SNAPSHOT, 0 } #define MOPT_MULTILABEL { "multilabel", 0, MNT_MULTILABEL, 0 } #define MOPT_ACLS { "acls", 0, MNT_ACLS, 0 } +#define MOPT_NFS4ACLS { "nfsv4acls", 0, MNT_NFS4ACLS, 0 } /* Control flags. */ #define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } @@ -87,7 +88,8 @@ struct mntopt { MOPT_NOCLUSTERR, \ MOPT_NOCLUSTERW, \ MOPT_MULTILABEL, \ - MOPT_ACLS + MOPT_ACLS, \ + MOPT_NFS4ACLS void getmntopts(const char *, const struct mntopt *, int *, int *); void rmslashes(char *, char *); Modified: head/sbin/mount/mount.8 ============================================================================== --- head/sbin/mount/mount.8 Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/mount/mount.8 Mon Dec 21 19:39:10 2009 (r200796) @@ -120,11 +120,14 @@ takes effect. The following options are available: .Bl -tag -width indent .It Cm acls -Enable Access Control Lists, or ACLS, which can be customized via the +Enable POSIX.1e Access Control Lists, or ACLs, which can be customized via the .Xr setfacl 1 and .Xr getfacl 1 commands. +This flag is mutually exclusive with +.Cm nfsv4acls +flag. .It Cm async All .Tn I/O @@ -186,6 +189,15 @@ See .Xr mac 4 for more information, which cause the multilabel mount flag to be set automatically at mount-time. +.It Cm nfsv4acls +Enable NFSv4 ACLs, which can be customized via the +.Xr setfacl 1 +and +.Xr getfacl 1 +commands. +This flag is mutually exclusive with +.Cm acls +flag. .It Cm noasync Metadata I/O should be done synchronously, while data I/O should be done asynchronously. Modified: head/sbin/mount/mount.c ============================================================================== --- head/sbin/mount/mount.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/mount/mount.c Mon Dec 21 19:39:10 2009 (r200796) @@ -111,6 +111,7 @@ static struct opt { { MNT_SOFTDEP, "soft-updates" }, { MNT_MULTILABEL, "multilabel" }, { MNT_ACLS, "acls" }, + { MNT_NFS4ACLS, "nfsv4acls" }, { MNT_GJOURNAL, "gjournal" }, { 0, NULL } }; @@ -918,6 +919,7 @@ flags2opts(int flags) if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir"); if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel"); if (flags & MNT_ACLS) res = catopt(res, "acls"); + if (flags & MNT_NFS4ACLS) res = catopt(res, "nfsv4acls"); return (res); } Modified: head/sbin/tunefs/tunefs.8 ============================================================================== --- head/sbin/tunefs/tunefs.8 Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/tunefs/tunefs.8 Mon Dec 21 19:39:10 2009 (r200796) @@ -44,6 +44,7 @@ .Op Fl L Ar volname .Op Fl l Cm enable | disable .Op Fl m Ar minfree +.Op Fl N Cm enable | disable .Op Fl n Cm enable | disable .Op Fl o Cm space | time .Op Fl p @@ -70,7 +71,7 @@ this option will cause all backups to be primary super-block. This is potentially dangerous - use with caution. .It Fl a Cm enable | disable -Turn on/off the administrative ACL enable flag. +Turn on/off the administrative POSIX.1e ACL enable flag. .It Fl e Ar maxbpg Indicate the maximum number of blocks any single file can allocate out of a cylinder group before it is forced to begin @@ -114,6 +115,8 @@ factor of three over the performance obt If the value is raised above the current usage level, users will be unable to allocate files until enough files have been deleted to get under the higher threshold. +.It Fl N Cm enable | disable +Turn on/off the administrative NFSv4 ACL enable flag. .It Fl n Cm enable | disable Turn on/off soft updates. .It Fl o Cm space | time Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sbin/tunefs/tunefs.c Mon Dec 21 19:39:10 2009 (r200796) @@ -76,12 +76,12 @@ void printfs(void); int main(int argc, char *argv[]) { - char *avalue, *Jvalue, *Lvalue, *lvalue, *nvalue; + char *avalue, *Jvalue, *Lvalue, *lvalue, *Nvalue, *nvalue; const char *special, *on; const char *name; int active; int Aflag, aflag, eflag, evalue, fflag, fvalue, Jflag, Lflag, lflag; - int mflag, mvalue, nflag, oflag, ovalue, pflag, sflag, svalue; + int mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag, svalue; int ch, found_arg, i; const char *chg[2]; struct ufs_args args; @@ -90,12 +90,12 @@ main(int argc, char *argv[]) if (argc < 3) usage(); Aflag = aflag = eflag = fflag = Jflag = Lflag = lflag = mflag = 0; - nflag = oflag = pflag = sflag = 0; - avalue = Jvalue = Lvalue = lvalue = nvalue = NULL; + Nflag = nflag = oflag = pflag = sflag = 0; + avalue = Jvalue = Lvalue = lvalue = Nvalue = nvalue = NULL; evalue = fvalue = mvalue = ovalue = svalue = 0; active = 0; found_arg = 0; /* At least one arg is required. */ - while ((ch = getopt(argc, argv, "Aa:e:f:J:L:l:m:n:o:ps:")) != -1) + while ((ch = getopt(argc, argv, "Aa:e:f:J:L:l:m:N:n:o:ps:")) != -1) switch (ch) { case 'A': @@ -105,7 +105,7 @@ main(int argc, char *argv[]) case 'a': found_arg = 1; - name = "ACLs"; + name = "POSIX.1e ACLs"; avalue = optarg; if (strcmp(avalue, "enable") && strcmp(avalue, "disable")) { @@ -187,6 +187,18 @@ main(int argc, char *argv[]) mflag = 1; break; + case 'N': + found_arg = 1; + name = "NFSv4 ACLs"; + Nvalue = optarg; + if (strcmp(Nvalue, "enable") && + strcmp(Nvalue, "disable")) { + errx(10, "bad %s (options are %s)", + name, "`enable' or `disable'"); + } + Nflag = 1; + break; + case 'n': found_arg = 1; name = "soft updates"; @@ -255,10 +267,13 @@ main(int argc, char *argv[]) strlcpy(sblock.fs_volname, Lvalue, MAXVOLLEN); } if (aflag) { - name = "ACLs"; + name = "POSIX.1e ACLs"; if (strcmp(avalue, "enable") == 0) { if (sblock.fs_flags & FS_ACLS) { warnx("%s remains unchanged as enabled", name); + } else if (sblock.fs_flags & FS_NFS4ACLS) { + warnx("%s and NFSv4 ACLs are mutually " + "exclusive", name); } else { sblock.fs_flags |= FS_ACLS; warnx("%s set", name); @@ -349,6 +364,29 @@ main(int argc, char *argv[]) warnx(OPTWARN, "space", "<", MINFREE); } } + if (Nflag) { + name = "NFSv4 ACLs"; + if (strcmp(Nvalue, "enable") == 0) { + if (sblock.fs_flags & FS_NFS4ACLS) { + warnx("%s remains unchanged as enabled", name); + } else if (sblock.fs_flags & FS_ACLS) { + warnx("%s and POSIX.1e ACLs are mutually " + "exclusive", name); + } else { + sblock.fs_flags |= FS_NFS4ACLS; + warnx("%s set", name); + } + } else if (strcmp(Nvalue, "disable") == 0) { + if ((~sblock.fs_flags & FS_NFS4ACLS) == + FS_NFS4ACLS) { + warnx("%s remains unchanged as disabled", + name); + } else { + sblock.fs_flags &= ~FS_NFS4ACLS; + warnx("%s cleared", name); + } + } + } if (nflag) { name = "soft updates"; if (strcmp(nvalue, "enable") == 0) { @@ -423,16 +461,18 @@ usage(void) fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]", " [-J enable | disable ] [-L volname] [-l enable | disable]", -" [-m minfree] [-n enable | disable] [-o space | time] [-p]", -" [-s avgfpdir] special | filesystem"); +" [-m minfree] [-N enable | disable] [-n enable | disable]", +" [-o space | time] [-p] [-s avgfpdir] special | filesystem"); exit(2); } void printfs(void) { - warnx("ACLs: (-a) %s", + warnx("POSIX.1e ACLs: (-a) %s", (sblock.fs_flags & FS_ACLS)? "enabled" : "disabled"); + warnx("NFSv4 ACLs: (-N) %s", + (sblock.fs_flags & FS_NFS4ACLS)? "enabled" : "disabled"); warnx("MAC multilabel: (-l) %s", (sblock.fs_flags & FS_MULTILABEL)? "enabled" : "disabled"); warnx("soft updates: (-n) %s", Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/sys/mount.h Mon Dec 21 19:39:10 2009 (r200796) @@ -239,6 +239,7 @@ void __mnt_vnode_markerfree(str #define MNT_NOATIME 0x10000000 /* disable update of file access time */ #define MNT_NOCLUSTERR 0x40000000 /* disable cluster read */ #define MNT_NOCLUSTERW 0x80000000 /* disable cluster write */ +#define MNT_NFS4ACLS 0x00000010 /* * NFS export related mount flags. @@ -274,7 +275,7 @@ void __mnt_vnode_markerfree(str MNT_ROOTFS | MNT_NOATIME | MNT_NOCLUSTERR| \ MNT_NOCLUSTERW | MNT_SUIDDIR | MNT_SOFTDEP | \ MNT_IGNORE | MNT_EXPUBLIC | MNT_NOSYMFOLLOW | \ - MNT_GJOURNAL | MNT_MULTILABEL | MNT_ACLS) + MNT_GJOURNAL | MNT_MULTILABEL | MNT_ACLS | MNT_NFS4ACLS) /* Mask of flags that can be updated. */ #define MNT_UPDATEMASK (MNT_NOSUID | MNT_NOEXEC | \ @@ -282,7 +283,7 @@ void __mnt_vnode_markerfree(str MNT_NOATIME | \ MNT_NOSYMFOLLOW | MNT_IGNORE | \ MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR | \ - MNT_ACLS | MNT_USER) + MNT_ACLS | MNT_USER | MNT_NFS4ACLS) /* * External filesystem command modifier flags. @@ -300,10 +301,6 @@ void __mnt_vnode_markerfree(str #define MNT_CMDFLAGS (MNT_UPDATE | MNT_DELEXPORT | MNT_RELOAD | \ MNT_FORCE | MNT_SNAPSHOT | MNT_BYFSID) /* - * Still available. - */ -#define MNT_SPARE_0x00000010 0x00000010 -/* * Internal filesystem control flags stored in mnt_kern_flag. * * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Dec 21 19:39:10 2009 (r200796) @@ -128,7 +128,7 @@ static struct buf_ops ffs_ops = { static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "noclusterw", "noexec", "export", "force", "from", "multilabel", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync", - "union", NULL }; + "union", "nfsv4acls", NULL }; static int ffs_mount(struct mount *mp) @@ -177,6 +177,15 @@ ffs_mount(struct mount *mp) vfs_deleteopt(mp->mnt_opt, "snapshot"); } + if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { + if (mntorflags & MNT_ACLS) { + printf("WARNING: \"acls\" and \"nfsv4acls\" " + "options are mutually exclusive\n"); + return (EINVAL); + } + mntorflags |= MNT_NFS4ACLS; + } + MNT_ILOCK(mp); mp->mnt_flag = (mp->mnt_flag | mntorflags) & ~mntandnotflags; MNT_IUNLOCK(mp); @@ -360,6 +369,13 @@ ffs_mount(struct mount *mp) MNT_IUNLOCK(mp); } + if ((fs->fs_flags & FS_NFS4ACLS) != 0) { + /* XXX: Set too late ? */ + MNT_ILOCK(mp); + mp->mnt_flag |= MNT_NFS4ACLS; + MNT_IUNLOCK(mp); + } + /* * If this is a snapshot request, take the snapshot. */ @@ -834,7 +850,13 @@ ffs_mountfs(devvp, mp, td) if ((fs->fs_flags & FS_ACLS) != 0) { #ifdef UFS_ACL MNT_ILOCK(mp); + + if (mp->mnt_flag & MNT_NFS4ACLS) + printf("WARNING: ACLs flag on fs conflicts with " + "\"nfsv4acls\" mount option; option ignored\n"); + mp->mnt_flag &= ~MNT_NFS4ACLS; mp->mnt_flag |= MNT_ACLS; + MNT_IUNLOCK(mp); #else printf( @@ -842,6 +864,24 @@ ffs_mountfs(devvp, mp, td) mp->mnt_stat.f_mntonname); #endif } + if ((fs->fs_flags & FS_NFS4ACLS) != 0) { +#ifdef UFS_ACL + MNT_ILOCK(mp); + + if (mp->mnt_flag & MNT_ACLS) + printf("WARNING: NFSv4 ACLs flag on fs conflicts with " + "\"acls\" mount option; option ignored\n"); + mp->mnt_flag &= ~MNT_ACLS; + mp->mnt_flag |= MNT_NFS4ACLS; + + MNT_IUNLOCK(mp); +#else + printf( +"WARNING: %s: NFSv4 ACLs flag on fs but no ACLs support\n", + mp->mnt_stat.f_mntonname); +#endif + } + ump->um_mountp = mp; ump->um_dev = dev; ump->um_devvp = devvp; Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ffs/fs.h Mon Dec 21 19:39:10 2009 (r200796) @@ -393,22 +393,24 @@ CTASSERT(sizeof(struct fs) == 1376); * flag to indicate that the indicies need to be rebuilt (by fsck) before * they can be used. * - * FS_ACLS indicates that ACLs are administratively enabled for the - * file system, so they should be loaded from extended attributes, + * FS_ACLS indicates that POSIX.1e ACLs are administratively enabled + * for the file system, so they should be loaded from extended attributes, * observed for access control purposes, and be administered by object - * owners. FS_MULTILABEL indicates that the TrustedBSD MAC Framework - * should attempt to back MAC labels into extended attributes on the - * file system rather than maintain a single mount label for all - * objects. - */ -#define FS_UNCLEAN 0x01 /* filesystem not clean at mount */ -#define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */ -#define FS_NEEDSFSCK 0x04 /* filesystem needs sync fsck before mount */ -#define FS_INDEXDIRS 0x08 /* kernel supports indexed directories */ -#define FS_ACLS 0x10 /* file system has ACLs enabled */ -#define FS_MULTILABEL 0x20 /* file system is MAC multi-label */ -#define FS_GJOURNAL 0x40 /* gjournaled file system */ -#define FS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */ + * owners. FS_NFS4ACLS indicates that NFSv4 ACLs are administratively + * enabled. This flag is mutually exclusive with FS_ACLS. FS_MULTILABEL + * indicates that the TrustedBSD MAC Framework should attempt to back MAC + * labels into extended attributes on the file system rather than maintain + * a single mount label for all objects. + */ +#define FS_UNCLEAN 0x0001 /* filesystem not clean at mount */ +#define FS_DOSOFTDEP 0x0002 /* filesystem using soft dependencies */ +#define FS_NEEDSFSCK 0x0004 /* filesystem needs sync fsck before mount */ +#define FS_INDEXDIRS 0x0008 /* kernel supports indexed directories */ +#define FS_ACLS 0x0010 /* file system has POSIX.1e ACLs enabled */ +#define FS_MULTILABEL 0x0020 /* file system is MAC multi-label */ +#define FS_GJOURNAL 0x0040 /* gjournaled file system */ +#define FS_FLAGS_UPDATED 0x0080 /* flags have been moved to new location */ +#define FS_NFS4ACLS 0x0100 /* file system has NFSv4 ACLs enabled */ /* * Macros to access bits in the fs_active array. Modified: head/sys/ufs/ufs/acl.h ============================================================================== --- head/sys/ufs/ufs/acl.h Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ufs/acl.h Mon Dec 21 19:39:10 2009 (r200796) @@ -37,6 +37,8 @@ #ifdef _KERNEL +int ufs_getacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td); +int ufs_setacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td); void ufs_sync_acl_from_inode(struct inode *ip, struct acl *acl); void ufs_sync_inode_from_acl(struct acl *acl, struct inode *ip); Modified: head/sys/ufs/ufs/ufs_acl.c ============================================================================== --- head/sys/ufs/ufs/ufs_acl.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ufs/ufs_acl.c Mon Dec 21 19:39:10 2009 (r200796) @@ -141,6 +141,81 @@ ufs_sync_inode_from_acl(struct acl *acl, } /* + * Retrieve NFSv4 ACL, skipping access checks. Must be used in UFS code + * instead of VOP_GETACL() when we don't want to be restricted by the user + * not having ACL_READ_ACL permission, e.g. when calculating inherited ACL + * or in ufs_vnops.c:ufs_accessx(). + */ +int +ufs_getacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td) +{ + int error, len; + struct inode *ip = VTOI(vp); + + len = sizeof(*aclp); + bzero(aclp, len); + + error = vn_extattr_get(vp, IO_NODELOCKED, + NFS4_ACL_EXTATTR_NAMESPACE, NFS4_ACL_EXTATTR_NAME, + &len, (char *) aclp, td); + aclp->acl_maxcnt = ACL_MAX_ENTRIES; + if (error == ENOATTR) { + /* + * Legitimately no ACL set on object, purely + * emulate it through the inode. + */ + acl_nfs4_sync_acl_from_mode(aclp, ip->i_mode, ip->i_uid); + + return (0); + } + + if (error) + return (error); + + if (len != sizeof(*aclp)) { + /* + * A short (or long) read, meaning that for + * some reason the ACL is corrupted. Return + * EPERM since the object DAC protections + * are unsafe. + */ + printf("ufs_getacl_nfs4(): Loaded invalid ACL (" + "%d bytes), inumber %d on %s\n", len, + ip->i_number, ip->i_fs->fs_fsmnt); + + return (EPERM); + } + + error = acl_nfs4_check(aclp, vp->v_type == VDIR); + if (error) { + printf("ufs_getacl_nfs4(): Loaded invalid ACL " + "(failed acl_nfs4_check), inumber %d on %s\n", + ip->i_number, ip->i_fs->fs_fsmnt); + + return (EPERM); + } + + return (0); +} + +static int +ufs_getacl_nfs4(struct vop_getacl_args *ap) +{ + int error; + + if ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 0) + return (EINVAL); + + error = VOP_ACCESSX(ap->a_vp, VREAD_ACL, ap->a_td->td_ucred, ap->a_td); + if (error) + return (error); + + error = ufs_getacl_nfs4_internal(ap->a_vp, ap->a_aclp, ap->a_td); + + return (error); +} + +/* * Read POSIX.1e ACL from an EA. Return error if its not found * or if any other error has occured. */ @@ -209,7 +284,7 @@ ufs_getacl_posix1e(struct vop_getacl_arg * ACLs, remove this check. */ if ((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) - return (EOPNOTSUPP); + return (EINVAL); old = malloc(sizeof(*old), M_ACL, M_WAITOK | M_ZERO); @@ -282,10 +357,118 @@ ufs_getacl(ap) } */ *ap; { + if ((ap->a_vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0) + return (EOPNOTSUPP); + + if (ap->a_type == ACL_TYPE_NFS4) + return (ufs_getacl_nfs4(ap)); + return (ufs_getacl_posix1e(ap)); } /* + * Set NFSv4 ACL without doing any access checking. This is required + * e.g. by the UFS code that implements ACL inheritance, or from + * ufs_vnops.c:ufs_chmod(), as some of the checks have to be skipped + * in that case, and others are redundant. + */ +int +ufs_setacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td) +{ + int error; + mode_t mode; + struct inode *ip = VTOI(vp); + + KASSERT(acl_nfs4_check(aclp, vp->v_type == VDIR) == 0, + ("invalid ACL passed to ufs_setacl_nfs4_internal")); + + if (acl_nfs4_is_trivial(aclp, ip->i_uid)) { + error = vn_extattr_rm(vp, IO_NODELOCKED, + NFS4_ACL_EXTATTR_NAMESPACE, NFS4_ACL_EXTATTR_NAME, td); + + /* + * An attempt to remove ACL from a file that didn't have + * any extended entries is not an error. + */ + if (error == ENOATTR) + error = 0; + + } else { + error = vn_extattr_set(vp, IO_NODELOCKED, + NFS4_ACL_EXTATTR_NAMESPACE, NFS4_ACL_EXTATTR_NAME, + sizeof(*aclp), (char *) aclp, td); + } + + /* + * Map lack of attribute definition in UFS_EXTATTR into lack of + * support for ACLs on the filesystem. + */ + if (error == ENOATTR) + return (EOPNOTSUPP); + + if (error) + return (error); + + mode = ip->i_mode; + + acl_nfs4_sync_mode_from_acl(&mode, aclp); + + ip->i_mode &= ACL_PRESERVE_MASK; + ip->i_mode |= mode; + DIP_SET(ip, i_mode, ip->i_mode); + ip->i_flag |= IN_CHANGE; + + VN_KNOTE_UNLOCKED(vp, NOTE_ATTRIB); + + return (0); +} + +static int +ufs_setacl_nfs4(struct vop_setacl_args *ap) +{ + int error; + struct inode *ip = VTOI(ap->a_vp); + + if ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 0) + return (EINVAL); + + if (ap->a_vp->v_mount->mnt_flag & MNT_RDONLY) + return (EROFS); + + if (ap->a_aclp == NULL) + return (EINVAL); + + error = VOP_ACLCHECK(ap->a_vp, ap->a_type, ap->a_aclp, ap->a_cred, + ap->a_td); + if (error) + return (error); + + /* + * Authorize the ACL operation. + */ + if (ip->i_flags & (IMMUTABLE | APPEND)) + return (EPERM); + + /* + * Must hold VWRITE_ACL or have appropriate privilege. + */ + if ((error = VOP_ACCESSX(ap->a_vp, VWRITE_ACL, ap->a_cred, ap->a_td))) + return (error); + + /* + * With NFSv4 ACLs, chmod(2) may need to add additional entries. + * Make sure it has enough room for that - splitting every entry + * into two and appending "canonical six" entries at the end. + */ + if (ap->a_aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) + return (ENOSPC); + + error = ufs_setacl_nfs4_internal(ap->a_vp, ap->a_aclp, ap->a_td); + + return (0); +} + +/* * Set the ACL on a file. * * As part of the ACL is stored in the inode, and the rest in an EA, @@ -302,7 +485,7 @@ ufs_setacl_posix1e(struct vop_setacl_arg struct oldacl *old; if ((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) - return (EOPNOTSUPP); + return (EINVAL); /* * If this is a set operation rather than a delete operation, @@ -422,16 +605,43 @@ ufs_setacl(ap) struct thread *td; } */ *ap; { + if ((ap->a_vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0) + return (EOPNOTSUPP); + + if (ap->a_type == ACL_TYPE_NFS4) + return (ufs_setacl_nfs4(ap)); return (ufs_setacl_posix1e(ap)); } static int +ufs_aclcheck_nfs4(struct vop_aclcheck_args *ap) +{ + int is_directory = 0; + + if ((ap->a_vp->v_mount->mnt_flag & MNT_NFS4ACLS) == 0) + return (EINVAL); + + /* + * With NFSv4 ACLs, chmod(2) may need to add additional entries. + * Make sure it has enough room for that - splitting every entry + * into two and appending "canonical six" entries at the end. + */ + if (ap->a_aclp->acl_cnt > (ACL_MAX_ENTRIES - 6) / 2) + return (ENOSPC); + + if (ap->a_vp->v_type == VDIR) + is_directory = 1; + + return (acl_nfs4_check(ap->a_aclp, is_directory)); +} + +static int ufs_aclcheck_posix1e(struct vop_aclcheck_args *ap) { if ((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0) - return (EOPNOTSUPP); + return (EINVAL); /* * Verify we understand this type of ACL, and that it applies @@ -471,6 +681,12 @@ ufs_aclcheck(ap) } */ *ap; { + if ((ap->a_vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0) + return (EOPNOTSUPP); + + if (ap->a_type == ACL_TYPE_NFS4) + return (ufs_aclcheck_nfs4(ap)); + return (ufs_aclcheck_posix1e(ap)); } Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ufs/ufs_lookup.c Mon Dec 21 19:39:10 2009 (r200796) @@ -80,6 +80,61 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *, ino_t *); +static int +ufs_delete_denied(struct vnode *vdp, struct vnode *tdp, struct ucred *cred, + struct thread *td) +{ + int error; + +#ifdef UFS_ACL + /* + * NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-03.txt + * + * 3.16.2.1. ACE4_DELETE vs. ACE4_DELETE_CHILD + */ + + /* + * XXX: Is this check required? + */ + error = VOP_ACCESS(vdp, VEXEC, cred, td); + if (error) + return (error); + + error = VOP_ACCESSX(tdp, VDELETE, cred, td); + if (error == 0) + return (0); + + error = VOP_ACCESSX(vdp, VDELETE_CHILD, cred, td); + if (error == 0) + return (0); + + error = VOP_ACCESSX(vdp, VEXPLICIT_DENY | VDELETE_CHILD, cred, td); + if (error) + return (error); + +#endif /* !UFS_ACL */ + + /* + * Standard Unix access control - delete access requires VWRITE. + */ + error = VOP_ACCESS(vdp, VWRITE, cred, td); + if (error) + return (error); + + /* + * If directory is "sticky", then user must own + * the directory, or the file in it, else she + * may not delete it (unless she's root). This + * implements append-only directories. + */ + if ((VTOI(vdp)->i_mode & ISVTX) && + VOP_ACCESS(vdp, VADMIN, cred, td) && + VOP_ACCESS(tdp, VADMIN, cred, td)) + return (EPERM); + + return (0); +} + /* * Convert a component of a pathname into a pointer to a locked inode. * This is a very central and rather complicated routine. @@ -410,8 +465,13 @@ notfound: /* * Access for write is interpreted as allowing * creation of files in the directory. + * + * XXX: Fix the comment above. */ - error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread); + if (flags & WILLBEDIR) + error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread); + else + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread); if (error) return (error); /* @@ -498,12 +558,17 @@ found: if (nameiop == DELETE && (flags & ISLASTCN)) { if (flags & LOCKPARENT) ASSERT_VOP_ELOCKED(vdp, __FUNCTION__); - /* - * Write access to directory required to delete files. - */ - error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread); - if (error) + if ((error = VFS_VGET(vdp->v_mount, ino, + LK_EXCLUSIVE, &tdp)) != 0) return (error); + + error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread); + if (error) { + vput(tdp); + return (error); + } + + /* * Return pointer to current entry in dp->i_offset, * and distance past previous entry (if there @@ -523,23 +588,10 @@ found: if (dp->i_number == ino) { VREF(vdp); *vpp = vdp; - return (0); - } - if ((error = VFS_VGET(vdp->v_mount, ino, - LK_EXCLUSIVE, &tdp)) != 0) - return (error); - /* - * If directory is "sticky", then user must own - * the directory, or the file in it, else she - * may not delete it (unless she's root). This - * implements append-only directories. - */ - if ((dp->i_mode & ISVTX) && - VOP_ACCESS(vdp, VADMIN, cred, cnp->cn_thread) && - VOP_ACCESS(tdp, VADMIN, cred, cnp->cn_thread)) { vput(tdp); - return (EPERM); + return (0); } + *vpp = tdp; return (0); } @@ -551,7 +603,11 @@ found: * regular file, or empty directory. */ if (nameiop == RENAME && (flags & ISLASTCN)) { - if ((error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread))) + if (flags & WILLBEDIR) + error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread); + else + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread); + if (error) return (error); /* * Careful about locking second inode. @@ -563,6 +619,33 @@ found: if ((error = VFS_VGET(vdp->v_mount, ino, LK_EXCLUSIVE, &tdp)) != 0) return (error); + + error = ufs_delete_denied(vdp, tdp, cred, cnp->cn_thread); + if (error) { + vput(tdp); + return (error); + } + +#ifdef SunOS_doesnt_do_that + /* + * The only purpose of this check is to return the correct + * error. Assume that we want to rename directory "a" + * to a file "b", and that we have no ACL_WRITE_DATA on + * a containing directory, but we _do_ have ACL_APPEND_DATA. + * In that case, the VOP_ACCESS check above will return 0, + * and the operation will fail with ENOTDIR instead + * of EACCESS. + */ + if (tdp->v_type == VDIR) + error = VOP_ACCESSX(vdp, VWRITE | VAPPEND, cred, cnp->cn_thread); + else + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_thread); + if (error) { + vput(tdp); + return (error); + } +#endif + *vpp = tdp; cnp->cn_flags |= SAVENAME; return (0); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Dec 21 19:27:52 2009 (r200795) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Dec 21 19:39:10 2009 (r200796) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include -static vop_access_t ufs_access; +static vop_accessx_t ufs_accessx; static int ufs_chmod(struct vnode *, int, struct ucred *, struct thread *); static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *); static vop_close_t ufs_close; @@ -298,8 +298,8 @@ ufs_close(ap) } static int -ufs_access(ap) - struct vop_access_args /* { +ufs_accessx(ap) + struct vop_accessx_args /* { struct vnode *a_vp; accmode_t a_accmode; struct ucred *a_cred; @@ -315,6 +315,7 @@ ufs_access(ap) #endif #ifdef UFS_ACL struct acl *acl; + acl_type_t type; #endif /* @@ -322,7 +323,7 @@ ufs_access(ap) * unless the file is a socket, fifo, or a block or * character device resident on the filesystem. */ - if (accmode & VWRITE) { + if (accmode & VMODIFY_PERMS) { switch (vp->v_type) { case VDIR: case VLNK: @@ -367,41 +368,63 @@ relock: } } - /* If immutable bit set, nobody gets to write it. */ - if ((accmode & VWRITE) && (ip->i_flags & (IMMUTABLE | SF_SNAPSHOT))) + /* + * If immutable bit set, nobody gets to write it. "& ~VADMIN_PERMS" + * is here, because without it, * it would be impossible for the owner + * to remove the IMMUTABLE flag. + */ + if ((accmode & (VMODIFY_PERMS & ~VADMIN_PERMS)) && + (ip->i_flags & (IMMUTABLE | SF_SNAPSHOT))) return (EPERM); #ifdef UFS_ACL - if ((vp->v_mount->mnt_flag & MNT_ACLS) != 0) { + if ((vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) != 0) { + if (vp->v_mount->mnt_flag & MNT_NFS4ACLS) + type = ACL_TYPE_NFS4; + else + type = ACL_TYPE_ACCESS; + acl = acl_alloc(M_WAITOK); - error = VOP_GETACL(vp, ACL_TYPE_ACCESS, acl, ap->a_cred, - ap->a_td); + if (type == ACL_TYPE_NFS4) + error = ufs_getacl_nfs4_internal(vp, acl, ap->a_td); + else + error = VOP_GETACL(vp, type, acl, ap->a_cred, ap->a_td); switch (error) { - case EOPNOTSUPP: - error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, - ip->i_gid, ap->a_accmode, ap->a_cred, NULL); - break; case 0: - error = vaccess_acl_posix1e(vp->v_type, ip->i_uid, - ip->i_gid, acl, ap->a_accmode, ap->a_cred, NULL); + if (type == ACL_TYPE_NFS4) { + error = vaccess_acl_nfs4(vp->v_type, ip->i_uid, + ip->i_gid, acl, accmode, ap->a_cred, NULL); + } else { + error = vfs_unixify_accmode(&accmode); + if (error == 0) + error = vaccess_acl_posix1e(vp->v_type, ip->i_uid, + ip->i_gid, acl, accmode, ap->a_cred, NULL); + } break; default: - printf( -"ufs_access(): Error retrieving ACL on object (%d).\n", - error); + if (error != EOPNOTSUPP) + printf( +"ufs_accessx(): Error retrieving ACL on object (%d).\n", + error); /* * XXX: Fall back until debugged. Should * eventually possibly log an error, and return * EPERM for safety. */ - error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, - ip->i_gid, ap->a_accmode, ap->a_cred, NULL); + error = vfs_unixify_accmode(&accmode); + if (error == 0) + error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, + ip->i_gid, accmode, ap->a_cred, NULL); } acl_free(acl); - } else + + return (error); + } #endif /* !UFS_ACL */ + error = vfs_unixify_accmode(&accmode); + if (error == 0) error = vaccess(vp->v_type, ip->i_mode, ip->i_uid, ip->i_gid, - ap->a_accmode, ap->a_cred, NULL); + accmode, ap->a_cred, NULL); return (error); } @@ -608,11 +631,20 @@ ufs_setattr(ap) * check succeeds. */ if (vap->va_vaflags & VA_UTIMES_NULL) { - error = VOP_ACCESS(vp, VADMIN, cred, td); + /* + * NFSv4.1, draft 21, 6.2.1.3.1, Discussion of Mask Attributes + * + * "A user having ACL_WRITE_DATA or ACL_WRITE_ATTRIBUTES + * will be allowed to set the times [..] to the current *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:43:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC1C6106566C; Mon, 21 Dec 2009 19:43:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB1108FC18; Mon, 21 Dec 2009 19:43:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJhNor038427; Mon, 21 Dec 2009 19:43:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJhNUU038425; Mon, 21 Dec 2009 19:43:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912211943.nBLJhNUU038425@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Dec 2009 19:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200797 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:43:24 -0000 Author: jhb Date: Mon Dec 21 19:43:23 2009 New Revision: 200797 URL: http://svn.freebsd.org/changeset/base/200797 Log: Use _once() to initialize the pthread key for thread-local storage to hold the results of localtime() instead of using a pthread mutex directly. MFC after: 1 week Modified: head/lib/libc/stdtime/localtime.c Modified: head/lib/libc/stdtime/localtime.c ============================================================================== --- head/lib/libc/stdtime/localtime.c Mon Dec 21 19:39:10 2009 (r200796) +++ head/lib/libc/stdtime/localtime.c Mon Dec 21 19:43:23 2009 (r200797) @@ -237,6 +237,9 @@ static char lcl_TZname[TZ_STRLEN_MAX + static int lcl_is_set; static pthread_once_t gmt_once = PTHREAD_ONCE_INIT; static pthread_rwlock_t lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER; +static pthread_once_t localtime_once = PTHREAD_ONCE_INIT; +static pthread_key_t localtime_key; +static int localtime_key_error; char * tzname[2] = { wildabbr, @@ -1406,27 +1409,24 @@ struct tm * const tmp; return result; } +static void +localtime_key_init(void) +{ + + localtime_key_error = _pthread_key_create(&localtime_key, free); +} + struct tm * localtime(timep) const time_t * const timep; { - static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER; - static pthread_key_t localtime_key = -1; struct tm *p_tm; - int r; if (__isthreaded != 0) { - if (localtime_key < 0) { - _pthread_mutex_lock(&localtime_mutex); - if (localtime_key < 0) { - if ((r = _pthread_key_create(&localtime_key, - free)) != 0) { - _pthread_mutex_unlock(&localtime_mutex); - errno = r; - return(NULL); - } - } - _pthread_mutex_unlock(&localtime_mutex); + _once(&localtime_once, localtime_key_init); + if (localtime_key_error != 0) { + errno = localtime_key_error; + return(NULL); } p_tm = _pthread_getspecific(localtime_key); if (p_tm == NULL) { From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:50:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D8A9106568B; Mon, 21 Dec 2009 19:50:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BBEB8FC15; Mon, 21 Dec 2009 19:50:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJoToW038615; Mon, 21 Dec 2009 19:50:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJoTLT038613; Mon, 21 Dec 2009 19:50:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211950.nBLJoTLT038613@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 19:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200798 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:50:29 -0000 Author: yongari Date: Mon Dec 21 19:50:29 2009 New Revision: 200798 URL: http://svn.freebsd.org/changeset/base/200798 Log: Use ANSI function definations. Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 19:43:23 2009 (r200797) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 19:50:29 2009 (r200798) @@ -200,8 +200,7 @@ SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, C * Sync the PHYs by setting data bit and strobing the clock 32 times. */ static void -ste_mii_sync(sc) - struct ste_softc *sc; +ste_mii_sync(struct ste_softc *sc) { register int i; @@ -221,10 +220,7 @@ ste_mii_sync(sc) * Clock a series of bits through the MII. */ static void -ste_mii_send(sc, bits, cnt) - struct ste_softc *sc; - u_int32_t bits; - int cnt; +ste_mii_send(struct ste_softc *sc, u_int32_t bits, int cnt) { int i; @@ -247,10 +243,7 @@ ste_mii_send(sc, bits, cnt) * Read an PHY register through the MII. */ static int -ste_mii_readreg(sc, frame) - struct ste_softc *sc; - struct ste_mii_frame *frame; - +ste_mii_readreg(struct ste_softc *sc, struct ste_mii_frame *frame) { int i, ack; @@ -336,10 +329,7 @@ fail: * Write to a PHY register through the MII. */ static int -ste_mii_writereg(sc, frame) - struct ste_softc *sc; - struct ste_mii_frame *frame; - +ste_mii_writereg(struct ste_softc *sc, struct ste_mii_frame *frame) { /* @@ -379,9 +369,7 @@ ste_mii_writereg(sc, frame) } static int -ste_miibus_readreg(dev, phy, reg) - device_t dev; - int phy, reg; +ste_miibus_readreg(device_t dev, int phy, int reg) { struct ste_softc *sc; struct ste_mii_frame frame; @@ -401,9 +389,7 @@ ste_miibus_readreg(dev, phy, reg) } static int -ste_miibus_writereg(dev, phy, reg, data) - device_t dev; - int phy, reg, data; +ste_miibus_writereg(device_t dev, int phy, int reg, int data) { struct ste_softc *sc; struct ste_mii_frame frame; @@ -421,8 +407,7 @@ ste_miibus_writereg(dev, phy, reg, data) } static void -ste_miibus_statchg(dev) - device_t dev; +ste_miibus_statchg(device_t dev) { struct ste_softc *sc; struct mii_data *mii; @@ -441,8 +426,7 @@ ste_miibus_statchg(dev) } static int -ste_ifmedia_upd(ifp) - struct ifnet *ifp; +ste_ifmedia_upd(struct ifnet *ifp) { struct ste_softc *sc; @@ -455,8 +439,7 @@ ste_ifmedia_upd(ifp) } static void -ste_ifmedia_upd_locked(ifp) - struct ifnet *ifp; +ste_ifmedia_upd_locked(struct ifnet *ifp) { struct ste_softc *sc; struct mii_data *mii; @@ -474,9 +457,7 @@ ste_ifmedia_upd_locked(ifp) } static void -ste_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +ste_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ste_softc *sc; struct mii_data *mii; @@ -494,8 +475,7 @@ ste_ifmedia_sts(ifp, ifmr) } static void -ste_wait(sc) - struct ste_softc *sc; +ste_wait(struct ste_softc *sc) { register int i; @@ -515,8 +495,7 @@ ste_wait(sc) * it a command. */ static int -ste_eeprom_wait(sc) - struct ste_softc *sc; +ste_eeprom_wait(struct ste_softc *sc) { int i; @@ -542,12 +521,7 @@ ste_eeprom_wait(sc) * data is stored in the EEPROM in network byte order. */ static int -ste_read_eeprom(sc, dest, off, cnt, swap) - struct ste_softc *sc; - caddr_t dest; - int off; - int cnt; - int swap; +ste_read_eeprom(struct ste_softc *sc, caddr_t dest, int off, int cnt, int swap) { int err = 0, i; u_int16_t word = 0, *ptr; @@ -572,8 +546,7 @@ ste_read_eeprom(sc, dest, off, cnt, swap } static void -ste_setmulti(sc) - struct ste_softc *sc; +ste_setmulti(struct ste_softc *sc) { struct ifnet *ifp; int h = 0; @@ -675,8 +648,7 @@ ste_poll_locked(struct ifnet *ifp, enum #endif /* DEVICE_POLLING */ static void -ste_intr(xsc) - void *xsc; +ste_intr(void *xsc) { struct ste_softc *sc; struct ifnet *ifp; @@ -770,8 +742,7 @@ ste_rxeoc(struct ste_softc *sc) * the higher level protocols. */ static int -ste_rxeof(sc) - struct ste_softc *sc; +ste_rxeof(struct ste_softc *sc) { struct mbuf *m; struct ifnet *ifp; @@ -858,8 +829,7 @@ ste_rxeof(sc) } static void -ste_txeoc(sc) - struct ste_softc *sc; +ste_txeoc(struct ste_softc *sc) { u_int8_t txstat; struct ifnet *ifp; @@ -898,8 +868,7 @@ ste_txeoc(sc) } static void -ste_txeof(sc) - struct ste_softc *sc; +ste_txeof(struct ste_softc *sc) { struct ste_chain *cur_tx; struct ifnet *ifp; @@ -928,8 +897,7 @@ ste_txeof(sc) } static void -ste_stats_update(xsc) - void *xsc; +ste_stats_update(void *xsc) { struct ste_softc *sc; struct ifnet *ifp; @@ -973,8 +941,7 @@ ste_stats_update(xsc) * IDs against our list and return a device name if we find a match. */ static int -ste_probe(dev) - device_t dev; +ste_probe(device_t dev) { struct ste_type *t; @@ -997,8 +964,7 @@ ste_probe(dev) * setup and ethernet/BPF attach. */ static int -ste_attach(dev) - device_t dev; +ste_attach(device_t dev) { struct ste_softc *sc; struct ifnet *ifp; @@ -1143,8 +1109,7 @@ fail: * allocated. */ static int -ste_detach(dev) - device_t dev; +ste_detach(device_t dev) { struct ste_softc *sc; struct ifnet *ifp; @@ -1191,10 +1156,7 @@ ste_detach(dev) } static int -ste_newbuf(sc, c, m) - struct ste_softc *sc; - struct ste_chain_onefrag *c; - struct mbuf *m; +ste_newbuf(struct ste_softc *sc, struct ste_chain_onefrag *c, struct mbuf *m) { struct mbuf *m_new = NULL; @@ -1225,8 +1187,7 @@ ste_newbuf(sc, c, m) } static int -ste_init_rx_list(sc) - struct ste_softc *sc; +ste_init_rx_list(struct ste_softc *sc) { struct ste_chain_data *cd; struct ste_list_data *ld; @@ -1259,8 +1220,7 @@ ste_init_rx_list(sc) } static void -ste_init_tx_list(sc) - struct ste_softc *sc; +ste_init_tx_list(struct ste_softc *sc) { struct ste_chain_data *cd; struct ste_list_data *ld; @@ -1288,8 +1248,7 @@ ste_init_tx_list(sc) } static void -ste_init(xsc) - void *xsc; +ste_init(void *xsc) { struct ste_softc *sc; @@ -1300,8 +1259,7 @@ ste_init(xsc) } static void -ste_init_locked(sc) - struct ste_softc *sc; +ste_init_locked(struct ste_softc *sc) { int i; struct ifnet *ifp; @@ -1413,8 +1371,7 @@ ste_init_locked(sc) } static void -ste_stop(sc) - struct ste_softc *sc; +ste_stop(struct ste_softc *sc) { int i; struct ifnet *ifp; @@ -1460,8 +1417,7 @@ ste_stop(sc) } static void -ste_reset(sc) - struct ste_softc *sc; +ste_reset(struct ste_softc *sc) { int i; @@ -1486,10 +1442,7 @@ ste_reset(sc) } static int -ste_ioctl(ifp, command, data) - struct ifnet *ifp; - u_long command; - caddr_t data; +ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ste_softc *sc; struct ifreq *ifr; @@ -1577,10 +1530,7 @@ ste_ioctl(ifp, command, data) } static int -ste_encap(sc, c, m_head) - struct ste_softc *sc; - struct ste_chain *c; - struct mbuf *m_head; +ste_encap(struct ste_softc *sc, struct ste_chain *c, struct mbuf *m_head) { int frag = 0; struct ste_frag *f = NULL; @@ -1627,8 +1577,7 @@ encap_retry: } static void -ste_start(ifp) - struct ifnet *ifp; +ste_start(struct ifnet *ifp) { struct ste_softc *sc; @@ -1639,8 +1588,7 @@ ste_start(ifp) } static void -ste_start_locked(ifp) - struct ifnet *ifp; +ste_start_locked(struct ifnet *ifp) { struct ste_softc *sc; struct mbuf *m_head = NULL; @@ -1741,8 +1689,7 @@ ste_watchdog(struct ste_softc *sc) } static int -ste_shutdown(dev) - device_t dev; +ste_shutdown(device_t dev) { struct ste_softc *sc; From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:55:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B72F51065696; Mon, 21 Dec 2009 19:55:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A62388FC1A; Mon, 21 Dec 2009 19:55:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJt5jQ038786; Mon, 21 Dec 2009 19:55:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJt5Q3038784; Mon, 21 Dec 2009 19:55:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211955.nBLJt5Q3038784@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200799 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:55:05 -0000 Author: delphij Date: Mon Dec 21 19:55:05 2009 New Revision: 200799 URL: http://svn.freebsd.org/changeset/base/200799 Log: K&R -> ANSI prototype. MFC after: 1 month Modified: head/lib/libc/stdio/vsscanf.c Modified: head/lib/libc/stdio/vsscanf.c ============================================================================== --- head/lib/libc/stdio/vsscanf.c Mon Dec 21 19:50:29 2009 (r200798) +++ head/lib/libc/stdio/vsscanf.c Mon Dec 21 19:55:05 2009 (r200799) @@ -45,20 +45,15 @@ eofread(void *, char *, int); /* ARGSUSED */ static int -eofread(cookie, buf, len) - void *cookie; - char *buf; - int len; +eofread(void *cookie, char *buf, int len) { return (0); } int -vsscanf(str, fmt, ap) - const char * __restrict str; - const char * __restrict fmt; - __va_list ap; +vsscanf(const char * __restrict str, const char * __restrict fmt, + __va_list ap) { FILE f; From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:56:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 930CE10656A8; Mon, 21 Dec 2009 19:56:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 821378FC36; Mon, 21 Dec 2009 19:56:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJu3cb038851; Mon, 21 Dec 2009 19:56:03 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJu3U2038849; Mon, 21 Dec 2009 19:56:03 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211956.nBLJu3U2038849@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200800 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:56:03 -0000 Author: delphij Date: Mon Dec 21 19:56:03 2009 New Revision: 200800 URL: http://svn.freebsd.org/changeset/base/200800 Log: Use vsscanf instead of rolling our own. PR: bin/140530 Submitted by: Jeremy Huddleston MFC after: 1 month Modified: head/lib/libc/stdio/sscanf.c Modified: head/lib/libc/stdio/sscanf.c ============================================================================== --- head/lib/libc/stdio/sscanf.c Mon Dec 21 19:55:05 2009 (r200799) +++ head/lib/libc/stdio/sscanf.c Mon Dec 21 19:56:03 2009 (r200800) @@ -41,37 +41,14 @@ __FBSDID("$FreeBSD$"); #include #include "local.h" -static int eofread(void *, char *, int); - -/* ARGSUSED */ -static int -eofread(cookie, buf, len) - void *cookie; - char *buf; - int len; -{ - - return (0); -} - int sscanf(const char * __restrict str, char const * __restrict fmt, ...) { int ret; va_list ap; - FILE f; - f._file = -1; - f._flags = __SRD; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._r = strlen(str); - f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); va_start(ap, fmt); - ret = __svfscanf(&f, fmt, ap); + ret = vsscanf(str, fmt, ap); va_end(ap); return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:56:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A29B410657C0; Mon, 21 Dec 2009 19:56:11 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9141F8FC38; Mon, 21 Dec 2009 19:56:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJuBWO038891; Mon, 21 Dec 2009 19:56:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJuBUm038889; Mon, 21 Dec 2009 19:56:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912211956.nBLJuBUm038889@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 19:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200801 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:56:11 -0000 Author: yongari Date: Mon Dec 21 19:56:11 2009 New Revision: 200801 URL: http://svn.freebsd.org/changeset/base/200801 Log: o Remove unnecessary return statement. o Remove register keyword. Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 19:56:03 2009 (r200800) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 19:56:11 2009 (r200801) @@ -202,7 +202,7 @@ SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, C static void ste_mii_sync(struct ste_softc *sc) { - register int i; + int i; MII_SET(STE_PHYCTL_MDIR|STE_PHYCTL_MDATA); @@ -212,8 +212,6 @@ ste_mii_sync(struct ste_softc *sc) MII_CLR(STE_PHYCTL_MCLK); DELAY(1); } - - return; } /* @@ -421,8 +419,6 @@ ste_miibus_statchg(device_t dev) } else { STE_CLRBIT2(sc, STE_MACCTL0, STE_MACCTL0_FULLDUPLEX); } - - return; } static int @@ -470,14 +466,12 @@ ste_ifmedia_sts(struct ifnet *ifp, struc ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; STE_UNLOCK(sc); - - return; } static void ste_wait(struct ste_softc *sc) { - register int i; + int i; for (i = 0; i < STE_TIMEOUT; i++) { if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG)) @@ -486,8 +480,6 @@ ste_wait(struct ste_softc *sc) if (i == STE_TIMEOUT) device_printf(sc->ste_dev, "command never completed!\n"); - - return; } /* @@ -586,8 +578,6 @@ ste_setmulti(struct ste_softc *sc) CSR_WRITE_2(sc, STE_MAR3, (hashes[1] >> 16) & 0xFFFF); STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_ALLMULTI); STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_MULTIHASH); - - return; } #ifdef DEVICE_POLLING @@ -710,8 +700,6 @@ ste_intr(void *xsc) ste_start_locked(ifp); STE_UNLOCK(sc); - - return; } static void @@ -863,8 +851,6 @@ ste_txeoc(struct ste_softc *sc) ste_init_locked(sc); CSR_WRITE_2(sc, STE_TX_STATUS, txstat); } - - return; } static void @@ -931,8 +917,6 @@ ste_stats_update(void *xsc) if (sc->ste_timer > 0 && --sc->ste_timer == 0) ste_watchdog(sc); callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc); - - return; } @@ -1243,8 +1227,6 @@ ste_init_tx_list(struct ste_softc *sc) cd->ste_tx_prod = 0; cd->ste_tx_cons = 0; - - return; } static void @@ -1366,8 +1348,6 @@ ste_init_locked(struct ste_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc); - - return; } static void @@ -1412,8 +1392,6 @@ ste_stop(struct ste_softc *sc) } bzero(sc->ste_ldata, sizeof(struct ste_list_data)); - - return; } static void @@ -1437,8 +1415,6 @@ ste_reset(struct ste_softc *sc) if (i == STE_TIMEOUT) device_printf(sc->ste_dev, "global reset never completed\n"); - - return; } static int @@ -1660,8 +1636,6 @@ ste_start_locked(struct ifnet *ifp) sc->ste_timer = 5; } sc->ste_cdata.ste_tx_prod = idx; - - return; } static void @@ -1684,8 +1658,6 @@ ste_watchdog(struct ste_softc *sc) if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) ste_start_locked(ifp); - - return; } static int From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 19:59:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4609B1065670; Mon, 21 Dec 2009 19:59:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34AE78FC08; Mon, 21 Dec 2009 19:59:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLJxdwo038988; Mon, 21 Dec 2009 19:59:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLJxdfK038986; Mon, 21 Dec 2009 19:59:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912211959.nBLJxdfK038986@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 19:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200802 - head/lib/libc/stdio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 19:59:39 -0000 Author: delphij Date: Mon Dec 21 19:59:38 2009 New Revision: 200802 URL: http://svn.freebsd.org/changeset/base/200802 Log: Use vsprintf instead of rolling our own. PR: bin/140496 Submitted by: Jeremy Huddleston MFC after: 1 month Modified: head/lib/libc/stdio/sprintf.c Modified: head/lib/libc/stdio/sprintf.c ============================================================================== --- head/lib/libc/stdio/sprintf.c Mon Dec 21 19:56:11 2009 (r200801) +++ head/lib/libc/stdio/sprintf.c Mon Dec 21 19:59:38 2009 (r200802) @@ -46,17 +46,9 @@ sprintf(char * __restrict str, char cons { int ret; va_list ap; - FILE f; - f._file = -1; - f._flags = __SWR | __SSTR; - f._bf._base = f._p = (unsigned char *)str; - f._bf._size = f._w = INT_MAX; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); va_start(ap, fmt); - ret = __vfprintf(&f, fmt, ap); + ret = vsprintf(str, fmt, ap); va_end(ap); - *f._p = 0; return (ret); } From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:00:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA7AC10656C1; Mon, 21 Dec 2009 20:00:27 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98EE58FC26; Mon, 21 Dec 2009 20:00:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLK0RA2039088; Mon, 21 Dec 2009 20:00:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLK0R4V039085; Mon, 21 Dec 2009 20:00:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912212000.nBLK0R4V039085@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 20:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200803 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:00:27 -0000 Author: yongari Date: Mon Dec 21 20:00:27 2009 New Revision: 200803 URL: http://svn.freebsd.org/changeset/base/200803 Log: s/u_intXX_t/uintXX_t/g Modified: head/sys/dev/ste/if_ste.c head/sys/dev/ste/if_stereg.h Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 19:59:38 2009 (r200802) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 20:00:27 2009 (r200803) @@ -117,7 +117,7 @@ static void ste_ifmedia_upd_locked(struc static void ste_ifmedia_sts(struct ifnet *, struct ifmediareq *); static void ste_mii_sync(struct ste_softc *); -static void ste_mii_send(struct ste_softc *, u_int32_t, int); +static void ste_mii_send(struct ste_softc *, uint32_t, int); static int ste_mii_readreg(struct ste_softc *, struct ste_mii_frame *); static int ste_mii_writereg(struct ste_softc *, struct ste_mii_frame *); static int ste_miibus_readreg(device_t, int, int); @@ -218,7 +218,7 @@ ste_mii_sync(struct ste_softc *sc) * Clock a series of bits through the MII. */ static void -ste_mii_send(struct ste_softc *sc, u_int32_t bits, int cnt) +ste_mii_send(struct ste_softc *sc, uint32_t bits, int cnt) { int i; @@ -516,7 +516,7 @@ static int ste_read_eeprom(struct ste_softc *sc, caddr_t dest, int off, int cnt, int swap) { int err = 0, i; - u_int16_t word = 0, *ptr; + uint16_t word = 0, *ptr; if (ste_eeprom_wait(sc)) return(1); @@ -527,7 +527,7 @@ ste_read_eeprom(struct ste_softc *sc, ca if (err) break; word = CSR_READ_2(sc, STE_EEPROM_DATA); - ptr = (u_int16_t *)(dest + (i * 2)); + ptr = (uint16_t *)(dest + (i * 2)); if (swap) *ptr = ntohs(word); else @@ -542,7 +542,7 @@ ste_setmulti(struct ste_softc *sc) { struct ifnet *ifp; int h = 0; - u_int32_t hashes[2] = { 0, 0 }; + uint32_t hashes[2] = { 0, 0 }; struct ifmultiaddr *ifma; ifp = sc->ste_ifp; @@ -613,7 +613,7 @@ ste_poll_locked(struct ifnet *ifp, enum ste_start_locked(ifp); if (cmd == POLL_AND_CHECK_STATUS) { - u_int16_t status; + uint16_t status; status = CSR_READ_2(sc, STE_ISR_ACK); @@ -642,7 +642,7 @@ ste_intr(void *xsc) { struct ste_softc *sc; struct ifnet *ifp; - u_int16_t status; + uint16_t status; sc = xsc; STE_LOCK(sc); @@ -736,7 +736,7 @@ ste_rxeof(struct ste_softc *sc) struct ifnet *ifp; struct ste_chain_onefrag *cur_rx; int total_len = 0, count=0, rx_npkts = 0; - u_int32_t rxstat; + uint32_t rxstat; STE_LOCK_ASSERT(sc); @@ -819,7 +819,7 @@ ste_rxeof(struct ste_softc *sc) static void ste_txeoc(struct ste_softc *sc) { - u_int8_t txstat; + uint8_t txstat; struct ifnet *ifp; ifp = sc->ste_ifp; Modified: head/sys/dev/ste/if_stereg.h ============================================================================== --- head/sys/dev/ste/if_stereg.h Mon Dec 21 19:59:38 2009 (r200802) +++ head/sys/dev/ste/if_stereg.h Mon Dec 21 20:00:27 2009 (r200803) @@ -386,27 +386,27 @@ struct ste_stats { - u_int32_t ste_rx_bytes; - u_int32_t ste_tx_bytes; - u_int16_t ste_tx_frames; - u_int16_t ste_rx_frames; - u_int8_t ste_carrsense_errs; - u_int8_t ste_late_colls; - u_int8_t ste_multi_colls; - u_int8_t ste_single_colls; - u_int8_t ste_tx_frames_defered; - u_int8_t ste_rx_lost_frames; - u_int8_t ste_tx_excess_defers; - u_int8_t ste_tx_abort_excess_colls; - u_int8_t ste_tx_bcast_frames; - u_int8_t ste_rx_bcast_frames; - u_int8_t ste_tx_mcast_frames; - u_int8_t ste_rx_mcast_frames; + uint32_t ste_rx_bytes; + uint32_t ste_tx_bytes; + uint16_t ste_tx_frames; + uint16_t ste_rx_frames; + uint8_t ste_carrsense_errs; + uint8_t ste_late_colls; + uint8_t ste_multi_colls; + uint8_t ste_single_colls; + uint8_t ste_tx_frames_defered; + uint8_t ste_rx_lost_frames; + uint8_t ste_tx_excess_defers; + uint8_t ste_tx_abort_excess_colls; + uint8_t ste_tx_bcast_frames; + uint8_t ste_rx_bcast_frames; + uint8_t ste_tx_mcast_frames; + uint8_t ste_rx_mcast_frames; }; struct ste_frag { - u_int32_t ste_addr; - u_int32_t ste_len; + uint32_t ste_addr; + uint32_t ste_len; }; #define STE_FRAG_LAST 0x80000000 @@ -415,14 +415,14 @@ struct ste_frag { #define STE_MAXFRAGS 8 struct ste_desc { - u_int32_t ste_next; - u_int32_t ste_ctl; + uint32_t ste_next; + uint32_t ste_ctl; struct ste_frag ste_frags[STE_MAXFRAGS]; }; struct ste_desc_onefrag { - u_int32_t ste_next; - u_int32_t ste_status; + uint32_t ste_next; + uint32_t ste_status; struct ste_frag ste_frag; }; @@ -472,8 +472,8 @@ struct ste_desc_onefrag { #define STE_NEXT(x, y) (x + 1) % y struct ste_type { - u_int16_t ste_vid; - u_int16_t ste_did; + uint16_t ste_vid; + uint16_t ste_did; char *ste_name; }; @@ -486,7 +486,7 @@ struct ste_chain { struct ste_desc *ste_ptr; struct mbuf *ste_mbuf; struct ste_chain *ste_next; - u_int32_t ste_phys; + uint32_t ste_phys; }; struct ste_chain_onefrag { @@ -515,7 +515,7 @@ struct ste_softc { device_t ste_miibus; device_t ste_dev; int ste_tx_thresh; - u_int8_t ste_link; + uint8_t ste_link; int ste_if_flags; int ste_timer; struct ste_chain *ste_tx_prev; @@ -523,7 +523,7 @@ struct ste_softc { struct ste_chain_data ste_cdata; struct callout ste_stat_callout; struct mtx ste_mtx; - u_int8_t ste_one_phy; + uint8_t ste_one_phy; #ifdef DEVICE_POLLING int rxcycles; #endif @@ -534,12 +534,12 @@ struct ste_softc { #define STE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->ste_mtx, MA_OWNED) struct ste_mii_frame { - u_int8_t mii_stdelim; - u_int8_t mii_opcode; - u_int8_t mii_phyaddr; - u_int8_t mii_regaddr; - u_int8_t mii_turnaround; - u_int16_t mii_data; + uint8_t mii_stdelim; + uint8_t mii_opcode; + uint8_t mii_phyaddr; + uint8_t mii_regaddr; + uint8_t mii_turnaround; + uint16_t mii_data; }; /* From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:02:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F101106568B; Mon, 21 Dec 2009 20:02:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D7C28FC19; Mon, 21 Dec 2009 20:02:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLK2Dgu039163; Mon, 21 Dec 2009 20:02:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLK2DYS039160; Mon, 21 Dec 2009 20:02:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912212002.nBLK2DYS039160@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 20:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200804 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:02:13 -0000 Author: yongari Date: Mon Dec 21 20:02:12 2009 New Revision: 200804 URL: http://svn.freebsd.org/changeset/base/200804 Log: Remove trailing white spaces. Modified: head/sys/dev/ste/if_ste.c head/sys/dev/ste/if_stereg.h Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 20:00:27 2009 (r200803) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 20:02:12 2009 (r200804) @@ -194,7 +194,7 @@ SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, C #define MII_SET(x) STE_SETBIT1(sc, STE_PHYCTL, x) -#define MII_CLR(x) STE_CLRBIT1(sc, STE_PHYCTL, x) +#define MII_CLR(x) STE_CLRBIT1(sc, STE_PHYCTL, x) /* * Sync the PHYs by setting data bit and strobing the clock 32 times. @@ -252,7 +252,7 @@ ste_mii_readreg(struct ste_softc *sc, st frame->mii_opcode = STE_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + CSR_WRITE_2(sc, STE_PHYCTL, 0); /* * Turn on data xmit. @@ -337,7 +337,7 @@ ste_mii_writereg(struct ste_softc *sc, s frame->mii_stdelim = STE_MII_STARTDELIM; frame->mii_opcode = STE_MII_WRITEOP; frame->mii_turnaround = STE_MII_TURNAROUND; - + /* * Turn on data output. */ @@ -420,7 +420,7 @@ ste_miibus_statchg(device_t dev) STE_CLRBIT2(sc, STE_MACCTL0, STE_MACCTL0_FULLDUPLEX); } } - + static int ste_ifmedia_upd(struct ifnet *ifp) { @@ -431,7 +431,7 @@ ste_ifmedia_upd(struct ifnet *ifp) ste_ifmedia_upd_locked(ifp); STE_UNLOCK(sc); - return(0); + return(0); } static void @@ -531,7 +531,7 @@ ste_read_eeprom(struct ste_softc *sc, ca if (swap) *ptr = ntohs(word); else - *ptr = word; + *ptr = word; } return(err ? 1 : 0); @@ -783,7 +783,7 @@ ste_rxeof(struct ste_softc *sc) continue; } - /* No errors; receive the packet. */ + /* No errors; receive the packet. */ m = cur_rx->ste_mbuf; total_len = cur_rx->ste_ptr->ste_status & STE_RXSTAT_FRAMELEN; @@ -1334,7 +1334,7 @@ ste_init_locked(struct ste_softc *sc) /* Disable interrupts if we are polling. */ if (ifp->if_capenable & IFCAP_POLLING) CSR_WRITE_2(sc, STE_IMR, 0); - else + else #endif /* Enable interrupts. */ CSR_WRITE_2(sc, STE_IMR, STE_INTRS); @@ -1369,8 +1369,8 @@ ste_stop(struct ste_softc *sc) STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_TXDMA_STALL); STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_RXDMA_STALL); ste_wait(sc); - /* - * Try really hard to stop the RX engine or under heavy RX + /* + * Try really hard to stop the RX engine or under heavy RX * data chip will write into de-allocated memory. */ ste_reset(sc); @@ -1442,7 +1442,7 @@ ste_ioctl(struct ifnet *ifp, u_long comm sc->ste_if_flags & IFF_PROMISC) { STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_PROMISC); - } + } if (ifp->if_drv_flags & IFF_DRV_RUNNING && (ifp->if_flags ^ sc->ste_if_flags) & IFF_ALLMULTI) ste_setmulti(sc); @@ -1483,7 +1483,7 @@ ste_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable |= IFCAP_POLLING; STE_UNLOCK(sc); return (error); - + } if (!(ifr->ifr_reqcap & IFCAP_POLLING) && ifp->if_capenable & IFCAP_POLLING) { @@ -1615,7 +1615,7 @@ ste_start_locked(struct ifnet *ifp) /* Set TX polling interval to start TX engine */ CSR_WRITE_1(sc, STE_TX_DMAPOLL_PERIOD, 64); - + STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL); ste_wait(sc); }else{ Modified: head/sys/dev/ste/if_stereg.h ============================================================================== --- head/sys/dev/ste/if_stereg.h Mon Dec 21 20:00:27 2009 (r200803) +++ head/sys/dev/ste/if_stereg.h Mon Dec 21 20:02:12 2009 (r200804) @@ -96,7 +96,7 @@ #define STE_LATE_COLLS 0x75 #define STE_MULTI_COLLS 0x76 -#define STE_SINGLE_COLLS 0x77 +#define STE_SINGLE_COLLS 0x77 #define STE_DMACTL_RXDMA_STOPPED 0x00000001 #define STE_DMACTL_TXDMA_CMPREQ 0x00000002 From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:09:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F1831065672; Mon, 21 Dec 2009 20:09:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6398FC14; Mon, 21 Dec 2009 20:09:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLK9JiQ039378; Mon, 21 Dec 2009 20:09:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLK9JmD039376; Mon, 21 Dec 2009 20:09:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200912212009.nBLK9JmD039376@svn.freebsd.org> From: John Baldwin Date: Mon, 21 Dec 2009 20:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200805 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:09:19 -0000 Author: jhb Date: Mon Dec 21 20:09:19 2009 New Revision: 200805 URL: http://svn.freebsd.org/changeset/base/200805 Log: Remove commented out prototype for ifinit(). This prototype has been commented out since 1.1 and has not been present in since at least 1.1 of that file. It is also not needed in FreeBSD due to SYSINIT(). Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Dec 21 20:02:12 2009 (r200804) +++ head/sys/net/if_var.h Mon Dec 21 20:09:19 2009 (r200805) @@ -843,7 +843,6 @@ void if_ref(struct ifnet *); void if_rele(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); void if_up(struct ifnet *); -/*void ifinit(void);*/ /* declared in systm.h for main() */ int ifioctl(struct socket *, u_long, caddr_t, struct thread *); int ifpromisc(struct ifnet *, int); struct ifnet *ifunit(const char *); From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:12:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 406931065693; Mon, 21 Dec 2009 20:12:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F2A78FC0A; Mon, 21 Dec 2009 20:12:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKC29X039481; Mon, 21 Dec 2009 20:12:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKC2aS039479; Mon, 21 Dec 2009 20:12:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200912212012.nBLKC2aS039479@svn.freebsd.org> From: Xin LI Date: Mon, 21 Dec 2009 20:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200806 - head/usr.sbin/newsyslog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:12:02 -0000 Author: delphij Date: Mon Dec 21 20:12:01 2009 New Revision: 200806 URL: http://svn.freebsd.org/changeset/base/200806 Log: Don't consider non-existence of a PID file an error, we should be able to proceed anyway as this most likely mean that the process has been terminated. PR: bin/140397 Submitted by: Dan Lukes MFC after: 1 month Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Mon Dec 21 20:09:19 2009 (r200805) +++ head/usr.sbin/newsyslog/newsyslog.c Mon Dec 21 20:12:01 2009 (r200806) @@ -1779,7 +1779,18 @@ set_swpid(struct sigwork_entry *swork, c f = fopen(ent->pid_file, "r"); if (f == NULL) { - warn("can't open pid file: %s", ent->pid_file); + if (errno == ENOENT) { + /* + * Warn if the PID file doesn't exist, but do + * not consider it an error. Most likely it + * means the process has been terminated, + * so it should be safe to rotate any log + * files that the process would have been using. + */ + swork->sw_pidok = 1; + warnx("pid file doesn't exist: %s", ent->pid_file); + } else + warn("can't open pid file: %s", ent->pid_file); return; } From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:18:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78F9B106568D; Mon, 21 Dec 2009 20:18:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66C428FC16; Mon, 21 Dec 2009 20:18:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKI1se039684; Mon, 21 Dec 2009 20:18:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKI13S039682; Mon, 21 Dec 2009 20:18:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912212018.nBLKI13S039682@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 20:18:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200808 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:18:01 -0000 Author: yongari Date: Mon Dec 21 20:18:01 2009 New Revision: 200808 URL: http://svn.freebsd.org/changeset/base/200808 Log: style(9) Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 20:17:34 2009 (r200807) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 20:18:01 2009 (r200808) @@ -202,7 +202,7 @@ SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, C static void ste_mii_sync(struct ste_softc *sc) { - int i; + int i; MII_SET(STE_PHYCTL_MDIR|STE_PHYCTL_MDATA); @@ -220,7 +220,7 @@ ste_mii_sync(struct ste_softc *sc) static void ste_mii_send(struct ste_softc *sc, uint32_t bits, int cnt) { - int i; + int i; MII_CLR(STE_PHYCTL_MCLK); @@ -243,7 +243,7 @@ ste_mii_send(struct ste_softc *sc, uint3 static int ste_mii_readreg(struct ste_softc *sc, struct ste_mii_frame *frame) { - int i, ack; + int i, ack; /* * Set up frame for RX. @@ -290,7 +290,7 @@ ste_mii_readreg(struct ste_softc *sc, st * need to clock through 16 cycles to keep the PHY(s) in sync. */ if (ack) { - for(i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { MII_CLR(STE_PHYCTL_MCLK); DELAY(1); MII_SET(STE_PHYCTL_MCLK); @@ -319,8 +319,8 @@ fail: DELAY(1); if (ack) - return(1); - return(0); + return (1); + return (0); } /* @@ -363,14 +363,14 @@ ste_mii_writereg(struct ste_softc *sc, s */ MII_CLR(STE_PHYCTL_MDIR); - return(0); + return (0); } static int ste_miibus_readreg(device_t dev, int phy, int reg) { - struct ste_softc *sc; - struct ste_mii_frame frame; + struct ste_softc *sc; + struct ste_mii_frame frame; sc = device_get_softc(dev); @@ -383,14 +383,14 @@ ste_miibus_readreg(device_t dev, int phy frame.mii_regaddr = reg; ste_mii_readreg(sc, &frame); - return(frame.mii_data); + return (frame.mii_data); } static int ste_miibus_writereg(device_t dev, int phy, int reg, int data) { - struct ste_softc *sc; - struct ste_mii_frame frame; + struct ste_softc *sc; + struct ste_mii_frame frame; sc = device_get_softc(dev); bzero((char *)&frame, sizeof(frame)); @@ -401,14 +401,14 @@ ste_miibus_writereg(device_t dev, int ph ste_mii_writereg(sc, &frame); - return(0); + return (0); } static void ste_miibus_statchg(device_t dev) { - struct ste_softc *sc; - struct mii_data *mii; + struct ste_softc *sc; + struct mii_data *mii; sc = device_get_softc(dev); @@ -424,21 +424,21 @@ ste_miibus_statchg(device_t dev) static int ste_ifmedia_upd(struct ifnet *ifp) { - struct ste_softc *sc; + struct ste_softc *sc; sc = ifp->if_softc; STE_LOCK(sc); ste_ifmedia_upd_locked(ifp); STE_UNLOCK(sc); - return(0); + return (0); } static void ste_ifmedia_upd_locked(struct ifnet *ifp) { - struct ste_softc *sc; - struct mii_data *mii; + struct ste_softc *sc; + struct mii_data *mii; sc = ifp->if_softc; STE_LOCK_ASSERT(sc); @@ -455,8 +455,8 @@ ste_ifmedia_upd_locked(struct ifnet *ifp static void ste_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct ste_softc *sc; - struct mii_data *mii; + struct ste_softc *sc; + struct mii_data *mii; sc = ifp->if_softc; mii = device_get_softc(sc->ste_miibus); @@ -471,7 +471,7 @@ ste_ifmedia_sts(struct ifnet *ifp, struc static void ste_wait(struct ste_softc *sc) { - int i; + int i; for (i = 0; i < STE_TIMEOUT; i++) { if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG)) @@ -489,7 +489,7 @@ ste_wait(struct ste_softc *sc) static int ste_eeprom_wait(struct ste_softc *sc) { - int i; + int i; DELAY(1000); @@ -502,10 +502,10 @@ ste_eeprom_wait(struct ste_softc *sc) if (i == 100) { device_printf(sc->ste_dev, "eeprom failed to come ready\n"); - return(1); + return (1); } - return(0); + return (0); } /* @@ -515,11 +515,11 @@ ste_eeprom_wait(struct ste_softc *sc) static int ste_read_eeprom(struct ste_softc *sc, caddr_t dest, int off, int cnt, int swap) { - int err = 0, i; - uint16_t word = 0, *ptr; + uint16_t word, *ptr; + int err = 0, i; if (ste_eeprom_wait(sc)) - return(1); + return (1); for (i = 0; i < cnt; i++) { CSR_WRITE_2(sc, STE_EEPROM_CTL, STE_EEOPCODE_READ | (off + i)); @@ -534,16 +534,16 @@ ste_read_eeprom(struct ste_softc *sc, ca *ptr = word; } - return(err ? 1 : 0); + return (err ? 1 : 0); } static void ste_setmulti(struct ste_softc *sc) { - struct ifnet *ifp; - int h = 0; - uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + uint32_t hashes[2] = { 0, 0 }; + int h; ifp = sc->ste_ifp; if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { @@ -640,9 +640,9 @@ ste_poll_locked(struct ifnet *ifp, enum static void ste_intr(void *xsc) { - struct ste_softc *sc; - struct ifnet *ifp; - uint16_t status; + struct ste_softc *sc; + struct ifnet *ifp; + uint16_t status; sc = xsc; STE_LOCK(sc); @@ -732,17 +732,17 @@ ste_rxeoc(struct ste_softc *sc) static int ste_rxeof(struct ste_softc *sc) { - struct mbuf *m; - struct ifnet *ifp; - struct ste_chain_onefrag *cur_rx; - int total_len = 0, count=0, rx_npkts = 0; - uint32_t rxstat; + struct mbuf *m; + struct ifnet *ifp; + struct ste_chain_onefrag *cur_rx; + uint32_t rxstat; + int total_len = 0, count = 0, rx_npkts = 0; STE_LOCK_ASSERT(sc); ifp = sc->ste_ifp; - while((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status) + while ((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status) & STE_RXSTAT_DMADONE) { #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { @@ -819,8 +819,8 @@ ste_rxeof(struct ste_softc *sc) static void ste_txeoc(struct ste_softc *sc) { - uint8_t txstat; - struct ifnet *ifp; + struct ifnet *ifp; + uint8_t txstat; ifp = sc->ste_ifp; @@ -856,14 +856,14 @@ ste_txeoc(struct ste_softc *sc) static void ste_txeof(struct ste_softc *sc) { - struct ste_chain *cur_tx; - struct ifnet *ifp; - int idx; + struct ifnet *ifp; + struct ste_chain *cur_tx; + int idx; ifp = sc->ste_ifp; idx = sc->ste_cdata.ste_tx_cons; - while(idx != sc->ste_cdata.ste_tx_prod) { + while (idx != sc->ste_cdata.ste_tx_prod) { cur_tx = &sc->ste_cdata.ste_tx_chain[idx]; if (!(cur_tx->ste_ptr->ste_ctl & STE_TXCTL_DMADONE)) @@ -885,9 +885,9 @@ ste_txeof(struct ste_softc *sc) static void ste_stats_update(void *xsc) { - struct ste_softc *sc; - struct ifnet *ifp; - struct mii_data *mii; + struct ste_softc *sc; + struct ifnet *ifp; + struct mii_data *mii; sc = xsc; STE_LOCK_ASSERT(sc); @@ -927,11 +927,11 @@ ste_stats_update(void *xsc) static int ste_probe(device_t dev) { - struct ste_type *t; + struct ste_type *t; t = ste_devs; - while(t->ste_name != NULL) { + while (t->ste_name != NULL) { if ((pci_get_vendor(dev) == t->ste_vid) && (pci_get_device(dev) == t->ste_did)) { device_set_desc(dev, t->ste_name); @@ -940,7 +940,7 @@ ste_probe(device_t dev) t++; } - return(ENXIO); + return (ENXIO); } /* @@ -950,10 +950,10 @@ ste_probe(device_t dev) static int ste_attach(device_t dev) { - struct ste_softc *sc; - struct ifnet *ifp; - int error = 0, rid; - u_char eaddr[6]; + struct ste_softc *sc; + struct ifnet *ifp; + u_char eaddr[6]; + int error = 0, rid; sc = device_get_softc(dev); sc->ste_dev = dev; @@ -1082,7 +1082,7 @@ fail: if (error) ste_detach(dev); - return(error); + return (error); } /* @@ -1095,8 +1095,8 @@ fail: static int ste_detach(device_t dev) { - struct ste_softc *sc; - struct ifnet *ifp; + struct ste_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); KASSERT(mtx_initialized(&sc->ste_mtx), ("ste mutex not initialized")); @@ -1136,22 +1136,22 @@ ste_detach(device_t dev) mtx_destroy(&sc->ste_mtx); - return(0); + return (0); } static int ste_newbuf(struct ste_softc *sc, struct ste_chain_onefrag *c, struct mbuf *m) { - struct mbuf *m_new = NULL; + struct mbuf *m_new = NULL; if (m == NULL) { MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) - return(ENOBUFS); + return (ENOBUFS); MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); - return(ENOBUFS); + return (ENOBUFS); } m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; } else { @@ -1167,15 +1167,15 @@ ste_newbuf(struct ste_softc *sc, struct c->ste_ptr->ste_frag.ste_addr = vtophys(mtod(m_new, caddr_t)); c->ste_ptr->ste_frag.ste_len = (1536 + ETHER_VLAN_ENCAP_LEN) | STE_FRAG_LAST; - return(0); + return (0); } static int ste_init_rx_list(struct ste_softc *sc) { - struct ste_chain_data *cd; - struct ste_list_data *ld; - int i; + struct ste_chain_data *cd; + struct ste_list_data *ld; + int i; cd = &sc->ste_cdata; ld = sc->ste_ldata; @@ -1183,7 +1183,7 @@ ste_init_rx_list(struct ste_softc *sc) for (i = 0; i < STE_RX_LIST_CNT; i++) { cd->ste_rx_chain[i].ste_ptr = &ld->ste_rx_list[i]; if (ste_newbuf(sc, &cd->ste_rx_chain[i], NULL) == ENOBUFS) - return(ENOBUFS); + return (ENOBUFS); if (i == (STE_RX_LIST_CNT - 1)) { cd->ste_rx_chain[i].ste_next = &cd->ste_rx_chain[0]; @@ -1200,15 +1200,15 @@ ste_init_rx_list(struct ste_softc *sc) cd->ste_rx_head = &cd->ste_rx_chain[0]; - return(0); + return (0); } static void ste_init_tx_list(struct ste_softc *sc) { - struct ste_chain_data *cd; - struct ste_list_data *ld; - int i; + struct ste_chain_data *cd; + struct ste_list_data *ld; + int i; cd = &sc->ste_cdata; ld = sc->ste_ldata; @@ -1232,7 +1232,7 @@ ste_init_tx_list(struct ste_softc *sc) static void ste_init(void *xsc) { - struct ste_softc *sc; + struct ste_softc *sc; sc = xsc; STE_LOCK(sc); @@ -1243,8 +1243,8 @@ ste_init(void *xsc) static void ste_init_locked(struct ste_softc *sc) { - int i; - struct ifnet *ifp; + struct ifnet *ifp; + int i; STE_LOCK_ASSERT(sc); ifp = sc->ste_ifp; @@ -1353,8 +1353,8 @@ ste_init_locked(struct ste_softc *sc) static void ste_stop(struct ste_softc *sc) { - int i; - struct ifnet *ifp; + struct ifnet *ifp; + int i; STE_LOCK_ASSERT(sc); ifp = sc->ste_ifp; @@ -1397,7 +1397,7 @@ ste_stop(struct ste_softc *sc) static void ste_reset(struct ste_softc *sc) { - int i; + int i; STE_SETBIT4(sc, STE_ASICCTL, STE_ASICCTL_GLOBAL_RESET|STE_ASICCTL_RX_RESET| @@ -1420,15 +1420,15 @@ ste_reset(struct ste_softc *sc) static int ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - struct ste_softc *sc; - struct ifreq *ifr; - struct mii_data *mii; - int error = 0; + struct ste_softc *sc; + struct ifreq *ifr; + struct mii_data *mii; + int error = 0; sc = ifp->if_softc; ifr = (struct ifreq *)data; - switch(command) { + switch (command) { case SIOCSIFFLAGS: STE_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -1476,7 +1476,7 @@ ste_ioctl(struct ifnet *ifp, u_long comm !(ifp->if_capenable & IFCAP_POLLING)) { error = ether_poll_register(ste_poll, ifp); if (error) - return(error); + return (error); STE_LOCK(sc); /* Disable interrupts */ CSR_WRITE_2(sc, STE_IMR, 0); @@ -1502,16 +1502,16 @@ ste_ioctl(struct ifnet *ifp, u_long comm break; } - return(error); + return (error); } static int ste_encap(struct ste_softc *sc, struct ste_chain *c, struct mbuf *m_head) { - int frag = 0; - struct ste_frag *f = NULL; - struct mbuf *m; - struct ste_desc *d; + struct mbuf *m; + struct ste_desc *d; + struct ste_frag *f = NULL; + int frag = 0; d = c->ste_ptr; d->ste_ctl = 0; @@ -1549,13 +1549,13 @@ encap_retry: d->ste_frags[frag - 1].ste_len |= STE_FRAG_LAST; d->ste_ctl = 1; - return(0); + return (0); } static void ste_start(struct ifnet *ifp) { - struct ste_softc *sc; + struct ste_softc *sc; sc = ifp->if_softc; STE_LOCK(sc); @@ -1566,10 +1566,10 @@ ste_start(struct ifnet *ifp) static void ste_start_locked(struct ifnet *ifp) { - struct ste_softc *sc; - struct mbuf *m_head = NULL; - struct ste_chain *cur_tx; - int idx; + struct ste_softc *sc; + struct ste_chain *cur_tx; + struct mbuf *m_head = NULL; + int idx; sc = ifp->if_softc; STE_LOCK_ASSERT(sc); @@ -1582,7 +1582,7 @@ ste_start_locked(struct ifnet *ifp) idx = sc->ste_cdata.ste_tx_prod; - while(sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) { + while (sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) { /* * We cannot re-use the last (free) descriptor; * the chip may not have read its ste_next yet. @@ -1641,7 +1641,7 @@ ste_start_locked(struct ifnet *ifp) static void ste_watchdog(struct ste_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp; ifp = sc->ste_ifp; STE_LOCK_ASSERT(sc); @@ -1663,7 +1663,7 @@ ste_watchdog(struct ste_softc *sc) static int ste_shutdown(device_t dev) { - struct ste_softc *sc; + struct ste_softc *sc; sc = device_get_softc(dev); From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:32:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13E671065676; Mon, 21 Dec 2009 20:32:05 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD5918FC24; Mon, 21 Dec 2009 20:32:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKW4re040003; Mon, 21 Dec 2009 20:32:04 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKW4WV040000; Mon, 21 Dec 2009 20:32:04 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200912212032.nBLKW4WV040000@svn.freebsd.org> From: Doug Barton Date: Mon, 21 Dec 2009 20:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200809 - head/usr.sbin/service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:32:05 -0000 Author: dougb Date: Mon Dec 21 20:32:04 2009 New Revision: 200809 URL: http://svn.freebsd.org/changeset/base/200809 Log: By popular request, execute rc.d scripts in the same environment as they are at boot time. Original concept submitted by: ume Modified: head/usr.sbin/service/service.8 head/usr.sbin/service/service.sh Modified: head/usr.sbin/service/service.8 ============================================================================== --- head/usr.sbin/service/service.8 Mon Dec 21 20:18:01 2009 (r200808) +++ head/usr.sbin/service/service.8 Mon Dec 21 20:32:04 2009 (r200809) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2009 +.Dd December 20, 2009 .Dt service 8 .Os .Sh NAME @@ -44,7 +44,10 @@ The .Nm command is an easy interface to the rc.d system. Its primary purpose is to start and stop services provided -by the rc.d scripts, however it can also be used to list +by the rc.d scripts. +When used for this purpose it will set the same restricted +environment that is in use at boot time (see below). +It can also be used to list the scripts using various criteria. .Pp The options are as follows: @@ -78,6 +81,20 @@ above, but list all of the files, not ju .It Fl v Be slightly more verbose .El +.Sh ENVIRONMENT +When used to run rc.d scripts the +.Nm +command sets +.Ev HOME +to +.Pa / +and +.Ev PATH +to +.Pa /sbin:/bin:/usr/sbin:/usr/bin +which is how they are set in +.Pa /etc/rc +at boot time. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES Modified: head/usr.sbin/service/service.sh ============================================================================== --- head/usr.sbin/service/service.sh Mon Dec 21 20:18:01 2009 (r200808) +++ head/usr.sbin/service/service.sh Mon Dec 21 20:32:04 2009 (r200809) @@ -106,11 +106,11 @@ else exit 1 fi +cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - $dir/$script $* - exit $? + exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $* fi done From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:34:22 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24D29106568D for ; Mon, 21 Dec 2009 20:34:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id AD24D8FC27 for ; Mon, 21 Dec 2009 20:34:21 +0000 (UTC) Received: (qmail 25627 invoked by uid 399); 21 Dec 2009 20:34:21 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 21 Dec 2009 20:34:21 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B2FDBD1.7030808@FreeBSD.org> Date: Mon, 21 Dec 2009 12:34:25 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Thunderbird 2.0.0.23 (X11/20091206) MIME-Version: 1.0 To: Hajimu UMEMOTO References: <200912200134.nBK1YCAA048942@svn.freebsd.org> <4B2DBB51.9060002@FreeBSD.org> <4B2DD2A1.8060907@FreeBSD.org> <4B2E84CF.2060902@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-rc@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:34:22 -0000 Hajimu UMEMOTO wrote: >>>>>> On Sun, 20 Dec 2009 12:10:55 -0800 >>>>>> Doug Barton said: > > dougb> I agree to making the change you suggested, but I would like to > dougb> quibble over the format. Isn't the attached patch equivalent, and > dougb> simpler? What is the value of setting HOME and PATH in the environment > dougb> if we're just going to use 'env -i HOME PATH' anyway? > > Yup, your attached patch is equivalent. However, I prefer the > previous one. In anyway, I don't have a strong opinion around here. Thanks for confirming. My preference generally is for things to be simple and clear which makes them less confusing down the road. I've committed the patch I posted. Thanks again to everyone who offered their feedback. I'll wait a little longer before MFC'ing this, but I do want to get it in ASAP. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:42:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A2511065679; Mon, 21 Dec 2009 20:42:24 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E9188FC0C; Mon, 21 Dec 2009 20:42:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKgOok040243; Mon, 21 Dec 2009 20:42:24 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKgOjo040241; Mon, 21 Dec 2009 20:42:24 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200912212042.nBLKgOjo040241@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 21 Dec 2009 20:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200810 - head/sys/dev/ste X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:42:24 -0000 Author: yongari Date: Mon Dec 21 20:42:23 2009 New Revision: 200810 URL: http://svn.freebsd.org/changeset/base/200810 Log: Sort function prototyes. Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Dec 21 20:32:04 2009 (r200809) +++ head/sys/dev/ste/if_ste.c Mon Dec 21 20:42:23 2009 (r200810) @@ -91,45 +91,44 @@ static struct ste_type ste_devs[] = { { 0, 0, NULL } }; -static int ste_probe(device_t); -static int ste_attach(device_t); -static int ste_detach(device_t); -static void ste_init(void *); -static void ste_init_locked(struct ste_softc *); -static void ste_intr(void *); -static void ste_rxeoc(struct ste_softc *); -static int ste_rxeof(struct ste_softc *); -static void ste_txeoc(struct ste_softc *); -static void ste_txeof(struct ste_softc *); -static void ste_stats_update(void *); -static void ste_stop(struct ste_softc *); -static void ste_reset(struct ste_softc *); -static int ste_ioctl(struct ifnet *, u_long, caddr_t); -static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *); -static void ste_start(struct ifnet *); -static void ste_start_locked(struct ifnet *); -static void ste_watchdog(struct ste_softc *); -static int ste_shutdown(device_t); -static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *, - struct mbuf *); -static int ste_ifmedia_upd(struct ifnet *); -static void ste_ifmedia_upd_locked(struct ifnet *); -static void ste_ifmedia_sts(struct ifnet *, struct ifmediareq *); - -static void ste_mii_sync(struct ste_softc *); -static void ste_mii_send(struct ste_softc *, uint32_t, int); -static int ste_mii_readreg(struct ste_softc *, struct ste_mii_frame *); -static int ste_mii_writereg(struct ste_softc *, struct ste_mii_frame *); -static int ste_miibus_readreg(device_t, int, int); -static int ste_miibus_writereg(device_t, int, int, int); -static void ste_miibus_statchg(device_t); - -static int ste_eeprom_wait(struct ste_softc *); -static int ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int); -static void ste_wait(struct ste_softc *); -static void ste_setmulti(struct ste_softc *); -static int ste_init_rx_list(struct ste_softc *); -static void ste_init_tx_list(struct ste_softc *); +static int ste_attach(device_t); +static int ste_detach(device_t); +static int ste_probe(device_t); +static int ste_shutdown(device_t); + +static int ste_eeprom_wait(struct ste_softc *); +static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *); +static int ste_ifmedia_upd(struct ifnet *); +static void ste_ifmedia_upd_locked(struct ifnet *); +static void ste_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void ste_init(void *); +static void ste_init_locked(struct ste_softc *); +static int ste_init_rx_list(struct ste_softc *); +static void ste_init_tx_list(struct ste_softc *); +static void ste_intr(void *); +static int ste_ioctl(struct ifnet *, u_long, caddr_t); +static int ste_mii_readreg(struct ste_softc *, struct ste_mii_frame *); +static void ste_mii_send(struct ste_softc *, uint32_t, int); +static void ste_mii_sync(struct ste_softc *); +static int ste_mii_writereg(struct ste_softc *, struct ste_mii_frame *); +static int ste_miibus_readreg(device_t, int, int); +static void ste_miibus_statchg(device_t); +static int ste_miibus_writereg(device_t, int, int, int); +static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *, + struct mbuf *); +static int ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int); +static void ste_reset(struct ste_softc *); +static void ste_rxeoc(struct ste_softc *); +static int ste_rxeof(struct ste_softc *); +static void ste_setmulti(struct ste_softc *); +static void ste_start(struct ifnet *); +static void ste_start_locked(struct ifnet *); +static void ste_stats_update(void *); +static void ste_stop(struct ste_softc *); +static void ste_txeoc(struct ste_softc *); +static void ste_txeof(struct ste_softc *); +static void ste_wait(struct ste_softc *); +static void ste_watchdog(struct ste_softc *); #ifdef STE_USEIOSPACE #define STE_RES SYS_RES_IOPORT From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 20:47:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BCC11065693; Mon, 21 Dec 2009 20:47:42 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00A158FC27; Mon, 21 Dec 2009 20:47:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLKlfb7040389; Mon, 21 Dec 2009 20:47:41 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLKlfeL040387; Mon, 21 Dec 2009 20:47:41 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912212047.nBLKlfeL040387@svn.freebsd.org> From: Edward Tomasz Napierala Date: Mon, 21 Dec 2009 20:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200811 - head/tools/regression/acltools X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 20:47:42 -0000 Author: trasz Date: Mon Dec 21 20:47:41 2009 New Revision: 200811 URL: http://svn.freebsd.org/changeset/base/200811 Log: Add regression test for NFSv4 ACLs on UFS. Added: head/tools/regression/acltools/02.t (contents, props changed) Added: head/tools/regression/acltools/02.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/02.t Mon Dec 21 20:47:41 2009 (r200811) @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Copyright (c) 2008, 2009 Edward Tomasz Napierała +# 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 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 AUTHOR 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. +# +# $FreeBSD$ +# + +# This is a wrapper script to run tools-nfs4.test. +# +# If any of the tests fails, here is how to debug it: go to +# the directory with problematic filesystem mounted on it, +# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test +# +# Output should be obvious. + +echo "1..4" + +if [ `whoami` != "root" ]; then + echo "not ok 1 - you need to be root to run this test." + exit 1 +fi + +TESTDIR=`dirname $0` + +# Set up the test filesystem. +MD=`mdconfig -at swap -s 10m` +MNT=`mktemp -dt acltools` +newfs /dev/$MD > /dev/null +mount -o nfsv4acls /dev/$MD $MNT +if [ $? -ne 0 ]; then + echo "not ok 1 - mount failed." + exit 1 +fi + +echo "ok 1" + +cd $MNT + +# First, check whether we can crash the kernel by creating too many +# entries. For some reason this won't work in the test file. +touch xxx +setfacl -x5 xxx +while :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done +chmod 600 xxx +rm xxx +echo "ok 2" + +perl $TESTDIR/run $TESTDIR/tools-nfs4.test > /dev/null + +if [ $? -eq 0 ]; then + echo "ok 3" +else + echo "not ok 3" +fi + +cd / +umount -f $MNT +rmdir $MNT +mdconfig -du $MD + +echo "ok 4" + From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 21:27:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 548FF106566B; Mon, 21 Dec 2009 21:27:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 436128FC1B; Mon, 21 Dec 2009 21:27:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLLRvQP041341; Mon, 21 Dec 2009 21:27:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLLRvSW041339; Mon, 21 Dec 2009 21:27:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912212127.nBLLRvSW041339@svn.freebsd.org> From: Alexander Motin Date: Mon, 21 Dec 2009 21:27:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200814 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 21:27:57 -0000 Author: mav Date: Mon Dec 21 21:27:56 2009 New Revision: 200814 URL: http://svn.freebsd.org/changeset/base/200814 Log: Clear all ports interrupt status bits in single write. Clearing one by one causes additional MSIs messages sent if several ports asked for attention same time. Time window before clearing is not important, as these interrupts are level triggered by interrupt source. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Dec 21 21:17:59 2009 (r200813) +++ head/sys/dev/ahci/ahci.c Mon Dec 21 21:27:56 2009 (r200814) @@ -596,20 +596,18 @@ ahci_intr(void *data) unit = irq->r_irq_rid - 1; is = ATA_INL(ctlr->r_mem, AHCI_IS); } + /* Some controllers have edge triggered IS. */ + if (ctlr->quirks & AHCI_Q_EDGEIS) + ATA_OUTL(ctlr->r_mem, AHCI_IS, is); for (; unit < ctlr->channels; unit++) { if ((is & (1 << unit)) != 0 && (arg = ctlr->interrupt[unit].argument)) { - if (ctlr->quirks & AHCI_Q_EDGEIS) { - /* Some controller have edge triggered IS. */ - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); ctlr->interrupt[unit].function(arg); - } else { - /* but AHCI declares level triggered IS. */ - ctlr->interrupt[unit].function(arg); - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); - } } } + /* AHCI declares level triggered IS. */ + if (!(ctlr->quirks & AHCI_Q_EDGEIS)) + ATA_OUTL(ctlr->r_mem, AHCI_IS, is); } /* From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 21:29:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8206106568B; Mon, 21 Dec 2009 21:29:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95A138FC14; Mon, 21 Dec 2009 21:29:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLLTGZ2041408; Mon, 21 Dec 2009 21:29:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLLTGj4041401; Mon, 21 Dec 2009 21:29:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912212129.nBLLTGj4041401@svn.freebsd.org> From: Marius Strobl Date: Mon, 21 Dec 2009 21:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200815 - in head/sys: dev/auxio sparc64/central sparc64/fhc sparc64/pci sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 21:29:16 -0000 Author: marius Date: Mon Dec 21 21:29:16 2009 New Revision: 200815 URL: http://svn.freebsd.org/changeset/base/200815 Log: Provide and consume missing module dependency information. Modified: head/sys/dev/auxio/auxio.c head/sys/sparc64/central/central.c head/sys/sparc64/fhc/fhc.c head/sys/sparc64/pci/apb.c head/sys/sparc64/pci/ofw_pcib.c head/sys/sparc64/sparc64/nexus.c Modified: head/sys/dev/auxio/auxio.c ============================================================================== --- head/sys/dev/auxio/auxio.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/dev/auxio/auxio.c Mon Dec 21 21:29:16 2009 (r200815) @@ -56,7 +56,7 @@ */ /* - * AUXIO registers support on the sbus & ebus2, used for the floppy driver + * AUXIO registers support on the SBus & EBus2, used for the floppy driver * and to control the system LED, for the BLINK option. */ @@ -85,8 +85,8 @@ __FBSDID("$FreeBSD$"); #include /* - * on sun4u, auxio exists with one register (LED) on the sbus, and 5 - * registers on the ebus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI + * On sun4u, auxio exists with one register (LED) on the SBus, and 5 + * registers on the EBus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI * OSCILLATOR, and TEMP SENSE. */ @@ -142,6 +142,7 @@ static driver_t auxio_sbus_driver = { static devclass_t auxio_devclass; DRIVER_MODULE(auxio, sbus, auxio_sbus_driver, auxio_devclass, 0, 0); +MODULE_DEPEND(auxio, sbus, 1, 1, 1); /* EBus */ static device_method_t auxio_ebus_methods[] = { @@ -158,6 +159,7 @@ static driver_t auxio_ebus_driver = { }; DRIVER_MODULE(auxio, ebus, auxio_ebus_driver, auxio_devclass, 0, 0); +MODULE_DEPEND(auxio, ebus, 1, 1, 1); MODULE_VERSION(auxio, 1); #define AUXIO_LOCK_INIT(sc) \ Modified: head/sys/sparc64/central/central.c ============================================================================== --- head/sys/sparc64/central/central.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/sparc64/central/central.c Mon Dec 21 21:29:16 2009 (r200815) @@ -106,6 +106,7 @@ static driver_t central_driver = { static devclass_t central_devclass; DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0); +MODULE_DEPEND(fhc, nexus, 1, 1, 1); MODULE_VERSION(central, 1); static int Modified: head/sys/sparc64/fhc/fhc.c ============================================================================== --- head/sys/sparc64/fhc/fhc.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/sparc64/fhc/fhc.c Mon Dec 21 21:29:16 2009 (r200815) @@ -120,8 +120,9 @@ static driver_t fhc_driver = { static devclass_t fhc_devclass; DRIVER_MODULE(fhc, central, fhc_driver, fhc_devclass, 0, 0); -DRIVER_MODULE(fhc, nexus, fhc_driver, fhc_devclass, 0, 0); MODULE_DEPEND(fhc, central, 1, 1, 1); +DRIVER_MODULE(fhc, nexus, fhc_driver, fhc_devclass, 0, 0); +MODULE_DEPEND(fhc, nexus, 1, 1, 1); MODULE_VERSION(fhc, 1); static const struct intr_controller fhc_ic = { Modified: head/sys/sparc64/pci/apb.c ============================================================================== --- head/sys/sparc64/pci/apb.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/sparc64/pci/apb.c Mon Dec 21 21:29:16 2009 (r200815) @@ -112,6 +112,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_0(pcib, apb_driver, apb_methods, sizeof(struct apb_softc)); DRIVER_MODULE(apb, pci, apb_driver, pcib_devclass, 0, 0); +MODULE_DEPEND(apb, pci, 1, 1, 1); /* APB specific registers */ #define APBR_IOMAP 0xde Modified: head/sys/sparc64/pci/ofw_pcib.c ============================================================================== --- head/sys/sparc64/pci/ofw_pcib.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/sparc64/pci/ofw_pcib.c Mon Dec 21 21:29:16 2009 (r200815) @@ -94,6 +94,7 @@ static devclass_t pcib_devclass; DEFINE_CLASS_0(pcib, ofw_pcib_driver, ofw_pcib_methods, sizeof(struct ofw_pcib_gen_softc)); DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0); +MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1); static int ofw_pcib_probe(device_t dev) Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Mon Dec 21 21:27:56 2009 (r200814) +++ head/sys/sparc64/sparc64/nexus.c Mon Dec 21 21:29:16 2009 (r200815) @@ -145,6 +145,7 @@ static devclass_t nexus_devclass; DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc)); DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); +MODULE_VERSION(nexus, 1); static const char *const nexus_excl_name[] = { "aliases", From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 21:41:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2981106566B; Mon, 21 Dec 2009 21:41:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9184F8FC1B; Mon, 21 Dec 2009 21:41:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLLfXk5041690; Mon, 21 Dec 2009 21:41:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLLfXrb041688; Mon, 21 Dec 2009 21:41:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912212141.nBLLfXrb041688@svn.freebsd.org> From: Marius Strobl Date: Mon, 21 Dec 2009 21:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200816 - head/sys/sparc64/sbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 21:41:33 -0000 Author: marius Date: Mon Dec 21 21:41:33 2009 New Revision: 200816 URL: http://svn.freebsd.org/changeset/base/200816 Log: Add missing module dependency information. Modified: head/sys/sparc64/sbus/sbus.c Modified: head/sys/sparc64/sbus/sbus.c ============================================================================== --- head/sys/sparc64/sbus/sbus.c Mon Dec 21 21:29:16 2009 (r200815) +++ head/sys/sparc64/sbus/sbus.c Mon Dec 21 21:41:33 2009 (r200816) @@ -248,6 +248,7 @@ static driver_t sbus_driver = { static devclass_t sbus_devclass; DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0); +MODULE_DEPEND(sbus, nexus, 1, 1, 1); MODULE_VERSION(sbus, 1); #define OFW_SBUS_TYPE "sbus" From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 21:44:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6523106566B; Mon, 21 Dec 2009 21:44:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 781528FC15; Mon, 21 Dec 2009 21:44:57 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 29FFF46B32; Mon, 21 Dec 2009 16:44:57 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 62E408A01F; Mon, 21 Dec 2009 16:44:56 -0500 (EST) From: John Baldwin To: src-committers@freebsd.org Date: Mon, 21 Dec 2009 14:59:21 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912211943.nBLJhNUU038425@svn.freebsd.org> In-Reply-To: <200912211943.nBLJhNUU038425@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200912211459.21766.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 21 Dec 2009 16:44:56 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r200797 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 21:44:57 -0000 On Monday 21 December 2009 2:43:23 pm John Baldwin wrote: > Author: jhb > Date: Mon Dec 21 19:43:23 2009 > New Revision: 200797 > URL: http://svn.freebsd.org/changeset/base/200797 > > Log: > Use _once() to initialize the pthread key for thread-local storage to hold > the results of localtime() instead of using a pthread mutex directly. It would probably be simpler to use TLS for this instead, but I'm not sure if we have working TLS on all supported platforms. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 21:47:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F8DE1065676; Mon, 21 Dec 2009 21:47:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EC0B8FC1E; Mon, 21 Dec 2009 21:47:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLLlXaV041845; Mon, 21 Dec 2009 21:47:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLLlXAB041843; Mon, 21 Dec 2009 21:47:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912212147.nBLLlXAB041843@svn.freebsd.org> From: Alexander Motin Date: Mon, 21 Dec 2009 21:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200817 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 21:47:33 -0000 Author: mav Date: Mon Dec 21 21:47:33 2009 New Revision: 200817 URL: http://svn.freebsd.org/changeset/base/200817 Log: Spell AMD properly. Modified: head/sys/dev/ata/chipsets/ata-amd.c Modified: head/sys/dev/ata/chipsets/ata-amd.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-amd.c Mon Dec 21 21:41:33 2009 (r200816) +++ head/sys/dev/ata/chipsets/ata-amd.c Mon Dec 21 21:47:33 2009 (r200817) @@ -61,7 +61,7 @@ static int ata_amd_setmode(device_t dev, #define AMD_CABLE 0x02 /* - * American Micro Devices (AMD) chipset support functions + * Advanced Micro Devices (AMD) chipset support functions */ static int ata_amd_probe(device_t dev) From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 22:00:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FF89106566C; Mon, 21 Dec 2009 22:00:07 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id D38D68FC1C; Mon, 21 Dec 2009 22:00:06 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id nBLM04dK095982; Mon, 21 Dec 2009 23:00:05 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id nBLM04QP095981; Mon, 21 Dec 2009 23:00:04 +0100 (CET) (envelope-from marius) Date: Mon, 21 Dec 2009 23:00:04 +0100 From: Marius Strobl To: John Baldwin Message-ID: <20091221220004.GA42400@alchemy.franken.de> References: <200912211943.nBLJhNUU038425@svn.freebsd.org> <200912211459.21766.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200912211459.21766.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r200797 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 22:00:07 -0000 On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote: > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote: > > Author: jhb > > Date: Mon Dec 21 19:43:23 2009 > > New Revision: 200797 > > URL: http://svn.freebsd.org/changeset/base/200797 > > > > Log: > > Use _once() to initialize the pthread key for thread-local storage to hold > > the results of localtime() instead of using a pthread mutex directly. > > It would probably be simpler to use TLS for this instead, but I'm not sure if > we have working TLS on all supported platforms. > At least not on arm and sparc64 as the in-tree binutils predate GNU TLS support for these. Marius From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 22:03:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16AEF106566C; Mon, 21 Dec 2009 22:03:59 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id BA7388FC16; Mon, 21 Dec 2009 22:03:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id C8D2A9CB0E6; Mon, 21 Dec 2009 23:01:42 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pzzu8DKIpKgR; Mon, 21 Dec 2009 23:01:40 +0100 (CET) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 214AA9CB1B0; Mon, 21 Dec 2009 23:01:40 +0100 (CET) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id nBLM1d6N084486; Mon, 21 Dec 2009 23:01:39 +0100 (CET) (envelope-from rdivacky) Date: Mon, 21 Dec 2009 23:01:39 +0100 From: Roman Divacky To: Marius Strobl Message-ID: <20091221220139.GA84109@freebsd.org> References: <200912211943.nBLJhNUU038425@svn.freebsd.org> <200912211459.21766.jhb@freebsd.org> <20091221220004.GA42400@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091221220004.GA42400@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r200797 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 22:03:59 -0000 On Mon, Dec 21, 2009 at 11:00:04PM +0100, Marius Strobl wrote: > On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote: > > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote: > > > Author: jhb > > > Date: Mon Dec 21 19:43:23 2009 > > > New Revision: 200797 > > > URL: http://svn.freebsd.org/changeset/base/200797 > > > > > > Log: > > > Use _once() to initialize the pthread key for thread-local storage to hold > > > the results of localtime() instead of using a pthread mutex directly. > > > > It would probably be simpler to use TLS for this instead, but I'm not sure if > > we have working TLS on all supported platforms. > > > > At least not on arm and sparc64 as the in-tree binutils predate > GNU TLS support for these. pardon my ignorance but what exactly is needed in binutils to support TLS? is it just (g)as? or ld too? From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 22:16:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BA54106568B; Mon, 21 Dec 2009 22:16:07 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1308FC15; Mon, 21 Dec 2009 22:16:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLMG7Xp042493; Mon, 21 Dec 2009 22:16:07 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLMG7gl042491; Mon, 21 Dec 2009 22:16:07 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200912212216.nBLMG7gl042491@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 21 Dec 2009 22:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200818 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 22:16:07 -0000 Author: jilles Date: Mon Dec 21 22:16:07 2009 New Revision: 200818 URL: http://svn.freebsd.org/changeset/base/200818 Log: rc.subr: Use pwait in wait_for_pids. This waits for the requested process(es) to terminate, rather than polling with an interval of 2 seconds. If pwait is not available, the old method is used. PR: conf/132766 Reviewed by: dougb Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Mon Dec 21 21:47:33 2009 (r200817) +++ head/etc/rc.subr Mon Dec 21 22:16:07 2009 (r200818) @@ -390,7 +390,7 @@ wait_for_pids() _list=$_nlist echo -n ${_prefix:-"Waiting for PIDS: "}$_list _prefix=", " - sleep 2 + pwait $_list 2>/dev/null || sleep 2 done if [ -n "$_prefix" ]; then echo "." From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 22:56:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E32F21065679; Mon, 21 Dec 2009 22:56:06 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D23B68FC15; Mon, 21 Dec 2009 22:56:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLMu6jm043610; Mon, 21 Dec 2009 22:56:06 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLMu6D1043608; Mon, 21 Dec 2009 22:56:06 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <200912212256.nBLMu6D1043608@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 21 Dec 2009 22:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200819 - head/usr.sbin/powerd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 22:56:07 -0000 Author: gavin Date: Mon Dec 21 22:56:06 2009 New Revision: 200819 URL: http://svn.freebsd.org/changeset/base/200819 Log: Grammar and minor tweaks to powerd(8) man page. PR: docs/133186 Approved by: ed (mentor) MFC after: 2 weeks Modified: head/usr.sbin/powerd/powerd.8 Modified: head/usr.sbin/powerd/powerd.8 ============================================================================== --- head/usr.sbin/powerd/powerd.8 Mon Dec 21 22:16:07 2009 (r200818) +++ head/usr.sbin/powerd/powerd.8 Mon Dec 21 22:56:06 2009 (r200819) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 24, 2008 +.Dd December 21, 2009 .Dt POWERD 8 .Os .Sh NAME @@ -45,7 +45,7 @@ The .Nm utility monitors the system state and sets various power control options accordingly. -It offers three modes (maximum, minimum, and adaptive) that can be +It offers four modes (maximum, minimum, adaptive and hiadaptive) that can be individually selected while on AC power or batteries. The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, min, adp, hadp. @@ -57,9 +57,10 @@ Adaptive mode attempts to strike a balan the system appears idle and increasing it when the system is busy. It offers a good balance between a small performance loss for greatly increased power savings. -Hiadaptive mode is alike adaptive mode, but tuned for systems where +Hiadaptive mode is like adaptive mode, but tuned for systems where performance and interactivity are more important then power consumption. -It rises frequency faster, drops slower and keeps twice lower CPU load. +It increases frequency faster, reduces the frequency less aggressively and +will maintain full frequency for longer. The default mode is adaptive for battery power and hiadaptive for the rest. .Pp The From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 22:57:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58D441065670; Mon, 21 Dec 2009 22:57:40 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4871C8FC0A; Mon, 21 Dec 2009 22:57:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLMvegS043677; Mon, 21 Dec 2009 22:57:40 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLMveQg043675; Mon, 21 Dec 2009 22:57:40 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <200912212257.nBLMveQg043675@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 21 Dec 2009 22:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200820 - head/sys/dev/uart X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 22:57:40 -0000 Author: gavin Date: Mon Dec 21 22:57:40 2009 New Revision: 200820 URL: http://svn.freebsd.org/changeset/base/200820 Log: Support the tablet in (at least) the Toshiba Portege M200 Tablet PC. This device only appears on the ACPI bus, so isn't caught by the current entry for it in the uart(4) ISA attachment. PR: kern/140172 Reviewed by: jhb, marcel Approved by: ed (mentor) MFC after: 2 weeks Modified: head/sys/dev/uart/uart_bus_acpi.c Modified: head/sys/dev/uart/uart_bus_acpi.c ============================================================================== --- head/sys/dev/uart/uart_bus_acpi.c Mon Dec 21 22:56:06 2009 (r200819) +++ head/sys/dev/uart/uart_bus_acpi.c Mon Dec 21 22:57:40 2009 (r200820) @@ -59,6 +59,7 @@ static driver_t uart_acpi_driver = { static struct isa_pnp_id acpi_ns8250_ids[] = { {0x0005d041, "Standard PC COM port"}, /* PNP0500 */ {0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */ + {0x04f0235c, "Wacom Tablet PC Screen"}, /* WACF004 */ {0} }; From owner-svn-src-head@FreeBSD.ORG Mon Dec 21 23:31:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC2B31065693; Mon, 21 Dec 2009 23:31:03 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 826C18FC14; Mon, 21 Dec 2009 23:31:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBLNV3xe044326; Mon, 21 Dec 2009 23:31:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBLNV3Kb044323; Mon, 21 Dec 2009 23:31:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912212331.nBLNV3Kb044323@svn.freebsd.org> From: Alexander Motin Date: Mon, 21 Dec 2009 23:31:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200821 - head/sys/geom/raid3 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2009 23:31:03 -0000 Author: mav Date: Mon Dec 21 23:31:03 2009 New Revision: 200821 URL: http://svn.freebsd.org/changeset/base/200821 Log: Make graid3 fallback to malloc() when component request size is bigger then maximal prepared UMA zone size. This fixes crash with MAXPHYS > 128K. Modified: head/sys/geom/raid3/g_raid3.c head/sys/geom/raid3/g_raid3.h Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Mon Dec 21 22:57:40 2009 (r200820) +++ head/sys/geom/raid3/g_raid3.c Mon Dec 21 23:31:03 2009 (r200821) @@ -183,15 +183,17 @@ static void * g_raid3_alloc(struct g_raid3_softc *sc, size_t size, int flags) { void *ptr; + enum g_raid3_zones zone; - if (g_raid3_use_malloc) + if (g_raid3_use_malloc || + (zone = g_raid3_zone(size)) == G_RAID3_NUM_ZONES) ptr = malloc(size, M_RAID3, flags); else { - ptr = uma_zalloc_arg(sc->sc_zones[g_raid3_zone(size)].sz_zone, - &sc->sc_zones[g_raid3_zone(size)], flags); - sc->sc_zones[g_raid3_zone(size)].sz_requested++; + ptr = uma_zalloc_arg(sc->sc_zones[zone].sz_zone, + &sc->sc_zones[zone], flags); + sc->sc_zones[zone].sz_requested++; if (ptr == NULL) - sc->sc_zones[g_raid3_zone(size)].sz_failed++; + sc->sc_zones[zone].sz_failed++; } return (ptr); } @@ -199,12 +201,14 @@ g_raid3_alloc(struct g_raid3_softc *sc, static void g_raid3_free(struct g_raid3_softc *sc, void *ptr, size_t size) { + enum g_raid3_zones zone; - if (g_raid3_use_malloc) + if (g_raid3_use_malloc || + (zone = g_raid3_zone(size)) == G_RAID3_NUM_ZONES) free(ptr, M_RAID3); else { - uma_zfree_arg(sc->sc_zones[g_raid3_zone(size)].sz_zone, - ptr, &sc->sc_zones[g_raid3_zone(size)]); + uma_zfree_arg(sc->sc_zones[zone].sz_zone, + ptr, &sc->sc_zones[zone]); } } Modified: head/sys/geom/raid3/g_raid3.h ============================================================================== --- head/sys/geom/raid3/g_raid3.h Mon Dec 21 22:57:40 2009 (r200820) +++ head/sys/geom/raid3/g_raid3.h Mon Dec 21 23:31:03 2009 (r200821) @@ -183,7 +183,9 @@ enum g_raid3_zones { static __inline enum g_raid3_zones g_raid3_zone(size_t nbytes) { - if (nbytes > 16384) + if (nbytes > 65536) + return (G_RAID3_NUM_ZONES); + else if (nbytes > 16384) return (G_RAID3_ZONE_64K); else if (nbytes > 4096) return (G_RAID3_ZONE_16K); From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 01:57:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23F15106566B; Tue, 22 Dec 2009 01:57:35 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1354D8FC1F; Tue, 22 Dec 2009 01:57:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM1vYJ3047142; Tue, 22 Dec 2009 01:57:34 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM1vYEq047140; Tue, 22 Dec 2009 01:57:34 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220157.nBM1vYEq047140@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 01:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200822 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 01:57:35 -0000 Author: thompsa Date: Tue Dec 22 01:57:34 2009 New Revision: 200822 URL: http://svn.freebsd.org/changeset/base/200822 Log: Add more EHCI pci ids. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/ehci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Dec 21 23:31:03 2009 (r200821) +++ head/sys/dev/usb/controller/ehci_pci.c Tue Dec 22 01:57:34 2009 (r200822) @@ -197,6 +197,10 @@ ehci_pci_match(device_t self) return "Intel 82801JI (ICH10) USB 2.0 controller USB-A"; case 0x3a3c8086: return "Intel 82801JI (ICH10) USB 2.0 controller USB-B"; + case 0x3b348086: + return ("Intel PCH USB 2.0 controller USB-A"); + case 0x3b3c8086: + return ("Intel PCH USB 2.0 controller USB-B"); case 0x00e01033: return ("NEC uPD 720100 USB 2.0 controller"); @@ -213,6 +217,12 @@ ehci_pci_match(device_t self) return "NVIDIA nForce4 USB 2.0 controller"; case 0x03f210de: return "NVIDIA nForce MCP61 USB 2.0 controller"; + case 0x0aa610de: + return "NVIDIA nForce MCP79 USB 2.0 controller"; + case 0x0aa910de: + return "NVIDIA nForce MCP79 USB 2.0 controller"; + case 0x0aaa10de: + return "NVIDIA nForce MCP79 USB 2.0 controller"; case 0x15621131: return "Philips ISP156x USB 2.0 controller"; From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 01:59:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98FC11065679; Tue, 22 Dec 2009 01:59:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887498FC17; Tue, 22 Dec 2009 01:59:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM1xHdr047204; Tue, 22 Dec 2009 01:59:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM1xH3l047202; Tue, 22 Dec 2009 01:59:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220159.nBM1xH3l047202@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 01:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200823 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 01:59:17 -0000 Author: thompsa Date: Tue Dec 22 01:59:17 2009 New Revision: 200823 URL: http://svn.freebsd.org/changeset/base/200823 Log: Add more OHCI pci ids. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/ohci_pci.c Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Tue Dec 22 01:57:34 2009 (r200822) +++ head/sys/dev/usb/controller/ohci_pci.c Tue Dec 22 01:59:17 2009 (r200823) @@ -175,6 +175,12 @@ ohci_pci_match(device_t self) case 0x03f110de: return ("nVidia nForce MCP61 USB Controller"); + case 0x0aa510de: + return ("nVidia nForce MCP79 USB Controller"); + case 0x0aa710de: + return ("nVidia nForce MCP79 USB Controller"); + case 0x0aa810de: + return ("nVidia nForce MCP79 USB Controller"); case 0x70011039: return ("SiS 5571 USB controller"); From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 02:04:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F21B1065696; Tue, 22 Dec 2009 02:04:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EC878FC12; Tue, 22 Dec 2009 02:04:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM24HrS047359; Tue, 22 Dec 2009 02:04:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM24Hhl047357; Tue, 22 Dec 2009 02:04:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220204.nBM24Hhl047357@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 02:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200824 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 02:04:17 -0000 Author: thompsa Date: Tue Dec 22 02:04:16 2009 New Revision: 200824 URL: http://svn.freebsd.org/changeset/base/200824 Log: Set correct USB device description Submitted by: Paul B Mahol Modified: head/sys/dev/if_ndis/if_ndis_usb.c Modified: head/sys/dev/if_ndis/if_ndis_usb.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_usb.c Tue Dec 22 01:59:17 2009 (r200823) +++ head/sys/dev/if_ndis/if_ndis_usb.c Tue Dec 22 02:04:16 2009 (r200824) @@ -165,6 +165,7 @@ ndisusb_attach(device_t self) driver_object *drv; int devidx = 0; + device_set_usb_desc(self); db = uaa->driver_ivar; sc = (struct ndis_softc *)dummy; sc->ndis_dev = self; From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 02:11:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5615D106568B; Tue, 22 Dec 2009 02:11:38 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 447298FC17; Tue, 22 Dec 2009 02:11:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM2Bc3I047527; Tue, 22 Dec 2009 02:11:38 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM2BcxU047525; Tue, 22 Dec 2009 02:11:38 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220211.nBM2BcxU047525@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 02:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200825 - head/sys/dev/sound/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 02:11:38 -0000 Author: thompsa Date: Tue Dec 22 02:11:37 2009 New Revision: 200825 URL: http://svn.freebsd.org/changeset/base/200825 Log: - add support for more than 2 audio channels. [1] - add support for more sample rates Submitted by: [1] ariff (earlier version), Hans Petter Selasky Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Tue Dec 22 02:04:16 2009 (r200824) +++ head/sys/dev/sound/usb/uaudio.c Tue Dec 22 02:11:37 2009 (r200825) @@ -87,20 +87,27 @@ #include #include "feeder_if.h" -static int uaudio_default_rate = 96000; +static int uaudio_default_rate = 0; /* use rate list */ static int uaudio_default_bits = 32; -static int uaudio_default_channels = 2; +static int uaudio_default_channels = 0; /* use default */ #if USB_DEBUG static int uaudio_debug = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); + SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RW, &uaudio_debug, 0, "uaudio debug level"); + +TUNABLE_INT("hw.usb.uaudio.default_rate", &uaudio_default_rate); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RW, &uaudio_default_rate, 0, "uaudio default sample rate"); + +TUNABLE_INT("hw.usb.uaudio.default_bits", &uaudio_default_bits); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RW, &uaudio_default_bits, 0, "uaudio default sample bits"); + +TUNABLE_INT("hw.usb.uaudio.default_channels", &uaudio_default_channels); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RW, &uaudio_default_channels, 0, "uaudio default sample channels"); #endif @@ -169,10 +176,16 @@ struct uaudio_chan { uint32_t intr_size; /* in bytes */ uint32_t intr_frames; /* in units */ uint32_t sample_rate; + uint32_t frames_per_second; + uint32_t sample_rem; + uint32_t sample_curr; + uint32_t format; uint32_t pcm_format[2]; - uint16_t bytes_per_frame; + uint16_t bytes_per_frame[2]; + + uint16_t sample_size; uint8_t valid; uint8_t iface_index; @@ -330,7 +343,7 @@ static usb_callback_t umidi_write_clear_ static usb_callback_t umidi_bulk_write_callback; static void uaudio_chan_fill_info_sub(struct uaudio_softc *, - struct usb_device *, uint32_t, uint16_t, uint8_t, uint8_t); + struct usb_device *, uint32_t, uint8_t, uint8_t); static void uaudio_chan_fill_info(struct uaudio_softc *, struct usb_device *); static void uaudio_mixer_add_ctl_sub(struct uaudio_softc *, @@ -787,8 +800,7 @@ uaudio_chan_dump_ep_desc(const usb2_endp static void uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, - uint32_t rate, uint16_t fps, uint8_t channels, - uint8_t bit_resolution) + uint32_t rate, uint8_t channels, uint8_t bit_resolution) { struct usb_descriptor *desc = NULL; const struct usb2_audio_streaming_interface_descriptor *asid = NULL; @@ -811,7 +823,6 @@ uaudio_chan_fill_info_sub(struct uaudio_ uint8_t bBitResolution; uint8_t x; uint8_t audio_if = 0; - uint8_t sample_size; while ((desc = usb_desc_foreach(cd, desc))) { @@ -1040,16 +1051,10 @@ uaudio_chan_fill_info_sub(struct uaudio_ chan->usb2_cfg = uaudio_cfg_play; - sample_size = (( + chan->sample_size = (( UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) * chan->p_asf1d->bBitResolution) / 8); - /* - * NOTE: "chan->bytes_per_frame" - * should not be zero! - */ - chan->bytes_per_frame = ((rate / fps) * sample_size); - if (sc->sc_sndstat_valid) { sbuf_printf(&sc->sc_sndstat, "\n\t" "mode %d.%d:(%s) %dch, %d/%dbit, %s, %dHz", @@ -1067,12 +1072,32 @@ uaudio_chan_fill_info_sub(struct uaudio_ } } +/* This structure defines all the supported rates. */ + +static const uint32_t uaudio_rate_list[] = { + 96000, + 88000, + 80000, + 72000, + 64000, + 56000, + 48000, + 44100, + 40000, + 32000, + 24000, + 22050, + 16000, + 11025, + 8000, + 0 +}; + static void uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev) { uint32_t rate = uaudio_default_rate; - uint32_t z; - uint16_t fps = usbd_get_isoc_fps(udev); + uint8_t z; uint8_t bits = uaudio_default_bits; uint8_t y; uint8_t channels = uaudio_default_channels; @@ -1083,14 +1108,24 @@ uaudio_chan_fill_info(struct uaudio_soft /* set a valid value */ bits = 32; } - rate -= (rate % fps); - if ((rate == 0) || (rate > 192000)) { - /* set a valid value */ - rate = 192000 - (192000 % fps); - } - if ((channels == 0) || (channels > 2)) { - /* set a valid value */ - channels = 2; + if (channels == 0) { + switch (usbd_get_speed(udev)) { + case USB_SPEED_LOW: + case USB_SPEED_FULL: + /* + * Due to high bandwidth usage and problems + * with HIGH-speed split transactions we + * disable surround setups on FULL-speed USB + * by default + */ + channels = 2; + break; + default: + channels = 16; + break; + } + } else if (channels > 16) { + channels = 16; } if (sbuf_new(&sc->sc_sndstat, NULL, 4096, SBUF_AUTOEXTEND)) { sc->sc_sndstat_valid = 1; @@ -1099,8 +1134,14 @@ uaudio_chan_fill_info(struct uaudio_soft for (x = channels; x; x--) { for (y = bits; y; y -= 8) { - for (z = rate; z; z -= fps) { - uaudio_chan_fill_info_sub(sc, udev, z, fps, x, y); + + /* try user defined rate, if any */ + if (rate != 0) + uaudio_chan_fill_info_sub(sc, udev, rate, x, y); + + /* try find a matching rate, if any */ + for (z = 0; uaudio_rate_list[z]; z++) { + uaudio_chan_fill_info_sub(sc, udev, uaudio_rate_list[z], x, y); if (sc->sc_rec_chan.valid && sc->sc_play_chan.valid) { @@ -1116,18 +1157,6 @@ done: } } -/* - * The following function sets up data size and block count for the - * next audio transfer. - */ -static void -uaudio_setup_blockcount(struct uaudio_chan *ch, - uint32_t *total, uint32_t *blockcount) -{ - *total = ch->intr_size; - *blockcount = ch->intr_frames; -} - static void uaudio_chan_play_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -1137,12 +1166,11 @@ uaudio_chan_play_callback(struct usb_xfe uint32_t blockcount; uint32_t n; uint32_t offset; - int actlen, sumlen; + int actlen; + int sumlen; usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); - uaudio_setup_blockcount(ch, &total, &blockcount); - if (ch->end == ch->start) { DPRINTF("no buffer!\n"); return; @@ -1153,22 +1181,39 @@ uaudio_chan_play_callback(struct usb_xfe tr_transferred: if (actlen < sumlen) { DPRINTF("short transfer, " - "%d of %d bytes\n", actlen, total); + "%d of %d bytes\n", actlen, sumlen); } chn_intr(ch->pcm_ch); case USB_ST_SETUP: - if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) { + if (ch->bytes_per_frame[1] > usbd_xfer_max_framelen(xfer)) { DPRINTF("bytes per transfer, %d, " "exceeds maximum, %d!\n", - ch->bytes_per_frame, + ch->bytes_per_frame[1], usbd_xfer_max_framelen(xfer)); break; } - /* setup frame length */ + + blockcount = ch->intr_frames; + + /* setup number of frames */ usbd_xfer_set_frames(xfer, blockcount); - for (n = 0; n != blockcount; n++) - usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); + + /* reset total length */ + total = 0; + + /* setup frame lengths */ + for (n = 0; n != blockcount; n++) { + ch->sample_curr += ch->sample_rem; + if (ch->sample_curr >= ch->frames_per_second) { + ch->sample_curr -= ch->frames_per_second; + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame[1]); + total += ch->bytes_per_frame[1]; + } else { + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame[0]); + total += ch->bytes_per_frame[0]; + } + } DPRINTFN(6, "transfer %d bytes\n", total); @@ -1210,7 +1255,6 @@ uaudio_chan_record_callback(struct usb_x struct usb_page_cache *pc; uint32_t n; uint32_t m; - uint32_t total; uint32_t blockcount; uint32_t offset0; uint32_t offset1; @@ -1222,8 +1266,6 @@ uaudio_chan_record_callback(struct usb_x usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); mfl = usbd_xfer_max_framelen(xfer); - uaudio_setup_blockcount(ch, &total, &blockcount); - if (ch->end == ch->start) { DPRINTF("no buffer!\n"); return; @@ -1231,12 +1273,8 @@ uaudio_chan_record_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (actlen < total) { - DPRINTF("short transfer, " - "%d of %d bytes\n", actlen, total); - } else { - DPRINTFN(6, "transferred %d bytes\n", actlen); - } + + DPRINTFN(6, "transferred %d bytes\n", actlen); offset0 = 0; pc = usbd_xfer_get_frame(xfer, 0); @@ -1271,6 +1309,8 @@ uaudio_chan_record_callback(struct usb_x case USB_ST_SETUP: tr_setup: + blockcount = ch->intr_frames; + usbd_xfer_set_frames(xfer, blockcount); for (n = 0; n < blockcount; n++) { usbd_xfer_set_frame_len(xfer, n, mfl); @@ -1295,6 +1335,8 @@ uaudio_chan_init(struct uaudio_softc *sc &sc->sc_play_chan : &sc->sc_rec_chan); uint32_t buf_size; uint32_t frames; + uint32_t format; + uint16_t fps; uint8_t endpoint; uint8_t blocks; uint8_t iface_index; @@ -1302,7 +1344,9 @@ uaudio_chan_init(struct uaudio_softc *sc uint8_t fps_shift; usb_error_t err; - if (usbd_get_isoc_fps(sc->sc_udev) < 8000) { + fps = usbd_get_isoc_fps(sc->sc_udev); + + if (fps < 8000) { /* FULL speed USB */ frames = 8; } else { @@ -1310,10 +1354,6 @@ uaudio_chan_init(struct uaudio_softc *sc frames = UAUDIO_NFRAMES; } - /* compute required buffer size */ - - buf_size = (ch->bytes_per_frame * frames); - /* setup play/record format */ ch->pcm_cap.fmtlist = ch->pcm_format; @@ -1329,15 +1369,34 @@ uaudio_chan_init(struct uaudio_softc *sc ch->pcm_ch = c; ch->pcm_mtx = c->lock; - if (ch->p_asf1d->bNrChannels >= 2) - ch->pcm_cap.fmtlist[0] = - SND_FORMAT(ch->p_fmt->freebsd_fmt, 2, 0); - else - ch->pcm_cap.fmtlist[0] = - SND_FORMAT(ch->p_fmt->freebsd_fmt, 1, 0); + format = ch->p_fmt->freebsd_fmt; + + switch (ch->p_asf1d->bNrChannels) { + case 2: + /* stereo */ + format = SND_FORMAT(format, 2, 0); + break; + case 1: + /* mono */ + format = SND_FORMAT(format, 1, 0); + break; + default: + /* surround and more */ + format = feeder_matrix_default_format( + SND_FORMAT(format, ch->p_asf1d->bNrChannels, 0)); + break; + } + ch->pcm_cap.fmtlist[0] = format; ch->pcm_cap.fmtlist[1] = 0; + /* check if format is not supported */ + + if (format == 0) { + DPRINTF("The selected audio format is not supported\n"); + goto error; + } + /* set alternate interface corresponding to the mode */ endpoint = ch->p_ed1->bEndpointAddress; @@ -1377,10 +1436,27 @@ uaudio_chan_init(struct uaudio_softc *sc fps_shift = usbd_xfer_get_fps_shift(ch->xfer[0]); - /* setup frame sizes */ + /* down shift number of frames per second, if any */ + fps >>= fps_shift; + frames >>= fps_shift; + + /* bytes per frame should not be zero */ + ch->bytes_per_frame[0] = ((ch->sample_rate / fps) * ch->sample_size); + ch->bytes_per_frame[1] = (((ch->sample_rate + fps - 1) / fps) * ch->sample_size); + + /* setup data rate dithering, if any */ + ch->frames_per_second = fps; + ch->sample_rem = ch->sample_rate % fps; + ch->sample_curr = 0; + ch->frames_per_second = fps; + + /* compute required buffer size */ + buf_size = (ch->bytes_per_frame[1] * frames); + ch->intr_size = buf_size; - ch->intr_frames = (frames >> fps_shift); - ch->bytes_per_frame <<= fps_shift; + ch->intr_frames = frames; + + DPRINTF("fps=%d sample_rem=%d\n", fps, ch->sample_rem); if (ch->intr_frames == 0) { DPRINTF("frame shift is too high!\n"); From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 02:13:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0A31106568B; Tue, 22 Dec 2009 02:13:23 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E01098FC13; Tue, 22 Dec 2009 02:13:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM2DNxH047593; Tue, 22 Dec 2009 02:13:23 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM2DN0c047591; Tue, 22 Dec 2009 02:13:23 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220213.nBM2DN0c047591@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 02:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200826 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 02:13:24 -0000 Author: thompsa Date: Tue Dec 22 02:13:23 2009 New Revision: 200826 URL: http://svn.freebsd.org/changeset/base/200826 Log: add new ID to UFTDI driver. Submitted by: YAMAMOTO, Shigeru Modified: head/sys/dev/usb/serial/uftdi.c Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Tue Dec 22 02:11:37 2009 (r200825) +++ head/sys/dev/usb/serial/uftdi.c Tue Dec 22 02:13:23 2009 (r200826) @@ -252,6 +252,7 @@ static struct usb_device_id uftdi_devs[] {USB_VPI(USB_VENDOR_BBELECTRONICS, USB_PRODUCT_BBELECTRONICS_USOTL4, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_MARVELL, USB_PRODUCT_MARVELL_SHEEVAPLUG, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1, UFTDI_TYPE_8U232AM)}, + {USB_VPI(USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60F, UFTDI_TYPE_8U232AM)}, }; static int From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 02:15:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDEF8106566C; Tue, 22 Dec 2009 02:15:36 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD9DF8FC0C; Tue, 22 Dec 2009 02:15:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM2FaVA047685; Tue, 22 Dec 2009 02:15:36 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM2Faoi047683; Tue, 22 Dec 2009 02:15:36 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200912220215.nBM2Faoi047683@svn.freebsd.org> From: Andrew Thompson Date: Tue, 22 Dec 2009 02:15:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200827 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 02:15:36 -0000 Author: thompsa Date: Tue Dec 22 02:15:36 2009 New Revision: 200827 URL: http://svn.freebsd.org/changeset/base/200827 Log: Add missed usb product define in r200826. Modified: head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Dec 22 02:13:23 2009 (r200826) +++ head/sys/dev/usb/usbdevs Tue Dec 22 02:15:36 2009 (r200827) @@ -2347,6 +2347,7 @@ product ROCKFIRE GAMEPAD 0x2033 gamepad /* RATOC Systems products */ product RATOC REXUSB60 0xb000 REX-USB60 +product RATOC REXUSB60F 0xb020 REX-USB60F /* Sagem products */ product SAGEM USBSERIAL 0x0027 USB-Serial Controller From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 03:50:50 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89B7D1065679; Tue, 22 Dec 2009 03:50:50 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 487D18FC13; Tue, 22 Dec 2009 03:50:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBM3nQdU040767; Mon, 21 Dec 2009 20:49:26 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 21 Dec 2009 20:49:59 -0700 (MST) Message-Id: <20091221.204959.104237699577179806.imp@bsdimp.com> To: dougb@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <4B2C127A.8060509@FreeBSD.org> References: <200912161541.53834.jhb@freebsd.org> <868wd0cyjd.fsf@ds4.des.no> <4B2C127A.8060509@FreeBSD.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, des@des.no, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, jhb@FreeBSD.org Subject: Re: svn commit: r200606 - in head/sys: compat/freebsd32 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 03:50:50 -0000 In message: <4B2C127A.8060509@FreeBSD.org> Doug Barton writes: : Dag-Erling Sm=F8rgrav wrote: : > John Baldwin writes: : >> Warner Losh writes: : >>> Log: : >>> Fix compiling FREEBSD_COMPAT[4,5,6] without FREEBSD_COMPAT7. : >>> = : >>> Note: Not sure this is the right way to do compat, but it makes= the : >>> headers consistent with the implementations. : >> Please revert. I think this has already been reverted once before= .= : > = : > Yep, that was me... we concluded back then that this is a perfectl= y : > reasonable dependency; perhaps we should simply add the appropriate= : > #ifndef / #error constructs so you can't define FREEBSD_COMPAT(n) : > without FREEBSD_COMPAT(n+1). : = : Trying to look at this from the user perspective, it's kind of silly : that if what I want is COMPAT5 I also need to add COMPAT. : = : I don't know the issues in the code so I don't know what the solution= : should be on the back end, but on the front end what needs to work is= : that I specify the compat level I want in my kernel config, then the : code does what's necessary to make that work. The trouble is that we need to do this globally, or certain definitions don't get defined. It is easier to just #error out than hack config to do the right thing I think... Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 04:10:30 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CFC41065670; Tue, 22 Dec 2009 04:10:30 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0418FC12; Tue, 22 Dec 2009 04:10:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBM48Ggl040937; Mon, 21 Dec 2009 21:08:17 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 21 Dec 2009 21:08:50 -0700 (MST) Message-Id: <20091221.210850.220301508585541755.imp@bsdimp.com> To: brooks@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20091220183519.GB64667@lor.one-eyed-alien.net> References: <4B2DD2A1.8060907@FreeBSD.org> <20091220183519.GB64667@lor.one-eyed-alien.net> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: dougb@FreeBSD.org, freebsd-rc@FreeBSD.org, ume@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r200743 - in head/usr.sbin: . service X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 04:10:30 -0000 In message: <20091220183519.GB64667@lor.one-eyed-alien.net> Brooks Davis writes: : On Sun, Dec 20, 2009 at 06:31:56PM +0900, Hajimu UMEMOTO wrote: : > Hi, : > : > >>>>> On Sat, 19 Dec 2009 23:30:41 -0800 : > >>>>> Doug Barton said: : > : > > About the value this change, I think it should be same as the values : > > at boot time. I cannot imagine that someone want to restart the : > > system daemons under the user environment. : > : > dougb> I can actually, especially for ports. : > : > Yup, I often do restart the services installed from ports, too. : > I meant that I don't want that the values of user environment are : > inherited to the services which is started from the user environment. : : This is where the value of service(8) would lie for me. The ability : to not have things work by accident due to my environment and then break : at reboot would be be very helful. I'd love to have some way to say 'If the daemon dies, please restart it. But don't be so eager about it that your attempts to keep it running interfere with things like service' Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 04:22:08 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DDA2106566C; Tue, 22 Dec 2009 04:22:08 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 28F468FC0A; Tue, 22 Dec 2009 04:22:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBM4GEUg041008; Mon, 21 Dec 2009 21:16:14 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 21 Dec 2009 21:16:48 -0700 (MST) Message-Id: <20091221.211648.632868945383134253.imp@bsdimp.com> To: marius@alchemy.franken.de From: "M. Warner Losh" In-Reply-To: <20091221220004.GA42400@alchemy.franken.de> References: <200912211943.nBLJhNUU038425@svn.freebsd.org> <200912211459.21766.jhb@freebsd.org> <20091221220004.GA42400@alchemy.franken.de> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, jhb@FreeBSD.org Subject: Re: svn commit: r200797 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 04:22:08 -0000 In message: <20091221220004.GA42400@alchemy.franken.de> Marius Strobl writes: : On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote: : > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote: : > > Author: jhb : > > Date: Mon Dec 21 19:43:23 2009 : > > New Revision: 200797 : > > URL: http://svn.freebsd.org/changeset/base/200797 : > > : > > Log: : > > Use _once() to initialize the pthread key for thread-local storage to hold : > > the results of localtime() instead of using a pthread mutex directly. : > : > It would probably be simpler to use TLS for this instead, but I'm not sure if : > we have working TLS on all supported platforms. : > : : At least not on arm and sparc64 as the in-tree binutils predate : GNU TLS support for these. We really need newer binutils in the tree. And we need a way to compiler gplv3 binutils into the system for folks that can do that without consequences... But many modern processors need to have the gplv3 version of binutils and that will be a continuing problem. One advantage of FreeBSD is its integration, rather than having to play version whack-a-mole like you do with embedded Linux. Warner From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 09:03:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C4E41065693; Tue, 22 Dec 2009 09:03:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF5B8FC14; Tue, 22 Dec 2009 09:03:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBM93x4X055945; Tue, 22 Dec 2009 09:03:59 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBM93x7c055943; Tue, 22 Dec 2009 09:03:59 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200912220903.nBM93x7c055943@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 22 Dec 2009 09:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200829 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 09:03:59 -0000 Author: trasz Date: Tue Dec 22 09:03:59 2009 New Revision: 200829 URL: http://svn.freebsd.org/changeset/base/200829 Log: Cosmetic fixes. Modified: head/sys/sys/acl.h Modified: head/sys/sys/acl.h ============================================================================== --- head/sys/sys/acl.h Tue Dec 22 06:09:00 2009 (r200828) +++ head/sys/sys/acl.h Tue Dec 22 09:03:59 2009 (r200829) @@ -99,13 +99,13 @@ struct oldacl { * Current "struct acl". */ struct acl_entry { - acl_tag_t ae_tag; - uid_t ae_id; - acl_perm_t ae_perm; - /* "allow" or "deny". Unused in POSIX ACLs. */ + acl_tag_t ae_tag; + uid_t ae_id; + acl_perm_t ae_perm; + /* NFSv4 entry type, "allow" or "deny". Unused in POSIX.1e ACLs. */ acl_entry_type_t ae_entry_type; - /* Flags control inheritance. Unused in POSIX ACLs. */ - acl_flag_t ae_flags; + /* NFSv4 ACL inheritance. Unused in POSIX.1e ACLs. */ + acl_flag_t ae_flags; }; typedef struct acl_entry *acl_entry_t; From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 10:26:52 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8FDA1065670; Tue, 22 Dec 2009 10:26:52 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 710218FC1A; Tue, 22 Dec 2009 10:26:52 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 7B9231FFC1E; Tue, 22 Dec 2009 10:26:51 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 3232A84513; Tue, 22 Dec 2009 11:26:51 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <200912161541.53834.jhb@freebsd.org> <868wd0cyjd.fsf@ds4.des.no> <4B2C127A.8060509@FreeBSD.org> <20091221.204959.104237699577179806.imp@bsdimp.com> Date: Tue, 22 Dec 2009 11:26:51 +0100 In-Reply-To: <20091221.204959.104237699577179806.imp@bsdimp.com> (M. Warner Losh's message of "Mon, 21 Dec 2009 20:49:59 -0700 (MST)") Message-ID: <864onj8ftg.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, jhb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r200606 - in head/sys: compat/freebsd32 sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 10:26:52 -0000 "M. Warner Losh" writes: > The trouble is that we need to do this globally, or certain > definitions don't get defined. It is easier to just #error out than > hack config to do the right thing I think... Suggestion: Introduce which includes "opt_compat.h" and contains the appropriate logic, then s@"opt_compat.h"@@ throughout the kernel. While you're there, add #include inside #ifdef _KERNEL in headers that use the COMPAT_FREEBSDn macros (e.g. fcntl.h) and see what breaks... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 11:17:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D72D8106568D; Tue, 22 Dec 2009 11:17:10 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACD9C8FC0C; Tue, 22 Dec 2009 11:17:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMBHAar062257; Tue, 22 Dec 2009 11:17:10 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMBHAWC062254; Tue, 22 Dec 2009 11:17:10 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912221117.nBMBHAWC062254@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 22 Dec 2009 11:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200832 - in head: lib/libc/stdtime usr.sbin/zic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 11:17:10 -0000 Author: edwin Date: Tue Dec 22 11:17:10 2009 New Revision: 200832 URL: http://svn.freebsd.org/changeset/base/200832 Log: MFV of tzdata2009t, r200831 zic: - Fix URL / reference to Calendrical Calculations: Third Edition libc/stdtime: - Fix typo in tzfile.5 (no changes in our part) MFC after: 1 week Modified: head/lib/libc/stdtime/tzfile.5 head/usr.sbin/zic/Theory Directory Properties: head/lib/libc/ (props changed) head/lib/libc/stdtime/ (props changed) head/usr.sbin/zic/ (props changed) Modified: head/lib/libc/stdtime/tzfile.5 ============================================================================== --- head/lib/libc/stdtime/tzfile.5 Tue Dec 22 11:09:00 2009 (r200831) +++ head/lib/libc/stdtime/tzfile.5 Tue Dec 22 11:17:10 2009 (r200832) @@ -147,6 +147,6 @@ such instants). .Xr ctime 3 , .Xr time2posix 3 , .Xr zic 8 -.\" @(#)tzfile.5 8.2 +.\" @(#)tzfile.5 8.3 .\" This file is in the public domain, so clarified as of .\" 1996-06-05 by Arthur David Olson. Modified: head/usr.sbin/zic/Theory ============================================================================== --- head/usr.sbin/zic/Theory Tue Dec 22 11:09:00 2009 (r200831) +++ head/usr.sbin/zic/Theory Tue Dec 22 11:17:10 2009 (r200832) @@ -1,4 +1,4 @@ -@(#)Theory 8.3 +@(#)Theory 8.4 This file is in the public domain, so clarified as of 2009-05-17 by Arthur David Olson. $FreeBSD$ @@ -361,10 +361,10 @@ abbreviations like `EST'; this avoids th Calendrical issues are a bit out of scope for a time zone database, but they indicate the sort of problems that we would run into if we extended the time zone database further into the past. An excellent -resource in this area is Edward M. Reingold and Nachum Dershowitz, - -Calendrical Calculations: The Millennium Edition -, Cambridge University Press (2001). Other information and +resource in this area is Nachum Dershowitz and Edward M. Reingold, + +Calendrical Calculations: Third Edition +, Cambridge University Press (2008). Other information and sources are given below. They sometimes disagree. From owner-svn-src-head@FreeBSD.ORG Tue Dec 22 11:21:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 160261065672; Tue, 22 Dec 2009 11:21:04 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04A578FC16; Tue, 22 Dec 2009 11:21:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMBL3JV062489; Tue, 22 Dec 2009 11:21:03 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMBL3C6062485; Tue, 22 Dec 2009 11:21:03 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200912221121.nBMBL3C6062485@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 22 Dec 2009 11:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200835 - head/share/zoneinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 11:21:04 -0000 Author: edwin Date: Tue Dec 22 11:21:03 2009 New Revision: 200835 URL: http://svn.freebsd.org/changeset/base/200835 Log: MFV of tzcode2009t, r200833 Comment only, no data changes. MFC after: 1 week Modified: head/share/zoneinfo/asia head/share/zoneinfo/europe head/share/zoneinfo/zone.tab Directory Properties: head/share/zoneinfo/ (props changed) Modified: head/share/zoneinfo/asia ============================================================================== --- head/share/zoneinfo/asia Tue Dec 22 11:19:00 2009 (r200834) +++ head/share/zoneinfo/asia Tue Dec 22 11:21:03 2009 (r200835) @@ -1,4 +1,4 @@ -# @(#)asia 8.44 +# @(#)asia 8.48 # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. @@ -363,6 +363,69 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # or # West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke, # Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding, # and Yarkand. + +# From Luther Ma (2009-10-17): +# Almost all (>99.9%) ethnic Chinese (properly ethnic Han) living in +# Xinjiang use Chinese Standard Time. Some are aware of Xinjiang time, +# but have no need of it. All planes, trains, and schools function on +# what is called "Beijing time." When Han make an appointment in Chinese +# they implicitly use Beijing time. +# +# On the other hand, ethnic Uyghurs, who make up about half the +# population of Xinjiang, typically use "Xinjiang time" which is two +# hours behind Beijing time, or UTC +0600. The government of the Xinjiang +# Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as +# local governments such as the Urumqi city government use both times in +# publications, referring to what is popularly called Xinjiang time as +# "Urumqi time." When Uyghurs make an appointment in the Uyghur language +# they almost invariably use Xinjiang time. +# +# (Their ethnic Han compatriots would typically have no clue of its +# widespread use, however, because so extremely few of them are fluent in +# Uyghur, comparable to the number of Anglo-Americans fluent in Navajo.) +# +# (...As with the rest of China there was a brief interval ending in 1990 +# or 1991 when summer time was in use. The confusion was severe, with +# the province not having dual times but four times in use at the same +# time. Some areas remained on standard Xinjiang time or Beijing time and +# others moving their clocks ahead.) +# +# ...an example of an official website using of Urumqi time. +# +# The first few lines of the Google translation of +# +# http://www.fjysgl.gov.cn/show.aspx?id=2379&cid=39 +# +# (retrieved 2009-10-13) +# > Urumqi fire seven people are missing the alleged losses of at least +# > 500 million yuan +# > +# > (Reporter Dong Liu) the day before 20:20 or so (Urumqi Time 18:20), +# > Urumqi City Department of International Plaza Luther Qiantang River +# > burst fire. As of yesterday, 18:30, Urumqi City Fire officers and men +# > have worked continuously for 22 hours... + +# From Luther Ma (2009-11-19): +# With the risk of being redundant to previous answers these are the most common +# English "transliterations" (w/o using non-English symbols): +# +# 1. Wulumuqi... +# 2. Kashi... +# 3. Urumqi... +# 4. Kashgar... +# ... +# 5. It seems that Uyghurs in Urumqi has been using Xinjiang since at least the +# 1960's. I know of one Han, now over 50, who grew up in the surrounding +# countryside and used Xinjiang time as a child. +# +# 6. Likewise for Kashgar and the rest of south Xinjiang I don't know of any +# start date for Xinjiang time. +# +# Without having access to local historical records, nor the ability to legally +# publish them, I would go with October 1, 1949, when Xinjiang became the Uyghur +# Autonomous Region under the PRC. (Before that Uyghurs, of course, would also +# not be using Beijing time, but some local time.) + Zone Asia/Kashgar 5:03:56 - LMT 1928 # or Kashi or Kaxgar 5:30 - KAST 1940 # Kashgar Time 5:00 - KAST 1980 May @@ -370,8 +433,8 @@ Zone Asia/Kashgar 5:03:56 - LMT 1928 # o # From Lee Yiu Chung (2009-10-24): -# I found there are some mistakes for the historial DST rule for Hong -# Kong. Accoring to the DST record from Hong Kong Observatory (actually, +# I found there are some mistakes for the...DST rule for Hong +# Kong. [According] to the DST record from Hong Kong Observatory (actually, # it is not [an] observatory, but the official meteorological agency of HK, # and also serves as the official timing agency), there are some missing # and incorrect rules. Although the exact switch over time is missing, I Modified: head/share/zoneinfo/europe ============================================================================== --- head/share/zoneinfo/europe Tue Dec 22 11:19:00 2009 (r200834) +++ head/share/zoneinfo/europe Tue Dec 22 11:21:03 2009 (r200835) @@ -1,5 +1,5 @@ #
-# @(#)europe	8.24
+# @(#)europe	8.25
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -2130,12 +2130,20 @@ Zone Asia/Irkutsk	 6:57:20 -	LMT	1880
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Aginskij Buryatskij avtonomnyj okrug, Amurskaya oblast',
 # [parts of] Respublika Sakha (Yakutiya), Chitinskaya oblast'.
+
+# From Oscar van Vlijmen (2009-11-29):
+# ...some regions of RUssia were merged with others since 2005...
+# Some names were changed, no big deal, except for one instance: a new name.
+# YAK/YAKST: UTC+9 Zabajkal'skij kraj.
+
+# From Oscar van Vlijmen (2009-11-29):
 # The Sakha districts are: Aldanskij, Amginskij, Anabarskij,
-# Bulunskij, Verkhnekolymskij, Verkhnevilyujskij, Vilyujskij, Gornyj,
+# Verkhnevilyujskij, Vilyujskij, Gornyj,
 # Zhiganskij, Kobyajskij, Lenskij, Megino-Kangalasskij, Mirninskij,
-# Namskij, Nyurbinskij, Olenekskij, Olekminskij, Srednekolymskij,
+# Namskij, Nyurbinskij, Olenyokskij, Olyokminskij,
 # Suntarskij, Tattinskij, Ust'-Aldanskij, Khangalasskij,
-# Churapchinskij, Eveno-Bytantajskij.
+# Churapchinskij, Eveno-Bytantajskij Natsional'nij.
+
 Zone Asia/Yakutsk	 8:38:40 -	LMT	1919 Dec 15
 			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
 			 9:00	Russia	YAK%sT	1991 Mar 31 2:00s
@@ -2145,7 +2153,9 @@ Zone Asia/Yakutsk	 8:38:40 -	LMT	1919 De
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Evrejskaya avtonomnaya oblast', Khabarovskij kraj, Primorskij kraj,
 # [parts of] Respublika Sakha (Yakutiya).
-# The Sakha districts are: Verkhoyanskij, Tomponskij, Ust'-Majskij,
+
+# From Oscar van Vlijmen (2009-11-29):
+# The Sakha districts are: Bulunskij, Verkhoyanskij, Tomponskij, Ust'-Majskij,
 # Ust'-Yanskij.
 Zone Asia/Vladivostok	 8:47:44 -	LMT	1922 Nov 15
 			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
@@ -2166,8 +2176,10 @@ Zone Asia/Sakhalin	 9:30:48 -	LMT	1905 A
 # From Oscar van Vlijmen (2003-10-18): [This region consists of]
 # Magadanskaya oblast', Respublika Sakha (Yakutiya).
 # Probably also: Kuril Islands.
-# The Sakha districts are: Abyjskij, Allaikhovskij, Momskij,
-# Nizhnekolymskij, Ojmyakonskij.
+
+# From Oscar van Vlijmen (2009-11-29):
+# The Sakha districts are: Abyjskij, Allaikhovskij, Verkhhhnekolymskij, Momskij,
+# Nizhnekolymskij, Ojmyakonskij, Srednekolymskij.
 Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
 			10:00	-	MAGT	1930 Jun 21 # Magadan Time
 			11:00	Russia	MAG%sT	1991 Mar 31 2:00s

Modified: head/share/zoneinfo/zone.tab
==============================================================================
--- head/share/zoneinfo/zone.tab	Tue Dec 22 11:19:00 2009	(r200834)
+++ head/share/zoneinfo/zone.tab	Tue Dec 22 11:21:03 2009	(r200835)
@@ -1,5 +1,5 @@
 # 
-# @(#)zone.tab	8.29
+# @(#)zone.tab	8.31
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 13:53:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35096106566B;
	Tue, 22 Dec 2009 13:53:35 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 235AB8FC0C;
	Tue, 22 Dec 2009 13:53:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMDrZAH065733;
	Tue, 22 Dec 2009 13:53:35 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMDrZTA065728;
	Tue, 22 Dec 2009 13:53:35 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912221353.nBMDrZTA065728@svn.freebsd.org>
From: Luigi Rizzo 
Date: Tue, 22 Dec 2009 13:53:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200838 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 13:53:35 -0000

Author: luigi
Date: Tue Dec 22 13:53:34 2009
New Revision: 200838
URL: http://svn.freebsd.org/changeset/base/200838

Log:
  some mostly cosmetic changes in preparation for upcoming work:
  
  + in many places, replace &V_layer3_chain with a local
    variable chain;
  + bring the counter of rules and static_len within ip_fw_chain
    replacing static variables;
  + remove some spurious comments and extern declaration;
  + document which lock protects certain data structures

Modified:
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_private.h
  head/sys/netinet/ipfw/ip_fw_sockopt.c
  head/sys/netinet/ipfw/ip_fw_table.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Tue Dec 22 13:49:37 2009	(r200837)
+++ head/sys/netinet/ipfw/ip_fw2.c	Tue Dec 22 13:53:34 2009	(r200838)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
+ * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -131,12 +131,10 @@ VNET_DEFINE(u_int32_t, set_disable);
 #define	V_set_disable			VNET(set_disable)
 
 VNET_DEFINE(int, fw_verbose);
-//#define	V_verbose_limit			VNET(verbose_limit)
 /* counter for ipfw_log(NULL...) */
 VNET_DEFINE(u_int64_t, norule_counter);
 VNET_DEFINE(int, verbose_limit);
 
-
 /* layer3_chain contains the list of rules for layer 3 */
 VNET_DEFINE(struct ip_fw_chain, layer3_chain);
 
@@ -147,8 +145,6 @@ ipfw_nat_cfg_t *ipfw_nat_del_ptr;
 ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr;
 ipfw_nat_cfg_t *ipfw_nat_get_log_ptr;
 
-extern int ipfw_chg_hook(SYSCTL_HANDLER_ARGS);
-
 #ifdef SYSCTL_NODE
 SYSCTL_NODE(_net_inet_ip, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
 SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, one_pass,
@@ -173,6 +169,9 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, de
     &default_to_accept, 0,
     "Make the default rule accept all packets.");
 TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept);
+SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count,
+    CTLFLAG_RD, &VNET_NAME(layer3_chain.n_rules), 0,
+    "Number of static rules");
 
 #ifdef INET6
 SYSCTL_DECL(_net_inet6_ip6);
@@ -739,6 +738,17 @@ check_uidgid(ipfw_insn_u32 *insn, int pr
 }
 
 /*
+ * Helper function to write the matching rule into args
+ */
+static inline void
+set_match(struct ip_fw_args *args, struct ip_fw *f, struct ip_fw_chain *chain)
+{
+	args->rule = f;
+	args->rule_id = f->id;
+	args->chain_id = chain->id;
+}
+
+/*
  * The main check routine for the firewall.
  *
  * All arguments are in args so we can modify them and return them
@@ -1942,13 +1952,9 @@ do {								\
 
 			case O_PIPE:
 			case O_QUEUE:
-				args->rule = f; /* report matching rule */
-				args->rule_id = f->id;
-				args->chain_id = chain->id;
-				if (cmd->arg1 == IP_FW_TABLEARG)
-					args->cookie = tablearg;
-				else
-					args->cookie = cmd->arg1;
+				set_match(args, f, chain);
+				args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ?
+					tablearg : cmd->arg1;
 				retval = IP_FW_DUMMYNET;
 				l = 0;          /* exit inner loop */
 				done = 1;       /* exit outer loop */
@@ -2077,13 +2083,9 @@ do {								\
 
 			case O_NETGRAPH:
 			case O_NGTEE:
-				args->rule = f;	/* report matching rule */
-				args->rule_id = f->id;
-				args->chain_id = chain->id;
-				if (cmd->arg1 == IP_FW_TABLEARG)
-					args->cookie = tablearg;
-				else
-					args->cookie = cmd->arg1;
+				set_match(args, f, chain);
+				args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ?
+					tablearg : cmd->arg1;
 				retval = (cmd->opcode == O_NETGRAPH) ?
 				    IP_FW_NETGRAPH : IP_FW_NGTEE;
 				l = 0;          /* exit inner loop */
@@ -2106,14 +2108,12 @@ do {								\
 				    struct cfg_nat *t;
 				    int nat_id;
 
-				    args->rule = f; /* Report matching rule. */
-				    args->rule_id = f->id;
-				    args->chain_id = chain->id;
+				    set_match(args, f, chain);
 				    t = ((ipfw_insn_nat *)cmd)->nat;
 				    if (t == NULL) {
 					nat_id = (cmd->arg1 == IP_FW_TABLEARG) ?
 						tablearg : cmd->arg1;
-					t = (*lookup_nat_ptr)(&V_layer3_chain.nat, nat_id);
+					t = (*lookup_nat_ptr)(&chain->nat, nat_id);
 
 					if (t == NULL) {
 					    retval = IP_FW_DENY;
@@ -2175,9 +2175,7 @@ do {								\
 				    else
 					ip->ip_sum = in_cksum(m, hlen);
 				    retval = IP_FW_REASS;
-				    args->rule = f;
-				    args->rule_id = f->id;
-				    args->chain_id = chain->id;
+				    set_match(args, f, chain);
 				}
 				done = 1;	/* exit outer loop */
 				break;
@@ -2311,8 +2309,13 @@ vnet_ipfw_init(const void *unused)
 {
 	int error;
 	struct ip_fw default_rule;
+	struct ip_fw_chain *chain;
+
+	chain = &V_layer3_chain;
 
 	/* First set up some values that are compile time options */
+	V_autoinc_step = 100;	/* bounded to 1..1000 in add_rule() */
+	V_fw_deny_unknown_exthdrs = 1;
 #ifdef IPFIREWALL_VERBOSE
 	V_fw_verbose = 1;
 #endif
@@ -2320,20 +2323,17 @@ vnet_ipfw_init(const void *unused)
 	V_verbose_limit = IPFIREWALL_VERBOSE_LIMIT;
 #endif
 
-	error = ipfw_init_tables(&V_layer3_chain);
+	error = ipfw_init_tables(chain);
 	if (error) {
 		panic("init_tables"); /* XXX Marko fix this ! */
 	}
 #ifdef IPFIREWALL_NAT
-	LIST_INIT(&V_layer3_chain.nat);
+	LIST_INIT(&chain->nat);
 #endif
 
-	V_autoinc_step = 100;	/* bounded to 1..1000 in add_rule() */
-
-	V_fw_deny_unknown_exthdrs = 1;
 
-	V_layer3_chain.rules = NULL;
-	IPFW_LOCK_INIT(&V_layer3_chain);
+	chain->rules = NULL;
+	IPFW_LOCK_INIT(chain);
 
 	bzero(&default_rule, sizeof default_rule);
 	default_rule.act_ofs = 0;
@@ -2342,17 +2342,17 @@ vnet_ipfw_init(const void *unused)
 	default_rule.set = RESVD_SET;
 	default_rule.cmd[0].len = 1;
 	default_rule.cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
-	error = ipfw_add_rule(&V_layer3_chain, &default_rule);
+	error = ipfw_add_rule(chain, &default_rule);
 
 	if (error != 0) {
 		printf("ipfw2: error %u initializing default rule "
 			"(support disabled)\n", error);
-		IPFW_LOCK_DESTROY(&V_layer3_chain);
+		IPFW_LOCK_DESTROY(chain);
 		printf("leaving ipfw_iattach (1) with error %d\n", error);
 		return (error);
 	}
 
-	V_layer3_chain.default_rule = V_layer3_chain.rules;
+	chain->default_rule = chain->rules;
 
 	ipfw_dyn_init();
 
@@ -2386,6 +2386,7 @@ static int
 vnet_ipfw_uninit(const void *unused)
 {
 	struct ip_fw *reap;
+	struct ip_fw_chain *chain = &V_layer3_chain;
 
 	V_ipfw_vnet_ready = 0; /* tell new callers to go away */
 	/*
@@ -2400,21 +2401,21 @@ vnet_ipfw_uninit(const void *unused)
 	V_ip_fw_chk_ptr = NULL;
 	V_ip_fw_ctl_ptr = NULL;
 
-	IPFW_WLOCK(&V_layer3_chain);
+	IPFW_WLOCK(chain);
 	/* We wait on the wlock here until the last user leaves */
-	IPFW_WUNLOCK(&V_layer3_chain);
-	IPFW_WLOCK(&V_layer3_chain);
+	IPFW_WUNLOCK(chain);
+	IPFW_WLOCK(chain);
 
 	ipfw_dyn_uninit(0);	/* run the callout_drain */
-	ipfw_flush_tables(&V_layer3_chain);
-	V_layer3_chain.reap = NULL;
-	ipfw_free_chain(&V_layer3_chain, 1 /* kill default rule */);
-	reap = V_layer3_chain.reap;
-	V_layer3_chain.reap = NULL;
-	IPFW_WUNLOCK(&V_layer3_chain);
+	ipfw_flush_tables(chain);
+	chain->reap = NULL;
+	ipfw_free_chain(chain, 1 /* kill default rule */);
+	reap = chain->reap;
+	chain->reap = NULL;
+	IPFW_WUNLOCK(chain);
 	if (reap != NULL)
 		ipfw_reap_rules(reap);
-	IPFW_LOCK_DESTROY(&V_layer3_chain);
+	IPFW_LOCK_DESTROY(chain);
 	ipfw_dyn_uninit(1);	/* free the remaining parts */
 	return 0;
 }

Modified: head/sys/netinet/ipfw/ip_fw_private.h
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_private.h	Tue Dec 22 13:49:37 2009	(r200837)
+++ head/sys/netinet/ipfw/ip_fw_private.h	Tue Dec 22 13:53:34 2009	(r200838)
@@ -78,9 +78,11 @@ struct ip_fw_args {
 	struct mbuf	*m;		/* the mbuf chain		*/
 	struct ifnet	*oif;		/* output interface		*/
 	struct sockaddr_in *next_hop;	/* forward address		*/
+
 	struct ip_fw	*rule;		/* matching rule		*/
-	uint32_t	rule_id;	/* matching rule id */
-	uint32_t	chain_id;	/* ruleset id */
+	uint32_t	rule_id;	/* matching rule id		*/
+	uint32_t	chain_id;	/* ruleset id			*/
+
 	struct ether_header *eh;	/* for bridged packets		*/
 
 	struct ipfw_flow_id f_id;	/* grabbed from IP header	*/
@@ -174,6 +176,8 @@ struct ip_fw_chain {
 	struct ip_fw	*rules;		/* list of rules */
 	struct ip_fw	*reap;		/* list of rules to reap */
 	struct ip_fw	*default_rule;
+	int		n_rules;	/* number of static rules */
+	int		static_len;	/* total len of static rules */
 	LIST_HEAD(nat_list, cfg_nat) nat;       /* list of nat entries */
 	struct radix_node_head *tables[IPFW_TABLES_MAX];
 	struct rwlock	rwmtx;

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_sockopt.c	Tue Dec 22 13:49:37 2009	(r200837)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Tue Dec 22 13:53:34 2009	(r200838)
@@ -77,23 +77,9 @@ __FBSDID("$FreeBSD$");
 MALLOC_DEFINE(M_IPFW, "IpFw/IpAcct", "IpFw/IpAcct chain's");
 
 /*
- * static variables followed by global ones
+ * static variables followed by global ones (none in this file)
  */
 
-static VNET_DEFINE(u_int32_t, static_count);	/* # of static rules */
-#define	V_static_count			VNET(static_count)
-
-static VNET_DEFINE(u_int32_t, static_len);	/* bytes of static rules */
-#define	V_static_len			VNET(static_len)
-
-#ifdef SYSCTL_NODE
-SYSCTL_DECL(_net_inet_ip_fw);
-SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count,
-    CTLFLAG_RD, &VNET_NAME(static_count), 0,
-    "Number of static rules");
-
-#endif /* SYSCTL_NODE */
-
 /*
  * When a rule is added/deleted, clear the next_rule pointers in all rules.
  * These will be reconstructed on the fly as packets are matched.
@@ -187,11 +173,9 @@ ipfw_add_rule(struct ip_fw_chain *chain,
 	/* chain->id incremented inside flush_rule_ptrs() */
 	rule->id = chain->id;
 done:
-	V_static_count++;
-	V_static_len += l;
+	chain->n_rules++;
+	chain->static_len += l;
 	IPFW_WUNLOCK(chain);
-	DEB(printf("ipfw: installed rule %d, static count now %d\n",
-		rule->rulenum, V_static_count);)
 	return (0);
 }
 
@@ -218,8 +202,8 @@ remove_rule(struct ip_fw_chain *chain, s
 		chain->rules = n;
 	else
 		prev->next = n;
-	V_static_count--;
-	V_static_len -= l;
+	chain->n_rules--;
+	chain->static_len -= l;
 
 	rule->next = chain->reap;
 	chain->reap = rule;
@@ -839,6 +823,7 @@ ipfw_ctl(struct sockopt *sopt)
 	int error;
 	size_t size;
 	struct ip_fw *buf, *rule;
+	struct ip_fw_chain *chain;
 	u_int32_t rulenum[2];
 
 	error = priv_check(sopt->sopt_td, PRIV_NETINET_IPFW);
@@ -856,6 +841,7 @@ ipfw_ctl(struct sockopt *sopt)
 			return (error);
 	}
 
+	chain = &V_layer3_chain;
 	error = 0;
 
 	switch (sopt->sopt_name) {
@@ -871,7 +857,7 @@ ipfw_ctl(struct sockopt *sopt)
 		 * change between calculating the size and returning the
 		 * data in which case we'll just return what fits.
 		 */
-		size = V_static_len;	/* size of static rules */
+		size = chain->static_len;	/* size of static rules */
 		size += ipfw_dyn_len();
 
 		if (size >= sopt->sopt_valsize)
@@ -883,7 +869,7 @@ ipfw_ctl(struct sockopt *sopt)
 		 */
 		buf = malloc(size, M_TEMP, M_WAITOK);
 		error = sooptcopyout(sopt, buf,
-				ipfw_getrules(&V_layer3_chain, buf, size));
+				ipfw_getrules(chain, buf, size));
 		free(buf, M_TEMP);
 		break;
 
@@ -901,10 +887,10 @@ ipfw_ctl(struct sockopt *sopt)
 		 * the old list without the need for a lock.
 		 */
 
-		IPFW_WLOCK(&V_layer3_chain);
-		ipfw_free_chain(&V_layer3_chain, 0 /* keep default rule */);
-		rule = V_layer3_chain.reap;
-		IPFW_WUNLOCK(&V_layer3_chain);
+		IPFW_WLOCK(chain);
+		ipfw_free_chain(chain, 0 /* keep default rule */);
+		rule = chain->reap;
+		IPFW_WUNLOCK(chain);
 		ipfw_reap_rules(rule);
 		break;
 
@@ -915,7 +901,7 @@ ipfw_ctl(struct sockopt *sopt)
 		if (error == 0)
 			error = check_ipfw_struct(rule, sopt->sopt_valsize);
 		if (error == 0) {
-			error = ipfw_add_rule(&V_layer3_chain, rule);
+			error = ipfw_add_rule(chain, rule);
 			size = RULESIZE(rule);
 			if (!error && sopt->sopt_dir == SOPT_GET)
 				error = sooptcopyout(sopt, rule, size);
@@ -941,13 +927,14 @@ ipfw_ctl(struct sockopt *sopt)
 		if (error)
 			break;
 		size = sopt->sopt_valsize;
-		if (size == sizeof(u_int32_t))	/* delete or reassign */
-			error = del_entry(&V_layer3_chain, rulenum[0]);
-		else if (size == 2*sizeof(u_int32_t)) /* set enable/disable */
+		if (size == sizeof(u_int32_t) && rulenum[0] != 0) {
+			/* delete or reassign, locking done in del_entry() */
+			error = del_entry(chain, rulenum[0]);
+		} else if (size == 2*sizeof(u_int32_t)) { /* set enable/disable */
 			V_set_disable =
 			    (V_set_disable | rulenum[0]) & ~rulenum[1] &
 			    ~(1<sopt_name == IP_FW_RESETLOG);
 		break;
 
+	/*--- TABLE manipulations are protected by the IPFW_LOCK ---*/
 	case IP_FW_TABLE_ADD:
 		{
 			ipfw_table_entry ent;
@@ -972,7 +960,7 @@ ipfw_ctl(struct sockopt *sopt)
 			    sizeof(ent), sizeof(ent));
 			if (error)
 				break;
-			error = ipfw_add_table_entry(&V_layer3_chain, ent.tbl,
+			error = ipfw_add_table_entry(chain, ent.tbl,
 			    ent.addr, ent.masklen, ent.value);
 		}
 		break;
@@ -985,7 +973,7 @@ ipfw_ctl(struct sockopt *sopt)
 			    sizeof(ent), sizeof(ent));
 			if (error)
 				break;
-			error = ipfw_del_table_entry(&V_layer3_chain, ent.tbl,
+			error = ipfw_del_table_entry(chain, ent.tbl,
 			    ent.addr, ent.masklen);
 		}
 		break;
@@ -998,9 +986,9 @@ ipfw_ctl(struct sockopt *sopt)
 			    sizeof(tbl), sizeof(tbl));
 			if (error)
 				break;
-			IPFW_WLOCK(&V_layer3_chain);
-			error = ipfw_flush_table(&V_layer3_chain, tbl);
-			IPFW_WUNLOCK(&V_layer3_chain);
+			IPFW_WLOCK(chain);
+			error = ipfw_flush_table(chain, tbl);
+			IPFW_WUNLOCK(chain);
 		}
 		break;
 
@@ -1011,9 +999,9 @@ ipfw_ctl(struct sockopt *sopt)
 			if ((error = sooptcopyin(sopt, &tbl, sizeof(tbl),
 			    sizeof(tbl))))
 				break;
-			IPFW_RLOCK(&V_layer3_chain);
-			error = ipfw_count_table(&V_layer3_chain, tbl, &cnt);
-			IPFW_RUNLOCK(&V_layer3_chain);
+			IPFW_RLOCK(chain);
+			error = ipfw_count_table(chain, tbl, &cnt);
+			IPFW_RUNLOCK(chain);
 			if (error)
 				break;
 			error = sooptcopyout(sopt, &cnt, sizeof(cnt));
@@ -1037,9 +1025,9 @@ ipfw_ctl(struct sockopt *sopt)
 			}
 			tbl->size = (size - sizeof(*tbl)) /
 			    sizeof(ipfw_table_entry);
-			IPFW_RLOCK(&V_layer3_chain);
-			error = ipfw_dump_table(&V_layer3_chain, tbl);
-			IPFW_RUNLOCK(&V_layer3_chain);
+			IPFW_RLOCK(chain);
+			error = ipfw_dump_table(chain, tbl);
+			IPFW_RUNLOCK(chain);
 			if (error) {
 				free(tbl, M_TEMP);
 				break;
@@ -1049,6 +1037,7 @@ ipfw_ctl(struct sockopt *sopt)
 		}
 		break;
 
+	/*--- NAT operations are protected by the IPFW_LOCK ---*/
 	case IP_FW_NAT_CFG:
 		if (IPFW_NAT_LOADED)
 			error = ipfw_nat_cfg_ptr(sopt);

Modified: head/sys/netinet/ipfw/ip_fw_table.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_table.c	Tue Dec 22 13:49:37 2009	(r200837)
+++ head/sys/netinet/ipfw/ip_fw_table.c	Tue Dec 22 13:53:34 2009	(r200838)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
  * keys are network prefixes (addr/masklen), and values are integers.
  * As a degenerate case we can interpret keys as 32-bit integers
  * (with a /32 mask).
+ *
+ * The table is protected by the IPFW lock even for manipulation coming
+ * from userland, because operations are typically fast.
  */
 
 #if !defined(KLD_MODULE)

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 14:20:32 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A6F81065672;
	Tue, 22 Dec 2009 14:20:32 +0000 (UTC)
	(envelope-from rdivacky@vlk.vlakno.cz)
Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190])
	by mx1.freebsd.org (Postfix) with ESMTP id 22E348FC29;
	Tue, 22 Dec 2009 14:20:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id 47CE59CB070;
	Tue, 22 Dec 2009 15:18:14 +0100 (CET)
X-Virus-Scanned: amavisd-new at vlakno.cz
Received: from vlakno.cz ([127.0.0.1])
	by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id V+QhSuEG-UDu; Tue, 22 Dec 2009 15:18:11 +0100 (CET)
Received: from vlk.vlakno.cz (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id B46829CB103;
	Tue, 22 Dec 2009 15:18:11 +0100 (CET)
Received: (from rdivacky@localhost)
	by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id nBMEIB8l017430;
	Tue, 22 Dec 2009 15:18:11 +0100 (CET) (envelope-from rdivacky)
Date: Tue, 22 Dec 2009 15:18:11 +0100
From: Roman Divacky 
To: "M. Warner Losh" 
Message-ID: <20091222141810.GA17221@freebsd.org>
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>
	<200912211459.21766.jhb@freebsd.org>
	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091221.211648.632868945383134253.imp@bsdimp.com>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, jhb@FreeBSD.org, marius@alchemy.franken.de
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 14:20:32 -0000

On Mon, Dec 21, 2009 at 09:16:48PM -0700, M. Warner Losh wrote:
> In message: <20091221220004.GA42400@alchemy.franken.de>
>             Marius Strobl  writes:
> : On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote:
> : > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote:
> : > > Author: jhb
> : > > Date: Mon Dec 21 19:43:23 2009
> : > > New Revision: 200797
> : > > URL: http://svn.freebsd.org/changeset/base/200797
> : > > 
> : > > Log:
> : > >   Use _once() to initialize the pthread key for thread-local storage to hold
> : > >   the results of localtime() instead of using a pthread mutex directly.
> : > 
> : > It would probably be simpler to use TLS for this instead, but I'm not sure if
> : > we have working TLS on all supported platforms.
> : > 
> : 
> : At least not on arm and sparc64 as the in-tree binutils predate
> : GNU TLS support for these.
> 
> We really need newer binutils in the tree.
> 
> And we need a way to compiler gplv3 binutils into the system for folks
> that can do that without consequences...  But many modern processors
> need to have the gplv3 version of binutils and that will be a
> continuing problem.  One advantage of FreeBSD is its integration,
> rather than having to play version whack-a-mole like you do with
> embedded Linux.

well... llvm provides its own assembler so if the need for newer binutils
comes from need of newer as I believe llvm can help here. or is the linker
the problem?

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 14:21:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19F2E106568D;
	Tue, 22 Dec 2009 14:21:09 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08EFD8FC0C;
	Tue, 22 Dec 2009 14:21:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMEL801066441;
	Tue, 22 Dec 2009 14:21:08 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMEL82q066438;
	Tue, 22 Dec 2009 14:21:08 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200912221421.nBMEL82q066438@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Tue, 22 Dec 2009 14:21:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200840 - head/usr.sbin/apm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 14:21:09 -0000

Author: ru
Date: Tue Dec 22 14:21:08 2009
New Revision: 200840
URL: http://svn.freebsd.org/changeset/base/200840

Log:
  apm(8) is no longer linked to zzz(8), catch up.
  (Fixes "zzz" clash in the whatis(1) database.)

Modified:
  head/usr.sbin/apm/apm.8
  head/usr.sbin/apm/apm.c

Modified: head/usr.sbin/apm/apm.8
==============================================================================
--- head/usr.sbin/apm/apm.8	Tue Dec 22 14:13:13 2009	(r200839)
+++ head/usr.sbin/apm/apm.8	Tue Dec 22 14:21:08 2009	(r200840)
@@ -7,15 +7,15 @@
 .\" these terms are retained. Under no circumstances is the author
 .\" responsible for the proper functioning of this software, nor does
 .\" the author assume any responsibility for damages incurred with its
+.\" use.
 .\"
 .\" $FreeBSD$
 .\"
-.\" use.
-.Dd November 1, 1994
+.Dd December 22, 2009
 .Dt APM 8 i386
 .Os
 .Sh NAME
-.Nm apm , zzz
+.Nm apm
 .Nd control the APM BIOS and display its information
 .Sh SYNOPSIS
 .Nm
@@ -24,27 +24,14 @@
 .Op Fl e Ar enable
 .Op Fl h Ar enable
 .Op Fl r Ar delta
-.Pp
-.Nm zzz
 .Sh DESCRIPTION
 The
 .Nm
 utility
 controls the Intel / Microsoft APM (Advanced Power Management) BIOS and
 displays the current status of APM on laptop PCs.
-The
-.Nm zzz
-utility suspends the system by controlling APM.
 .Pp
-The following options are available for
-.Nm
-(no options are available for
-.Nm zzz ) .
-If no options are specified,
-.Nm
-displays information and current status of APM in verbose mode.
-If multiple display options are given, the values are displayed one
-per line in the order given here.
+The options are as follows:
 .Bl -tag -width indent
 .It Fl a
 Display the current AC-line status as an integer value.
@@ -126,9 +113,15 @@ output of
 tells what your laptop claims to support.
 .It Fl z
 Suspend the system.
-It is equivalent to
-.Nm zzz .
+It is used by
+.Xr zzz 8 .
 .El
+.Pp
+If no options are specified,
+.Nm
+displays information and current status of APM in verbose mode.
+If multiple display options are given, the values are displayed one
+per line in the order given here.
 .Sh NOTES
 .Xr apmconf 8
 has been merged in
@@ -137,7 +130,8 @@ and thus
 .Nm
 replaces all of its functionality.
 .Sh SEE ALSO
-.Xr apm 4
+.Xr apm 4 ,
+.Xr zzz 8
 .Sh AUTHORS
 .An Tatsumi Hosokawa Aq hosokawa@jp.FreeBSD.org
 .Sh BUGS

Modified: head/usr.sbin/apm/apm.c
==============================================================================
--- head/usr.sbin/apm/apm.c	Tue Dec 22 14:13:13 2009	(r200839)
+++ head/usr.sbin/apm/apm.c	Tue Dec 22 14:21:08 2009	(r200840)
@@ -1,5 +1,5 @@
 /*
- * apm / zzz	APM BIOS utility for FreeBSD
+ * APM BIOS utility for FreeBSD
  *
  * Copyright (C) 1994-1996 by Tatsumi Hosokawa 
  *
@@ -43,10 +43,9 @@ int cmos_wall = 0;	/* True when wall tim
 static void
 usage(void)
 {
-	fprintf(stderr, "%s\n%s\n",
+	fprintf(stderr,
 		"usage: apm [-ablstzZ] [-d enable ] [ -e enable ] "
-		"[ -h enable ] [-r delta]",
-		"       zzz");
+		"[ -h enable ] [-r delta]\n");
 	exit(1);
 }
 
@@ -397,11 +396,6 @@ main(int argc, char *argv[])
 	else
 		cmdname = argv[0];
 
-	if (strcmp(cmdname, "zzz") == 0) {
-		dosleep = 1;
-		all_info = 0;
-		goto finish_option;
-	}
 	while ((c = getopt(argc, argv, "abe:h:lRr:stzd:Z")) != -1) {
 		switch (c) {
 		case 'a':
@@ -457,7 +451,6 @@ main(int argc, char *argv[])
 		argc -= optind;
 		argv += optind;
 	}
-finish_option:
 	if (haltcpu != -1 || enable != -1 || display != -1 || delta || dosleep
 	    || standby) {
 		fd = open(APMDEV, O_RDWR);

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 15:13:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F39DF106568F;
	Tue, 22 Dec 2009 15:13:16 +0000 (UTC) (envelope-from jh@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E2FAB8FC13;
	Tue, 22 Dec 2009 15:13:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMFDG01067659;
	Tue, 22 Dec 2009 15:13:16 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMFDGRD067657;
	Tue, 22 Dec 2009 15:13:16 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <200912221513.nBMFDGRD067657@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 22 Dec 2009 15:13:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200844 - head/usr.bin/unzip
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 15:13:17 -0000

Author: jh
Date: Tue Dec 22 15:13:16 2009
New Revision: 200844
URL: http://svn.freebsd.org/changeset/base/200844

Log:
  Don't print the archive name with -p and -q options.
  
  PR:		bin/141280
  Approved by:	des, trasz (mentor)

Modified:
  head/usr.bin/unzip/unzip.c

Modified: head/usr.bin/unzip/unzip.c
==============================================================================
--- head/usr.bin/unzip/unzip.c	Tue Dec 22 15:08:06 2009	(r200843)
+++ head/usr.bin/unzip/unzip.c	Tue Dec 22 15:13:16 2009	(r200844)
@@ -814,7 +814,8 @@ unzip(const char *fn)
 	ac(archive_read_support_format_zip(a));
 	ac(archive_read_open_fd(a, fd, 8192));
 
-	printf("Archive:  %s\n", fn);
+	if (!p_opt && !q_opt)
+		printf("Archive:  %s\n", fn);
 	if (v_opt == 1) {
 		printf("  Length     Date   Time    Name\n");
 		printf(" --------    ----   ----    ----\n");

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 15:14:56 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F8A71065692;
	Tue, 22 Dec 2009 15:14:56 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id EF9CA8FC15;
	Tue, 22 Dec 2009 15:14:55 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBMF5YTZ048398;
	Tue, 22 Dec 2009 08:05:34 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 22 Dec 2009 08:06:08 -0700 (MST)
Message-Id: <20091222.080608.321689433999165447.imp@bsdimp.com>
To: rdivacky@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <20091222141810.GA17221@freebsd.org>
References: <20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<20091222141810.GA17221@freebsd.org>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, jhb@FreeBSD.org, marius@alchemy.franken.de
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 15:14:56 -0000

In message: <20091222141810.GA17221@freebsd.org>
            Roman Divacky  writes:
: On Mon, Dec 21, 2009 at 09:16:48PM -0700, M. Warner Losh wrote:
: > In message: <20091221220004.GA42400@alchemy.franken.de>
: >             Marius Strobl  writes:
: > : On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote:
: > : > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote:
: > : > > Author: jhb
: > : > > Date: Mon Dec 21 19:43:23 2009
: > : > > New Revision: 200797
: > : > > URL: http://svn.freebsd.org/changeset/base/200797
: > : > > 
: > : > > Log:
: > : > >   Use _once() to initialize the pthread key for thread-local storage to hold
: > : > >   the results of localtime() instead of using a pthread mutex directly.
: > : > 
: > : > It would probably be simpler to use TLS for this instead, but I'm not sure if
: > : > we have working TLS on all supported platforms.
: > : > 
: > : 
: > : At least not on arm and sparc64 as the in-tree binutils predate
: > : GNU TLS support for these.
: > 
: > We really need newer binutils in the tree.
: > 
: > And we need a way to compiler gplv3 binutils into the system for folks
: > that can do that without consequences...  But many modern processors
: > need to have the gplv3 version of binutils and that will be a
: > continuing problem.  One advantage of FreeBSD is its integration,
: > rather than having to play version whack-a-mole like you do with
: > embedded Linux.
: 
: well... llvm provides its own assembler so if the need for newer binutils
: comes from need of newer as I believe llvm can help here. or is the linker
: the problem?

Some platforms and features it is the assembler, others it is linker.
The problem with even llvm is that binutils tends to get the features
faster and time to market tends to be more important in the embedded
space..

Warner

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 15:41:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7CB31065694;
	Tue, 22 Dec 2009 15:41:58 +0000 (UTC)
	(envelope-from gallatin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D6CC08FC0A;
	Tue, 22 Dec 2009 15:41:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMFfwc5068290;
	Tue, 22 Dec 2009 15:41:58 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMFfwrc068288;
	Tue, 22 Dec 2009 15:41:58 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <200912221541.nBMFfwrc068288@svn.freebsd.org>
From: Andrew Gallatin 
Date: Tue, 22 Dec 2009 15:41:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200845 - head/sys/dev/mxge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 15:41:59 -0000

Author: gallatin
Date: Tue Dec 22 15:41:58 2009
New Revision: 200845
URL: http://svn.freebsd.org/changeset/base/200845

Log:
  Don't take the driver mutex in mxge_tick(), as it
  is run with the mutex held.
  
  Submitted by: rwatson
  MFC after:	3 days

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Tue Dec 22 15:13:16 2009	(r200844)
+++ head/sys/dev/mxge/if_mxge.c	Tue Dec 22 15:41:58 2009	(r200845)
@@ -3956,9 +3956,7 @@ mxge_tick(void *arg)
 	uint16_t cmd;
 
 	ticks = mxge_ticks;
-	mtx_lock(&sc->driver_mtx);
 	running = sc->ifp->if_drv_flags & IFF_DRV_RUNNING;
-	mtx_unlock(&sc->driver_mtx);
 	if (running) {
 		/* aggregate stats from different slices */
 		pkts = mxge_update_stats(sc);

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 15:47:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9FE20106566B;
	Tue, 22 Dec 2009 15:47:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 845768FC12;
	Tue, 22 Dec 2009 15:47:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMFlejn068475;
	Tue, 22 Dec 2009 15:47:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMFlewJ068471;
	Tue, 22 Dec 2009 15:47:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200912221547.nBMFlewJ068471@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 22 Dec 2009 15:47:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200847 - in head/sys: dev/cxgb/ulp/iw_cxgb netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 15:47:40 -0000

Author: jhb
Date: Tue Dec 22 15:47:40 2009
New Revision: 200847
URL: http://svn.freebsd.org/changeset/base/200847

Log:
  - Rename the __tcpi_(snd|rcv)_mss fields of the tcp_info structure to remove
    the leading underscores since they are now implemented.
  - Implement the tcpi_rto and tcpi_last_data_recv fields in the tcp_info
    structure.
  
  Reviewed by:	rwatson
  MFC after:	2 weeks

Modified:
  head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
  head/sys/netinet/tcp.h
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
==============================================================================
--- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c	Tue Dec 22 15:45:38 2009	(r200846)
+++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c	Tue Dec 22 15:47:40 2009	(r200847)
@@ -203,7 +203,7 @@ static int set_tcpinfo(struct iwch_ep *e
 
 	ep->snd_seq = ti.tcpi_snd_nxt;
 	ep->rcv_seq = ti.tcpi_rcv_nxt;
-	ep->emss = ti.__tcpi_snd_mss - sizeof(struct tcpiphdr);
+	ep->emss = ti.tcpi_snd_mss - sizeof(struct tcpiphdr);
 	ep->hwtid = TOEPCB(ep->com.so)->tp_tid; /* XXX */
 	if (ti.tcpi_options & TCPI_OPT_TIMESTAMPS)
 		ep->emss -= 12;

Modified: head/sys/netinet/tcp.h
==============================================================================
--- head/sys/netinet/tcp.h	Tue Dec 22 15:45:38 2009	(r200846)
+++ head/sys/netinet/tcp.h	Tue Dec 22 15:47:40 2009	(r200847)
@@ -181,10 +181,10 @@ struct tcp_info {
 	u_int8_t	tcpi_snd_wscale:4,	/* RFC1323 send shift value. */
 			tcpi_rcv_wscale:4;	/* RFC1323 recv shift value. */
 
-	u_int32_t	__tcpi_rto;
+	u_int32_t	tcpi_rto;		/* Retransmission timeout (usec). */
 	u_int32_t	__tcpi_ato;
-	u_int32_t	__tcpi_snd_mss;
-	u_int32_t	__tcpi_rcv_mss;
+	u_int32_t	tcpi_snd_mss;		/* Max segment size for send. */
+	u_int32_t	tcpi_rcv_mss;		/* Max segment size for receive. */
 
 	u_int32_t	__tcpi_unacked;
 	u_int32_t	__tcpi_sacked;
@@ -195,7 +195,7 @@ struct tcp_info {
 	/* Times; measurements in usecs. */
 	u_int32_t	__tcpi_last_data_sent;
 	u_int32_t	__tcpi_last_ack_sent;	/* Also unimpl. on Linux? */
-	u_int32_t	__tcpi_last_data_recv;
+	u_int32_t	tcpi_last_data_recv;	/* Time since last recv data. */
 	u_int32_t	__tcpi_last_ack_recv;
 
 	/* Metrics; variable units. */

Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c	Tue Dec 22 15:45:38 2009	(r200846)
+++ head/sys/netinet/tcp_usrreq.c	Tue Dec 22 15:47:40 2009	(r200847)
@@ -1194,6 +1194,8 @@ tcp_fill_info(struct tcpcb *tp, struct t
 		ti->tcpi_rcv_wscale = tp->rcv_scale;
 	}
 
+	ti->tcpi_rto = tp->t_rxtcur * tick;
+	ti->tcpi_last_data_recv = (long)(ticks - (int)tp->t_rcvtime) * tick;
 	ti->tcpi_rtt = ((u_int64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT;
 	ti->tcpi_rttvar = ((u_int64_t)tp->t_rttvar * tick) >> TCP_RTTVAR_SHIFT;
 
@@ -1208,8 +1210,8 @@ tcp_fill_info(struct tcpcb *tp, struct t
 	ti->tcpi_snd_wnd = tp->snd_wnd;
 	ti->tcpi_snd_bwnd = tp->snd_bwnd;
 	ti->tcpi_snd_nxt = tp->snd_nxt;
-	ti->__tcpi_snd_mss = tp->t_maxseg;
-	ti->__tcpi_rcv_mss = tp->t_maxseg;
+	ti->tcpi_snd_mss = tp->t_maxseg;
+	ti->tcpi_rcv_mss = tp->t_maxseg;
 	if (tp->t_flags & TF_TOE)
 		ti->tcpi_options |= TCPI_OPT_TOE;
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 16:02:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1984F10656A4;
	Tue, 22 Dec 2009 16:02:09 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 06B3E8FC21;
	Tue, 22 Dec 2009 16:02:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMG286Q068799;
	Tue, 22 Dec 2009 16:02:08 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMG28YH068797;
	Tue, 22 Dec 2009 16:02:08 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200912221602.nBMG28YH068797@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Tue, 22 Dec 2009 16:02:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200848 - head/share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 16:02:09 -0000

Author: ru
Date: Tue Dec 22 16:02:08 2009
New Revision: 200848
URL: http://svn.freebsd.org/changeset/base/200848

Log:
  Sort mlinks.

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Tue Dec 22 15:47:40 2009	(r200847)
+++ head/share/man/man9/Makefile	Tue Dec 22 16:02:08 2009	(r200848)
@@ -394,14 +394,14 @@ MLINKS+=atomic.9 atomic_add.9 \
 	atomic.9 atomic_set.9 \
 	atomic.9 atomic_store.9 \
 	atomic.9 atomic_subtract.9
-MLINKS+=bpf.9 bpf_filter.9 \
+MLINKS+=bpf.9 bpfattach.9 \
+	bpf.9 bpfattach2.9 \
+	bpf.9 bpfdetach.9 \
+	bpf.9 bpf_filter.9 \
 	bpf.9 bpf_mtap.9 \
 	bpf.9 bpf_mtap2.9 \
 	bpf.9 bpf_tap.9 \
-	bpf.9 bpf_validate.9 \
-	bpf.9 bpfattach.9 \
-	bpf.9 bpfattach2.9 \
-	bpf.9 bpfdetach.9
+	bpf.9 bpf_validate.9
 MLINKS+=buf.9 bp.9
 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9
 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9
@@ -563,11 +563,11 @@ MLINKS+=crypto.9 crypto_dispatch.9 \
 	crypto.9 crypto_unblock.9 \
 	crypto.9 crypto_unregister.9 \
 	crypto.9 crypto_unregister_all.9
-MLINKS+=DB_COMMAND.9 DB_SHOW_COMMAND.9 \
-	DB_COMMAND.9 DB_SHOW_ALL_COMMAND.9
+MLINKS+=DB_COMMAND.9 DB_SHOW_ALL_COMMAND.9 \
+	DB_COMMAND.9 DB_SHOW_COMMAND.9
 MLINKS+=dev_clone.9 drain_dev_clone_events.9
-MLINKS+=devfs_set_cdevpriv.9 devfs_get_cdevpriv.9 \
-	devfs_set_cdevpriv.9 devfs_clear_cdevpriv.9
+MLINKS+=devfs_set_cdevpriv.9 devfs_clear_cdevpriv.9 \
+	devfs_set_cdevpriv.9 devfs_get_cdevpriv.9
 MLINKS+=device_add_child.9 device_add_child_ordered.9
 MLINKS+=device_enable.9 device_disable.9 \
 	device_enable.9 device_is_enabled.9
@@ -591,8 +591,8 @@ MLINKS+=devstat.9 devicestat.9 \
 	devstat.9 devstat_start_transaction.9
 MLINKS+=disk.9 disk_alloc.9 \
 	disk.9 disk_create.9 \
-	disk.9 disk_gone.9 \
-	disk.9 disk_destroy.9
+	disk.9 disk_destroy.9 \
+	disk.9 disk_gone.9
 MLINKS+=domain.9 DOMAIN_SET.9 \
 	domain.9 net_add_domain.9 \
 	domain.9 pfctlinput.9 \
@@ -642,60 +642,60 @@ MLINKS+=hashinit.9 hashdestroy.9 \
 	hashinit.9 phashinit.9
 MLINKS+=ieee80211.9 ieee80211_ifattach.9 \
 	ieee80211.9 ieee80211_ifdetach.9
-MLINKS+=ieee80211_amrr.9 ieee80211_amrr_init.9 \
-	ieee80211_amrr.9 ieee80211_amrr_cleanup.9 \
-	ieee80211_amrr.9 ieee80211_amrr_setinterval.9 \
+MLINKS+=ieee80211_amrr.9 ieee80211_amrr_cleanup.9 \
+	ieee80211_amrr.9 ieee80211_amrr_init.9 \
 	ieee80211_amrr.9 ieee80211_amrr_node_init.9 \
+	ieee80211_amrr.9 ieee80211_amrr_setinterval.9 \
 	ieee80211_amrr.9 ieee80211_amrr_tx_complete.9 \
 	ieee80211_amrr.9 ieee80211_amrr_tx_update.9
 MLINKS+=ieee80211_beacon.9 ieee80211_beacon_alloc.9 \
-	ieee80211_beacon.9 ieee80211_beacon_update.9 \
-	ieee80211_beacon.9 ieee80211_beacon_notify.9
+	ieee80211_beacon.9 ieee80211_beacon_notify.9 \
+	ieee80211_beacon.9 ieee80211_beacon_update.9
 MLINKS+=ieee80211_bmiss.9 ieee80211_beacon_miss.9
-MLINKS+=ieee80211_crypto.9 ieee80211_key_update_begin.9 \
-	ieee80211_crypto.9 ieee80211_key_update_end.9 \
-	ieee80211_crypto.9 ieee80211_crypto_newkey.9 \
-	ieee80211_crypto.9 ieee80211_crypto_setkey.9 \
-	ieee80211_crypto.9 ieee80211_crypto_delglobalkeys.9 \
-	ieee80211_crypto.9 ieee80211_crypto_reload_keys.9 \
+MLINKS+=ieee80211_crypto.9 ieee80211_crypto_available.9 \
 	ieee80211_crypto.9 ieee80211_crypto_decap.9 \
-	ieee80211_crypto.9 ieee80211_crypto_encap.9 \
+	ieee80211_crypto.9 ieee80211_crypto_delglobalkeys.9 \
 	ieee80211_crypto.9 ieee80211_crypto_demic.9 \
+	ieee80211_crypto.9 ieee80211_crypto_encap.9 \
 	ieee80211_crypto.9 ieee80211_crypto_enmic.9 \
-	ieee80211_crypto.9 ieee80211_notify_michael_failure.9 \
-	ieee80211_crypto.9 ieee80211_notify_replay_failure.9 \
+	ieee80211_crypto.9 ieee80211_crypto_newkey.9 \
 	ieee80211_crypto.9 ieee80211_crypto_register.9 \
+	ieee80211_crypto.9 ieee80211_crypto_reload_keys.9 \
+	ieee80211_crypto.9 ieee80211_crypto_setkey.9 \
 	ieee80211_crypto.9 ieee80211_crypto_unregister.9 \
-	ieee80211_crypto.9 ieee80211_crypto_available.9
+	ieee80211_crypto.9 ieee80211_key_update_begin.9 \
+	ieee80211_crypto.9 ieee80211_key_update_end.9 \
+	ieee80211_crypto.9 ieee80211_notify_michael_failure.9 \
+	ieee80211_crypto.9 ieee80211_notify_replay_failure.9
 MLINKS+=ieee80211_input.9 ieee80211_input_all.9
-MLINKS+=ieee80211_node.9 ieee80211_find_rxnode.9 \
+MLINKS+=ieee80211_node.9 ieee80211_dump_node.9 \
+	ieee80211_node.9 ieee80211_dump_nodes.9 \
+	ieee80211_node.9 ieee80211_find_rxnode.9 \
 	ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \
-	ieee80211_node.9 ieee80211_ref_node.9 \
-	ieee80211_node.9 ieee80211_unref_node.9 \
 	ieee80211_node.9 ieee80211_free_node.9 \
 	ieee80211_node.9 ieee80211_iterate_nodes.9 \
-	ieee80211_node.9 ieee80211_dump_node.9 \
-	ieee80211_node.9 ieee80211_dump_nodes.9
-MLINKS+=ieee80211_output.9 M_WME_GETAC.9 \
+	ieee80211_node.9 ieee80211_ref_node.9 \
+	ieee80211_node.9 ieee80211_unref_node.9
+MLINKS+=ieee80211_output.9 ieee80211_process_callback.9 \
 	ieee80211_output.9 M_SEQNO_GET.9 \
-	ieee80211_output.9 ieee80211_process_callback.9
+	ieee80211_output.9 M_WME_GETAC.9
 MLINKS+=ieee80211_proto.9 ieee80211_new_state.9 \
+	ieee80211_proto.9 ieee80211_resume_all.9 \
 	ieee80211_proto.9 ieee80211_start_all.9 \
 	ieee80211_proto.9 ieee80211_stop_all.9 \
 	ieee80211_proto.9 ieee80211_suspend_all.9 \
-	ieee80211_proto.9 ieee80211_resume_all.9 \
 	ieee80211_proto.9 ieee80211_waitfor_parent.9
-MLINKS+=ieee80211_radiotap.9 radiotap.9 \
-	ieee80211_radiotap.9 ieee80211_radiotap_attach.9 \
+MLINKS+=ieee80211_radiotap.9 ieee80211_radiotap_active.9 \
 	ieee80211_radiotap.9 ieee80211_radiotap_active_vap.9 \
-	ieee80211_radiotap.9 ieee80211_radiotap_active.9 \
-	ieee80211_radiotap.9 ieee80211_radiotap_tx.9
-MLINKS+=ieee80211_regdomain.9 ieee80211_init_channels.9 \
-	ieee80211_regdomain.9 ieee80211_sort_channels.9 \
-	ieee80211_regdomain.9 ieee80211_alloc_countryie.9
-MLINKS+=ieee80211_vap.9 ieee80211_vap_setup.9 \
-	ieee80211_vap.9 ieee80211_vap_attach.9 \
-	ieee80211_vap.9 ieee80211_vap_detach.9
+	ieee80211_radiotap.9 ieee80211_radiotap_attach.9 \
+	ieee80211_radiotap.9 ieee80211_radiotap_tx.9 \
+	ieee80211_radiotap.9 radiotap.9
+MLINKS+=ieee80211_regdomain.9 ieee80211_alloc_countryie.9 \
+	ieee80211_regdomain.9 ieee80211_init_channels.9 \
+	ieee80211_regdomain.9 ieee80211_sort_channels.9
+MLINKS+=ieee80211_vap.9 ieee80211_vap_attach.9 \
+	ieee80211_vap.9 ieee80211_vap_detach.9 \
+	ieee80211_vap.9 ieee80211_vap_setup.9
 MLINKS+=ifnet.9 ifaddr.9 \
 	ifnet.9 if_data.9 \
 	ifnet.9 ifqueue.9
@@ -720,13 +720,13 @@ MLINKS+=kobj.9 DEFINE_CLASS.9 \
 	kobj.9 kobj_delete.9 \
 	kobj.9 kobj_init.9
 MLINKS+=kproc.9 kproc_create.9 \
-	kproc.9 kthread_create.9 \
 	kproc.9 kproc_exit.9 \
 	kproc.9 kproc_resume.9 \
 	kproc.9 kproc_shutdown.9 \
 	kproc.9 kproc_start.9 \
 	kproc.9 kproc_suspend.9 \
-	kproc.9 kproc_suspend_check.9
+	kproc.9 kproc_suspend_check.9 \
+	kproc.9 kthread_create.9
 MLINKS+=kqueue.9 knlist_add.9 \
 	kqueue.9 knlist_clear.9 \
 	kqueue.9 knlist_delete.9 \
@@ -1237,23 +1237,7 @@ MLINKS+=uidinfo.9 uifind.9 \
 	uidinfo.9 uihashinit.9 \
 	uidinfo.9 uihold.9
 MLINKS+=uio.9 uiomove.9
-MLINKS+=usbdi.9 usb_fifo_alloc_buffer.9 \
-	usbdi.9 usb_fifo_attach.9 \
-	usbdi.9 usb_fifo_detach.9 \
-	usbdi.9 usb_fifo_free_buffer.9 \
-	usbdi.9 usb_fifo_get_data.9 \
-	usbdi.9 usb_fifo_get_data_buffer.9 \
-	usbdi.9 usb_fifo_get_data_error.9 \
-	usbdi.9 usb_fifo_get_data_linear.9 \
-	usbdi.9 usb_fifo_put_bytes_max.9 \
-	usbdi.9 usb_fifo_put_data.9 \
-	usbdi.9 usb_fifo_put_data_buffer.9 \
-	usbdi.9 usb_fifo_put_data_error.9 \
-	usbdi.9 usb_fifo_put_data_linear.9 \
-	usbdi.9 usb_fifo_reset.9 \
-	usbdi.9 usb_fifo_softc.9 \
-	usbdi.9 usb_fifo_wakeup.9 \
-	usbdi.9 usbd_do_request.9 \
+MLINKS+=usbdi.9 usbd_do_request.9 \
 	usbdi.9 usbd_do_request_flags.9 \
 	usbdi.9 usbd_errstr.9 \
 	usbdi.9 usbd_lookup_id_by_info.9 \
@@ -1288,7 +1272,23 @@ MLINKS+=usbdi.9 usb_fifo_alloc_buffer.9 
 	usbdi.9 usbd_xfer_softc.9 \
 	usbdi.9 usbd_xfer_state.9 \
 	usbdi.9 usbd_xfer_state.9 \
-	usbdi.9 usbd_xfer_status.9
+	usbdi.9 usbd_xfer_status.9 \
+	usbdi.9 usb_fifo_alloc_buffer.9 \
+	usbdi.9 usb_fifo_attach.9 \
+	usbdi.9 usb_fifo_detach.9 \
+	usbdi.9 usb_fifo_free_buffer.9 \
+	usbdi.9 usb_fifo_get_data.9 \
+	usbdi.9 usb_fifo_get_data_buffer.9 \
+	usbdi.9 usb_fifo_get_data_error.9 \
+	usbdi.9 usb_fifo_get_data_linear.9 \
+	usbdi.9 usb_fifo_put_bytes_max.9 \
+	usbdi.9 usb_fifo_put_data.9 \
+	usbdi.9 usb_fifo_put_data_buffer.9 \
+	usbdi.9 usb_fifo_put_data_error.9 \
+	usbdi.9 usb_fifo_put_data_linear.9 \
+	usbdi.9 usb_fifo_reset.9 \
+	usbdi.9 usb_fifo_softc.9 \
+	usbdi.9 usb_fifo_wakeup.9
 MLINKS+=vcount.9 count_dev.9
 MLINKS+=vfsconf.9 vfs_modevent.9 \
 	vfsconf.9 vfs_register.9 \
@@ -1304,8 +1304,8 @@ MLINKS+=vfs_getopt.9 vfs_copyopt.9 \
 MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9
 MLINKS+=vgone.9 vgonel.9
 MLINKS+=vhold.9 vdrop.9 \
-	vhold.9	vholdl.9 \
-	vhold.9 vdropl.9
+	vhold.9 vdropl.9 \
+	vhold.9 vholdl.9
 MLINKS+=vm_map_lock.9 vm_map_lock_downgrade.9 \
 	vm_map_lock.9 vm_map_lock_read.9 \
 	vm_map_lock.9 vm_map_lock_upgrade.9 \

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 16:05:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E172E1065697;
	Tue, 22 Dec 2009 16:05:28 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D0CDE8FC16;
	Tue, 22 Dec 2009 16:05:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMG5SsQ068888;
	Tue, 22 Dec 2009 16:05:28 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMG5SDI068885;
	Tue, 22 Dec 2009 16:05:28 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200912221605.nBMG5SDI068885@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Tue, 22 Dec 2009 16:05:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200849 - head/share/man/man9
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 16:05:29 -0000

Author: ru
Date: Tue Dec 22 16:05:28 2009
New Revision: 200849
URL: http://svn.freebsd.org/changeset/base/200849

Log:
  Removed duplicate usbd_xfer_state(9) link.

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/usbdi.9

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Tue Dec 22 16:02:08 2009	(r200848)
+++ head/share/man/man9/Makefile	Tue Dec 22 16:05:28 2009	(r200849)
@@ -1271,7 +1271,6 @@ MLINKS+=usbdi.9 usbd_do_request.9 \
 	usbdi.9 usbd_xfer_set_timeout.9 \
 	usbdi.9 usbd_xfer_softc.9 \
 	usbdi.9 usbd_xfer_state.9 \
-	usbdi.9 usbd_xfer_state.9 \
 	usbdi.9 usbd_xfer_status.9 \
 	usbdi.9 usb_fifo_alloc_buffer.9 \
 	usbdi.9 usb_fifo_attach.9 \

Modified: head/share/man/man9/usbdi.9
==============================================================================
--- head/share/man/man9/usbdi.9	Tue Dec 22 16:02:08 2009	(r200848)
+++ head/share/man/man9/usbdi.9	Tue Dec 22 16:05:28 2009	(r200849)
@@ -78,7 +78,6 @@
 .Nm usbd_xfer_set_timeout ,
 .Nm usbd_xfer_softc ,
 .Nm usbd_xfer_state ,
-.Nm usbd_xfer_state ,
 .Nm usbd_xfer_status
 .Nd Universal Serial Bus driver programming interface
 .Sh SYNOPSIS

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 16:09:26 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD9261065676;
	Tue, 22 Dec 2009 16:09:26 +0000 (UTC)
	(envelope-from erik@cederstrand.dk)
Received: from csmtp1.one.com (csmtp1.one.com [195.47.247.21])
	by mx1.freebsd.org (Postfix) with ESMTP id 6ED2D8FC22;
	Tue, 22 Dec 2009 16:09:26 +0000 (UTC)
Received: from 212.27.19.227.bredband.3.dk (212.27.19.227.bredband.3.dk
	[212.27.19.227])
	by csmtp1.one.com (Postfix) with ESMTP id 26E4A1BC024EE;
	Tue, 22 Dec 2009 15:49:51 +0000 (UTC)
Mime-Version: 1.0 (Apple Message framework v1077)
Content-Type: multipart/signed; boundary=Apple-Mail-166--278053036;
	protocol="application/pkcs7-signature"; micalg=sha1
From: Erik Cederstrand 
In-Reply-To: <20091222141810.GA17221@freebsd.org>
Date: Tue, 22 Dec 2009 16:49:48 +0100
Message-Id: 
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>
	<200912211459.21766.jhb@freebsd.org>
	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<20091222141810.GA17221@freebsd.org>
To: Roman Divacky 
X-Mailer: Apple Mail (2.1077)
X-Content-Filtered-By: Mailman/MimeDel 2.1.5
Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org,
	marius@alchemy.franken.de, svn-src-head@FreeBSD.org,
	"M. Warner Losh" 
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 16:09:27 -0000


--Apple-Mail-166--278053036
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Den 22/12/2009 kl. 15.18 skrev Roman Divacky:

> well... llvm provides its own assembler so if the need for newer =
binutils
> comes from need of newer as I believe llvm can help here. or is the =
linker
> the problem?

It does? I was under the impression that this was still very much a WIP =
(http://llvm.org/releases/2.6/docs/ReleaseNotes.html#mc) and that LLVM =
still uses the system assembler and linker.

Erik=

--Apple-Mail-166--278053036--

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 18:57:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 389711065695;
	Tue, 22 Dec 2009 18:57:08 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 265B38FC08;
	Tue, 22 Dec 2009 18:57:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMIv8s3072489;
	Tue, 22 Dec 2009 18:57:08 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMIv8R3072486;
	Tue, 22 Dec 2009 18:57:08 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912221857.nBMIv8R3072486@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 18:57:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200853 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 18:57:08 -0000

Author: yongari
Date: Tue Dec 22 18:57:07 2009
New Revision: 200853
URL: http://svn.freebsd.org/changeset/base/200853

Log:
  Add bus_dma(9) and endianness support to ste(4).
   o Sorted includes and added missing header files.
   o Added basic endianness support. In theory ste(4) should work on
     any architectures.
   o Remove the use of contigmalloc(9), contigfree(9) and vtophys(9).
   o Added 8 byte alignment limitation of TX/RX descriptor.
   o Added 1 byte alignment requirement for TX/RX buffers.
   o ste(4) controllers does not support DAC. Limit DMA address space
     to be within 32bit address.
   o Added spare DMA map to gracefully recover from DMA map failure.
   o Removed dead code for checking STE_RXSTAT_DMADONE bit. The bit
     was already checked in each iteration of loop so it can't be true.
   o Added second argument count to ste_rxeof(). It is used to limit
     number of iterations done in RX handler. ATM polling is the only
     consumer.
   o Removed ste_rxeoc() which was added to address RX stuck issue
     (cvs rev 1.66). Unlike TX descriptors, ST201 supports chaining
     descriptors to form a ring for RX descriptors. If RX descriptor
     chaining is not supported it's possible for controller to stop
     receiving incoming frames once controller pass the end of RX
     descriptor which in turn requires driver post new RX
     descriptors to receive more frames. For TX descriptors which
     does not support chaning, we exactly do manual chaining in
     driver by concatenating new descriptors to the end of previous
     TX chain.
     Maybe the workaround was borrowed from other drivers that does
     not support RX descriptor chaining, which is not valid for ST201
     controllers. I still have no idea how this address RX stuck
     issue and I can't reproduce the RX stuck issue on DFE-550TX
     controller.
   o Removed hw.ste_rxsyncs sysctl as the workaround was removed.
   o TX/RX side bus_dmamap_load_mbuf_sg(9) support.
   o Reimplemented optimized ste_encap().
   o Simplified TX logic of ste_start_locked().
   o Added comments for TFD/RFD requirements.
   o Increased number of RX descriptors to 128 from 64. 128 gave much
     better performance than 64 under high network loads.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 17:44:56 2009	(r200852)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 18:57:07 2009	(r200853)
@@ -39,14 +39,19 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -55,14 +60,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
-#include               /* for vtophys */
-#include             /* for vtophys */
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -70,13 +69,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 /* "device miibus" required.  See GENERIC if you get errors here. */
 #include "miibus_if.h"
 
 #define STE_USEIOSPACE
 
-#include 
-
 MODULE_DEPEND(ste, pci, 1, 1, 1);
 MODULE_DEPEND(ste, ether, 1, 1, 1);
 MODULE_DEPEND(ste, miibus, 1, 1, 1);
@@ -96,8 +95,12 @@ static int	ste_detach(device_t);
 static int	ste_probe(device_t);
 static int	ste_shutdown(device_t);
 
+static int	ste_dma_alloc(struct ste_softc *);
+static void	ste_dma_free(struct ste_softc *);
+static void	ste_dmamap_cb(void *, bus_dma_segment_t *, int, int);
 static int 	ste_eeprom_wait(struct ste_softc *);
-static int	ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *);
+static int	ste_encap(struct ste_softc *, struct mbuf **,
+		    struct ste_chain *);
 static int	ste_ifmedia_upd(struct ifnet *);
 static void	ste_ifmedia_upd_locked(struct ifnet *);
 static void	ste_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -114,12 +117,10 @@ static int	ste_mii_writereg(struct ste_s
 static int	ste_miibus_readreg(device_t, int, int);
 static void	ste_miibus_statchg(device_t);
 static int	ste_miibus_writereg(device_t, int, int, int);
-static int	ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *,
-		    struct mbuf *);
+static int	ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *);
 static int	ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int);
 static void	ste_reset(struct ste_softc *);
-static void	ste_rxeoc(struct ste_softc *);
-static int	ste_rxeof(struct ste_softc *);
+static int	ste_rxeof(struct ste_softc *, int);
 static void	ste_setmulti(struct ste_softc *);
 static void	ste_start(struct ifnet *);
 static void	ste_start_locked(struct ifnet *);
@@ -168,11 +169,6 @@ static devclass_t ste_devclass;
 DRIVER_MODULE(ste, pci, ste_driver, ste_devclass, 0, 0);
 DRIVER_MODULE(miibus, ste, miibus_driver, miibus_devclass, 0, 0);
 
-SYSCTL_NODE(_hw, OID_AUTO, ste, CTLFLAG_RD, 0, "if_ste parameters");
-
-static int ste_rxsyncs;
-SYSCTL_INT(_hw_ste, OID_AUTO, rxsyncs, CTLFLAG_RW, &ste_rxsyncs, 0, "");
-
 #define STE_SETBIT4(sc, reg, x)				\
 	CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x))
 
@@ -603,10 +599,7 @@ ste_poll_locked(struct ifnet *ifp, enum 
 
 	STE_LOCK_ASSERT(sc);
 
-	sc->rxcycles = count;
-	if (cmd == POLL_AND_CHECK_STATUS)
-		ste_rxeoc(sc);
-	rx_npkts = ste_rxeof(sc);
+	rx_npkts = ste_rxeof(sc, count);
 	ste_txeof(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		ste_start_locked(ifp);
@@ -666,10 +659,8 @@ ste_intr(void *xsc)
 		if (!(status & STE_INTRS))
 			break;
 
-		if (status & STE_ISR_RX_DMADONE) {
-			ste_rxeoc(sc);
-			ste_rxeof(sc);
-		}
+		if (status & STE_ISR_RX_DMADONE)
+			ste_rxeof(sc, -1);
 
 		if (status & STE_ISR_TX_DMADONE)
 			ste_txeof(sc);
@@ -701,62 +692,40 @@ ste_intr(void *xsc)
 	STE_UNLOCK(sc);
 }
 
-static void
-ste_rxeoc(struct ste_softc *sc)
-{
-	struct ste_chain_onefrag *cur_rx;
-
-	STE_LOCK_ASSERT(sc);
-
-	if (sc->ste_cdata.ste_rx_head->ste_ptr->ste_status == 0) {
-		cur_rx = sc->ste_cdata.ste_rx_head;
-		do {
-			cur_rx = cur_rx->ste_next;
-			/* If the ring is empty, just return. */
-			if (cur_rx == sc->ste_cdata.ste_rx_head)
-				return;
-		} while (cur_rx->ste_ptr->ste_status == 0);
-		if (sc->ste_cdata.ste_rx_head->ste_ptr->ste_status == 0) {
-			/* We've fallen behind the chip: catch it. */
-			sc->ste_cdata.ste_rx_head = cur_rx;
-			++ste_rxsyncs;
-		}
-	}
-}
-
 /*
  * A frame has been uploaded: pass the resulting mbuf chain up to
  * the higher level protocols.
  */
 static int
-ste_rxeof(struct ste_softc *sc)
+ste_rxeof(struct ste_softc *sc, int count)
 {
         struct mbuf *m;
         struct ifnet *ifp;
 	struct ste_chain_onefrag *cur_rx;
 	uint32_t rxstat;
-	int total_len = 0, count = 0, rx_npkts = 0;
-
-	STE_LOCK_ASSERT(sc);
+	int total_len, rx_npkts;
 
 	ifp = sc->ste_ifp;
 
-	while ((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status)
-	      & STE_RXSTAT_DMADONE) {
+	bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag,
+	    sc->ste_cdata.ste_rx_list_map,
+	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
+	cur_rx = sc->ste_cdata.ste_rx_head;
+	for (rx_npkts = 0; rx_npkts < STE_RX_LIST_CNT; rx_npkts++,
+	    cur_rx = cur_rx->ste_next) {
+		rxstat = le32toh(cur_rx->ste_ptr->ste_status);
+		if ((rxstat & STE_RXSTAT_DMADONE) == 0)
+			break;
 #ifdef DEVICE_POLLING
 		if (ifp->if_capenable & IFCAP_POLLING) {
-			if (sc->rxcycles <= 0)
+			if (count == 0)
 				break;
-			sc->rxcycles--;
+			count--;
 		}
 #endif
-		if ((STE_RX_LIST_CNT - count) < 3) {
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 			break;
-		}
-
-		cur_rx = sc->ste_cdata.ste_rx_head;
-		sc->ste_cdata.ste_rx_head = cur_rx->ste_next;
-
 		/*
 		 * If an error occurs, update stats, clear the
 		 * status word and leave the mbuf cluster in place:
@@ -769,22 +738,9 @@ ste_rxeof(struct ste_softc *sc)
 			continue;
 		}
 
-		/*
-		 * If there error bit was not set, the upload complete
-		 * bit should be set which means we have a valid packet.
-		 * If not, something truly strange has happened.
-		 */
-		if (!(rxstat & STE_RXSTAT_DMADONE)) {
-			device_printf(sc->ste_dev,
-			    "bad receive status -- packet dropped\n");
-			ifp->if_ierrors++;
-			cur_rx->ste_ptr->ste_status = 0;
-			continue;
-		}
-
 		/* No errors; receive the packet. */
 		m = cur_rx->ste_mbuf;
-		total_len = cur_rx->ste_ptr->ste_status & STE_RXSTAT_FRAMELEN;
+		total_len = STE_RX_BYTES(rxstat);
 
 		/*
 		 * Try to conjure up a new mbuf cluster. If that
@@ -793,7 +749,7 @@ ste_rxeof(struct ste_softc *sc)
 		 * result in a lost packet, but there's little else we
 		 * can do in this situation.
 		 */
-		if (ste_newbuf(sc, cur_rx, NULL) == ENOBUFS) {
+		if (ste_newbuf(sc, cur_rx) != 0) {
 			ifp->if_ierrors++;
 			cur_rx->ste_ptr->ste_status = 0;
 			continue;
@@ -806,10 +762,13 @@ ste_rxeof(struct ste_softc *sc)
 		STE_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		STE_LOCK(sc);
+	}
 
-		cur_rx->ste_ptr->ste_status = 0;
-		count++;
-		rx_npkts++;
+	if (rx_npkts > 0) {
+		sc->ste_cdata.ste_rx_head = cur_rx;
+		bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag,
+		    sc->ste_cdata.ste_rx_list_map,
+		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 	}
 
 	return (rx_npkts);
@@ -857,27 +816,40 @@ ste_txeof(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
 	struct ste_chain *cur_tx;
+	uint32_t txstat;
 	int idx;
 
-	ifp = sc->ste_ifp;
+	STE_LOCK_ASSERT(sc);
 
+	ifp = sc->ste_ifp;
 	idx = sc->ste_cdata.ste_tx_cons;
+	if (idx == sc->ste_cdata.ste_tx_prod)
+		return;
+
+	bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag,
+	    sc->ste_cdata.ste_tx_list_map,
+	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
 	while (idx != sc->ste_cdata.ste_tx_prod) {
 		cur_tx = &sc->ste_cdata.ste_tx_chain[idx];
-
-		if (!(cur_tx->ste_ptr->ste_ctl & STE_TXCTL_DMADONE))
+		txstat = le32toh(cur_tx->ste_ptr->ste_ctl);
+		if ((txstat & STE_TXCTL_DMADONE) == 0)
 			break;
-
+		bus_dmamap_sync(sc->ste_cdata.ste_tx_tag, cur_tx->ste_map,
+		    BUS_DMASYNC_POSTWRITE);
+		bus_dmamap_unload(sc->ste_cdata.ste_tx_tag, cur_tx->ste_map);
+		KASSERT(cur_tx->ste_mbuf != NULL,
+		    ("%s: freeing NULL mbuf!\n", __func__));
 		m_freem(cur_tx->ste_mbuf);
 		cur_tx->ste_mbuf = NULL;
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 		ifp->if_opackets++;
-
+		sc->ste_cdata.ste_tx_cnt--;
 		STE_INC(idx, STE_TX_LIST_CNT);
 	}
 
 	sc->ste_cdata.ste_tx_cons = idx;
-	if (idx == sc->ste_cdata.ste_tx_prod)
+	if (sc->ste_cdata.ste_tx_cnt == 0)
 		sc->ste_timer = 0;
 }
 
@@ -1012,17 +984,8 @@ ste_attach(device_t dev)
 		goto fail;
 	}
 
-	/* Allocate the descriptor queues. */
-	sc->ste_ldata = contigmalloc(sizeof(struct ste_list_data), M_DEVBUF,
-	    M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
-
-	if (sc->ste_ldata == NULL) {
-		device_printf(dev, "no memory for list buffers!\n");
-		error = ENXIO;
+	if ((error = ste_dma_alloc(sc)) != 0)
 		goto fail;
-	}
-
-	bzero(sc->ste_ldata, sizeof(struct ste_list_data));
 
 	ifp = sc->ste_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
@@ -1128,44 +1091,325 @@ ste_detach(device_t dev)
 	if (ifp)
 		if_free(ifp);
 
-	if (sc->ste_ldata) {
-		contigfree(sc->ste_ldata, sizeof(struct ste_list_data),
-		    M_DEVBUF);
-	}
-
+	ste_dma_free(sc);
 	mtx_destroy(&sc->ste_mtx);
 
 	return (0);
 }
 
+struct ste_dmamap_arg {
+	bus_addr_t	ste_busaddr;
+};
+
+static void
+ste_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error)
+{
+	struct ste_dmamap_arg *ctx;
+
+	if (error != 0)
+		return;
+
+	KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
+
+	ctx = (struct ste_dmamap_arg *)arg;
+	ctx->ste_busaddr = segs[0].ds_addr;
+}
+
 static int
-ste_newbuf(struct ste_softc *sc, struct ste_chain_onefrag *c, struct mbuf *m)
+ste_dma_alloc(struct ste_softc *sc)
 {
-	struct mbuf *m_new = NULL;
+	struct ste_chain *txc;
+	struct ste_chain_onefrag *rxc;
+	struct ste_dmamap_arg ctx;
+	int error, i;
+
+	/* Create parent DMA tag. */
+	error = bus_dma_tag_create(
+	    bus_get_dma_tag(sc->ste_dev), /* parent */
+	    1, 0,			/* alignment, boundary */
+	    BUS_SPACE_MAXADDR_32BIT,	/* lowaddr */
+	    BUS_SPACE_MAXADDR,		/* highaddr */
+	    NULL, NULL,			/* filter, filterarg */
+	    BUS_SPACE_MAXSIZE_32BIT,	/* maxsize */
+	    0,				/* nsegments */
+	    BUS_SPACE_MAXSIZE_32BIT,	/* maxsegsize */
+	    0,				/* flags */
+	    NULL, NULL,			/* lockfunc, lockarg */
+	    &sc->ste_cdata.ste_parent_tag);
+	if (error != 0) {
+		device_printf(sc->ste_dev,
+		    "could not create parent DMA tag.\n");
+		goto fail;
+	}
+
+	/* Create DMA tag for Tx descriptor list. */
+	error = bus_dma_tag_create(
+	    sc->ste_cdata.ste_parent_tag, /* parent */
+	    STE_DESC_ALIGN, 0,		/* alignment, boundary */
+	    BUS_SPACE_MAXADDR,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,		/* highaddr */
+	    NULL, NULL,			/* filter, filterarg */
+	    STE_TX_LIST_SZ,		/* maxsize */
+	    1,				/* nsegments */
+	    STE_TX_LIST_SZ,		/* maxsegsize */
+	    0,				/* flags */
+	    NULL, NULL,			/* lockfunc, lockarg */
+	    &sc->ste_cdata.ste_tx_list_tag);
+	if (error != 0) {
+		device_printf(sc->ste_dev,
+		    "could not create Tx list DMA tag.\n");
+		goto fail;
+	}
+
+	/* Create DMA tag for Rx descriptor list. */
+	error = bus_dma_tag_create(
+	    sc->ste_cdata.ste_parent_tag, /* parent */
+	    STE_DESC_ALIGN, 0,		/* alignment, boundary */
+	    BUS_SPACE_MAXADDR,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,		/* highaddr */
+	    NULL, NULL,			/* filter, filterarg */
+	    STE_RX_LIST_SZ,		/* maxsize */
+	    1,				/* nsegments */
+	    STE_RX_LIST_SZ,		/* maxsegsize */
+	    0,				/* flags */
+	    NULL, NULL,			/* lockfunc, lockarg */
+	    &sc->ste_cdata.ste_rx_list_tag);
+	if (error != 0) {
+		device_printf(sc->ste_dev,
+		    "could not create Rx list DMA tag.\n");
+		goto fail;
+	}
+
+	/* Create DMA tag for Tx buffers. */
+	error = bus_dma_tag_create(
+	    sc->ste_cdata.ste_parent_tag, /* parent */
+	    1, 0,			/* alignment, boundary */
+	    BUS_SPACE_MAXADDR,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,		/* highaddr */
+	    NULL, NULL,			/* filter, filterarg */
+	    MCLBYTES * STE_MAXFRAGS,	/* maxsize */
+	    STE_MAXFRAGS,		/* nsegments */
+	    MCLBYTES,			/* maxsegsize */
+	    0,				/* flags */
+	    NULL, NULL,			/* lockfunc, lockarg */
+	    &sc->ste_cdata.ste_tx_tag);
+	if (error != 0) {
+		device_printf(sc->ste_dev, "could not create Tx DMA tag.\n");
+		goto fail;
+	}
 
-	if (m == NULL) {
-		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-		if (m_new == NULL)
-			return (ENOBUFS);
-		MCLGET(m_new, M_DONTWAIT);
-		if (!(m_new->m_flags & M_EXT)) {
-			m_freem(m_new);
-			return (ENOBUFS);
+	/* Create DMA tag for Rx buffers. */
+	error = bus_dma_tag_create(
+	    sc->ste_cdata.ste_parent_tag, /* parent */
+	    1, 0,			/* alignment, boundary */
+	    BUS_SPACE_MAXADDR,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,		/* highaddr */
+	    NULL, NULL,			/* filter, filterarg */
+	    MCLBYTES,			/* maxsize */
+	    1,				/* nsegments */
+	    MCLBYTES,			/* maxsegsize */
+	    0,				/* flags */
+	    NULL, NULL,			/* lockfunc, lockarg */
+	    &sc->ste_cdata.ste_rx_tag);
+	if (error != 0) {
+		device_printf(sc->ste_dev, "could not create Rx DMA tag.\n");
+		goto fail;
+	}
+
+	/* Allocate DMA'able memory and load the DMA map for Tx list. */
+	error = bus_dmamem_alloc(sc->ste_cdata.ste_tx_list_tag,
+	    (void **)&sc->ste_ldata.ste_tx_list,
+	    BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT,
+	    &sc->ste_cdata.ste_tx_list_map);
+	if (error != 0) {
+		device_printf(sc->ste_dev,
+		    "could not allocate DMA'able memory for Tx list.\n");
+		goto fail;
+	}
+	ctx.ste_busaddr = 0;
+	error = bus_dmamap_load(sc->ste_cdata.ste_tx_list_tag,
+	    sc->ste_cdata.ste_tx_list_map, sc->ste_ldata.ste_tx_list,
+	    STE_TX_LIST_SZ, ste_dmamap_cb, &ctx, 0);
+	if (error != 0 || ctx.ste_busaddr == 0) {
+		device_printf(sc->ste_dev,
+		    "could not load DMA'able memory for Tx list.\n");
+		goto fail;
+	}
+	sc->ste_ldata.ste_tx_list_paddr = ctx.ste_busaddr;
+
+	/* Allocate DMA'able memory and load the DMA map for Rx list. */
+	error = bus_dmamem_alloc(sc->ste_cdata.ste_rx_list_tag,
+	    (void **)&sc->ste_ldata.ste_rx_list,
+	    BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT,
+	    &sc->ste_cdata.ste_rx_list_map);
+	if (error != 0) {
+		device_printf(sc->ste_dev,
+		    "could not allocate DMA'able memory for Rx list.\n");
+		goto fail;
+	}
+	ctx.ste_busaddr = 0;
+	error = bus_dmamap_load(sc->ste_cdata.ste_rx_list_tag,
+	    sc->ste_cdata.ste_rx_list_map, sc->ste_ldata.ste_rx_list,
+	    STE_RX_LIST_SZ, ste_dmamap_cb, &ctx, 0);
+	if (error != 0 || ctx.ste_busaddr == 0) {
+		device_printf(sc->ste_dev,
+		    "could not load DMA'able memory for Rx list.\n");
+		goto fail;
+	}
+	sc->ste_ldata.ste_rx_list_paddr = ctx.ste_busaddr;
+
+	/* Create DMA maps for Tx buffers. */
+	for (i = 0; i < STE_TX_LIST_CNT; i++) {
+		txc = &sc->ste_cdata.ste_tx_chain[i];
+		txc->ste_ptr = NULL;
+		txc->ste_mbuf = NULL;
+		txc->ste_next = NULL;
+		txc->ste_phys = 0;
+		txc->ste_map = NULL;
+		error = bus_dmamap_create(sc->ste_cdata.ste_tx_tag, 0,
+		    &txc->ste_map);
+		if (error != 0) {
+			device_printf(sc->ste_dev,
+			    "could not create Tx dmamap.\n");
+			goto fail;
+		}
+	}
+	/* Create DMA maps for Rx buffers. */
+	if ((error = bus_dmamap_create(sc->ste_cdata.ste_rx_tag, 0,
+	    &sc->ste_cdata.ste_rx_sparemap)) != 0) {
+		device_printf(sc->ste_dev,
+		    "could not create spare Rx dmamap.\n");
+		goto fail;
+	}
+	for (i = 0; i < STE_RX_LIST_CNT; i++) {
+		rxc = &sc->ste_cdata.ste_rx_chain[i];
+		rxc->ste_ptr = NULL;
+		rxc->ste_mbuf = NULL;
+		rxc->ste_next = NULL;
+		rxc->ste_map = NULL;
+		error = bus_dmamap_create(sc->ste_cdata.ste_rx_tag, 0,
+		    &rxc->ste_map);
+		if (error != 0) {
+			device_printf(sc->ste_dev,
+			    "could not create Rx dmamap.\n");
+			goto fail;
 		}
-		m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
-	} else {
-		m_new = m;
-		m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
-		m_new->m_data = m_new->m_ext.ext_buf;
 	}
 
-	m_adj(m_new, ETHER_ALIGN);
+fail:
+	return (error);
+}
 
-	c->ste_mbuf = m_new;
-	c->ste_ptr->ste_status = 0;
-	c->ste_ptr->ste_frag.ste_addr = vtophys(mtod(m_new, caddr_t));
-	c->ste_ptr->ste_frag.ste_len = (1536 + ETHER_VLAN_ENCAP_LEN) | STE_FRAG_LAST;
+static void
+ste_dma_free(struct ste_softc *sc)
+{
+	struct ste_chain *txc;
+	struct ste_chain_onefrag *rxc;
+	int i;
 
+	/* Tx buffers. */
+	if (sc->ste_cdata.ste_tx_tag != NULL) {
+		for (i = 0; i < STE_TX_LIST_CNT; i++) {
+			txc = &sc->ste_cdata.ste_tx_chain[i];
+			if (txc->ste_map != NULL) {
+				bus_dmamap_destroy(sc->ste_cdata.ste_tx_tag,
+				    txc->ste_map);
+				txc->ste_map = NULL;
+			}
+		}
+		bus_dma_tag_destroy(sc->ste_cdata.ste_tx_tag);
+		sc->ste_cdata.ste_tx_tag = NULL;
+	}
+	/* Rx buffers. */
+	if (sc->ste_cdata.ste_rx_tag != NULL) {
+		for (i = 0; i < STE_RX_LIST_CNT; i++) {
+			rxc = &sc->ste_cdata.ste_rx_chain[i];
+			if (rxc->ste_map != NULL) {
+				bus_dmamap_destroy(sc->ste_cdata.ste_rx_tag,
+				    rxc->ste_map);
+				rxc->ste_map = NULL;
+			}
+		}
+		if (sc->ste_cdata.ste_rx_sparemap != NULL) {
+			bus_dmamap_destroy(sc->ste_cdata.ste_rx_tag,
+			    sc->ste_cdata.ste_rx_sparemap);
+			sc->ste_cdata.ste_rx_sparemap = NULL;
+		}
+		bus_dma_tag_destroy(sc->ste_cdata.ste_rx_tag);
+		sc->ste_cdata.ste_rx_tag = NULL;
+	}
+	/* Tx descriptor list. */
+	if (sc->ste_cdata.ste_tx_list_tag != NULL) {
+		if (sc->ste_cdata.ste_tx_list_map != NULL)
+			bus_dmamap_unload(sc->ste_cdata.ste_tx_list_tag,
+			    sc->ste_cdata.ste_tx_list_map);
+		if (sc->ste_cdata.ste_tx_list_map != NULL &&
+		    sc->ste_ldata.ste_tx_list != NULL)
+			bus_dmamem_free(sc->ste_cdata.ste_tx_list_tag,
+			    sc->ste_ldata.ste_tx_list,
+			    sc->ste_cdata.ste_tx_list_map);
+		sc->ste_ldata.ste_tx_list = NULL;
+		sc->ste_cdata.ste_tx_list_map = NULL;
+		bus_dma_tag_destroy(sc->ste_cdata.ste_tx_list_tag);
+		sc->ste_cdata.ste_tx_list_tag = NULL;
+	}
+	/* Rx descriptor list. */
+	if (sc->ste_cdata.ste_rx_list_tag != NULL) {
+		if (sc->ste_cdata.ste_rx_list_map != NULL)
+			bus_dmamap_unload(sc->ste_cdata.ste_rx_list_tag,
+			    sc->ste_cdata.ste_rx_list_map);
+		if (sc->ste_cdata.ste_rx_list_map != NULL &&
+		    sc->ste_ldata.ste_rx_list != NULL)
+			bus_dmamem_free(sc->ste_cdata.ste_rx_list_tag,
+			    sc->ste_ldata.ste_rx_list,
+			    sc->ste_cdata.ste_rx_list_map);
+		sc->ste_ldata.ste_rx_list = NULL;
+		sc->ste_cdata.ste_rx_list_map = NULL;
+		bus_dma_tag_destroy(sc->ste_cdata.ste_rx_list_tag);
+		sc->ste_cdata.ste_rx_list_tag = NULL;
+	}
+	if (sc->ste_cdata.ste_parent_tag != NULL) {
+		bus_dma_tag_destroy(sc->ste_cdata.ste_parent_tag);
+		sc->ste_cdata.ste_parent_tag = NULL;
+	}
+}
+
+static int
+ste_newbuf(struct ste_softc *sc, struct ste_chain_onefrag *rxc)
+{
+	struct mbuf *m;
+	bus_dma_segment_t segs[1];
+	bus_dmamap_t map;
+	int error, nsegs;
+
+	m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+	if (m == NULL)
+		return (ENOBUFS);
+	m->m_len = m->m_pkthdr.len = MCLBYTES;
+	m_adj(m, ETHER_ALIGN);
+
+	if ((error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_rx_tag,
+	    sc->ste_cdata.ste_rx_sparemap, m, segs, &nsegs, 0)) != 0) {
+		m_freem(m);
+		return (error);
+	}
+	KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
+
+	if (rxc->ste_mbuf != NULL) {
+		bus_dmamap_sync(sc->ste_cdata.ste_rx_tag, rxc->ste_map,
+		    BUS_DMASYNC_POSTREAD);
+		bus_dmamap_unload(sc->ste_cdata.ste_rx_tag, rxc->ste_map);
+	}
+	map = rxc->ste_map;
+	rxc->ste_map = sc->ste_cdata.ste_rx_sparemap;
+	sc->ste_cdata.ste_rx_sparemap = map;
+	bus_dmamap_sync(sc->ste_cdata.ste_rx_tag, rxc->ste_map,
+	    BUS_DMASYNC_PREREAD);
+	rxc->ste_mbuf = m;
+	rxc->ste_ptr->ste_status = 0;
+	rxc->ste_ptr->ste_frag.ste_addr = htole32(segs[0].ds_addr);
+	rxc->ste_ptr->ste_frag.ste_len = htole32(segs[0].ds_len |
+	    STE_FRAG_LAST);
 	return (0);
 }
 
@@ -1174,30 +1418,31 @@ ste_init_rx_list(struct ste_softc *sc)
 {
 	struct ste_chain_data *cd;
 	struct ste_list_data *ld;
-	int i;
+	int error, i;
 
 	cd = &sc->ste_cdata;
-	ld = sc->ste_ldata;
-
+	ld = &sc->ste_ldata;
+	bzero(ld->ste_rx_list, STE_RX_LIST_SZ);
 	for (i = 0; i < STE_RX_LIST_CNT; i++) {
 		cd->ste_rx_chain[i].ste_ptr = &ld->ste_rx_list[i];
-		if (ste_newbuf(sc, &cd->ste_rx_chain[i], NULL) == ENOBUFS)
-			return (ENOBUFS);
+		error = ste_newbuf(sc, &cd->ste_rx_chain[i]);
+		if (error != 0)
+			return (error);
 		if (i == (STE_RX_LIST_CNT - 1)) {
-			cd->ste_rx_chain[i].ste_next =
-			    &cd->ste_rx_chain[0];
-			ld->ste_rx_list[i].ste_next =
-			    vtophys(&ld->ste_rx_list[0]);
+			cd->ste_rx_chain[i].ste_next = &cd->ste_rx_chain[0];
+			ld->ste_rx_list[i].ste_next = ld->ste_rx_list_paddr +
+			    (sizeof(struct ste_desc_onefrag) * 0);
 		} else {
-			cd->ste_rx_chain[i].ste_next =
-			    &cd->ste_rx_chain[i + 1];
-			ld->ste_rx_list[i].ste_next =
-			    vtophys(&ld->ste_rx_list[i + 1]);
+			cd->ste_rx_chain[i].ste_next = &cd->ste_rx_chain[i + 1];
+			ld->ste_rx_list[i].ste_next = ld->ste_rx_list_paddr +
+			    (sizeof(struct ste_desc_onefrag) * (i + 1));
 		}
-		ld->ste_rx_list[i].ste_status = 0;
 	}
 
 	cd->ste_rx_head = &cd->ste_rx_chain[0];
+	bus_dmamap_sync(sc->ste_cdata.ste_rx_list_tag,
+	    sc->ste_cdata.ste_rx_list_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	return (0);
 }
@@ -1210,22 +1455,32 @@ ste_init_tx_list(struct ste_softc *sc)
 	int i;
 
 	cd = &sc->ste_cdata;
-	ld = sc->ste_ldata;
+	ld = &sc->ste_ldata;
+	bzero(ld->ste_tx_list, STE_TX_LIST_SZ);
 	for (i = 0; i < STE_TX_LIST_CNT; i++) {
 		cd->ste_tx_chain[i].ste_ptr = &ld->ste_tx_list[i];
-		cd->ste_tx_chain[i].ste_ptr->ste_next = 0;
-		cd->ste_tx_chain[i].ste_ptr->ste_ctl  = 0;
-		cd->ste_tx_chain[i].ste_phys = vtophys(&ld->ste_tx_list[i]);
-		if (i == (STE_TX_LIST_CNT - 1))
-			cd->ste_tx_chain[i].ste_next =
-			    &cd->ste_tx_chain[0];
-		else
-			cd->ste_tx_chain[i].ste_next =
-			    &cd->ste_tx_chain[i + 1];
+		cd->ste_tx_chain[i].ste_mbuf = NULL;
+		if (i == (STE_TX_LIST_CNT - 1)) {
+			cd->ste_tx_chain[i].ste_next = &cd->ste_tx_chain[0];
+			cd->ste_tx_chain[i].ste_phys = htole32(STE_ADDR_LO(
+			    ld->ste_tx_list_paddr +
+			    (sizeof(struct ste_desc) * 0)));
+		} else {
+			cd->ste_tx_chain[i].ste_next = &cd->ste_tx_chain[i + 1];
+			cd->ste_tx_chain[i].ste_phys = htole32(STE_ADDR_LO(
+			    ld->ste_tx_list_paddr +
+			    (sizeof(struct ste_desc) * (i + 1))));
+		}
 	}
 
+	cd->ste_last_tx = NULL;
 	cd->ste_tx_prod = 0;
 	cd->ste_tx_cons = 0;
+	cd->ste_tx_cnt = 0;
+
+	bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag,
+	    sc->ste_cdata.ste_tx_list_map,
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 }
 
 static void
@@ -1258,7 +1513,7 @@ ste_init_locked(struct ste_softc *sc)
 	}
 
 	/* Init RX list */
-	if (ste_init_rx_list(sc) == ENOBUFS) {
+	if (ste_init_rx_list(sc) != 0) {
 		device_printf(sc->ste_dev,
 		    "initialization failed: no memory for RX buffers\n");
 		ste_stop(sc);
@@ -1303,11 +1558,11 @@ ste_init_locked(struct ste_softc *sc)
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_RXDMA_STALL);
 	ste_wait(sc);
 	CSR_WRITE_4(sc, STE_RX_DMALIST_PTR,
-	    vtophys(&sc->ste_ldata->ste_rx_list[0]));
+	    STE_ADDR_LO(sc->ste_ldata.ste_rx_list_paddr));
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_RXDMA_UNSTALL);
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_RXDMA_UNSTALL);
 
-	/* Set TX polling interval (defer until we TX first packet */
+	/* Set TX polling interval(defer until we TX first packet). */
 	CSR_WRITE_1(sc, STE_TX_DMAPOLL_PERIOD, 0);
 
 	/* Load address of the TX list */
@@ -1317,7 +1572,6 @@ ste_init_locked(struct ste_softc *sc)
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
 	ste_wait(sc);
-	sc->ste_tx_prev = NULL;
 
 	/* Enable receiver and transmitter */
 	CSR_WRITE_2(sc, STE_MACCTL0, 0);
@@ -1353,6 +1607,8 @@ static void
 ste_stop(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
+	struct ste_chain_onefrag *cur_rx;
+	struct ste_chain *cur_tx;
 	int i;
 
 	STE_LOCK_ASSERT(sc);
@@ -1377,20 +1633,28 @@ ste_stop(struct ste_softc *sc)
 	sc->ste_link = 0;
 
 	for (i = 0; i < STE_RX_LIST_CNT; i++) {
-		if (sc->ste_cdata.ste_rx_chain[i].ste_mbuf != NULL) {
-			m_freem(sc->ste_cdata.ste_rx_chain[i].ste_mbuf);
-			sc->ste_cdata.ste_rx_chain[i].ste_mbuf = NULL;
+		cur_rx = &sc->ste_cdata.ste_rx_chain[i];
+		if (cur_rx->ste_mbuf != NULL) {
+			bus_dmamap_sync(sc->ste_cdata.ste_rx_tag,
+			    cur_rx->ste_map, BUS_DMASYNC_POSTREAD);
+			bus_dmamap_unload(sc->ste_cdata.ste_rx_tag,
+			    cur_rx->ste_map);
+			m_freem(cur_rx->ste_mbuf);
+			cur_rx->ste_mbuf = NULL;
 		}
 	}
 
 	for (i = 0; i < STE_TX_LIST_CNT; i++) {
-		if (sc->ste_cdata.ste_tx_chain[i].ste_mbuf != NULL) {
-			m_freem(sc->ste_cdata.ste_tx_chain[i].ste_mbuf);
-			sc->ste_cdata.ste_tx_chain[i].ste_mbuf = NULL;
+		cur_tx = &sc->ste_cdata.ste_tx_chain[i];
+		if (cur_tx->ste_mbuf != NULL) {
+			bus_dmamap_sync(sc->ste_cdata.ste_tx_tag,
+			    cur_tx->ste_map, BUS_DMASYNC_POSTWRITE);
+			bus_dmamap_unload(sc->ste_cdata.ste_tx_tag,
+			    cur_tx->ste_map);
+			m_freem(cur_tx->ste_mbuf);
+			cur_tx->ste_mbuf = NULL;
 		}
 	}
-
-	bzero(sc->ste_ldata, sizeof(struct ste_list_data));
 }
 
 static void
@@ -1505,48 +1769,60 @@ ste_ioctl(struct ifnet *ifp, u_long comm
 }
 
 static int
-ste_encap(struct ste_softc *sc, struct ste_chain *c, struct mbuf *m_head)
+ste_encap(struct ste_softc *sc, struct mbuf **m_head, struct ste_chain *txc)
 {
+	struct ste_frag *frag;
 	struct mbuf *m;
-	struct ste_desc *d;
-	struct ste_frag *f = NULL;
-	int frag = 0;
-
-	d = c->ste_ptr;
-	d->ste_ctl = 0;
-
-encap_retry:
-	for (m = m_head, frag = 0; m != NULL; m = m->m_next) {
-		if (m->m_len != 0) {
-			if (frag == STE_MAXFRAGS)
-				break;
-			f = &d->ste_frags[frag];
-			f->ste_addr = vtophys(mtod(m, vm_offset_t));
-			f->ste_len = m->m_len;
-			frag++;
-		}
-	}
+	struct ste_desc *desc;
+	bus_dma_segment_t txsegs[STE_MAXFRAGS];
+	int error, i, nsegs;
 
-	if (m != NULL) {
-		struct mbuf *mn;
+	STE_LOCK_ASSERT(sc);
+	M_ASSERTPKTHDR((*m_head));
 
-		/*
-		 * We ran out of segments. We have to recopy this
-		 * mbuf chain first. Bail out if we can't get the
-		 * new buffers.
-		 */
-		mn = m_defrag(m_head, M_DONTWAIT);
-		if (mn == NULL) {
-			m_freem(m_head);
-			return ENOMEM;
-		}
-		m_head = mn;
-		goto encap_retry;
+	error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_tx_tag,
+	    txc->ste_map, *m_head, txsegs, &nsegs, 0);
+	if (error == EFBIG) {
+		m = m_collapse(*m_head, M_DONTWAIT, STE_MAXFRAGS);
+		if (m == NULL) {
+			m_freem(*m_head);
+			*m_head = NULL;
+			return (ENOMEM);
+		}
+		*m_head = m;
+		error = bus_dmamap_load_mbuf_sg(sc->ste_cdata.ste_tx_tag,
+		    txc->ste_map, *m_head, txsegs, &nsegs, 0);
+		if (error != 0) {
+			m_freem(*m_head);
+			*m_head = NULL;
+			return (error);
+		}
+	} else if (error != 0)
+		return (error);
+	if (nsegs == 0) {
+		m_freem(*m_head);
+		*m_head = NULL;
+		return (EIO);
+	}
+	bus_dmamap_sync(sc->ste_cdata.ste_tx_tag, txc->ste_map,
+	    BUS_DMASYNC_PREWRITE);
+
+	desc = txc->ste_ptr;
+	for (i = 0; i < nsegs; i++) {
+		frag = &desc->ste_frags[i];
+		frag->ste_addr = htole32(STE_ADDR_LO(txsegs[i].ds_addr));
+		frag->ste_len = htole32(txsegs[i].ds_len);
 	}
-
-	c->ste_mbuf = m_head;
-	d->ste_frags[frag - 1].ste_len |= STE_FRAG_LAST;
-	d->ste_ctl = 1;
+	desc->ste_frags[i - 1].ste_len |= htole32(STE_FRAG_LAST);
+	/*
+	 * Because we use Tx polling we can't chain multiple
+	 * Tx descriptors here. Otherwise we race with controller.
+	 */
+	desc->ste_next = 0;
+	desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS | STE_TXCTL_DMAINTR);
+	txc->ste_mbuf = *m_head;
+	STE_INC(sc->ste_cdata.ste_tx_prod, STE_TX_LIST_CNT);
+	sc->ste_cdata.ste_tx_cnt++;
 
 	return (0);
 }
@@ -1568,7 +1844,7 @@ ste_start_locked(struct ifnet *ifp)
 	struct ste_softc *sc;
 	struct ste_chain *cur_tx;
 	struct mbuf *m_head = NULL;
-	int idx;
+	int enq;
 
 	sc = ifp->if_softc;
 	STE_LOCK_ASSERT(sc);
@@ -1579,62 +1855,56 @@ ste_start_locked(struct ifnet *ifp)
 	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
 		return;
 
-	idx = sc->ste_cdata.ste_tx_prod;
-
-	while (sc->ste_cdata.ste_tx_chain[idx].ste_mbuf == NULL) {
-		/*
-		 * We cannot re-use the last (free) descriptor;
-		 * the chip may not have read its ste_next yet.
-		 */
-		if (STE_NEXT(idx, STE_TX_LIST_CNT) ==
-		    sc->ste_cdata.ste_tx_cons) {
+	for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd);) {
+		if (sc->ste_cdata.ste_tx_cnt == STE_TX_LIST_CNT - 1) {
+			/*
+			 * Controller may have cached copy of the last used
+			 * next ptr so we have to reserve one TFD to avoid
+			 * TFD overruns.
+			 */
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			break;
 		}
-
 		IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
 		if (m_head == NULL)
 			break;
-
-		cur_tx = &sc->ste_cdata.ste_tx_chain[idx];
-
-		if (ste_encap(sc, cur_tx, m_head) != 0)
+		cur_tx = &sc->ste_cdata.ste_tx_chain[sc->ste_cdata.ste_tx_prod];
+		if (ste_encap(sc, &m_head, cur_tx) != 0) {
+			if (m_head == NULL)
+				break;
+			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			break;
-
-		cur_tx->ste_ptr->ste_next = 0;
-
-		if (sc->ste_tx_prev == NULL) {
-			cur_tx->ste_ptr->ste_ctl = STE_TXCTL_DMAINTR | 1;
-			/* Load address of the TX list */
+		}
+		if (sc->ste_cdata.ste_last_tx == NULL) {
+			bus_dmamap_sync(sc->ste_cdata.ste_tx_list_tag,
+			    sc->ste_cdata.ste_tx_list_map,
+			    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 			STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_STALL);
 			ste_wait(sc);
-
 			CSR_WRITE_4(sc, STE_TX_DMALIST_PTR,
-			    vtophys(&sc->ste_ldata->ste_tx_list[0]));
-
-			/* Set TX polling interval to start TX engine */
+	    		    STE_ADDR_LO(sc->ste_ldata.ste_tx_list_paddr));
 			CSR_WRITE_1(sc, STE_TX_DMAPOLL_PERIOD, 64);
-
 			STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
 			ste_wait(sc);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 19:00:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 347E61065696;
	Tue, 22 Dec 2009 19:00:19 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 23F5C8FC21;
	Tue, 22 Dec 2009 19:00:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMJ0Jja072597;
	Tue, 22 Dec 2009 19:00:19 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJ0JUw072595;
	Tue, 22 Dec 2009 19:00:19 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912221900.nBMJ0JUw072595@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 19:00:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200854 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 19:00:19 -0000

Author: yongari
Date: Tue Dec 22 19:00:18 2009
New Revision: 200854
URL: http://svn.freebsd.org/changeset/base/200854

Log:
  Add minimal dealy while ste(4) is waiting for the end of active DMA
  cycle.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 18:57:07 2009	(r200853)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 19:00:18 2009	(r200854)
@@ -471,6 +471,7 @@ ste_wait(struct ste_softc *sc)
 	for (i = 0; i < STE_TIMEOUT; i++) {
 		if (!(CSR_READ_4(sc, STE_DMACTL) & STE_DMACTL_DMA_HALTINPROG))
 			break;
+		DELAY(1);
 	}
 
 	if (i == STE_TIMEOUT)

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 19:01:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5F5401065697;
	Tue, 22 Dec 2009 19:01:48 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D18F8FC1B;
	Tue, 22 Dec 2009 19:01:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMJ1mJ4072686;
	Tue, 22 Dec 2009 19:01:48 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJ1mXQ072673;
	Tue, 22 Dec 2009 19:01:48 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912221901.nBMJ1mXQ072673@svn.freebsd.org>
From: Luigi Rizzo 
Date: Tue, 22 Dec 2009 19:01:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200855 - in head/sys: net netgraph netinet netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 19:01:48 -0000

Author: luigi
Date: Tue Dec 22 19:01:47 2009
New Revision: 200855
URL: http://svn.freebsd.org/changeset/base/200855

Log:
  merge code from ipfw3-head to reduce contention on the ipfw lock
  and remove all O(N) sequences from kernel critical sections in ipfw.
  
  In detail:
  
   1. introduce a IPFW_UH_LOCK to arbitrate requests from
       the upper half of the kernel. Some things, such as 'ipfw show',
       can be done holding this lock in read mode, whereas insert and
       delete require IPFW_UH_WLOCK.
  
    2. introduce a mapping structure to keep rules together. This replaces
       the 'next' chain currently used in ipfw rules. At the moment
       the map is a simple array (sorted by rule number and then rule_id),
       so we can find a rule quickly instead of having to scan the list.
       This reduces many expensive lookups from O(N) to O(log N).
  
    3. when an expensive operation (such as insert or delete) is done
       by userland, we grab IPFW_UH_WLOCK, create a new copy of the map
       without blocking the bottom half of the kernel, then acquire
       IPFW_WLOCK and quickly update pointers to the map and related info.
       After dropping IPFW_LOCK we can then continue the cleanup protected
       by IPFW_UH_LOCK. So userland still costs O(N) but the kernel side
       is only blocked for O(1).
  
    4. do not pass pointers to rules through dummynet, netgraph, divert etc,
       but rather pass a  tuple.
       We validate the slot index (in the array of #2) with chain_id,
       and if successful do a O(1) dereference; otherwise, we can find
       the rule in O(log N) through 
  
  All the above does not change the userland/kernel ABI, though there
  are some disgusting casts between pointers and uint32_t
  
  Operation costs now are as follows:
  
    Function				Old	Now	  Planned
  -------------------------------------------------------------------
    + skipto X, non cached		O(N)	O(log N)
    + skipto X, cached			O(1)	O(1)
  XXX dynamic rule lookup			O(1)	O(log N)  O(1)
    + skipto tablearg			O(N)	O(1)
    + reinject, non cached		O(N)	O(log N)
    + reinject, cached			O(1)	O(1)
    + kernel blocked during setsockopt()	O(N)	O(1)
  -------------------------------------------------------------------
  
  The only (very small) regression is on dynamic rule lookup and this will
  be fixed in a day or two, without changing the userland/kernel ABI
  
  Supported by: Valeria Paoli
  MFC after:	1 month

Modified:
  head/sys/net/if_bridge.c
  head/sys/net/if_ethersubr.c
  head/sys/netgraph/ng_ipfw.c
  head/sys/netgraph/ng_ipfw.h
  head/sys/netinet/ip_dummynet.h
  head/sys/netinet/ip_fw.h
  head/sys/netinet/ipfw/ip_dummynet.c
  head/sys/netinet/ipfw/ip_fw2.c
  head/sys/netinet/ipfw/ip_fw_log.c
  head/sys/netinet/ipfw/ip_fw_pfil.c
  head/sys/netinet/ipfw/ip_fw_private.h
  head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/net/if_bridge.c
==============================================================================
--- head/sys/net/if_bridge.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/net/if_bridge.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -3039,20 +3039,23 @@ bridge_pfil(struct mbuf **mp, struct ifn
 			goto bad;
 	}
 
+	/* XXX this section is also in if_ethersubr.c */
 	if (V_ip_fw_chk_ptr && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) {
 		struct dn_pkt_tag *dn_tag;
 
 		error = -1;
 		dn_tag = ip_dn_claim_tag(*mp);
-		if (dn_tag != NULL) {
-			if (dn_tag->rule != NULL && V_fw_one_pass)
+		if (dn_tag == NULL) {
+			args.slot = 0;
+		} else {
+			if (dn_tag->slot != 0 && V_fw_one_pass)
 				/* packet already partially processed */
 				goto ipfwpass;
-			args.rule = dn_tag->rule; /* matching rule to restart */
-			args.rule_id = dn_tag->rule_id;
+			args.slot = dn_tag->slot; /* next rule to use */
 			args.chain_id = dn_tag->chain_id;
-		} else
-			args.rule = NULL;
+			args.rulenum = dn_tag->rulenum;
+			args.rule_id = dn_tag->rule_id;
+		}
 
 		args.m = *mp;
 		args.oif = ifp;

Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/net/if_ethersubr.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -471,15 +471,17 @@ ether_ipfw_chk(struct mbuf **m0, struct 
 
 	dn_tag = ip_dn_claim_tag(*m0);
 
-	if (dn_tag != NULL) {
-		if (dn_tag->rule != NULL && V_fw_one_pass)
+	if (dn_tag == NULL) {
+		args.slot = 0;
+	} else {
+		if (dn_tag->slot != 0 && V_fw_one_pass)
 			/* dummynet packet, already partially processed */
 			return (1);
-		args.rule = dn_tag->rule;	/* matching rule to restart */
+		args.slot = dn_tag->slot;	/* matching rule to restart */
+		args.rulenum = dn_tag->rulenum;
 		args.rule_id = dn_tag->rule_id;
 		args.chain_id = dn_tag->chain_id;
-	} else
-		args.rule = NULL;
+	}
 
 	/*
 	 * I need some amt of data to be contiguous, and in case others need

Modified: head/sys/netgraph/ng_ipfw.c
==============================================================================
--- head/sys/netgraph/ng_ipfw.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netgraph/ng_ipfw.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -293,7 +293,8 @@ ng_ipfw_input(struct mbuf **m0, int dir,
 			m_freem(m);
 			return (ENOMEM);
 		}
-		ngit->rule = fwa->rule;
+		ngit->slot = fwa->slot;
+		ngit->rulenum = fwa->rulenum;
 		ngit->rule_id = fwa->rule_id;
 		ngit->chain_id = fwa->chain_id;
 		ngit->dir = dir;

Modified: head/sys/netgraph/ng_ipfw.h
==============================================================================
--- head/sys/netgraph/ng_ipfw.h	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netgraph/ng_ipfw.h	Tue Dec 22 19:01:47 2009	(r200855)
@@ -37,7 +37,8 @@ extern	ng_ipfw_input_t	*ng_ipfw_input_p;
 
 struct ng_ipfw_tag {
 	struct m_tag	mt;		/* tag header */
-	struct ip_fw	*rule;		/* matching rule */
+	uint32_t	slot;		/* slot for next rule */
+	uint32_t	rulenum;	/* matching rule number */
 	uint32_t	rule_id;	/* matching rule id */
 	uint32_t	chain_id;	/* ruleset id */
 	struct ifnet	*ifp;		/* interface, for ip_output */

Modified: head/sys/netinet/ip_dummynet.h
==============================================================================
--- head/sys/netinet/ip_dummynet.h	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ip_dummynet.h	Tue Dec 22 19:01:47 2009	(r200855)
@@ -112,7 +112,8 @@ struct dn_heap {
  * processing requirements.
  */
 struct dn_pkt_tag {
-    struct ip_fw *rule;		/* matching rule */
+    uint32_t slot;		/* slot of next rule to use */
+    uint32_t rulenum;		/* matching rule number */
     uint32_t rule_id;		/* matching rule id */
     uint32_t chain_id;		/* ruleset id */
     int dn_dir;			/* action when packet comes out. */

Modified: head/sys/netinet/ip_fw.h
==============================================================================
--- head/sys/netinet/ip_fw.h	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ip_fw.h	Tue Dec 22 19:01:47 2009	(r200855)
@@ -461,7 +461,7 @@ typedef struct _ipfw_insn_icmp6 {
  */
 
 struct ip_fw {
-	struct ip_fw	*next;		/* linked list of rules		*/
+	struct ip_fw	*x_next;	/* linked list of rules		*/
 	struct ip_fw	*next_rule;	/* ptr to next [skipto] rule	*/
 	/* 'next_rule' is used to pass up 'set_disable' status		*/
 

Modified: head/sys/netinet/ipfw/ip_dummynet.c
==============================================================================
--- head/sys/netinet/ipfw/ip_dummynet.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_dummynet.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -1367,20 +1367,11 @@ dummynet_io(struct mbuf **m0, int dir, s
 	struct dn_pipe *pipe;
 	uint64_t len = m->m_pkthdr.len;
 	struct dn_flow_queue *q = NULL;
-	int is_pipe;
-	ipfw_insn *cmd = ACTION_PTR(fwa->rule);
+	int is_pipe = fwa->cookie & 0x8000000 ? 0 : 1;
 
 	KASSERT(m->m_nextpkt == NULL,
 	    ("dummynet_io: mbuf queue passed to dummynet"));
 
-	if (cmd->opcode == O_LOG)
-		cmd += F_LEN(cmd);
-	if (cmd->opcode == O_ALTQ)
-		cmd += F_LEN(cmd);
-	if (cmd->opcode == O_TAG)
-		cmd += F_LEN(cmd);
-	is_pipe = (cmd->opcode == O_PIPE);
-
 	DUMMYNET_LOCK();
 	io_pkt++;
 	/*
@@ -1390,11 +1381,11 @@ dummynet_io(struct mbuf **m0, int dir, s
 	 * below can be simplified.
 	 */
 	if (is_pipe) {
-		pipe = locate_pipe(fwa->cookie);
+		pipe = locate_pipe(fwa->cookie & 0xffff);
 		if (pipe != NULL)
 			fs = &(pipe->fs);
 	} else
-		fs = locate_flowset(fwa->cookie);
+		fs = locate_flowset(fwa->cookie & 0xffff);
 
 	if (fs == NULL)
 		goto dropit;	/* This queue/pipe does not exist! */
@@ -1440,7 +1431,8 @@ dummynet_io(struct mbuf **m0, int dir, s
 	 * Ok, i can handle the pkt now...
 	 * Build and enqueue packet + parameters.
 	 */
-	pkt->rule = fwa->rule;
+	pkt->slot = fwa->slot;
+	pkt->rulenum = fwa->rulenum;
 	pkt->rule_id = fwa->rule_id;
 	pkt->chain_id = fwa->chain_id;
 	pkt->dn_dir = dir;

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_fw2.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -628,31 +628,6 @@ send_reject(struct ip_fw_args *args, int
 	args->m = NULL;
 }
 
-/**
- * Return the pointer to the skipto target.
- *
- * IMPORTANT: this should only be called on SKIPTO rules, and the
- * jump target is taken from the 'rulenum' argument, which may come
- * from the rule itself (direct skipto) or not (tablearg)
- *
- * The function never returns NULL: if the requested rule is not
- * present, it returns the next rule in the chain.
- * This also happens in case of a bogus argument > 65535
- */
-static struct ip_fw *
-lookup_next_rule(struct ip_fw *me, uint32_t rulenum)
-{
-	struct ip_fw *rule;
-
-	for (rule = me->next; rule ; rule = rule->next) {
-		if (rule->rulenum >= rulenum)
-			break;
-	}
-	if (rule == NULL)	/* failure or not a skipto */
-		rule = me->next ? me->next : me;
-	return rule;
-}
-
 /*
  * Support for uid/gid/jail lookup. These tests are expensive
  * (because we may need to look into the list of active sockets)
@@ -741,11 +716,13 @@ check_uidgid(ipfw_insn_u32 *insn, int pr
  * Helper function to write the matching rule into args
  */
 static inline void
-set_match(struct ip_fw_args *args, struct ip_fw *f, struct ip_fw_chain *chain)
+set_match(struct ip_fw_args *args, int slot,
+	struct ip_fw_chain *chain)
 {
-	args->rule = f;
-	args->rule_id = f->id;
 	args->chain_id = chain->id;
+	args->slot = slot + 1; /* we use 0 as a marker */
+	args->rule_id = chain->map[slot]->id;
+	args->rulenum = chain->map[slot]->rulenum;
 }
 
 /*
@@ -839,7 +816,7 @@ ipfw_chk(struct ip_fw_args *args)
 	 */
 	struct ifnet *oif = args->oif;
 
-	struct ip_fw *f = NULL;		/* matching rule */
+	int f_pos = 0;		/* index of current rule in the array */
 	int retval = 0;
 
 	/*
@@ -1168,31 +1145,21 @@ do {								\
 		return (IP_FW_PASS);	/* accept */
 	}
 	mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL);
-	if (args->rule) {
+	if (args->slot) {
 		/*
 		 * Packet has already been tagged as a result of a previous
 		 * match on rule args->rule aka args->rule_id (PIPE, QUEUE,
 		 * REASS, NETGRAPH and similar, never a skipto).
-		 * Validate the pointer and continue from args->rule->next
-		 * if still present, otherwise use the default rule.
-		 * XXX If fw_one_pass != 0 then just accept it, though
-		 * the caller should never pass us such packets.
+		 * Validate the slot and continue from the next one
+		 * if still present, otherwise do a lookup.
 		 */
 		if (V_fw_one_pass) {
 			IPFW_RUNLOCK(chain);
 			return (IP_FW_PASS);
 		}
-		if (chain->id == args->chain_id) { /* pointer still valid */
-			f = args->rule->next;
-		} else { /* must revalidate the pointer */
-			for (f = chain->rules; f != NULL; f = f->next)
-				if (f == args->rule && f->id == args->rule_id) {
-					f = args->rule->next;
-					break;
-				}
-		}
-		if (f == NULL) /* in case of errors, use default; */
-			f = chain->default_rule;
+		f_pos = (args->chain_id == chain->id) ?
+		    args->slot /* already incremented */ :
+		    ipfw_find_rule(chain, args->rulenum, args->rule_id+1);
 	} else {
 		/*
 		 * Find the starting rule. It can be either the first
@@ -1200,18 +1167,13 @@ do {								\
 		 */
 		int skipto = mtag ? divert_cookie(mtag) : 0;
 
-		f = chain->rules;
+		f_pos = 0;
 		if (args->eh == NULL && skipto != 0) {
 			if (skipto >= IPFW_DEFAULT_RULE) {
 				IPFW_RUNLOCK(chain);
 				return (IP_FW_DENY); /* invalid */
 			}
-			while (f && f->rulenum <= skipto)
-				f = f->next;
-			if (f == NULL) {	/* drop packet */
-				IPFW_RUNLOCK(chain);
-				return (IP_FW_DENY);
-			}
+			f_pos = ipfw_find_rule(chain, skipto, 0);
 		}
 	}
 	/* reset divert rule to avoid confusion later */
@@ -1227,7 +1189,7 @@ do {								\
 	 * need to break out of one or both loops, or re-enter one of
 	 * the loops with updated variables. Loop variables are:
 	 *
-	 *	f (outer loop) points to the current rule.
+	 *	f_pos (outer loop) points to the current rule.
 	 *		On output it points to the matching rule.
 	 *	done (outer loop) is used as a flag to break the loop.
 	 *	l (inner loop)	residual length of current rule.
@@ -1236,15 +1198,16 @@ do {								\
 	 * We break the inner loop by setting l=0 and possibly
 	 * cmdlen=0 if we don't want to advance cmd.
 	 * We break the outer loop by setting done=1
-	 * We can restart the inner loop by setting l>0 and f, cmd
+	 * We can restart the inner loop by setting l>0 and f_pos, f, cmd
 	 * as needed.
 	 */
-	for (; f; f = f->next) {
+	for (; f_pos < chain->n_rules; f_pos++) {
 		ipfw_insn *cmd;
 		uint32_t tablearg = 0;
 		int l, cmdlen, skip_or; /* skip rest of OR block */
+		struct ip_fw *f;
 
-/* again: */
+		f = chain->map[f_pos];
 		if (V_set_disable & (1 << f->set) )
 			continue;
 
@@ -1864,8 +1827,8 @@ do {								\
 			 * Exceptions:
 			 * O_COUNT and O_SKIPTO actions:
 			 *   instead of terminating, we jump to the next rule
-			 *   (setting l=0), or to the SKIPTO target (by
-			 *   setting f, cmd and l as needed), respectively.
+			 *   (setting l=0), or to the SKIPTO target (setting
+			 *   f/f_len, cmd and l as needed), respectively.
 			 *
 			 * O_TAG, O_LOG and O_ALTQ action parameters:
 			 *   perform some action and set match = 1;
@@ -1926,7 +1889,14 @@ do {								\
 					 */
 					q->pcnt++;
 					q->bcnt += pktlen;
+					/* XXX we would like to have f_pos
+					 * readily accessible in the dynamic
+				         * rule, instead of having to
+					 * lookup q->rule.
+					 */
 					f = q->rule;
+					f_pos = ipfw_find_rule(chain,
+						f->rulenum, f->id);
 					cmd = ACTION_PTR(f);
 					l = f->cmd_len - f->act_ofs;
 					ipfw_dyn_unlock();
@@ -1952,9 +1922,11 @@ do {								\
 
 			case O_PIPE:
 			case O_QUEUE:
-				set_match(args, f, chain);
+				set_match(args, f_pos, chain);
 				args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ?
 					tablearg : cmd->arg1;
+				if (cmd->opcode == O_QUEUE)
+					args->cookie |= 0x80000000;
 				retval = IP_FW_DUMMYNET;
 				l = 0;          /* exit inner loop */
 				done = 1;       /* exit outer loop */
@@ -1987,38 +1959,53 @@ do {								\
 				break;
 
 			case O_COUNT:
-			case O_SKIPTO:
 				f->pcnt++;	/* update stats */
 				f->bcnt += pktlen;
 				f->timestamp = time_uptime;
-				if (cmd->opcode == O_COUNT) {
 					l = 0;		/* exit inner loop */
 					break;
-				}
-				/* skipto: */
-				if (cmd->arg1 == IP_FW_TABLEARG) {
-				    f = lookup_next_rule(f, tablearg);
-				} else { /* direct skipto */
-				    /* update f->next_rule if not set */
-				    if (f->next_rule == NULL)
+
+			case O_SKIPTO:
+			    f->pcnt++;	/* update stats */
+			    f->bcnt += pktlen;
+			    f->timestamp = time_uptime;
+			    /* If possible use cached f_pos (in f->next_rule),
+			     * whose version is written in f->next_rule
+			     * (horrible hacks to avoid changing the ABI).
+			     */
+			    if (cmd->arg1 != IP_FW_TABLEARG &&
+				    (uint32_t)f->x_next == chain->id) {
+				f_pos = (uint32_t)f->next_rule;
+			    } else {
+				int i = (cmd->arg1 == IP_FW_TABLEARG) ?
+					tablearg : cmd->arg1;
+				/* make sure we do not jump backward */
+				if (i <= f->rulenum)
+				    i = f->rulenum + 1;
+				f_pos = ipfw_find_rule(chain, i, 0);
+				/* update the cache */
+				if (cmd->arg1 != IP_FW_TABLEARG) {
 					f->next_rule =
-					    lookup_next_rule(f, cmd->arg1);
-				    f = f->next_rule;
+					(void *)(uintptr_t)f_pos;
+				    f->x_next =
+					(void *)(uintptr_t)chain->id;
+				}
 				}
 				/*
-				 * Skip disabled rules, and
-				 * re-enter the inner loop
-				 * with the correct f, l and cmd.
+			     * Skip disabled rules, and re-enter
+			     * the inner loop with the correct
+			     * f_pos, f, l and cmd.
 				 * Also clear cmdlen and skip_or
 				 */
-				while (f && (V_set_disable & (1 << f->set)))
-					f = f->next;
-				if (f) { /* found a valid rule */
+			    for (; f_pos < chain->n_rules - 1 &&
+				    (V_set_disable &
+				     (1 << chain->map[f_pos]->set));
+				    f_pos++)
+				;
+			    /* prepare to enter the inner loop */
+			    f = chain->map[f_pos];
 					l = f->cmd_len;
 					cmd = f->cmd;
-				} else { /* should not happen */
-					l = 0;  /* exit inner loop */
-				}
 				match = 1;
 				cmdlen = 0;
 				skip_or = 0;
@@ -2083,7 +2070,7 @@ do {								\
 
 			case O_NETGRAPH:
 			case O_NGTEE:
-				set_match(args, f, chain);
+				set_match(args, f_pos, chain);
 				args->cookie = (cmd->arg1 == IP_FW_TABLEARG) ?
 					tablearg : cmd->arg1;
 				retval = (cmd->opcode == O_NETGRAPH) ?
@@ -2108,7 +2095,7 @@ do {								\
 				    struct cfg_nat *t;
 				    int nat_id;
 
-				    set_match(args, f, chain);
+				    set_match(args, f_pos, chain);
 				    t = ((ipfw_insn_nat *)cmd)->nat;
 				    if (t == NULL) {
 					nat_id = (cmd->arg1 == IP_FW_TABLEARG) ?
@@ -2175,7 +2162,7 @@ do {								\
 				    else
 					ip->ip_sum = in_cksum(m, hlen);
 				    retval = IP_FW_REASS;
-				    set_match(args, f, chain);
+				    set_match(args, f_pos, chain);
 				}
 				done = 1;	/* exit outer loop */
 				break;
@@ -2209,10 +2196,11 @@ do {								\
 	}		/* end of outer for, scan rules */
 
 	if (done) {
+		struct ip_fw *rule = chain->map[f_pos];
 		/* Update statistics */
-		f->pcnt++;
-		f->bcnt += pktlen;
-		f->timestamp = time_uptime;
+		rule->pcnt++;
+		rule->bcnt += pktlen;
+		rule->timestamp = time_uptime;
 	} else {
 		retval = IP_FW_DENY;
 		printf("ipfw: ouch!, skip past end of rules, denying packet\n");
@@ -2308,7 +2296,7 @@ static int
 vnet_ipfw_init(const void *unused)
 {
 	int error;
-	struct ip_fw default_rule;
+	struct ip_fw *rule = NULL;
 	struct ip_fw_chain *chain;
 
 	chain = &V_layer3_chain;
@@ -2322,38 +2310,39 @@ vnet_ipfw_init(const void *unused)
 #ifdef IPFIREWALL_VERBOSE_LIMIT
 	V_verbose_limit = IPFIREWALL_VERBOSE_LIMIT;
 #endif
+#ifdef IPFIREWALL_NAT
+	LIST_INIT(&chain->nat);
+#endif
 
+	/* insert the default rule and create the initial map */
+	chain->n_rules = 1;
+	chain->static_len = sizeof(struct ip_fw);
+	chain->map = malloc(sizeof(struct ip_fw *), M_IPFW, M_NOWAIT | M_ZERO);
+	if (chain->map)
+		rule = malloc(chain->static_len, M_IPFW, M_NOWAIT | M_ZERO);
+	if (rule == NULL) {
+		if (chain->map)
+			free(chain->map, M_IPFW);
+		printf("ipfw2: ENOSPC initializing default rule "
+			"(support disabled)\n");
+		return (ENOSPC);
+	}
 	error = ipfw_init_tables(chain);
 	if (error) {
 		panic("init_tables"); /* XXX Marko fix this ! */
 	}
-#ifdef IPFIREWALL_NAT
-	LIST_INIT(&chain->nat);
-#endif
 
+	/* fill and insert the default rule */
+	rule->act_ofs = 0;
+	rule->rulenum = IPFW_DEFAULT_RULE;
+	rule->cmd_len = 1;
+	rule->set = RESVD_SET;
+	rule->cmd[0].len = 1;
+	rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
+	chain->rules = chain->default_rule = chain->map[0] = rule;
+	chain->id = rule->id = 1;
 
-	chain->rules = NULL;
 	IPFW_LOCK_INIT(chain);
-
-	bzero(&default_rule, sizeof default_rule);
-	default_rule.act_ofs = 0;
-	default_rule.rulenum = IPFW_DEFAULT_RULE;
-	default_rule.cmd_len = 1;
-	default_rule.set = RESVD_SET;
-	default_rule.cmd[0].len = 1;
-	default_rule.cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
-	error = ipfw_add_rule(chain, &default_rule);
-
-	if (error != 0) {
-		printf("ipfw2: error %u initializing default rule "
-			"(support disabled)\n", error);
-		IPFW_LOCK_DESTROY(chain);
-		printf("leaving ipfw_iattach (1) with error %d\n", error);
-		return (error);
-	}
-
-	chain->default_rule = chain->rules;
-
 	ipfw_dyn_init();
 
 	/* First set up some values that are compile time options */
@@ -2385,8 +2374,9 @@ vnet_ipfw_init(const void *unused)
 static int
 vnet_ipfw_uninit(const void *unused)
 {
-	struct ip_fw *reap;
+	struct ip_fw *reap, *rule;
 	struct ip_fw_chain *chain = &V_layer3_chain;
+	int i;
 
 	V_ipfw_vnet_ready = 0; /* tell new callers to go away */
 	/*
@@ -2400,19 +2390,26 @@ vnet_ipfw_uninit(const void *unused)
 #endif
 	V_ip_fw_chk_ptr = NULL;
 	V_ip_fw_ctl_ptr = NULL;
+	IPFW_UH_WLOCK(chain);
+	IPFW_UH_WUNLOCK(chain);
+	IPFW_UH_WLOCK(chain);
 
 	IPFW_WLOCK(chain);
-	/* We wait on the wlock here until the last user leaves */
 	IPFW_WUNLOCK(chain);
 	IPFW_WLOCK(chain);
 
 	ipfw_dyn_uninit(0);	/* run the callout_drain */
 	ipfw_flush_tables(chain);
-	chain->reap = NULL;
-	ipfw_free_chain(chain, 1 /* kill default rule */);
-	reap = chain->reap;
-	chain->reap = NULL;
+	reap = NULL;
+	for (i = 0; i < chain->n_rules; i++) {
+		rule = chain->map[i];
+		rule->x_next = reap;
+		reap = rule;
+	}
+	if (chain->map)
+		free(chain->map, M_IPFW);
 	IPFW_WUNLOCK(chain);
+	IPFW_UH_WUNLOCK(chain);
 	if (reap != NULL)
 		ipfw_reap_rules(reap);
 	IPFW_LOCK_DESTROY(chain);

Modified: head/sys/netinet/ipfw/ip_fw_log.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_log.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_fw_log.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -26,9 +26,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define        DEB(x)
-#define        DDB(x) x
-
 /*
  * Logging support for ipfw
  */

Modified: head/sys/netinet/ipfw/ip_fw_pfil.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_pfil.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_fw_pfil.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -125,7 +125,8 @@ ipfw_check_in(void *arg, struct mbuf **m
 	if (ng_tag != NULL) {
 		KASSERT(ng_tag->dir == NG_IPFW_IN,
 		    ("ng_ipfw tag with wrong direction"));
-		args.rule = ng_tag->rule;
+		args.slot = ng_tag->slot;
+		args.rulenum = ng_tag->rulenum;
 		args.rule_id = ng_tag->rule_id;
 		args.chain_id = ng_tag->chain_id;
 		m_tag_delete(*m0, (struct m_tag *)ng_tag);
@@ -137,10 +138,10 @@ again:
 		struct dn_pkt_tag *dt;
 
 		dt = (struct dn_pkt_tag *)(dn_tag+1);
-		args.rule = dt->rule;
+		args.slot = dt->slot;
+		args.rulenum = dt->rulenum;
 		args.rule_id = dt->rule_id;
 		args.chain_id = dt->chain_id;
-
 		m_tag_delete(*m0, dn_tag);
 	}
 
@@ -148,7 +149,7 @@ again:
 	args.inp = inp;
 	tee = 0;
 
-	if (V_fw_one_pass == 0 || args.rule == NULL) {
+	if (V_fw_one_pass == 0 || args.slot == 0) {
 		ipfw = ipfw_chk(&args);
 		*m0 = args.m;
 	} else
@@ -201,7 +202,7 @@ again:
 			*m0 = NULL;
 			return 0;	/* packet consumed */
 		} else {
-			args.rule = NULL;
+			args.slot = 0;
 			goto again;	/* continue with packet */
 		}
 
@@ -258,7 +259,8 @@ ipfw_check_out(void *arg, struct mbuf **
 	if (ng_tag != NULL) {
 		KASSERT(ng_tag->dir == NG_IPFW_OUT,
 		    ("ng_ipfw tag with wrong direction"));
-		args.rule = ng_tag->rule;
+		args.slot = ng_tag->slot;
+		args.rulenum = ng_tag->rulenum;
 		args.rule_id = ng_tag->rule_id;
 		args.chain_id = ng_tag->chain_id;
 		m_tag_delete(*m0, (struct m_tag *)ng_tag);
@@ -270,10 +272,10 @@ again:
 		struct dn_pkt_tag *dt;
 
 		dt = (struct dn_pkt_tag *)(dn_tag+1);
-		args.rule = dt->rule;
+		args.slot = dt->slot;
+		args.rulenum = dt->rulenum;
 		args.rule_id = dt->rule_id;
 		args.chain_id = dt->chain_id;
-
 		m_tag_delete(*m0, dn_tag);
 	}
 
@@ -282,7 +284,7 @@ again:
 	args.inp = inp;
 	tee = 0;
 
-	if (V_fw_one_pass == 0 || args.rule == NULL) {
+	if (V_fw_one_pass == 0 || args.slot == 0) {
 		ipfw = ipfw_chk(&args);
 		*m0 = args.m;
 	} else
@@ -341,7 +343,7 @@ again:
 			*m0 = NULL;
 			return 0;	/* packet consumed */
 		} else {
-			args.rule = NULL;
+			args.slot = 0;
 			goto again;	/* continue with packet */
 		}
 

Modified: head/sys/netinet/ipfw/ip_fw_private.h
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_private.h	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_fw_private.h	Tue Dec 22 19:01:47 2009	(r200855)
@@ -79,7 +79,12 @@ struct ip_fw_args {
 	struct ifnet	*oif;		/* output interface		*/
 	struct sockaddr_in *next_hop;	/* forward address		*/
 
-	struct ip_fw	*rule;		/* matching rule		*/
+	/* chain_id validates 'slot', the location of the pointer to
+	 * a matching rule.
+	 * If invalid, we can lookup the rule using rule_id and rulenum
+	 */
+	uint32_t	slot;		/* slot for matching rule	*/
+	uint32_t	rulenum;	/* matching rule number		*/
 	uint32_t	rule_id;	/* matching rule id		*/
 	uint32_t	chain_id;	/* ruleset id			*/
 
@@ -178,9 +183,11 @@ struct ip_fw_chain {
 	struct ip_fw	*default_rule;
 	int		n_rules;	/* number of static rules */
 	int		static_len;	/* total len of static rules */
+	struct ip_fw    **map;	/* array of rule ptrs to ease lookup */
 	LIST_HEAD(nat_list, cfg_nat) nat;       /* list of nat entries */
 	struct radix_node_head *tables[IPFW_TABLES_MAX];
 	struct rwlock	rwmtx;
+	struct rwlock	uh_lock;	/* lock for upper half */
 	uint32_t	id;		/* ruleset id */
 };
 
@@ -191,9 +198,16 @@ struct sockopt;	/* used by tcp_var.h */
  * so the variable and the macros must be here.
  */
 
-#define	IPFW_LOCK_INIT(_chain) \
-	rw_init(&(_chain)->rwmtx, "IPFW static rules")
-#define	IPFW_LOCK_DESTROY(_chain)	rw_destroy(&(_chain)->rwmtx)
+#define	IPFW_LOCK_INIT(_chain) do {			\
+	rw_init(&(_chain)->rwmtx, "IPFW static rules");	\
+	rw_init(&(_chain)->uh_lock, "IPFW UH lock");	\
+	} while (0)
+
+#define	IPFW_LOCK_DESTROY(_chain) do {			\
+	rw_destroy(&(_chain)->rwmtx);			\
+	rw_destroy(&(_chain)->uh_lock);			\
+	} while (0)
+
 #define	IPFW_WLOCK_ASSERT(_chain)	rw_assert(&(_chain)->rwmtx, RA_WLOCKED)
 
 #define IPFW_RLOCK(p) rw_rlock(&(p)->rwmtx)
@@ -201,12 +215,17 @@ struct sockopt;	/* used by tcp_var.h */
 #define IPFW_WLOCK(p) rw_wlock(&(p)->rwmtx)
 #define IPFW_WUNLOCK(p) rw_wunlock(&(p)->rwmtx)
 
+#define IPFW_UH_RLOCK(p) rw_rlock(&(p)->uh_lock)
+#define IPFW_UH_RUNLOCK(p) rw_runlock(&(p)->uh_lock)
+#define IPFW_UH_WLOCK(p) rw_wlock(&(p)->uh_lock)
+#define IPFW_UH_WUNLOCK(p) rw_wunlock(&(p)->uh_lock)
+
 /* In ip_fw_sockopt.c */
+int ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id);
 int ipfw_add_rule(struct ip_fw_chain *chain, struct ip_fw *input_rule);
 int ipfw_ctl(struct sockopt *sopt);
 int ipfw_chk(struct ip_fw_args *args);
 void ipfw_reap_rules(struct ip_fw *head);
-void ipfw_free_chain(struct ip_fw_chain *chain, int kill_default);
 
 /* In ip_fw_table.c */
 struct radix_node;

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_sockopt.c	Tue Dec 22 19:00:18 2009	(r200854)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Tue Dec 22 19:01:47 2009	(r200855)
@@ -1,5 +1,7 @@
 /*-
- * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
+ * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa
+ *
+ * Supported by: Valeria Paoli
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,9 +28,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#define        DEB(x)
-#define        DDB(x) x
-
 /*
  * Sockopt support for ipfw. The routines here implement
  * the upper half of the ipfw code.
@@ -81,136 +80,143 @@ MALLOC_DEFINE(M_IPFW, "IpFw/IpAcct", "Ip
  */
 
 /*
- * When a rule is added/deleted, clear the next_rule pointers in all rules.
- * These will be reconstructed on the fly as packets are matched.
+ * Find the smallest rule >= key, id.
+ * We could use bsearch but it is so simple that we code it directly
  */
-static void
-flush_rule_ptrs(struct ip_fw_chain *chain)
+int
+ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id)
 {
-	struct ip_fw *rule;
+	int i, lo, hi;
+	struct ip_fw *r;
 
-	IPFW_WLOCK_ASSERT(chain);
+  	for (lo = 0, hi = chain->n_rules - 1; lo < hi;) {
+		i = (lo + hi) / 2;
+		r = chain->map[i];
+		if (r->rulenum < key)
+			lo = i + 1;	/* continue from the next one */
+		else if (r->rulenum > key)
+			hi = i;		/* this might be good */
+		else if (r->id < id)
+			lo = i + 1;	/* continue from the next one */
+		else /* r->id >= id */
+			hi = i;		/* this might be good */
+	};
+	return hi;
+}
 
-	chain->id++;
+/*
+ * allocate a new map, returns the chain locked. extra is the number
+ * of entries to add or delete.
+ */
+static struct ip_fw **
+get_map(struct ip_fw_chain *chain, int extra, int locked)
+{
+
+	for (;;) {
+		struct ip_fw **map;
+		int i;
+
+		i = chain->n_rules + extra;
+		map = malloc(i * sizeof(struct ip_fw *), M_IPFW, M_WAITOK);
+		if (map == NULL) {
+			printf("%s: cannot allocate map\n", __FUNCTION__);
+			return NULL;
+		}
+		if (!locked)
+			IPFW_UH_WLOCK(chain);
+		if (i >= chain->n_rules + extra) /* good */
+			return map;
+		/* otherwise we lost the race, free and retry */
+		if (!locked)
+			IPFW_UH_WUNLOCK(chain);
+		free(map, M_IPFW);
+	}
+}
+
+/*
+ * swap the maps. It is supposed to be called with IPFW_UH_WLOCK
+ */
+static struct ip_fw **
+swap_map(struct ip_fw_chain *chain, struct ip_fw **new_map, int new_len)
+{
+	struct ip_fw **old_map;
 
-	for (rule = chain->rules; rule; rule = rule->next)
-		rule->next_rule = NULL;
+	IPFW_WLOCK(chain);
+	chain->id++;
+	chain->n_rules = new_len;
+	old_map = chain->map;
+	chain->map = new_map;
+	IPFW_WUNLOCK(chain);
+	return old_map;
 }
 
 /*
  * Add a new rule to the list. Copy the rule into a malloc'ed area, then
  * possibly create a rule number and add the rule to the list.
  * Update the rule_number in the input struct so the caller knows it as well.
+ * XXX DO NOT USE FOR THE DEFAULT RULE.
+ * Must be called without IPFW_UH held
  */
 int
 ipfw_add_rule(struct ip_fw_chain *chain, struct ip_fw *input_rule)
 {
-	struct ip_fw *rule, *f, *prev;
-	int l = RULESIZE(input_rule);
+	struct ip_fw *rule;
+	int i, l, insert_before;
+	struct ip_fw **map;	/* the new array of pointers */
 
-	if (chain->rules == NULL && input_rule->rulenum != IPFW_DEFAULT_RULE)
+	if (chain->rules == NULL || input_rule->rulenum > IPFW_DEFAULT_RULE-1)
 		return (EINVAL);
 
-	rule = malloc(l, M_IPFW, M_NOWAIT | M_ZERO);
+	l = RULESIZE(input_rule);
+	rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO);
 	if (rule == NULL)
 		return (ENOSPC);
+	/* get_map returns with IPFW_UH_WLOCK if successful */
+	map = get_map(chain, 1, 0 /* not locked */);
+	if (map == NULL) {
+		free(rule, M_IPFW);
+		return ENOSPC;
+	}
 
 	bcopy(input_rule, rule, l);
-
-	rule->next = NULL;
+	/* clear fields not settable from userland */
+	rule->x_next = NULL;
 	rule->next_rule = NULL;
-
 	rule->pcnt = 0;
 	rule->bcnt = 0;
 	rule->timestamp = 0;
 
-	IPFW_WLOCK(chain);
-
-	if (chain->rules == NULL) {	/* default rule */
-		chain->rules = rule;
-		rule->id = ++chain->id;
-		goto done;
-        }
-
-	/*
-	 * If rulenum is 0, find highest numbered rule before the
-	 * default rule, and add autoinc_step
-	 */
 	if (V_autoinc_step < 1)
 		V_autoinc_step = 1;
 	else if (V_autoinc_step > 1000)
 		V_autoinc_step = 1000;
+	/* find the insertion point, we will insert before */
+	insert_before = rule->rulenum ? rule->rulenum + 1 : IPFW_DEFAULT_RULE;
+	i = ipfw_find_rule(chain, insert_before, 0);
+	/* duplicate first part */
+	if (i > 0)
+		bcopy(chain->map, map, i * sizeof(struct ip_fw *));
+	map[i] = rule;
+	/* duplicate remaining part, we always have the default rule */
+	bcopy(chain->map + i, map + i + 1,
+		sizeof(struct ip_fw *) *(chain->n_rules - i));
 	if (rule->rulenum == 0) {
-		/*
-		 * locate the highest numbered rule before default
-		 */
-		for (f = chain->rules; f; f = f->next) {
-			if (f->rulenum == IPFW_DEFAULT_RULE)
-				break;
-			rule->rulenum = f->rulenum;
-		}
+		/* write back the number */
+		rule->rulenum = i > 0 ? map[i-1]->rulenum : 0;
 		if (rule->rulenum < IPFW_DEFAULT_RULE - V_autoinc_step)
 			rule->rulenum += V_autoinc_step;
 		input_rule->rulenum = rule->rulenum;
 	}
 
-	/*
-	 * Now insert the new rule in the right place in the sorted list.
-	 */
-	for (prev = NULL, f = chain->rules; f; prev = f, f = f->next) {
-		if (f->rulenum > rule->rulenum) { /* found the location */
-			if (prev) {
-				rule->next = f;
-				prev->next = rule;
-			} else { /* head insert */
-				rule->next = chain->rules;
-				chain->rules = rule;
-			}
-			break;
-		}
-	}
-	flush_rule_ptrs(chain);
-	/* chain->id incremented inside flush_rule_ptrs() */
-	rule->id = chain->id;
-done:
-	chain->n_rules++;
+	rule->id = chain->id + 1;
+	map = swap_map(chain, map, chain->n_rules + 1);
 	chain->static_len += l;
-	IPFW_WUNLOCK(chain);
+	IPFW_UH_WUNLOCK(chain);
+	if (map)
+		free(map, M_IPFW);
 	return (0);
 }
 
-/**
- * Remove a static rule (including derived * dynamic rules)
- * and place it on the ``reap list'' for later reclamation.
- * The caller is in charge of clearing rule pointers to avoid
- * dangling pointers.
- * @return a pointer to the next entry.
- * Arguments are not checked, so they better be correct.
- */
-static struct ip_fw *
-remove_rule(struct ip_fw_chain *chain, struct ip_fw *rule,
-    struct ip_fw *prev)
-{
-	struct ip_fw *n;
-	int l = RULESIZE(rule);
-
-	IPFW_WLOCK_ASSERT(chain);
-
-	n = rule->next;
-	ipfw_remove_dyn_children(rule);
-	if (prev == NULL)
-		chain->rules = n;
-	else
-		prev->next = n;
-	chain->n_rules--;
-	chain->static_len -= l;
-
-	rule->next = chain->reap;
-	chain->reap = rule;
-
-	return n;
-}
-
 /*
  * Reclaim storage associated with a list of rules.  This is
  * typically the list created using remove_rule.
@@ -222,34 +228,11 @@ ipfw_reap_rules(struct ip_fw *head)
 	struct ip_fw *rule;
 
 	while ((rule = head) != NULL) {
-		head = head->next;
+		head = head->x_next;
 		free(rule, M_IPFW);
 	}
 }
 
-/*
- * Remove all rules from a chain (except rules in set RESVD_SET

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 19:05:08 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B8FB106568B;
	Tue, 22 Dec 2009 19:05:08 +0000 (UTC)
	(envelope-from rdivacky@vlk.vlakno.cz)
Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190])
	by mx1.freebsd.org (Postfix) with ESMTP id BF8F28FC0A;
	Tue, 22 Dec 2009 19:05:06 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id 417C69CB091;
	Tue, 22 Dec 2009 20:02:50 +0100 (CET)
X-Virus-Scanned: amavisd-new at vlakno.cz
Received: from vlakno.cz ([127.0.0.1])
	by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id f7kOjpnQatTP; Tue, 22 Dec 2009 20:02:44 +0100 (CET)
Received: from vlk.vlakno.cz (localhost [127.0.0.1])
	by vlakno.cz (Postfix) with ESMTP id 7E7E29CB0DB;
	Tue, 22 Dec 2009 20:02:44 +0100 (CET)
Received: (from rdivacky@localhost)
	by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id nBMJ2isJ057003;
	Tue, 22 Dec 2009 20:02:44 +0100 (CET) (envelope-from rdivacky)
Date: Tue, 22 Dec 2009 20:02:44 +0100
From: Roman Divacky 
To: Erik Cederstrand 
Message-ID: <20091222190244.GA56837@freebsd.org>
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>
	<200912211459.21766.jhb@freebsd.org>
	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<20091222141810.GA17221@freebsd.org>
	
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: 
User-Agent: Mutt/1.4.2.3i
Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org,
	marius@alchemy.franken.de, svn-src-head@FreeBSD.org,
	"M. Warner Losh" 
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 19:05:08 -0000

On Tue, Dec 22, 2009 at 04:49:48PM +0100, Erik Cederstrand wrote:
> Den 22/12/2009 kl. 15.18 skrev Roman Divacky:
> 
> > well... llvm provides its own assembler so if the need for newer binutils
> > comes from need of newer as I believe llvm can help here. or is the linker
> > the problem?
> 
> It does? I was under the impression that this was still very much a WIP (http://llvm.org/releases/2.6/docs/ReleaseNotes.html#mc) and that LLVM still uses the system assembler and linker.

yes, it's a WIP. what I meant was that there's not so much pressure to import
newer "as" as we might be getting that from llvm anyway in the time frame...

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 19:32:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84F66106568F;
	Tue, 22 Dec 2009 19:32:16 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6A8A88FC2E;
	Tue, 22 Dec 2009 19:32:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMJWGY7073387;
	Tue, 22 Dec 2009 19:32:16 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJWGU0073384;
	Tue, 22 Dec 2009 19:32:16 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912221932.nBMJWGU0073384@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 19:32:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200856 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 19:32:16 -0000

Author: yongari
Date: Tue Dec 22 19:32:16 2009
New Revision: 200856
URL: http://svn.freebsd.org/changeset/base/200856

Log:
  Introduce sc_flags member variable and use it to keep track of
  link state and PHY related information.
  Remove ste_link and ste_one_phy variable of softc as it's not used
  anymore.
  While I'm here add IFF_DRV_RUNNING check in ste_start_locked().

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 19:01:47 2009	(r200855)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 19:32:16 2009	(r200856)
@@ -369,7 +369,7 @@ ste_miibus_readreg(device_t dev, int phy
 
 	sc = device_get_softc(dev);
 
-	if ( sc->ste_one_phy && phy != 0 )
+	if ((sc->ste_flags & STE_FLAG_ONE_PHY) != 0 && phy != 0)
 		return (0);
 
 	bzero((char *)&frame, sizeof(frame));
@@ -438,7 +438,7 @@ ste_ifmedia_upd_locked(struct ifnet *ifp
 	sc = ifp->if_softc;
 	STE_LOCK_ASSERT(sc);
 	mii = device_get_softc(sc->ste_miibus);
-	sc->ste_link = 0;
+	sc->ste_flags &= ~STE_FLAG_LINK;
 	if (mii->mii_instance) {
 		struct mii_softc	*miisc;
 		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
@@ -871,11 +871,11 @@ ste_stats_update(void *xsc)
 	    + CSR_READ_1(sc, STE_MULTI_COLLS)
 	    + CSR_READ_1(sc, STE_SINGLE_COLLS);
 
-	if (!sc->ste_link) {
+	if ((sc->ste_flags & STE_FLAG_LINK) ==0) {
 		mii_pollstat(mii);
 		if (mii->mii_media_status & IFM_ACTIVE &&
 		    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
-			sc->ste_link++;
+			sc->ste_flags |= STE_FLAG_LINK;
 			/*
 			* we don't get a call-back on re-init so do it
 			* otherwise we get stuck in the wrong link state
@@ -938,7 +938,7 @@ ste_attach(device_t dev)
 	if (pci_get_vendor(dev) == DL_VENDORID &&
 	    pci_get_device(dev) == DL_DEVICEID_DL10050 &&
 	    pci_get_revid(dev) == 0x12 )
-		sc->ste_one_phy = 1;
+		sc->ste_flags |= STE_FLAG_ONE_PHY;
 
 	mtx_init(&sc->ste_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 	    MTX_DEF);
@@ -1631,7 +1631,7 @@ ste_stop(struct ste_softc *sc)
 	 */
 	ste_reset(sc);
 
-	sc->ste_link = 0;
+	sc->ste_flags &= ~STE_FLAG_LINK;
 
 	for (i = 0; i < STE_RX_LIST_CNT; i++) {
 		cur_rx = &sc->ste_cdata.ste_rx_chain[i];
@@ -1850,10 +1850,8 @@ ste_start_locked(struct ifnet *ifp)
 	sc = ifp->if_softc;
 	STE_LOCK_ASSERT(sc);
 
-	if (!sc->ste_link)
-		return;
-
-	if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
+	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) !=
+	    IFF_DRV_RUNNING || (sc->ste_flags & STE_FLAG_LINK) == 0)
 		return;
 
 	for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd);) {

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Tue Dec 22 19:01:47 2009	(r200855)
+++ head/sys/dev/ste/if_stereg.h	Tue Dec 22 19:32:16 2009	(r200856)
@@ -554,14 +554,15 @@ struct ste_softc {
 	device_t		ste_miibus;
 	device_t		ste_dev;
 	int			ste_tx_thresh;
-	uint8_t			ste_link;
+	int			ste_flags;
+#define	STE_FLAG_ONE_PHY	0x0001
+#define	STE_FLAG_LINK		0x8000
 	int			ste_if_flags;
 	int			ste_timer;
 	struct ste_list_data	ste_ldata;
 	struct ste_chain_data	ste_cdata;
 	struct callout		ste_stat_callout;
 	struct mtx		ste_mtx;
-	uint8_t			ste_one_phy;
 };
 
 #define	STE_LOCK(_sc)		mtx_lock(&(_sc)->ste_mtx)

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 19:48:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CEB05106568B;
	Tue, 22 Dec 2009 19:48:06 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BDABC8FC18;
	Tue, 22 Dec 2009 19:48:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMJm6LH073766;
	Tue, 22 Dec 2009 19:48:06 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMJm6am073763;
	Tue, 22 Dec 2009 19:48:06 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912221948.nBMJm6am073763@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 22 Dec 2009 19:48:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200857 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 19:48:07 -0000

Author: mav
Date: Tue Dec 22 19:48:06 2009
New Revision: 200857
URL: http://svn.freebsd.org/changeset/base/200857

Log:
  Add support for Intel SCH PATA controller.
  
  PR:		kern/140251

Modified:
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/chipsets/ata-intel.c

Modified: head/sys/dev/ata/ata-pci.h
==============================================================================
--- head/sys/dev/ata/ata-pci.h	Tue Dec 22 19:32:16 2009	(r200856)
+++ head/sys/dev/ata/ata-pci.h	Tue Dec 22 19:48:06 2009	(r200857)
@@ -204,6 +204,7 @@ struct ata_pci_controller {
 #define ATA_I82801JI_R1         0x3a258086
 #define ATA_I82801JI_S2         0x3a268086
 #define ATA_I31244              0x32008086
+#define ATA_ISCH                0x811a8086
 
 #define ATA_ITE_ID              0x1283
 #define ATA_IT8211F             0x82111283

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-intel.c	Tue Dec 22 19:32:16 2009	(r200856)
+++ head/sys/dev/ata/chipsets/ata-intel.c	Tue Dec 22 19:48:06 2009	(r200857)
@@ -57,6 +57,7 @@ static int ata_intel_ch_attach(device_t 
 static void ata_intel_reset(device_t dev);
 static int ata_intel_old_setmode(device_t dev, int target, int mode);
 static int ata_intel_new_setmode(device_t dev, int target, int mode);
+static int ata_intel_sch_setmode(device_t dev, int target, int mode);
 static int ata_intel_sata_getrev(device_t dev, int target);
 static int ata_intel_31244_ch_attach(device_t dev);
 static int ata_intel_31244_ch_detach(device_t dev);
@@ -140,6 +141,7 @@ ata_intel_probe(device_t dev)
      { ATA_I82801JI_R1,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
      { ATA_I82801JI_S2,  0, INTEL_AHCI, 0, ATA_SA300, "ICH10" },
      { ATA_I31244,       0,          0, 2, ATA_SA150, "31244" },
+     { ATA_ISCH,         0,          0, 1, ATA_UDMA5, "SCH" },
      { 0, 0, 0, 0, 0, 0}};
 
     if (pci_get_vendor(dev) != ATA_INTEL_ID)
@@ -183,7 +185,13 @@ ata_intel_chipinit(device_t dev)
 	ctlr->setmode = ata_sata_setmode;
 	ctlr->getrev = ata_sata_getrev;
     }
-
+    /* SCH */
+    else if (ctlr->chip->chipid == ATA_ISCH) {
+	ctlr->channels = 1;
+	ctlr->ch_attach = ata_intel_ch_attach;
+	ctlr->ch_detach = ata_pci_ch_detach;
+	ctlr->setmode = ata_intel_sch_setmode;
+    }
     /* non SATA intel chips goes here */
     else if (ctlr->chip->max_dma < ATA_SA150) {
 	ctlr->channels = ctlr->chip->cfg2;
@@ -245,7 +253,7 @@ ata_intel_ch_attach(device_t dev)
 		(pci_read_config(device_get_parent(dev), 0x90, 1) & 0x04) == 0)
 		    ch->flags |= ATA_NO_SLAVE;
 	    ch->flags |= ATA_SATA;
-    } else
+    } else if (ctlr->chip->chipid != ATA_ISCH)
 	    ch->flags |= ATA_CHECKS_CABLE;
     return 0;
 }
@@ -360,6 +368,35 @@ ata_intel_new_setmode(device_t dev, int 
 }
 
 static int
+ata_intel_sch_setmode(device_t dev, int target, int mode)
+{
+	device_t parent = device_get_parent(dev);
+	struct ata_pci_controller *ctlr = device_get_softc(parent);
+	u_int8_t dtim = 0x80 + (target << 2);
+	u_int32_t tim = pci_read_config(parent, dtim, 4);
+	int piomode;
+
+	mode = min(mode, ctlr->chip->max_dma);
+	if (mode >= ATA_UDMA0) {
+		tim |= (0x1 << 31);
+		tim &= ~(0x7 << 16);
+		tim |= ((mode & ATA_MODE_MASK) << 16);
+		piomode = ATA_PIO4;
+	} else if (mode >= ATA_WDMA0) {
+		tim &= ~(0x1 << 31);
+		tim &= ~(0x3 << 8);
+		tim |= ((mode & ATA_MODE_MASK) << 8);
+		piomode = (mode == ATA_WDMA0) ? ATA_PIO0 :
+		    (mode == ATA_WDMA1) ? ATA_PIO3 : ATA_PIO4;
+	} else
+		piomode = mode;
+	tim &= ~(0x7);
+	tim |= (piomode & 0x7);
+	pci_write_config(parent, dtim, tim, 4);
+	return (mode);
+}
+
+static int
 ata_intel_sata_getrev(device_t dev, int target)
 {
 	struct ata_channel *ch = device_get_softc(dev);

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:11:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93FC61065670;
	Tue, 22 Dec 2009 20:11:56 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 82DF38FC24;
	Tue, 22 Dec 2009 20:11:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMKBun8074895;
	Tue, 22 Dec 2009 20:11:56 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKBuXg074892;
	Tue, 22 Dec 2009 20:11:56 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912222011.nBMKBuXg074892@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 20:11:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200865 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:11:56 -0000

Author: yongari
Date: Tue Dec 22 20:11:56 2009
New Revision: 200865
URL: http://svn.freebsd.org/changeset/base/200865

Log:
  Reimplement miibus_statchg method. Don't rely on link state change
  interrupt. If we want to use link state change interrupt ste(4)
  should also implement auto-negotiation complete handler as well as
  various PHY access handling. Now link state change is handled by
  mii(4) polling so it will automatically update link state UP/DOWN
  events which in turn make ste(4) usable with lagg(4).
  
  r199559 added a private timer to drive watchdog and the timer also
  used to drive MAC statistics update. Because the MAC statistics
  update is called whenever statistics counter reaches near-full, it
  drove watchdog timer too fast such that it caused false watchdog
  timeouts under heavy TX traffic conditions.
  Fix the regression by separating ste_stats_update() from driving
  watchdog timer and introduce a new function ste_tick() that handles
  periodic job such as driving watchdog, MAC statistics update and
  link state check etc.
  While I'm here clear armed watchdog timer in ste_stop().

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 20:05:09 2009	(r200864)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 20:11:56 2009	(r200865)
@@ -124,8 +124,9 @@ static int	ste_rxeof(struct ste_softc *,
 static void	ste_setmulti(struct ste_softc *);
 static void	ste_start(struct ifnet *);
 static void	ste_start_locked(struct ifnet *);
-static void	ste_stats_update(void *);
+static void	ste_stats_update(struct ste_softc *);
 static void	ste_stop(struct ste_softc *);
+static void	ste_tick(void *);
 static void	ste_txeoc(struct ste_softc *);
 static void	ste_txeof(struct ste_softc *);
 static void	ste_wait(struct ste_softc *);
@@ -404,15 +405,49 @@ ste_miibus_statchg(device_t dev)
 {
 	struct ste_softc *sc;
 	struct mii_data *mii;
+	struct ifnet *ifp;
+	uint16_t cfg;
 
 	sc = device_get_softc(dev);
 
 	mii = device_get_softc(sc->ste_miibus);
+	ifp = sc->ste_ifp;
+	if (mii == NULL || ifp == NULL ||
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+		return;
 
-	if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) {
-		STE_SETBIT2(sc, STE_MACCTL0, STE_MACCTL0_FULLDUPLEX);
-	} else {
-		STE_CLRBIT2(sc, STE_MACCTL0, STE_MACCTL0_FULLDUPLEX);
+	sc->ste_flags &= ~STE_FLAG_LINK;
+	if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+	    (IFM_ACTIVE | IFM_AVALID)) {
+		switch (IFM_SUBTYPE(mii->mii_media_active)) {
+		case IFM_10_T:
+		case IFM_100_TX:
+		case IFM_100_FX:
+		case IFM_100_T4:
+			sc->ste_flags |= STE_FLAG_LINK;
+		default:
+			break;
+		}
+	}
+
+	/* Program MACs with resolved speed/duplex/flow-control. */
+	if ((sc->ste_flags & STE_FLAG_LINK) != 0) {
+		cfg = CSR_READ_2(sc, STE_MACCTL0);
+		cfg &= ~(STE_MACCTL0_FLOWCTL_ENABLE | STE_MACCTL0_FULLDUPLEX);
+		if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
+			/*
+			 * ST201 data sheet says driver should enable receiving
+			 * MAC control frames bit of receive mode register to
+			 * receive flow-control frames but the register has no
+			 * such bits. In addition the controller has no ability
+			 * to send pause frames so it should be handled in
+			 * driver. Implementing pause timer handling in driver
+			 * layer is not trivial, so don't enable flow-control
+			 * here.
+			 */
+			cfg |= STE_MACCTL0_FULLDUPLEX;
+		}
+		CSR_WRITE_2(sc, STE_MACCTL0, cfg);
 	}
 }
 
@@ -613,13 +648,8 @@ ste_poll_locked(struct ifnet *ifp, enum 
 		if (status & STE_ISR_TX_DONE)
 			ste_txeoc(sc);
 
-		if (status & STE_ISR_STATS_OFLOW) {
-			callout_stop(&sc->ste_stat_callout);
+		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
-		}
-
-		if (status & STE_ISR_LINKEVENT)
-			mii_pollstat(device_get_softc(sc->ste_miibus));
 
 		if (status & STE_ISR_HOSTERR) {
 			ste_reset(sc);
@@ -669,14 +699,8 @@ ste_intr(void *xsc)
 		if (status & STE_ISR_TX_DONE)
 			ste_txeoc(sc);
 
-		if (status & STE_ISR_STATS_OFLOW) {
-			callout_stop(&sc->ste_stat_callout);
+		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
-		}
-
-		if (status & STE_ISR_LINKEVENT)
-			mii_pollstat(device_get_softc(sc->ste_miibus));
-
 
 		if (status & STE_ISR_HOSTERR) {
 			ste_reset(sc);
@@ -813,6 +837,30 @@ ste_txeoc(struct ste_softc *sc)
 }
 
 static void
+ste_tick(void *arg)
+{
+	struct ste_softc *sc;
+	struct mii_data *mii;
+
+	sc = (struct ste_softc *)arg;
+
+	STE_LOCK_ASSERT(sc);
+
+	mii = device_get_softc(sc->ste_miibus);
+	mii_tick(mii);
+	/*
+	 * ukphy(4) does not seem to generate CB that reports
+	 * resolved link state so if we know we lost a link,
+	 * explicitly check the link state.
+	 */
+	if ((sc->ste_flags & STE_FLAG_LINK) == 0)
+		ste_miibus_statchg(sc->ste_dev);
+	ste_stats_update(sc);
+	ste_watchdog(sc);
+	callout_reset(&sc->ste_callout, hz, ste_tick, sc);
+}
+
+static void
 ste_txeof(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
@@ -855,43 +903,18 @@ ste_txeof(struct ste_softc *sc)
 }
 
 static void
-ste_stats_update(void *xsc)
+ste_stats_update(struct ste_softc *sc)
 {
-	struct ste_softc *sc;
 	struct ifnet *ifp;
-	struct mii_data *mii;
 
-	sc = xsc;
 	STE_LOCK_ASSERT(sc);
 
 	ifp = sc->ste_ifp;
-	mii = device_get_softc(sc->ste_miibus);
-
 	ifp->if_collisions += CSR_READ_1(sc, STE_LATE_COLLS)
 	    + CSR_READ_1(sc, STE_MULTI_COLLS)
 	    + CSR_READ_1(sc, STE_SINGLE_COLLS);
-
-	if ((sc->ste_flags & STE_FLAG_LINK) ==0) {
-		mii_pollstat(mii);
-		if (mii->mii_media_status & IFM_ACTIVE &&
-		    IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
-			sc->ste_flags |= STE_FLAG_LINK;
-			/*
-			* we don't get a call-back on re-init so do it
-			* otherwise we get stuck in the wrong link state
-			*/
-			ste_miibus_statchg(sc->ste_dev);
-			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-				ste_start_locked(ifp);
-		}
-	}
-
-	if (sc->ste_timer > 0 && --sc->ste_timer == 0)
-		ste_watchdog(sc);
-	callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
 }
 
-
 /*
  * Probe for a Sundance ST201 chip. Check the PCI vendor and device
  * IDs against our list and return a device name if we find a match.
@@ -970,7 +993,7 @@ ste_attach(device_t dev)
 		goto fail;
 	}
 
-	callout_init_mtx(&sc->ste_stat_callout, &sc->ste_mtx, 0);
+	callout_init_mtx(&sc->ste_callout, &sc->ste_mtx, 0);
 
 	/* Reset the adapter. */
 	ste_reset(sc);
@@ -1076,7 +1099,7 @@ ste_detach(device_t dev)
 		STE_LOCK(sc);
 		ste_stop(sc);
 		STE_UNLOCK(sc);
-		callout_drain(&sc->ste_stat_callout);
+		callout_drain(&sc->ste_callout);
 	}
 	if (sc->ste_miibus)
 		device_delete_child(dev, sc->ste_miibus);
@@ -1601,7 +1624,7 @@ ste_init_locked(struct ste_softc *sc)
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
-	callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
+	callout_reset(&sc->ste_callout, hz, ste_tick, sc);
 }
 
 static void
@@ -1615,7 +1638,8 @@ ste_stop(struct ste_softc *sc)
 	STE_LOCK_ASSERT(sc);
 	ifp = sc->ste_ifp;
 
-	callout_stop(&sc->ste_stat_callout);
+	callout_stop(&sc->ste_callout);
+	sc->ste_timer = 0;
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING|IFF_DRV_OACTIVE);
 
 	CSR_WRITE_2(sc, STE_IMR, 0);
@@ -1914,6 +1938,9 @@ ste_watchdog(struct ste_softc *sc)
 	ifp = sc->ste_ifp;
 	STE_LOCK_ASSERT(sc);
 
+	if (sc->ste_timer == 0 || --sc->ste_timer)
+		return;
+
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
 

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Tue Dec 22 20:05:09 2009	(r200864)
+++ head/sys/dev/ste/if_stereg.h	Tue Dec 22 20:11:56 2009	(r200865)
@@ -276,10 +276,9 @@
 #define STE_IMR_TX_DMADONE		0x0200
 #define STE_IMR_RX_DMADONE		0x0400
 
-#define STE_INTRS					\
+#define STE_INTRS				\
 	(STE_IMR_RX_DMADONE|STE_IMR_TX_DMADONE|	\
-	STE_IMR_TX_DONE|STE_IMR_HOSTERR| \
-        STE_IMR_LINKEVENT)
+	STE_IMR_TX_DONE|STE_IMR_HOSTERR)
 
 #define STE_ISR_INTLATCH		0x0001
 #define STE_ISR_HOSTERR			0x0002
@@ -561,7 +560,7 @@ struct ste_softc {
 	int			ste_timer;
 	struct ste_list_data	ste_ldata;
 	struct ste_chain_data	ste_cdata;
-	struct callout		ste_stat_callout;
+	struct callout		ste_callout;
 	struct mtx		ste_mtx;
 };
 

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:19:23 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3D81110656B5
	for ; Tue, 22 Dec 2009 20:19:23 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id D92518FC20
	for ; Tue, 22 Dec 2009 20:19:22 +0000 (UTC)
Received: (qmail 14106 invoked by uid 399); 22 Dec 2009 20:19:22 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 22 Dec 2009 20:19:22 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4B3129CD.20908@FreeBSD.org>
Date: Tue, 22 Dec 2009 12:19:25 -0800
From: Doug Barton 
Organization: http://SupersetSolutions.com/
User-Agent: Thunderbird 2.0.0.23 (X11/20091206)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>	<200912211459.21766.jhb@freebsd.org>	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
In-Reply-To: <20091221.211648.632868945383134253.imp@bsdimp.com>
X-Enigmail-Version: 0.96.0
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, jhb@FreeBSD.org, marius@alchemy.franken.de
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:19:23 -0000

M. Warner Losh wrote:
> We really need newer binutils in the tree.
> 
> And we need a way to compiler gplv3 binutils into the system for folks
> that can do that without consequences...  But many modern processors
> need to have the gplv3 version of binutils and that will be a
> continuing problem.  One advantage of FreeBSD is its integration,
> rather than having to play version whack-a-mole like you do with
> embedded Linux.

When "we" last had the gplv3 discussion there were two lines of
thought that were proposed. One is "import llvm/clang" and the other
was "improve the infrastructure to support toolchains from ports." I
know that the llvm/clang project is moving forward, and I think that's
a great long-term direction.

In the short term I think we are well served on all fronts to modify
the build architecture to better support compilers from ports. This
would actually help with the llvm/clang testing too, and sidestep the
problems of gplv3 stuff being in the base. TMK there has been no work
on this direction at all, which is disappointing.

I know that there is a huge cultural bias towards shipping "a complete
system," and don't get me wrong, I am fully supportive of that. I am
NOT suggesting that we dike out the existing toolchain. Just that we
make it easier to use toolchains from ports.


Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/


From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:31:59 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1A17B106566C;
	Tue, 22 Dec 2009 20:31:59 +0000 (UTC)
	(envelope-from bms@incunabulum.net)
Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com
	[66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id D27E58FC20;
	Tue, 22 Dec 2009 20:31:58 +0000 (UTC)
Received: from compute1.internal (compute1.internal [10.202.2.41])
	by gateway1.messagingengine.com (Postfix) with ESMTP id A1076C7D77;
	Tue, 22 Dec 2009 15:31:57 -0500 (EST)
Received: from heartbeat1.messagingengine.com ([10.202.2.160])
	by compute1.internal (MEProxy); Tue, 22 Dec 2009 15:31:57 -0500
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com;
	h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding;
	s=smtpout; bh=A7z3/Nb4/tl0oo74X+swZIY/3Y8=;
	b=kHp1VrVwvga/9JrcPDQ58eq4BeGDg8EA4DS117enCMszf9Fm3DwSu6wSXUPdPOmWrMZ0sLEME0Q2JWnzh0FmOEB1tMiwvc2P5wNqJClaKgTXwMz32dnUiofJB4CIMAOYmUBsNdP+mN977egSHd5QPAAirmoUGAUd5Ul2OK+m7ag=
X-Sasl-enc: gQFr31L9hbN9wBzNASVd0pupi+z/Qp0KPEilFhCyMckc 1261513917
Received: from anglepoise.lon.incunabulum.net
	(cpc2-dals7-0-0-cust253.hari.cable.virginmedia.com [82.35.112.254])
	by mail.messagingengine.com (Postfix) with ESMTPSA id AB81B4B9842;
	Tue, 22 Dec 2009 15:31:56 -0500 (EST)
Message-ID: <4B312CBB.7000307@incunabulum.net>
Date: Tue, 22 Dec 2009 20:31:55 +0000
From: Bruce Simpson 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.1.5) Gecko/20091222 Thunderbird/3.0
MIME-Version: 1.0
To: Doug Barton 
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>	<200912211459.21766.jhb@freebsd.org>	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<4B3129CD.20908@FreeBSD.org>
In-Reply-To: <4B3129CD.20908@FreeBSD.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, svn-src-all@FreeBSD.org,
	marius@alchemy.franken.de, svn-src-head@FreeBSD.org,
	"M. Warner Losh" 
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:31:59 -0000

On 12/22/09 20:19, Doug Barton wrote:
> I know that there is a huge cultural bias towards shipping "a complete
> system," and don't get me wrong, I am fully supportive of that. I am
> NOT suggesting that we dike out the existing toolchain. Just that we
> make it easier to use toolchains from ports.
>    

+1

The modularity we have now is great.

We need more modularity to support stuff like cross-builds.

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:33:58 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A70D106568B;
	Tue, 22 Dec 2009 20:33:58 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id 04BE18FC17;
	Tue, 22 Dec 2009 20:33:57 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id
	nBMKXo7L007288; Tue, 22 Dec 2009 21:33:51 +0100 (CET)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.3/8.14.3/Submit) id nBMKXocV007287;
	Tue, 22 Dec 2009 21:33:50 +0100 (CET) (envelope-from marius)
Date: Tue, 22 Dec 2009 21:33:50 +0100
From: Marius Strobl 
To: Roman Divacky 
Message-ID: <20091222203350.GE74529@alchemy.franken.de>
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>
	<200912211459.21766.jhb@freebsd.org>
	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<20091222141810.GA17221@freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091222141810.GA17221@freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, jhb@FreeBSD.org,
	"M. Warner Losh" 
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:33:58 -0000

On Tue, Dec 22, 2009 at 03:18:11PM +0100, Roman Divacky wrote:
> On Mon, Dec 21, 2009 at 09:16:48PM -0700, M. Warner Losh wrote:
> > In message: <20091221220004.GA42400@alchemy.franken.de>
> >             Marius Strobl  writes:
> > : On Mon, Dec 21, 2009 at 02:59:21PM -0500, John Baldwin wrote:
> > : > On Monday 21 December 2009 2:43:23 pm John Baldwin wrote:
> > : > > Author: jhb
> > : > > Date: Mon Dec 21 19:43:23 2009
> > : > > New Revision: 200797
> > : > > URL: http://svn.freebsd.org/changeset/base/200797
> > : > > 
> > : > > Log:
> > : > >   Use _once() to initialize the pthread key for thread-local storage to hold
> > : > >   the results of localtime() instead of using a pthread mutex directly.
> > : > 
> > : > It would probably be simpler to use TLS for this instead, but I'm not sure if
> > : > we have working TLS on all supported platforms.
> > : > 
> > : 
> > : At least not on arm and sparc64 as the in-tree binutils predate
> > : GNU TLS support for these.
> > 
> > We really need newer binutils in the tree.
> > 
> > And we need a way to compiler gplv3 binutils into the system for folks
> > that can do that without consequences...  But many modern processors
> > need to have the gplv3 version of binutils and that will be a
> > continuing problem.  One advantage of FreeBSD is its integration,
> > rather than having to play version whack-a-mole like you do with
> > embedded Linux.
> 
> well... llvm provides its own assembler so if the need for newer binutils
> comes from need of newer as I believe llvm can help here. or is the linker
> the problem?

Assuming LLVM properly supports the architecture in the first
place ...

Marius


From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:40:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 809E1106566C;
	Tue, 22 Dec 2009 20:40:22 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6F3AA8FC16;
	Tue, 22 Dec 2009 20:40:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMKeMqn075987;
	Tue, 22 Dec 2009 20:40:22 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKeM4X075984;
	Tue, 22 Dec 2009 20:40:22 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200912222040.nBMKeM4X075984@svn.freebsd.org>
From: Bruce M Simpson 
Date: Tue, 22 Dec 2009 20:40:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200871 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:40:22 -0000

Author: bms
Date: Tue Dec 22 20:40:22 2009
New Revision: 200871
URL: http://svn.freebsd.org/changeset/base/200871

Log:
  Use ALLOW_NEW_SOURCES and BLOCK_OLD_SOURCES to signal a join or leave
  with SSM MLDv2 by default.
  This is current practice and complies with RFC 4604, as well as being
  required by production IPv6 networks in Japan.
  The behaviour may be disabled by setting the net.inet6.mld.use_allow
  sysctl/tunable to 0.
  
  Requested by:	Hideki Yamamoto
  MFC after:	1 week

Modified:
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h

Modified: head/sys/netinet6/mld6.c
==============================================================================
--- head/sys/netinet6/mld6.c	Tue Dec 22 20:37:40 2009	(r200870)
+++ head/sys/netinet6/mld6.c	Tue Dec 22 20:40:22 2009	(r200871)
@@ -132,7 +132,8 @@ static struct mbuf *
 static int	mld_v2_enqueue_filter_change(struct ifqueue *,
 		    struct in6_multi *);
 static int	mld_v2_enqueue_group_record(struct ifqueue *,
-		    struct in6_multi *, const int, const int, const int);
+		    struct in6_multi *, const int, const int, const int,
+		    const int);
 static int	mld_v2_input_query(struct ifnet *, const struct ip6_hdr *,
 		    struct mbuf *, const int, const int);
 static int	mld_v2_merge_state_changes(struct in6_multi *,
@@ -236,6 +237,11 @@ SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1e
     &mld_v1enable, 0, "Enable fallback to MLDv1");
 TUNABLE_INT("net.inet6.mld.v1enable", &mld_v1enable);
 
+static int	mld_use_allow = 1;
+SYSCTL_INT(_net_inet6_mld, OID_AUTO, use_allow, CTLFLAG_RW,
+    &mld_use_allow, 0, "Use ALLOW/BLOCK for RFC 4604 SSM joins/leaves");
+TUNABLE_INT("net.inet6.mld.use_allow", &mld_use_allow);
+
 /*
  * Packed Router Alert option structure declaration.
  */
@@ -461,6 +467,8 @@ mld_domifattach(struct ifnet *ifp)
 	mli = mli_alloc_locked(ifp);
 	if (!(ifp->if_flags & IFF_MULTICAST))
 		mli->mli_flags |= MLIF_SILENT;
+	if (mld_use_allow)
+		mli->mli_flags |= MLIF_USEALLOW;
 
 	MLD_UNLOCK();
 
@@ -1550,7 +1558,8 @@ mld_v2_process_group_timers(struct mld_i
 			int retval;
 
 			retval = mld_v2_enqueue_group_record(qrq, inm, 0, 1,
-			    (inm->in6m_state == MLD_SG_QUERY_PENDING_MEMBER));
+			    (inm->in6m_state == MLD_SG_QUERY_PENDING_MEMBER),
+			    0);
 			CTR2(KTR_MLD, "%s: enqueue record = %d",
 			    __func__, retval);
 			inm->in6m_state = MLD_REPORTING_MEMBER;
@@ -2025,7 +2034,7 @@ mld_initial_join(struct in6_multi *inm, 
 			ifq = &inm->in6m_scq;
 			_IF_DRAIN(ifq);
 			retval = mld_v2_enqueue_group_record(ifq, inm, 1,
-			    0, 0);
+			    0, 0, (mli->mli_flags & MLIF_USEALLOW));
 			CTR2(KTR_MLD, "%s: enqueue record = %d",
 			    __func__, retval);
 			if (retval <= 0) {
@@ -2118,7 +2127,8 @@ mld_handle_state_change(struct in6_multi
 
 	_IF_DRAIN(&inm->in6m_scq);
 
-	retval = mld_v2_enqueue_group_record(&inm->in6m_scq, inm, 1, 0, 0);
+	retval = mld_v2_enqueue_group_record(&inm->in6m_scq, inm, 1, 0, 0,
+	    (mli->mli_flags & MLIF_USEALLOW));
 	CTR2(KTR_MLD, "%s: enqueue record = %d", __func__, retval);
 	if (retval <= 0)
 		return (-retval);
@@ -2203,7 +2213,8 @@ mld_final_leave(struct in6_multi *inm, s
 				in6m_acquire_locked(inm);
 
 				retval = mld_v2_enqueue_group_record(
-				    &inm->in6m_scq, inm, 1, 0, 0);
+				    &inm->in6m_scq, inm, 1, 0, 0,
+				    (mli->mli_flags & MLIF_USEALLOW));
 				KASSERT(retval != 0,
 				    ("%s: enqueue record = %d", __func__,
 				     retval));
@@ -2250,6 +2261,10 @@ mld_final_leave(struct in6_multi *inm, s
  * it was recorded for a Group-Source query, and will be omitted if
  * it is not both in-mode and recorded.
  *
+ * If use_block_allow is non-zero, state change reports for initial join
+ * and final leave, on an inclusive mode group with a source list, will be
+ * rewritten to use the ALLOW_NEW and BLOCK_OLD record types, respectively.
+ *
  * The function will attempt to allocate leading space in the packet
  * for the IPv6+ICMP headers to be prepended without fragmenting the chain.
  *
@@ -2260,7 +2275,7 @@ mld_final_leave(struct in6_multi *inm, s
 static int
 mld_v2_enqueue_group_record(struct ifqueue *ifq, struct in6_multi *inm,
     const int is_state_change, const int is_group_query,
-    const int is_source_query)
+    const int is_source_query, const int use_block_allow)
 {
 	struct mldv2_record	 mr;
 	struct mldv2_record	*pmr;
@@ -2308,10 +2323,16 @@ mld_v2_enqueue_group_record(struct ifque
 		 * If the mode did not change, and there are non-ASM
 		 * listeners or source filters present,
 		 * we potentially need to issue two records for the group.
-		 * If we are transitioning to MCAST_UNDEFINED, we need
-		 * not send any sources.
 		 * If there are ASM listeners, and there was no filter
 		 * mode transition of any kind, do nothing.
+		 *
+		 * If we are transitioning to MCAST_UNDEFINED, we need
+		 * not send any sources. A transition to/from this state is
+		 * considered inclusive with some special treatment.
+		 *
+		 * If we are rewriting initial joins/leaves to use
+		 * ALLOW/BLOCK, and the group's membership is inclusive,
+		 * we need to send sources in all cases.
 		 */
 		if (mode != inm->in6m_st[0].iss_fmode) {
 			if (mode == MCAST_EXCLUDE) {
@@ -2321,9 +2342,26 @@ mld_v2_enqueue_group_record(struct ifque
 			} else {
 				CTR1(KTR_MLD, "%s: change to INCLUDE",
 				    __func__);
-				type = MLD_CHANGE_TO_INCLUDE_MODE;
-				if (mode == MCAST_UNDEFINED)
-					record_has_sources = 0;
+				if (use_block_allow) {
+					/*
+					 * XXX
+					 * Here we're interested in state
+					 * edges either direction between
+					 * MCAST_UNDEFINED and MCAST_INCLUDE.
+					 * Perhaps we should just check
+					 * the group state, rather than
+					 * the filter mode.
+					 */
+					if (mode == MCAST_UNDEFINED) {
+						type = MLD_BLOCK_OLD_SOURCES;
+					} else {
+						type = MLD_ALLOW_NEW_SOURCES;
+					}
+				} else {
+					type = MLD_CHANGE_TO_INCLUDE_MODE;
+					if (mode == MCAST_UNDEFINED)
+						record_has_sources = 0;
+				}
 			}
 		} else {
 			if (record_has_sources) {
@@ -2436,9 +2474,12 @@ mld_v2_enqueue_group_record(struct ifque
 	 * If we are appending to an existing packet, we need to obtain
 	 * a pointer to the group record after m_append(), in case a new
 	 * mbuf was allocated.
+	 *
 	 * Only append sources which are in-mode at t1. If we are
-	 * transitioning to MCAST_UNDEFINED state on the group, do not
-	 * include source entries.
+	 * transitioning to MCAST_UNDEFINED state on the group, and
+	 * use_block_allow is zero, do not include source entries.
+	 * Otherwise, we need to include this source in the report.
+	 *
 	 * Only report recorded sources in our filter set when responding
 	 * to a group-source query.
 	 */
@@ -2460,7 +2501,8 @@ mld_v2_enqueue_group_record(struct ifque
 			now = im6s_get_mode(inm, ims, 1);
 			CTR2(KTR_MLD, "%s: node is %d", __func__, now);
 			if ((now != mode) ||
-			    (now == mode && mode == MCAST_UNDEFINED)) {
+			    (now == mode &&
+			     (!use_block_allow && mode == MCAST_UNDEFINED))) {
 				CTR1(KTR_MLD, "%s: skip node", __func__);
 				continue;
 			}
@@ -2550,7 +2592,8 @@ mld_v2_enqueue_group_record(struct ifque
 			    __func__, ip6_sprintf(ip6tbuf, &ims->im6s_addr));
 			now = im6s_get_mode(inm, ims, 1);
 			if ((now != mode) ||
-			    (now == mode && mode == MCAST_UNDEFINED)) {
+			    (now == mode &&
+			     (!use_block_allow && mode == MCAST_UNDEFINED))) {
 				CTR1(KTR_MLD, "%s: skip node", __func__);
 				continue;
 			}
@@ -2961,7 +3004,7 @@ mld_v2_dispatch_general_query(struct mld
 		case MLD_AWAKENING_MEMBER:
 			inm->in6m_state = MLD_REPORTING_MEMBER;
 			retval = mld_v2_enqueue_group_record(&mli->mli_gq,
-			    inm, 0, 0, 0);
+			    inm, 0, 0, 0, 0);
 			CTR2(KTR_MLD, "%s: enqueue record = %d",
 			    __func__, retval);
 			break;

Modified: head/sys/netinet6/mld6_var.h
==============================================================================
--- head/sys/netinet6/mld6_var.h	Tue Dec 22 20:37:40 2009	(r200870)
+++ head/sys/netinet6/mld6_var.h	Tue Dec 22 20:40:22 2009	(r200871)
@@ -55,6 +55,7 @@ struct mld_ifinfo {
 	struct ifqueue	 mli_gq;	/* queue of general query responses */
 };
 #define MLIF_SILENT	0x00000001	/* Do not use MLD on this ifp */
+#define MLIF_USEALLOW	0x00000002	/* Use ALLOW/BLOCK for joins/leaves */
 
 #define MLD_RANDOM_DELAY(X)		(arc4random() % (X) + 1)
 #define MLD_MAX_STATE_CHANGES		24 /* Max pending changes per group */

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:56:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1667E1065670;
	Tue, 22 Dec 2009 20:56:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 05F6E8FC12;
	Tue, 22 Dec 2009 20:56:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMKuXZq076369;
	Tue, 22 Dec 2009 20:56:33 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKuXPD076367;
	Tue, 22 Dec 2009 20:56:33 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200912222056.nBMKuXPD076367@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 22 Dec 2009 20:56:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200872 - head/sys/boot/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:56:34 -0000

Author: jhb
Date: Tue Dec 22 20:56:33 2009
New Revision: 200872
URL: http://svn.freebsd.org/changeset/base/200872

Log:
  Don't build zfsboot, gptzfsboot, and zfsloader if WITHOUT_ZFS is enabled.
  
  MFC after:	1 week

Modified:
  head/sys/boot/i386/Makefile

Modified: head/sys/boot/i386/Makefile
==============================================================================
--- head/sys/boot/i386/Makefile	Tue Dec 22 20:40:22 2009	(r200871)
+++ head/sys/boot/i386/Makefile	Tue Dec 22 20:56:33 2009	(r200872)
@@ -1,9 +1,15 @@
 # $FreeBSD$
 
-SUBDIR=		mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot zfsboot \
-		gptzfsboot kgzldr libi386 libfirewire loader zfsloader
+.include 
+
+SUBDIR=		mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot kgzldr \
+		libi386 libfirewire loader
 
 # special boot programs, 'self-extracting boot2+loader'
 SUBDIR+=	pxeldr
 
+.if ${MK_ZFS} != "no"
+SUBDIR+=	zfsboot gptzfsboot zfsloader
+.endif
+
 .include 

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 20:57:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7AD25106568F;
	Tue, 22 Dec 2009 20:57:30 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 697478FC2B;
	Tue, 22 Dec 2009 20:57:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMKvUBZ076425;
	Tue, 22 Dec 2009 20:57:30 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMKvURv076423;
	Tue, 22 Dec 2009 20:57:30 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912222057.nBMKvURv076423@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 20:57:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200873 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 20:57:30 -0000

Author: yongari
Date: Tue Dec 22 20:57:30 2009
New Revision: 200873
URL: http://svn.freebsd.org/changeset/base/200873

Log:
  Instead of relying on hard resetting of controller to stop
  receiving incoming traffics, try harder to gracefully stop active
  DMA cycles and then stop MACs. This is the way what datasheet
  recommends and seems to work reliably. Resetting controller while
  active DMAs are in progress is bad thing as we can't predict how
  DMAs touche allocated TX/RX buffers. This change ensures controller
  stop state before attempting to release allocated TX/RX buffers.
  Also update MAC statistics which could have been updated during the
  wait time of MAC stop.
  
  While I'm here remove unnecessary controller resets in various
  location. ste(4) no longer relies on hard controller reset to stop
  controller and resetting controller also clears all configured
  settings which makes it hard to implement WOL in near future.
  Now resetting a controller is performed in ste_init_locked().

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 20:56:33 2009	(r200872)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 20:57:30 2009	(r200873)
@@ -651,10 +651,8 @@ ste_poll_locked(struct ifnet *ifp, enum 
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR) {
-			ste_reset(sc);
+		if (status & STE_ISR_HOSTERR)
 			ste_init_locked(sc);
-		}
 	}
 	return (rx_npkts);
 }
@@ -702,10 +700,8 @@ ste_intr(void *xsc)
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR) {
-			ste_reset(sc);
+		if (status & STE_ISR_HOSTERR)
 			ste_init_locked(sc);
-		}
 	}
 
 	/* Re-enable interrupts */
@@ -816,7 +812,6 @@ ste_txeoc(struct ste_softc *sc)
 			device_printf(sc->ste_dev,
 			    "transmission error: %x\n", txstat);
 
-			ste_reset(sc);
 			ste_init_locked(sc);
 
 			if (txstat & STE_TXSTATUS_UNDERRUN &&
@@ -1528,6 +1523,8 @@ ste_init_locked(struct ste_softc *sc)
 	ifp = sc->ste_ifp;
 
 	ste_stop(sc);
+	/* Reset the chip to a known state. */
+	ste_reset(sc);
 
 	/* Init our MAC address */
 	for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
@@ -1633,6 +1630,7 @@ ste_stop(struct ste_softc *sc)
 	struct ifnet *ifp;
 	struct ste_chain_onefrag *cur_rx;
 	struct ste_chain *cur_tx;
+	uint32_t val;
 	int i;
 
 	STE_LOCK_ASSERT(sc);
@@ -1643,19 +1641,33 @@ ste_stop(struct ste_softc *sc)
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING|IFF_DRV_OACTIVE);
 
 	CSR_WRITE_2(sc, STE_IMR, 0);
-	STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_TX_DISABLE);
-	STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_RX_DISABLE);
-	STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_STATS_DISABLE);
-	STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_TXDMA_STALL);
-	STE_SETBIT2(sc, STE_DMACTL, STE_DMACTL_RXDMA_STALL);
+	/* Stop pending DMA. */
+	val = CSR_READ_4(sc, STE_DMACTL);
+	val |= STE_DMACTL_TXDMA_STALL | STE_DMACTL_RXDMA_STALL;
+	CSR_WRITE_4(sc, STE_DMACTL, val);
 	ste_wait(sc);
-	/*
-	 * Try really hard to stop the RX engine or under heavy RX
-	 * data chip will write into de-allocated memory.
-	 */
-	ste_reset(sc);
-
-	sc->ste_flags &= ~STE_FLAG_LINK;
+	/* Disable auto-polling. */
+	CSR_WRITE_1(sc, STE_RX_DMAPOLL_PERIOD, 0);
+	CSR_WRITE_1(sc, STE_TX_DMAPOLL_PERIOD, 0);
+	/* Nullify DMA address to stop any further DMA. */
+	CSR_WRITE_4(sc, STE_RX_DMALIST_PTR, 0);
+	CSR_WRITE_4(sc, STE_TX_DMALIST_PTR, 0);
+	/* Stop TX/RX MAC. */
+	val = CSR_READ_2(sc, STE_MACCTL1);
+	val |= STE_MACCTL1_TX_DISABLE | STE_MACCTL1_RX_DISABLE |
+	    STE_MACCTL1_STATS_DISABLE;
+	CSR_WRITE_2(sc, STE_MACCTL1, val);
+	for (i = 0; i < STE_TIMEOUT; i++) {
+		DELAY(10);
+		if ((CSR_READ_2(sc, STE_MACCTL1) & (STE_MACCTL1_TX_DISABLE |
+		    STE_MACCTL1_RX_DISABLE | STE_MACCTL1_STATS_DISABLE)) == 0)
+			break;
+	}
+	if (i == STE_TIMEOUT)
+		device_printf(sc->ste_dev, "Stopping MAC timed out\n");
+	/* Acknowledge any pending interrupts. */
+	CSR_READ_2(sc, STE_ISR_ACK);
+	ste_stats_update(sc);
 
 	for (i = 0; i < STE_RX_LIST_CNT; i++) {
 		cur_rx = &sc->ste_cdata.ste_rx_chain[i];
@@ -1947,7 +1959,6 @@ ste_watchdog(struct ste_softc *sc)
 	ste_txeoc(sc);
 	ste_txeof(sc);
 	ste_rxeof(sc, -1);
-	ste_reset(sc);
 	ste_init_locked(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:02:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 96AF9106566C;
	Tue, 22 Dec 2009 21:02:46 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8399A8FC2D;
	Tue, 22 Dec 2009 21:02:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBML2kDi076588;
	Tue, 22 Dec 2009 21:02:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBML2k98076576;
	Tue, 22 Dec 2009 21:02:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912222102.nBML2k98076576@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 22 Dec 2009 21:02:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200874 - in head/sys: dev/auxio sparc64/central
	sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:02:46 -0000

Author: marius
Date: Tue Dec 22 21:02:46 2009
New Revision: 200874
URL: http://svn.freebsd.org/changeset/base/200874

Log:
  Enroll these drivers in multipass probing. The motivation behind this
  is that the JBus to EBus bridges share the interrupt controller of a
  sibling JBus to PCIe bridge (at least as far as the OFW device tree
  is concerned, in reality they are part of the same chip) so we have to
  probe and attach the latter first. That happens to be also the case
  due to the fact that the JBus to PCIe bridges appear first in the OFW
  device tree but it doesn't hurt to ensure the right order.

Modified:
  head/sys/dev/auxio/auxio.c
  head/sys/sparc64/central/central.c
  head/sys/sparc64/ebus/ebus.c
  head/sys/sparc64/fhc/fhc.c
  head/sys/sparc64/pci/apb.c
  head/sys/sparc64/pci/ofw_pcib.c
  head/sys/sparc64/pci/ofw_pcibus.c
  head/sys/sparc64/sbus/dma_sbus.c
  head/sys/sparc64/sbus/sbus.c
  head/sys/sparc64/sparc64/nexus.c
  head/sys/sparc64/sparc64/upa.c

Modified: head/sys/dev/auxio/auxio.c
==============================================================================
--- head/sys/dev/auxio/auxio.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/dev/auxio/auxio.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -141,7 +141,9 @@ static driver_t auxio_sbus_driver = {
 };
 
 static devclass_t	auxio_devclass;
-DRIVER_MODULE(auxio, sbus, auxio_sbus_driver, auxio_devclass, 0, 0);
+/* The probe order is handled by sbus(4). */
+EARLY_DRIVER_MODULE(auxio, sbus, auxio_sbus_driver, auxio_devclass, 0, 0,
+    BUS_PASS_DEFAULT);
 MODULE_DEPEND(auxio, sbus, 1, 1, 1);
 
 /* EBus */
@@ -158,7 +160,8 @@ static driver_t auxio_ebus_driver = {
 	sizeof(struct auxio_softc)
 };
 
-DRIVER_MODULE(auxio, ebus, auxio_ebus_driver, auxio_devclass, 0, 0);
+EARLY_DRIVER_MODULE(auxio, ebus, auxio_ebus_driver, auxio_devclass, 0, 0,
+    BUS_PASS_DEFAULT);
 MODULE_DEPEND(auxio, ebus, 1, 1, 1);
 MODULE_VERSION(auxio, 1);
 

Modified: head/sys/sparc64/central/central.c
==============================================================================
--- head/sys/sparc64/central/central.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/central/central.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -105,7 +105,8 @@ static driver_t central_driver = {
 
 static devclass_t central_devclass;
 
-DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0);
+EARLY_DRIVER_MODULE(central, nexus, central_driver, central_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(fhc, nexus, 1, 1, 1);
 MODULE_VERSION(central, 1);
 

Modified: head/sys/sparc64/ebus/ebus.c
==============================================================================
--- head/sys/sparc64/ebus/ebus.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/ebus/ebus.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -138,7 +138,8 @@ static driver_t ebus_driver = {
 
 static devclass_t ebus_devclass;
 
-DRIVER_MODULE(ebus, pci, ebus_driver, ebus_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ebus, pci, ebus_driver, ebus_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(ebus, pci, 1, 1, 1);
 MODULE_VERSION(ebus, 1);
 

Modified: head/sys/sparc64/fhc/fhc.c
==============================================================================
--- head/sys/sparc64/fhc/fhc.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/fhc/fhc.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -119,9 +119,11 @@ static driver_t fhc_driver = {
 
 static devclass_t fhc_devclass;
 
-DRIVER_MODULE(fhc, central, fhc_driver, fhc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(fhc, central, fhc_driver, fhc_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(fhc, central, 1, 1, 1);
-DRIVER_MODULE(fhc, nexus, fhc_driver, fhc_devclass, 0, 0);
+EARLY_DRIVER_MODULE(fhc, nexus, fhc_driver, fhc_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(fhc, nexus, 1, 1, 1);
 MODULE_VERSION(fhc, 1);
 

Modified: head/sys/sparc64/pci/apb.c
==============================================================================
--- head/sys/sparc64/pci/apb.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/pci/apb.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -111,7 +111,7 @@ static device_method_t apb_methods[] = {
 static devclass_t pcib_devclass;
 
 DEFINE_CLASS_0(pcib, apb_driver, apb_methods, sizeof(struct apb_softc));
-DRIVER_MODULE(apb, pci, apb_driver, pcib_devclass, 0, 0);
+EARLY_DRIVER_MODULE(apb, pci, apb_driver, pcib_devclass, 0, 0, BUS_PASS_BUS);
 MODULE_DEPEND(apb, pci, 1, 1, 1);
 
 /* APB specific registers */

Modified: head/sys/sparc64/pci/ofw_pcib.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcib.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/pci/ofw_pcib.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -93,7 +93,8 @@ static devclass_t pcib_devclass;
 
 DEFINE_CLASS_0(pcib, ofw_pcib_driver, ofw_pcib_methods,
     sizeof(struct ofw_pcib_gen_softc));
-DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_driver, pcib_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1);
 
 static int

Modified: head/sys/sparc64/pci/ofw_pcibus.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcibus.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/pci/ofw_pcibus.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -101,7 +101,8 @@ static devclass_t pci_devclass;
 
 DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */,
     pci_driver);
-DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_VERSION(ofw_pcibus, 1);
 MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1);
 

Modified: head/sys/sparc64/sbus/dma_sbus.c
==============================================================================
--- head/sys/sparc64/sbus/dma_sbus.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/sbus/dma_sbus.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -149,7 +149,13 @@ static driver_t dma_driver = {
 	sizeof(struct dma_softc),
 };
 
-DRIVER_MODULE(dma, sbus, dma_driver, dma_devclass, 0, 0);
+/*
+ * The probe order is handled by sbus(4) as we don't want the variants
+ * with children to be attached earlier than the stand-alone controllers
+ * in order to generally preserve the OFW device tree order.
+ */
+EARLY_DRIVER_MODULE(dma, sbus, dma_driver, dma_devclass, 0, 0,
+    BUS_PASS_DEFAULT);
 MODULE_DEPEND(dma, sbus, 1, 1, 1);
 MODULE_VERSION(dma, 1);
 

Modified: head/sys/sparc64/sbus/sbus.c
==============================================================================
--- head/sys/sparc64/sbus/sbus.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/sbus/sbus.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -247,7 +247,8 @@ static driver_t sbus_driver = {
 
 static devclass_t sbus_devclass;
 
-DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0);
+EARLY_DRIVER_MODULE(sbus, nexus, sbus_driver, sbus_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_DEPEND(sbus, nexus, 1, 1, 1);
 MODULE_VERSION(sbus, 1);
 

Modified: head/sys/sparc64/sparc64/nexus.c
==============================================================================
--- head/sys/sparc64/sparc64/nexus.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/sparc64/nexus.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -144,7 +144,8 @@ static device_method_t nexus_methods[] =
 static devclass_t nexus_devclass;
 
 DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, sizeof(struct nexus_softc));
-DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
+EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0,
+    BUS_PASS_BUS);
 MODULE_VERSION(nexus, 1);
 
 static const char *const nexus_excl_name[] = {

Modified: head/sys/sparc64/sparc64/upa.c
==============================================================================
--- head/sys/sparc64/sparc64/upa.c	Tue Dec 22 20:57:30 2009	(r200873)
+++ head/sys/sparc64/sparc64/upa.c	Tue Dec 22 21:02:46 2009	(r200874)
@@ -151,7 +151,7 @@ static device_method_t upa_methods[] = {
 static devclass_t upa_devclass;
 
 DEFINE_CLASS_0(upa, upa_driver, upa_methods, sizeof(struct upa_softc));
-DRIVER_MODULE(upa, nexus, upa_driver, upa_devclass, 0, 0);
+EARLY_DRIVER_MODULE(upa, nexus, upa_driver, upa_devclass, 0, 0, BUS_PASS_BUS);
 
 static const struct intr_controller upa_ic = {
 	upa_intr_enable,

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:32:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11849106568F;
	Tue, 22 Dec 2009 21:32:27 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from mx0.deglitch.com (backbone.deglitch.com
	[IPv6:2001:16d8:fffb:4::abba])
	by mx1.freebsd.org (Postfix) with ESMTP id AFC518FC0A;
	Tue, 22 Dec 2009 21:32:26 +0000 (UTC)
Received: from orion.SpringDaemons.com
	(adsl-99-48-191-9.dsl.snfc21.sbcglobal.net [99.48.191.9])
	by mx0.deglitch.com (Postfix) with ESMTPA id 9BB648FC4E;
	Wed, 23 Dec 2009 00:32:24 +0300 (MSK)
Received: from orion (localhost [127.0.0.1])
	by orion.SpringDaemons.com (Postfix) with SMTP id E453B39C24;
	Tue, 22 Dec 2009 13:32:17 -0800 (PST)
Date: Tue, 22 Dec 2009 13:32:17 -0800
From: Stanislav Sedov 
To: Xin LI 
Message-Id: <20091222133217.aad538b0.stas@FreeBSD.org>
In-Reply-To: <200912212012.nBLKC2aS039479@svn.freebsd.org>
References: <200912212012.nBLKC2aS039479@svn.freebsd.org>
Organization: The FreeBSD Project
X-Mailer: carrier-pigeon
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200806 - head/usr.sbin/newsyslog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:32:27 -0000

On Mon, 21 Dec 2009 20:12:02 +0000 (UTC)
Xin LI  mentioned:

> Author: delphij
> Date: Mon Dec 21 20:12:01 2009
> New Revision: 200806
> URL: http://svn.freebsd.org/changeset/base/200806
> 
> Log:
>   Don't consider non-existence of a PID file an error, we should be able
>   to proceed anyway as this most likely mean that the process has been
>   terminated.

Or the process has not created the PID file and can be screwed up by rotating
its log file.  What about making this optional controlled by a command line
switch?  It might be a more safe alternative.

-- 
Stanislav Sedov
ST4096-RIPE

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:39:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A6E61065694;
	Tue, 22 Dec 2009 21:39:34 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 893B28FC16;
	Tue, 22 Dec 2009 21:39:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLdYZr077371;
	Tue, 22 Dec 2009 21:39:34 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLdYB7077368;
	Tue, 22 Dec 2009 21:39:34 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912222139.nBMLdYB7077368@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 21:39:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200875 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:39:34 -0000

Author: yongari
Date: Tue Dec 22 21:39:34 2009
New Revision: 200875
URL: http://svn.freebsd.org/changeset/base/200875

Log:
  Prefer memory space register mapping over io space. If memory space
  mapping fails fall back to old io space mapping.
  While I'm here use PCIR_BAR macro.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 21:02:46 2009	(r200874)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 21:39:34 2009	(r200875)
@@ -74,8 +74,6 @@ __FBSDID("$FreeBSD$");
 /* "device miibus" required.  See GENERIC if you get errors here. */
 #include "miibus_if.h"
 
-#define STE_USEIOSPACE
-
 MODULE_DEPEND(ste, pci, 1, 1, 1);
 MODULE_DEPEND(ste, ether, 1, 1, 1);
 MODULE_DEPEND(ste, miibus, 1, 1, 1);
@@ -132,14 +130,6 @@ static void	ste_txeof(struct ste_softc *
 static void	ste_wait(struct ste_softc *);
 static void	ste_watchdog(struct ste_softc *);
 
-#ifdef STE_USEIOSPACE
-#define STE_RES			SYS_RES_IOPORT
-#define STE_RID			STE_PCI_LOIO
-#else
-#define STE_RES			SYS_RES_MEMORY
-#define STE_RID			STE_PCI_LOMEM
-#endif
-
 static device_method_t ste_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		ste_probe),
@@ -965,9 +955,17 @@ ste_attach(device_t dev)
 	 */
 	pci_enable_busmaster(dev);
 
-	rid = STE_RID;
-	sc->ste_res = bus_alloc_resource_any(dev, STE_RES, &rid, RF_ACTIVE);
-
+	/* Prefer memory space register mapping over IO space. */
+	sc->ste_res_id = PCIR_BAR(1);
+	sc->ste_res_type = SYS_RES_MEMORY;
+	sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,
+	    &sc->ste_res_id, RF_ACTIVE);
+	if (sc->ste_res == NULL) {
+		sc->ste_res_id = PCIR_BAR(0);
+		sc->ste_res_type = SYS_RES_IOPORT;
+		sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,
+		    &sc->ste_res_id, RF_ACTIVE);
+	}
 	if (sc->ste_res == NULL) {
 		device_printf(dev, "couldn't map ports/memory\n");
 		error = ENXIO;
@@ -1105,7 +1103,8 @@ ste_detach(device_t dev)
 	if (sc->ste_irq)
 		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ste_irq);
 	if (sc->ste_res)
-		bus_release_resource(dev, STE_RES, STE_RID, sc->ste_res);
+		bus_release_resource(dev, sc->ste_res_type, sc->ste_res_id,
+		    sc->ste_res);
 
 	if (ifp)
 		if_free(ifp);

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Tue Dec 22 21:02:46 2009	(r200874)
+++ head/sys/dev/ste/if_stereg.h	Tue Dec 22 21:39:34 2009	(r200875)
@@ -547,6 +547,8 @@ struct ste_softc {
 	bus_space_tag_t		ste_btag;
 	bus_space_handle_t	ste_bhandle;
 	struct resource		*ste_res;
+	int			ste_res_id;
+	int			ste_res_type;
 	struct resource		*ste_irq;
 	void			*ste_intrhand;
 	struct ste_type		*ste_info;

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:42:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A643B106566B;
	Tue, 22 Dec 2009 21:42:54 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7C1458FC13;
	Tue, 22 Dec 2009 21:42:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLgsne077468;
	Tue, 22 Dec 2009 21:42:54 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLgst0077466;
	Tue, 22 Dec 2009 21:42:54 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912222142.nBMLgst0077466@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 22 Dec 2009 21:42:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200876 - head/sys/sparc64/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:42:54 -0000

Author: marius
Date: Tue Dec 22 21:42:54 2009
New Revision: 200876
URL: http://svn.freebsd.org/changeset/base/200876

Log:
  Make these constants unsigned which is more appropriate.

Modified:
  head/sys/sparc64/include/bus_common.h

Modified: head/sys/sparc64/include/bus_common.h
==============================================================================
--- head/sys/sparc64/include/bus_common.h	Tue Dec 22 21:39:34 2009	(r200875)
+++ head/sys/sparc64/include/bus_common.h	Tue Dec 22 21:42:54 2009	(r200876)
@@ -39,18 +39,18 @@
 #ifndef _MACHINE_BUS_COMMON_H_
 #define	_MACHINE_BUS_COMMON_H_
 
-#define	INTMAP_V		0x080000000LL	/* Interrupt valid (enabled) */
-#define	INTMAP_TID_MASK		0x07c000000LL	/* UPA target ID */
+#define	INTMAP_V		0x080000000ULL	/* Interrupt valid (enabled) */
+#define	INTMAP_TID_MASK		0x07c000000ULL	/* UPA target ID */
 #define	INTMAP_TID_SHIFT	26
-#define	INTMAP_IGN_MASK		0x0000007c0LL	/* Interrupt group no. */
+#define	INTMAP_IGN_MASK		0x0000007c0ULL	/* Interrupt group no. */
 #define	INTMAP_IGN_SHIFT	6
-#define	INTMAP_INO_MASK		0x00000003fLL	/* Interrupt number */
+#define	INTMAP_INO_MASK		0x00000003fULL	/* Interrupt number */
 #define	INTMAP_INR_MASK		(INTMAP_IGN_MASK | INTMAP_INO_MASK)
-#define	INTMAP_SBUSSLOT_MASK	0x000000018LL	/* SBus slot # */
-#define	INTMAP_PCIBUS_MASK	0x000000010LL	/* PCI bus number (A or B) */
-#define	INTMAP_PCISLOT_MASK	0x00000000cLL	/* PCI slot # */
-#define	INTMAP_PCIINT_MASK	0x000000003LL	/* PCI interrupt #A,#B,#C,#D */
-#define	INTMAP_OBIO_MASK	0x000000020LL	/* Onboard device */
+#define	INTMAP_SBUSSLOT_MASK	0x000000018ULL	/* SBus slot # */
+#define	INTMAP_PCIBUS_MASK	0x000000010ULL	/* PCI bus number (A or B) */
+#define	INTMAP_PCISLOT_MASK	0x00000000cULL	/* PCI slot # */
+#define	INTMAP_PCIINT_MASK	0x000000003ULL	/* PCI interrupt #A,#B,#C,#D */
+#define	INTMAP_OBIO_MASK	0x000000020ULL	/* Onboard device */
 #define	INTIGN(x)		(((x) & INTMAP_IGN_MASK) >> INTMAP_IGN_SHIFT)
 #define	INTVEC(x)		((x) & INTMAP_INR_MASK)
 #define	INTSLOT(x)		(((x) >> 3) & 0x7)

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:44:25 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E9EF01065697;
	Tue, 22 Dec 2009 21:44:25 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BFB1B8FC1F;
	Tue, 22 Dec 2009 21:44:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLiP8U077548;
	Tue, 22 Dec 2009 21:44:25 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLiP4n077545;
	Tue, 22 Dec 2009 21:44:25 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912222144.nBMLiP4n077545@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 21:44:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200877 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:44:26 -0000

Author: yongari
Date: Tue Dec 22 21:44:25 2009
New Revision: 200877
URL: http://svn.freebsd.org/changeset/base/200877

Log:
  Prefer bus_write_{1,2,4}/bus_read_{1,2,4} to
  bus_space_write_{1,2,4}/bus_space_read_{1,2,4}.
  Remove unused ste_bhandle and ste_btag in softc.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 21:42:54 2009	(r200876)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 21:44:25 2009	(r200877)
@@ -972,9 +972,6 @@ ste_attach(device_t dev)
 		goto fail;
 	}
 
-	sc->ste_btag = rman_get_bustag(sc->ste_res);
-	sc->ste_bhandle = rman_get_bushandle(sc->ste_res);
-
 	/* Allocate interrupt */
 	rid = 0;
 	sc->ste_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Tue Dec 22 21:42:54 2009	(r200876)
+++ head/sys/dev/ste/if_stereg.h	Tue Dec 22 21:44:25 2009	(r200877)
@@ -465,18 +465,18 @@ struct ste_desc_onefrag {
  * register space access macros
  */
 #define CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4(sc->ste_btag, sc->ste_bhandle, reg, val)
+	bus_write_4((sc)->ste_res, reg, val)
 #define CSR_WRITE_2(sc, reg, val)	\
-	bus_space_write_2(sc->ste_btag, sc->ste_bhandle, reg, val)
+	bus_write_2((sc)->ste_res, reg, val)
 #define CSR_WRITE_1(sc, reg, val)	\
-	bus_space_write_1(sc->ste_btag, sc->ste_bhandle, reg, val)
+	bus_write_1((sc)->ste_res, reg, val)
 
 #define CSR_READ_4(sc, reg)		\
-	bus_space_read_4(sc->ste_btag, sc->ste_bhandle, reg)
+	bus_read_4((sc)->ste_res, reg)
 #define CSR_READ_2(sc, reg)		\
-	bus_space_read_2(sc->ste_btag, sc->ste_bhandle, reg)
+	bus_read_2((sc)->ste_res, reg)
 #define CSR_READ_1(sc, reg)		\
-	bus_space_read_1(sc->ste_btag, sc->ste_bhandle, reg)
+	bus_read_1((sc)->ste_res, reg)
 
 #define	STE_DESC_ALIGN		8
 #define STE_RX_LIST_CNT		128
@@ -544,8 +544,6 @@ struct ste_chain_data {
 
 struct ste_softc {
 	struct ifnet		*ste_ifp;
-	bus_space_tag_t		ste_btag;
-	bus_space_handle_t	ste_bhandle;
 	struct resource		*ste_res;
 	int			ste_res_id;
 	int			ste_res_type;

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:48:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AA19F106568D;
	Tue, 22 Dec 2009 21:48:18 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9936F8FC18;
	Tue, 22 Dec 2009 21:48:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLmI7Z077661;
	Tue, 22 Dec 2009 21:48:18 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLmIte077659;
	Tue, 22 Dec 2009 21:48:18 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912222148.nBMLmIte077659@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 22 Dec 2009 21:48:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200878 - head/sys/sparc64/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:48:18 -0000

Author: marius
Date: Tue Dec 22 21:48:18 2009
New Revision: 200878
URL: http://svn.freebsd.org/changeset/base/200878

Log:
  - Add macros for the states of the interrupt clear registers.
  - Change INTMAP_VEC() to take an INO as its second argument rather
    than an INR. The former is what I actually intended with this
    macro and how it's currently used.

Modified:
  head/sys/sparc64/include/bus_common.h

Modified: head/sys/sparc64/include/bus_common.h
==============================================================================
--- head/sys/sparc64/include/bus_common.h	Tue Dec 22 21:44:25 2009	(r200877)
+++ head/sys/sparc64/include/bus_common.h	Tue Dec 22 21:48:18 2009	(r200878)
@@ -39,6 +39,10 @@
 #ifndef _MACHINE_BUS_COMMON_H_
 #define	_MACHINE_BUS_COMMON_H_
 
+#define	INTCLR_PENDING		0x000000003ULL	/* Interrupt queued to CPU */
+#define	INTCLR_RECEIVED		0x000000001ULL	/* Interrupt received */
+#define	INTCLR_IDLE		0x000000000ULL	/* Interrupt idle */
+
 #define	INTMAP_V		0x080000000ULL	/* Interrupt valid (enabled) */
 #define	INTMAP_TID_MASK		0x07c000000ULL	/* UPA target ID */
 #define	INTMAP_TID_SHIFT	26
@@ -60,9 +64,9 @@
 	(INTMAP_TID((mr), (mid)) | INTMAP_V)
 #define	INTMAP_TID(mr, mid)						\
 	(((mr) & ~INTMAP_TID_MASK) | ((mid) << INTMAP_TID_SHIFT))
-#define	INTMAP_VEC(ign, inr)						\
+#define	INTMAP_VEC(ign, ino)						\
 	((((ign) << INTMAP_IGN_SHIFT) & INTMAP_IGN_MASK) |		\
-	((inr) & INTMAP_INR_MASK))
+	((ino) & INTMAP_INO_MASK))
 
 /* counter-timer support. */
 void sparc64_counter_init(const char *name, bus_space_tag_t tag,

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:49:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D445106568B;
	Tue, 22 Dec 2009 21:49:53 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B7348FC16;
	Tue, 22 Dec 2009 21:49:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLnrfw077724;
	Tue, 22 Dec 2009 21:49:53 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLnr8j077722;
	Tue, 22 Dec 2009 21:49:53 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912222149.nBMLnr8j077722@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 22 Dec 2009 21:49:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200879 - head/sys/sparc64/ebus
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:49:53 -0000

Author: marius
Date: Tue Dec 22 21:49:53 2009
New Revision: 200879
URL: http://svn.freebsd.org/changeset/base/200879

Log:
  - Add support for the JBus to EBus bridges which hang off of nexus(4)
    and are found in sun4u and sun4v machines based on the Fire ASIC.
  - Initialize the configuration space of the PCI to EBus variant the
    same way as OpenSolaris does.

Modified:
  head/sys/sparc64/ebus/ebus.c

Modified: head/sys/sparc64/ebus/ebus.c
==============================================================================
--- head/sys/sparc64/ebus/ebus.c	Tue Dec 22 21:48:18 2009	(r200878)
+++ head/sys/sparc64/ebus/ebus.c	Tue Dec 22 21:49:53 2009	(r200879)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 1999, 2000 Matthew R. Green
  * Copyright (c) 2001 Thomas Moestl 
+ * Copyright (c) 2009 by Marius Strobl 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +34,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * UltraSPARC 5 and beyond EBus support
+ * Driver for JBus to EBus and PCI to EBus bridges
  */
 
 #include 
@@ -43,14 +44,17 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-
 #include 
 
 #include 
 #include 
 #include 
 
+#include 
+#ifndef SUN4V
+#include 
+#endif
+#include 
 #include 
 
 #include 
@@ -59,11 +63,19 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /*
- * The register, ranges and interrupt map properties are identical to the ISA
- * ones.
+ * The register, interrupt map and for the PCI variant also the ranges
+ * properties are identical to the ISA ones.
  */
 #include 
 
+struct ebus_nexus_ranges {
+	uint32_t	child_hi;
+	uint32_t	child_lo;
+	uint32_t	phys_hi;
+	uint32_t	phys_lo;
+	uint32_t	size;
+};
+
 struct ebus_devinfo {
 	struct ofw_bus_devinfo	edi_obdinfo;
 	struct resource_list	edi_rl;
@@ -76,32 +88,45 @@ struct ebus_rinfo {
 };
 
 struct ebus_softc {
-	struct isa_ranges	*sc_range;
+	void			*sc_range;
 	struct ebus_rinfo	*sc_rinfo;
 
+	u_int			sc_flags;
+#define	EBUS_PCI		(1 << 0)
+
 	int			sc_nrange;
 
 	struct ofw_bus_iinfo	sc_iinfo;
+
+#ifndef SUN4V
+	uint32_t		sc_ign;
+#endif
 };
 
-static device_probe_t ebus_probe;
-static device_attach_t ebus_attach;
+static device_probe_t ebus_nexus_probe;
+static device_attach_t ebus_nexus_attach;
+static device_probe_t ebus_pci_probe;
+static device_attach_t ebus_pci_attach;
 static bus_print_child_t ebus_print_child;
 static bus_probe_nomatch_t ebus_probe_nomatch;
 static bus_alloc_resource_t ebus_alloc_resource;
 static bus_release_resource_t ebus_release_resource;
+static bus_setup_intr_t ebus_setup_intr;
 static bus_get_resource_list_t ebus_get_resource_list;
 static ofw_bus_get_devinfo_t ebus_get_devinfo;
 
-static struct ebus_devinfo *ebus_setup_dinfo(device_t, struct ebus_softc *,
-    phandle_t);
-static void ebus_destroy_dinfo(struct ebus_devinfo *);
-static int ebus_print_res(struct ebus_devinfo *);
+static int ebus_attach(device_t dev, struct ebus_softc *sc, phandle_t node);
+static struct ebus_devinfo *ebus_setup_dinfo(device_t dev,
+    struct ebus_softc *sc, phandle_t node);
+static void ebus_destroy_dinfo(struct ebus_devinfo *edi);
+static int ebus_print_res(struct ebus_devinfo *edi);
+
+static devclass_t ebus_devclass;
 
-static device_method_t ebus_methods[] = {
+static device_method_t ebus_nexus_methods[] = {
 	/* Device interface */
-	DEVMETHOD(device_probe,		ebus_probe),
-	DEVMETHOD(device_attach,	ebus_attach),
+	DEVMETHOD(device_probe,		ebus_nexus_probe),
+	DEVMETHOD(device_attach,	ebus_nexus_attach),
 	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
 	DEVMETHOD(device_suspend,	bus_generic_suspend),
 	DEVMETHOD(device_resume,	bus_generic_resume),
@@ -113,7 +138,7 @@ static device_method_t ebus_methods[] = 
 	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
 	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
 	DEVMETHOD(bus_release_resource,	ebus_release_resource),
-	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
+	DEVMETHOD(bus_setup_intr,	ebus_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
 	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
 	DEVMETHOD(bus_get_resource_list, ebus_get_resource_list),
@@ -130,21 +155,80 @@ static device_method_t ebus_methods[] = 
 	KOBJMETHOD_END
 };
 
-static driver_t ebus_driver = {
+static driver_t ebus_nexus_driver = {
 	"ebus",
-	ebus_methods,
+	ebus_nexus_methods,
 	sizeof(struct ebus_softc),
 };
 
-static devclass_t ebus_devclass;
+/*
+ * NB: we rely on the interrupt controllers of the accompanying PCI-Express
+ * bridge to be registered as the nexus variant of the EBus bridges doesn't
+ * employ its own one.
+ */
+EARLY_DRIVER_MODULE(ebus, nexus, ebus_nexus_driver, ebus_devclass, 0, 0,
+    BUS_PASS_BUS + 1);
+MODULE_DEPEND(ebus, nexus, 1, 1, 1);
+
+static device_method_t ebus_pci_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		ebus_pci_probe),
+	DEVMETHOD(device_attach,	ebus_pci_attach),
+	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
+	DEVMETHOD(device_suspend,	bus_generic_suspend),
+	DEVMETHOD(device_resume,	bus_generic_resume),
 
-EARLY_DRIVER_MODULE(ebus, pci, ebus_driver, ebus_devclass, 0, 0,
+	/* Bus interface */
+	DEVMETHOD(bus_print_child,	ebus_print_child),
+	DEVMETHOD(bus_probe_nomatch,	ebus_probe_nomatch),
+	DEVMETHOD(bus_alloc_resource,	ebus_alloc_resource),
+	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+	DEVMETHOD(bus_release_resource,	ebus_release_resource),
+	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
+	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
+	DEVMETHOD(bus_get_resource_list, ebus_get_resource_list),
+	DEVMETHOD(bus_child_pnpinfo_str, ofw_bus_gen_child_pnpinfo_str),
+
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_devinfo,	ebus_get_devinfo),
+	DEVMETHOD(ofw_bus_get_compat,	ofw_bus_gen_get_compat),
+	DEVMETHOD(ofw_bus_get_model,	ofw_bus_gen_get_model),
+	DEVMETHOD(ofw_bus_get_name,	ofw_bus_gen_get_name),
+	DEVMETHOD(ofw_bus_get_node,	ofw_bus_gen_get_node),
+	DEVMETHOD(ofw_bus_get_type,	ofw_bus_gen_get_type),
+
+	KOBJMETHOD_END
+};
+
+static driver_t ebus_pci_driver = {
+	"ebus",
+	ebus_pci_methods,
+	sizeof(struct ebus_softc),
+};
+
+EARLY_DRIVER_MODULE(ebus, pci, ebus_pci_driver, ebus_devclass, 0, 0,
     BUS_PASS_BUS);
 MODULE_DEPEND(ebus, pci, 1, 1, 1);
 MODULE_VERSION(ebus, 1);
 
 static int
-ebus_probe(device_t dev)
+ebus_nexus_probe(device_t dev)
+{
+	const char* compat;
+
+	compat = ofw_bus_get_compat(dev);
+	if (compat != NULL && strcmp(ofw_bus_get_name(dev), "ebus") == 0 &&
+	    strcmp(compat, "jbus-ebus") == 0) {
+		device_set_desc(dev, "JBus-EBus bridge");
+		return (BUS_PROBE_GENERIC);
+	}
+	return (ENXIO);
+}
+
+static int
+ebus_pci_probe(device_t dev)
 {
 
 	if (pci_get_class(dev) != PCIC_BRIDGE ||
@@ -158,27 +242,58 @@ ebus_probe(device_t dev)
 		device_set_desc(dev, "PCI-EBus3 bridge");
 	else
 		return (ENXIO);
-	return (0);
+	return (BUS_PROBE_GENERIC);
 }
 
 static int
-ebus_attach(device_t dev)
+ebus_nexus_attach(device_t dev)
+{
+	struct ebus_softc *sc;
+	phandle_t node;
+
+	sc = device_get_softc(dev);
+	node = ofw_bus_get_node(dev);
+
+#ifndef SUN4V
+	if (OF_getprop(node, "portid", &sc->sc_ign,
+	    sizeof(sc->sc_ign)) == -1) {
+		device_printf(dev, "could not determine IGN");
+		return (ENXIO);
+	}
+#endif
+
+	sc->sc_nrange = OF_getprop_alloc(node, "ranges",
+	    sizeof(struct ebus_nexus_ranges), &sc->sc_range);
+	if (sc->sc_nrange == -1) {
+		printf("%s: could not get ranges property\n", __func__);
+		return (ENXIO);
+	}
+	return (ebus_attach(dev, sc, node));
+}
+
+static int
+ebus_pci_attach(device_t dev)
 {
 	struct ebus_softc *sc;
-	struct ebus_devinfo *edi;
 	struct ebus_rinfo *eri;
 	struct resource *res;
-	device_t cdev;
 	phandle_t node;
 	int i, rnum, rid;
 
 	sc = device_get_softc(dev);
+	sc->sc_flags |= EBUS_PCI;
+
+	pci_write_config(dev, PCIR_COMMAND,
+	    pci_read_config(dev, PCIR_COMMAND, 2) | PCIM_CMD_SERRESPEN |
+	    PCIM_CMD_PERRESPEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MEMEN, 2);
+	pci_write_config(dev, PCIR_CACHELNSZ, 16 /* 64 bytes */, 1);
+	pci_write_config(dev, PCIR_LATTIMER, 64 /* 64 PCI cycles */, 1);
 
 	node = ofw_bus_get_node(dev);
 	sc->sc_nrange = OF_getprop_alloc(node, "ranges",
-	    sizeof(*sc->sc_range), (void **)&sc->sc_range);
+	    sizeof(struct isa_ranges), &sc->sc_range);
 	if (sc->sc_nrange == -1) {
-		printf("ebus_attach: could not get ranges property\n");
+		printf("%s: could not get ranges property\n", __func__);
 		return (ENXIO);
 	}
 
@@ -188,29 +303,52 @@ ebus_attach(device_t dev)
 	/* For every range, there must be a matching resource. */
 	for (rnum = 0; rnum < sc->sc_nrange; rnum++) {
 		eri = &sc->sc_rinfo[rnum];
-		eri->eri_rtype = ofw_isa_range_restype(&sc->sc_range[rnum]);
+		eri->eri_rtype = ofw_isa_range_restype(
+		    &((struct isa_ranges *)sc->sc_range)[rnum]);
 		rid = PCIR_BAR(rnum);
 		res = bus_alloc_resource_any(dev, eri->eri_rtype, &rid,
 		    RF_ACTIVE);
 		if (res == NULL) {
-			printf("ebus_attach: failed to allocate range "
-			    "resource!\n");
+			printf("%s: failed to allocate range resource!\n",
+			    __func__);
 			goto fail;
 		}
 		eri->eri_res = res;
 		eri->eri_rman.rm_type = RMAN_ARRAY;
 		eri->eri_rman.rm_descr = "EBus range";
 		if (rman_init(&eri->eri_rman) != 0) {
-			printf("ebus_attach: failed to initialize rman!");
+			printf("%s: failed to initialize rman!", __func__);
 			goto fail;
 		}
 		if (rman_manage_region(&eri->eri_rman, rman_get_start(res),
 		    rman_get_end(res)) != 0) {
-			printf("ebus_attach: failed to register region!");
+			printf("%s: failed to register region!", __func__);
 			rman_fini(&eri->eri_rman);
 			goto fail;
 		}
 	}
+	return (ebus_attach(dev, sc, node));
+
+ fail:
+	for (i = rnum; i >= 0; i--) {
+		eri = &sc->sc_rinfo[i];
+		if (i < rnum)
+			rman_fini(&eri->eri_rman);
+		if (eri->eri_res != 0) {
+			bus_release_resource(dev, eri->eri_rtype,
+			    PCIR_BAR(rnum), eri->eri_res);
+		}
+	}
+	free(sc->sc_rinfo, M_DEVBUF);
+	free(sc->sc_range, M_OFWPROP);
+	return (ENXIO);
+}
+
+static int
+ebus_attach(device_t dev, struct ebus_softc *sc, phandle_t node)
+{
+	struct ebus_devinfo *edi;
+	device_t cdev;
 
 	ofw_bus_setup_iinfo(node, &sc->sc_iinfo, sizeof(ofw_isa_intr_t));
 
@@ -229,20 +367,6 @@ ebus_attach(device_t dev)
 		device_set_ivars(cdev, edi);
 	}
 	return (bus_generic_attach(dev));
-
-fail:
-	for (i = rnum; i >= 0; i--) {
-		eri = &sc->sc_rinfo[i];
-		if (i < rnum)
-			rman_fini(&eri->eri_rman);
-		if (eri->eri_res != 0) {
-			bus_release_resource(dev, eri->eri_rtype,
-			    PCIR_BAR(rnum), eri->eri_res);
-		}
-	}
-	free(sc->sc_rinfo, M_DEVBUF);
-	free(sc->sc_range, M_OFWPROP);
-	return (ENXIO);
 }
 
 static int
@@ -274,28 +398,26 @@ ebus_alloc_resource(device_t bus, device
 	struct resource_list_entry *rle = NULL;
 	struct resource *res;
 	struct ebus_rinfo *ri;
+	struct ebus_nexus_ranges *enr;
 	bus_space_tag_t bt;
 	bus_space_handle_t bh;
-	int passthrough = (device_get_parent(child) != bus);
-	int isdefault = (start == 0UL && end == ~0UL);
-	int ridx, rv;
+	uint64_t cend, cstart, offset;
+	int i, isdefault, passthrough, ridx, rv;
 
-	sc = (struct ebus_softc *)device_get_softc(bus);
+	isdefault = (start == 0UL && end == ~0UL);
+	passthrough = (device_get_parent(child) != bus);
+	sc = device_get_softc(bus);
 	rl = BUS_GET_RESOURCE_LIST(bus, child);
-	/*
-	 * Map EBus ranges to PCI ranges.  This may include changing the
-	 * allocation type.
-	 */
 	switch (type) {
 	case SYS_RES_MEMORY:
 		KASSERT(!(isdefault && passthrough),
-		    ("ebus_alloc_resource: passthrough of default alloc"));
+		    ("%s: passthrough of default allocation", __func__));
 		if (!passthrough) {
 			rle = resource_list_find(rl, type, *rid);
 			if (rle == NULL)
 				return (NULL);
 			KASSERT(rle->res == NULL,
-			    ("ebus_alloc_resource: resource entry is busy"));
+			    ("%s: resource entry is busy", __func__));
 			if (isdefault) {
 				start = rle->start;
 				count = ulmax(count, rle->count);
@@ -303,25 +425,53 @@ ebus_alloc_resource(device_t bus, device
 			}
 		}
 
-		(void)ofw_isa_range_map(sc->sc_range, sc->sc_nrange,
-		    &start, &end, &ridx);
+		res = NULL;
+		if ((sc->sc_flags & EBUS_PCI) != 0) {
+			/*
+			 * Map EBus ranges to PCI ranges.  This may include
+			 * changing the allocation type.
+			 */
+			(void)ofw_isa_range_map(sc->sc_range, sc->sc_nrange,
+			    &start, &end, &ridx);
+			ri = &sc->sc_rinfo[ridx];
+			res = rman_reserve_resource(&ri->eri_rman, start, end,
+			    count, flags, child);
+			if (res == NULL)
+				return (NULL);
+			rman_set_rid(res, *rid);
+			bt = rman_get_bustag(ri->eri_res);
+			rman_set_bustag(res, bt);
+			rv = bus_space_subregion(bt,
+			    rman_get_bushandle(ri->eri_res),
+			    rman_get_start(res) - rman_get_start(ri->eri_res),
+			    count, &bh);
+			if (rv != 0) {
+				rman_release_resource(res);
+				return (NULL);
+			}
+			rman_set_bushandle(res, bh);
+		} else {
+			/* Map EBus ranges to nexus ranges. */
+			for (i = 0; i < sc->sc_nrange; i++) {
+				enr = &((struct ebus_nexus_ranges *)
+				    sc->sc_range)[i];
+				cstart = (((uint64_t)enr->child_hi) << 32) |
+				    enr->child_lo;
+				cend = cstart + enr->size - 1;
+				if (start >= cstart && end <= cend) {
+					offset =
+					    (((uint64_t)enr->phys_hi) << 32) |
+					    enr->phys_lo;
+					start += offset - cstart;
+					end += offset - cstart;
+					res = bus_generic_alloc_resource(bus,
+					    child, type, rid, start, end,
+					    count, flags);
+					break;
+				}
+			}
 
-		ri = &sc->sc_rinfo[ridx];
-		res = rman_reserve_resource(&ri->eri_rman, start, end, count,
-		    flags, child);
-		if (res == NULL)
-			return (NULL);
-		rman_set_rid(res, *rid);
-		bt = rman_get_bustag(ri->eri_res);
-		rman_set_bustag(res, bt);
-		rv = bus_space_subregion(bt, rman_get_bushandle(ri->eri_res),
-		    rman_get_start(res) - rman_get_start(ri->eri_res), count,
-		    &bh);
-		if (rv != 0) {
-			rman_release_resource(res);
-			return (NULL);
 		}
-		rman_set_bushandle(res, bh);
 		if (!passthrough)
 			rle->res = res;
 		return (res);
@@ -336,34 +486,77 @@ static int
 ebus_release_resource(device_t bus, device_t child, int type, int rid,
     struct resource *res)
 {
+	struct ebus_softc *sc;
 	struct resource_list *rl;
 	struct resource_list_entry *rle;
-	int passthrough = (device_get_parent(child) != bus);
-	int rv;
+	int passthrough, rv;
 
+	passthrough = (device_get_parent(child) != bus);
 	rl = BUS_GET_RESOURCE_LIST(bus, child);
 	switch (type) {
 	case SYS_RES_MEMORY:
+		sc = device_get_softc(bus);
+		if ((sc->sc_flags & EBUS_PCI) == 0)
+			return (resource_list_release(rl, bus, child, type,
+			    rid, res));
 		if ((rv = rman_release_resource(res)) != 0)
 			return (rv);
 		if (!passthrough) {
 			rle = resource_list_find(rl, type, rid);
-			KASSERT(rle != NULL, ("ebus_release_resource: "
-			    "resource entry not found!"));
-			KASSERT(rle->res != NULL, ("ebus_alloc_resource: "
-			    "resource entry is not busy"));
+			KASSERT(rle != NULL,
+			    ("%s: resource entry not found!", __func__));
+			KASSERT(rle->res != NULL,
+			   ("%s: resource entry is not busy", __func__));
 			rle->res = NULL;
 		}
 		break;
 	case SYS_RES_IRQ:
 		return (resource_list_release(rl, bus, child, type, rid, res));
 	default:
-		panic("ebus_release_resource: unsupported resource type %d",
-		    type);
+		panic("%s: unsupported resource type %d", __func__, type);
 	}
 	return (0);
 }
 
+static int
+ebus_setup_intr(device_t dev, device_t child, struct resource *ires,
+    int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
+    void **cookiep)
+{
+#ifndef SUN4V
+	struct ebus_softc *sc;
+	u_long vec;
+
+	sc = device_get_softc(dev);
+	if ((sc->sc_flags & EBUS_PCI) == 0) {
+		/*
+		 * Make sure the vector is fully specified.  This isn't
+		 * necessarily the case with the PCI variant.
+		 */
+		vec = rman_get_start(ires);
+		if (INTIGN(vec) != sc->sc_ign) {
+			device_printf(dev,
+			    "invalid interrupt vector 0x%lx\n", vec);
+			return (EINVAL);
+		}
+
+		/*
+		 * As we rely on the interrupt controllers of the
+		 * accompanying PCI-Express bridge ensure at least
+		 * something is registered for this vector.
+		 */
+		if (intr_vectors[vec].iv_ic == NULL) {
+			device_printf(dev,
+			    "invalid interrupt controller for vector 0x%lx\n",
+			    vec);
+			return (EINVAL);
+		}
+	}
+#endif
+	return (bus_generic_setup_intr(dev, child, ires, flags, filt, intr,
+	    arg, cookiep));
+}
+
 static struct resource_list *
 ebus_get_resource_list(device_t dev, device_t child)
 {
@@ -385,12 +578,13 @@ ebus_get_devinfo(device_t bus, device_t 
 static struct ebus_devinfo *
 ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node)
 {
+	struct isa_regs reg, *regs;
+	ofw_isa_intr_t intr, *intrs;
 	struct ebus_devinfo *edi;
-	struct isa_regs *reg;
-	ofw_isa_intr_t *intrs;
-	ofw_pci_intr_t rintr;
-	u_int64_t start;
-	int nreg, nintr, i;
+	uint64_t start;
+	uint32_t rintr;
+	int i, nintr, nreg, rv;
+	uint8_t maskbuf[sizeof(reg) + sizeof(intr)];
 
 	edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK);
 	if (ofw_bus_gen_setup_devinfo(&edi->edi_obdinfo, node) != 0) {
@@ -398,40 +592,51 @@ ebus_setup_dinfo(device_t dev, struct eb
 		return (NULL);
 	}
 	resource_list_init(&edi->edi_rl);
-	nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®);
+	nreg = OF_getprop_alloc(node, "reg", sizeof(*regs), (void **)®s);
 	if (nreg == -1) {
 		device_printf(dev, "<%s>: incomplete\n",
 		    edi->edi_obdinfo.obd_name);
-		goto fail;
+		ebus_destroy_dinfo(edi);
+		return (NULL);
 	}
 	for (i = 0; i < nreg; i++) {
-		start = ISA_REG_PHYS(reg + i);
-		resource_list_add(&edi->edi_rl, SYS_RES_MEMORY, i,
-		    start, start + reg[i].size - 1, reg[i].size);
+		start = ISA_REG_PHYS(regs + i);
+		(void)resource_list_add(&edi->edi_rl, SYS_RES_MEMORY, i,
+		    start, start + regs[i].size - 1, regs[i].size);
 	}
-	free(reg, M_OFWPROP);
+	free(regs, M_OFWPROP);
 
 	nintr = OF_getprop_alloc(node, "interrupts",  sizeof(*intrs),
 	    (void **)&intrs);
+	if (nintr == -1)
+		return (edi);
 	for (i = 0; i < nintr; i++) {
-		rintr = ofw_isa_route_intr(dev, node, &sc->sc_iinfo, intrs[i]);
-		if (rintr == PCI_INVALID_IRQ) {
+		rv = 0;
+		if ((sc->sc_flags & EBUS_PCI) != 0) {
+			rintr = ofw_isa_route_intr(dev, node, &sc->sc_iinfo,
+			    intrs[i]);
+		} else {
+			intr = intrs[i];
+			rv = ofw_bus_lookup_imap(node, &sc->sc_iinfo, ®,
+			    sizeof(reg), &intr, sizeof(intr), &rintr,
+			    sizeof(rintr), maskbuf);
+#ifndef SUN4V
+			if (rv != 0)
+				rintr = INTMAP_VEC(sc->sc_ign, rintr);
+#endif
+		}
+		if ((sc->sc_flags & EBUS_PCI) == 0 ? rv == 0 :
+		    rintr == PCI_INVALID_IRQ) {
 			device_printf(dev,
 			    "<%s>: could not map EBus interrupt %d\n",
 			    edi->edi_obdinfo.obd_name, intrs[i]);
-			free(intrs, M_OFWPROP);
-			goto fail;
+			continue;
 		}
-		resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i,
-		    rintr, rintr, 1);
+		(void)resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i, rintr,
+		    rintr, 1);
 	}
 	free(intrs, M_OFWPROP);
-
 	return (edi);
-
-fail:
-	ebus_destroy_dinfo(edi);
-	return (NULL);
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 21:53:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B3121106568B;
	Tue, 22 Dec 2009 21:53:19 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A22138FC0A;
	Tue, 22 Dec 2009 21:53:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMLrJmm077821;
	Tue, 22 Dec 2009 21:53:19 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMLrJaJ077819;
	Tue, 22 Dec 2009 21:53:19 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912222153.nBMLrJaJ077819@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 22 Dec 2009 21:53:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200880 - head/sys/sparc64/isa
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 21:53:19 -0000

Author: marius
Date: Tue Dec 22 21:53:19 2009
New Revision: 200880
URL: http://svn.freebsd.org/changeset/base/200880

Log:
  - Correct an off-by-one error when calculating the end of a child
    range.
  - Spell the PCI TLA in uppercase.

Modified:
  head/sys/sparc64/isa/ofw_isa.c

Modified: head/sys/sparc64/isa/ofw_isa.c
==============================================================================
--- head/sys/sparc64/isa/ofw_isa.c	Tue Dec 22 21:49:53 2009	(r200879)
+++ head/sys/sparc64/isa/ofw_isa.c	Tue Dec 22 21:53:19 2009	(r200880)
@@ -79,11 +79,11 @@ ofw_isa_range_map(struct isa_ranges *ran
 	for (i = 0; i < nrange; i++) {
 		r = &range[i];
 		cstart = ISA_RANGE_CHILD(r);
-		cend = cstart + r->size;
+		cend = cstart + r->size - 1;
 		if (*start < cstart || *start > cend)
 			continue;
 		if (*end < cstart || *end > cend) {
-			panic("ofw_isa_map_iorange: iorange crosses pci "
+			panic("ofw_isa_map_iorange: iorange crosses PCI "
 			    "ranges (%#lx not in %#lx - %#lx)", *end, cstart,
 			    cend);
 		}

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 22:11:18 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3FEC1065695;
	Tue, 22 Dec 2009 22:11:18 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.geekcn.org (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id C06D08FC19;
	Tue, 22 Dec 2009 22:11:16 +0000 (UTC)
Received: from mail.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id D721CA5A1A2;
	Wed, 23 Dec 2009 06:11:11 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by mail.geekcn.org (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with LMTP id 3QZXoI3PdWwU; Wed, 23 Dec 2009 06:10:52 +0800 (CST)
Received: from delta.delphij.net (drawbridge.ixsystems.com [206.40.55.65])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id F3C14A5A123;
	Wed, 23 Dec 2009 06:10:45 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:content-type;
	b=Nq70/p4u9OaFsBm2KFdbh1Le8aCF5i1AgLWRbqycBnSZYFy0ThNRowKqcQGAEPl8Q
	hlZKWDMBXO+EV18HYhHdg==
Message-ID: <4B3143CE.1000608@delphij.net>
Date: Tue, 22 Dec 2009 14:10:22 -0800
From: Xin LI 
Organization: The Geek China Organization
User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US;
	rv:1.9.1.5) Gecko/20091220 Thunderbird/3.0 ThunderBrowse/3.2.6.8
MIME-Version: 1.0
To: Stanislav Sedov 
References: <200912212012.nBLKC2aS039479@svn.freebsd.org>
	<20091222133217.aad538b0.stas@FreeBSD.org>
In-Reply-To: <20091222133217.aad538b0.stas@FreeBSD.org>
Content-Type: multipart/mixed; boundary="------------050907050800030009080600"
Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG,
	src-committers@FreeBSD.ORG, Xin LI 
Subject: Re: svn commit: r200806 - head/usr.sbin/newsyslog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 22:11:18 -0000

This is a multi-part message in MIME format.
--------------050907050800030009080600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 2009/12/22 13:32, Stanislav Sedov wrote:
> On Mon, 21 Dec 2009 20:12:02 +0000 (UTC)
> Xin LI  mentioned:
>
>> Author: delphij
>> Date: Mon Dec 21 20:12:01 2009
>> New Revision: 200806
>> URL: http://svn.freebsd.org/changeset/base/200806
>>
>> Log:
>>    Don't consider non-existence of a PID file an error, we should be able
>>    to proceed anyway as this most likely mean that the process has been
>>    terminated.
>
> Or the process has not created the PID file and can be screwed up by rotating
> its log file.  What about making this optional controlled by a command line
> switch?  It might be a more safe alternative.

Yes probably.  I think the both case (can't find the PID file, or the 
PID file is empty) should be counted, as they may represent the similar 
situation, however, I think we'd better leave the current behavior 
default, since it's the most case.

Do you think the attached patch makes sense?

Cheers,
-- 
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die

--------------050907050800030009080600
Content-Type: text/plain;
 name="newsyslog-option.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="newsyslog-option.diff"

Index: newsyslog.8
===================================================================
--- newsyslog.8	(revision 200868)
+++ newsyslog.8	(working copy)
@@ -17,7 +17,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd February 24, 2005
+.Dd December 23, 2009
 .Dt NEWSYSLOG 8
 .Os
 .Sh NAME
@@ -25,7 +25,7 @@
 .Nd maintain system log files to manageable sizes
 .Sh SYNOPSIS
 .Nm
-.Op Fl CFNnrsv
+.Op Fl CFNPnrsv
 .Op Fl R Ar tagname
 .Op Fl a Ar directory
 .Op Fl d Ar directory
@@ -169,6 +169,10 @@
 or
 .Fl CC
 options when creating log files is the only objective.
+.It Fl P
+Prevent further action if we should send signal but the
+.Dq pidfile
+is empty or does not exist.
 .It Fl R Ar tagname
 Specify that
 .Nm
Index: newsyslog.c
===================================================================
--- newsyslog.c	(revision 200868)
+++ newsyslog.c	(working copy)
@@ -167,6 +167,7 @@
 int noaction = 0;		/* Don't do anything, just show it */
 int norotate = 0;		/* Don't rotate */
 int nosignal;			/* Do not send any signals */
+int enforcepid = 0;		/* If PID file does not exist or empty, do nothing */
 int force = 0;			/* Force the trim no matter what */
 int rotatereq = 0;		/* -R = Always rotate the file(s) as given */
 				/*    on the command (this also requires   */
@@ -580,7 +581,7 @@
 		*p = '\0';
 
 	/* Parse command line options. */
-	while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FNR:")) != -1)
+	while ((ch = getopt(argc, argv, "a:d:f:nrsvCD:FNR:P")) != -1)
 		switch (ch) {
 		case 'a':
 			archtodir++;
@@ -624,6 +625,8 @@
 		case 'N':
 			norotate++;
 			break;
+		case 'P':
+			enforcepid++;
 		case 'R':
 			rotatereq++;
 			requestor = strdup(optarg);
@@ -1779,7 +1782,7 @@
 
 	f = fopen(ent->pid_file, "r");
 	if (f == NULL) {
-		if (errno == ENOENT) {
+		if (errno == ENOENT && enforcepid == 0) {
 			/*
 			 * Warn if the PID file doesn't exist, but do
 			 * not consider it an error.  Most likely it
@@ -1801,7 +1804,7 @@
 		 * has terminated, so it should be safe to rotate any
 		 * log files that the process would have been using.
 		 */
-		if (feof(f)) {
+		if (feof(f) && enforcepid == 0) {
 			swork->sw_pidok = 1;
 			warnx("pid file is empty: %s", ent->pid_file);
 		} else

--------------050907050800030009080600--

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 22:15:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBCD4106566B;
	Tue, 22 Dec 2009 22:15:52 +0000 (UTC)
	(envelope-from cognet@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BABA68FC17;
	Tue, 22 Dec 2009 22:15:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMMFqCR078328;
	Tue, 22 Dec 2009 22:15:52 GMT (envelope-from cognet@svn.freebsd.org)
Received: (from cognet@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMMFq0j078326;
	Tue, 22 Dec 2009 22:15:52 GMT (envelope-from cognet@svn.freebsd.org)
Message-Id: <200912222215.nBMMFq0j078326@svn.freebsd.org>
From: Olivier Houchard 
Date: Tue, 22 Dec 2009 22:15:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200881 - head/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 22:15:52 -0000

Author: cognet
Date: Tue Dec 22 22:15:52 2009
New Revision: 200881
URL: http://svn.freebsd.org/changeset/base/200881

Log:
  Don't name parameters, for consistency with the rest of the file, and because
  it breaks third-party apps.
  
  Submitted by:	gahr

Modified:
  head/include/signal.h

Modified: head/include/signal.h
==============================================================================
--- head/include/signal.h	Tue Dec 22 21:53:19 2009	(r200880)
+++ head/include/signal.h	Tue Dec 22 22:15:52 2009	(r200881)
@@ -99,12 +99,12 @@ int	sigwaitinfo(const sigset_t * __restr
 #if __XSI_VISIBLE
 int	killpg(__pid_t, int);
 int	sigaltstack(const stack_t * __restrict, stack_t * __restrict); 
-int	sighold(int sig);
-int	sigignore(int sig);
-int	sigpause(int sigmask);
-int	sigrelse(int sig);
-void	(*sigset(int sig, void (*disp)(int)))(int);
-int	xsi_sigpause(int sig);
+int	sighold(int);
+int	sigignore(int);
+int	sigpause(int);
+int	sigrelse(int);
+void	(*sigset(int, void (*)(int)))(int);
+int	xsi_sigpause(int);
 #endif
 
 #if __XSI_VISIBLE >= 600

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 22:25:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 527CB10656D4;
	Tue, 22 Dec 2009 22:25:39 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 215D68FC18;
	Tue, 22 Dec 2009 22:25:39 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id ADFAE46B17;
	Tue, 22 Dec 2009 17:25:38 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id E35E18A01B;
	Tue, 22 Dec 2009 17:25:37 -0500 (EST)
From: John Baldwin 
To: Marius Strobl 
Date: Tue, 22 Dec 2009 17:20:00 -0500
User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; )
References: <200912222102.nBML2k98076576@svn.freebsd.org>
In-Reply-To: <200912222102.nBML2k98076576@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-Id: <200912221720.00692.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 22 Dec 2009 17:25:37 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200874 - in head/sys: dev/auxio sparc64/central
	sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 22:25:39 -0000

On Tuesday 22 December 2009 4:02:46 pm Marius Strobl wrote:
> Author: marius
> Date: Tue Dec 22 21:02:46 2009
> New Revision: 200874
> URL: http://svn.freebsd.org/changeset/base/200874
> 
> Log:
>   Enroll these drivers in multipass probing. The motivation behind this
>   is that the JBus to EBus bridges share the interrupt controller of a
>   sibling JBus to PCIe bridge (at least as far as the OFW device tree
>   is concerned, in reality they are part of the same chip) so we have to
>   probe and attach the latter first. That happens to be also the case
>   due to the fact that the JBus to PCIe bridges appear first in the OFW
>   device tree but it doesn't hurt to ensure the right order.

Hmm, I'm curious why you used BUS_PASS_DEFAULT with EARLY_DRIVER_MODULE()?  
The intent was that EARLY_DRIVER_MODULE() only really be used for drivers that 
used a pass other than BUS_PASS_DEFAULT.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 23:21:47 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB420106568D;
	Tue, 22 Dec 2009 23:21:47 +0000 (UTC)
	(envelope-from stas@FreeBSD.org)
Received: from mx0.deglitch.com (backbone.deglitch.com
	[IPv6:2001:16d8:fffb:4::abba])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E86C8FC18;
	Tue, 22 Dec 2009 23:21:47 +0000 (UTC)
Received: from orion.SpringDaemons.com
	(adsl-99-48-191-9.dsl.snfc21.sbcglobal.net [99.48.191.9])
	by mx0.deglitch.com (Postfix) with ESMTPA id 285388FC4E;
	Wed, 23 Dec 2009 02:21:45 +0300 (MSK)
Received: from orion (localhost [127.0.0.1])
	by orion.SpringDaemons.com (Postfix) with SMTP id 57BF739C24;
	Tue, 22 Dec 2009 15:21:38 -0800 (PST)
Date: Tue, 22 Dec 2009 15:21:33 -0800
From: Stanislav Sedov 
To: d@delphij.net
Message-Id: <20091222152133.526509ab.stas@FreeBSD.org>
In-Reply-To: <4B3143CE.1000608@delphij.net>
References: <200912212012.nBLKC2aS039479@svn.freebsd.org>
	<20091222133217.aad538b0.stas@FreeBSD.org>
	<4B3143CE.1000608@delphij.net>
Organization: The FreeBSD Project
X-Mailer: carrier-pigeon
Mime-Version: 1.0
Content-Type: multipart/signed; protocol="application/pgp-signature";
	micalg="PGP-SHA1";
	boundary="Signature=_Tue__22_Dec_2009_15_21_33_-0800_FQuq+rQ=KhGuhZ2g"
Cc: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG,
	Stanislav Sedov , Xin LI ,
	svn-src-head@FreeBSD.ORG, Xin LI 
Subject: Re: svn commit: r200806 - head/usr.sbin/newsyslog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 23:21:47 -0000

--Signature=_Tue__22_Dec_2009_15_21_33_-0800_FQuq+rQ=KhGuhZ2g
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, 22 Dec 2009 14:10:22 -0800
Xin LI  mentioned:

> On 2009/12/22 13:32, Stanislav Sedov wrote:
> > On Mon, 21 Dec 2009 20:12:02 +0000 (UTC)
> > Xin LI  mentioned:
> >
> >> Author: delphij
> >> Date: Mon Dec 21 20:12:01 2009
> >> New Revision: 200806
> >> URL: http://svn.freebsd.org/changeset/base/200806
> >>
> >> Log:
> >>    Don't consider non-existence of a PID file an error, we should be a=
ble
> >>    to proceed anyway as this most likely mean that the process has been
> >>    terminated.
> >
> > Or the process has not created the PID file and can be screwed up by ro=
tating
> > its log file.  What about making this optional controlled by a command =
line
> > switch?  It might be a more safe alternative.
>=20
> Yes probably.  I think the both case (can't find the PID file, or the=20
> PID file is empty) should be counted, as they may represent the similar=20
> situation, however, I think we'd better leave the current behavior=20
> default, since it's the most case.
>=20
> Do you think the attached patch makes sense?
>=20

Yeah, thank you, it looks fine.

In my opinion, though, I'd left the old behavior as default, as it is somew=
hat safer.
But maybe I'm just too paranoic.:-)

--=20
Stanislav Sedov
ST4096-RIPE

--Signature=_Tue__22_Dec_2009_15_21_33_-0800_FQuq+rQ=KhGuhZ2g
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----

iQIcBAEBAgAGBQJLMVSCAAoJEL8lojEJL9nwCfgP/RvLoWdiifFAPcB6LkPPv9pl
9ScG60jWTPKA+R67NkoxiBM0v6oOq2qqpluWifx+SgDVsj4gFHdE8Ccm6Oyw7AYo
QC5vbarq/NwHQq1cx5iR70kLqPuo6UUI/j6clANp1dMX0QTb2AKoPYT+a9staT3Y
hkyVFaI9t9eNW/kDBoNaqPF2V731NkRO098E5CvZK3sxCRwRkBRvJBqxjhE05lM5
PBJUpWWoYpDBjUd8zL2Z33khSlqu/cGJ89eoj16LE5qFYWceLCxdk5rD6ssv1vRK
sY6LvjkjcFqjkpq3SXKEhPO1m241d8GD0rAbxZW6Jilpnz5nBe5A1NTW9eM579Zp
/Zu4qVq7jGWTMQ5Zgnxn6zES8xg5Rme6D2LFvHJJ9uRt59/mm1iVq62LbQX44SSk
3PoAmM2AyX2IDRxl+lbiLAVs1JLDcCx2NvH/H7DJ0bC0BGE1inNrozNRrYY2/ips
as1vB2yg9vtvjHFQOfKdsZfFzJD9+1FZ3aHWV+OYa4sHhYoaSaZ+1GY5XW1URxzo
HjTeXdCLEvM+MC5dh9tR65n9IGKGeJPaA6SMkSqRQogLr9j6Gx96ByYMDAMRglAD
aL8q/IkUoQaJlIuU4ZAqOJv6rCzt1w2HA4GWDjbQGiThq3OawVbNky73sn5GXvF+
lBsqcaVGaYlOyKowWFWT
=sEXE
-----END PGP SIGNATURE-----

--Signature=_Tue__22_Dec_2009_15_21_33_-0800_FQuq+rQ=KhGuhZ2g--

From owner-svn-src-head@FreeBSD.ORG  Tue Dec 22 23:57:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FF041065692;
	Tue, 22 Dec 2009 23:57:11 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E82E78FC15;
	Tue, 22 Dec 2009 23:57:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBMNvA6U080329;
	Tue, 22 Dec 2009 23:57:10 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBMNvA4X080326;
	Tue, 22 Dec 2009 23:57:10 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912222357.nBMNvA4X080326@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 22 Dec 2009 23:57:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200884 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 22 Dec 2009 23:57:11 -0000

Author: yongari
Date: Tue Dec 22 23:57:10 2009
New Revision: 200884
URL: http://svn.freebsd.org/changeset/base/200884

Log:
  Reimplement Tx status error handler as recommended by datasheet.
  If ste(4) encounter TX underrun or excessive collisions the TX MAC
  of controller is stalled so driver should wake it up again. TX
  underrun requires increasing TX threshold value to minimize
  further TX underruns. Previously ste(4) used to reset controller
  to recover from TX underrun, excessive collision and reclaiming
  error. However datasheet says only TX underrun requires resetting
  entire controller. So implement ste_restart_tx() that restarts TX
  MAC and do not perform full reset except TX underrun case.
  Now ste(4) uses CSR_READ_2 instead of CSR_READ_1 to read
  STE_TX_STATUS register. This way ste(4) will also read frame id
  value and we can write the same value back to STE_TX_FRAMEID
  register instead of overwriting it to 0. The datasheet was wrong
  in write back of STE_TX_STATUS so add some comments why we do so.
  Also always invoke ste_txeoc() after ste_txeof() in ste_poll as
  without reading TX status register can stall TX MAC.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Tue Dec 22 22:45:03 2009	(r200883)
+++ head/sys/dev/ste/if_ste.c	Tue Dec 22 23:57:10 2009	(r200884)
@@ -78,6 +78,9 @@ MODULE_DEPEND(ste, pci, 1, 1, 1);
 MODULE_DEPEND(ste, ether, 1, 1, 1);
 MODULE_DEPEND(ste, miibus, 1, 1, 1);
 
+/* Define to show Tx error status. */
+#define	STE_SHOW_TXERRORS
+
 /*
  * Various supported device vendors/types and their names.
  */
@@ -118,6 +121,7 @@ static int	ste_miibus_writereg(device_t,
 static int	ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *);
 static int	ste_read_eeprom(struct ste_softc *, caddr_t, int, int, int);
 static void	ste_reset(struct ste_softc *);
+static void	ste_restart_tx(struct ste_softc *);
 static int	ste_rxeof(struct ste_softc *, int);
 static void	ste_setmulti(struct ste_softc *);
 static void	ste_start(struct ifnet *);
@@ -627,6 +631,7 @@ ste_poll_locked(struct ifnet *ifp, enum 
 
 	rx_npkts = ste_rxeof(sc, count);
 	ste_txeof(sc);
+	ste_txeoc(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		ste_start_locked(ifp);
 
@@ -635,9 +640,6 @@ ste_poll_locked(struct ifnet *ifp, enum 
 
 		status = CSR_READ_2(sc, STE_ISR_ACK);
 
-		if (status & STE_ISR_TX_DONE)
-			ste_txeoc(sc);
-
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
@@ -788,35 +790,63 @@ ste_rxeof(struct ste_softc *sc, int coun
 static void
 ste_txeoc(struct ste_softc *sc)
 {
+	uint16_t txstat;
 	struct ifnet *ifp;
-	uint8_t txstat;
+
+	STE_LOCK_ASSERT(sc);
 
 	ifp = sc->ste_ifp;
 
-	while ((txstat = CSR_READ_1(sc, STE_TX_STATUS)) &
-	    STE_TXSTATUS_TXDONE) {
-		if (txstat & STE_TXSTATUS_UNDERRUN ||
-		    txstat & STE_TXSTATUS_EXCESSCOLLS ||
-		    txstat & STE_TXSTATUS_RECLAIMERR) {
+	/*
+	 * STE_TX_STATUS register implements a queue of up to 31
+	 * transmit status byte. Writing an arbitrary value to the
+	 * register will advance the queue to the next transmit
+	 * status byte. This means if driver does not read
+	 * STE_TX_STATUS register after completing sending more
+	 * than 31 frames the controller would be stalled so driver
+	 * should re-wake the Tx MAC. This is the most severe
+	 * limitation of ST201 based controller.
+	 */
+	for (;;) {
+		txstat = CSR_READ_2(sc, STE_TX_STATUS);
+		if ((txstat & STE_TXSTATUS_TXDONE) == 0)
+			break;
+		if ((txstat & (STE_TXSTATUS_UNDERRUN |
+		    STE_TXSTATUS_EXCESSCOLLS | STE_TXSTATUS_RECLAIMERR |
+		    STE_TXSTATUS_STATSOFLOW)) != 0) {
 			ifp->if_oerrors++;
-			device_printf(sc->ste_dev,
-			    "transmission error: %x\n", txstat);
-
-			ste_init_locked(sc);
-
-			if (txstat & STE_TXSTATUS_UNDERRUN &&
+#ifdef	STE_SHOW_TXERRORS
+			device_printf(sc->ste_dev, "TX error : 0x%b\n",
+			    txstat & 0xFF, STE_ERR_BITS);
+#endif
+			if ((txstat & STE_TXSTATUS_UNDERRUN) != 0 &&
 			    sc->ste_tx_thresh < STE_PACKET_SIZE) {
 				sc->ste_tx_thresh += STE_MIN_FRAMELEN;
+				if (sc->ste_tx_thresh > STE_PACKET_SIZE)
+					sc->ste_tx_thresh = STE_PACKET_SIZE;
 				device_printf(sc->ste_dev,
-				    "tx underrun, increasing tx"
+				    "TX underrun, increasing TX"
 				    " start threshold to %d bytes\n",
 				    sc->ste_tx_thresh);
+				/* Make sure to disable active DMA cycles. */
+				STE_SETBIT4(sc, STE_DMACTL,
+				    STE_DMACTL_TXDMA_STALL);
+				ste_wait(sc);
+				ste_init_locked(sc);
+				break;
 			}
-			CSR_WRITE_2(sc, STE_TX_STARTTHRESH, sc->ste_tx_thresh);
-			CSR_WRITE_2(sc, STE_TX_RECLAIM_THRESH,
-			    (STE_PACKET_SIZE >> 4));
+			/* Restart Tx. */
+			ste_restart_tx(sc);
 		}
-		ste_init_locked(sc);
+		/*
+		 * Advance to next status and ACK TxComplete
+		 * interrupt. ST201 data sheet was wrong here, to
+		 * get next Tx status, we have to write both
+		 * STE_TX_STATUS and STE_TX_FRAMEID register.
+		 * Otherwise controller returns the same status
+		 * as well as not acknowledge Tx completion
+		 * interrupt.
+		 */
 		CSR_WRITE_2(sc, STE_TX_STATUS, txstat);
 	}
 }
@@ -1713,6 +1743,26 @@ ste_reset(struct ste_softc *sc)
 		device_printf(sc->ste_dev, "global reset never completed\n");
 }
 
+static void
+ste_restart_tx(struct ste_softc *sc)
+{
+	uint16_t mac;
+	int i;
+
+	for (i = 0; i < STE_TIMEOUT; i++) {
+		mac = CSR_READ_2(sc, STE_MACCTL1);
+		mac |= STE_MACCTL1_TX_ENABLE;
+		CSR_WRITE_2(sc, STE_MACCTL1, mac);
+		mac = CSR_READ_2(sc, STE_MACCTL1);
+		if ((mac & STE_MACCTL1_TX_ENABLED) != 0)
+			break;
+		DELAY(10);
+	}
+
+	if (i == STE_TIMEOUT)
+		device_printf(sc->ste_dev, "starting Tx failed");
+}
+
 static int
 ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
 {
@@ -1952,8 +2002,8 @@ ste_watchdog(struct ste_softc *sc)
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
 
-	ste_txeoc(sc);
 	ste_txeof(sc);
+	ste_txeoc(sc);
 	ste_rxeof(sc, -1);
 	ste_init_locked(sc);
 

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Tue Dec 22 22:45:03 2009	(r200883)
+++ head/sys/dev/ste/if_stereg.h	Tue Dec 22 23:57:10 2009	(r200884)
@@ -253,6 +253,11 @@
 #define STE_TXSTATUS_TXINTR_REQ		0x40
 #define STE_TXSTATUS_TXDONE		0x80
 
+#define	STE_ERR_BITS			"\20"				\
+					"\2RECLAIM\3STSOFLOW"		\
+					"\4EXCESSCOLLS\5UNDERRUN"	\
+					"\6INTREQ\7DONE"
+
 #define STE_ISRACK_INTLATCH		0x0001
 #define STE_ISRACK_HOSTERR		0x0002
 #define STE_ISRACK_TX_DONE		0x0004

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 01:12:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A10971065670;
	Wed, 23 Dec 2009 01:12:55 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 776BD8FC1D;
	Wed, 23 Dec 2009 01:12:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN1Ctxk081878;
	Wed, 23 Dec 2009 01:12:55 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN1Ct7c081877;
	Wed, 23 Dec 2009 01:12:55 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200912230112.nBN1Ct7c081877@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 23 Dec 2009 01:12:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200885 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 01:12:55 -0000

Author: thompsa
Date: Wed Dec 23 01:12:54 2009
New Revision: 200885
URL: http://svn.freebsd.org/changeset/base/200885

Log:
  Sync usb vendor/product defines to p4
  
  Submitted by:	HPS

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Tue Dec 22 23:57:10 2009	(r200884)
+++ head/sys/dev/usb/usbdevs	Wed Dec 23 01:12:54 2009	(r200885)
@@ -328,6 +328,7 @@ vendor AVISION		0x0638	Avision
 vendor TEAC		0x0644	TEAC
 vendor SGI		0x065e	Silicon Graphics
 vendor SANWASUPPLY	0x0663	Sanwa Supply
+vendor MEGATEC		0x0665	Megatec
 vendor LINKSYS		0x066b	Linksys
 vendor ACERSA		0x066e	Acer Semiconductor America
 vendor SIGMATEL		0x066f	Sigmatel
@@ -666,6 +667,7 @@ vendor SITECOM		0x6189	Sitecom
 vendor ARKMICRO		0x6547	Arkmicro Technologies Inc.
 vendor 3COM2		0x6891	3Com
 vendor INTEL		0x8086	Intel
+vendor INTEL2		0x8087	Intel
 vendor SITECOM2		0x9016	Sitecom
 vendor MOSCHIP		0x9710	MosChip Semiconductor
 vendor MARVELL		0x9e88	Marvell Technology Group Ltd.
@@ -1062,6 +1064,7 @@ product CHIC CYPRESS		0x0003	Cypress USB
 
 /* Chicony products */
 product CHICONY KB8933		0x0001	KB-8933 keyboard
+product CHICONY CNF7129		0xb071	Notebook Web Camera
 product CHICONY2 TWINKLECAM	0x600d	TwinkleCam USB camera
 
 /* CH Products */
@@ -1629,6 +1632,7 @@ product INSYSTEM STORAGE_V2	0x5701	USB S
 /* Intel products */
 product INTEL EASYPC_CAMERA	0x0110	Easy PC Camera
 product INTEL TESTBOARD		0x9890	82930 test board
+product INTEL2 IRMH        	0x0020	Integrated Rate Matching Hub
 
 /* Intersil products */
 product INTERSIL PRISM_GT	0x1000	PrismGT USB 2.0 WLAN
@@ -2137,7 +2141,10 @@ product PHILIPS UM10016		0x1552	ISP 1581
 product PHILIPS DIVAUSB		0x1801	DIVA USB mp3 player
 
 /* Philips Semiconductor products */
-product PHILIPSSEMI HUB1122	0x1122	hub
+product PHILIPSSEMI HUB1122	0x1122	HUB
+
+/* Megatec */
+product MEGATEC UPS		0x5161	Protocol based UPS
 
 /* P.I. Engineering products */
 product PIENGINEERING PS2USB	0x020b	PS2 to Mac USB Adapter

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 01:16:25 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E720E1065670;
	Wed, 23 Dec 2009 01:16:24 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D429F8FC18;
	Wed, 23 Dec 2009 01:16:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN1GOtl081980;
	Wed, 23 Dec 2009 01:16:24 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN1GOjk081976;
	Wed, 23 Dec 2009 01:16:24 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200912230116.nBN1GOjk081976@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 23 Dec 2009 01:16:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200886 - in head/sys/dev/usb: quirk storage
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 01:16:25 -0000

Author: thompsa
Date: Wed Dec 23 01:16:24 2009
New Revision: 200886
URL: http://svn.freebsd.org/changeset/base/200886

Log:
  Move all Mass Storage Quirks over to the USB quirk module.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/quirk/usb_quirk.h
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.c	Wed Dec 23 01:12:54 2009	(r200885)
+++ head/sys/dev/usb/quirk/usb_quirk.c	Wed Dec 23 01:16:24 2009	(r200886)
@@ -66,7 +66,7 @@ MODULE_VERSION(usb_quirk, 1);
 #define	USB_QUIRK_ENTRY(v,p,l,h,...) \
   .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), .quirks = { __VA_ARGS__ }
 
-#define	USB_DEV_QUIRKS_MAX 128
+#define	USB_DEV_QUIRKS_MAX 256
 #define	USB_SUB_QUIRKS_MAX 8
 
 struct usb_quirk_entry {
@@ -183,10 +183,396 @@ static struct usb_quirk_entry usb_quirks
 	{USB_QUIRK_ENTRY(USB_VENDOR_CURITEL, USB_PRODUCT_CURITEL_UM175,
 	    0x0000, 0xFFFF, UQ_ASSUME_CM_OVER_DATA)},
 
+	/* USB Mass Storage Class Quirks */
+	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, 0,
+	    0x0000, 0xFFFF, UQ_MSC_NO_RS_CLEAR_UA, UQ_MATCH_VENDOR_ONLY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_ATTACHE, 0x0000,
+	    0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_A256MB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_DISKPRO512,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ADDONICS2, USB_PRODUCT_ADDONICS2_CABLE_205,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_AIPTEK, USB_PRODUCT_AIPTEK_POCKETCAM3M,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_AIPTEK2, USB_PRODUCT_AIPTEK2_SUNPLUS_TECH,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_SDCR_6335,
+	    0x0000, 0xFFFF, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_TRANSCEND,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO230,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO330,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2SCSI,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_CASIO, USB_PRODUCT_CASIO_QV_DIGICAM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_CCYU, USB_PRODUCT_CCYU_ED1064,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_CENTURY, USB_PRODUCT_CENTURY_EX35QUAT,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_XX6830XX,
+	    0x0000, 0xFFFF, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_DESKNOTE, USB_PRODUCT_DESKNOTE_UCR_61S2B,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_DMI, USB_PRODUCT_DMI_CFSM_RW,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_875DC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_895,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_FEIYA, USB_PRODUCT_FEIYA_5IN1,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_FREECOM, USB_PRODUCT_FREECOM_DVD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_FUJIPHOTO, USB_PRODUCT_FUJIPHOTO_MASS0100,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_RS_CLEAR_UA)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE,
+	    UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE_2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB_2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_WRONG_CSWSIG)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FG,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FGSM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_DZ_MV100A,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_USB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_CDW4E,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_CDW8200,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_IMAGINATION, USB_PRODUCT_IMAGINATION_DBX1,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_WRONG_CSWSIG)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_USBCABLE,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP, UQ_MSC_ALT_IFACE_1)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_ATAPI,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_STORAGE_V2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_IU_CD2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_DVR_UEH8,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_IOMEGA, USB_PRODUCT_IOMEGA_ZIP100,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_TEST_UNIT_READY)}, /* XXX ZIP drives can also use ATAPI */
+	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_L3,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S3X,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S4,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S5,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_CF_READER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_JUMPSHOT,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443SU2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443U2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_DUBPXXG,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_DPCM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIDB25,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIHD50,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_E223,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_F300,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_CDRRW,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI | UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_FDD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_E398,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MPMAN, 0,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_RS_CLEAR_UA)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN,
+	    0x0000, 0xFFFF, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_CF_CARD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_ONLYDISK,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_CLIK_40,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_NIKON, USB_PRODUCT_NIKON_D300,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C1,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_WRONG_CSWSIG)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700,
+	    0x0000, 0xFFFF, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFMS_RW,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_COMBO,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDCFE_B_CF_READER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDSM_B_READER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_READER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_UCF100,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_INQUIRY | UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC2, USB_PRODUCT_ONSPEC2_IMAGEMATE_SDDR55,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB35AN,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_LS120CAM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_UFI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SPE3030CC,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PLEXTOR, USB_PRODUCT_PLEXTOR_40_12_40U,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_TEST_UNIT_READY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_START_STOP)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR05A,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR09,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR12,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ2_256,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_128,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_256,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR31,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_READ_CAP_OFFBY1)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SCANLOGIC, USB_PRODUCT_SCANLOGIC_SL11R,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP, UQ_MSC_SHUTTLE_INIT)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CDRW,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CF,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBATAPI,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBCFSM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSCSI,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_HIFD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_SDDR09,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_ZIOMMC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_I_BEAD100,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_SHUTTLE_INIT)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SIIG, USB_PRODUCT_SIIG_WINTERREADER,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_MD_7425,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_SX_520Z,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
+	    0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
+	    UQ_MSC_RBC_PAD_TO_12)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40_MS,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	    0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
+	    UQ_MSC_RBC_PAD_TO_12)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	    0x0600, 0x0600, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
+	    UQ_MSC_RBC_PAD_TO_12)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_MSC_U03,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_NW_MS7,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_PEG_N760C,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSACUS1,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_PORTABLE_HDD_V2,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDE,
+	    0x0000, 0xFFFF, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TAUGA, USB_PRODUCT_TAUGA_CAMERAMATE,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TEAC, USB_PRODUCT_TEAC_FD05PUB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TECLAST, USB_PRODUCT_TECLAST_TLC300,
+	    0x0000, 0xFFFF, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TREK, USB_PRODUCT_TREK_MEMKEY,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE_8MB,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_C3310,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_MP3,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_RBC)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_T33520,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_MDIV,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_VIA, USB_PRODUCT_VIA_USB2IDEBRIDGE,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_VIVITAR, USB_PRODUCT_VIVITAR_35XX,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_COMBO,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_EXTHDD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYBOOK,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY_EVPD)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYPASSWORD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_SHORT_INQ)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_WINMAXGROUP, USB_PRODUCT_WINMAXGROUP_FLASH64MC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_YANO, USB_PRODUCT_YANO_FW800HD,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_YANO, USB_PRODUCT_YANO_U640MO,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
+	    UQ_MSC_FORCE_SHORT_INQ)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	    0x0000, 0x007F, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI,
+	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	    0x0080, 0x0080, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_UFI,
+	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	    0x0081, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_UFI,
+	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED, UQ_MSC_NO_GETMAXLUN)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ZORAN, USB_PRODUCT_ZORAN_EX20DSC,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_MEIZU, USB_PRODUCT_MEIZU_M6_SL,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ACTIONS, USB_PRODUCT_ACTIONS_MP4,
+	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
+	    UQ_MSC_NO_SYNC_CACHE)},
+	{USB_QUIRK_ENTRY(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_GMSC,
+	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
 };
 
 static const char *usb_quirk_str[USB_QUIRK_MAX] = {
 	[UQ_NONE]		= "UQ_NONE",
+	[UQ_MATCH_VENDOR_ONLY]	= "UQ_MATCH_VENDOR_ONLY",
 	[UQ_AUDIO_SWAP_LR]	= "UQ_AUDIO_SWAP_LR",
 	[UQ_AU_INP_ASYNC]	= "UQ_AU_INP_ASYNC",
 	[UQ_AU_NO_FRAC]		= "UQ_AU_NO_FRAC",
@@ -210,7 +596,29 @@ static const char *usb_quirk_str[USB_QUI
 	[UQ_CFG_INDEX_3]	= "UQ_CFG_INDEX_3",
 	[UQ_CFG_INDEX_4]	= "UQ_CFG_INDEX_4",
 	[UQ_CFG_INDEX_0]	= "UQ_CFG_INDEX_0",
-	[UQ_ASSUME_CM_OVER_DATA]= "UQ_ASSUME_CM_OVER_DATA",
+	[UQ_ASSUME_CM_OVER_DATA]	= "UQ_ASSUME_CM_OVER_DATA",
+	[UQ_MSC_NO_TEST_UNIT_READY]	= "UQ_MSC_NO_TEST_UNIT_READY",
+	[UQ_MSC_NO_RS_CLEAR_UA]		= "UQ_MSC_NO_RS_CLEAR_UA",
+	[UQ_MSC_NO_START_STOP]		= "UQ_MSC_NO_START_STOP",
+	[UQ_MSC_NO_GETMAXLUN]		= "UQ_MSC_NO_GETMAXLUN",
+	[UQ_MSC_NO_INQUIRY]		= "UQ_MSC_NO_INQUIRY",
+	[UQ_MSC_NO_INQUIRY_EVPD]	= "UQ_MSC_NO_INQUIRY_EVPD",
+	[UQ_MSC_NO_SYNC_CACHE]		= "UQ_MSC_NO_SYNC_CACHE",
+	[UQ_MSC_SHUTTLE_INIT]		= "UQ_MSC_SHUTTLE_INIT",
+	[UQ_MSC_ALT_IFACE_1]		= "UQ_MSC_ALT_IFACE_1",
+	[UQ_MSC_FLOPPY_SPEED]		= "UQ_MSC_FLOPPY_SPEED",
+	[UQ_MSC_IGNORE_RESIDUE]		= "UQ_MSC_IGNORE_RESIDUE",
+	[UQ_MSC_WRONG_CSWSIG]		= "UQ_MSC_WRONG_CSWSIG",
+	[UQ_MSC_RBC_PAD_TO_12]		= "UQ_MSC_RBC_PAD_TO_12",
+	[UQ_MSC_READ_CAP_OFFBY1]	= "UQ_MSC_READ_CAP_OFFBY1",
+	[UQ_MSC_FORCE_SHORT_INQ]	= "UQ_MSC_FORCE_SHORT_INQ",
+	[UQ_MSC_FORCE_WIRE_BBB]		= "UQ_MSC_FORCE_WIRE_BBB",
+	[UQ_MSC_FORCE_WIRE_CBI]		= "UQ_MSC_FORCE_WIRE_CBI",
+	[UQ_MSC_FORCE_WIRE_CBI_I]	= "UQ_MSC_FORCE_WIRE_CBI_I",
+	[UQ_MSC_FORCE_PROTO_SCSI]	= "UQ_MSC_FORCE_PROTO_SCSI",
+	[UQ_MSC_FORCE_PROTO_ATAPI]	= "UQ_MSC_FORCE_PROTO_ATAPI",
+	[UQ_MSC_FORCE_PROTO_UFI]	= "UQ_MSC_FORCE_PROTO_UFI",
+	[UQ_MSC_FORCE_PROTO_RBC]	= "UQ_MSC_FORCE_PROTO_RBC",
 };
 
 /*------------------------------------------------------------------------*
@@ -246,11 +654,22 @@ usb_test_quirk_by_info(const struct usbd
 	for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
 		/* see if quirk information does not match */
 		if ((usb_quirks[x].vid != info->idVendor) ||
-		    (usb_quirks[x].pid != info->idProduct) ||
 		    (usb_quirks[x].lo_rev > info->bcdDevice) ||
 		    (usb_quirks[x].hi_rev < info->bcdDevice)) {
 			continue;
 		}
+		/* see if quirk only should match vendor ID */
+		if (usb_quirks[x].pid != info->idProduct) {
+			if (usb_quirks[x].pid != 0)
+				continue;
+
+			for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) {
+				if (usb_quirks[x].quirks[y] == UQ_MATCH_VENDOR_ONLY)
+					break;
+			}
+			if (y == USB_SUB_QUIRKS_MAX)
+				continue;
+		}
 		/* lookup quirk */
 		for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) {
 			if (usb_quirks[x].quirks[y] == quirk) {

Modified: head/sys/dev/usb/quirk/usb_quirk.h
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.h	Wed Dec 23 01:12:54 2009	(r200885)
+++ head/sys/dev/usb/quirk/usb_quirk.h	Wed Dec 23 01:16:24 2009	(r200886)
@@ -30,6 +30,11 @@
 /* NOTE: UQ_NONE is not a valid quirk */
 enum {	/* keep in sync with usb_quirk_str table */
 	UQ_NONE,
+
+	UQ_MATCH_VENDOR_ONLY,
+
+	/* Various quirks */
+
 	UQ_AUDIO_SWAP_LR,	/* left and right sound channels are swapped */
 	UQ_AU_INP_ASYNC,	/* input is async despite claim of adaptive */
 	UQ_AU_NO_FRAC,		/* don't adjust for fractional samples */
@@ -54,6 +59,31 @@ enum {	/* keep in sync with usb_quirk_st
 	UQ_CFG_INDEX_4,		/* select configuration index 4 by default */
 	UQ_CFG_INDEX_0,		/* select configuration index 0 by default */
 	UQ_ASSUME_CM_OVER_DATA,	/* modem device breaks on cm over data */
+
+	/* USB Mass Storage Quirks. See "storage/umass.c" for a detailed description. */
+	UQ_MSC_NO_TEST_UNIT_READY,
+	UQ_MSC_NO_RS_CLEAR_UA,
+	UQ_MSC_NO_START_STOP,
+	UQ_MSC_NO_GETMAXLUN,
+	UQ_MSC_NO_INQUIRY,
+	UQ_MSC_NO_INQUIRY_EVPD,
+	UQ_MSC_NO_SYNC_CACHE,
+	UQ_MSC_SHUTTLE_INIT,
+	UQ_MSC_ALT_IFACE_1,
+	UQ_MSC_FLOPPY_SPEED,
+	UQ_MSC_IGNORE_RESIDUE,
+	UQ_MSC_WRONG_CSWSIG,
+	UQ_MSC_RBC_PAD_TO_12,
+	UQ_MSC_READ_CAP_OFFBY1,
+	UQ_MSC_FORCE_SHORT_INQ,
+	UQ_MSC_FORCE_WIRE_BBB,
+	UQ_MSC_FORCE_WIRE_CBI,
+	UQ_MSC_FORCE_WIRE_CBI_I,
+	UQ_MSC_FORCE_PROTO_SCSI,
+	UQ_MSC_FORCE_PROTO_ATAPI,
+	UQ_MSC_FORCE_PROTO_UFI,
+	UQ_MSC_FORCE_PROTO_RBC,
+
 	USB_QUIRK_MAX
 };
 

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Wed Dec 23 01:12:54 2009	(r200885)
+++ head/sys/dev/usb/storage/umass.c	Wed Dec 23 01:16:24 2009	(r200886)
@@ -127,6 +127,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "usbdevs.h"
 
+#include 
+
 #include 
 #include 
 #include 
@@ -311,32 +313,18 @@ typedef void (umass_callback_t)(struct u
 typedef uint8_t (umass_transform_t)(struct umass_softc *sc, uint8_t *cmd_ptr,
     	uint8_t cmd_len);
 
-struct umass_devdescr {
-	uint32_t vid;
-#define	VID_WILDCARD	0xffffffff
-#define	VID_EOT		0xfffffffe
-	uint32_t pid;
-#define	PID_WILDCARD	0xffffffff
-#define	PID_EOT		0xfffffffe
-	uint32_t rid;
-#define	RID_WILDCARD	0xffffffff
-#define	RID_EOT		0xfffffffe
-
-	/* wire and command protocol */
-	uint16_t proto;
-#define	UMASS_PROTO_DEFAULT	0x0000	/* use protocol indicated by USB descriptors */
+/* Wire and command protocol */
 #define	UMASS_PROTO_BBB		0x0001	/* USB wire protocol */
 #define	UMASS_PROTO_CBI		0x0002
 #define	UMASS_PROTO_CBI_I	0x0004
-#define	UMASS_PROTO_WIRE		0x00ff	/* USB wire protocol mask */
-#define	UMASS_PROTO_SCSI		0x0100	/* command protocol */
+#define	UMASS_PROTO_WIRE	0x00ff	/* USB wire protocol mask */
+#define	UMASS_PROTO_SCSI	0x0100	/* command protocol */
 #define	UMASS_PROTO_ATAPI	0x0200
 #define	UMASS_PROTO_UFI		0x0400
 #define	UMASS_PROTO_RBC		0x0800
 #define	UMASS_PROTO_COMMAND	0xff00	/* command protocol mask */
 
-	/* Device specific quirks */
-	uint16_t quirks;
+/* Device specific quirks */
 #define	NO_QUIRKS		0x0000
 	/*
 	 * The drive does not support Test Unit Ready. Convert to Start Unit
@@ -384,608 +372,6 @@ struct umass_devdescr {
 	 * result.
 	 */
 #define	NO_SYNCHRONIZE_CACHE	0x4000
-};
-
-static const struct umass_devdescr umass_devdescr[] = {
-	{USB_VENDOR_ASAHIOPTICAL, PID_WILDCARD, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		RS_NO_CLEAR_UA
-	},
-	{USB_VENDOR_ADDON, USB_PRODUCT_ADDON_ATTACHE, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_ADDON, USB_PRODUCT_ADDON_A256MB, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_ADDON, USB_PRODUCT_ADDON_DISKPRO512, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_ADDONICS2, USB_PRODUCT_ADDONICS2_CABLE_205, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_AIPTEK, USB_PRODUCT_AIPTEK_POCKETCAM3M, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_AIPTEK2, USB_PRODUCT_AIPTEK2_SUNPLUS_TECH, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_SDCR_6335, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_TEST_UNIT_READY | NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_TRANSCEND, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO230, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO330, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2SCSI, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_CASIO, USB_PRODUCT_CASIO_QV_DIGICAM, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_CCYU, USB_PRODUCT_CCYU_ED1064, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_CENTURY, USB_PRODUCT_CENTURY_EX35QUAT, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
-	},
-	{USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_XX6830XX, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_GETMAXLUN | NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_DESKNOTE, USB_PRODUCT_DESKNOTE_UCR_61S2B, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_DMI, USB_PRODUCT_DMI_CFSM_RW, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_875DC, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_895, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_FEIYA, USB_PRODUCT_FEIYA_5IN1, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_FREECOM, USB_PRODUCT_FREECOM_DVD, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_FUJIPHOTO, USB_PRODUCT_FUJIPHOTO_MASS0100, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
-		RS_NO_CLEAR_UA
-	},
-	{USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
-		    | NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE_2, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
-	},
-	{USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
-	},
-	{USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB_2, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		WRONG_CSWSIG
-	},
-	{USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FG, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FGSM, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_DZ_MV100A, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_USB, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_HP, USB_PRODUCT_HP_CDW4E, RID_WILDCARD,
-		UMASS_PROTO_ATAPI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_HP, USB_PRODUCT_HP_CDW8200, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
-		NO_TEST_UNIT_READY | NO_START_STOP
-	},
-	{USB_VENDOR_IMAGINATION, USB_PRODUCT_IMAGINATION_DBX1, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		WRONG_CSWSIG
-	},
-	{USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_USBCABLE, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_TEST_UNIT_READY | NO_START_STOP | ALT_IFACE_1
-	},
-	{USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_ATAPI, RID_WILDCARD,
-		UMASS_PROTO_RBC | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_STORAGE_V2, RID_WILDCARD,
-		UMASS_PROTO_RBC | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_IODATA, USB_PRODUCT_IODATA_IU_CD2, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_IODATA, USB_PRODUCT_IODATA_DVR_UEH8, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_IOMEGA, USB_PRODUCT_IOMEGA_ZIP100, RID_WILDCARD,
-		/*
-		 * XXX This is not correct as there are Zip drives that use
-		 * ATAPI.
-		 */
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_TEST_UNIT_READY
-	},
-	{USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_L3, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S3X, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S4, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S5, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD, RID_WILDCARD,
-		UMASS_PROTO_RBC | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_CF_READER, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_JUMPSHOT, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443SU2, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443U2, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MELCO, USB_PRODUCT_MELCO_DUBPXXG, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_START_STOP | IGNORE_RESIDUE
-	},
-	{USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_DPCM, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_TEST_UNIT_READY | NO_START_STOP
-	},
-	{USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIDB25, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIHD50, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_E223, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_F300, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_CDRRW, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_FDD, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_E398, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY | NO_INQUIRY_EVPD | NO_GETMAXLUN
-	},
-	{USB_VENDOR_MPMAN, PID_WILDCARD, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE | NO_GETMAXLUN | RS_NO_CLEAR_UA
-	},
-	{USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY2, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		FORCE_SHORT_INQUIRY
-	},
-	{USB_VENDOR_NETAC, USB_PRODUCT_NETAC_CF_CARD, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_NETAC, USB_PRODUCT_NETAC_ONLYDISK, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_CLIK_40, RID_WILDCARD,
-		UMASS_PROTO_ATAPI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_NIKON, USB_PRODUCT_NIKON_D300, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C1, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		WRONG_CSWSIG
-	},
-	{USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN | NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFMS_RW, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_COMBO, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER2, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDCFE_B_CF_READER, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDSM_B_READER, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_READER, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_UCF100, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
-		NO_INQUIRY | NO_GETMAXLUN
-	},
-	{USB_VENDOR_ONSPEC2, USB_PRODUCT_ONSPEC2_IMAGEMATE_SDDR55, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB35AN, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_LS120CAM, RID_WILDCARD,
-		UMASS_PROTO_UFI,
-		NO_QUIRKS
-	},
-	{ USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SPE3030CC, RID_WILDCARD,
-		UMASS_PROTO_DEFAULT,
-		NO_SYNCHRONIZE_CACHE
-	},
-	{USB_VENDOR_PLEXTOR, USB_PRODUCT_PLEXTOR_40_12_40U, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_TEST_UNIT_READY
-	},
-	{USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE2, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE | NO_START_STOP
-	},
-	{USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR05A, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		READ_CAPACITY_OFFBY1 | NO_GETMAXLUN
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR09, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		READ_CAPACITY_OFFBY1 | NO_GETMAXLUN
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR12, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		READ_CAPACITY_OFFBY1 | NO_GETMAXLUN
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ2_256, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_128, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_256, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		IGNORE_RESIDUE
-	},
-	{USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR31, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		READ_CAPACITY_OFFBY1
-	},
-	{USB_VENDOR_SCANLOGIC, USB_PRODUCT_SCANLOGIC_SL11R, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
-		NO_INQUIRY
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSB, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
-		NO_TEST_UNIT_READY | NO_START_STOP | SHUTTLE_INIT
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CDRW, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CF, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBATAPI, RID_WILDCARD,
-		UMASS_PROTO_ATAPI | UMASS_PROTO_CBI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBCFSM, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSCSI, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		NO_QUIRKS
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_HIFD, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_SDDR09, RID_WILDCARD,
-		UMASS_PROTO_SCSI,
-		NO_GETMAXLUN
-	},
-	{USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_ZIOMMC, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_CBI,
-		NO_GETMAXLUN

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 01:41:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 35605106566B;
	Wed, 23 Dec 2009 01:41:53 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2268D8FC16;
	Wed, 23 Dec 2009 01:41:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN1frQT082459;
	Wed, 23 Dec 2009 01:41:53 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN1frVc082457;
	Wed, 23 Dec 2009 01:41:53 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200912230141.nBN1frVc082457@svn.freebsd.org>
From: Andrew Thompson 
Date: Wed, 23 Dec 2009 01:41:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200887 - head/sys/dev/usb/quirk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 01:41:53 -0000

Author: thompsa
Date: Wed Dec 23 01:41:52 2009
New Revision: 200887
URL: http://svn.freebsd.org/changeset/base/200887

Log:
  Shorten the USB_QUIRK_ENTRY macro and undef it at the end, its only internal.

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- head/sys/dev/usb/quirk/usb_quirk.c	Wed Dec 23 01:16:24 2009	(r200886)
+++ head/sys/dev/usb/quirk/usb_quirk.c	Wed Dec 23 01:41:52 2009	(r200887)
@@ -60,12 +60,6 @@
 MODULE_DEPEND(usb_quirk, usb, 1, 1, 1);
 MODULE_VERSION(usb_quirk, 1);
 
-/*
- * The following macro adds one or more quirks for a USB device:
- */
-#define	USB_QUIRK_ENTRY(v,p,l,h,...) \
-  .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), .quirks = { __VA_ARGS__ }
-
 #define	USB_DEV_QUIRKS_MAX 256
 #define	USB_SUB_QUIRKS_MAX 8
 
@@ -79,496 +73,499 @@ struct usb_quirk_entry {
 
 static struct mtx usb_quirk_mtx;
 
+#define	USB_QUIRK(v,p,l,h,...) \
+  .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), .quirks = { __VA_ARGS__ }
 static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {
-	{USB_QUIRK_ENTRY(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_LCM,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
-	    0x094, 0x094, UQ_SWAP_UNICODE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,
-	    0x0a2, 0x0a2, UQ_BAD_ADC, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,
-	    0x0a2, 0x0a2, UQ_AU_NO_XU, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ADA70,
-	    0x103, 0x103, UQ_BAD_ADC, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ASC495,
-	    0x000, 0x000, UQ_BAD_AUDIO, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_QTRONIX, USB_PRODUCT_QTRONIX_980N,
-	    0x110, 0x110, UQ_SPUR_BUT_UP, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR2, USB_PRODUCT_ALCOR2_KBD_HUB,
-	    0x001, 0x001, UQ_SPUR_BUT_UP, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MCT, USB_PRODUCT_MCT_HUB0100,
-	    0x102, 0x102, UQ_BUS_POWERED, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232,
-	    0x102, 0x102, UQ_BUS_POWERED, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41,
-	    0x110, 0x110, UQ_POWER_CLAIM, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1,
-	    0x009, 0x009, UQ_AU_NO_FRAC, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SILICONPORTALS,
+	{USB_QUIRK(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_LCM,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
+	    0x094, 0x094, UQ_SWAP_UNICODE)},
+	{USB_QUIRK(USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,
+	    0x0a2, 0x0a2, UQ_BAD_ADC)},
+	{USB_QUIRK(USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,
+	    0x0a2, 0x0a2, UQ_AU_NO_XU)},
+	{USB_QUIRK(USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ADA70,
+	    0x103, 0x103, UQ_BAD_ADC)},
+	{USB_QUIRK(USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ASC495,
+	    0x000, 0x000, UQ_BAD_AUDIO)},
+	{USB_QUIRK(USB_VENDOR_QTRONIX, USB_PRODUCT_QTRONIX_980N,
+	    0x110, 0x110, UQ_SPUR_BUT_UP)},
+	{USB_QUIRK(USB_VENDOR_ALCOR2, USB_PRODUCT_ALCOR2_KBD_HUB,
+	    0x001, 0x001, UQ_SPUR_BUT_UP)},
+	{USB_QUIRK(USB_VENDOR_MCT, USB_PRODUCT_MCT_HUB0100,
+	    0x102, 0x102, UQ_BUS_POWERED)},
+	{USB_QUIRK(USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232,
+	    0x102, 0x102, UQ_BUS_POWERED)},
+	{USB_QUIRK(USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41,
+	    0x110, 0x110, UQ_POWER_CLAIM)},
+	{USB_QUIRK(USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1,
+	    0x009, 0x009, UQ_AU_NO_FRAC)},
+	{USB_QUIRK(USB_VENDOR_SILICONPORTALS,
 	    USB_PRODUCT_SILICONPORTALS_YAPPHONE,
-	    0x100, 0x100, UQ_AU_INP_ASYNC, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN53B,
-	    0x0000, 0xFFFF, UQ_NO_STRINGS, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ELSA, USB_PRODUCT_ELSA_MODEM1,
-	    0x0000, 0xFFFF, UQ_CFG_INDEX_1, UQ_NONE)},
+	    0x100, 0x100, UQ_AU_INP_ASYNC)},
+	{USB_QUIRK(USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN53B,
+	    0x0000, 0xFFFF, UQ_NO_STRINGS)},
+	{USB_QUIRK(USB_VENDOR_ELSA, USB_PRODUCT_ELSA_MODEM1,
+	    0x0000, 0xFFFF, UQ_CFG_INDEX_1)},
 
 	/*
 	 * XXX The following quirks should have a more specific revision
 	 * number:
 	 */
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_895C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_880C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_815C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_810C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_830C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_1220C,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_XEROX, USB_PRODUCT_XEROX_WCM15,
-	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR, UQ_NONE)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_895C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_880C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_815C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_810C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_830C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_1220C,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
+	{USB_QUIRK(USB_VENDOR_XEROX, USB_PRODUCT_XEROX_WCM15,
+	    0x0000, 0xFFFF, UQ_BROKEN_BIDIR)},
 	/* Devices which should be ignored by uhid */
-	{USB_QUIRK_ENTRY(USB_VENDOR_APC, USB_PRODUCT_APC_UPS,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F6C550AVR,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CYBERPOWER,
+	{USB_QUIRK(USB_VENDOR_APC, USB_PRODUCT_APC_UPS,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F6C550AVR,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_CYBERPOWER,
 	    USB_PRODUCT_CYBERPOWER_1500CAVRLCD,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD2X20,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD4X20,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_3G,
-	    0x0000, 0xFFFF, UQ_HID_IGNORE, UQ_NONE)},
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD2X20,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD4X20,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_3G,
+	    0x0000, 0xFFFF, UQ_HID_IGNORE)},
 	/* Devices which should be ignored by both ukbd and uhid */
-	{USB_QUIRK_ENTRY(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_WISPY1A,
-	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY1B,
-	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TENX, USB_PRODUCT_TENX_UAUDIO0,
-	    0x0101, 0x0101, UQ_AUDIO_SWAP_LR, UQ_NONE)},
+	{USB_QUIRK(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_WISPY1A,
+	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY1B,
+	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE)},
+	{USB_QUIRK(USB_VENDOR_TENX, USB_PRODUCT_TENX_UAUDIO0,
+	    0x0101, 0x0101, UQ_AUDIO_SWAP_LR)},
 	/* MS keyboards do weird things */
-	{USB_QUIRK_ENTRY(USB_VENDOR_MICROSOFT,
+	{USB_QUIRK(USB_VENDOR_MICROSOFT,
 	    USB_PRODUCT_MICROSOFT_WLINTELLIMOUSE,
-	    0x0000, 0xFFFF, UQ_MS_LEADING_BYTE, UQ_NONE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24X,
-	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE, UQ_NONE)},
+	    0x0000, 0xFFFF, UQ_MS_LEADING_BYTE)},
+	{USB_QUIRK(USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24X,
+	    0x0000, 0xFFFF, UQ_KBD_IGNORE, UQ_HID_IGNORE)},
 	/* umodem(4) device quirks */
-	{USB_QUIRK_ENTRY(USB_VENDOR_METRICOM, USB_PRODUCT_METRICOM_RICOCHET_GS,
+	{USB_QUIRK(USB_VENDOR_METRICOM, USB_PRODUCT_METRICOM_RICOCHET_GS,
 	    0x100, 0x100, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANYO, USB_PRODUCT_SANYO_SCP4900,
+	{USB_QUIRK(USB_VENDOR_SANYO, USB_PRODUCT_SANYO_SCP4900,
 	    0x000, 0x000, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_T720C,
+	{USB_QUIRK(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_T720C,
 	    0x001, 0x001, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_EICON, USB_PRODUCT_EICON_DIVA852,
+	{USB_QUIRK(USB_VENDOR_EICON, USB_PRODUCT_EICON_DIVA852,
 	    0x100, 0x100, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SIEMENS2, USB_PRODUCT_SIEMENS2_ES75,
+	{USB_QUIRK(USB_VENDOR_SIEMENS2, USB_PRODUCT_SIEMENS2_ES75,
 	    0x000, 0x000, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_CDMA_MSM,
+	{USB_QUIRK(USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_CDMA_MSM,
 	    0x0000, 0xFFFF, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_QUALCOMM2, USB_PRODUCT_QUALCOMM2_CDMA_MSM,
+	{USB_QUIRK(USB_VENDOR_QUALCOMM2, USB_PRODUCT_QUALCOMM2_CDMA_MSM,
 	    0x0000, 0xFFFF, UQ_ASSUME_CM_OVER_DATA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CURITEL, USB_PRODUCT_CURITEL_UM175,
+	{USB_QUIRK(USB_VENDOR_CURITEL, USB_PRODUCT_CURITEL_UM175,
 	    0x0000, 0xFFFF, UQ_ASSUME_CM_OVER_DATA)},
 
 	/* USB Mass Storage Class Quirks */
-	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, 0,
+	{USB_QUIRK(USB_VENDOR_ASAHIOPTICAL, 0,
 	    0x0000, 0xFFFF, UQ_MSC_NO_RS_CLEAR_UA, UQ_MATCH_VENDOR_ONLY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_ATTACHE, 0x0000,
+	{USB_QUIRK(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_ATTACHE, 0x0000,
 	    0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_A256MB,
+	{USB_QUIRK(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_A256MB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_DISKPRO512,
+	{USB_QUIRK(USB_VENDOR_ADDON, USB_PRODUCT_ADDON_DISKPRO512,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ADDONICS2, USB_PRODUCT_ADDONICS2_CABLE_205,
+	{USB_QUIRK(USB_VENDOR_ADDONICS2, USB_PRODUCT_ADDONICS2_CABLE_205,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_AIPTEK, USB_PRODUCT_AIPTEK_POCKETCAM3M,
+	{USB_QUIRK(USB_VENDOR_AIPTEK, USB_PRODUCT_AIPTEK_POCKETCAM3M,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_AIPTEK2, USB_PRODUCT_AIPTEK2_SUNPLUS_TECH,
+	{USB_QUIRK(USB_VENDOR_AIPTEK2, USB_PRODUCT_AIPTEK2_SUNPLUS_TECH,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_SDCR_6335,
+	{USB_QUIRK(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_SDCR_6335,
 	    0x0000, 0xFFFF, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390,
+	{USB_QUIRK(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361,
+	{USB_QUIRK(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_UMCR_9361,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_TRANSCEND,
+	{USB_QUIRK(USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_TRANSCEND,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO230,
+	{USB_QUIRK(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO230,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO330,
+	{USB_QUIRK(USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO330,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2SCSI,
+	{USB_QUIRK(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2SCSI,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CASIO, USB_PRODUCT_CASIO_QV_DIGICAM,
+	{USB_QUIRK(USB_VENDOR_CASIO, USB_PRODUCT_CASIO_QV_DIGICAM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CCYU, USB_PRODUCT_CCYU_ED1064,
+	{USB_QUIRK(USB_VENDOR_CCYU, USB_PRODUCT_CCYU_ED1064,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CENTURY, USB_PRODUCT_CENTURY_EX35QUAT,
+	{USB_QUIRK(USB_VENDOR_CENTURY, USB_PRODUCT_CENTURY_EX35QUAT,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_XX6830XX,
+	{USB_QUIRK(USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_XX6830XX,
 	    0x0000, 0xFFFF, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_DESKNOTE, USB_PRODUCT_DESKNOTE_UCR_61S2B,
+	{USB_QUIRK(USB_VENDOR_DESKNOTE, USB_PRODUCT_DESKNOTE_UCR_61S2B,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_DMI, USB_PRODUCT_DMI_CFSM_RW,
+	{USB_QUIRK(USB_VENDOR_DMI, USB_PRODUCT_DMI_CFSM_RW,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_875DC,
+	{USB_QUIRK(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_875DC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_895,
+	{USB_QUIRK(USB_VENDOR_EPSON, USB_PRODUCT_EPSON_STYLUS_895,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_FEIYA, USB_PRODUCT_FEIYA_5IN1,
+	{USB_QUIRK(USB_VENDOR_FEIYA, USB_PRODUCT_FEIYA_5IN1,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_FREECOM, USB_PRODUCT_FREECOM_DVD,
+	{USB_QUIRK(USB_VENDOR_FREECOM, USB_PRODUCT_FREECOM_DVD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_FUJIPHOTO, USB_PRODUCT_FUJIPHOTO_MASS0100,
+	{USB_QUIRK(USB_VENDOR_FUJIPHOTO, USB_PRODUCT_FUJIPHOTO_MASS0100,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_RS_CLEAR_UA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE,
+	{USB_QUIRK(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE,
 	    UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE_2,
+	{USB_QUIRK(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB2IDE_2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB,
+	{USB_QUIRK(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB_2,
+	{USB_QUIRK(USB_VENDOR_GENESYS, USB_PRODUCT_GENESYS_GL641USB_2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_WRONG_CSWSIG)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FG,
+	{USB_QUIRK(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FG,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FGSM,
+	{USB_QUIRK(USB_VENDOR_HAGIWARA, USB_PRODUCT_HAGIWARA_FGSM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_DZ_MV100A,
+	{USB_QUIRK(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_DZ_MV100A,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_USB,
+	{USB_QUIRK(USB_VENDOR_HITACHI, USB_PRODUCT_HITACHI_DVDCAM_USB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_CDW4E,
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_CDW4E,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_HP, USB_PRODUCT_HP_CDW8200,
+	{USB_QUIRK(USB_VENDOR_HP, USB_PRODUCT_HP_CDW8200,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_IMAGINATION, USB_PRODUCT_IMAGINATION_DBX1,
+	{USB_QUIRK(USB_VENDOR_IMAGINATION, USB_PRODUCT_IMAGINATION_DBX1,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_WRONG_CSWSIG)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_USBCABLE,
+	{USB_QUIRK(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_USBCABLE,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP, UQ_MSC_ALT_IFACE_1)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_ATAPI,
+	{USB_QUIRK(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_ATAPI,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_STORAGE_V2,
+	{USB_QUIRK(USB_VENDOR_INSYSTEM, USB_PRODUCT_INSYSTEM_STORAGE_V2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_IU_CD2,
+	{USB_QUIRK(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_IU_CD2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_DVR_UEH8,
+	{USB_QUIRK(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_DVR_UEH8,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_IOMEGA, USB_PRODUCT_IOMEGA_ZIP100,
+	{USB_QUIRK(USB_VENDOR_IOMEGA, USB_PRODUCT_IOMEGA_ZIP100,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_TEST_UNIT_READY)}, /* XXX ZIP drives can also use ATAPI */
-	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_L3,
+	{USB_QUIRK(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_L3,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S3X,
+	{USB_QUIRK(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S3X,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S4,
+	{USB_QUIRK(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S4,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S5,
+	{USB_QUIRK(USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_FINECAM_S5,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD,
+	{USB_QUIRK(USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_CF_READER,
+	{USB_QUIRK(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_CF_READER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_JUMPSHOT,
+	{USB_QUIRK(USB_VENDOR_LEXAR, USB_PRODUCT_LEXAR_JUMPSHOT,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443SU2,
+	{USB_QUIRK(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443SU2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443U2,
+	{USB_QUIRK(USB_VENDOR_LOGITEC, USB_PRODUCT_LOGITEC_LDR_H443U2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_DUBPXXG,
+	{USB_QUIRK(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_DUBPXXG,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_DPCM,
+	{USB_QUIRK(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_DPCM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIDB25,
+	{USB_QUIRK(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIDB25,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIHD50,
+	{USB_QUIRK(USB_VENDOR_MICROTECH, USB_PRODUCT_MICROTECH_SCSIHD50,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_E223,
+	{USB_QUIRK(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_E223,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_F300,
+	{USB_QUIRK(USB_VENDOR_MINOLTA, USB_PRODUCT_MINOLTA_F300,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_CDRRW,
+	{USB_QUIRK(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_CDRRW,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI | UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_FDD,
+	{USB_QUIRK(USB_VENDOR_MITSUMI, USB_PRODUCT_MITSUMI_FDD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_E398,
+	{USB_QUIRK(USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_E398,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MPMAN, 0,
+	{USB_QUIRK(USB_VENDOR_MPMAN, 0,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY,
+	{USB_QUIRK(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_RS_CLEAR_UA)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY2,
+	{USB_QUIRK(USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DISKONKEY2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN,
+	{USB_QUIRK(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN,
 	    0x0000, 0xFFFF, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813,
+	{USB_QUIRK(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER,
+	{USB_QUIRK(USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260,
+	{USB_QUIRK(USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_CF_CARD,
+	{USB_QUIRK(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_CF_CARD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_ONLYDISK,
+	{USB_QUIRK(USB_VENDOR_NETAC, USB_PRODUCT_NETAC_ONLYDISK,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_CLIK_40,
+	{USB_QUIRK(USB_VENDOR_NETCHIP, USB_PRODUCT_NETCHIP_CLIK_40,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_NIKON, USB_PRODUCT_NIKON_D300,
+	{USB_QUIRK(USB_VENDOR_NIKON, USB_PRODUCT_NIKON_D300,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C1,
+	{USB_QUIRK(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C1,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_WRONG_CSWSIG)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700,
+	{USB_QUIRK(USB_VENDOR_OLYMPUS, USB_PRODUCT_OLYMPUS_C700,
 	    0x0000, 0xFFFF, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_SDS_HOTFIND_D,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFMS_RW,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFMS_RW,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_COMBO,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_COMBO,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER2,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_CFSM_READER2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDCFE_B_CF_READER,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDCFE_B_CF_READER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDSM_B_READER,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_MDSM_B_READER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_READER,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_READER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_UCF100,
+	{USB_QUIRK(USB_VENDOR_ONSPEC, USB_PRODUCT_ONSPEC_UCF100,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY | UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ONSPEC2, USB_PRODUCT_ONSPEC2_IMAGEMATE_SDDR55,
+	{USB_QUIRK(USB_VENDOR_ONSPEC2, USB_PRODUCT_ONSPEC2_IMAGEMATE_SDDR55,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN,
+	{USB_QUIRK(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN,
+	{USB_QUIRK(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB35AN,
+	{USB_QUIRK(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB35AN,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_LS120CAM,
+	{USB_QUIRK(USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_LS120CAM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_UFI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SPE3030CC,
+	{USB_QUIRK(USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SPE3030CC,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PLEXTOR, USB_PRODUCT_PLEXTOR_40_12_40U,
+	{USB_QUIRK(USB_VENDOR_PLEXTOR, USB_PRODUCT_PLEXTOR_40_12_40U,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_TEST_UNIT_READY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE2,
+	{USB_QUIRK(USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_START_STOP)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410,
+	{USB_QUIRK(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR05A,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR05A,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR09,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR09,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR12,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR12,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ2_256,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ2_256,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_128,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_128,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_256,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDCZ4_256,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR31,
+	{USB_QUIRK(USB_VENDOR_SANDISK, USB_PRODUCT_SANDISK_SDDR31,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_READ_CAP_OFFBY1)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SCANLOGIC, USB_PRODUCT_SCANLOGIC_SL11R,
+	{USB_QUIRK(USB_VENDOR_SCANLOGIC, USB_PRODUCT_SCANLOGIC_SL11R,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSB,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_START_STOP, UQ_MSC_SHUTTLE_INIT)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CDRW,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CDRW,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CF,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_CF,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBATAPI,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBATAPI,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBCFSM,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSBCFSM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSCSI,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_EUSCSI,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_HIFD,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_HIFD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_SDDR09,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_SDDR09,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_ZIOMMC,
+	{USB_QUIRK(USB_VENDOR_SHUTTLE, USB_PRODUCT_SHUTTLE_ZIOMMC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_I_BEAD100,
+	{USB_QUIRK(USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_I_BEAD100,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_SHUTTLE_INIT)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SIIG, USB_PRODUCT_SIIG_WINTERREADER,
+	{USB_QUIRK(USB_VENDOR_SIIG, USB_PRODUCT_SIIG_WINTERREADER,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_MD_7425,
+	{USB_QUIRK(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_MD_7425,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_SX_520Z,
+	{USB_QUIRK(USB_VENDOR_SKANHEX, USB_PRODUCT_SKANHEX_SX_520Z,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
 	    0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
 	    UQ_MSC_RBC_PAD_TO_12)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40_MS,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40_MS,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
 	    0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
 	    UQ_MSC_RBC_PAD_TO_12)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
 	    0x0600, 0x0600, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC,
 	    UQ_MSC_RBC_PAD_TO_12)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_HANDYCAM,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSC,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_MSC_U03,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_MSC_U03,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_NW_MS7,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_NW_MS7,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_PEG_N760C,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_MS_PEG_N760C,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSACUS1,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_MSACUS1,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SONY, USB_PRODUCT_SONY_PORTABLE_HDD_V2,
+	{USB_QUIRK(USB_VENDOR_SONY, USB_PRODUCT_SONY_PORTABLE_HDD_V2,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDE,
+	{USB_QUIRK(USB_VENDOR_SUPERTOP, USB_PRODUCT_SUPERTOP_IDE,
 	    0x0000, 0xFFFF, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TAUGA, USB_PRODUCT_TAUGA_CAMERAMATE,
+	{USB_QUIRK(USB_VENDOR_TAUGA, USB_PRODUCT_TAUGA_CAMERAMATE,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TEAC, USB_PRODUCT_TEAC_FD05PUB,
+	{USB_QUIRK(USB_VENDOR_TEAC, USB_PRODUCT_TEAC_FD05PUB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TECLAST, USB_PRODUCT_TECLAST_TLC300,
+	{USB_QUIRK(USB_VENDOR_TECLAST, USB_PRODUCT_TECLAST_TLC300,
 	    0x0000, 0xFFFF, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TREK, USB_PRODUCT_TREK_MEMKEY,
+	{USB_QUIRK(USB_VENDOR_TREK, USB_PRODUCT_TREK_MEMKEY,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE_8MB,
+	{USB_QUIRK(USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE_8MB,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_C3310,
+	{USB_QUIRK(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_C3310,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_MP3,
+	{USB_QUIRK(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_MP3,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_RBC)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_T33520,
+	{USB_QUIRK(USB_VENDOR_TRUMPION, USB_PRODUCT_TRUMPION_T33520,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_MDIV,
+	{USB_QUIRK(USB_VENDOR_TWINMOS, USB_PRODUCT_TWINMOS_MDIV,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_VIA, USB_PRODUCT_VIA_USB2IDEBRIDGE,
+	{USB_QUIRK(USB_VENDOR_VIA, USB_PRODUCT_VIA_USB2IDEBRIDGE,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_VIVITAR, USB_PRODUCT_VIVITAR_35XX,
+	{USB_QUIRK(USB_VENDOR_VIVITAR, USB_PRODUCT_VIVITAR_35XX,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_COMBO,
+	{USB_QUIRK(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_COMBO,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_EXTHDD,
+	{USB_QUIRK(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_EXTHDD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYBOOK,
+	{USB_QUIRK(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYBOOK,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY_EVPD)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYPASSWORD,
+	{USB_QUIRK(USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYPASSWORD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_SHORT_INQ)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_WINMAXGROUP, USB_PRODUCT_WINMAXGROUP_FLASH64MC,
+	{USB_QUIRK(USB_VENDOR_WINMAXGROUP, USB_PRODUCT_WINMAXGROUP_FLASH64MC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_YANO, USB_PRODUCT_YANO_FW800HD,
+	{USB_QUIRK(USB_VENDOR_YANO, USB_PRODUCT_YANO_FW800HD,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_YANO, USB_PRODUCT_YANO_U640MO,
+	{USB_QUIRK(USB_VENDOR_YANO, USB_PRODUCT_YANO_U640MO,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_FORCE_SHORT_INQ)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	{USB_QUIRK(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
 	    0x0000, 0x007F, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_UFI,
 	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	{USB_QUIRK(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
 	    0x0080, 0x0080, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_UFI,
 	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
+	{USB_QUIRK(USB_VENDOR_YEDATA, USB_PRODUCT_YEDATA_FLASHBUSTERU,
 	    0x0081, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_UFI,
 	    UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED, UQ_MSC_NO_GETMAXLUN)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ZORAN, USB_PRODUCT_ZORAN_EX20DSC,
+	{USB_QUIRK(USB_VENDOR_ZORAN, USB_PRODUCT_ZORAN_EX20DSC,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_ATAPI)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_MEIZU, USB_PRODUCT_MEIZU_M6_SL,
+	{USB_QUIRK(USB_VENDOR_MEIZU, USB_PRODUCT_MEIZU_M6_SL,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ACTIONS, USB_PRODUCT_ACTIONS_MP4,
+	{USB_QUIRK(USB_VENDOR_ACTIONS, USB_PRODUCT_ACTIONS_MP4,
 	    0x0000, 0xFFFF, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_SYNC_CACHE)},
-	{USB_QUIRK_ENTRY(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_GMSC,
+	{USB_QUIRK(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_GMSC,
 	    0x0000, 0xFFFF, UQ_MSC_NO_SYNC_CACHE)},
 };
+#undef USB_QUIRK
 
 static const char *usb_quirk_str[USB_QUIRK_MAX] = {
 	[UQ_NONE]		= "UQ_NONE",

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 04:39:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 315371065670;
	Wed, 23 Dec 2009 04:39:06 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2012C8FC0C;
	Wed, 23 Dec 2009 04:39:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN4d5p1086231;
	Wed, 23 Dec 2009 04:39:05 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN4d5UD086229;
	Wed, 23 Dec 2009 04:39:05 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200912230439.nBN4d5UD086229@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 23 Dec 2009 04:39:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200888 - head/sys/ia64/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 04:39:06 -0000

Author: marcel
Date: Wed Dec 23 04:39:05 2009
New Revision: 200888
URL: http://svn.freebsd.org/changeset/base/200888

Log:
  Add a bit definition for invalid timestamp in the record header.

Modified:
  head/sys/ia64/include/mca.h

Modified: head/sys/ia64/include/mca.h
==============================================================================
--- head/sys/ia64/include/mca.h	Wed Dec 23 01:41:52 2009	(r200887)
+++ head/sys/ia64/include/mca.h	Wed Dec 23 04:39:05 2009	(r200888)
@@ -39,6 +39,7 @@ struct mca_record_header {
 #define	MCA_RH_ERROR_CORRECTED		2
 	uint8_t		rh_flags;
 #define	MCA_RH_FLAGS_PLATFORM_ID	0x01	/* Platform_id present. */
+#define	MCA_RH_FLAGS_TIME_STAMP		0x02	/* Timestamp invalid. */
 	uint32_t	rh_length;		/* Size including header. */
 	uint8_t		rh_time[8];
 #define	MCA_RH_TIME_SEC		0

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 04:48:43 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C1BB106568B;
	Wed, 23 Dec 2009 04:48:43 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EE2808FC08;
	Wed, 23 Dec 2009 04:48:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN4mg82086444;
	Wed, 23 Dec 2009 04:48:42 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN4mgMW086439;
	Wed, 23 Dec 2009 04:48:42 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200912230448.nBN4mgMW086439@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 23 Dec 2009 04:48:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200889 - in head/sys/ia64: ia64 include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 04:48:43 -0000

Author: marcel
Date: Wed Dec 23 04:48:42 2009
New Revision: 200889
URL: http://svn.freebsd.org/changeset/base/200889

Log:
  Export the bus, cpu and itc frequencies under the hw.freq sysctl node.
  The frequencies are in MHz (i.e. a value of 1000 represents 1GHz). The
  frequencies are rounded to the nearest whole MHz.
  
  While here, rename and re-type bus_frequency, processor_frequency and
  itc_frequency to bus_freq, cpu_freq and itc_freq and make them static.
  As unsigned integers, the hw.freq.cpu sysctl can more easily be made
  generic (across all architectures) making porting easier.
  
  MFC after:	3 days

Modified:
  head/sys/ia64/ia64/clock.c
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/include/clock.h
  head/sys/ia64/include/md_var.h

Modified: head/sys/ia64/ia64/clock.c
==============================================================================
--- head/sys/ia64/ia64/clock.c	Wed Dec 23 04:39:05 2009	(r200888)
+++ head/sys/ia64/ia64/clock.c	Wed Dec 23 04:48:42 2009	(r200889)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 uint64_t ia64_clock_reload;
 
@@ -78,15 +79,15 @@ pcpu_initclock(void)
 void
 cpu_initclocks()
 {
+	u_long itc_freq;
 
-	if (itc_frequency == 0)
-		panic("Unknown clock frequency");
+	itc_freq = (u_long)ia64_itc_freq() * 1000000ul;
 
 	stathz = hz;
-	ia64_clock_reload = (itc_frequency + hz/2) / hz;
+	ia64_clock_reload = (itc_freq + hz/2) / hz;
 
 #ifndef SMP
-	ia64_timecounter.tc_frequency = itc_frequency;
+	ia64_timecounter.tc_frequency = itc_freq;
 	tc_init(&ia64_timecounter);
 #endif
 

Modified: head/sys/ia64/ia64/machdep.c
==============================================================================
--- head/sys/ia64/ia64/machdep.c	Wed Dec 23 04:39:05 2009	(r200888)
+++ head/sys/ia64/ia64/machdep.c	Wed Dec 23 04:48:42 2009	(r200889)
@@ -101,11 +101,21 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+SYSCTL_NODE(_hw, OID_AUTO, freq, CTLFLAG_RD, 0, "");
 SYSCTL_NODE(_machdep, OID_AUTO, cpu, CTLFLAG_RD, 0, "");
 
-u_int64_t processor_frequency;
-u_int64_t bus_frequency;
-u_int64_t itc_frequency;
+static u_int bus_freq;
+SYSCTL_UINT(_hw_freq, OID_AUTO, bus, CTLFLAG_RD, &bus_freq, 0,
+    "Bus clock frequency");
+
+static u_int cpu_freq;
+SYSCTL_UINT(_hw_freq, OID_AUTO, cpu, CTLFLAG_RD, &cpu_freq, 0,
+    "CPU clock frequency");
+
+static u_int itc_freq;
+SYSCTL_UINT(_hw_freq, OID_AUTO, itc, CTLFLAG_RD, &itc_freq, 0,
+    "ITC frequency");
+
 int cold = 1;
 
 u_int64_t pa_bootinfo;
@@ -203,9 +213,7 @@ identifycpu(void)
 			 * (i.e. the clock frequency) to identify those.
 			 * Allow for roughly 1% error margin.
 			 */
-			tmp = processor_frequency >> 7;
-			if ((processor_frequency - tmp) < 1*Ghz &&
-			    (processor_frequency + tmp) >= 1*Ghz)
+			if (cpu_freq > 990 && cpu_freq < 1010)
 				model_name = "Deerfield";
 			else
 				model_name = "Madison";
@@ -232,11 +240,8 @@ identifycpu(void)
 	features = ia64_get_cpuid(4);
 
 	printf("CPU: %s (", model_name);
-	if (processor_frequency) {
-		printf("%ld.%02ld-Mhz ",
-		    (processor_frequency + 4999) / Mhz,
-		    ((processor_frequency + 4999) / (Mhz/100)) % 100);
-	}
+	if (cpu_freq)
+		printf("%u Mhz ", cpu_freq);
 	printf("%s)\n", family_name);
 	printf("  Origin = \"%s\"  Revision = %d\n", vendor, revision);
 	printf("  Features = 0x%b\n", (u_int32_t) features,
@@ -396,7 +401,7 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 
 	if (pcpu_find(cpu_id) == NULL || rate == NULL)
 		return (EINVAL);
-	*rate = processor_frequency;
+	*rate = (u_long)cpu_freq * 1000000ul;
 	return (0);
 }
 
@@ -600,6 +605,15 @@ map_gateway_page(void)
 	ia64_set_k5(VM_MAX_ADDRESS);
 }
 
+static u_int
+freq_ratio(u_long base, u_long ratio)
+{
+	u_long f;
+
+	f = (base * (ratio >> 32)) / (ratio & 0xfffffffful);
+	return ((f + 500000) / 1000000);
+}
+
 static void
 calculate_frequencies(void)
 {
@@ -622,15 +636,9 @@ calculate_frequencies(void)
 			       pal.pal_result[2] >> 32,
 			       pal.pal_result[2] & ((1L << 32) - 1));
 		}
-		processor_frequency =
-			sal.sal_result[0] * (pal.pal_result[0] >> 32)
-			/ (pal.pal_result[0] & ((1L << 32) - 1));
-		bus_frequency =
-			sal.sal_result[0] * (pal.pal_result[1] >> 32)
-			/ (pal.pal_result[1] & ((1L << 32) - 1));
-		itc_frequency =
-			sal.sal_result[0] * (pal.pal_result[2] >> 32)
-			/ (pal.pal_result[2] & ((1L << 32) - 1));
+		cpu_freq = freq_ratio(sal.sal_result[0], pal.pal_result[0]);
+		bus_freq = freq_ratio(sal.sal_result[0], pal.pal_result[1]);
+		itc_freq = freq_ratio(sal.sal_result[0], pal.pal_result[2]);
 	}
 }
 
@@ -971,6 +979,13 @@ bzero(void *buf, size_t len)
 	}
 }
 
+u_int
+ia64_itc_freq(void)
+{
+
+	return (itc_freq);
+}
+
 void
 DELAY(int n)
 {
@@ -979,7 +994,7 @@ DELAY(int n)
 	sched_pin();
 
 	start = ia64_get_itc();
-	end = start + (itc_frequency * n) / 1000000;
+	end = start + itc_freq * n;
 	/* printf("DELAY from 0x%lx to 0x%lx\n", start, end); */
 	do {
 		now = ia64_get_itc();

Modified: head/sys/ia64/include/clock.h
==============================================================================
--- head/sys/ia64/include/clock.h	Wed Dec 23 04:39:05 2009	(r200888)
+++ head/sys/ia64/include/clock.h	Wed Dec 23 04:48:42 2009	(r200889)
@@ -14,7 +14,6 @@
 #define	CLOCK_VECTOR	254
 
 extern uint64_t	ia64_clock_reload;
-extern uint64_t	itc_frequency;
 
 #endif
 

Modified: head/sys/ia64/include/md_var.h
==============================================================================
--- head/sys/ia64/include/md_var.h	Wed Dec 23 04:39:05 2009	(r200888)
+++ head/sys/ia64/include/md_var.h	Wed Dec 23 04:48:42 2009	(r200889)
@@ -90,6 +90,7 @@ int	ia64_highfp_enable(struct thread *, 
 int	ia64_highfp_save(struct thread *);
 int	ia64_highfp_save_ipi(void);
 struct ia64_init_return ia64_init(void);
+u_int	ia64_itc_freq(void);
 void	ia64_probe_sapics(void);
 void	ia64_sync_icache(vm_offset_t, vm_size_t);
 void	interrupt(struct trapframe *);

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 06:52:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F07A61065693;
	Wed, 23 Dec 2009 06:52:12 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF2BC8FC1B;
	Wed, 23 Dec 2009 06:52:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN6qCU9088829;
	Wed, 23 Dec 2009 06:52:12 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN6qCRa088827;
	Wed, 23 Dec 2009 06:52:12 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200912230652.nBN6qCRa088827@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Wed, 23 Dec 2009 06:52:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200891 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 06:52:13 -0000

Author: marcel
Date: Wed Dec 23 06:52:12 2009
New Revision: 200891
URL: http://svn.freebsd.org/changeset/base/200891

Log:
  Calculate the average CPU clock frequency and export that through
  the hw.freq.cpu sysctl variable. This can be used by ports that
  need to know "the" CPU frequency.

Modified:
  head/sys/sparc64/sparc64/identcpu.c

Modified: head/sys/sparc64/sparc64/identcpu.c
==============================================================================
--- head/sys/sparc64/sparc64/identcpu.c	Wed Dec 23 05:15:40 2009	(r200890)
+++ head/sys/sparc64/sparc64/identcpu.c	Wed Dec 23 06:52:12 2009	(r200891)
@@ -27,6 +27,13 @@ static char cpu_model[128];
 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
     cpu_model, 0, "Machine model");
 
+SYSCTL_NODE(_hw, OID_AUTO, freq, CTLFLAG_RD, 0, "");
+
+static u_int cpu_count;
+static u_int cpu_freq;
+SYSCTL_UINT(_hw_freq, OID_AUTO, cpu, CTLFLAG_RD, &cpu_freq, 0,
+    "CPU clock frequency");
+
 int cpu_impl;
 
 void
@@ -104,4 +111,11 @@ cpu_identify(u_long vers, u_int freq, u_
 		printf("  mask=0x%lx maxtl=%ld maxwin=%ld\n", VER_MASK(vers),
 		    VER_MAXTL(vers), VER_MAXWIN(vers));
 	}
+
+	/*
+	 * Calculate the average CPU frequency.
+	 */
+	freq = (freq + 500000ul) / 1000000ul;
+	cpu_freq = (cpu_freq * cpu_count + freq) / (cpu_count + 1);
+	cpu_count++;
 }

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 08:00:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7532C1065676;
	Wed, 23 Dec 2009 08:00:23 +0000 (UTC)
	(envelope-from marius@alchemy.franken.de)
Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214])
	by mx1.freebsd.org (Postfix) with ESMTP id F27658FC0A;
	Wed, 23 Dec 2009 08:00:22 +0000 (UTC)
Received: from alchemy.franken.de (localhost [127.0.0.1])
	by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id
	nBN80LZ5012593; Wed, 23 Dec 2009 09:00:21 +0100 (CET)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.3/8.14.3/Submit) id nBN80Lg9012592;
	Wed, 23 Dec 2009 09:00:21 +0100 (CET) (envelope-from marius)
Date: Wed, 23 Dec 2009 09:00:21 +0100
From: Marius Strobl 
To: John Baldwin 
Message-ID: <20091223080021.GJ74529@alchemy.franken.de>
References: <200912222102.nBML2k98076576@svn.freebsd.org>
	<200912221720.00692.jhb@freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200912221720.00692.jhb@freebsd.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200874 - in head/sys: dev/auxio sparc64/central
	sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 08:00:23 -0000

On Tue, Dec 22, 2009 at 05:20:00PM -0500, John Baldwin wrote:
> On Tuesday 22 December 2009 4:02:46 pm Marius Strobl wrote:
> > Author: marius
> > Date: Tue Dec 22 21:02:46 2009
> > New Revision: 200874
> > URL: http://svn.freebsd.org/changeset/base/200874
> > 
> > Log:
> >   Enroll these drivers in multipass probing. The motivation behind this
> >   is that the JBus to EBus bridges share the interrupt controller of a
> >   sibling JBus to PCIe bridge (at least as far as the OFW device tree
> >   is concerned, in reality they are part of the same chip) so we have to
> >   probe and attach the latter first. That happens to be also the case
> >   due to the fact that the JBus to PCIe bridges appear first in the OFW
> >   device tree but it doesn't hurt to ensure the right order.
> 
> Hmm, I'm curious why you used BUS_PASS_DEFAULT with EARLY_DRIVER_MODULE()?  
> The intent was that EARLY_DRIVER_MODULE() only really be used for drivers that 
> used a pass other than BUS_PASS_DEFAULT.

Just in order to document as good as possible that the use of
another pass level has been considered but was decided to not
be the right thing to do (although dma_sbus(4) can act like a
bus BUS_PASS_BUS isn't appropriate for example) as my impression
was that at some point in time we'll want to got through the
tree and change for example all bus drivers to use BUS_PASS_BUS
etc similarly to how BUS_PROBE_* at least partially was introduced
in a sweeping fashion (causing the expected breakage).

Marius


From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 12:00:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8436810656A4;
	Wed, 23 Dec 2009 12:00:50 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7419C8FC0A;
	Wed, 23 Dec 2009 12:00:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNC0oC5097340;
	Wed, 23 Dec 2009 12:00:50 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNC0oUW097338;
	Wed, 23 Dec 2009 12:00:50 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912231200.nBNC0oUW097338@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 23 Dec 2009 12:00:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200896 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 12:00:50 -0000

Author: luigi
Date: Wed Dec 23 12:00:50 2009
New Revision: 200896
URL: http://svn.freebsd.org/changeset/base/200896

Log:
  fix build on 64-bit architectures.
  Also fix the indentation on a few lines.

Modified:
  head/sys/netinet/ipfw/ip_fw2.c

Modified: head/sys/netinet/ipfw/ip_fw2.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw2.c	Wed Dec 23 11:35:25 2009	(r200895)
+++ head/sys/netinet/ipfw/ip_fw2.c	Wed Dec 23 12:00:50 2009	(r200896)
@@ -1962,8 +1962,8 @@ do {								\
 				f->pcnt++;	/* update stats */
 				f->bcnt += pktlen;
 				f->timestamp = time_uptime;
-					l = 0;		/* exit inner loop */
-					break;
+				l = 0;		/* exit inner loop */
+				break;
 
 			case O_SKIPTO:
 			    f->pcnt++;	/* update stats */
@@ -1974,8 +1974,8 @@ do {								\
 			     * (horrible hacks to avoid changing the ABI).
 			     */
 			    if (cmd->arg1 != IP_FW_TABLEARG &&
-				    (uint32_t)f->x_next == chain->id) {
-				f_pos = (uint32_t)f->next_rule;
+				    (uintptr_t)f->x_next == chain->id) {
+				f_pos = (uintptr_t)f->next_rule;
 			    } else {
 				int i = (cmd->arg1 == IP_FW_TABLEARG) ?
 					tablearg : cmd->arg1;
@@ -1985,18 +1985,18 @@ do {								\
 				f_pos = ipfw_find_rule(chain, i, 0);
 				/* update the cache */
 				if (cmd->arg1 != IP_FW_TABLEARG) {
-					f->next_rule =
+				    f->next_rule =
 					(void *)(uintptr_t)f_pos;
 				    f->x_next =
 					(void *)(uintptr_t)chain->id;
 				}
-				}
-				/*
+			    }
+			    /*
 			     * Skip disabled rules, and re-enter
 			     * the inner loop with the correct
 			     * f_pos, f, l and cmd.
-				 * Also clear cmdlen and skip_or
-				 */
+			     * Also clear cmdlen and skip_or
+			     */
 			    for (; f_pos < chain->n_rules - 1 &&
 				    (V_set_disable &
 				     (1 << chain->map[f_pos]->set));
@@ -2004,12 +2004,12 @@ do {								\
 				;
 			    /* prepare to enter the inner loop */
 			    f = chain->map[f_pos];
-					l = f->cmd_len;
-					cmd = f->cmd;
-				match = 1;
-				cmdlen = 0;
-				skip_or = 0;
-				break;
+			    l = f->cmd_len;
+			    cmd = f->cmd;
+			    match = 1;
+			    cmdlen = 0;
+			    skip_or = 0;
+			    break;
 
 			case O_REJECT:
 				/*

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 12:15:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 199EB106566B;
	Wed, 23 Dec 2009 12:15:22 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 084298FC08;
	Wed, 23 Dec 2009 12:15:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNCFL5T097758;
	Wed, 23 Dec 2009 12:15:21 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNCFLfN097756;
	Wed, 23 Dec 2009 12:15:21 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912231215.nBNCFLfN097756@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 23 Dec 2009 12:15:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200897 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 12:15:22 -0000

Author: luigi
Date: Wed Dec 23 12:15:21 2009
New Revision: 200897
URL: http://svn.freebsd.org/changeset/base/200897

Log:
  fix build with the new fast lookup structure.
  Also remove some unnecessary headers

Modified:
  head/sys/netinet/ipfw/ip_fw_nat.c

Modified: head/sys/netinet/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_nat.c	Wed Dec 23 12:00:50 2009	(r200896)
+++ head/sys/netinet/ipfw/ip_fw_nat.c	Wed Dec 23 12:15:21 2009	(r200897)
@@ -32,19 +32,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #define        IPFW_INTERNAL   /* Access to protected data structures in ip_fw.h. */
 
@@ -55,15 +48,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
 
 #include 	/* XXX for in_cksum */
 
@@ -75,10 +63,12 @@ ifaddr_change(void *arg __unused, struct
 {
 	struct cfg_nat *ptr;
 	struct ifaddr *ifa;
+	struct ip_fw_chain *chain;
 
-	IPFW_WLOCK(&V_layer3_chain);			
+	chain = &V_layer3_chain;
+	IPFW_WLOCK(chain);			
 	/* Check every nat entry... */
-	LIST_FOREACH(ptr, &V_layer3_chain.nat, _next) {
+	LIST_FOREACH(ptr, &chain->nat, _next) {
 		/* ...using nic 'ifp->if_xname' as dynamic alias address. */
 		if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) {
 			if_addr_rlock(ifp);
@@ -94,42 +84,26 @@ ifaddr_change(void *arg __unused, struct
 			if_addr_runlock(ifp);
 		}
 	}
-	IPFW_WUNLOCK(&V_layer3_chain);	
+	IPFW_WUNLOCK(chain);	
 }
 
+/*
+ * delete the pointers for nat entry ix, or all of them if ix < 0
+ */
 static void
-flush_nat_ptrs(const int i)
+flush_nat_ptrs(struct ip_fw_chain *chain, const int ix)
 {
-	struct ip_fw *rule;
+	int i;
 
-	IPFW_WLOCK_ASSERT(&V_layer3_chain);
-	for (rule = V_layer3_chain.rules; rule; rule = rule->next) {
-		ipfw_insn_nat *cmd = (ipfw_insn_nat *)ACTION_PTR(rule);
-		if (cmd->o.opcode != O_NAT)
-			continue;
-		if (cmd->nat != NULL && cmd->nat->id == i)
+	IPFW_WLOCK_ASSERT(chain);
+	for (i = 0; i < chain->n_rules; i++) {
+		ipfw_insn_nat *cmd = (ipfw_insn_nat *)ACTION_PTR(chain->map[i]);
+		if (cmd->o.opcode == O_NAT && cmd->nat != NULL &&
+			    (ix < 0 || cmd->nat->id == ix))
 			cmd->nat = NULL;
 	}
 }
 
-#define HOOK_NAT(b, p) do {				\
-		IPFW_WLOCK_ASSERT(&V_layer3_chain);	\
-		LIST_INSERT_HEAD(b, p, _next);		\
-	} while (0)
-
-#define UNHOOK_NAT(p) do {				\
-		IPFW_WLOCK_ASSERT(&V_layer3_chain);	\
-		LIST_REMOVE(p, _next);			\
-	} while (0)
-
-#define HOOK_REDIR(b, p) do {			\
-		LIST_INSERT_HEAD(b, p, _next);	\
-	} while (0)
-
-#define HOOK_SPOOL(b, p) do {			\
-		LIST_INSERT_HEAD(b, p, _next);	\
-	} while (0)
-
 static void
 del_redir_spool_cfg(struct cfg_nat *n, struct redir_chain *head)
 {
@@ -223,10 +197,10 @@ add_redir_spool_cfg(char *buf, struct cf
 				    s->addr, htons(s->port));
 				off += SOF_SPOOL;
 				/* Hook spool entry. */
-				HOOK_SPOOL(&r->spool_chain, s);
+				LIST_INSERT_HEAD(&r->spool_chain, s, _next);
 			}
 		/* And finally hook this redir entry. */
-		HOOK_REDIR(&ptr->redir_chain, r);
+		LIST_INSERT_HEAD(&ptr->redir_chain, r, _next);
 	}
 	return (1);
 bad:
@@ -418,29 +392,31 @@ ipfw_nat_cfg(struct sockopt *sopt)
 {
 	struct cfg_nat *ptr, *ser_n;
 	char *buf;
+	struct ip_fw_chain *chain = &V_layer3_chain;
 
 	buf = malloc(NAT_BUF_LEN, M_IPFW, M_WAITOK | M_ZERO);
 	sooptcopyin(sopt, buf, NAT_BUF_LEN, 
 	    sizeof(struct cfg_nat));
 	ser_n = (struct cfg_nat *)buf;
 
+	/* check valid parameter ser_n->id > 0 ? */
 	/* 
 	 * Find/create nat rule.
 	 */
-	IPFW_WLOCK(&V_layer3_chain);
-	LOOKUP_NAT(&V_layer3_chain.nat, ser_n->id, ptr);
+	IPFW_WLOCK(chain);
+	LOOKUP_NAT(&chain->nat, ser_n->id, ptr);
 	if (ptr == NULL) {
 		/* New rule: allocate and init new instance. */
 		ptr = malloc(sizeof(struct cfg_nat), 
 		    M_IPFW, M_NOWAIT | M_ZERO);
 		if (ptr == NULL) {
-			IPFW_WUNLOCK(&V_layer3_chain);				
+			IPFW_WUNLOCK(chain);				
 			free(buf, M_IPFW);
 			return (ENOSPC);
 		}
 		ptr->lib = LibAliasInit(NULL);
 		if (ptr->lib == NULL) {
-			IPFW_WUNLOCK(&V_layer3_chain);
+			IPFW_WUNLOCK(chain);
 			free(ptr, M_IPFW);
 			free(buf, M_IPFW);
 			return (EINVAL);
@@ -448,10 +424,10 @@ ipfw_nat_cfg(struct sockopt *sopt)
 		LIST_INIT(&ptr->redir_chain);
 	} else {
 		/* Entry already present: temporarly unhook it. */
-		UNHOOK_NAT(ptr);
-		flush_nat_ptrs(ser_n->id);
+		LIST_REMOVE(ptr, _next);
+		flush_nat_ptrs(chain, ser_n->id);
 	}
-	IPFW_WUNLOCK(&V_layer3_chain);
+	IPFW_WUNLOCK(chain);
 
 	/* 
 	 * Basic nat configuration.
@@ -477,9 +453,9 @@ ipfw_nat_cfg(struct sockopt *sopt)
 	/* Add new entries. */
 	add_redir_spool_cfg(&buf[(sizeof(struct cfg_nat))], ptr);
 	free(buf, M_IPFW);
-	IPFW_WLOCK(&V_layer3_chain);
-	HOOK_NAT(&V_layer3_chain.nat, ptr);
-	IPFW_WUNLOCK(&V_layer3_chain);
+	IPFW_WLOCK(chain);
+	LIST_INSERT_HEAD(&chain->nat, ptr, _next);
+	IPFW_WUNLOCK(chain);
 	return (0);
 }
 
@@ -487,18 +463,19 @@ static int
 ipfw_nat_del(struct sockopt *sopt)
 {
 	struct cfg_nat *ptr;
+	struct ip_fw_chain *chain = &V_layer3_chain;
 	int i;
 		
 	sooptcopyin(sopt, &i, sizeof i, sizeof i);
-	IPFW_WLOCK(&V_layer3_chain);
-	LOOKUP_NAT(&V_layer3_chain.nat, i, ptr);
+	IPFW_WLOCK(chain);
+	LOOKUP_NAT(&chain->nat, i, ptr);
 	if (ptr == NULL) {
-		IPFW_WUNLOCK(&V_layer3_chain);
+		IPFW_WUNLOCK(chain);
 		return (EINVAL);
 	}
-	UNHOOK_NAT(ptr);
-	flush_nat_ptrs(i);
-	IPFW_WUNLOCK(&V_layer3_chain);
+	LIST_REMOVE(ptr, _next);
+	flush_nat_ptrs(chain, i);
+	IPFW_WUNLOCK(chain);
 	del_redir_spool_cfg(ptr, &ptr->redir_chain);
 	LibAliasUninit(ptr->lib);
 	free(ptr, M_IPFW);
@@ -513,14 +490,16 @@ ipfw_nat_get_cfg(struct sockopt *sopt)
 	struct cfg_redir *r;
 	struct cfg_spool *s;
 	int nat_cnt, off;
-		
+	struct ip_fw_chain *chain;
+
+	chain = &V_layer3_chain;
 	nat_cnt = 0;
 	off = sizeof(nat_cnt);
 
 	data = malloc(NAT_BUF_LEN, M_IPFW, M_WAITOK | M_ZERO);
-	IPFW_RLOCK(&V_layer3_chain);
+	IPFW_RLOCK(chain);
 	/* Serialize all the data. */
-	LIST_FOREACH(n, &V_layer3_chain.nat, _next) {
+	LIST_FOREACH(n, &chain->nat, _next) {
 		nat_cnt++;
 		if (off + SOF_NAT < NAT_BUF_LEN) {
 			bcopy(n, &data[off], SOF_NAT);
@@ -547,12 +526,12 @@ ipfw_nat_get_cfg(struct sockopt *sopt)
 			goto nospace;
 	}
 	bcopy(&nat_cnt, data, sizeof(nat_cnt));
-	IPFW_RUNLOCK(&V_layer3_chain);
+	IPFW_RUNLOCK(chain);
 	sooptcopyout(sopt, data, NAT_BUF_LEN);
 	free(data, M_IPFW);
 	return (0);
 nospace:
-	IPFW_RUNLOCK(&V_layer3_chain);
+	IPFW_RUNLOCK(chain);
 	printf("serialized data buffer not big enough:"
 	    "please increase NAT_BUF_LEN\n");
 	free(data, M_IPFW);
@@ -565,21 +544,23 @@ ipfw_nat_get_log(struct sockopt *sopt)
 	uint8_t *data;
 	struct cfg_nat *ptr;
 	int i, size, cnt, sof;
+	struct ip_fw_chain *chain;
 
+	chain = &V_layer3_chain;
 	data = NULL;
 	sof = LIBALIAS_BUF_SIZE;
 	cnt = 0;
 
-	IPFW_RLOCK(&V_layer3_chain);
+	IPFW_RLOCK(chain);
 	size = i = 0;
-	LIST_FOREACH(ptr, &V_layer3_chain.nat, _next) {
+	LIST_FOREACH(ptr, &chain->nat, _next) {
 		if (ptr->lib->logDesc == NULL) 
 			continue;
 		cnt++;
 		size = cnt * (sof + sizeof(int));
 		data = realloc(data, size, M_IPFW, M_NOWAIT | M_ZERO);
 		if (data == NULL) {
-			IPFW_RUNLOCK(&V_layer3_chain);
+			IPFW_RUNLOCK(chain);
 			return (ENOSPC);
 		}
 		bcopy(&ptr->id, &data[i], sizeof(int));
@@ -587,7 +568,7 @@ ipfw_nat_get_log(struct sockopt *sopt)
 		bcopy(ptr->lib->logDesc, &data[i], sof);
 		i += sof;
 	}
-	IPFW_RUNLOCK(&V_layer3_chain);
+	IPFW_RUNLOCK(chain);
 	sooptcopyout(sopt, data, size);
 	free(data, M_IPFW);
 	return(0);
@@ -613,23 +594,19 @@ ipfw_nat_init(void)
 static void
 ipfw_nat_destroy(void)
 {
-	struct ip_fw *rule;
 	struct cfg_nat *ptr, *ptr_temp;
-	
-	IPFW_WLOCK(&V_layer3_chain);
-	LIST_FOREACH_SAFE(ptr, &V_layer3_chain.nat, _next, ptr_temp) {
+	struct ip_fw_chain *chain;
+
+	chain = &V_layer3_chain;
+	IPFW_WLOCK(chain);
+	LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) {
 		LIST_REMOVE(ptr, _next);
 		del_redir_spool_cfg(ptr, &ptr->redir_chain);
 		LibAliasUninit(ptr->lib);
 		free(ptr, M_IPFW);
 	}
 	EVENTHANDLER_DEREGISTER(ifaddr_event, V_ifaddr_event_tag);
-	/* flush all nat ptrs */
-	for (rule = V_layer3_chain.rules; rule; rule = rule->next) {
-		ipfw_insn_nat *cmd = (ipfw_insn_nat *)ACTION_PTR(rule);
-		if (cmd->o.opcode == O_NAT)
-			cmd->nat = NULL;
-	}
+	flush_nat_ptrs(chain, -1 /* flush all */);
 	/* deregister ipfw_nat */
 	ipfw_nat_ptr = NULL;
 	lookup_nat_ptr = NULL;
@@ -637,7 +614,7 @@ ipfw_nat_destroy(void)
 	ipfw_nat_del_ptr = NULL;
 	ipfw_nat_get_cfg_ptr = NULL;
 	ipfw_nat_get_log_ptr = NULL;
-	IPFW_WUNLOCK(&V_layer3_chain);
+	IPFW_WUNLOCK(chain);
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 12:31:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A13E21065672;
	Wed, 23 Dec 2009 12:31:27 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 902458FC17;
	Wed, 23 Dec 2009 12:31:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNCVRb8098083;
	Wed, 23 Dec 2009 12:31:27 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNCVRj4098081;
	Wed, 23 Dec 2009 12:31:27 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200912231231.nBNCVRj4098081@svn.freebsd.org>
From: Robert Watson 
Date: Wed, 23 Dec 2009 12:31:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200898 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 12:31:27 -0000

Author: rwatson
Date: Wed Dec 23 12:31:27 2009
New Revision: 200898
URL: http://svn.freebsd.org/changeset/base/200898

Log:
  Refine netisr.c comments a bit.

Modified:
  head/sys/net/netisr.c

Modified: head/sys/net/netisr.c
==============================================================================
--- head/sys/net/netisr.c	Wed Dec 23 12:15:21 2009	(r200897)
+++ head/sys/net/netisr.c	Wed Dec 23 12:31:27 2009	(r200898)
@@ -32,13 +32,13 @@ __FBSDID("$FreeBSD$");
  * dispatched) and asynchronous (deferred dispatch) processing of packets by
  * registered protocol handlers.  Callers pass a protocol identifier and
  * packet to netisr, along with a direct dispatch hint, and work will either
- * be immediately processed with the registered handler, or passed to a
- * kernel software interrupt (SWI) thread for deferred dispatch.  Callers
- * will generally select one or the other based on:
+ * be immediately processed by the registered handler, or passed to a
+ * software interrupt (SWI) thread for deferred dispatch.  Callers will
+ * generally select one or the other based on:
  *
- * - Might directly dispatching a netisr handler lead to code reentrance or
+ * - Whether directly dispatching a netisr handler lead to code reentrance or
  *   lock recursion, such as entering the socket code from the socket code.
- * - Might directly dispatching a netisr handler lead to recursive
+ * - Whether directly dispatching a netisr handler lead to recursive
  *   processing, such as when decapsulating several wrapped layers of tunnel
  *   information (IPSEC within IPSEC within ...).
  *
@@ -54,9 +54,9 @@ __FBSDID("$FreeBSD$");
  * more than one flow.
  *
  * netisr supports several policy variations, represented by the
- * NETISR_POLICY_* constants, allowing protocols to play a varying role in
+ * NETISR_POLICY_* constants, allowing protocols to play various roles in
  * identifying flows, assigning work to CPUs, etc.  These are described in
- * detail in netisr.h.
+ * netisr.h.
  */
 
 #include "opt_ddb.h"
@@ -101,7 +101,7 @@ __FBSDID("$FreeBSD$");
  *
  * Note: the NETISR_LOCKING define controls whether read locks are acquired
  * in packet processing paths requiring netisr registration stability.  This
- * is disabled by default as it can lead to a measurable performance
+ * is disabled by default as it can lead to measurable performance
  * degradation even with rmlocks (3%-6% for loopback ping-pong traffic), and
  * because netisr registration and unregistration is extremely rare at
  * runtime.  If it becomes more common, this decision should be revisited.
@@ -166,8 +166,9 @@ SYSCTL_INT(_net_isr, OID_AUTO, bindthrea
     &netisr_bindthreads, 0, "Bind netisr threads to CPUs.");
 
 /*
- * Limit per-workstream queues to at most net.isr.maxqlimit, both for initial
- * configuration and later modification using netisr_setqlimit().
+ * Limit per-workstream mbuf queue limits s to at most net.isr.maxqlimit,
+ * both for initial configuration and later modification using
+ * netisr_setqlimit().
  */
 #define	NETISR_DEFAULT_MAXQLIMIT	10240
 static u_int	netisr_maxqlimit = NETISR_DEFAULT_MAXQLIMIT;
@@ -177,9 +178,9 @@ SYSCTL_INT(_net_isr, OID_AUTO, maxqlimit
     "Maximum netisr per-protocol, per-CPU queue depth.");
 
 /*
- * The default per-workstream queue limit for protocols that don't initialize
- * the nh_qlimit field of their struct netisr_handler.  If this is set above
- * netisr_maxqlimit, we truncate it to the maximum during boot.
+ * The default per-workstream mbuf queue limit for protocols that don't
+ * initialize the nh_qlimit field of their struct netisr_handler.  If this is
+ * set above netisr_maxqlimit, we truncate it to the maximum during boot.
  */
 #define	NETISR_DEFAULT_DEFAULTQLIMIT	256
 static u_int	netisr_defaultqlimit = NETISR_DEFAULT_DEFAULTQLIMIT;
@@ -237,12 +238,14 @@ struct netisr_work {
 };
 
 /*
- * Workstreams hold a set of ordered work across each protocol, and are
+ * Workstreams hold a queue of ordered work across each protocol, and are
  * described by netisr_workstream.  Each workstream is associated with a
  * worker thread, which in turn is pinned to a CPU.  Work associated with a
  * workstream can be processd in other threads during direct dispatch;
  * concurrent processing is prevented by the NWS_RUNNING flag, which
- * indicates that a thread is already processing the work queue.
+ * indicates that a thread is already processing the work queue.  It is
+ * important to prevent a directly dispatched packet from "skipping ahead" of
+ * work already in the workstream queue.
  */
 struct netisr_workstream {
 	struct intr_event *nws_intr_event;	/* Handler for stream. */
@@ -317,7 +320,7 @@ netisr_get_cpuid(u_int cpunumber)
 }
 
 /*
- * The default implementation of -> CPU ID mapping.
+ * The default implementation of flow -> CPU ID mapping.
  *
  * Non-static so that protocols can use it to map their own work to specific
  * CPUs in a manner consistent to netisr for affinity purposes.
@@ -437,7 +440,7 @@ netisr_clearqdrops(const struct netisr_h
 }
 
 /*
- * Query the current drop counters across all workstreams for a protocol.
+ * Query current drop counters across all workstreams for a protocol.
  */
 void
 netisr_getqdrops(const struct netisr_handler *nhp, u_int64_t *qdropp)
@@ -472,7 +475,7 @@ netisr_getqdrops(const struct netisr_han
 }
 
 /*
- * Query the current queue limit for per-workstream queues for a protocol.
+ * Query current per-workstream queue limit for a protocol.
  */
 void
 netisr_getqlimit(const struct netisr_handler *nhp, u_int *qlimitp)
@@ -726,7 +729,7 @@ netisr_process_workstream_proto(struct n
 }
 
 /*
- * SWI handler for netisr -- processes prackets in a set of workstreams that
+ * SWI handler for netisr -- processes packets in a set of workstreams that
  * it owns, woken up by calls to NWS_SIGNAL().  If this workstream is already
  * being direct dispatched, go back to sleep and wait for the dispatching
  * thread to wake us up again.
@@ -794,6 +797,11 @@ netisr_queue_workstream(struct netisr_wo
 		npwp->nw_len++;
 		if (npwp->nw_len > npwp->nw_watermark)
 			npwp->nw_watermark = npwp->nw_len;
+
+		/*
+		 * We must set the bit regardless of NWS_RUNNING, so that
+		 * swi_net() keeps calling netisr_process_workstream_proto().
+		 */
 		nwsp->nws_pendingbits |= (1 << proto);
 		if (!(nwsp->nws_flags & 
 		    (NWS_RUNNING | NWS_DISPATCHING | NWS_SCHEDULED))) {
@@ -874,7 +882,7 @@ netisr_queue(u_int proto, struct mbuf *m
 }
 
 /*
- * Dispatch a packet for netisr processing, direct dispatch permitted by
+ * Dispatch a packet for netisr processing; direct dispatch is permitted by
  * calling context.
  */
 int

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 12:33:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9C0A1065692;
	Wed, 23 Dec 2009 12:33:59 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A98D08FC1C;
	Wed, 23 Dec 2009 12:33:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNCXxol098181;
	Wed, 23 Dec 2009 12:33:59 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNCXxV0098179;
	Wed, 23 Dec 2009 12:33:59 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200912231233.nBNCXxV0098179@svn.freebsd.org>
From: Robert Watson 
Date: Wed, 23 Dec 2009 12:33:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200899 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 12:33:59 -0000

Author: rwatson
Date: Wed Dec 23 12:33:59 2009
New Revision: 200899
URL: http://svn.freebsd.org/changeset/base/200899

Log:
  When warning about possible netisr configuration problems during boot,
  report using "netisr_init" rather than "netisr2", which was the development
  name for the project.
  
  MFC after:	3 days

Modified:
  head/sys/net/netisr.c

Modified: head/sys/net/netisr.c
==============================================================================
--- head/sys/net/netisr.c	Wed Dec 23 12:31:27 2009	(r200898)
+++ head/sys/net/netisr.c	Wed Dec 23 12:33:59 2009	(r200899)
@@ -1076,12 +1076,12 @@ netisr_init(void *arg)
 	if (netisr_maxthreads < 1)
 		netisr_maxthreads = 1;
 	if (netisr_maxthreads > mp_ncpus) {
-		printf("netisr2: forcing maxthreads from %d to %d\n",
+		printf("netisr_init: forcing maxthreads from %d to %d\n",
 		    netisr_maxthreads, mp_ncpus);
 		netisr_maxthreads = mp_ncpus;
 	}
 	if (netisr_defaultqlimit > netisr_maxqlimit) {
-		printf("netisr2: forcing defaultqlimit from %d to %d\n",
+		printf("netisr_init: forcing defaultqlimit from %d to %d\n",
 		    netisr_defaultqlimit, netisr_maxqlimit);
 		netisr_defaultqlimit = netisr_maxqlimit;
 	}
@@ -1092,8 +1092,8 @@ netisr_init(void *arg)
 	 * polling disables parallel netisr workers.
 	 */
 	if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
-		printf("netisr2: forcing maxthreads to 1 and bindthreads to "
-		    "0 for device polling\n");
+		printf("netisr_init: forcing maxthreads to 1 and "
+		    "bindthreads to 0 for device polling\n");
 		netisr_maxthreads = 1;
 		netisr_bindthreads = 0;
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 14:38:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B68FF1065672;
	Wed, 23 Dec 2009 14:38:37 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 857FB8FC0A;
	Wed, 23 Dec 2009 14:38:37 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 307F546B17;
	Wed, 23 Dec 2009 09:38:37 -0500 (EST)
Received: from jhbbsd.localnet (unknown [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 737B48A01D;
	Wed, 23 Dec 2009 09:38:35 -0500 (EST)
From: John Baldwin 
To: Marius Strobl 
Date: Wed, 23 Dec 2009 09:32:34 -0500
User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; )
References: <200912222102.nBML2k98076576@svn.freebsd.org>
	<200912221720.00692.jhb@freebsd.org>
	<20091223080021.GJ74529@alchemy.franken.de>
In-Reply-To: <20091223080021.GJ74529@alchemy.franken.de>
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200912230932.34491.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Wed, 23 Dec 2009 09:38:35 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200874 - in head/sys: dev/auxio sparc64/central
	sparc64/ebus sparc64/fhc sparc64/pci sparc64/sbus sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 14:38:37 -0000

On Wednesday 23 December 2009 3:00:21 am Marius Strobl wrote:
> On Tue, Dec 22, 2009 at 05:20:00PM -0500, John Baldwin wrote:
> > On Tuesday 22 December 2009 4:02:46 pm Marius Strobl wrote:
> > > Author: marius
> > > Date: Tue Dec 22 21:02:46 2009
> > > New Revision: 200874
> > > URL: http://svn.freebsd.org/changeset/base/200874
> > > 
> > > Log:
> > >   Enroll these drivers in multipass probing. The motivation behind this
> > >   is that the JBus to EBus bridges share the interrupt controller of a
> > >   sibling JBus to PCIe bridge (at least as far as the OFW device tree
> > >   is concerned, in reality they are part of the same chip) so we have to
> > >   probe and attach the latter first. That happens to be also the case
> > >   due to the fact that the JBus to PCIe bridges appear first in the OFW
> > >   device tree but it doesn't hurt to ensure the right order.
> > 
> > Hmm, I'm curious why you used BUS_PASS_DEFAULT with EARLY_DRIVER_MODULE()?  
> > The intent was that EARLY_DRIVER_MODULE() only really be used for drivers that 
> > used a pass other than BUS_PASS_DEFAULT.
> 
> Just in order to document as good as possible that the use of
> another pass level has been considered but was decided to not
> be the right thing to do (although dma_sbus(4) can act like a
> bus BUS_PASS_BUS isn't appropriate for example) as my impression
> was that at some point in time we'll want to got through the
> tree and change for example all bus drivers to use BUS_PASS_BUS
> etc similarly to how BUS_PROBE_* at least partially was introduced
> in a sweeping fashion (causing the expected breakage).

Ok.  I am slowly working on allow for multiple passes but am working on
resource management stuff currently (the resource_list_reserve() commit).
Hopefully in the not too distant future I can teach the PCI bus driver to
handle multiple passes correctly along with ACPI and many other x86
bus drivers.  I'm not able to test non-x86 at this point, but I believe
that the PCI bus changes I make will be suitable for other platforms.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 15:22:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CCEE1065670;
	Wed, 23 Dec 2009 15:22:51 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3C79B8FC16;
	Wed, 23 Dec 2009 15:22:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNFMpoN001697;
	Wed, 23 Dec 2009 15:22:51 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNFMpHA001695;
	Wed, 23 Dec 2009 15:22:51 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912231522.nBNFMpHA001695@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 23 Dec 2009 15:22:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200902 - head/usr.bin/truss
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 15:22:51 -0000

Author: ed
Date: Wed Dec 23 15:22:50 2009
New Revision: 200902
URL: http://svn.freebsd.org/changeset/base/200902

Log:
  Allow proper tracing of posix_openpt(2).

Modified:
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c	Wed Dec 23 14:55:33 2009	(r200901)
+++ head/usr.bin/truss/syscalls.c	Wed Dec 23 15:22:50 2009	(r200902)
@@ -258,6 +258,8 @@ struct syscall syscalls[] = {
 	  .args = { { Name , 0 } , { Name, 1 } } },
 	{ .name = "symlink", .ret_type = 1, .nargs = 2,
 	  .args = { { Name , 0 } , { Name, 1 } } },
+	{ .name = "posix_openpt", .ret_type = 1, .nargs = 1,
+	  .args = { { Open, 0 } } },
 	{ .name = 0 },
 };
 

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 17:46:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 32B9F1065696;
	Wed, 23 Dec 2009 17:46:12 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21DFC8FC21;
	Wed, 23 Dec 2009 17:46:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNHkCOF004729;
	Wed, 23 Dec 2009 17:46:12 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNHkCbG004727;
	Wed, 23 Dec 2009 17:46:12 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231746.nBNHkCbG004727@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 17:46:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200904 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 17:46:12 -0000

Author: yongari
Date: Wed Dec 23 17:46:11 2009
New Revision: 200904
URL: http://svn.freebsd.org/changeset/base/200904

Log:
  Don't reinitialize controller if driver is already running. This
  reduces number of link state UP/DOWN changes.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 16:30:39 2009	(r200903)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 17:46:11 2009	(r200904)
@@ -643,8 +643,10 @@ ste_poll_locked(struct ifnet *ifp, enum 
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR)
+		if (status & STE_ISR_HOSTERR) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			ste_init_locked(sc);
+		}
 	}
 	return (rx_npkts);
 }
@@ -692,8 +694,10 @@ ste_intr(void *xsc)
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR)
+		if (status & STE_ISR_HOSTERR) {
 			ste_init_locked(sc);
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+		}
 	}
 
 	/* Re-enable interrupts */
@@ -832,6 +836,7 @@ ste_txeoc(struct ste_softc *sc)
 				STE_SETBIT4(sc, STE_DMACTL,
 				    STE_DMACTL_TXDMA_STALL);
 				ste_wait(sc);
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				ste_init_locked(sc);
 				break;
 			}
@@ -1548,6 +1553,9 @@ ste_init_locked(struct ste_softc *sc)
 	STE_LOCK_ASSERT(sc);
 	ifp = sc->ste_ifp;
 
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
+
 	ste_stop(sc);
 	/* Reset the chip to a known state. */
 	ste_reset(sc);
@@ -2005,6 +2013,7 @@ ste_watchdog(struct ste_softc *sc)
 	ste_txeof(sc);
 	ste_txeoc(sc);
 	ste_rxeof(sc, -1);
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	ste_init_locked(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 17:54:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82775106568D;
	Wed, 23 Dec 2009 17:54:24 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 717BC8FC18;
	Wed, 23 Dec 2009 17:54:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNHsOik004920;
	Wed, 23 Dec 2009 17:54:24 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNHsOYO004918;
	Wed, 23 Dec 2009 17:54:24 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231754.nBNHsOYO004918@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 17:54:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200905 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 17:54:24 -0000

Author: yongari
Date: Wed Dec 23 17:54:24 2009
New Revision: 200905
URL: http://svn.freebsd.org/changeset/base/200905

Log:
  Reimplement controller reset. Datasheet says full reset takes about
  1ms. Since we switched to memory register mapping make sure to
  flush PCI posted write by reading the register again.
  While I'm here add additional delays in loop while driver waits the
  completion of the reset.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 17:46:11 2009	(r200904)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 17:54:24 2009	(r200905)
@@ -1731,20 +1731,27 @@ ste_stop(struct ste_softc *sc)
 static void
 ste_reset(struct ste_softc *sc)
 {
+	uint32_t ctl;
 	int i;
 
-	STE_SETBIT4(sc, STE_ASICCTL,
-	    STE_ASICCTL_GLOBAL_RESET|STE_ASICCTL_RX_RESET|
-	    STE_ASICCTL_TX_RESET|STE_ASICCTL_DMA_RESET|
-	    STE_ASICCTL_FIFO_RESET|STE_ASICCTL_NETWORK_RESET|
-	    STE_ASICCTL_AUTOINIT_RESET|STE_ASICCTL_HOST_RESET|
-	    STE_ASICCTL_EXTRESET_RESET);
-
-	DELAY(100000);
+	ctl = CSR_READ_4(sc, STE_ASICCTL);
+	ctl |= STE_ASICCTL_GLOBAL_RESET | STE_ASICCTL_RX_RESET |
+	    STE_ASICCTL_TX_RESET | STE_ASICCTL_DMA_RESET |
+	    STE_ASICCTL_FIFO_RESET | STE_ASICCTL_NETWORK_RESET |
+	    STE_ASICCTL_AUTOINIT_RESET |STE_ASICCTL_HOST_RESET |
+	    STE_ASICCTL_EXTRESET_RESET;
+	CSR_WRITE_4(sc, STE_ASICCTL, ctl);
+	CSR_READ_4(sc, STE_ASICCTL);
+	/*
+	 * Due to the need of accessing EEPROM controller can take
+	 * up to 1ms to complete the global reset.
+	 */
+	DELAY(1000);
 
 	for (i = 0; i < STE_TIMEOUT; i++) {
 		if (!(CSR_READ_4(sc, STE_ASICCTL) & STE_ASICCTL_RESET_BUSY))
 			break;
+		DELAY(10);
 	}
 
 	if (i == STE_TIMEOUT)

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 18:24:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9BB56106568B;
	Wed, 23 Dec 2009 18:24:22 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F75D8FC1C;
	Wed, 23 Dec 2009 18:24:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNIOMuY005538;
	Wed, 23 Dec 2009 18:24:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNIOM7v005536;
	Wed, 23 Dec 2009 18:24:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231824.nBNIOM7v005536@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 18:24:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200906 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 18:24:22 -0000

Author: yongari
Date: Wed Dec 23 18:24:22 2009
New Revision: 200906
URL: http://svn.freebsd.org/changeset/base/200906

Log:
  Overhaul RX filter programming.
   o Let RX filter handler program promiscuous/multicast filter as
     well as broadcasting.
   o Remove unnecessary register access.
   o Simplify ioctl handler and have set_rxfilter to handle
     IFF_PROMISC and IFF_ALLMULTI change instead of directly
     programming the controller.
   o Removed unnecessary error variable reinitialization in ioctl
     handler.
   o Add IFF_DRV_RUNNING check before programming multicast filter.
   o Configure maximum allowed frame length before enabling MAC.
     Datasheet didn't say the exact ordering of programming sequence
     but it looks more natural to set maximum allowed frame length
     first prior to enabling controller.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 17:54:24 2009	(r200905)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 18:24:22 2009	(r200906)
@@ -123,7 +123,7 @@ static int	ste_read_eeprom(struct ste_so
 static void	ste_reset(struct ste_softc *);
 static void	ste_restart_tx(struct ste_softc *);
 static int	ste_rxeof(struct ste_softc *, int);
-static void	ste_setmulti(struct ste_softc *);
+static void	ste_rxfilter(struct ste_softc *);
 static void	ste_start(struct ifnet *);
 static void	ste_start_locked(struct ifnet *);
 static void	ste_stats_update(struct ste_softc *);
@@ -563,27 +563,33 @@ ste_read_eeprom(struct ste_softc *sc, ca
 }
 
 static void
-ste_setmulti(struct ste_softc *sc)
+ste_rxfilter(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
 	struct ifmultiaddr *ifma;
 	uint32_t hashes[2] = { 0, 0 };
+	uint8_t rxcfg;
 	int h;
 
+	STE_LOCK_ASSERT(sc);
+
 	ifp = sc->ste_ifp;
-	if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
-		STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_ALLMULTI);
-		STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_MULTIHASH);
-		return;
+	rxcfg = CSR_READ_1(sc, STE_RX_MODE);
+	rxcfg |= STE_RXMODE_UNICAST;
+	rxcfg &= ~(STE_RXMODE_ALLMULTI | STE_RXMODE_MULTIHASH |
+	    STE_RXMODE_BROADCAST | STE_RXMODE_PROMISC);
+	if (ifp->if_flags & IFF_BROADCAST)
+		rxcfg |= STE_RXMODE_BROADCAST;
+	if ((ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) != 0) {
+		if ((ifp->if_flags & IFF_ALLMULTI) != 0)
+			rxcfg |= STE_RXMODE_ALLMULTI;
+		if ((ifp->if_flags & IFF_PROMISC) != 0)
+			rxcfg |= STE_RXMODE_PROMISC;
+		goto chipit;
 	}
 
-	/* first, zot all the existing hash bits */
-	CSR_WRITE_2(sc, STE_MAR0, 0);
-	CSR_WRITE_2(sc, STE_MAR1, 0);
-	CSR_WRITE_2(sc, STE_MAR2, 0);
-	CSR_WRITE_2(sc, STE_MAR3, 0);
-
-	/* now program new ones */
+	rxcfg |= STE_RXMODE_MULTIHASH;
+	/* Now program new ones. */
 	if_maddr_rlock(ifp);
 	TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 		if (ifma->ifma_addr->sa_family != AF_LINK)
@@ -597,12 +603,13 @@ ste_setmulti(struct ste_softc *sc)
 	}
 	if_maddr_runlock(ifp);
 
+chipit:
 	CSR_WRITE_2(sc, STE_MAR0, hashes[0] & 0xFFFF);
 	CSR_WRITE_2(sc, STE_MAR1, (hashes[0] >> 16) & 0xFFFF);
 	CSR_WRITE_2(sc, STE_MAR2, hashes[1] & 0xFFFF);
 	CSR_WRITE_2(sc, STE_MAR3, (hashes[1] >> 16) & 0xFFFF);
-	STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_ALLMULTI);
-	STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_MULTIHASH);
+	CSR_WRITE_1(sc, STE_RX_MODE, rxcfg);
+	CSR_READ_1(sc, STE_RX_MODE);
 }
 
 #ifdef DEVICE_POLLING
@@ -1590,24 +1597,11 @@ ste_init_locked(struct ste_softc *sc)
 	/* Set the TX reclaim threshold. */
 	CSR_WRITE_1(sc, STE_TX_RECLAIM_THRESH, (STE_PACKET_SIZE >> 4));
 
-	/* Set up the RX filter. */
-	CSR_WRITE_1(sc, STE_RX_MODE, STE_RXMODE_UNICAST);
-
-	/* If we want promiscuous mode, set the allframes bit. */
-	if (ifp->if_flags & IFF_PROMISC) {
-		STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_PROMISC);
-	} else {
-		STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_PROMISC);
-	}
-
-	/* Set capture broadcast bit to accept broadcast frames. */
-	if (ifp->if_flags & IFF_BROADCAST) {
-		STE_SETBIT1(sc, STE_RX_MODE, STE_RXMODE_BROADCAST);
-	} else {
-		STE_CLRBIT1(sc, STE_RX_MODE, STE_RXMODE_BROADCAST);
-	}
+	/* Accept VLAN length packets */
+	CSR_WRITE_2(sc, STE_MAX_FRAMELEN, ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN);
 
-	ste_setmulti(sc);
+	/* Set up the RX filter. */
+	ste_rxfilter(sc);
 
 	/* Load the address of the RX list. */
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_RXDMA_STALL);
@@ -1647,9 +1641,6 @@ ste_init_locked(struct ste_softc *sc)
 	/* Enable interrupts. */
 	CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
 
-	/* Accept VLAN length packets */
-	CSR_WRITE_2(sc, STE_MAX_FRAMELEN, ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN);
-
 	ste_ifmedia_upd_locked(ifp);
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -1792,39 +1783,24 @@ ste_ioctl(struct ifnet *ifp, u_long comm
 	switch (command) {
 	case SIOCSIFFLAGS:
 		STE_LOCK(sc);
-		if (ifp->if_flags & IFF_UP) {
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-			    ifp->if_flags & IFF_PROMISC &&
-			    !(sc->ste_if_flags & IFF_PROMISC)) {
-				STE_SETBIT1(sc, STE_RX_MODE,
-				    STE_RXMODE_PROMISC);
-			} else if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-			    !(ifp->if_flags & IFF_PROMISC) &&
-			    sc->ste_if_flags & IFF_PROMISC) {
-				STE_CLRBIT1(sc, STE_RX_MODE,
-				    STE_RXMODE_PROMISC);
-			}
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
-			    (ifp->if_flags ^ sc->ste_if_flags) & IFF_ALLMULTI)
-				ste_setmulti(sc);
-			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-				sc->ste_tx_thresh = STE_TXSTART_THRESH;
+		if ((ifp->if_flags & IFF_UP) != 0) {
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
+			    ((ifp->if_flags ^ sc->ste_if_flags) &
+			     (IFF_PROMISC | IFF_ALLMULTI)) != 0)
+				ste_rxfilter(sc);
+			else
 				ste_init_locked(sc);
-			}
-		} else {
-			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-				ste_stop(sc);
-		}
+		} else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			ste_stop(sc);
 		sc->ste_if_flags = ifp->if_flags;
 		STE_UNLOCK(sc);
-		error = 0;
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		STE_LOCK(sc);
-		ste_setmulti(sc);
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			ste_rxfilter(sc);
 		STE_UNLOCK(sc);
-		error = 0;
 		break;
 	case SIOCGIFMEDIA:
 	case SIOCSIFMEDIA:

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 18:28:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3C7B1065676;
	Wed, 23 Dec 2009 18:28:47 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B2CE88FC15;
	Wed, 23 Dec 2009 18:28:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNISlq6005659;
	Wed, 23 Dec 2009 18:28:47 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNISl5Y005657;
	Wed, 23 Dec 2009 18:28:47 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231828.nBNISl5Y005657@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 18:28:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200907 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 18:28:47 -0000

Author: yongari
Date: Wed Dec 23 18:28:47 2009
New Revision: 200907
URL: http://svn.freebsd.org/changeset/base/200907

Log:
  Don't report link status if driver is not running.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 18:24:22 2009	(r200906)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 18:28:47 2009	(r200907)
@@ -486,6 +486,10 @@ ste_ifmedia_sts(struct ifnet *ifp, struc
 	mii = device_get_softc(sc->ste_miibus);
 
 	STE_LOCK(sc);
+	if ((ifp->if_flags & IFF_UP) == 0) {
+		STE_UNLOCK(sc);
+		return;
+	}
 	mii_pollstat(mii);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 18:42:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62EF81065672;
	Wed, 23 Dec 2009 18:42:26 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3868F8FC1B;
	Wed, 23 Dec 2009 18:42:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNIgQXY006004;
	Wed, 23 Dec 2009 18:42:26 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNIgQKc006002;
	Wed, 23 Dec 2009 18:42:26 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231842.nBNIgQKc006002@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 18:42:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200908 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 18:42:26 -0000

Author: yongari
Date: Wed Dec 23 18:42:25 2009
New Revision: 200908
URL: http://svn.freebsd.org/changeset/base/200908

Log:
  Report the correct result of mii_mediachg(). Previously it always
  used to return success without respect to the result.
  While I'm here use mii_mediachg() in ste_init_locked which allows
  driver to use currently configured media. ste_ifmedia_upd() is
  supposed to be called whenever user changes current media settings.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 18:28:47 2009	(r200907)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 18:42:25 2009	(r200908)
@@ -103,7 +103,6 @@ static int 	ste_eeprom_wait(struct ste_s
 static int	ste_encap(struct ste_softc *, struct mbuf **,
 		    struct ste_chain *);
 static int	ste_ifmedia_upd(struct ifnet *);
-static void	ste_ifmedia_upd_locked(struct ifnet *);
 static void	ste_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static void	ste_init(void *);
 static void	ste_init_locked(struct ste_softc *);
@@ -449,31 +448,21 @@ static int
 ste_ifmedia_upd(struct ifnet *ifp)
 {
 	struct ste_softc *sc;
+	struct mii_data	*mii;
+	struct mii_softc *miisc;
+	int error;
 
 	sc = ifp->if_softc;
 	STE_LOCK(sc);
-	ste_ifmedia_upd_locked(ifp);
-	STE_UNLOCK(sc);
-
-	return (0);
-}
-
-static void
-ste_ifmedia_upd_locked(struct ifnet *ifp)
-{
-	struct ste_softc *sc;
-	struct mii_data *mii;
-
-	sc = ifp->if_softc;
-	STE_LOCK_ASSERT(sc);
 	mii = device_get_softc(sc->ste_miibus);
-	sc->ste_flags &= ~STE_FLAG_LINK;
 	if (mii->mii_instance) {
-		struct mii_softc	*miisc;
 		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
 			mii_phy_reset(miisc);
 	}
-	mii_mediachg(mii);
+	error = mii_mediachg(mii);
+	STE_UNLOCK(sc);
+
+	return (error);
 }
 
 static void
@@ -1559,10 +1548,12 @@ static void
 ste_init_locked(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
+	struct mii_data *mii;
 	int i;
 
 	STE_LOCK_ASSERT(sc);
 	ifp = sc->ste_ifp;
+	mii = device_get_softc(sc->ste_miibus);
 
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
 		return;
@@ -1645,7 +1636,9 @@ ste_init_locked(struct ste_softc *sc)
 	/* Enable interrupts. */
 	CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
 
-	ste_ifmedia_upd_locked(ifp);
+	sc->ste_flags &= ~STE_FLAG_LINK;
+	/* Switch to the current media. */
+	mii_mediachg(mii);
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 18:53:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46B37106566C;
	Wed, 23 Dec 2009 18:53:11 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3495D8FC0C;
	Wed, 23 Dec 2009 18:53:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNIrB91006303;
	Wed, 23 Dec 2009 18:53:11 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNIrBXd006301;
	Wed, 23 Dec 2009 18:53:11 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912231853.nBNIrBXd006301@svn.freebsd.org>
From: Luigi Rizzo 
Date: Wed, 23 Dec 2009 18:53:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200909 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 18:53:11 -0000

Author: luigi
Date: Wed Dec 23 18:53:11 2009
New Revision: 200909
URL: http://svn.freebsd.org/changeset/base/200909

Log:
  mostly style changes, such as removal of trailing whitespace,
  reformatting to avoid unnecessary line breaks, small block
  restructuring to avoid unnecessary nesting, replace macros
  with function calls, etc.
  
  As a side effect of code restructuring, this commit fixes one bug:
  previously, if a realloc() failed, memory was leaked. Now, the
  realloc is not there anymore, as we first count how much memory
  we need and then do a single malloc.

Modified:
  head/sys/netinet/ipfw/ip_fw_nat.c

Modified: head/sys/netinet/ipfw/ip_fw_nat.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_nat.c	Wed Dec 23 18:42:25 2009	(r200908)
+++ head/sys/netinet/ipfw/ip_fw_nat.c	Wed Dec 23 18:53:11 2009	(r200909)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 static VNET_DEFINE(eventhandler_tag, ifaddr_event_tag);
 #define	V_ifaddr_event_tag	VNET(ifaddr_event_tag)
 
-static void 
+static void
 ifaddr_change(void *arg __unused, struct ifnet *ifp)
 {
 	struct cfg_nat *ptr;
@@ -66,25 +66,25 @@ ifaddr_change(void *arg __unused, struct
 	struct ip_fw_chain *chain;
 
 	chain = &V_layer3_chain;
-	IPFW_WLOCK(chain);			
+	IPFW_WLOCK(chain);
 	/* Check every nat entry... */
 	LIST_FOREACH(ptr, &chain->nat, _next) {
 		/* ...using nic 'ifp->if_xname' as dynamic alias address. */
-		if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) {
-			if_addr_rlock(ifp);
-			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-				if (ifa->ifa_addr == NULL)
-					continue;
-				if (ifa->ifa_addr->sa_family != AF_INET)
-					continue;
-				ptr->ip = ((struct sockaddr_in *) 
-				    (ifa->ifa_addr))->sin_addr;
-				LibAliasSetAddress(ptr->lib, ptr->ip);
-			}
-			if_addr_runlock(ifp);
+		if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) != 0)
+			continue;
+		if_addr_rlock(ifp);
+		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+			if (ifa->ifa_addr == NULL)
+				continue;
+			if (ifa->ifa_addr->sa_family != AF_INET)
+				continue;
+			ptr->ip = ((struct sockaddr_in *)
+			    (ifa->ifa_addr))->sin_addr;
+			LibAliasSetAddress(ptr->lib, ptr->ip);
 		}
+		if_addr_runlock(ifp);
 	}
-	IPFW_WUNLOCK(chain);	
+	IPFW_WUNLOCK(chain);
 }
 
 /*
@@ -94,10 +94,12 @@ static void
 flush_nat_ptrs(struct ip_fw_chain *chain, const int ix)
 {
 	int i;
+	ipfw_insn_nat *cmd;
 
 	IPFW_WLOCK_ASSERT(chain);
 	for (i = 0; i < chain->n_rules; i++) {
-		ipfw_insn_nat *cmd = (ipfw_insn_nat *)ACTION_PTR(chain->map[i]);
+		cmd = (ipfw_insn_nat *)ACTION_PTR(chain->map[i]);
+		/* XXX skip log and the like ? */
 		if (cmd->o.opcode == O_NAT && cmd->nat != NULL &&
 			    (ix < 0 || cmd->nat->id == ix))
 			cmd->nat = NULL;
@@ -132,9 +134,9 @@ del_redir_spool_cfg(struct cfg_nat *n, s
 			free(r, M_IPFW);
 			break;
 		default:
-			printf("unknown redirect mode: %u\n", r->mode);				
+			printf("unknown redirect mode: %u\n", r->mode);
 			/* XXX - panic?!?!? */
-			break; 
+			break;
 		}
 	}
 }
@@ -145,7 +147,6 @@ add_redir_spool_cfg(char *buf, struct cf
 	struct cfg_redir *r, *ser_r;
 	struct cfg_spool *s, *ser_s;
 	int cnt, off, i;
-	char *panic_err;
 
 	for (cnt = 0, off = 0; cnt < ptr->redir_cnt; cnt++) {
 		ser_r = (struct cfg_redir *)&buf[off];
@@ -168,7 +169,7 @@ add_redir_spool_cfg(char *buf, struct cf
 					remotePortCopy = 0;
 				r->alink[i] = LibAliasRedirectPort(ptr->lib,
 				    r->laddr, htons(r->lport + i), r->raddr,
-				    htons(remotePortCopy), r->paddr, 
+				    htons(remotePortCopy), r->paddr,
 				    htons(r->pport + i), r->proto);
 				if (r->alink[i] == NULL) {
 					r->alink[0] = NULL;
@@ -182,30 +183,26 @@ add_redir_spool_cfg(char *buf, struct cf
 			break;
 		default:
 			printf("unknown redirect mode: %u\n", r->mode);
-			break; 
+			break;
+		}
+		/* XXX perhaps return an error instead of panic ? */
+		if (r->alink[0] == NULL)
+			panic("LibAliasRedirect* returned NULL");
+		/* LSNAT handling. */
+		for (i = 0; i < r->spool_cnt; i++) {
+			ser_s = (struct cfg_spool *)&buf[off];
+			s = malloc(SOF_REDIR, M_IPFW, M_WAITOK | M_ZERO);
+			memcpy(s, ser_s, SOF_SPOOL);
+			LibAliasAddServer(ptr->lib, r->alink[0],
+			    s->addr, htons(s->port));
+			off += SOF_SPOOL;
+			/* Hook spool entry. */
+			LIST_INSERT_HEAD(&r->spool_chain, s, _next);
 		}
-		if (r->alink[0] == NULL) {
-			panic_err = "LibAliasRedirect* returned NULL";
-			goto bad;
-		} else /* LSNAT handling. */
-			for (i = 0; i < r->spool_cnt; i++) {
-				ser_s = (struct cfg_spool *)&buf[off];
-				s = malloc(SOF_REDIR, M_IPFW, 
-				    M_WAITOK | M_ZERO);
-				memcpy(s, ser_s, SOF_SPOOL);
-				LibAliasAddServer(ptr->lib, r->alink[0], 
-				    s->addr, htons(s->port));
-				off += SOF_SPOOL;
-				/* Hook spool entry. */
-				LIST_INSERT_HEAD(&r->spool_chain, s, _next);
-			}
 		/* And finally hook this redir entry. */
 		LIST_INSERT_HEAD(&ptr->redir_chain, r, _next);
 	}
 	return (1);
-bad:
-	/* something really bad happened: panic! */
-	panic("%s\n", panic_err);
 }
 
 static int
@@ -219,101 +216,84 @@ ipfw_nat(struct ip_fw_args *args, struct
 
 	ldt = 0;
 	retval = 0;
-	if ((mcl = m_megapullup(m, m->m_pkthdr.len)) ==
-	    NULL)
-		goto badnat;
+	mcl = m_megapullup(m, m->m_pkthdr.len);
+	if (mcl == NULL) {
+		args->m = NULL;
+		return (IP_FW_DENY);
+	}
 	ip = mtod(mcl, struct ip *);
 	if (args->eh == NULL) {
 		ip->ip_len = htons(ip->ip_len);
 		ip->ip_off = htons(ip->ip_off);
 	}
 
-	/* 
+	/*
 	 * XXX - Libalias checksum offload 'duct tape':
-	 * 
-	 * locally generated packets have only
-	 * pseudo-header checksum calculated
-	 * and libalias will screw it[1], so
-	 * mark them for later fix.  Moreover
-	 * there are cases when libalias
-	 * modify tcp packet data[2], mark it
-	 * for later fix too.
 	 *
-	 * [1] libalias was never meant to run
-	 * in kernel, so it doesn't have any
-	 * knowledge about checksum
-	 * offloading, and it expects a packet
-	 * with a full internet
-	 * checksum. Unfortunately, packets
-	 * generated locally will have just the
-	 * pseudo header calculated, and when
-	 * libalias tries to adjust the
-	 * checksum it will actually screw it.
+	 * locally generated packets have only pseudo-header checksum
+	 * calculated and libalias will break it[1], so mark them for
+	 * later fix.  Moreover there are cases when libalias modifies
+	 * tcp packet data[2], mark them for later fix too.
+	 *
+	 * [1] libalias was never meant to run in kernel, so it does
+	 * not have any knowledge about checksum offloading, and
+	 * expects a packet with a full internet checksum.
+	 * Unfortunately, packets generated locally will have just the
+	 * pseudo header calculated, and when libalias tries to adjust
+	 * the checksum it will actually compute a wrong value.
 	 *
-	 * [2] when libalias modify tcp's data
-	 * content, full TCP checksum has to
-	 * be recomputed: the problem is that
-	 * libalias doesn't have any idea
-	 * about checksum offloading To
-	 * workaround this, we do not do
-	 * checksumming in LibAlias, but only
-	 * mark the packets in th_x2 field. If
-	 * we receive a marked packet, we
-	 * calculate correct checksum for it
-	 * aware of offloading.  Why such a
-	 * terrible hack instead of
-	 * recalculating checksum for each
-	 * packet?  Because the previous
-	 * checksum was not checked!
-	 * Recalculating checksums for EVERY
-	 * packet will hide ALL transmission
-	 * errors. Yes, marked packets still
-	 * suffer from this problem. But,
-	 * sigh, natd(8) has this problem,
-	 * too.
+	 * [2] when libalias modifies tcp's data content, full TCP
+	 * checksum has to be recomputed: the problem is that
+	 * libalias does not have any idea about checksum offloading.
+	 * To work around this, we do not do checksumming in LibAlias,
+	 * but only mark the packets in th_x2 field. If we receive a
+	 * marked packet, we calculate correct checksum for it
+	 * aware of offloading.  Why such a terrible hack instead of
+	 * recalculating checksum for each packet?
+	 * Because the previous checksum was not checked!
+	 * Recalculating checksums for EVERY packet will hide ALL
+	 * transmission errors. Yes, marked packets still suffer from
+	 * this problem. But, sigh, natd(8) has this problem, too.
 	 *
 	 * TODO: -make libalias mbuf aware (so
 	 * it can handle delayed checksum and tso)
 	 */
 
-	if (mcl->m_pkthdr.rcvif == NULL && 
-	    mcl->m_pkthdr.csum_flags & 
-	    CSUM_DELAY_DATA)
+	if (mcl->m_pkthdr.rcvif == NULL &&
+	    mcl->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
 		ldt = 1;
 
 	c = mtod(mcl, char *);
 	if (args->oif == NULL)
-		retval = LibAliasIn(t->lib, c, 
+		retval = LibAliasIn(t->lib, c,
 			mcl->m_len + M_TRAILINGSPACE(mcl));
 	else
-		retval = LibAliasOut(t->lib, c, 
+		retval = LibAliasOut(t->lib, c,
 			mcl->m_len + M_TRAILINGSPACE(mcl));
 	if (retval == PKT_ALIAS_RESPOND) {
-	  m->m_flags |= M_SKIP_FIREWALL;
-	  retval = PKT_ALIAS_OK;
+		m->m_flags |= M_SKIP_FIREWALL;
+		retval = PKT_ALIAS_OK;
 	}
 	if (retval != PKT_ALIAS_OK &&
 	    retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) {
 		/* XXX - should i add some logging? */
 		m_free(mcl);
-	badnat:
 		args->m = NULL;
 		return (IP_FW_DENY);
 	}
-	mcl->m_pkthdr.len = mcl->m_len = 
-	    ntohs(ip->ip_len);
+	mcl->m_pkthdr.len = mcl->m_len = ntohs(ip->ip_len);
 
-	/* 
-	 * XXX - libalias checksum offload 
-	 * 'duct tape' (see above) 
+	/*
+	 * XXX - libalias checksum offload
+	 * 'duct tape' (see above)
 	 */
 
-	if ((ip->ip_off & htons(IP_OFFMASK)) == 0 && 
+	if ((ip->ip_off & htons(IP_OFFMASK)) == 0 &&
 	    ip->ip_p == IPPROTO_TCP) {
-		struct tcphdr 	*th; 
+		struct tcphdr 	*th;
 
 		th = (struct tcphdr *)(ip + 1);
-		if (th->th_x2) 
+		if (th->th_x2)
 			ldt = 1;
 	}
 
@@ -325,38 +305,33 @@ ipfw_nat(struct ip_fw_args *args, struct
 		ip->ip_len = ntohs(ip->ip_len);
 		cksum = in_pseudo(
 		    ip->ip_src.s_addr,
-		    ip->ip_dst.s_addr, 
+		    ip->ip_dst.s_addr,
 		    htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2))
 		);
-					
+
 		switch (ip->ip_p) {
 		case IPPROTO_TCP:
 			th = (struct tcphdr *)(ip + 1);
-			/* 
-			 * Maybe it was set in 
-			 * libalias... 
+			/*
+			 * Maybe it was set in
+			 * libalias...
 			 */
 			th->th_x2 = 0;
 			th->th_sum = cksum;
-			mcl->m_pkthdr.csum_data = 
+			mcl->m_pkthdr.csum_data =
 			    offsetof(struct tcphdr, th_sum);
 			break;
 		case IPPROTO_UDP:
 			uh = (struct udphdr *)(ip + 1);
 			uh->uh_sum = cksum;
-			mcl->m_pkthdr.csum_data = 
+			mcl->m_pkthdr.csum_data =
 			    offsetof(struct udphdr, uh_sum);
-			break;						
+			break;
 		}
-		/* 
-		 * No hw checksum offloading: do it 
-		 * by ourself. 
-		 */
-		if ((mcl->m_pkthdr.csum_flags & 
-		     CSUM_DELAY_DATA) == 0) {
+		/* No hw checksum offloading: do it ourselves */
+		if ((mcl->m_pkthdr.csum_flags & CSUM_DELAY_DATA) == 0) {
 			in_delayed_cksum(mcl);
-			mcl->m_pkthdr.csum_flags &= 
-			    ~CSUM_DELAY_DATA;
+			mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 		}
 		ip->ip_len = htons(ip->ip_len);
 	}
@@ -370,24 +345,19 @@ ipfw_nat(struct ip_fw_args *args, struct
 	return (IP_FW_NAT);
 }
 
-#define LOOKUP_NAT(head, i, p) do {			\
-		LIST_FOREACH((p), head, _next) {	\
-			if ((p)->id == (i)) {		\
-				break;			\
-			}				\
-		}					\
-	} while (0)
-
 static struct cfg_nat *
 lookup_nat(struct nat_list *l, int nat_id)
 {
 	struct cfg_nat *res;
 
-	LOOKUP_NAT(l, nat_id, res);
+	LIST_FOREACH(res, l, _next) {
+		if (res->id == nat_id)
+			break;
+	}
 	return res;
 }
 
-static int 
+static int
 ipfw_nat_cfg(struct sockopt *sopt)
 {
 	struct cfg_nat *ptr, *ser_n;
@@ -395,22 +365,21 @@ ipfw_nat_cfg(struct sockopt *sopt)
 	struct ip_fw_chain *chain = &V_layer3_chain;
 
 	buf = malloc(NAT_BUF_LEN, M_IPFW, M_WAITOK | M_ZERO);
-	sooptcopyin(sopt, buf, NAT_BUF_LEN, 
-	    sizeof(struct cfg_nat));
+	sooptcopyin(sopt, buf, NAT_BUF_LEN, sizeof(struct cfg_nat));
 	ser_n = (struct cfg_nat *)buf;
 
 	/* check valid parameter ser_n->id > 0 ? */
-	/* 
+	/*
 	 * Find/create nat rule.
 	 */
 	IPFW_WLOCK(chain);
-	LOOKUP_NAT(&chain->nat, ser_n->id, ptr);
+	ptr = lookup_nat(&chain->nat, ser_n->id);
 	if (ptr == NULL) {
 		/* New rule: allocate and init new instance. */
-		ptr = malloc(sizeof(struct cfg_nat), 
+		ptr = malloc(sizeof(struct cfg_nat),
 		    M_IPFW, M_NOWAIT | M_ZERO);
 		if (ptr == NULL) {
-			IPFW_WUNLOCK(chain);				
+			IPFW_WUNLOCK(chain);
 			free(buf, M_IPFW);
 			return (ENOSPC);
 		}
@@ -429,13 +398,13 @@ ipfw_nat_cfg(struct sockopt *sopt)
 	}
 	IPFW_WUNLOCK(chain);
 
-	/* 
+	/*
 	 * Basic nat configuration.
 	 */
 	ptr->id = ser_n->id;
-	/* 
-	 * XXX - what if this rule doesn't nat any ip and just 
-	 * redirect? 
+	/*
+	 * XXX - what if this rule doesn't nat any ip and just
+	 * redirect?
 	 * do we set aliasaddress to 0.0.0.0?
 	 */
 	ptr->ip = ser_n->ip;
@@ -445,7 +414,7 @@ ipfw_nat_cfg(struct sockopt *sopt)
 	LibAliasSetAddress(ptr->lib, ptr->ip);
 	memcpy(ptr->if_name, ser_n->if_name, IF_NAMESIZE);
 
-	/* 
+	/*
 	 * Redir and LSNAT configuration.
 	 */
 	/* Delete old cfgs. */
@@ -465,10 +434,11 @@ ipfw_nat_del(struct sockopt *sopt)
 	struct cfg_nat *ptr;
 	struct ip_fw_chain *chain = &V_layer3_chain;
 	int i;
-		
+
 	sooptcopyin(sopt, &i, sizeof i, sizeof i);
+	/* XXX validate i */
 	IPFW_WLOCK(chain);
-	LOOKUP_NAT(&chain->nat, i, ptr);
+	ptr = lookup_nat(&chain->nat, i);
 	if (ptr == NULL) {
 		IPFW_WUNLOCK(chain);
 		return (EINVAL);
@@ -484,13 +454,14 @@ ipfw_nat_del(struct sockopt *sopt)
 
 static int
 ipfw_nat_get_cfg(struct sockopt *sopt)
-{	
+{
 	uint8_t *data;
 	struct cfg_nat *n;
 	struct cfg_redir *r;
 	struct cfg_spool *s;
 	int nat_cnt, off;
 	struct ip_fw_chain *chain;
+	int err = ENOSPC;
 
 	chain = &V_layer3_chain;
 	nat_cnt = 0;
@@ -501,41 +472,35 @@ ipfw_nat_get_cfg(struct sockopt *sopt)
 	/* Serialize all the data. */
 	LIST_FOREACH(n, &chain->nat, _next) {
 		nat_cnt++;
-		if (off + SOF_NAT < NAT_BUF_LEN) {
-			bcopy(n, &data[off], SOF_NAT);
-			off += SOF_NAT;
-			LIST_FOREACH(r, &n->redir_chain, _next) {
-				if (off + SOF_REDIR < NAT_BUF_LEN) {
-					bcopy(r, &data[off], 
-					    SOF_REDIR);
-					off += SOF_REDIR;
-					LIST_FOREACH(s, &r->spool_chain, 
-					    _next) {
-						if (off + SOF_SPOOL < 
-						    NAT_BUF_LEN) {
-							bcopy(s, &data[off],
-							    SOF_SPOOL);
-							off += SOF_SPOOL;
-						} else
-							goto nospace;
-					}
-				} else
+		if (off + SOF_NAT >= NAT_BUF_LEN)
+			goto nospace;
+		bcopy(n, &data[off], SOF_NAT);
+		off += SOF_NAT;
+		LIST_FOREACH(r, &n->redir_chain, _next) {
+			if (off + SOF_REDIR >= NAT_BUF_LEN)
+				goto nospace;
+			bcopy(r, &data[off], SOF_REDIR);
+			off += SOF_REDIR;
+			LIST_FOREACH(s, &r->spool_chain, _next) {
+				if (off + SOF_SPOOL >= NAT_BUF_LEN)
 					goto nospace;
+				bcopy(s, &data[off], SOF_SPOOL);
+				off += SOF_SPOOL;
 			}
-		} else
-			goto nospace;
+		}
 	}
-	bcopy(&nat_cnt, data, sizeof(nat_cnt));
-	IPFW_RUNLOCK(chain);
-	sooptcopyout(sopt, data, NAT_BUF_LEN);
-	free(data, M_IPFW);
-	return (0);
+	err = 0; /* all good */
 nospace:
 	IPFW_RUNLOCK(chain);
-	printf("serialized data buffer not big enough:"
-	    "please increase NAT_BUF_LEN\n");
+	if (err == 0) {
+		bcopy(&nat_cnt, data, sizeof(nat_cnt));
+		sooptcopyout(sopt, data, NAT_BUF_LEN);
+	} else {
+		printf("serialized data buffer not big enough:"
+		    "please increase NAT_BUF_LEN\n");
+	}
 	free(data, M_IPFW);
-	return (ENOSPC);
+	return (err);
 }
 
 static int
@@ -543,30 +508,33 @@ ipfw_nat_get_log(struct sockopt *sopt)
 {
 	uint8_t *data;
 	struct cfg_nat *ptr;
-	int i, size, cnt, sof;
+	int i, size;
 	struct ip_fw_chain *chain;
 
 	chain = &V_layer3_chain;
-	data = NULL;
-	sof = LIBALIAS_BUF_SIZE;
-	cnt = 0;
 
 	IPFW_RLOCK(chain);
-	size = i = 0;
+	/* one pass to count, one to copy the data */
+	i = 0;
 	LIST_FOREACH(ptr, &chain->nat, _next) {
-		if (ptr->lib->logDesc == NULL) 
+		if (ptr->lib->logDesc == NULL)
+			continue;
+		i++;
+	}
+	size = i * (LIBALIAS_BUF_SIZE + sizeof(int));
+	data = malloc(size, M_IPFW, M_NOWAIT | M_ZERO);
+	if (data == NULL) {
+		IPFW_RUNLOCK(chain);
+		return (ENOSPC);
+	}
+	i = 0;
+	LIST_FOREACH(ptr, &chain->nat, _next) {
+		if (ptr->lib->logDesc == NULL)
 			continue;
-		cnt++;
-		size = cnt * (sof + sizeof(int));
-		data = realloc(data, size, M_IPFW, M_NOWAIT | M_ZERO);
-		if (data == NULL) {
-			IPFW_RUNLOCK(chain);
-			return (ENOSPC);
-		}
 		bcopy(&ptr->id, &data[i], sizeof(int));
 		i += sizeof(int);
-		bcopy(ptr->lib->logDesc, &data[i], sof);
-		i += sof;
+		bcopy(ptr->lib->logDesc, &data[i], LIBALIAS_BUF_SIZE);
+		i += LIBALIAS_BUF_SIZE;
 	}
 	IPFW_RUNLOCK(chain);
 	sooptcopyout(sopt, data, size);
@@ -587,7 +555,8 @@ ipfw_nat_init(void)
 	ipfw_nat_get_cfg_ptr = ipfw_nat_get_cfg;
 	ipfw_nat_get_log_ptr = ipfw_nat_get_log;
 	IPFW_WUNLOCK(&V_layer3_chain);
-	V_ifaddr_event_tag = EVENTHANDLER_REGISTER(ifaddr_event, ifaddr_change, 
+	V_ifaddr_event_tag = EVENTHANDLER_REGISTER(
+	    ifaddr_event, ifaddr_change,
 	    NULL, EVENTHANDLER_PRI_ANY);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 19:18:08 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0D13A1065670;
	Wed, 23 Dec 2009 19:18:08 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EEFA18FC14;
	Wed, 23 Dec 2009 19:18:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNJI76G006856;
	Wed, 23 Dec 2009 19:18:07 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNJI7Ll006853;
	Wed, 23 Dec 2009 19:18:07 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231918.nBNJI7Ll006853@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 19:18:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200910 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 19:18:08 -0000

Author: yongari
Date: Wed Dec 23 19:18:07 2009
New Revision: 200910
URL: http://svn.freebsd.org/changeset/base/200910

Log:
  Implement hardware MAC statistics counter support. The counters
  could be accessed with dev.ste.0.stats sysctl node.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 18:53:11 2009	(r200909)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 19:18:07 2009	(r200910)
@@ -125,8 +125,10 @@ static int	ste_rxeof(struct ste_softc *,
 static void	ste_rxfilter(struct ste_softc *);
 static void	ste_start(struct ifnet *);
 static void	ste_start_locked(struct ifnet *);
+static void	ste_stats_clear(struct ste_softc *);
 static void	ste_stats_update(struct ste_softc *);
 static void	ste_stop(struct ste_softc *);
+static void	ste_sysctl_node(struct ste_softc *);
 static void	ste_tick(void *);
 static void	ste_txeoc(struct ste_softc *);
 static void	ste_txeof(struct ste_softc *);
@@ -923,16 +925,74 @@ ste_txeof(struct ste_softc *sc)
 }
 
 static void
+ste_stats_clear(struct ste_softc *sc)
+{
+
+	STE_LOCK_ASSERT(sc);
+
+	/* Rx stats. */
+	CSR_READ_2(sc, STE_STAT_RX_OCTETS_LO);
+	CSR_READ_2(sc, STE_STAT_RX_OCTETS_HI);
+	CSR_READ_2(sc, STE_STAT_RX_FRAMES);
+	CSR_READ_1(sc, STE_STAT_RX_BCAST);
+	CSR_READ_1(sc, STE_STAT_RX_MCAST);
+	CSR_READ_1(sc, STE_STAT_RX_LOST);
+	/* Tx stats. */
+	CSR_READ_2(sc, STE_STAT_TX_OCTETS_LO);
+	CSR_READ_2(sc, STE_STAT_TX_OCTETS_HI);
+	CSR_READ_2(sc, STE_STAT_TX_FRAMES);
+	CSR_READ_1(sc, STE_STAT_TX_BCAST);
+	CSR_READ_1(sc, STE_STAT_TX_MCAST);
+	CSR_READ_1(sc, STE_STAT_CARRIER_ERR);
+	CSR_READ_1(sc, STE_STAT_SINGLE_COLLS);
+	CSR_READ_1(sc, STE_STAT_MULTI_COLLS);
+	CSR_READ_1(sc, STE_STAT_LATE_COLLS);
+	CSR_READ_1(sc, STE_STAT_TX_DEFER);
+	CSR_READ_1(sc, STE_STAT_TX_EXDEFER);
+	CSR_READ_1(sc, STE_STAT_TX_ABORT);
+}
+
+static void
 ste_stats_update(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
+	struct ste_hw_stats *stats;
+	uint32_t val;
 
 	STE_LOCK_ASSERT(sc);
 
 	ifp = sc->ste_ifp;
-	ifp->if_collisions += CSR_READ_1(sc, STE_LATE_COLLS)
-	    + CSR_READ_1(sc, STE_MULTI_COLLS)
-	    + CSR_READ_1(sc, STE_SINGLE_COLLS);
+	stats = &sc->ste_stats;
+	/* Rx stats. */
+	val = (uint32_t)CSR_READ_2(sc, STE_STAT_RX_OCTETS_LO) |
+	    ((uint32_t)CSR_READ_2(sc, STE_STAT_RX_OCTETS_HI)) << 16;
+	val &= 0x000FFFFF;
+	stats->rx_bytes += val;
+	stats->rx_frames += CSR_READ_2(sc, STE_STAT_RX_FRAMES);
+	stats->rx_bcast_frames += CSR_READ_1(sc, STE_STAT_RX_BCAST);
+	stats->rx_mcast_frames += CSR_READ_1(sc, STE_STAT_RX_MCAST);
+	stats->rx_lost_frames += CSR_READ_1(sc, STE_STAT_RX_LOST);
+	/* Tx stats. */
+	val = (uint32_t)CSR_READ_2(sc, STE_STAT_TX_OCTETS_LO) |
+	    ((uint32_t)CSR_READ_2(sc, STE_STAT_TX_OCTETS_HI)) << 16;
+	val &= 0x000FFFFF;
+	stats->tx_bytes += val;
+	stats->tx_frames += CSR_READ_2(sc, STE_STAT_TX_FRAMES);
+	stats->tx_bcast_frames += CSR_READ_1(sc, STE_STAT_TX_BCAST);
+	stats->tx_mcast_frames += CSR_READ_1(sc, STE_STAT_TX_MCAST);
+	stats->tx_carrsense_errs += CSR_READ_1(sc, STE_STAT_CARRIER_ERR);
+	val = CSR_READ_1(sc, STE_STAT_SINGLE_COLLS);
+	stats->tx_single_colls += val;
+	ifp->if_collisions += val;
+	val = CSR_READ_1(sc, STE_STAT_MULTI_COLLS);
+	stats->tx_multi_colls += val;
+	ifp->if_collisions += val;
+	val += CSR_READ_1(sc, STE_STAT_LATE_COLLS);
+	stats->tx_late_colls += val;
+	ifp->if_collisions += val;
+	stats->tx_frames_defered += CSR_READ_1(sc, STE_STAT_TX_DEFER);
+	stats->tx_excess_defers += CSR_READ_1(sc, STE_STAT_TX_EXDEFER);
+	stats->tx_abort += CSR_READ_1(sc, STE_STAT_TX_ABORT);
 }
 
 /*
@@ -1032,6 +1092,7 @@ ste_attach(device_t dev)
 		error = ENXIO;;
 		goto fail;
 	}
+	ste_sysctl_node(sc);
 
 	if ((error = ste_dma_alloc(sc)) != 0)
 		goto fail;
@@ -1625,6 +1686,8 @@ ste_init_locked(struct ste_softc *sc)
 
 	/* Enable stats counters. */
 	STE_SETBIT2(sc, STE_MACCTL1, STE_MACCTL1_STATS_ENABLE);
+	/* Clear stats counters. */
+	ste_stats_clear(sc);
 
 	CSR_WRITE_2(sc, STE_ISR, 0xFFFF);
 #ifdef DEVICE_POLLING
@@ -2013,3 +2076,70 @@ ste_shutdown(device_t dev)
 
 	return (0);
 }
+
+#define	STE_SYSCTL_STAT_ADD32(c, h, n, p, d)	\
+	    SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d)
+#define	STE_SYSCTL_STAT_ADD64(c, h, n, p, d)	\
+	    SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d)
+
+static void
+ste_sysctl_node(struct ste_softc *sc)
+{
+	struct sysctl_ctx_list *ctx;
+	struct sysctl_oid_list *child, *parent;
+	struct sysctl_oid *tree;
+	struct ste_hw_stats *stats;
+
+	stats = &sc->ste_stats;
+	ctx = device_get_sysctl_ctx(sc->ste_dev);
+	child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ste_dev));
+
+	tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD,
+	    NULL, "STE statistics");
+	parent = SYSCTL_CHILDREN(tree);
+
+	/* Rx statistics. */
+	tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD,
+	    NULL, "Rx MAC statistics");
+	child = SYSCTL_CHILDREN(tree);
+	STE_SYSCTL_STAT_ADD64(ctx, child, "good_octets",
+	    &stats->rx_bytes, "Good octets");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_frames",
+	    &stats->rx_frames, "Good frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_bcast_frames",
+	    &stats->rx_bcast_frames, "Good broadcast frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_mcast_frames",
+	    &stats->rx_mcast_frames, "Good multicast frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "lost_frames",
+	    &stats->rx_lost_frames, "Lost frames");
+
+	/* Tx statistics. */
+	tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD,
+	    NULL, "Tx MAC statistics");
+	child = SYSCTL_CHILDREN(tree);
+	STE_SYSCTL_STAT_ADD64(ctx, child, "good_octets",
+	    &stats->tx_bytes, "Good octets");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_frames",
+	    &stats->tx_frames, "Good frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_bcast_frames",
+	    &stats->tx_bcast_frames, "Good broadcast frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "good_mcast_frames",
+	    &stats->tx_mcast_frames, "Good multicast frames");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "carrier_errs",
+	    &stats->tx_carrsense_errs, "Carrier sense errors");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "single_colls",
+	    &stats->tx_single_colls, "Single collisions");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "multi_colls",
+	    &stats->tx_multi_colls, "Multiple collisions");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "late_colls",
+	    &stats->tx_late_colls, "Late collisions");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "defers",
+	    &stats->tx_frames_defered, "Frames with deferrals");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "excess_defers",
+	    &stats->tx_excess_defers, "Frames with excessive derferrals");
+	STE_SYSCTL_STAT_ADD32(ctx, child, "abort",
+	    &stats->tx_abort, "Aborted frames due to Excessive collisions");
+}
+
+#undef STE_SYSCTL_STAT_ADD32
+#undef STE_SYSCTL_STAT_ADD64

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Wed Dec 23 18:53:11 2009	(r200909)
+++ head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:18:07 2009	(r200910)
@@ -92,11 +92,25 @@
 #define STE_MAR1		0x62
 #define STE_MAR2		0x64
 #define STE_MAR3		0x66
-#define STE_STATS		0x68
 
-#define STE_LATE_COLLS  0x75
-#define STE_MULTI_COLLS	0x76
-#define STE_SINGLE_COLLS 0x77
+#define	STE_STAT_RX_OCTETS_LO	0x68
+#define	STE_STAT_RX_OCTETS_HI	0x6A
+#define	STE_STAT_TX_OCTETS_LO	0x6C
+#define	STE_STAT_TX_OCTETS_HI	0x6E
+#define	STE_STAT_TX_FRAMES	0x70
+#define	STE_STAT_RX_FRAMES	0x72
+#define	STE_STAT_CARRIER_ERR	0x74
+#define	STE_STAT_LATE_COLLS	0x75
+#define	STE_STAT_MULTI_COLLS	0x76
+#define	STE_STAT_SINGLE_COLLS	0x77
+#define	STE_STAT_TX_DEFER	0x78
+#define	STE_STAT_RX_LOST	0x79
+#define	STE_STAT_TX_EXDEFER	0x7A
+#define	STE_STAT_TX_ABORT	0x7B
+#define	STE_STAT_TX_BCAST	0x7C
+#define	STE_STAT_RX_BCAST	0x7D
+#define	STE_STAT_TX_MCAST	0x7E
+#define	STE_STAT_RX_MCAST	0x7F
 
 #define STE_DMACTL_RXDMA_STOPPED	0x00000001
 #define STE_DMACTL_TXDMA_CMPREQ		0x00000002
@@ -388,24 +402,23 @@
 #define STE_PME_EN			0x0010
 #define STE_PME_STATUS			0x8000
 
-
-struct ste_stats {
-	uint32_t		ste_rx_bytes;
-	uint32_t		ste_tx_bytes;
-	uint16_t		ste_tx_frames;
-	uint16_t		ste_rx_frames;
-	uint8_t			ste_carrsense_errs;
-	uint8_t			ste_late_colls;
-	uint8_t			ste_multi_colls;
-	uint8_t			ste_single_colls;
-	uint8_t			ste_tx_frames_defered;
-	uint8_t			ste_rx_lost_frames;
-	uint8_t			ste_tx_excess_defers;
-	uint8_t			ste_tx_abort_excess_colls;
-	uint8_t			ste_tx_bcast_frames;
-	uint8_t			ste_rx_bcast_frames;
-	uint8_t			ste_tx_mcast_frames;
-	uint8_t			ste_rx_mcast_frames;
+struct ste_hw_stats {
+	uint64_t		rx_bytes;
+	uint32_t		rx_frames;
+	uint32_t		rx_bcast_frames;
+	uint32_t		rx_mcast_frames;
+	uint32_t		rx_lost_frames;
+	uint64_t		tx_bytes;
+	uint32_t		tx_frames;
+	uint32_t		tx_bcast_frames;
+	uint32_t		tx_mcast_frames;
+	uint32_t		tx_carrsense_errs;
+	uint32_t		tx_single_colls;
+	uint32_t		tx_multi_colls;
+	uint32_t		tx_late_colls;
+	uint32_t		tx_frames_defered;
+	uint32_t		tx_excess_defers;
+	uint32_t		tx_abort;
 };
 
 struct ste_frag {
@@ -566,6 +579,7 @@ struct ste_softc {
 	struct ste_list_data	ste_ldata;
 	struct ste_chain_data	ste_cdata;
 	struct callout		ste_callout;
+	struct ste_hw_stats	ste_stats;
 	struct mtx		ste_mtx;
 };
 

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 19:21:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E9101065698;
	Wed, 23 Dec 2009 19:21:38 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2DC728FC1F;
	Wed, 23 Dec 2009 19:21:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNJLcu9006951;
	Wed, 23 Dec 2009 19:21:38 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNJLca1006949;
	Wed, 23 Dec 2009 19:21:38 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231921.nBNJLca1006949@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 19:21:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200911 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 19:21:38 -0000

Author: yongari
Date: Wed Dec 23 19:21:37 2009
New Revision: 200911
URL: http://svn.freebsd.org/changeset/base/200911

Log:
  Remove unused duplicated register definition. It seems the
  definition was made to access STE_ASICCTL register as 16bits but
  ste(4) always access the register as 32bits so it was never used
  before.

Modified:
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:18:07 2009	(r200910)
+++ head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:21:37 2009	(r200911)
@@ -213,18 +213,6 @@
 #define STE_ASICCTL_SOFTINTR		0x02000000
 #define STE_ASICCTL_RESET_BUSY		0x04000000
 
-#define STE_ASICCTL1_GLOBAL_RESET	0x0001
-#define STE_ASICCTL1_RX_RESET		0x0002
-#define STE_ASICCTL1_TX_RESET		0x0004
-#define STE_ASICCTL1_DMA_RESET		0x0008
-#define STE_ASICCTL1_FIFO_RESET		0x0010
-#define STE_ASICCTL1_NETWORK_RESET	0x0020
-#define STE_ASICCTL1_HOST_RESET		0x0040
-#define STE_ASICCTL1_AUTOINIT_RESET	0x0080
-#define STE_ASICCTL1_EXTRESET_RESET	0x0100
-#define STE_ASICCTL1_SOFTINTR		0x0200
-#define STE_ASICCTL1_RESET_BUSY		0x0400
-
 #define STE_EECTL_ADDR			0x00FF
 #define STE_EECTL_OPCODE		0x0300
 #define STE_EECTL_BUSY			0x1000

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 19:26:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5FC6B1065670;
	Wed, 23 Dec 2009 19:26:38 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4ED858FC0C;
	Wed, 23 Dec 2009 19:26:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNJQc1O007104;
	Wed, 23 Dec 2009 19:26:38 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNJQc7C007102;
	Wed, 23 Dec 2009 19:26:38 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231926.nBNJQc7C007102@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 19:26:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200912 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 19:26:38 -0000

Author: yongari
Date: Wed Dec 23 19:26:38 2009
New Revision: 200912
URL: http://svn.freebsd.org/changeset/base/200912

Log:
  Correct STE_COUNTDOWN register offset. The datasheet was wrong.

Modified:
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:21:37 2009	(r200911)
+++ head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:26:38 2009	(r200912)
@@ -63,6 +63,7 @@
 #define STE_RX_DMABURST_THRESH	0x14
 #define STE_RX_DMAURG_THRESH	0x15
 #define STE_RX_DMAPOLL_PERIOD	0x16
+#define	STE_COUNTDOWN		0x18
 #define STE_DEBUGCTL		0x1A
 #define STE_ASICCTL		0x30
 #define STE_EEPROM_DATA		0x34
@@ -75,7 +76,6 @@
 #define STE_WAKE_EVENT		0x45
 #define STE_TX_STATUS		0x46
 #define STE_TX_FRAMEID		0x47
-#define STE_COUNTDOWN		0x48
 #define STE_ISR_ACK		0x4A
 #define STE_IMR			0x4C
 #define STE_ISR			0x4E

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 19:38:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 39BC0106566C;
	Wed, 23 Dec 2009 19:38:23 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F8478FC1A;
	Wed, 23 Dec 2009 19:38:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNJcM62007363;
	Wed, 23 Dec 2009 19:38:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNJcMgF007360;
	Wed, 23 Dec 2009 19:38:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912231938.nBNJcMgF007360@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Wed, 23 Dec 2009 19:38:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200913 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 19:38:23 -0000

Author: yongari
Date: Wed Dec 23 19:38:22 2009
New Revision: 200913
URL: http://svn.freebsd.org/changeset/base/200913

Log:
  We don't need to generate DMA complete interrupt for every
  transmitted frames. So request interrupt for every 16th frames. Due
  to the limitation of hardware we can't suppress the interrupt as
  driver should have to check TX status register. The TX status
  register can store up to 31 TX status so driver can't send more
  than 31 frames without reading TX status register.
  With this change controller would not generate TX completion
  interrupt for every frame, so reclaim transmitted frames in
  ste_tick().

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 19:26:38 2009	(r200912)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 19:38:22 2009	(r200913)
@@ -877,6 +877,13 @@ ste_tick(void *arg)
 	 */
 	if ((sc->ste_flags & STE_FLAG_LINK) == 0)
 		ste_miibus_statchg(sc->ste_dev);
+	/*
+	 * Because we are not generating Tx completion
+	 * interrupt for every frame, reclaim transmitted
+	 * buffers here.
+	 */
+	ste_txeof(sc);
+	ste_txeoc(sc);
 	ste_stats_update(sc);
 	ste_watchdog(sc);
 	callout_reset(&sc->ste_callout, hz, ste_tick, sc);
@@ -1953,7 +1960,11 @@ ste_encap(struct ste_softc *sc, struct m
 	 * Tx descriptors here. Otherwise we race with controller.
 	 */
 	desc->ste_next = 0;
-	desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS | STE_TXCTL_DMAINTR);
+	if ((sc->ste_cdata.ste_tx_prod % STE_TX_INTR_FRAMES) == 0)
+		desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS |
+		    STE_TXCTL_DMAINTR);
+	else
+		desc->ste_ctl = htole32(STE_TXCTL_ALIGN_DIS);
 	txc->ste_mbuf = *m_head;
 	STE_INC(sc->ste_cdata.ste_tx_prod, STE_TX_LIST_CNT);
 	sc->ste_cdata.ste_tx_cnt++;

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:26:38 2009	(r200912)
+++ head/sys/dev/ste/if_stereg.h	Wed Dec 23 19:38:22 2009	(r200913)
@@ -494,6 +494,12 @@ struct ste_desc_onefrag {
 #define	STE_ADDR_LO(x)		((uint64_t)(x) & 0xFFFFFFFF)
 #define	STE_ADDR_HI(x)		((uint64_t)(x) >> 32)
 
+/*
+ * Since Tx status can hold up to 31 status bytes we should
+ * check Tx status before controller fills it up. Otherwise
+ * Tx MAC stalls.
+ */
+#define	STE_TX_INTR_FRAMES	16
 #define	STE_TX_TIMEOUT		5
 #define STE_TIMEOUT		1000
 #define STE_MIN_FRAMELEN	60

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 20:23:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 080EA1065670;
	Wed, 23 Dec 2009 20:23:05 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4D358FC14;
	Wed, 23 Dec 2009 20:23:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNKN4bn008291;
	Wed, 23 Dec 2009 20:23:04 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNKN4Pi008289;
	Wed, 23 Dec 2009 20:23:04 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232023.nBNKN4Pi008289@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 20:23:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200914 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 20:23:05 -0000

Author: marius
Date: Wed Dec 23 20:23:04 2009
New Revision: 200914
URL: http://svn.freebsd.org/changeset/base/200914

Log:
  Don't use an out register to hold the vector number across the call
  of the interrupt handler in intr_fast() as the handler might clobber
  it (no in-tree handler currently does but an upcoming one will).
  While at it, tidy the register usage in the interrupt counting code.

Modified:
  head/sys/sparc64/sparc64/interrupt.S

Modified: head/sys/sparc64/sparc64/interrupt.S
==============================================================================
--- head/sys/sparc64/sparc64/interrupt.S	Wed Dec 23 19:38:22 2009	(r200913)
+++ head/sys/sparc64/sparc64/interrupt.S	Wed Dec 23 20:23:04 2009	(r200914)
@@ -176,7 +176,7 @@ ENTRY(intr_fast)
 
 3:	ldx	[%l0 + IR_FUNC], %o0
 	ldx	[%l0 + IR_ARG], %o1
-	lduw	[%l0 + IR_VEC], %o2
+	lduw	[%l0 + IR_VEC], %l2
 
 	ldx	[PCPU(IRFREE)], %l1
 	stx	%l1, [%l0 + IR_NEXT]
@@ -188,17 +188,17 @@ ENTRY(intr_fast)
 	call	%o0
 	 mov	%o1, %o0
 
-	/* intrcnt[intr_countp[%o2]]++ */
-	SET(intrcnt, %l7, %l2)		/* %l2 = intrcnt */
-	prefetcha [%l2] ASI_N, 1
-	SET(intr_countp, %l7, %l3)	/* %l3 = intr_countp */
-	sllx	%o2, 1, %l4		/* %l4 = vec << 1 */
-	lduh	[%l4 + %l3], %l5	/* %l5 = intr_countp[%o2] */
-	sllx	%l5, 3, %l6		/* %l6 = intr_countp[%o2] << 3 */
-	add	%l6, %l2, %l7		/* %l7 = intrcnt[intr_countp[%o2]] */
-	ldx	[%l7], %l2
+	/* intrcnt[intr_countp[%l2]]++ */
+	SET(intrcnt, %l7, %l3)		/* %l3 = intrcnt */
+	prefetcha [%l3] ASI_N, 1
+	SET(intr_countp, %l7, %l4)	/* %l4 = intr_countp */
+	sllx	%l2, 1, %l2		/* %l2 = vec << 1 */
+	lduh	[%l4 + %l2], %l4	/* %l4 = intr_countp[%l2] */
+	sllx	%l4, 3, %l4		/* %l4 = intr_countp[%l2] << 3 */
+	add	%l4, %l3, %l4		/* %l4 = intrcnt[intr_countp[%l2]] */
+	ldx	[%l4], %l2
 	inc	%l2
-	stx	%l2, [%l7]
+	stx	%l2, [%l4]
 
 	ba,a	%xcc, 1b
 	 nop

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 20:42:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F771106566B;
	Wed, 23 Dec 2009 20:42:15 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E5648FC1A;
	Wed, 23 Dec 2009 20:42:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNKgERr008682;
	Wed, 23 Dec 2009 20:42:14 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNKgEPH008680;
	Wed, 23 Dec 2009 20:42:14 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232042.nBNKgEPH008680@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 20:42:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200915 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 20:42:15 -0000

Author: marius
Date: Wed Dec 23 20:42:14 2009
New Revision: 200915
URL: http://svn.freebsd.org/changeset/base/200915

Log:
  Don't probe the bq4802 variant found in Ultra 25 and 45 for now as
  this chip isn't MC146818 compatible and requires different handlers
  (but which I can't test due to lack of such hardware).

Modified:
  head/sys/sparc64/sparc64/rtc.c

Modified: head/sys/sparc64/sparc64/rtc.c
==============================================================================
--- head/sys/sparc64/sparc64/rtc.c	Wed Dec 23 20:23:04 2009	(r200914)
+++ head/sys/sparc64/sparc64/rtc.c	Wed Dec 23 20:42:14 2009	(r200915)
@@ -28,10 +28,11 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * The `rtc' device is a MC146818 compatible clock found on the ISA
- * bus and EBus. The EBus variant actually is the Real-Time Clock
- * function of a National Semiconductor PC87317/PC97317 which also
- * provides Advanced Power Control functionality.
+ * The `rtc' device is found on the ISA bus and the EBus.  The ISA version
+ * always is a MC146818 compatible clock while the EBus variant either is the
+ * MC146818 compatible Real-Time Clock function of a National Semiconductor
+ * PC87317/PC97317 which also provides Advanced Power Control functionality
+ * or a Texas Instruments bq4802.
  */
 
 #include "opt_isa.h"
@@ -130,6 +131,10 @@ rtc_ebus_probe(device_t dev)
 {
 
 	if (strcmp(ofw_bus_get_name(dev), "rtc") == 0) {
+		/* The bq4802 is not supported, yet. */
+		if (ofw_bus_get_compat(dev) != NULL &&
+		    strcmp(ofw_bus_get_compat(dev), "bq4802") == 0)
+			return (ENXIO);
 		device_set_desc(dev, RTC_DESC);
 		return (0);
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 20:52:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 39A7610656AA;
	Wed, 23 Dec 2009 20:52:46 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 238078FC29;
	Wed, 23 Dec 2009 20:52:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNKqkwo008908;
	Wed, 23 Dec 2009 20:52:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNKqkQA008906;
	Wed, 23 Dec 2009 20:52:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232052.nBNKqkQA008906@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 20:52:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200916 - head/sys/sun4v/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 20:52:46 -0000

Author: marius
Date: Wed Dec 23 20:52:45 2009
New Revision: 200916
URL: http://svn.freebsd.org/changeset/base/200916

Log:
  - Remove devices which are/were only relevant for sun4u.

Modified:
  head/sys/sun4v/conf/NOTES

Modified: head/sys/sun4v/conf/NOTES
==============================================================================
--- head/sys/sun4v/conf/NOTES	Wed Dec 23 20:42:14 2009	(r200915)
+++ head/sys/sun4v/conf/NOTES	Wed Dec 23 20:52:45 2009	(r200916)
@@ -21,37 +21,18 @@ cpu		SUN4V
 device		ebus
 #device		isa
 device		pci
-device		sbus
-#device		central
-device		fhc
 
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION
 
 #
-# Mandatory devices:
-#
-
-#device		eeprom		# eeprom (really a front-end for the MK48Txx)
-device		mk48txx		# Mostek MK48Txx clocks
-#device		rtc		# rtc (really a front-end for the MC146818)
-device		mc146818	# Motorola MC146818 and compatible clocks
-
-#
 # Optional devices:
 #
 
-#device		auxio		# auxiliary I/O device
-#device		clkbrd		# Clock Board (blinkenlight on Sun Exx00)
-#device		creator		# Creator, Creator3D and Elite3D framebuffers
-#device		machfb		# ATI Mach64 framebuffers
-
 device		ofw_console	# Open Firmware console device
 option 		OFWCONS_POLL_HZ=4 # 20 or more works best on Ultra2
 
-#device		sab		# Siemens SAB82532 based serial ports
-
 
 #####################################################################
 # Devices we don't want to deal with

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:04:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27EF61065695;
	Wed, 23 Dec 2009 21:04:32 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 16CE78FC08;
	Wed, 23 Dec 2009 21:04:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNL4Vt9009171;
	Wed, 23 Dec 2009 21:04:31 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNL4V7E009168;
	Wed, 23 Dec 2009 21:04:31 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232104.nBNL4V7E009168@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 21:04:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200917 - in head/sys: conf sun4v/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:04:32 -0000

Author: marius
Date: Wed Dec 23 21:04:31 2009
New Revision: 200917
URL: http://svn.freebsd.org/changeset/base/200917

Log:
  Hook ebus(4) and isa(4) up to the sun4v LINT build in order to
  ensure that their compilation doesn't break as they are expected
  to work as-is now (but aren't actually run-time tested).

Modified:
  head/sys/conf/files.sun4v
  head/sys/sun4v/conf/NOTES

Modified: head/sys/conf/files.sun4v
==============================================================================
--- head/sys/conf/files.sun4v	Wed Dec 23 20:52:45 2009	(r200916)
+++ head/sys/conf/files.sun4v	Wed Dec 23 21:04:31 2009	(r200917)
@@ -35,6 +35,10 @@ libkern/ffsl.c			standard
 libkern/fls.c			standard
 libkern/flsl.c			standard
 libkern/memmove.c		standard
+sparc64/ebus/ebus.c		optional	ebus
+sparc64/isa/isa.c		optional	isa
+sparc64/isa/isa_dma.c		optional	isa
+sparc64/isa/ofw_isa.c		optional	ebus | isa
 sparc64/sparc64/autoconf.c	standard
 sun4v/sun4v/bus_machdep.c	standard
 sun4v/sun4v/clock.c		standard

Modified: head/sys/sun4v/conf/NOTES
==============================================================================
--- head/sys/sun4v/conf/NOTES	Wed Dec 23 20:52:45 2009	(r200916)
+++ head/sys/sun4v/conf/NOTES	Wed Dec 23 21:04:31 2009	(r200917)
@@ -19,7 +19,7 @@ cpu		SUN4V
 # HARDWARE BUS CONFIGURATION
 
 device		ebus
-#device		isa
+device		isa
 device		pci
 
 

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:07:49 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B580106568F;
	Wed, 23 Dec 2009 21:07:49 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A75A8FC18;
	Wed, 23 Dec 2009 21:07:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNL7nIt009275;
	Wed, 23 Dec 2009 21:07:49 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNL7n8w009273;
	Wed, 23 Dec 2009 21:07:49 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232107.nBNL7n8w009273@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 21:07:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200918 - head/sys/sparc64/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:07:49 -0000

Author: marius
Date: Wed Dec 23 21:07:49 2009
New Revision: 200918
URL: http://svn.freebsd.org/changeset/base/200918

Log:
  Add structures for OFW MSI/MSI-X support. These are identical for
  both sun4u and sun4v.

Modified:
  head/sys/sparc64/pci/ofw_pci.h

Modified: head/sys/sparc64/pci/ofw_pci.h
==============================================================================
--- head/sys/sparc64/pci/ofw_pci.h	Wed Dec 23 21:04:31 2009	(r200917)
+++ head/sys/sparc64/pci/ofw_pci.h	Wed Dec 23 21:07:49 2009	(r200918)
@@ -48,6 +48,31 @@ typedef uint32_t ofw_pci_intr_t;
 #define	OFW_TYPE_PCI		"pci"
 #define	OFW_TYPE_PCIE		"pciex"
 
+struct ofw_pci_msi_addr_ranges {
+	uint32_t	addr32_hi;
+	uint32_t	addr32_lo;
+	uint32_t	addr32_sz;
+	uint32_t	addr64_hi;
+	uint32_t	addr64_lo;
+	uint32_t	addr64_sz;
+};
+
+#define	OFW_PCI_MSI_ADDR_RANGE_32(r) \
+	(((uint64_t)(r)->addr32_hi << 32) | (uint64_t)(r)->addr32_lo)
+#define	OFW_PCI_MSI_ADDR_RANGE_64(r) \
+	(((uint64_t)(r)->addr64_hi << 32) | (uint64_t)(r)->addr64_lo)
+
+struct ofw_pci_msi_eq_to_devino {
+	uint32_t	eq_first;
+	uint32_t	eq_count;
+	uint32_t	devino_first;
+};
+
+struct ofw_pci_msi_ranges {
+	uint32_t	first;
+	uint32_t	count;
+};
+
 struct ofw_pci_ranges {
 	uint32_t	cspace;
 	uint32_t	child_hi;

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:11:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9684E1065695;
	Wed, 23 Dec 2009 21:11:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 850748FC18;
	Wed, 23 Dec 2009 21:11:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNLB36r009388;
	Wed, 23 Dec 2009 21:11:03 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNLB3Tc009385;
	Wed, 23 Dec 2009 21:11:03 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200912232111.nBNLB3Tc009385@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 23 Dec 2009 21:11:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200919 - head/lib/libstand
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:11:03 -0000

Author: jhb
Date: Wed Dec 23 21:11:03 2009
New Revision: 200919
URL: http://svn.freebsd.org/changeset/base/200919

Log:
  Fix a bug in gzipfs that prevented lseek() from working and add lseek()
  support to bzip2fs.  This fixes problems with loading compressed amd64
  kernel modules containing debug symbols.
  
  Submitted by:	David Naylor  naylor.b.david (gmail)
  MFC after:	1 week

Modified:
  head/lib/libstand/bzipfs.c
  head/lib/libstand/gzipfs.c

Modified: head/lib/libstand/bzipfs.c
==============================================================================
--- head/lib/libstand/bzipfs.c	Wed Dec 23 21:07:49 2009	(r200918)
+++ head/lib/libstand/bzipfs.c	Wed Dec 23 21:11:03 2009	(r200919)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #ifndef REGRESSION
 #include "stand.h"
 #else
+#include 
 #include 
 #include 
 #include 
@@ -42,7 +43,7 @@ struct open_file {
 };
 #define F_READ          0x0001  /* file opened for reading */
 #define EOFFSET (ELAST+8)       /* relative seek not supported */
-static inline u_int min(u_int a, u_int b) { return (a < b ? a : b); }
+static inline u_int min(u_int a, u_int b) { return(a < b ? a : b); }
 #define panic(x, y) abort()
 #endif
 
@@ -174,6 +175,8 @@ bzf_open(const char *fname, struct open_
 
     /* Construct new name */
     bzfname = malloc(strlen(fname) + 5);
+    if (bzfname == NULL)
+	return(ENOMEM);
     sprintf(bzfname, "%s.bz2", fname);
 
     /* Try to open the compressed datafile */
@@ -195,13 +198,14 @@ bzf_open(const char *fname, struct open_
 
     /* Allocate a bz_file structure, populate it */
     bzf = malloc(sizeof(struct bz_file));
+    if (bzf == NULL)
+	return(ENOMEM);
     bzero(bzf, sizeof(struct bz_file));
     bzf->bzf_rawfd = rawfd;
 
-    /* Verify that the file is bzipped (XXX why do this afterwards?) */
+    /* Verify that the file is bzipped */
     if (check_header(bzf)) {
 	close(bzf->bzf_rawfd);
-	BZ2_bzDecompressEnd(&(bzf->bzf_bzstream));
 	free(bzf);
 	return(EFTYPE);
     }
@@ -247,7 +251,7 @@ bzf_read(struct open_file *f, void *buf,
 	if (bzf->bzf_bzstream.avail_in == 0) {		/* oops, unexpected EOF */
 	    printf("bzf_read: unexpected EOF\n");
 	    if (bzf->bzf_bzstream.avail_out == size)
-		return (EIO);
+		return(EIO);
 	    break;
 	}
 
@@ -266,6 +270,50 @@ bzf_read(struct open_file *f, void *buf,
     return(0);
 }
 
+static int
+bzf_rewind(struct open_file *f)
+{
+    struct bz_file	*bzf = (struct bz_file *)f->f_fsdata;
+    struct bz_file	*bzf_tmp;
+
+    /*
+     * Since bzip2 does not have an equivalent inflateReset function a crude
+     * one needs to be provided.  The functions all called in such a way that
+     * at any time an error occurs a role back can be done (effectively making
+     * this rewind 'atomic', either the reset occurs successfully or not at all,
+     * with no 'undefined' state happening).
+     */
+
+    /* Allocate a bz_file structure, populate it */
+    bzf_tmp = malloc(sizeof(struct bz_file));
+    if (bzf_tmp == NULL)
+	return(-1);
+    bzero(bzf_tmp, sizeof(struct bz_file));
+    bzf_tmp->bzf_rawfd = bzf->bzf_rawfd;
+
+    /* Initialise the inflation engine */
+    if (BZ2_bzDecompressInit(&(bzf_tmp->bzf_bzstream), 0, 1) != BZ_OK) {
+	free(bzf_tmp);
+	return(-1);
+    }
+
+    /* Seek back to the beginning of the file */
+    if (lseek(bzf->bzf_rawfd, 0, SEEK_SET) == -1) {
+	BZ2_bzDecompressEnd(&(bzf_tmp->bzf_bzstream));
+	free(bzf_tmp);
+	return(-1);
+    }
+
+    /* Free old bz_file data */
+    BZ2_bzDecompressEnd(&(bzf->bzf_bzstream));
+    free(bzf);
+
+    /* Use the new bz_file data */
+    f->f_fsdata = bzf_tmp;
+
+    return(0);
+}
+
 static off_t
 bzf_seek(struct open_file *f, off_t offset, int where)
 {
@@ -284,14 +332,17 @@ bzf_seek(struct open_file *f, off_t offs
 	target = -1;
     default:
 	errno = EINVAL;
-	return (-1);
+	return(-1);
     }
 
     /* Can we get there from here? */
-    if (target < bzf->bzf_bzstream.total_out_lo32) {
+    if (target < bzf->bzf_bzstream.total_out_lo32 && bzf_rewind(f) != 0) {
 	errno = EOFFSET;
 	return -1;
-    } 
+    }
+
+    /* if bzf_rewind was called then bzf has changed */
+    bzf = (struct bz_file *)f->f_fsdata;
 
     /* skip forwards if required */
     while (target > bzf->bzf_bzstream.total_out_lo32) {
@@ -301,7 +352,7 @@ bzf_seek(struct open_file *f, off_t offs
 	    return(-1);
     }
     /* This is where we are (be honest if we overshot) */
-    return (bzf->bzf_bzstream.total_out_lo32);
+    return(bzf->bzf_bzstream.total_out_lo32);
 }
 
 static int

Modified: head/lib/libstand/gzipfs.c
==============================================================================
--- head/lib/libstand/gzipfs.c	Wed Dec 23 21:07:49 2009	(r200918)
+++ head/lib/libstand/gzipfs.c	Wed Dec 23 21:11:03 2009	(r200919)
@@ -212,10 +212,9 @@ zf_open(const char *fname, struct open_f
     bzero(zf, sizeof(struct z_file));
     zf->zf_rawfd = rawfd;
 
-    /* Verify that the file is gzipped (XXX why do this afterwards?) */
+    /* Verify that the file is gzipped */
     if (check_header(zf)) {
 	close(zf->zf_rawfd);
-	inflateEnd(&(zf->zf_zstream));
 	free(zf);
 	return(EFTYPE);
     }
@@ -261,7 +260,7 @@ zf_read(struct open_file *f, void *buf, 
 	if (zf->zf_zstream.avail_in == 0) {		/* oops, unexpected EOF */
 	    printf("zf_read: unexpected EOF\n");
 	    if (zf->zf_zstream.avail_out == size)
-		return (EIO);
+		return(EIO);
 	    break;
 	}
 
@@ -286,12 +285,13 @@ zf_rewind(struct open_file *f)
     struct z_file	*zf = (struct z_file *)f->f_fsdata;
 
     if (lseek(zf->zf_rawfd, zf->zf_dataoffset, SEEK_SET) == -1)
-	return -1;
+	return(-1);
     zf->zf_zstream.avail_in = 0;
     zf->zf_zstream.next_in = NULL;
+    zf->zf_endseen = 0;
     (void)inflateReset(&zf->zf_zstream);
 
-    return 0;
+    return(0);
 }
 
 static off_t
@@ -312,12 +312,12 @@ zf_seek(struct open_file *f, off_t offse
 	target = -1;
     default:
 	errno = EINVAL;
-	return (-1);
+	return(-1);
     }
 
     /* rewind if required */
     if (target < zf->zf_zstream.total_out && zf_rewind(f) != 0)
-	return -1;
+	return(-1);
 
     /* skip forwards if required */
     while (target > zf->zf_zstream.total_out) {
@@ -327,7 +327,7 @@ zf_seek(struct open_file *f, off_t offse
 	    return(-1);
     }
     /* This is where we are (be honest if we overshot) */
-    return (zf->zf_zstream.total_out);
+    return(zf->zf_zstream.total_out);
 }
 
 

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:25:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EAC46106566C;
	Wed, 23 Dec 2009 21:25:16 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D8FE08FC16;
	Wed, 23 Dec 2009 21:25:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNLPG74009688;
	Wed, 23 Dec 2009 21:25:16 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNLPGtP009686;
	Wed, 23 Dec 2009 21:25:16 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232125.nBNLPGtP009686@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 21:25:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200920 - head/sys/sparc64/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:25:17 -0000

Author: marius
Date: Wed Dec 23 21:25:16 2009
New Revision: 200920
URL: http://svn.freebsd.org/changeset/base/200920

Log:
  - Sort the prototypes.
  - Add macros to ease the access of device configuration space in
    ofw_pcibus_setup_device().

Modified:
  head/sys/sparc64/pci/ofw_pcibus.c

Modified: head/sys/sparc64/pci/ofw_pcibus.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcibus.c	Wed Dec 23 21:11:03 2009	(r200919)
+++ head/sys/sparc64/pci/ofw_pcibus.c	Wed Dec 23 21:25:16 2009	(r200920)
@@ -64,11 +64,11 @@ static void ofw_pcibus_setup_device(devi
     u_int busno, u_int slot, u_int func);
 
 /* Methods */
-static device_probe_t ofw_pcibus_probe;
+static bus_child_pnpinfo_str_t ofw_pcibus_pnpinfo_str;
 static device_attach_t ofw_pcibus_attach;
-static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
+static device_probe_t ofw_pcibus_probe;
 static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo;
-static bus_child_pnpinfo_str_t ofw_pcibus_pnpinfo_str;
+static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
 
 static device_method_t ofw_pcibus_methods[] = {
 	/* Device interface */
@@ -124,6 +124,11 @@ static void
 ofw_pcibus_setup_device(device_t bridge, uint32_t clock, u_int busno,
     u_int slot, u_int func)
 {
+#define	CS_READ(n, w)							\
+	PCIB_READ_CONFIG(bridge, busno, slot, func, (n), (w))
+#define	CS_WRITE(n, v, w)						\
+	PCIB_WRITE_CONFIG(bridge, busno, slot, func, (n), (v), (w))
+
 #ifndef SUN4V
 	uint32_t reg;
 
@@ -138,33 +143,27 @@ ofw_pcibus_setup_device(device_t bridge,
 	 * For bridges, we additionally set up the bridge control and the
 	 * secondary latency registers.
 	 */
-	if ((PCIB_READ_CONFIG(bridge, busno, slot, func, PCIR_HDRTYPE, 1) &
-	    PCIM_HDRTYPE) == PCIM_HDRTYPE_BRIDGE) {
-		reg = PCIB_READ_CONFIG(bridge, busno, slot, func,
-		    PCIR_BRIDGECTL_1, 1);
+	if ((CS_READ(PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) ==
+	    PCIM_HDRTYPE_BRIDGE) {
+		reg = CS_READ(PCIR_BRIDGECTL_1, 1);
 		reg |= PCIB_BCR_MASTER_ABORT_MODE | PCIB_BCR_SERR_ENABLE |
 		    PCIB_BCR_PERR_ENABLE;
 #ifdef OFW_PCI_DEBUG
 		device_printf(bridge,
 		    "bridge %d/%d/%d: control 0x%x -> 0x%x\n",
-		    busno, slot, func, PCIB_READ_CONFIG(bridge, busno, slot,
-		    func, PCIR_BRIDGECTL_1, 1), reg);
+		    busno, slot, func, CS_READ(PCIR_BRIDGECTL_1, 1), reg);
 #endif /* OFW_PCI_DEBUG */
-		PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_BRIDGECTL_1,
-		    reg, 1);
+		CS_WRITE(PCIR_BRIDGECTL_1, reg, 1);
 
 		reg = OFW_PCI_LATENCY;
 #ifdef OFW_PCI_DEBUG
 		device_printf(bridge,
 		    "bridge %d/%d/%d: latency timer %d -> %d\n",
-		    busno, slot, func, PCIB_READ_CONFIG(bridge, busno, slot,
-		    func, PCIR_SECLAT_1, 1), reg);
+		    busno, slot, func, CS_READ(PCIR_SECLAT_1, 1), reg);
 #endif /* OFW_PCI_DEBUG */
-		PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_SECLAT_1,
-		    reg, 1);
+		CS_WRITE(PCIR_SECLAT_1, reg, 1);
 	} else {
-		reg = PCIB_READ_CONFIG(bridge, busno, slot, func,
-		    PCIR_MINGNT, 1);
+		reg = CS_READ(PCIR_MINGNT, 1);
 		if (reg != 0) {
 			switch (clock) {
 			case 33000000:
@@ -180,10 +179,9 @@ ofw_pcibus_setup_device(device_t bridge,
 	}
 #ifdef OFW_PCI_DEBUG
 	device_printf(bridge, "device %d/%d/%d: latency timer %d -> %d\n",
-	    busno, slot, func, PCIB_READ_CONFIG(bridge, busno, slot, func,
-	    PCIR_LATTIMER, 1), reg);
+	    busno, slot, func, CS_READ(PCIR_LATTIMER, 1), reg);
 #endif /* OFW_PCI_DEBUG */
-	PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_LATTIMER, reg, 1);
+	CS_WRITE(PCIR_LATTIMER, reg, 1);
 
 	/*
 	 * Compute a value to write into the cache line size register.
@@ -192,8 +190,7 @@ ofw_pcibus_setup_device(device_t bridge,
 	 * reached.  Generally, the cache line size is fixed at 64 bytes
 	 * by Fireplane/Safari, JBus and UPA.
 	 */
-	PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_CACHELNSZ,
-	    STRBUF_LINESZ / sizeof(uint32_t), 1);
+	CS_WRITE(PCIR_CACHELNSZ, STRBUF_LINESZ / sizeof(uint32_t), 1);
 #endif
 
 	/*
@@ -201,8 +198,10 @@ ofw_pcibus_setup_device(device_t bridge,
 	 * it to 255, so that the PCI code will reroute the interrupt if
 	 * needed.
 	 */
-	PCIB_WRITE_CONFIG(bridge, busno, slot, func, PCIR_INTLINE,
-	    PCI_INVALID_IRQ, 1);
+	CS_WRITE(PCIR_INTLINE, PCI_INVALID_IRQ, 1);
+
+#undef CS_READ
+#undef CS_WRITE
 }
 
 static int

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:39:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 508E81065695;
	Wed, 23 Dec 2009 21:39:00 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 356F58FC12;
	Wed, 23 Dec 2009 21:39:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNLd0Yu009982;
	Wed, 23 Dec 2009 21:39:00 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNLd0pZ009980;
	Wed, 23 Dec 2009 21:39:00 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232139.nBNLd0pZ009980@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 21:39:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200921 - head/sys/sparc64/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:39:00 -0000

Author: marius
Date: Wed Dec 23 21:38:59 2009
New Revision: 200921
URL: http://svn.freebsd.org/changeset/base/200921

Log:
  - Add quirk handling for ALi M5229, mainly setting the magic "force
    enable IDE I/O" bit which prevents data access traps with revision
    0xc8 in Fire-based machines when pci(4) enables PCIM_CMD_PORTEN.
  - Like for sun4v also don't add the PCI side of host-PCIe bridges to
    the bus on sun4u as they don't have configuration space implement
    there either.

Modified:
  head/sys/sparc64/pci/ofw_pcibus.c

Modified: head/sys/sparc64/pci/ofw_pcibus.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcibus.c	Wed Dec 23 21:25:16 2009	(r200920)
+++ head/sys/sparc64/pci/ofw_pcibus.c	Wed Dec 23 21:38:59 2009	(r200921)
@@ -3,6 +3,7 @@
  * Copyright (c) 2000, Michael Smith 
  * Copyright (c) 2000, BSDi
  * Copyright (c) 2003, Thomas Moestl 
+ * Copyright (c) 2005 - 2009 Marius Strobl 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -194,6 +195,22 @@ ofw_pcibus_setup_device(device_t bridge,
 #endif
 
 	/*
+	 * Ensure that ALi M5229 report the actual content of PCIR_PROGIF
+	 * and that IDE I/O is force enabled.  The former is done in order
+	 * to have unique behavior across revisions as some default to
+	 * hiding bits 4-6 for compliance with PCI 2.3.  The latter is done
+	 * as at least revision 0xc8 requires the PCIM_CMD_PORTEN bypass
+	 * to be always enabled as otherwise even enabling PCIM_CMD_PORTEN
+	 * results in an instant data access trap on Fire-based machines.
+	 * Thus these quirks have to be handled before pci(4) adds the maps.
+	 * Note that for older revisions bit 0 of register 0x50 enables the
+	 * internal IDE function instead of force enabling IDE I/O.
+	 */
+	if ((CS_READ(PCIR_VENDOR, 2) == 0x10b9 &&
+	    CS_READ(PCIR_DEVICE, 2) == 0x5229))
+		CS_WRITE(0x50, CS_READ(0x50, 1) | 0x3, 1);
+
+	/*
 	 * The preset in the intline register is usually wrong.  Reset
 	 * it to 255, so that the PCI code will reroute the interrupt if
 	 * needed.
@@ -222,9 +239,14 @@ ofw_pcibus_attach(device_t dev)
 		    domain, busno);
 	node = ofw_bus_get_node(dev);
 
-#ifndef SUN4V
-	/* Add the PCI side of the HOST-PCI bridge itself to the bus. */
+	/*
+	 * Add the PCI side of the host-PCI bridge itself to the bus.
+	 * Note that we exclude the host-PCIe bridges here as these
+	 * have no configuration space implemented themselves.
+	 */
 	if (strcmp(device_get_name(device_get_parent(pcib)), "nexus") == 0 &&
+	    ofw_bus_get_type(pcib) != NULL &&
+	    strcmp(ofw_bus_get_type(pcib), OFW_TYPE_PCIE) != 0 &&
 	    (dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib,
 	    domain, busno, 0, 0, sizeof(*dinfo))) != NULL) {
 		if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, node) != 0)
@@ -232,7 +254,6 @@ ofw_pcibus_attach(device_t dev)
 		else
 			pci_add_child(dev, (struct pci_devinfo *)dinfo);
 	}
-#endif
 
 	if (OF_getprop(ofw_bus_get_node(pcib), "clock-frequency", &clock,
 	    sizeof(clock)) == -1)

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 21:51:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C12971065692;
	Wed, 23 Dec 2009 21:51:41 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AFCF08FC20;
	Wed, 23 Dec 2009 21:51:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNLpfqt010245;
	Wed, 23 Dec 2009 21:51:41 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNLpfTE010243;
	Wed, 23 Dec 2009 21:51:41 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232151.nBNLpfTE010243@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 21:51:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200922 - head/sys/sparc64/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 21:51:41 -0000

Author: marius
Date: Wed Dec 23 21:51:41 2009
New Revision: 200922
URL: http://svn.freebsd.org/changeset/base/200922

Log:
  Fix whitespace according to style(9).

Modified:
  head/sys/sparc64/include/iommureg.h

Modified: head/sys/sparc64/include/iommureg.h
==============================================================================
--- head/sys/sparc64/include/iommureg.h	Wed Dec 23 21:38:59 2009	(r200921)
+++ head/sys/sparc64/include/iommureg.h	Wed Dec 23 21:51:41 2009	(r200922)
@@ -37,7 +37,7 @@
  */
 
 #ifndef _MACHINE_IOMMUREG_H_
-#define _MACHINE_IOMMUREG_H_
+#define	_MACHINE_IOMMUREG_H_
 
 /*
  * UltraSPARC IOMMU registers, common to both the PCI and SBus
@@ -61,9 +61,9 @@
 #define	ISD_LN_TAG_DIAG	0x0900	/* streaming buffer line tag diag 0..15 */
 
 /* streaming buffer control register */
-#define STRBUF_EN		0x0000000000000001UL
-#define STRBUF_D		0x0000000000000002UL
-#define STRBUF_RR_DIS		0x0000000000000004UL
+#define	STRBUF_EN		0x0000000000000001UL
+#define	STRBUF_D		0x0000000000000002UL
+#define	STRBUF_RR_DIS		0x0000000000000004UL
 
 #define	IOMMU_MAXADDR(bits)	((1UL << (bits)) - 1)
 
@@ -72,24 +72,24 @@
  */
 /* Nummber of entries in IOTSB */
 #define	IOMMUCR_TSBSZ_SHIFT	16
-#define IOMMUCR_TSB1K		0x0000000000000000UL
-#define IOMMUCR_TSB2K		0x0000000000010000UL
-#define IOMMUCR_TSB4K		0x0000000000020000UL
-#define IOMMUCR_TSB8K		0x0000000000030000UL
-#define IOMMUCR_TSB16K		0x0000000000040000UL
-#define IOMMUCR_TSB32K		0x0000000000050000UL
-#define IOMMUCR_TSB64K		0x0000000000060000UL
-#define IOMMUCR_TSB128K		0x0000000000070000UL
+#define	IOMMUCR_TSB1K		0x0000000000000000UL
+#define	IOMMUCR_TSB2K		0x0000000000010000UL
+#define	IOMMUCR_TSB4K		0x0000000000020000UL
+#define	IOMMUCR_TSB8K		0x0000000000030000UL
+#define	IOMMUCR_TSB16K		0x0000000000040000UL
+#define	IOMMUCR_TSB32K		0x0000000000050000UL
+#define	IOMMUCR_TSB64K		0x0000000000060000UL
+#define	IOMMUCR_TSB128K		0x0000000000070000UL
 /* Mask for above */
-#define IOMMUCR_TSBMASK		0xfffffffffff8ffffUL
+#define	IOMMUCR_TSBMASK		0xfffffffffff8ffffUL
 /* 8K iommu page size */
-#define IOMMUCR_8KPG		0x0000000000000000UL
+#define	IOMMUCR_8KPG		0x0000000000000000UL
 /* 64K iommu page size */
-#define IOMMUCR_64KPG		0x0000000000000004UL
+#define	IOMMUCR_64KPG		0x0000000000000004UL
 /* Diag enable */
-#define IOMMUCR_DE		0x0000000000000002UL
+#define	IOMMUCR_DE		0x0000000000000002UL
 /* Enable IOMMU */
-#define IOMMUCR_EN		0x0000000000000001UL
+#define	IOMMUCR_EN		0x0000000000000001UL
 
 /*
  * Diagnostic register definitions
@@ -97,9 +97,9 @@
 #define	IOMMU_DTAG_VPNBITS	19
 #define	IOMMU_DTAG_VPNMASK	((1 << IOMMU_DTAG_VPNBITS) - 1)
 #define	IOMMU_DTAG_VPNSHIFT	13
-#define IOMMU_DTAG_ERRBITS	3
+#define	IOMMU_DTAG_ERRBITS	3
 #define	IOMMU_DTAG_ERRSHIFT	22
-#define	IOMMU_DTAG_ERRMASK \
+#define	IOMMU_DTAG_ERRMASK						\
 	(((1 << IOMMU_DTAG_ERRBITS) - 1) << IOMMU_DTAG_ERRSHIFT)
 
 #define	IOMMU_DDATA_PGBITS	21
@@ -114,18 +114,18 @@
 /* Entry valid */
 #define	IOTTE_V			0x8000000000000000UL
 /* 8K or 64K page? */
-#define IOTTE_64K		0x2000000000000000UL
-#define IOTTE_8K		0x0000000000000000UL
+#define	IOTTE_64K		0x2000000000000000UL
+#define	IOTTE_8K		0x0000000000000000UL
 /* Is page streamable? */
-#define IOTTE_STREAM		0x1000000000000000UL
+#define	IOTTE_STREAM		0x1000000000000000UL
 /* Accesses to same bus segment? */
 #define	IOTTE_LOCAL		0x0800000000000000UL
 /* Let's assume this is correct */
-#define IOTTE_PAMASK		0x000007ffffffe000UL
+#define	IOTTE_PAMASK		0x000007ffffffe000UL
 /* Accesses to cacheable space */
-#define IOTTE_C			0x0000000000000010UL
+#define	IOTTE_C			0x0000000000000010UL
 /* Writeable */
-#define IOTTE_W			0x0000000000000002UL
+#define	IOTTE_W			0x0000000000000002UL
 
 /* log2 of the IOMMU TTE size */
 #define	IOTTE_SHIFT		3
@@ -167,14 +167,14 @@
  */
 
 #define	IOTSB_BASESZ		(1024 << IOTTE_SHIFT)
-#define IOTSB_VEND		(~IO_PAGE_MASK)
-#define IOTSB_VSTART(sz)	(u_int)(IOTSB_VEND << ((sz) + 10))
+#define	IOTSB_VEND		(~IO_PAGE_MASK)
+#define	IOTSB_VSTART(sz)	(u_int)(IOTSB_VEND << ((sz) + 10))
 
-#define MAKEIOTTE(pa,w,c,s)						\
+#define	MAKEIOTTE(pa, w, c, s)						\
 	(((pa) & IOTTE_PAMASK) | ((w) ? IOTTE_W : 0) |			\
 	((c) ? IOTTE_C : 0) | ((s) ? IOTTE_STREAM : 0) |		\
 	(IOTTE_V | IOTTE_8K))
-#define IOTSBSLOT(va)						\
+#define	IOTSBSLOT(va)							\
 	((u_int)(((vm_offset_t)(va)) - (is->is_dvmabase)) >> IO_PAGE_SHIFT)
 
 #endif /* !_MACHINE_IOMMUREG_H_ */

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 22:02:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F10B8106566B;
	Wed, 23 Dec 2009 22:02:35 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE8EC8FC1B;
	Wed, 23 Dec 2009 22:02:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNM2YRY010498;
	Wed, 23 Dec 2009 22:02:34 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNM2YcC010494;
	Wed, 23 Dec 2009 22:02:34 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232202.nBNM2YcC010494@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 22:02:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200923 - in head/sys/sparc64: include sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 22:02:36 -0000

Author: marius
Date: Wed Dec 23 22:02:34 2009
New Revision: 200923
URL: http://svn.freebsd.org/changeset/base/200923

Log:
  - Add support for the IOMMUs of Fire JBus to PCIe and Oberon Uranus
    to PCIe bridges.
  - Add support for talking the PROM mappings over to the kernel IOTSB
    just like we do with the kernel TSB in order to allow OFW drivers
    to continue to work.
  - Change some members, parameters and variables to unsigned where
    more appropriate.

Modified:
  head/sys/sparc64/include/iommureg.h
  head/sys/sparc64/include/iommuvar.h
  head/sys/sparc64/sparc64/iommu.c

Modified: head/sys/sparc64/include/iommureg.h
==============================================================================
--- head/sys/sparc64/include/iommureg.h	Wed Dec 23 21:51:41 2009	(r200922)
+++ head/sys/sparc64/include/iommureg.h	Wed Dec 23 22:02:34 2009	(r200923)
@@ -44,10 +44,13 @@
  * controllers.
  */
 
-/* iommmu registers */
+/* IOMMU registers */
 #define	IMR_CTL		0x0000	/* IOMMU control register */
 #define	IMR_TSB		0x0008	/* IOMMU TSB base register */
 #define	IMR_FLUSH	0x0010	/* IOMMU flush register */
+/* The TTE Cache is Fire and Oberon only. */
+#define	IMR_CACHE_FLUSH	0x0100	/* IOMMU TTE cache flush address register */
+#define	IMR_CACHE_INVAL	0x0108	/* IOMMU TTE cache invalidate register */
 
 /* streaming buffer registers */
 #define	ISR_CTL		0x0000	/* streaming buffer control reg */
@@ -70,28 +73,57 @@
 /*
  * control register bits
  */
-/* Nummber of entries in IOTSB */
+/* Nummber of entries in the IOTSB - pre-Fire only */
+#define	IOMMUCR_TSBSZ_MASK	0x0000000000070000UL
 #define	IOMMUCR_TSBSZ_SHIFT	16
-#define	IOMMUCR_TSB1K		0x0000000000000000UL
-#define	IOMMUCR_TSB2K		0x0000000000010000UL
-#define	IOMMUCR_TSB4K		0x0000000000020000UL
-#define	IOMMUCR_TSB8K		0x0000000000030000UL
-#define	IOMMUCR_TSB16K		0x0000000000040000UL
-#define	IOMMUCR_TSB32K		0x0000000000050000UL
-#define	IOMMUCR_TSB64K		0x0000000000060000UL
-#define	IOMMUCR_TSB128K		0x0000000000070000UL
-/* Mask for above */
-#define	IOMMUCR_TSBMASK		0xfffffffffff8ffffUL
-/* 8K iommu page size */
+/* TSB cache snoop enable */
+#define	IOMMUCR_SE		0x0000000000000400UL
+/* Cache modes - Fire and Oberon */
+#define	IOMMUCR_CM_NC_TLB_TBW	0x0000000000000000UL
+#define	IOMMUCR_CM_LC_NTLB_NTBW	0x0000000000000100UL
+#define	IOMMUCR_CM_LC_TLB_TBW	0x0000000000000200UL
+#define	IOMMUCR_CM_C_TLB_TBW	0x0000000000000300UL
+/* IOMMU page size - pre-Fire only */
 #define	IOMMUCR_8KPG		0x0000000000000000UL
-/* 64K iommu page size */
 #define	IOMMUCR_64KPG		0x0000000000000004UL
-/* Diag enable */
+/* Bypass enable - Fire and Oberon */
+#define	IOMMUCR_BE		0x0000000000000002UL
+/* Diagnostic mode enable - pre-Fire only */
 #define	IOMMUCR_DE		0x0000000000000002UL
-/* Enable IOMMU */
+/* IOMMU/translation enable */
 #define	IOMMUCR_EN		0x0000000000000001UL
 
 /*
+ * TSB base register bits
+ */
+ /* TSB base address */
+#define	IOMMUTB_TB_MASK		0x000007ffffffe000UL
+#define	IOMMUTB_TB_SHIFT	13
+/* IOMMU page size - Fire and Oberon */
+#define	IOMMUTB_8KPG		0x0000000000000000UL
+#define	IOMMUTB_64KPG		0x0000000000000100UL
+/* Nummber of entries in the IOTSB - Fire and Oberon */
+#define	IOMMUTB_TSBSZ_MASK	0x0000000000000004UL
+#define	IOMMUTB_TSBSZ_SHIFT	0
+
+/*
+ * TSB size definitions for both control and TSB base register */
+#define	IOMMU_TSB1K		0
+#define	IOMMU_TSB2K		1
+#define	IOMMU_TSB4K		2
+#define	IOMMU_TSB8K		3
+#define	IOMMU_TSB16K		4
+#define	IOMMU_TSB32K		5
+#define	IOMMU_TSB64K		6
+#define	IOMMU_TSB128K		7
+/* Fire and Oberon */
+#define	IOMMU_TSB256K		8
+/* Fire and Oberon */
+#define	IOMMU_TSB512K		9
+#define	IOMMU_TSBENTRIES(tsbsz)						\
+	((1 << (tsbsz)) << (IO_PAGE_SHIFT - IOTTE_SHIFT))
+
+/*
  * Diagnostic register definitions
  */
 #define	IOMMU_DTAG_VPNBITS	19
@@ -113,16 +145,16 @@
  */
 /* Entry valid */
 #define	IOTTE_V			0x8000000000000000UL
-/* 8K or 64K page? */
+/* Page size - pre-Fire only */
 #define	IOTTE_64K		0x2000000000000000UL
 #define	IOTTE_8K		0x0000000000000000UL
-/* Is page streamable? */
+/* Streamable page - streaming buffer equipped variants only */
 #define	IOTTE_STREAM		0x1000000000000000UL
-/* Accesses to same bus segment? */
+/* Accesses to the same bus segment - SBus only */
 #define	IOTTE_LOCAL		0x0800000000000000UL
-/* Let's assume this is correct */
-#define	IOTTE_PAMASK		0x000007ffffffe000UL
-/* Accesses to cacheable space */
+/* Physical address mask (based on Oberon) */
+#define	IOTTE_PAMASK		0x00007fffffffe000UL
+/* Accesses to cacheable space - pre-Fire only */
 #define	IOTTE_C			0x0000000000000010UL
 /* Writeable */
 #define	IOTTE_W			0x0000000000000002UL

Modified: head/sys/sparc64/include/iommuvar.h
==============================================================================
--- head/sys/sparc64/include/iommuvar.h	Wed Dec 23 21:51:41 2009	(r200922)
+++ head/sys/sparc64/include/iommuvar.h	Wed Dec 23 22:02:34 2009	(r200923)
@@ -66,10 +66,10 @@ struct iommu_state {
 	int			is_tsbsize;	/* (r) 0 = 8K, ... */
 	uint64_t		is_pmaxaddr;	/* (r) max. physical address */
 	uint64_t		is_dvmabase;	/* (r) */
-	int64_t			is_cr;		/* (r) Control reg value */
+	uint64_t		is_cr;		/* (r) Control reg value */
 
 	vm_paddr_t		is_flushpa[2];	/* (r) */
-	volatile int64_t	*is_flushva[2];	/* (r, *i) */
+	volatile uint64_t	*is_flushva[2];	/* (r, *i) */
 	/*
 	 * (i)
 	 * When a flush is completed, 64 bytes will be stored at the given
@@ -99,11 +99,14 @@ struct iommu_state {
 	/* behavior flags */
 	u_int			is_flags;	/* (r) */
 #define	IOMMU_RERUN_DISABLE	(1 << 0)
+#define	IOMMU_FIRE		(1 << 1)
+#define	IOMMU_FLUSH_CACHE	(1 << 2)
+#define	IOMMU_PRESERVE_PROM	(1 << 3)
 };
 
 /* interfaces for PCI/SBus code */
-void iommu_init(const char *name, struct iommu_state *is, int tsbsize,
-    uint32_t iovabase, int resvpg);
+void iommu_init(const char *name, struct iommu_state *is, u_int tsbsize,
+    uint32_t iovabase, u_int resvpg);
 void iommu_reset(struct iommu_state *is);
 void iommu_decode_fault(struct iommu_state *is, vm_offset_t phys);
 

Modified: head/sys/sparc64/sparc64/iommu.c
==============================================================================
--- head/sys/sparc64/sparc64/iommu.c	Wed Dec 23 21:51:41 2009	(r200922)
+++ head/sys/sparc64/sparc64/iommu.c	Wed Dec 23 22:02:34 2009	(r200923)
@@ -138,11 +138,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -212,6 +214,12 @@ static __inline void
 iommu_tlb_flush(struct iommu_state *is, bus_addr_t va)
 {
 
+	if ((is->is_flags & IOMMU_FIRE) != 0)
+		/*
+		 * Direct page flushing is not supported and also not
+		 * necessary due to cache snooping.
+		 */
+		return;
 	IOMMU_WRITE8(is, is_iommu, IMR_FLUSH, va);
 }
 
@@ -282,18 +290,19 @@ iommu_map_remq(struct iommu_state *is, b
  *	- create a private DVMA map.
  */
 void
-iommu_init(const char *name, struct iommu_state *is, int tsbsize,
-    uint32_t iovabase, int resvpg)
+iommu_init(const char *name, struct iommu_state *is, u_int tsbsize,
+    uint32_t iovabase, u_int resvpg)
 {
 	vm_size_t size;
 	vm_offset_t offs;
-	uint64_t end;
+	uint64_t end, obpmap, obpptsb, tte;
+	u_int maxtsbsize, obptsbentries, obptsbsize, slot, tsbentries;
 	int i;
 
 	/*
-	 * Setup the iommu.
+	 * Setup the IOMMU.
 	 *
-	 * The sun4u iommu is part of the PCI or SBus controller so we
+	 * The sun4u IOMMU is part of the PCI or SBus controller so we
 	 * will deal with it here..
 	 *
 	 * The IOMMU address space always ends at 0xffffe000, but the starting
@@ -301,16 +310,30 @@ iommu_init(const char *name, struct iomm
 	 * is->is_tsbsize entries, where each entry is 8 bytes.  The start of
 	 * the map can be calculated by (0xffffe000 << (8 + is->is_tsbsize)).
 	 */
-	is->is_cr = (tsbsize << IOMMUCR_TSBSZ_SHIFT) | IOMMUCR_EN;
+	if ((is->is_flags & IOMMU_FIRE) != 0) {
+		maxtsbsize = IOMMU_TSB512K;
+		/*
+		 * We enable bypass in order to be able to use a physical
+		 * address for the event queue base.
+		 */
+		is->is_cr = IOMMUCR_SE | IOMMUCR_CM_C_TLB_TBW | IOMMUCR_BE;
+	} else {
+		maxtsbsize = IOMMU_TSB128K;
+		is->is_cr = (tsbsize << IOMMUCR_TSBSZ_SHIFT) | IOMMUCR_DE;
+	}
+	if (tsbsize > maxtsbsize)
+		panic("%s: unsupported TSB size	", __func__);
+	tsbentries = IOMMU_TSBENTRIES(tsbsize);
+	is->is_cr |= IOMMUCR_EN;
 	is->is_tsbsize = tsbsize;
 	is->is_dvmabase = iovabase;
 	if (iovabase == -1)
 		is->is_dvmabase = IOTSB_VSTART(is->is_tsbsize);
 
 	size = IOTSB_BASESZ << is->is_tsbsize;
-	printf("%s: DVMA map: %#lx to %#lx%s\n", name,
+	printf("%s: DVMA map: %#lx to %#lx %d entries%s\n", name,
 	    is->is_dvmabase, is->is_dvmabase +
-	    (size << (IO_PAGE_SHIFT - IOTTE_SHIFT)) - 1,
+	    (size << (IO_PAGE_SHIFT - IOTTE_SHIFT)) - 1, tsbentries,
 	    IOMMU_HAS_SB(is) ? ", streaming buffer" : "");
 
 	/*
@@ -333,12 +356,54 @@ iommu_init(const char *name, struct iomm
 	 */
 	is->is_tsb = contigmalloc(size, M_DEVBUF, M_NOWAIT, 0, ~0UL,
 	    PAGE_SIZE, 0);
-	if (is->is_tsb == 0)
+	if (is->is_tsb == NULL)
 		panic("%s: contigmalloc failed", __func__);
 	is->is_ptsb = pmap_kextract((vm_offset_t)is->is_tsb);
 	bzero(is->is_tsb, size);
 
 	/*
+	 * Add the PROM mappings to the kernel IOTSB if desired.
+	 * Note that the firmware of certain Darwin boards doesn't set
+	 * the TSB size correctly.
+	 */
+	if ((is->is_flags & IOMMU_FIRE) != 0)
+		obptsbsize = (IOMMU_READ8(is, is_iommu, IMR_TSB) &
+		    IOMMUTB_TSBSZ_MASK) >> IOMMUTB_TSBSZ_SHIFT;
+	else
+		obptsbsize = (IOMMU_READ8(is, is_iommu, IMR_CTL) &
+		    IOMMUCR_TSBSZ_MASK) >> IOMMUCR_TSBSZ_SHIFT;
+	obptsbentries = IOMMU_TSBENTRIES(obptsbsize);
+	if (bootverbose)
+		printf("%s: PROM IOTSB size: %d (%d entries)\n", name,
+		    obptsbsize, obptsbentries);
+	if ((is->is_flags & IOMMU_PRESERVE_PROM) != 0 &&
+	    !(cpu_impl == CPU_IMPL_ULTRASPARCIIi && obptsbsize == 7)) {
+		if (obptsbentries > tsbentries)
+			panic("%s: PROM IOTSB entries exceed kernel",
+			    __func__);
+		obpptsb = IOMMU_READ8(is, is_iommu, IMR_TSB) &
+		    IOMMUTB_TB_MASK;
+		for (i = 0; i < obptsbentries; i++) {
+			tte = ldxa(obpptsb + i * 8, ASI_PHYS_USE_EC);
+			if ((tte & IOTTE_V) == 0)
+				continue;
+			slot = tsbentries - obptsbentries + i;
+			if (bootverbose)
+				printf("%s: adding PROM IOTSB slot %d "
+				    "(kernel slot %d) TTE: %#lx\n", name,
+				    i, slot, tte);
+			obpmap = (is->is_dvmabase + slot * IO_PAGE_SIZE) >>
+			    IO_PAGE_SHIFT;
+			if (rman_reserve_resource(&is->is_dvma_rman, obpmap,
+			    obpmap, IO_PAGE_SIZE >> IO_PAGE_SHIFT, RF_ACTIVE,
+			    NULL) == NULL)
+				panic("%s: could not reserve PROM IOTSB slot "
+				    "%d (kernel slot %d)", __func__, i, slot);
+			is->is_tsb[slot] = tte;
+		}
+	}
+
+	/*
 	 * Initialize streaming buffer, if it is there.
 	 */
 	if (IOMMU_HAS_SB(is)) {
@@ -349,7 +414,7 @@ iommu_init(const char *name, struct iomm
 		offs = roundup2((vm_offset_t)is->is_flush,
 		    STRBUF_FLUSHSYNC_NBYTES);
 		for (i = 0; i < 2; i++, offs += STRBUF_FLUSHSYNC_NBYTES) {
-			is->is_flushva[i] = (int64_t *)offs;
+			is->is_flushva[i] = (uint64_t *)offs;
 			is->is_flushpa[i] = pmap_kextract(offs);
 		}
 	}
@@ -368,11 +433,16 @@ iommu_init(const char *name, struct iomm
 void
 iommu_reset(struct iommu_state *is)
 {
+	uint64_t tsb;
 	int i;
 
-	IOMMU_WRITE8(is, is_iommu, IMR_TSB, is->is_ptsb);
-	/* Enable IOMMU in diagnostic mode */
-	IOMMU_WRITE8(is, is_iommu, IMR_CTL, is->is_cr | IOMMUCR_DE);
+	tsb = is->is_ptsb;
+	if ((is->is_flags & IOMMU_FIRE) != 0) {
+		tsb |= is->is_tsbsize;
+		IOMMU_WRITE8(is, is_iommu, IMR_CACHE_INVAL, ~0ULL);
+	}
+	IOMMU_WRITE8(is, is_iommu, IMR_TSB, tsb);
+	IOMMU_WRITE8(is, is_iommu, IMR_CTL, is->is_cr);
 
 	for (i = 0; i < 2; i++) {
 		if (is->is_sb[i] != 0) {
@@ -386,6 +456,8 @@ iommu_reset(struct iommu_state *is)
 				is->is_sb[i] = 0;
 		}
 	}
+
+	(void)IOMMU_READ8(is, is_iommu, IMR_CTL);
 }
 
 /*
@@ -396,7 +468,7 @@ static void
 iommu_enter(struct iommu_state *is, vm_offset_t va, vm_paddr_t pa,
     int stream, int flags)
 {
-	int64_t tte;
+	uint64_t tte;
 
 	KASSERT(va >= is->is_dvmabase,
 	    ("%s: va %#lx not in DVMA space", __func__, va));
@@ -423,7 +495,7 @@ iommu_enter(struct iommu_state *is, vm_o
 static int
 iommu_remove(struct iommu_state *is, vm_offset_t va, vm_size_t len)
 {
-	int streamed = 0;
+	int slot, streamed = 0;
 
 #ifdef IOMMU_DIAG
 	iommu_diag(is, va);
@@ -443,6 +515,12 @@ iommu_remove(struct iommu_state *is, vm_
 		len -= ulmin(len, IO_PAGE_SIZE);
 		IOMMU_SET_TTE(is, va, 0);
 		iommu_tlb_flush(is, va);
+		if ((is->is_flags & IOMMU_FLUSH_CACHE) != 0) {
+			slot = IOTSBSLOT(va);
+			if (len <= IO_PAGE_SIZE || slot % 8 == 7)
+				IOMMU_WRITE8(is, is_iommu, IMR_CACHE_FLUSH,
+				    is->is_ptsb + slot * 8);
+		}
 		va += IO_PAGE_SIZE;
 	}
 	return (streamed);
@@ -829,12 +907,13 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t 
     bus_dmamap_t map, void *buf, bus_size_t buflen, struct thread *td,
     int flags, bus_dma_segment_t *segs, int *segp, int align)
 {
-	bus_addr_t amask, dvmaddr;
+	bus_addr_t amask, dvmaddr, dvmoffs;
 	bus_size_t sgsize, esize;
 	vm_offset_t vaddr, voffs;
 	vm_paddr_t curaddr;
 	pmap_t pmap = NULL;
 	int error, firstpg, sgcnt;
+	u_int slot;
 
 	KASSERT(buflen != 0, ("%s: buflen == 0!", __func__));
 	if (buflen > dt->dt_maxsize)
@@ -877,8 +956,15 @@ iommu_dvmamap_load_buffer(bus_dma_tag_t 
 		buflen -= sgsize;
 		vaddr += sgsize;
 
-		iommu_enter(is, trunc_io_page(dvmaddr), trunc_io_page(curaddr),
+		dvmoffs = trunc_io_page(dvmaddr);
+		iommu_enter(is, dvmoffs, trunc_io_page(curaddr),
 		    (map->dm_flags & DMF_STREAMED) != 0, flags);
+		if ((is->is_flags & IOMMU_FLUSH_CACHE) != 0) {
+			slot = IOTSBSLOT(dvmoffs);
+			if (buflen <= 0 || slot % 8 == 7)
+				IOMMU_WRITE8(is, is_iommu, IMR_CACHE_FLUSH,
+				    is->is_ptsb + slot * 8);
+		}
 
 		/*
 		 * Chop the chunk up into segments of at most maxsegsz, but try
@@ -1183,6 +1269,8 @@ iommu_diag(struct iommu_state *is, vm_of
 	int i;
 	uint64_t data, tag;
 
+	if ((is->is_flags & IOMMU_FIRE) != 0)
+		return;
 	IS_LOCK_ASSERT(is);
 	IOMMU_WRITE8(is, is_dva, 0, trunc_io_page(va));
 	membar(StoreStore | StoreLoad);

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 22:11:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 496771065672;
	Wed, 23 Dec 2009 22:11:34 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37C6A8FC14;
	Wed, 23 Dec 2009 22:11:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNMBYsD010735;
	Wed, 23 Dec 2009 22:11:34 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNMBYcK010733;
	Wed, 23 Dec 2009 22:11:34 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232211.nBNMBYcK010733@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 22:11:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200924 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 22:11:34 -0000

Author: marius
Date: Wed Dec 23 22:11:33 2009
New Revision: 200924
URL: http://svn.freebsd.org/changeset/base/200924

Log:
  Style changes.

Modified:
  head/sys/sparc64/sparc64/ofw_machdep.c

Modified: head/sys/sparc64/sparc64/ofw_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/ofw_machdep.c	Wed Dec 23 22:02:34 2009	(r200923)
+++ head/sys/sparc64/sparc64/ofw_machdep.c	Wed Dec 23 22:11:33 2009	(r200924)
@@ -23,7 +23,7 @@
  * 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 
 __FBSDID("$FreeBSD$");
 
@@ -64,34 +64,32 @@ OF_getetheraddr(device_t dev, u_char *ad
 
 	node = OF_peer(0);
 	if (node <= 0 || OF_getprop(node, "idprom", &idp, sizeof(idp)) == -1)
-		panic("Could not determine the machine ethernet address");
+		panic("Could not determine the machine Ethernet address");
 	bcopy(&idp.id_ether, addr, ETHER_ADDR_LEN);
 }
 
 static __inline uint32_t
 phys_hi_mask_space(const char *bus, uint32_t phys_hi)
 {
-	uint32_t space;
 
-	space = phys_hi;
 	if (strcmp(bus, "ebus") == 0 || strcmp(bus, "isa") == 0)
-		space &= 0x1;
+		phys_hi &= 0x1;
 	else if (strcmp(bus, "pci") == 0)
-		space &= OFW_PCI_PHYS_HI_SPACEMASK;
+		phys_hi &= OFW_PCI_PHYS_HI_SPACEMASK;
 	/* The phys.hi cells of the other busses only contain space bits. */
-	return (space);
+	return (phys_hi);
 }
 
 /*
  * Return the physical address and the bus space to use for a node
  * referenced by its package handle and the index of the register bank
- * to decode. Intended to be used to together with sparc64_fake_bustag()
+ * to decode.  Intended to be used to together with sparc64_fake_bustag()
  * by console drivers in early boot only.
  * Works by mapping the address of the node's bank given in the address
  * space of its parent upward in the device tree at each bridge along the
  * path.
  * Currently only really deals with max. 64-bit addresses, i.e. addresses
- * consisting of max. 2 phys cells (phys.hi and phys.lo). If we encounter
+ * consisting of max. 2 phys cells (phys.hi and phys.lo).  If we encounter
  * a 3 phys cells address (as with PCI addresses) we assume phys.hi can
  * be ignored except for the space bits (generally contained in phys.hi)
  * and treat phys.mid as phys.hi.
@@ -109,17 +107,17 @@ OF_decode_addr(phandle_t node, int bank,
 
 	/*
 	 * In general the addresses are contained in the "reg" property
-	 * of a node. The first address in the "reg" property of a PCI
+	 * of a node.  The first address in the "reg" property of a PCI
 	 * node however is the address of its configuration registers in
-	 * the configuration space of the host bridge. Additional entries
-	 * denote the memory and I/O addresses. For relocatable addresses
+	 * the configuration space of the host bridge.  Additional entries
+	 * denote the memory and I/O addresses.  For relocatable addresses
 	 * the "reg" property contains the BAR, for non-relocatable
-	 * addresses it contains the absolute PCI address. The PCI-only
+	 * addresses it contains the absolute PCI address.  The PCI-only
 	 * "assigned-addresses" property however always contains the
 	 * absolute PCI addresses.
 	 * The "assigned-addresses" and "reg" properties are arrays of
 	 * address structures consisting of #address-cells 32-bit phys
-	 * cells and #size-cells 32-bit size cells. If a parent lacks
+	 * cells and #size-cells 32-bit size cells.  If a parent lacks
 	 * the "#address-cells" or "#size-cells" property the default
 	 * for #address-cells to use is 2 and for #size-cells 1.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 22:25:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4525106568F;
	Wed, 23 Dec 2009 22:25:23 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B256E8FC12;
	Wed, 23 Dec 2009 22:25:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNMPNob011052;
	Wed, 23 Dec 2009 22:25:23 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNMPNQn011050;
	Wed, 23 Dec 2009 22:25:23 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232225.nBNMPNQn011050@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 22:25:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200925 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 22:25:23 -0000

Author: marius
Date: Wed Dec 23 22:25:23 2009
New Revision: 200925
URL: http://svn.freebsd.org/changeset/base/200925

Log:
  - By re-arranging the code in OF_decode_addr() somewhat and accepting
    a bit of a detour we can just iterate through the banks array instead
    of having to calculate every offset. This change is inspired by the
    powerpc version of this function.
  - Add support for the JBus to EBus bridges which hang off of nexus(4).

Modified:
  head/sys/sparc64/sparc64/ofw_machdep.c

Modified: head/sys/sparc64/sparc64/ofw_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/ofw_machdep.c	Wed Dec 23 22:11:33 2009	(r200924)
+++ head/sys/sparc64/sparc64/ofw_machdep.c	Wed Dec 23 22:25:23 2009	(r200925)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2001 by Thomas Moestl .
- * Copyright (c) 2005 by Marius Strobl .
+ * Copyright (c) 2005 - 2009 by Marius Strobl .
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -98,11 +98,11 @@ int
 OF_decode_addr(phandle_t node, int bank, int *space, bus_addr_t *addr)
 {
 	char name[32];
-	uint64_t cend, cstart, end, phys, sz, start;
+	uint64_t cend, cstart, end, phys, pphys, sz, start;
 	pcell_t addrc, szc, paddrc;
 	phandle_t bus, lbus, pbus;
 	uint32_t banks[10 * 5];	/* 10 PCI banks */
-	uint32_t cspace, spc;
+	uint32_t cspc, pspc, spc;
 	int i, j, nbank;
 
 	/*
@@ -148,17 +148,18 @@ OF_decode_addr(phandle_t node, int bank,
 	nbank /= sizeof(banks[0]) * (addrc + szc);
 	if (bank < 0 || bank > nbank - 1)
 		return (ENXIO);
+	bank *= addrc + szc;
+	spc = phys_hi_mask_space(name, banks[bank]);
+	/* Skip the high cell for 3-cell addresses. */
+	bank += addrc - 2;
 	phys = 0;
 	for (i = 0; i < MIN(2, addrc); i++)
-		phys |= (uint64_t)banks[(addrc + szc) * bank + addrc - 2 + i] <<
-		    32 * (MIN(2, addrc) - i - 1);
+		phys = ((uint64_t)phys << 32) | banks[bank++];
 	sz = 0;
 	for (i = 0; i < szc; i++)
-		sz |= (uint64_t)banks[(addrc + szc) * bank + addrc + i] <<
-		    32 * (szc - i - 1);
+		sz = ((uint64_t)sz << 32) | banks[bank++];
 	start = phys;
 	end = phys + sz - 1;
-	spc = phys_hi_mask_space(name, banks[(addrc + szc) * bank]);
 
 	/*
 	 * Map upward in the device tree at every bridge we encounter
@@ -170,7 +171,7 @@ OF_decode_addr(phandle_t node, int bank,
 	 * If a bridge doesn't have a "ranges" property no mapping is
 	 * necessary at that bridge.
 	 */
-	cspace = 0;
+	cspc = 0;
 	lbus = bus;
 	while ((pbus = OF_parent(bus)) != 0) {
 		if (OF_getprop(pbus, "#address-cells", &paddrc,
@@ -193,42 +194,40 @@ OF_decode_addr(phandle_t node, int bank,
 				return (ENXIO);
 		}
 		nbank /= sizeof(banks[0]) * (addrc + paddrc + szc);
+		bank = 0;
 		for (i = 0; i < nbank; i++) {
-			cspace = phys_hi_mask_space(name,
-			    banks[(addrc + paddrc + szc) * i]);
-			if (cspace != spc)
+			cspc = phys_hi_mask_space(name, banks[bank]);
+			if (cspc != spc) {
+				bank += addrc + paddrc + szc;
 				continue;
+			}
+			/* Skip the high cell for 3-cell addresses. */
+			bank += addrc - 2;
 			phys = 0;
 			for (j = 0; j < MIN(2, addrc); j++)
-				phys |= (uint64_t)banks[
-				    (addrc + paddrc + szc) * i +
-				    addrc - 2 + j] <<
-				    32 * (MIN(2, addrc) - j - 1);
+				phys = ((uint64_t)phys << 32) | banks[bank++];
+			pspc = banks[bank];
+			/* Skip the high cell for 3-cell addresses. */
+			bank += paddrc - 2;
+			pphys = 0;
+			for (j = 0; j < MIN(2, paddrc); j++)
+				pphys =
+				    ((uint64_t)pphys << 32) | banks[bank++];
 			sz = 0;
 			for (j = 0; j < szc; j++)
-				sz |= (uint64_t)banks[
-				    (addrc + paddrc + szc) * i + addrc +
-				    paddrc + j] <<
-				    32 * (szc - j - 1);
+				sz = ((uint64_t)sz << 32) | banks[bank++];
 			cstart = phys;
 			cend = phys + sz - 1;
 			if (start < cstart || start > cend)
 				continue;
 			if (end < cstart || end > cend)
 				return (ENXIO);
-			phys = 0;
-			for (j = 0; j < MIN(2, paddrc); j++)
-				phys |= (uint64_t)banks[
-				    (addrc + paddrc + szc) * i + addrc +
-				    paddrc - 2 + j] <<
-				    32 * (MIN(2, paddrc) - j - 1);
-			start += phys - cstart;
-			end += phys - cstart;
 			if (OF_getprop(pbus, "name", name, sizeof(name)) == -1)
 				return (ENXIO);
 			name[sizeof(name) - 1] = '\0';
-			spc = phys_hi_mask_space(name,
-			    banks[(addrc + paddrc + szc) * i + addrc]);
+			spc = phys_hi_mask_space(name, pspc);
+			start += pphys - cstart;
+			end += pphys - cstart;
 			break;
 		}
 		if (i == nbank)
@@ -239,8 +238,8 @@ OF_decode_addr(phandle_t node, int bank,
 		bus = pbus;
 	}
 
-	/* Done with mapping. Return the bus space as used by FreeBSD. */
 	*addr = start;
+	/* Determine the bus space based on the last bus we mapped. */
 	if (OF_parent(lbus) == 0) {
 		*space = NEXUS_BUS_SPACE;
 		return (0);
@@ -248,11 +247,12 @@ OF_decode_addr(phandle_t node, int bank,
 	if (OF_getprop(lbus, "name", name, sizeof(name)) == -1)
 		return (ENXIO);
 	name[sizeof(name) - 1] = '\0';
-	if (strcmp(name, "central") == 0 || strcmp(name, "upa") == 0) {
+	if (strcmp(name, "central") == 0 || strcmp(name, "ebus") == 0 ||
+	    strcmp(name, "upa") == 0) {
 		*space = NEXUS_BUS_SPACE;
 		return (0);
 	} else if (strcmp(name, "pci") == 0) {
-		switch (cspace) {
+		switch (cspc) {
 		case OFW_PCI_PHYS_HI_SPACE_IO:
 			*space = PCI_IO_BUS_SPACE;
 			return (0);

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 22:31:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0A67A106568B;
	Wed, 23 Dec 2009 22:31:44 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED27C8FC1D;
	Wed, 23 Dec 2009 22:31:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNMVhsf011247;
	Wed, 23 Dec 2009 22:31:43 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNMVhd0011244;
	Wed, 23 Dec 2009 22:31:43 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912232231.nBNMVhd0011244@svn.freebsd.org>
From: Marius Strobl 
Date: Wed, 23 Dec 2009 22:31:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200926 - head/sys/dev/uart
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 22:31:44 -0000

Author: marius
Date: Wed Dec 23 22:31:43 2009
New Revision: 200926
URL: http://svn.freebsd.org/changeset/base/200926

Log:
  Recognize the NS16552 found in PCIe-based sun4u machines.

Modified:
  head/sys/dev/uart/uart_bus_ebus.c
  head/sys/dev/uart/uart_cpu_sparc64.c

Modified: head/sys/dev/uart/uart_bus_ebus.c
==============================================================================
--- head/sys/dev/uart/uart_bus_ebus.c	Wed Dec 23 22:25:23 2009	(r200925)
+++ head/sys/dev/uart/uart_bus_ebus.c	Wed Dec 23 22:31:43 2009	(r200926)
@@ -77,7 +77,7 @@ uart_ebus_probe(device_t dev)
 	if (!strcmp(nm, "lom-console") || !strcmp(nm, "su") ||
 	    !strcmp(nm, "su_pnp") || !strcmp(cmpt, "rsc-console") ||
 	    !strcmp(cmpt, "rsc-control") || !strcmp(cmpt, "su") ||
-	    !strcmp(cmpt, "su16550")) {
+	    !strcmp(cmpt, "su16550") || !strcmp(cmpt, "su16552")) {
 		/*
 		 * On AXi and AXmp boards the NS16550 (used to connect
 		 * keyboard/mouse) share their IRQ lines with the i8042.

Modified: head/sys/dev/uart/uart_cpu_sparc64.c
==============================================================================
--- head/sys/dev/uart/uart_cpu_sparc64.c	Wed Dec 23 22:25:23 2009	(r200925)
+++ head/sys/dev/uart/uart_cpu_sparc64.c	Wed Dec 23 22:31:43 2009	(r200926)
@@ -254,7 +254,8 @@ uart_cpu_getdev(int devtype, struct uart
 		addr += range - range * (di->bas.chan - 1);
 	} else if (!strcmp(buf, "lom-console") || !strcmp(buf, "su") ||
 	    !strcmp(buf, "su_pnp") || !strcmp(compat, "rsc-console") ||
-	    !strcmp(compat, "su") || !strcmp(compat, "su16550")) {
+	    !strcmp(compat, "su") || !strcmp(compat, "su16550") ||
+	    !strcmp(compat, "su16552")) {
 		class = &uart_ns8250_class;
 		di->bas.chan = 0;
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 23:16:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF075106566C;
	Wed, 23 Dec 2009 23:16:54 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CB0988FC15;
	Wed, 23 Dec 2009 23:16:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNNGsfw012385;
	Wed, 23 Dec 2009 23:16:54 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNNGsiV012373;
	Wed, 23 Dec 2009 23:16:54 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <200912232316.nBNNGsiV012373@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 23 Dec 2009 23:16:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200928 - in head: lib/libpmc sys/arm/conf
	sys/arm/include sys/arm/xscale/ixp425 sys/dev/hwpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 23:16:55 -0000

Author: rpaulo
Date: Wed Dec 23 23:16:54 2009
New Revision: 200928
URL: http://svn.freebsd.org/changeset/base/200928

Log:
  Intel XScale hwpmc(4) support.
  
  This brings hwpmc(4) support for 2nd and 3rd generation XScale cores.
  Right now it's enabled by default to make sure we test this a bit.
  When the time comes it can be disabled by default.
  Tested on Gateworks boards.
  
  A man page is coming.
  
  Obtained from:	//depot/user/rpaulo/xscalepmc/...

Added:
  head/lib/libpmc/pmc.xscale.3   (contents, props changed)
  head/sys/dev/hwpmc/hwpmc_xscale.c   (contents, props changed)
  head/sys/dev/hwpmc/hwpmc_xscale.h   (contents, props changed)
Modified:
  head/lib/libpmc/Makefile
  head/lib/libpmc/libpmc.c
  head/sys/arm/conf/AVILA
  head/sys/arm/conf/CAMBRIA
  head/sys/arm/include/pmc_mdep.h
  head/sys/arm/xscale/ixp425/files.ixp425
  head/sys/dev/hwpmc/hwpmc_arm.c
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/lib/libpmc/Makefile
==============================================================================
--- head/lib/libpmc/Makefile	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/lib/libpmc/Makefile	Wed Dec 23 23:16:54 2009	(r200928)
@@ -35,6 +35,8 @@ MAN+=	pmc.p4.3
 MAN+=	pmc.p5.3
 MAN+=	pmc.p6.3
 MAN+=	pmc.tsc.3
+.elif ${MACHINE_ARCH} == "arm" && ${CPUTYPE} == "xscale"
+MAN+=	pmc.xscale.3
 .endif
 
 MLINKS+= \

Modified: head/lib/libpmc/libpmc.c
==============================================================================
--- head/lib/libpmc/libpmc.c	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/lib/libpmc/libpmc.c	Wed Dec 23 23:16:54 2009	(r200928)
@@ -69,6 +69,10 @@ static int p6_allocate_pmc(enum pmc_even
 static int tsc_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
     struct pmc_op_pmcallocate *_pmc_config);
 #endif
+#if defined(__XSCALE__)
+static int xscale_allocate_pmc(enum pmc_event _pe, char *_ctrspec,
+    struct pmc_op_pmcallocate *_pmc_config);
+#endif
 
 #define PMC_CALL(cmd, params)				\
 	syscall(pmc_syscall, PMC_OP_##cmd, (params))
@@ -132,6 +136,7 @@ PMC_CLASSDEP_TABLE(k8, K8);
 PMC_CLASSDEP_TABLE(p4, P4);
 PMC_CLASSDEP_TABLE(p5, P5);
 PMC_CLASSDEP_TABLE(p6, P6);
+PMC_CLASSDEP_TABLE(xscale, XSCALE);
 
 #undef	__PMC_EV_ALIAS
 #define	__PMC_EV_ALIAS(N,CODE) 	{ N, PMC_EV_##CODE },
@@ -176,6 +181,7 @@ PMC_MDEP_TABLE(k8, K8, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(p4, P4, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(p5, P5, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(p6, P6, PMC_CLASS_TSC);
+PMC_MDEP_TABLE(xscale, XSCALE, PMC_CLASS_XSCALE);
 
 static const struct pmc_event_descr tsc_event_table[] =
 {
@@ -216,6 +222,9 @@ PMC_CLASS_TABLE_DESC(p6, P6, p6, p6);
 #if	defined(__i386__) || defined(__amd64__)
 PMC_CLASS_TABLE_DESC(tsc, TSC, tsc, tsc);
 #endif
+#if	defined(__XSCALE__)
+PMC_CLASS_TABLE_DESC(xscale, XSCALE, xscale, xscale);
+#endif
 
 #undef	PMC_CLASS_TABLE_DESC
 
@@ -2008,6 +2017,29 @@ tsc_allocate_pmc(enum pmc_event pe, char
 }
 #endif
 
+#if	defined(__XSCALE__)
+
+static struct pmc_event_alias xscale_aliases[] = {
+	EV_ALIAS("branches",		"BRANCH_RETIRED"),
+	EV_ALIAS("branch-mispredicts",	"BRANCH_MISPRED"),
+	EV_ALIAS("dc-misses",		"DC_MISS"),
+	EV_ALIAS("ic-misses",		"IC_MISS"),
+	EV_ALIAS("instructions",	"INSTR_RETIRED"),
+	EV_ALIAS(NULL, NULL)
+};
+static int
+xscale_allocate_pmc(enum pmc_event pe, char *ctrspec __unused,
+    struct pmc_op_pmcallocate *pmc_config __unused)
+{
+	switch (pe) {
+	default:
+		break;
+	}
+
+	return (0);
+}
+#endif
+
 /*
  * Match an event name `name' with its canonical form.
  *
@@ -2335,6 +2367,10 @@ pmc_event_names_of_class(enum pmc_class 
 		ev = p6_event_table;
 		count = PMC_EVENT_TABLE_SIZE(p6);
 		break;
+	case PMC_CLASS_XSCALE:
+		ev = xscale_event_table;
+		count = PMC_EVENT_TABLE_SIZE(xscale);
+		break;
 	default:
 		errno = EINVAL;
 		return (-1);
@@ -2520,6 +2556,12 @@ pmc_init(void)
 		pmc_class_table[n] = &p4_class_table_descr;
 		break;
 #endif
+#if defined(__XSCALE__)
+	case PMC_CPU_INTEL_XSCALE:
+		PMC_MDEP_INIT(xscale);
+		pmc_class_table[n] = &xscale_class_table_descr;
+		break;
+#endif
 
 
 	default:
@@ -2635,6 +2677,9 @@ _pmc_name_of_event(enum pmc_event pe, en
 	} else if (pe >= PMC_EV_P6_FIRST && pe <= PMC_EV_P6_LAST) {
 		ev = p6_event_table;
 		evfence = p6_event_table + PMC_EVENT_TABLE_SIZE(p6);
+	} else if (pe >= PMC_EV_XSCALE_FIRST && pe <= PMC_EV_XSCALE_LAST) {
+		ev = xscale_event_table;
+		evfence = xscale_event_table + PMC_EVENT_TABLE_SIZE(xscale);
 	} else if (pe == PMC_EV_TSC_TSC) {
 		ev = tsc_event_table;
 		evfence = tsc_event_table + PMC_EVENT_TABLE_SIZE(tsc);

Added: head/lib/libpmc/pmc.xscale.3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libpmc/pmc.xscale.3	Wed Dec 23 23:16:54 2009	(r200928)
@@ -0,0 +1,39 @@
+.\" Copyright (c) 2009 Rui Paulo.  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 Joseph Koshy ``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 Joseph Koshy 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 23, 2009
+.Os
+.Dt PMC.XSCALE 3
+.Sh NAME
+.Nm pmc.xscale
+.Nd measurement events for
+.Tn Intel
+.Tn XScale
+family CPUs
+.Sh LIBRARY
+.Lb libpmc
+.Sh SYNOPSIS
+.In pmc.h
+.Sh DESCRIPTION

Modified: head/sys/arm/conf/AVILA
==============================================================================
--- head/sys/arm/conf/AVILA	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/sys/arm/conf/AVILA	Wed Dec 23 23:16:54 2009	(r200928)
@@ -61,6 +61,10 @@ options 	BOOTP_COMPAT
 #options 	PREEMPTION
 #options 	VERBOSE_SYSINIT
 
+# Hardware performance counters
+options 	HWPMC_HOOKS
+device		hwpmc
+
 #device		saarm
 
 device		pci

Modified: head/sys/arm/conf/CAMBRIA
==============================================================================
--- head/sys/arm/conf/CAMBRIA	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/sys/arm/conf/CAMBRIA	Wed Dec 23 23:16:54 2009	(r200928)
@@ -58,6 +58,10 @@ options 	BOOTP_NFSV3
 options 	BOOTP_WIRED_TO=npe0
 options 	BOOTP_COMPAT
 
+# Hardware performance counters
+options 	HWPMC_HOOKS
+device		hwpmc
+
 #options 	VERBOSE_SYSINIT
 options 	VERBOSE_INIT_ARM
 

Modified: head/sys/arm/include/pmc_mdep.h
==============================================================================
--- head/sys/arm/include/pmc_mdep.h	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/sys/arm/include/pmc_mdep.h	Wed Dec 23 23:16:54 2009	(r200928)
@@ -1,5 +1,27 @@
 /*-
- * This file is in the public domain.
+ * Copyright (c) 2009 Rui Paulo 
+ * 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.
  *
  * $FreeBSD$
  */
@@ -7,6 +29,14 @@
 #ifndef _MACHINE_PMC_MDEP_H_
 #define	_MACHINE_PMC_MDEP_H_
 
+#define	PMC_MDEP_CLASS_INDEX_XSCALE	0
+/*
+ * On the ARM platform we support the following PMCs.
+ *
+ * XSCALE	Intel XScale processors
+ */
+#include 
+
 union pmc_md_op_pmcallocate {
 	uint64_t	__pad[4];
 };
@@ -15,14 +45,20 @@ union pmc_md_op_pmcallocate {
 #define	PMCLOG_READADDR		PMCLOG_READ32
 #define	PMCLOG_EMITADDR		PMCLOG_EMIT32
 
-#if	_KERNEL
+#ifdef	_KERNEL
 union pmc_md_pmc {
+	struct pmc_md_xscale_pmc	pm_xscale;
 };
 
-#define	PMC_TRAPFRAME_TO_PC(TF)	(0)	/* Stubs */
-#define	PMC_TRAPFRAME_TO_FP(TF)	(0)
-#define	PMC_TRAPFRAME_TO_SP(TF)	(0)
+#define	PMC_TRAPFRAME_TO_PC(TF)	((TF)->tf_pc)
+#define	PMC_TRAPFRAME_TO_FP(TF)	((TF)->tf_usr_lr)
+#define	PMC_TRAPFRAME_TO_SP(TF)	((TF)->tf_usr_sp)
 
-#endif
+/*
+ * Prototypes
+ */
+struct pmc_mdep *pmc_xscale_initialize(void);
+void		pmc_xscale_finalize(struct pmc_mdep *_md);
+#endif /* _KERNEL */
 
 #endif /* !_MACHINE_PMC_MDEP_H_ */

Modified: head/sys/arm/xscale/ixp425/files.ixp425
==============================================================================
--- head/sys/arm/xscale/ixp425/files.ixp425	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/sys/arm/xscale/ixp425/files.ixp425	Wed Dec 23 23:16:54 2009	(r200928)
@@ -16,6 +16,7 @@ arm/xscale/ixp425/uart_bus_ixp425.c	opti
 arm/xscale/ixp425/ixp425_a4x_space.c	optional	uart
 arm/xscale/ixp425/ixp425_a4x_io.S	optional	uart
 dev/cfi/cfi_bus_ixp4xx.c		optional	cfi
+dev/hwpmc/hwpmc_xscale.c		optional	hwpmc
 dev/uart/uart_dev_ns8250.c		optional	uart
 #
 # NPE-based Ethernet support (requires qmgr also).

Modified: head/sys/dev/hwpmc/hwpmc_arm.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_arm.c	Wed Dec 23 22:59:03 2009	(r200927)
+++ head/sys/dev/hwpmc/hwpmc_arm.c	Wed Dec 23 23:16:54 2009	(r200928)
@@ -30,19 +30,28 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
+#include 
 
 struct pmc_mdep *
 pmc_md_initialize()
 {
-	return NULL;
+	if (cpu_class == CPU_CLASS_XSCALE)
+		return pmc_xscale_initialize();
+	else
+		return NULL;
 }
 
 void
 pmc_md_finalize(struct pmc_mdep *md)
 {
-	(void) md;
+	if (cpu_class == CPU_CLASS_XSCALE)
+		pmc_xscale_finalize(md);
+	else
+		KASSERT(0, ("[arm,%d] Unknown CPU Class 0x%x", __LINE__,
+		    cpu_class));
 }
 
 int

Added: head/sys/dev/hwpmc/hwpmc_xscale.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/hwpmc/hwpmc_xscale.c	Wed Dec 23 23:16:54 2009	(r200928)
@@ -0,0 +1,678 @@
+/*-
+ * Copyright (c) 2009 Rui Paulo 
+ * 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 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 AUTHOR 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+/*
+ * Support for the Intel XScale network processors
+ *
+ * XScale processors have up to now three generations.
+ *
+ * The first generation has two PMC; the event selection, interrupt config
+ * and overflow flag setup are done by writing to the PMNC register.
+ * It also has less monitoring events than the latter generations.
+ *
+ * The second and third generatiosn have four PMCs, one register for the event
+ * selection, one register for the interrupt config and one register for
+ * the overflow flags.
+ */
+static int xscale_npmcs;
+static int xscale_gen;	/* XScale Core generation */
+
+struct xscale_event_code_map {
+	enum pmc_event	pe_ev;
+	uint8_t		pe_code;
+};
+
+const struct xscale_event_code_map xscale_event_codes[] = {
+	/* 1st and 2nd Generation XScale cores */
+	{ PMC_EV_XSCALE_IC_FETCH,		0x00 },
+	{ PMC_EV_XSCALE_IC_MISS,		0x01 },
+	{ PMC_EV_XSCALE_DATA_DEPENDENCY_STALLED,0x02 },
+	{ PMC_EV_XSCALE_ITLB_MISS,		0x03 },
+	{ PMC_EV_XSCALE_DTLB_MISS,		0x04 },
+	{ PMC_EV_XSCALE_BRANCH_RETIRED,		0x05 },
+	{ PMC_EV_XSCALE_BRANCH_MISPRED,		0x06 },
+	{ PMC_EV_XSCALE_INSTR_RETIRED,		0x07 },
+	{ PMC_EV_XSCALE_DC_FULL_CYCLE,		0x08 },
+	{ PMC_EV_XSCALE_DC_FULL_CONTIG, 	0x09 },
+	{ PMC_EV_XSCALE_DC_ACCESS,		0x0a },
+	{ PMC_EV_XSCALE_DC_MISS,		0x0b },
+	{ PMC_EV_XSCALE_DC_WRITEBACK,		0x0c },
+	{ PMC_EV_XSCALE_PC_CHANGE,		0x0d },
+	/* 3rd Generation XScale cores */
+	{ PMC_EV_XSCALE_BRANCH_RETIRED_ALL,	0x0e },
+	{ PMC_EV_XSCALE_INSTR_CYCLE,		0x0f },
+	{ PMC_EV_XSCALE_CP_STALL,		0x17 },
+	{ PMC_EV_XSCALE_PC_CHANGE_ALL,		0x18 },
+	{ PMC_EV_XSCALE_PIPELINE_FLUSH,		0x19 },
+	{ PMC_EV_XSCALE_BACKEND_STALL,		0x1a },
+	{ PMC_EV_XSCALE_MULTIPLIER_USE,		0x1b },
+	{ PMC_EV_XSCALE_MULTIPLIER_STALLED,	0x1c },
+	{ PMC_EV_XSCALE_DATA_CACHE_STALLED,	0x1e },
+	{ PMC_EV_XSCALE_L2_CACHE_REQ,		0x20 },
+	{ PMC_EV_XSCALE_L2_CACHE_MISS,		0x23 },
+	{ PMC_EV_XSCALE_ADDRESS_BUS_TRANS,	0x40 },
+	{ PMC_EV_XSCALE_SELF_ADDRESS_BUS_TRANS,	0x41 },
+	{ PMC_EV_XSCALE_DATA_BUS_TRANS,		0x48 },
+};
+
+const int xscale_event_codes_size =
+	sizeof(xscale_event_codes) / sizeof(xscale_event_codes[0]);
+
+/*
+ * Per-processor information.
+ */
+struct xscale_cpu {
+	struct pmc_hw   *pc_xscalepmcs;
+};
+
+static struct xscale_cpu **xscale_pcpu;
+
+/*
+ * Performance Monitor Control Register
+ */
+static __inline uint32_t
+xscale_pmnc_read(void)
+{
+	uint32_t reg;
+
+	__asm __volatile("mrc p14, 0, %0, c0, c1, 0" : "=r" (reg));
+
+	return (reg);
+}
+
+static __inline void
+xscale_pmnc_write(uint32_t reg)
+{
+	__asm __volatile("mcr p14, 0, %0, c0, c1, 0" : : "r" (reg));
+}
+
+/*
+ * Clock Counter Register
+ */
+static __inline uint32_t
+xscale_ccnt_read(void)
+{
+	uint32_t reg;
+
+	__asm __volatile("mrc p14, 0, %0, c1, c1, 0" : "=r" (reg));
+	
+	return (reg);
+}
+
+static __inline void
+xscale_ccnt_write(uint32_t reg)
+{
+	__asm __volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (reg));
+}
+
+/*
+ * Interrupt Enable Register
+ */
+static __inline uint32_t
+xscale_inten_read(void)
+{
+	uint32_t reg;
+
+	__asm __volatile("mrc p14, 0, %0, c4, c1, 0" : "=r" (reg));
+
+	return (reg);
+}
+
+static __inline void
+xscale_inten_write(uint32_t reg)
+{
+	__asm __volatile("mcr p14, 0, %0, c4, c1, 0" : : "r" (reg));
+}
+
+/*
+ * Overflow Flag Register
+ */
+static __inline uint32_t
+xscale_flag_read(void)
+{
+	uint32_t reg;
+
+	__asm __volatile("mrc p14, 0, %0, c5, c1, 0" : "=r" (reg));
+
+	return (reg);
+}
+
+static __inline void
+xscale_flag_write(uint32_t reg)
+{
+	__asm __volatile("mcr p14, 0, %0, c5, c1, 0" : : "r" (reg));
+}
+
+/*
+ * Event Selection Register
+ */
+static __inline uint32_t
+xscale_evtsel_read(void)
+{
+	uint32_t reg;
+
+	__asm __volatile("mrc p14, 0, %0, c8, c1, 0" : "=r" (reg));
+
+	return (reg);
+}
+
+static __inline void
+xscale_evtsel_write(uint32_t reg)
+{
+	__asm __volatile("mcr p14, 0, %0, c8, c1, 0" : : "r" (reg));
+}
+
+/*
+ * Performance Count Register N
+ */
+static uint32_t
+xscale_pmcn_read(unsigned int pmc)
+{
+	uint32_t reg = 0;
+
+	KASSERT(pmc < 4, ("[xscale,%d] illegal PMC number %d", __LINE__, pmc));
+
+	switch (pmc) {
+	case 0:
+		__asm __volatile("mrc p14, 0, %0, c0, c2, 0" : "=r" (reg));
+		break;
+	case 1:
+		__asm __volatile("mrc p14, 0, %0, c1, c2, 0" : "=r" (reg));
+		break;
+	case 2:
+		__asm __volatile("mrc p14, 0, %0, c2, c2, 0" : "=r" (reg));
+		break;
+	case 3:
+		__asm __volatile("mrc p14, 0, %0, c3, c2, 0" : "=r" (reg));
+		break;
+	}
+
+	return (reg);
+}
+
+static uint32_t
+xscale_pmcn_write(unsigned int pmc, uint32_t reg)
+{
+
+	KASSERT(pmc < 4, ("[xscale,%d] illegal PMC number %d", __LINE__, pmc));
+
+	switch (pmc) {
+	case 0:
+		__asm __volatile("mcr p14, 0, %0, c0, c2, 0" : : "r" (reg));
+		break;
+	case 1:
+		__asm __volatile("mcr p14, 0, %0, c1, c2, 0" : : "r" (reg));
+		break;
+	case 2:
+		__asm __volatile("mcr p14, 0, %0, c2, c2, 0" : : "r" (reg));
+		break;
+	case 3:
+		__asm __volatile("mcr p14, 0, %0, c3, c2, 0" : : "r" (reg));
+		break;
+	}
+
+	return (reg);
+}
+
+static int
+xscale_allocate_pmc(int cpu, int ri, struct pmc *pm,
+  const struct pmc_op_pmcallocate *a)
+{
+	enum pmc_event pe;
+	uint32_t caps, config;
+	int i;
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] illegal row index %d", __LINE__, ri));
+
+	caps = a->pm_caps;
+	if (a->pm_class != PMC_CLASS_XSCALE)
+		return (EINVAL);
+	pe = a->pm_ev;
+	for (i = 0; i < xscale_event_codes_size; i++) {
+		if (xscale_event_codes[i].pe_ev == pe) {
+			config = xscale_event_codes[i].pe_code;
+			break;
+		}
+	}
+	if (i == xscale_event_codes_size)
+		return EINVAL;
+	/* Generation 1 has fewer events */
+	if (xscale_gen == 1 && i > PMC_EV_XSCALE_PC_CHANGE)
+		return EINVAL;
+	pm->pm_md.pm_xscale.pm_xscale_evsel = config;
+
+	PMCDBG(MDP,ALL,2,"xscale-allocate ri=%d -> config=0x%x", ri, config);
+
+	return 0;
+}
+
+
+static int
+xscale_read_pmc(int cpu, int ri, pmc_value_t *v)
+{
+	struct pmc *pm;
+	pmc_value_t tmp;
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] illegal row index %d", __LINE__, ri));
+
+	pm  = xscale_pcpu[cpu]->pc_xscalepmcs[ri].phw_pmc;
+	tmp = xscale_pmcn_read(ri);
+	PMCDBG(MDP,REA,2,"xscale-read id=%d -> %jd", ri, tmp);
+	if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
+		*v = XSCALE_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp);
+	else
+		*v = tmp;
+
+	return 0;
+}
+
+static int
+xscale_write_pmc(int cpu, int ri, pmc_value_t v)
+{
+	struct pmc *pm;
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] illegal row-index %d", __LINE__, ri));
+
+	pm  = xscale_pcpu[cpu]->pc_xscalepmcs[ri].phw_pmc;
+
+	if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
+		v = XSCALE_RELOAD_COUNT_TO_PERFCTR_VALUE(v);
+	
+	PMCDBG(MDP,WRI,1,"xscale-write cpu=%d ri=%d v=%jx", cpu, ri, v);
+
+	xscale_pmcn_write(ri, v);
+
+	return 0;
+}
+
+static int
+xscale_config_pmc(int cpu, int ri, struct pmc *pm)
+{
+	struct pmc_hw *phw;
+
+	PMCDBG(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm);
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] illegal row-index %d", __LINE__, ri));
+
+	phw = &xscale_pcpu[cpu]->pc_xscalepmcs[ri];
+
+	KASSERT(pm == NULL || phw->phw_pmc == NULL,
+	    ("[xscale,%d] pm=%p phw->pm=%p hwpmc not unconfigured",
+	    __LINE__, pm, phw->phw_pmc));
+
+	phw->phw_pmc = pm;
+
+	return 0;
+}
+
+static int
+xscale_start_pmc(int cpu, int ri)
+{
+	uint32_t pmnc, config, evtsel;
+        struct pmc *pm;
+        struct pmc_hw *phw;
+
+	phw    = &xscale_pcpu[cpu]->pc_xscalepmcs[ri];
+	pm     = phw->phw_pmc;
+	config = pm->pm_md.pm_xscale.pm_xscale_evsel;
+
+	/*
+	 * Configure the event selection.
+	 *
+	 * On the XScale 2nd Generation there's no EVTSEL register.
+	 */
+	if (xscale_npmcs == 2) {
+		pmnc = xscale_pmnc_read();
+		switch (ri) {
+		case 0:
+			pmnc &= ~XSCALE_PMNC_EVT0_MASK;
+			pmnc |= (config << 12) & XSCALE_PMNC_EVT0_MASK;
+			break;
+		case 1:
+			pmnc &= ~XSCALE_PMNC_EVT1_MASK;
+			pmnc |= (config << 20) & XSCALE_PMNC_EVT1_MASK;
+			break;
+		default:
+			/* XXX */
+			break;
+		}
+		xscale_pmnc_write(pmnc);
+	} else {
+		evtsel = xscale_evtsel_read();
+		switch (ri) {
+		case 0:
+			evtsel &= ~XSCALE_EVTSEL_EVT0_MASK;
+			evtsel |= config & XSCALE_EVTSEL_EVT0_MASK;
+			break;
+		case 1:
+			evtsel &= ~XSCALE_EVTSEL_EVT1_MASK;
+			evtsel |= (config << 8) & XSCALE_EVTSEL_EVT1_MASK;
+			break;
+		case 2:
+			evtsel &= ~XSCALE_EVTSEL_EVT2_MASK;
+			evtsel |= (config << 16) & XSCALE_EVTSEL_EVT2_MASK;
+			break;
+		case 3:
+			evtsel &= ~XSCALE_EVTSEL_EVT3_MASK;
+			evtsel |= (config << 24) & XSCALE_EVTSEL_EVT3_MASK;
+			break;
+		default:
+			/* XXX */
+			break;
+		}
+		xscale_evtsel_write(evtsel);
+	}
+	/*
+	 * Enable the PMC.
+	 *
+	 * Note that XScale provides only one bit to enable/disable _all_
+	 * performance monitoring units.
+	 */
+	pmnc = xscale_pmnc_read();
+	pmnc |= XSCALE_PMNC_ENABLE;
+	xscale_pmnc_write(pmnc);
+
+	return 0;
+}
+
+static int
+xscale_stop_pmc(int cpu, int ri)
+{
+	uint32_t pmnc, evtsel;
+        struct pmc *pm;
+        struct pmc_hw *phw;
+
+	phw    = &xscale_pcpu[cpu]->pc_xscalepmcs[ri];
+	pm     = phw->phw_pmc;
+
+	/*
+	 * Disable the PMCs.
+	 *
+	 * Note that XScale provides only one bit to enable/disable _all_
+	 * performance monitoring units.
+	 */
+	pmnc = xscale_pmnc_read();
+	pmnc &= ~XSCALE_PMNC_ENABLE;
+	xscale_pmnc_write(pmnc);
+	/*
+	 * A value of 0xff makes the corresponding PMU go into
+	 * power saving mode.
+	 */
+	if (xscale_npmcs == 2) {
+		pmnc = xscale_pmnc_read();
+		switch (ri) {
+		case 0:
+			pmnc |= XSCALE_PMNC_EVT0_MASK;
+			break;
+		case 1:
+			pmnc |= XSCALE_PMNC_EVT1_MASK;
+			break;
+		default:
+			/* XXX */
+			break;
+		}
+		xscale_pmnc_write(pmnc);
+	} else {
+		evtsel = xscale_evtsel_read();
+		switch (ri) {
+		case 0:
+			evtsel |= XSCALE_EVTSEL_EVT0_MASK;
+			break;
+		case 1:
+			evtsel |= XSCALE_EVTSEL_EVT1_MASK;
+			break;
+		case 2:
+			evtsel |= XSCALE_EVTSEL_EVT2_MASK;
+			break;
+		case 3:
+			evtsel |= XSCALE_EVTSEL_EVT3_MASK;
+			break;
+		default:
+			/* XXX */
+			break;
+		}
+		xscale_evtsel_write(evtsel);
+	}
+
+	return 0;
+}
+
+static int
+xscale_release_pmc(int cpu, int ri, struct pmc *pmc)
+{
+	struct pmc_hw *phw;
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] illegal CPU value %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] illegal row-index %d", __LINE__, ri));
+
+	phw = &xscale_pcpu[cpu]->pc_xscalepmcs[ri];
+	KASSERT(phw->phw_pmc == NULL,
+	    ("[xscale,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc));
+
+	return 0;
+}
+
+static int
+xscale_intr(int cpu, struct trapframe *tf)
+{
+	printf("intr\n");
+	return 0;
+}
+
+static int
+xscale_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc)
+{
+	int error;
+	struct pmc_hw *phw;
+	char xscale_name[PMC_NAME_MAX];
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d], illegal CPU %d", __LINE__, cpu));
+	KASSERT(ri >= 0 && ri < xscale_npmcs,
+	    ("[xscale,%d] row-index %d out of range", __LINE__, ri));
+
+	phw = &xscale_pcpu[cpu]->pc_xscalepmcs[ri];
+	snprintf(xscale_name, sizeof(xscale_name), "XSCALE-%d", ri);
+	if ((error = copystr(xscale_name, pi->pm_name, PMC_NAME_MAX,
+	    NULL)) != 0)
+		return error;
+	pi->pm_class = PMC_CLASS_XSCALE;
+	if (phw->phw_state & PMC_PHW_FLAG_IS_ENABLED) {
+		pi->pm_enabled = TRUE;
+		*ppmc          = phw->phw_pmc;
+	} else {
+		pi->pm_enabled = FALSE;
+		*ppmc	       = NULL;
+	}
+
+	return (0);
+}
+
+static int
+xscale_get_config(int cpu, int ri, struct pmc **ppm)
+{
+	*ppm = xscale_pcpu[cpu]->pc_xscalepmcs[ri].phw_pmc;
+
+	return 0;
+}
+
+/*
+ * XXX don't know what we should do here.
+ */
+static int
+xscale_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
+{
+	return 0;
+}
+
+static int
+xscale_switch_out(struct pmc_cpu *pc, struct pmc_process *pp)
+{
+	return 0;
+}
+
+static int
+xscale_pcpu_init(struct pmc_mdep *md, int cpu)
+{
+	int first_ri, i;
+	struct pmc_cpu *pc;
+	struct xscale_cpu *pac;
+	struct pmc_hw  *phw;
+
+	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+	    ("[xscale,%d] wrong cpu number %d", __LINE__, cpu));
+	PMCDBG(MDP,INI,1,"xscale-init cpu=%d", cpu);
+
+	xscale_pcpu[cpu] = pac = malloc(sizeof(struct xscale_cpu), M_PMC,
+	    M_WAITOK|M_ZERO);
+	pac->pc_xscalepmcs = malloc(sizeof(struct pmc_hw) * xscale_npmcs,
+	    M_PMC, M_WAITOK|M_ZERO);
+	pc = pmc_pcpu[cpu];
+	first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_XSCALE].pcd_ri;
+	KASSERT(pc != NULL, ("[xscale,%d] NULL per-cpu pointer", __LINE__));
+
+	for (i = 0, phw = pac->pc_xscalepmcs; i < xscale_npmcs; i++, phw++) {
+		phw->phw_state    = PMC_PHW_FLAG_IS_ENABLED |
+		    PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i);
+		phw->phw_pmc      = NULL;
+		pc->pc_hwpmcs[i + first_ri] = phw;
+	}
+
+	/*
+	 * Disable and put the PMUs into power save mode.
+	 */
+	if (xscale_npmcs == 2) {
+		xscale_pmnc_write(XSCALE_PMNC_EVT1_MASK |
+		    XSCALE_PMNC_EVT0_MASK);
+	} else {
+		xscale_evtsel_write(XSCALE_EVTSEL_EVT3_MASK |
+		    XSCALE_EVTSEL_EVT2_MASK | XSCALE_EVTSEL_EVT1_MASK |
+		    XSCALE_EVTSEL_EVT0_MASK);
+	}
+
+	return 0;
+}
+
+static int
+xscale_pcpu_fini(struct pmc_mdep *md, int cpu)
+{
+	return 0;
+}
+
+struct pmc_mdep *
+pmc_xscale_initialize()
+{
+	struct pmc_mdep *pmc_mdep;
+	struct pmc_classdep *pcd;
+	uint32_t idreg;
+
+	/* Get the Core Generation from CP15 */
+	__asm __volatile("mrc p15, 0, %0, c0, c0, 0" : "=r" (idreg));
+	xscale_gen = (idreg >> 13) & 0x3;
+	switch (xscale_gen) {
+	case 1:
+		xscale_npmcs = 2;
+		break;
+	case 2:
+	case 3:
+		xscale_npmcs = 4;
+		break;
+	default:
+		printf("%s: unknown XScale core generation\n", __func__);
+		return (NULL);
+	}
+	PMCDBG(MDP,INI,1,"xscale-init npmcs=%d", xscale_npmcs);
+	
+	/*
+	 * Allocate space for pointers to PMC HW descriptors and for
+	 * the MDEP structure used by MI code.
+	 */
+	xscale_pcpu = malloc(sizeof(struct xscale_cpu *) * pmc_cpu_max(), M_PMC,
+            M_WAITOK|M_ZERO);
+
+	/* Just one class */
+	pmc_mdep = malloc(sizeof(struct pmc_mdep) + sizeof(struct pmc_classdep),
+	    M_PMC, M_WAITOK|M_ZERO);
+
+	pmc_mdep->pmd_cputype = PMC_CPU_INTEL_XSCALE;
+	pmc_mdep->pmd_nclass  = 1;
+
+	pcd = &pmc_mdep->pmd_classdep[PMC_MDEP_CLASS_INDEX_XSCALE];
+	pcd->pcd_caps  = XSCALE_PMC_CAPS;
+	pcd->pcd_class = PMC_CLASS_XSCALE;
+	pcd->pcd_num   = xscale_npmcs;
+	pcd->pcd_ri    = pmc_mdep->pmd_npmc;
+	pcd->pcd_width = 32;
+
+	pcd->pcd_allocate_pmc   = xscale_allocate_pmc;
+	pcd->pcd_config_pmc     = xscale_config_pmc;
+	pcd->pcd_pcpu_fini      = xscale_pcpu_fini;
+	pcd->pcd_pcpu_init      = xscale_pcpu_init;
+	pcd->pcd_describe       = xscale_describe;
+	pcd->pcd_get_config	= xscale_get_config;
+	pcd->pcd_read_pmc       = xscale_read_pmc;
+	pcd->pcd_release_pmc    = xscale_release_pmc;
+	pcd->pcd_start_pmc      = xscale_start_pmc;
+	pcd->pcd_stop_pmc       = xscale_stop_pmc;
+	pcd->pcd_write_pmc      = xscale_write_pmc;
+
+	pmc_mdep->pmd_intr       = xscale_intr;
+	pmc_mdep->pmd_switch_in  = xscale_switch_in;
+	pmc_mdep->pmd_switch_out = xscale_switch_out;
+	
+	pmc_mdep->pmd_npmc   += xscale_npmcs;
+
+	return (pmc_mdep);
+}
+
+void
+pmc_xscale_finalize(struct pmc_mdep *md)
+{
+}

Added: head/sys/dev/hwpmc/hwpmc_xscale.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/hwpmc/hwpmc_xscale.h	Wed Dec 23 23:16:54 2009	(r200928)
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 2009 Rui Paulo 
+ * 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 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Wed Dec 23 23:53:30 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D5EE71065679;
	Wed, 23 Dec 2009 23:53:30 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C4B4D8FC17;
	Wed, 23 Dec 2009 23:53:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBNNrUHf013054;
	Wed, 23 Dec 2009 23:53:30 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBNNrU5w013052;
	Wed, 23 Dec 2009 23:53:30 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <200912232353.nBNNrU5w013052@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 23 Dec 2009 23:53:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200929 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 23 Dec 2009 23:53:30 -0000

Author: rpaulo
Date: Wed Dec 23 23:53:30 2009
New Revision: 200929
URL: http://svn.freebsd.org/changeset/base/200929

Log:
  Add hwpmc_arm.c

Modified:
  head/sys/conf/files.arm

Modified: head/sys/conf/files.arm
==============================================================================
--- head/sys/conf/files.arm	Wed Dec 23 23:16:54 2009	(r200928)
+++ head/sys/conf/files.arm	Wed Dec 23 23:53:30 2009	(r200929)
@@ -47,6 +47,7 @@ arm/arm/vm_machdep.c		standard
 arm/fpe-arm/armfpe_glue.S	optional	armfpe
 arm/fpe-arm/armfpe_init.c	optional	armfpe
 arm/fpe-arm/armfpe.S		optional	armfpe
+dev/hwpmc/hwpmc_arm.c		optional	hwpmc
 geom/geom_bsd.c			optional	geom_bsd
 geom/geom_bsd_enc.c		optional	geom_bsd
 geom/geom_mbr.c			optional	geom_mbr

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 00:43:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77A0D1065670;
	Thu, 24 Dec 2009 00:43:45 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6404C8FC1A;
	Thu, 24 Dec 2009 00:43:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBO0hjSn014091;
	Thu, 24 Dec 2009 00:43:45 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBO0hjCd014082;
	Thu, 24 Dec 2009 00:43:45 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200912240043.nBO0hjCd014082@svn.freebsd.org>
From: Xin LI 
Date: Thu, 24 Dec 2009 00:43:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200930 - in head: contrib/pf/man contrib/pf/pfctl
	sys/contrib/pf/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 00:43:45 -0000

Author: delphij
Date: Thu Dec 24 00:43:44 2009
New Revision: 200930
URL: http://svn.freebsd.org/changeset/base/200930

Log:
  Adapt OpenBSD pf's "sloopy" TCP state machine which is useful for Direct
  Server Return mode, where not all packets would be visible to the load
  balancer or gateway.
  
  This commit should be reverted when we merge future pf versions.  The
  benefit it would provide is that this version does not break any existing
  public interface and thus won't be a problem if we want to MFC it to
  earlier FreeBSD releases.
  
  Discussed with:	mlaier
  Obtained from:	OpenBSD
  Sponsored by:	iXsystems, Inc.
  MFC after:	1 month

Modified:
  head/contrib/pf/man/pf.conf.5
  head/contrib/pf/pfctl/parse.y
  head/contrib/pf/pfctl/pf_print_state.c
  head/contrib/pf/pfctl/pfctl_parser.c
  head/sys/contrib/pf/net/if_pfsync.c
  head/sys/contrib/pf/net/if_pfsync.h
  head/sys/contrib/pf/net/pf.c
  head/sys/contrib/pf/net/pfvar.h

Modified: head/contrib/pf/man/pf.conf.5
==============================================================================
--- head/contrib/pf/man/pf.conf.5	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/contrib/pf/man/pf.conf.5	Thu Dec 24 00:43:44 2009	(r200930)
@@ -28,7 +28,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 30, 2006
+.Dd June 10, 2008
 .Dt PF.CONF 5
 .Os
 .Sh NAME
@@ -2059,6 +2059,13 @@ Changes the timeout values used for stat
 For a list of all valid timeout names, see
 .Sx OPTIONS
 above.
+.It Ar sloppy
+Uses a sloppy TCP connection tracker that does not check sequence
+numbers at all, which makes insertion and ICMP teardown attacks way
+easier.
+This is intended to be used in situations where one does not see all
+packets of a connection, i.e. in asymmetric routing situations.
+Cannot be used with modulate or synproxy state.
 .El
 .Pp
 Multiple options can be specified, separated by commas:
@@ -2923,7 +2930,7 @@ tos            = "tos" ( "lowdelay" | "t
                  [ "0x" ] number )
 
 state-opts     = state-opt [ [ "," ] state-opts ]
-state-opt      = ( "max" number | "no-sync" | timeout |
+state-opt      = ( "max" number | "no-sync" | timeout | sloppy |
                  "source-track" [ ( "rule" | "global" ) ] |
                  "max-src-nodes" number | "max-src-states" number |
                  "max-src-conn" number |

Modified: head/contrib/pf/pfctl/parse.y
==============================================================================
--- head/contrib/pf/pfctl/parse.y	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/contrib/pf/pfctl/parse.y	Thu Dec 24 00:43:44 2009	(r200930)
@@ -128,7 +128,7 @@ enum	{ PF_STATE_OPT_MAX, PF_STATE_OPT_NO
 	    PF_STATE_OPT_MAX_SRC_STATES, PF_STATE_OPT_MAX_SRC_CONN,
 	    PF_STATE_OPT_MAX_SRC_CONN_RATE, PF_STATE_OPT_MAX_SRC_NODES,
 	    PF_STATE_OPT_OVERLOAD, PF_STATE_OPT_STATELOCK,
-	    PF_STATE_OPT_TIMEOUT };
+	    PF_STATE_OPT_TIMEOUT, PF_STATE_OPT_SLOPPY };
 
 enum	{ PF_SRCTRACK_NONE, PF_SRCTRACK, PF_SRCTRACK_GLOBAL, PF_SRCTRACK_RULE };
 
@@ -423,7 +423,7 @@ typedef struct {
 %token	QUEUE PRIORITY QLIMIT RTABLE
 %token	LOAD RULESET_OPTIMIZATION
 %token	STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE
-%token	MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH
+%token	MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY
 %token	TAGGED TAG IFBOUND FLOATING STATEPOLICY ROUTE
 %token			STRING
 %token				PORTBINARY
@@ -1891,6 +1891,14 @@ pfrule		: action dir logquick interface 
 					statelock = 1;
 					r.rule_flag |= o->data.statelock;
 					break;
+				case PF_STATE_OPT_SLOPPY:
+					if (r.rule_flag & PFRULE_STATESLOPPY) {
+						yyerror("state sloppy option: "
+						    "multiple definitions");
+						YYERROR;
+					}
+					r.rule_flag |= PFRULE_STATESLOPPY;
+					break;
 				case PF_STATE_OPT_TIMEOUT:
 					if (o->data.timeout.number ==
 					    PFTM_ADAPTIVE_START ||
@@ -3216,6 +3224,14 @@ state_opt_item	: MAXIMUM number		{
 			$$->next = NULL;
 			$$->tail = $$;
 		}
+		| SLOPPY {
+			$$ = calloc(1, sizeof(struct node_state_opt));
+			if ($$ == NULL)
+				err(1, "state_opt_item: calloc");
+			$$->type = PF_STATE_OPT_SLOPPY;
+			$$->next = NULL;
+			$$->tail = $$;
+		}
 		| STRING number			{
 			int	i;
 
@@ -4101,6 +4117,13 @@ filter_consistent(struct pf_rule *r, int
 		yyerror("keep state on block rules doesn't make sense");
 		problems++;
 	}
+	if (r->rule_flag & PFRULE_STATESLOPPY &&
+	    (r->keep_state == PF_STATE_MODULATE ||
+	    r->keep_state == PF_STATE_SYNPROXY)) {
+		yyerror("sloppy state matching cannot be used with "
+		    "synproxy state or modulate state");
+		problems++;
+	}
 	return (-problems);
 }
 
@@ -4969,6 +4992,7 @@ lookup(char *s)
 		{ "scrub",		SCRUB},
 		{ "set",		SET},
 		{ "skip",		SKIP},
+		{ "sloppy",		SLOPPY},
 		{ "source-hash",	SOURCEHASH},
 		{ "source-track",	SOURCETRACK},
 		{ "state",		STATE},

Modified: head/contrib/pf/pfctl/pf_print_state.c
==============================================================================
--- head/contrib/pf/pfctl/pf_print_state.c	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/contrib/pf/pfctl/pf_print_state.c	Thu Dec 24 00:43:44 2009	(r200930)
@@ -294,6 +294,8 @@ print_state(struct pf_state *s, int opts
 			printf(", anchor %u", s->anchor.nr);
 		if (s->rule.nr != -1)
 			printf(", rule %u", s->rule.nr);
+		if (s->state_flags & PFSTATE_SLOPPY)
+			printf(", sloppy");
 		if (s->src_node != NULL)
 			printf(", source-track");
 		if (s->nat_src_node != NULL)

Modified: head/contrib/pf/pfctl/pfctl_parser.c
==============================================================================
--- head/contrib/pf/pfctl/pfctl_parser.c	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/contrib/pf/pfctl/pfctl_parser.c	Thu Dec 24 00:43:44 2009	(r200930)
@@ -873,6 +873,8 @@ print_rule(struct pf_rule *r, const char
 		opts = 1;
 	if (r->rule_flag & PFRULE_IFBOUND)
 		opts = 1;
+	if (r->rule_flag & PFRULE_STATESLOPPY)
+		opts = 1;
 	for (i = 0; !opts && i < PFTM_MAX; ++i)
 		if (r->timeout[i])
 			opts = 1;
@@ -939,6 +941,12 @@ print_rule(struct pf_rule *r, const char
 			printf("if-bound");
 			opts = 0;
 		}
+		if (r->rule_flag & PFRULE_STATESLOPPY) {
+			if (!opts)
+				printf(", ");
+			printf("sloppy");
+			opts = 0;
+		}
 		for (i = 0; i < PFTM_MAX; ++i)
 			if (r->timeout[i]) {
 				int j;

Modified: head/sys/contrib/pf/net/if_pfsync.c
==============================================================================
--- head/sys/contrib/pf/net/if_pfsync.c	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/sys/contrib/pf/net/if_pfsync.c	Thu Dec 24 00:43:44 2009	(r200930)
@@ -465,7 +465,7 @@ pfsync_insert_net_state(struct pfsync_st
 	st->direction = sp->direction;
 	st->log = sp->log;
 	st->timeout = sp->timeout;
-	st->allow_opts = sp->allow_opts;
+	st->state_flags = sp->state_flags;
 
 	bcopy(sp->id, &st->id, sizeof(st->id));
 	st->creatorid = sp->creatorid;
@@ -1578,7 +1578,7 @@ pfsync_pack_state(u_int8_t action, struc
 		sp->proto = st->proto;
 		sp->direction = st->direction;
 		sp->log = st->log;
-		sp->allow_opts = st->allow_opts;
+		sp->state_flags = st->state_flags;
 		sp->timeout = st->timeout;
 
 		if (flags & PFSYNC_FLAG_STALE)

Modified: head/sys/contrib/pf/net/if_pfsync.h
==============================================================================
--- head/sys/contrib/pf/net/if_pfsync.h	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/sys/contrib/pf/net/if_pfsync.h	Thu Dec 24 00:43:44 2009	(r200930)
@@ -80,7 +80,7 @@ struct pfsync_state {
 	u_int8_t	 proto;
 	u_int8_t	 direction;
 	u_int8_t	 log;
-	u_int8_t	 allow_opts;
+	u_int8_t	 state_flags;
 	u_int8_t	 timeout;
 	u_int8_t	 sync_flags;
 	u_int8_t	 updates;

Modified: head/sys/contrib/pf/net/pf.c
==============================================================================
--- head/sys/contrib/pf/net/pf.c	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/sys/contrib/pf/net/pf.c	Thu Dec 24 00:43:44 2009	(r200930)
@@ -253,6 +253,13 @@ int			 pf_test_fragment(struct pf_rule *
 			    struct pfi_kif *, struct mbuf *, void *,
 			    struct pf_pdesc *, struct pf_rule **,
 			    struct pf_ruleset **);
+int			 pf_tcp_track_full(struct pf_state_peer *,
+			    struct pf_state_peer *, struct pf_state **,
+			    struct pfi_kif *, struct mbuf *, int,
+			    struct pf_pdesc *, u_short *, int *);
+int			 pf_tcp_track_sloppy(struct pf_state_peer *,
+			    struct pf_state_peer *, struct pf_state **,
+			    struct pf_pdesc *, u_short *);
 int			 pf_test_state_tcp(struct pf_state **, int,
 			    struct pfi_kif *, struct mbuf *, int,
 			    void *, struct pf_pdesc *, u_short *);
@@ -3528,7 +3535,10 @@ cleanup:
 		s->nat_rule.ptr = nr;
 		s->anchor.ptr = a;
 		STATE_INC_COUNTERS(s);
-		s->allow_opts = r->allow_opts;
+		if (r->allow_opts)
+			s->state_flags |= PFSTATE_ALLOWOPTS;
+		if (r->rule_flag & PFRULE_STATESLOPPY)
+			s->state_flags |= PFSTATE_SLOPPY;
 		s->log = r->log & PF_LOG_ALL;
 		if (nr != NULL)
 			s->log |= nr->log & PF_LOG_ALL;
@@ -3925,7 +3935,10 @@ cleanup:
 		s->nat_rule.ptr = nr;
 		s->anchor.ptr = a;
 		STATE_INC_COUNTERS(s);
-		s->allow_opts = r->allow_opts;
+		if (r->allow_opts)
+			s->state_flags |= PFSTATE_ALLOWOPTS;
+ 		if (r->rule_flag & PFRULE_STATESLOPPY)
+			s->state_flags |= PFSTATE_SLOPPY;
 		s->log = r->log & PF_LOG_ALL;
 		if (nr != NULL)
 			s->log |= nr->log & PF_LOG_ALL;
@@ -4238,7 +4251,10 @@ cleanup:
 		s->nat_rule.ptr = nr;
 		s->anchor.ptr = a;
 		STATE_INC_COUNTERS(s);
-		s->allow_opts = r->allow_opts;
+		if (r->allow_opts)
+			s->state_flags |= PFSTATE_ALLOWOPTS;
+ 		if (r->rule_flag & PFRULE_STATESLOPPY)
+			s->state_flags |= PFSTATE_SLOPPY;
 		s->log = r->log & PF_LOG_ALL;
 		if (nr != NULL)
 			s->log |= nr->log & PF_LOG_ALL;
@@ -4525,7 +4541,10 @@ cleanup:
 		s->nat_rule.ptr = nr;
 		s->anchor.ptr = a;
 		STATE_INC_COUNTERS(s);
-		s->allow_opts = r->allow_opts;
+		if (r->allow_opts)
+			s->state_flags |= PFSTATE_ALLOWOPTS;
+ 		if (r->rule_flag & PFRULE_STATESLOPPY)
+			s->state_flags |= PFSTATE_SLOPPY;
 		s->log = r->log & PF_LOG_ALL;
 		if (nr != NULL)
 			s->log |= nr->log & PF_LOG_ALL;
@@ -4666,165 +4685,15 @@ pf_test_fragment(struct pf_rule **rm, in
 }
 
 int
-pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
-    struct mbuf *m, int off, void *h, struct pf_pdesc *pd,
-    u_short *reason)
-{
-	struct pf_state_cmp	 key;
-	struct tcphdr		*th = pd->hdr.tcp;
-	u_int16_t		 win = ntohs(th->th_win);
-	u_int32_t		 ack, end, seq, orig_seq;
-	u_int8_t		 sws, dws;
-	int			 ackskew;
-	int			 copyback = 0;
-	struct pf_state_peer	*src, *dst;
-
-	key.af = pd->af;
-	key.proto = IPPROTO_TCP;
-	if (direction == PF_IN)	{
-		PF_ACPY(&key.ext.addr, pd->src, key.af);
-		PF_ACPY(&key.gwy.addr, pd->dst, key.af);
-		key.ext.port = th->th_sport;
-		key.gwy.port = th->th_dport;
-	} else {
-		PF_ACPY(&key.lan.addr, pd->src, key.af);
-		PF_ACPY(&key.ext.addr, pd->dst, key.af);
-		key.lan.port = th->th_sport;
-		key.ext.port = th->th_dport;
-	}
-
-	STATE_LOOKUP();
-
-	if (direction == (*state)->direction) {
-		src = &(*state)->src;
-		dst = &(*state)->dst;
-	} else {
-		src = &(*state)->dst;
-		dst = &(*state)->src;
-	}
-
-	if ((*state)->src.state == PF_TCPS_PROXY_SRC) {
-		if (direction != (*state)->direction) {
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_SYNPROXY_DROP);
-		}
-		if (th->th_flags & TH_SYN) {
-			if (ntohl(th->th_seq) != (*state)->src.seqlo) {
-				REASON_SET(reason, PFRES_SYNPROXY);
-				return (PF_DROP);
-			}
-#ifdef __FreeBSD__
-			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
-#else
-			pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
-#endif
-			    pd->src, th->th_dport, th->th_sport,
-			    (*state)->src.seqhi, ntohl(th->th_seq) + 1,
-			    TH_SYN|TH_ACK, 0, (*state)->src.mss, 0, 1,
-			    0, NULL, NULL);
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_SYNPROXY_DROP);
-		} else if (!(th->th_flags & TH_ACK) ||
-		    (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
-		    (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_DROP);
-		} else if ((*state)->src_node != NULL &&
-		    pf_src_connlimit(state)) {
-			REASON_SET(reason, PFRES_SRCLIMIT);
-			return (PF_DROP);
-		} else
-			(*state)->src.state = PF_TCPS_PROXY_DST;
-	}
-	if ((*state)->src.state == PF_TCPS_PROXY_DST) {
-		struct pf_state_host *src, *dst;
-
-		if (direction == PF_OUT) {
-			src = &(*state)->gwy;
-			dst = &(*state)->ext;
-		} else {
-			src = &(*state)->ext;
-			dst = &(*state)->lan;
-		}
-		if (direction == (*state)->direction) {
-			if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) ||
-			    (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
-			    (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
-				REASON_SET(reason, PFRES_SYNPROXY);
-				return (PF_DROP);
-			}
-			(*state)->src.max_win = MAX(ntohs(th->th_win), 1);
-			if ((*state)->dst.seqhi == 1)
-				(*state)->dst.seqhi = htonl(arc4random());
-#ifdef __FreeBSD__
-			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
-			    &src->addr,
-#else
-			pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
-#endif
-			    &dst->addr, src->port, dst->port,
-			    (*state)->dst.seqhi, 0, TH_SYN, 0,
-			    (*state)->src.mss, 0, 0, (*state)->tag, NULL, NULL);
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_SYNPROXY_DROP);
-		} else if (((th->th_flags & (TH_SYN|TH_ACK)) !=
-		    (TH_SYN|TH_ACK)) ||
-		    (ntohl(th->th_ack) != (*state)->dst.seqhi + 1)) {
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_DROP);
-		} else {
-			(*state)->dst.max_win = MAX(ntohs(th->th_win), 1);
-			(*state)->dst.seqlo = ntohl(th->th_seq);
-#ifdef __FreeBSD__
-			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
-#else
-			pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
-#endif
-			    pd->src, th->th_dport, th->th_sport,
-			    ntohl(th->th_ack), ntohl(th->th_seq) + 1,
-			    TH_ACK, (*state)->src.max_win, 0, 0, 0,
-			    (*state)->tag, NULL, NULL);
-#ifdef __FreeBSD__
-			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
-			    &src->addr,
-#else
-			pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
-#endif
-			    &dst->addr, src->port, dst->port,
-			    (*state)->src.seqhi + 1, (*state)->src.seqlo + 1,
-			    TH_ACK, (*state)->dst.max_win, 0, 0, 1,
-			    0, NULL, NULL);
-			(*state)->src.seqdiff = (*state)->dst.seqhi -
-			    (*state)->src.seqlo;
-			(*state)->dst.seqdiff = (*state)->src.seqhi -
-			    (*state)->dst.seqlo;
-			(*state)->src.seqhi = (*state)->src.seqlo +
-			    (*state)->dst.max_win;
-			(*state)->dst.seqhi = (*state)->dst.seqlo +
-			    (*state)->src.max_win;
-			(*state)->src.wscale = (*state)->dst.wscale = 0;
-			(*state)->src.state = (*state)->dst.state =
-			    TCPS_ESTABLISHED;
-			REASON_SET(reason, PFRES_SYNPROXY);
-			return (PF_SYNPROXY_DROP);
-		}
-	}
-
-	if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) &&
-	    dst->state >= TCPS_FIN_WAIT_2 &&
-	    src->state >= TCPS_FIN_WAIT_2) {
-		if (pf_status.debug >= PF_DEBUG_MISC) {
-			printf("pf: state reuse ");
-			pf_print_state(*state);
-			pf_print_flags(th->th_flags);
-			printf("\n");
-		}
-		/* XXX make sure it's the same direction ?? */
-		(*state)->src.state = (*state)->dst.state = TCPS_CLOSED;
-		pf_unlink_state(*state);
-		*state = NULL;
-		return (PF_DROP);
-	}
+pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst,
+	struct pf_state **state, struct pfi_kif *kif, struct mbuf *m, int off,
+	struct pf_pdesc *pd, u_short *reason, int *copyback)
+{
+ 	struct tcphdr		*th = pd->hdr.tcp;
+ 	u_int16_t		 win = ntohs(th->th_win);
+ 	u_int32_t		 ack, end, seq, orig_seq;
+ 	u_int8_t		 sws, dws;
+ 	int			 ackskew;
 
 	if (src->wscale && dst->wscale && !(th->th_flags & TH_SYN)) {
 		sws = src->wscale & PF_WSCALE_MASK;
@@ -4863,7 +4732,7 @@ pf_test_state_tcp(struct pf_state **stat
 			pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
 			    src->seqdiff), 0);
 			pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
-			copyback = 1;
+			*copyback = 1;
 		} else {
 			ack = ntohl(th->th_ack);
 		}
@@ -4915,7 +4784,7 @@ pf_test_state_tcp(struct pf_state **stat
 			pf_change_a(&th->th_seq, &th->th_sum, htonl(seq +
 			    src->seqdiff), 0);
 			pf_change_a(&th->th_ack, &th->th_sum, htonl(ack), 0);
-			copyback = 1;
+			*copyback = 1;
 		}
 		end = seq + pd->p_len;
 		if (th->th_flags & TH_SYN)
@@ -4961,7 +4830,7 @@ pf_test_state_tcp(struct pf_state **stat
 	 */
 	if (dst->seqdiff && (th->th_off << 2) > sizeof(struct tcphdr)) {
 		if (pf_modulate_sack(m, off, pd, th, dst))
-			copyback = 1;
+			*copyback = 1;
 	}
 
 
@@ -4980,7 +4849,7 @@ pf_test_state_tcp(struct pf_state **stat
 
 		if (dst->scrub || src->scrub) {
 			if (pf_normalize_tcp_stateful(m, off, pd, reason, th,
-			    *state, src, dst, ©back))
+			    *state, src, dst, copyback))
 				return (PF_DROP);
 		}
 
@@ -5082,7 +4951,7 @@ pf_test_state_tcp(struct pf_state **stat
 
 		if (dst->scrub || src->scrub) {
 			if (pf_normalize_tcp_stateful(m, off, pd, reason, th,
-			    *state, src, dst, ©back))
+			    *state, src, dst, copyback))
 				return (PF_DROP);
 		}
 
@@ -5132,7 +5001,11 @@ pf_test_state_tcp(struct pf_state **stat
 			pf_print_state(*state);
 			pf_print_flags(th->th_flags);
 			printf(" seq=%u (%u) ack=%u len=%u ackskew=%d "
+#ifdef notyet
 			    "pkts=%llu:%llu dir=%s,%s\n",
+#else
+			    "pkts=%llu:%llu%s\n",
+#endif
 			    seq, orig_seq, ack, pd->p_len, ackskew,
 #ifdef __FreeBSD__
 			    (unsigned long long)(*state)->packets[0],
@@ -5140,8 +5013,12 @@ pf_test_state_tcp(struct pf_state **stat
 #else
 			    (*state)->packets[0], (*state)->packets[1],
 #endif
+#ifdef notyet
 			    direction == PF_IN ? "in" : "out",
 			    direction == (*state)->direction ? "fwd" : "rev");
+#else
+			    "");
+#endif
 			printf("pf: State failure on: %c %c %c %c | %c %c\n",
 			    SEQ_GEQ(src->seqhi, end) ? ' ' : '1',
 			    SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)) ?
@@ -5156,6 +5033,246 @@ pf_test_state_tcp(struct pf_state **stat
 	}
 
 	/* Any packets which have gotten here are to be passed */
+	return (PF_PASS);
+}
+
+int
+pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst,
+	struct pf_state **state, struct pf_pdesc *pd, u_short *reason)
+{
+	struct tcphdr		*th = pd->hdr.tcp;
+
+	if (th->th_flags & TH_SYN)
+		if (src->state < TCPS_SYN_SENT)
+			src->state = TCPS_SYN_SENT;
+	if (th->th_flags & TH_FIN)
+		if (src->state < TCPS_CLOSING)
+			src->state = TCPS_CLOSING;
+	if (th->th_flags & TH_ACK) {
+		if (dst->state == TCPS_SYN_SENT) {
+			dst->state = TCPS_ESTABLISHED;
+			if (src->state == TCPS_ESTABLISHED &&
+			    (*state)->src_node != NULL &&
+			    pf_src_connlimit(state)) {
+				REASON_SET(reason, PFRES_SRCLIMIT);
+				return (PF_DROP);
+			}
+		} else if (dst->state == TCPS_CLOSING) {
+			dst->state = TCPS_FIN_WAIT_2;
+		} else if (src->state == TCPS_SYN_SENT &&
+		    dst->state < TCPS_SYN_SENT) {
+			/*
+			 * Handle a special sloppy case where we only see one
+			 * half of the connection. If there is a ACK after
+			 * the initial SYN without ever seeing a packet from
+			 * the destination, set the connection to established.
+			 */
+			dst->state = src->state = TCPS_ESTABLISHED;
+			if ((*state)->src_node != NULL &&
+			    pf_src_connlimit(state)) {
+				REASON_SET(reason, PFRES_SRCLIMIT);
+				return (PF_DROP);
+			}
+		} else if (src->state == TCPS_CLOSING &&
+		    dst->state == TCPS_ESTABLISHED &&
+		    dst->seqlo == 0) {
+			/*
+			 * Handle the closing of half connections where we
+			 * don't see the full bidirectional FIN/ACK+ACK
+			 * handshake.
+			 */
+			dst->state = TCPS_CLOSING;
+		}
+	}
+	if (th->th_flags & TH_RST)
+		src->state = dst->state = TCPS_TIME_WAIT;
+
+	/* update expire time */
+	(*state)->expire = time_second;
+	if (src->state >= TCPS_FIN_WAIT_2 &&
+	    dst->state >= TCPS_FIN_WAIT_2)
+		(*state)->timeout = PFTM_TCP_CLOSED;
+	else if (src->state >= TCPS_CLOSING &&
+	    dst->state >= TCPS_CLOSING)
+		(*state)->timeout = PFTM_TCP_FIN_WAIT;
+	else if (src->state < TCPS_ESTABLISHED ||
+	    dst->state < TCPS_ESTABLISHED)
+		(*state)->timeout = PFTM_TCP_OPENING;
+	else if (src->state >= TCPS_CLOSING ||
+	    dst->state >= TCPS_CLOSING)
+		(*state)->timeout = PFTM_TCP_CLOSING;
+	else
+		(*state)->timeout = PFTM_TCP_ESTABLISHED;
+
+	return (PF_PASS);
+}
+
+
+int
+pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
+    struct mbuf *m, int off, void *h, struct pf_pdesc *pd,
+    u_short *reason)
+{
+	struct pf_state_cmp	 key;
+	struct tcphdr		*th = pd->hdr.tcp;
+	int			 copyback = 0;
+	struct pf_state_peer	*src, *dst;
+
+	key.af = pd->af;
+	key.proto = IPPROTO_TCP;
+	if (direction == PF_IN)	{
+		PF_ACPY(&key.ext.addr, pd->src, key.af);
+		PF_ACPY(&key.gwy.addr, pd->dst, key.af);
+		key.ext.port = th->th_sport;
+		key.gwy.port = th->th_dport;
+	} else {
+		PF_ACPY(&key.lan.addr, pd->src, key.af);
+		PF_ACPY(&key.ext.addr, pd->dst, key.af);
+		key.lan.port = th->th_sport;
+		key.ext.port = th->th_dport;
+	}
+
+	STATE_LOOKUP();
+
+	if (direction == (*state)->direction) {
+		src = &(*state)->src;
+		dst = &(*state)->dst;
+	} else {
+		src = &(*state)->dst;
+		dst = &(*state)->src;
+	}
+
+	if ((*state)->src.state == PF_TCPS_PROXY_SRC) {
+		if (direction != (*state)->direction) {
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_SYNPROXY_DROP);
+		}
+		if (th->th_flags & TH_SYN) {
+			if (ntohl(th->th_seq) != (*state)->src.seqlo) {
+				REASON_SET(reason, PFRES_SYNPROXY);
+				return (PF_DROP);
+			}
+#ifdef __FreeBSD__
+			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
+#else
+			pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
+#endif
+			    pd->src, th->th_dport, th->th_sport,
+			    (*state)->src.seqhi, ntohl(th->th_seq) + 1,
+			    TH_SYN|TH_ACK, 0, (*state)->src.mss, 0, 1,
+			    0, NULL, NULL);
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_SYNPROXY_DROP);
+		} else if (!(th->th_flags & TH_ACK) ||
+		    (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
+		    (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_DROP);
+		} else if ((*state)->src_node != NULL &&
+		    pf_src_connlimit(state)) {
+			REASON_SET(reason, PFRES_SRCLIMIT);
+			return (PF_DROP);
+		} else
+			(*state)->src.state = PF_TCPS_PROXY_DST;
+	}
+	if ((*state)->src.state == PF_TCPS_PROXY_DST) {
+		struct pf_state_host *src, *dst;
+
+		if (direction == PF_OUT) {
+			src = &(*state)->gwy;
+			dst = &(*state)->ext;
+		} else {
+			src = &(*state)->ext;
+			dst = &(*state)->lan;
+		}
+		if (direction == (*state)->direction) {
+			if (((th->th_flags & (TH_SYN|TH_ACK)) != TH_ACK) ||
+			    (ntohl(th->th_ack) != (*state)->src.seqhi + 1) ||
+			    (ntohl(th->th_seq) != (*state)->src.seqlo + 1)) {
+				REASON_SET(reason, PFRES_SYNPROXY);
+				return (PF_DROP);
+			}
+			(*state)->src.max_win = MAX(ntohs(th->th_win), 1);
+			if ((*state)->dst.seqhi == 1)
+				(*state)->dst.seqhi = htonl(arc4random());
+#ifdef __FreeBSD__
+			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
+			    &src->addr,
+#else
+			pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
+#endif
+			    &dst->addr, src->port, dst->port,
+			    (*state)->dst.seqhi, 0, TH_SYN, 0,
+			    (*state)->src.mss, 0, 0, (*state)->tag, NULL, NULL);
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_SYNPROXY_DROP);
+		} else if (((th->th_flags & (TH_SYN|TH_ACK)) !=
+		    (TH_SYN|TH_ACK)) ||
+		    (ntohl(th->th_ack) != (*state)->dst.seqhi + 1)) {
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_DROP);
+		} else {
+			(*state)->dst.max_win = MAX(ntohs(th->th_win), 1);
+			(*state)->dst.seqlo = ntohl(th->th_seq);
+#ifdef __FreeBSD__
+			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af, pd->dst,
+#else
+			pf_send_tcp((*state)->rule.ptr, pd->af, pd->dst,
+#endif
+			    pd->src, th->th_dport, th->th_sport,
+			    ntohl(th->th_ack), ntohl(th->th_seq) + 1,
+			    TH_ACK, (*state)->src.max_win, 0, 0, 0,
+			    (*state)->tag, NULL, NULL);
+#ifdef __FreeBSD__
+			pf_send_tcp(NULL, (*state)->rule.ptr, pd->af,
+			    &src->addr,
+#else
+			pf_send_tcp((*state)->rule.ptr, pd->af, &src->addr,
+#endif
+			    &dst->addr, src->port, dst->port,
+			    (*state)->src.seqhi + 1, (*state)->src.seqlo + 1,
+			    TH_ACK, (*state)->dst.max_win, 0, 0, 1,
+			    0, NULL, NULL);
+			(*state)->src.seqdiff = (*state)->dst.seqhi -
+			    (*state)->src.seqlo;
+			(*state)->dst.seqdiff = (*state)->src.seqhi -
+			    (*state)->dst.seqlo;
+			(*state)->src.seqhi = (*state)->src.seqlo +
+			    (*state)->dst.max_win;
+			(*state)->dst.seqhi = (*state)->dst.seqlo +
+			    (*state)->src.max_win;
+			(*state)->src.wscale = (*state)->dst.wscale = 0;
+			(*state)->src.state = (*state)->dst.state =
+			    TCPS_ESTABLISHED;
+			REASON_SET(reason, PFRES_SYNPROXY);
+			return (PF_SYNPROXY_DROP);
+		}
+	}
+
+	if (((th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN) &&
+	    dst->state >= TCPS_FIN_WAIT_2 &&
+	    src->state >= TCPS_FIN_WAIT_2) {
+		if (pf_status.debug >= PF_DEBUG_MISC) {
+			printf("pf: state reuse ");
+			pf_print_state(*state);
+			pf_print_flags(th->th_flags);
+			printf("\n");
+		}
+		/* XXX make sure it's the same direction ?? */
+		(*state)->src.state = (*state)->dst.state = TCPS_CLOSED;
+		pf_unlink_state(*state);
+		*state = NULL;
+		return (PF_DROP);
+	}
+
+	if ((*state)->state_flags & PFSTATE_SLOPPY) {
+		if (pf_tcp_track_sloppy(src, dst, state, pd, reason) == PF_DROP)
+			return (PF_DROP);
+	} else {
+		if (pf_tcp_track_full(src, dst, state, kif, m, off, pd, reason,
+		    ©back) == PF_DROP)
+			return (PF_DROP);
+	}
 
 	/* translate source/destination address, if necessary */
 	if (STATE_TRANSLATE(*state)) {
@@ -5533,8 +5650,9 @@ pf_test_state_icmp(struct pf_state **sta
 				copyback = 1;
 			}
 
-			if (!SEQ_GEQ(src->seqhi, seq) ||
-			    !SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws))) {
+			if (!((*state)->state_flags & PFSTATE_SLOPPY) &&
+			    (!SEQ_GEQ(src->seqhi, seq) ||
+			    !SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)))) {
 				if (pf_status.debug >= PF_DEBUG_MISC) {
 					printf("pf: BAD ICMP %d:%d ",
 					    icmptype, pd->hdr.icmp->icmp_code);
@@ -7052,7 +7170,7 @@ pf_test(int dir, struct ifnet *ifp, stru
 
 done:
 	if (action == PF_PASS && h->ip_hl > 5 &&
-	    !((s && s->allow_opts) || r->allow_opts)) {
+	    !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) {
 		action = PF_DROP;
 		REASON_SET(&reason, PFRES_IPOPTIONS);
 		log = 1;
@@ -7513,7 +7631,7 @@ pf_test6(int dir, struct ifnet *ifp, str
 done:
 	/* handle dangerous IPv6 extension headers. */
 	if (action == PF_PASS && rh_cnt &&
-	    !((s && s->allow_opts) || r->allow_opts)) {
+	    !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) {
 		action = PF_DROP;
 		REASON_SET(&reason, PFRES_IPOPTIONS);
 		log = 1;

Modified: head/sys/contrib/pf/net/pfvar.h
==============================================================================
--- head/sys/contrib/pf/net/pfvar.h	Wed Dec 23 23:53:30 2009	(r200929)
+++ head/sys/contrib/pf/net/pfvar.h	Thu Dec 24 00:43:44 2009	(r200930)
@@ -700,6 +700,7 @@ struct pf_rule {
 
 /* rule flags again */
 #define PFRULE_IFBOUND		0x00010000	/* if-bound */
+#define PFRULE_STATESLOPPY	0x00020000	/* sloppy state tracking */
 
 #define PFSTATE_HIWAT		10000	/* default state table size */
 #define PFSTATE_ADAPT_START	6000	/* default adaptive timeout start */
@@ -800,7 +801,9 @@ struct pf_state {
 	u_int8_t	 pad;
 #endif
 	u_int8_t	 log;
-	u_int8_t	 allow_opts;
+	u_int8_t	 state_flags;
+#define	PFSTATE_ALLOWOPTS	0x01
+#define	PFSTATE_SLOPPY		0x02
 	u_int8_t	 timeout;
 	u_int8_t	 sync_flags;
 #define	PFSTATE_NOSYNC	 0x01

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 10:43:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D91DE106568D;
	Thu, 24 Dec 2009 10:43:44 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8C048FC08;
	Thu, 24 Dec 2009 10:43:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOAhinp028048;
	Thu, 24 Dec 2009 10:43:44 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOAhik8028046;
	Thu, 24 Dec 2009 10:43:44 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912241043.nBOAhik8028046@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 10:43:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200933 - head/sys/geom/stripe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 10:43:44 -0000

Author: mav
Date: Thu Dec 24 10:43:44 2009
New Revision: 200933
URL: http://svn.freebsd.org/changeset/base/200933

Log:
  Make geom_stripe report it's stripe size to upper layers.

Modified:
  head/sys/geom/stripe/g_stripe.c

Modified: head/sys/geom/stripe/g_stripe.c
==============================================================================
--- head/sys/geom/stripe/g_stripe.c	Thu Dec 24 04:50:18 2009	(r200932)
+++ head/sys/geom/stripe/g_stripe.c	Thu Dec 24 10:43:44 2009	(r200933)
@@ -675,6 +675,8 @@ g_stripe_check_and_run(struct g_stripe_s
 	}
 	sc->sc_provider->sectorsize = sectorsize;
 	sc->sc_provider->mediasize = mediasize * sc->sc_ndisks;
+	sc->sc_provider->stripesize = sc->sc_stripesize;
+	sc->sc_provider->stripeoffset = 0;
 	g_error_provider(sc->sc_provider, 0);
 
 	G_STRIPE_DEBUG(0, "Device %s activated.", sc->sc_name);

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 11:05:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84F7F106568D;
	Thu, 24 Dec 2009 11:05:23 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7425B8FC1F;
	Thu, 24 Dec 2009 11:05:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOB5NQT028494;
	Thu, 24 Dec 2009 11:05:23 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOB5Nou028491;
	Thu, 24 Dec 2009 11:05:23 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912241105.nBOB5Nou028491@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 11:05:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200934 - in head/sys: geom sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 11:05:23 -0000

Author: mav
Date: Thu Dec 24 11:05:23 2009
New Revision: 200934
URL: http://svn.freebsd.org/changeset/base/200934

Log:
  Add two disk ioctls, giving user-level tools information about disk/array
  stripe (optimal access block) size and offset.

Modified:
  head/sys/geom/geom_dev.c
  head/sys/sys/disk.h

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Thu Dec 24 10:43:44 2009	(r200933)
+++ head/sys/geom/geom_dev.c	Thu Dec 24 11:05:23 2009	(r200934)
@@ -323,7 +323,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
 			return (ENOENT);
 		strlcpy(data, pp->name, i);
 		break;
-
+	case DIOCGSTRIPESIZE:
+		*(off_t *)data = cp->provider->stripesize;
+		break;
+	case DIOCGSTRIPEOFFSET:
+		*(off_t *)data = cp->provider->stripeoffset;
+		break;
 	default:
 		if (cp->provider->geom->ioctl != NULL) {
 			error = cp->provider->geom->ioctl(cp->provider, cmd, data, fflag, td);

Modified: head/sys/sys/disk.h
==============================================================================
--- head/sys/sys/disk.h	Thu Dec 24 10:43:44 2009	(r200933)
+++ head/sys/sys/disk.h	Thu Dec 24 11:05:23 2009	(r200934)
@@ -104,4 +104,16 @@ void disk_err(struct bio *bp, const char
 	 * must be at least MAXPATHLEN bytes long.
 	 */
 
+#define DIOCGSTRIPESIZE	_IOR('d', 139, off_t)	/* Get stripe size in bytes */
+	/*-
+	 * Get the size of the device's optimal access block in bytes.
+	 * This should be a multiple of the sectorsize.
+	 */
+
+#define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t)	/* Get stripe offset in bytes */
+	/*-
+	 * Get the offset of the first device's optimal access block in bytes.
+	 * This should be a multiple of the sectorsize.
+	 */
+
 #endif /* _SYS_DISK_H_ */

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 12:17:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77BC01065676;
	Thu, 24 Dec 2009 12:17:22 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 675728FC15;
	Thu, 24 Dec 2009 12:17:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOCHMeM029903;
	Thu, 24 Dec 2009 12:17:22 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOCHMGN029901;
	Thu, 24 Dec 2009 12:17:22 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912241217.nBOCHMGN029901@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 12:17:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200935 - head/sys/geom/mirror
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 12:17:22 -0000

Author: mav
Date: Thu Dec 24 12:17:22 2009
New Revision: 200935
URL: http://svn.freebsd.org/changeset/base/200935

Log:
  As soon as mirror has no own stripes, report largest stripe of unrerlying
  components, hoping others fit, if they are not equal.

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==============================================================================
--- head/sys/geom/mirror/g_mirror.c	Thu Dec 24 11:05:23 2009	(r200934)
+++ head/sys/geom/mirror/g_mirror.c	Thu Dec 24 12:17:22 2009	(r200935)
@@ -2036,6 +2036,15 @@ g_mirror_launch_provider(struct g_mirror
 	pp = g_new_providerf(sc->sc_geom, "mirror/%s", sc->sc_name);
 	pp->mediasize = sc->sc_mediasize;
 	pp->sectorsize = sc->sc_sectorsize;
+	pp->stripesize = 0;
+	pp->stripeoffset = 0;
+	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
+		if (disk->d_consumer && disk->d_consumer->provider &&
+		    disk->d_consumer->provider->stripesize > pp->stripesize) {
+			pp->stripesize = disk->d_consumer->provider->stripesize;
+			pp->stripeoffset = disk->d_consumer->provider->stripeoffset;
+		}
+	}
 	sc->sc_provider = pp;
 	g_error_provider(pp, 0);
 	g_topology_unlock();

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 12:27:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 209591065670;
	Thu, 24 Dec 2009 12:27:23 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 100188FC15;
	Thu, 24 Dec 2009 12:27:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOCRMkc030242;
	Thu, 24 Dec 2009 12:27:22 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOCRM9t030240;
	Thu, 24 Dec 2009 12:27:22 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241227.nBOCRM9t030240@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 12:27:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200938 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 12:27:23 -0000

Author: marius
Date: Thu Dec 24 12:27:22 2009
New Revision: 200938
URL: http://svn.freebsd.org/changeset/base/200938

Log:
  - Don't check for a valid interrupt controller on every interrupt
    in intr_execute_handlers(). If we managed to get here without an
    associated interrupt controller we have way bigger problems.
    While at it predict stray vector interrupts as false as they are
    rather unlikely.
  - Don't blindly call the clear function of an interrupt controller
    when adding a handler in inthand_add() as interrupt controllers
    like the one driven by upa(4) are auto-clearing and thus provide
    NULL instead.

Modified:
  head/sys/sparc64/sparc64/intr_machdep.c

Modified: head/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 12:26:13 2009	(r200937)
+++ head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 12:27:22 2009	(r200938)
@@ -276,7 +276,7 @@ intr_execute_handlers(void *cookie)
 	struct intr_vector *iv;
 
 	iv = cookie;
-	if (iv->iv_ic == NULL || intr_event_handle(iv->iv_event, NULL) != 0)
+	if (__predict_false(intr_event_handle(iv->iv_event, NULL) != 0))
 		intr_stray_vector(iv);
 }
 
@@ -377,7 +377,8 @@ inthand_add(const char *name, int vec, d
 #endif
 	ic->ic_enable(iv);
 	/* Ensure the interrupt is cleared, it might have triggered before. */
-	ic->ic_clear(iv);
+	if (ic->ic_clear != NULL)
+		ic->ic_clear(iv);
 	sx_xunlock(&intr_table_lock);
 	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 13:38:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58F3D1065693;
	Thu, 24 Dec 2009 13:38:02 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 48DE38FC13;
	Thu, 24 Dec 2009 13:38:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBODc2Mk031654;
	Thu, 24 Dec 2009 13:38:02 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBODc2V0031652;
	Thu, 24 Dec 2009 13:38:02 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912241338.nBODc2V0031652@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 13:38:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200940 - head/sys/geom/raid3
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 13:38:02 -0000

Author: mav
Date: Thu Dec 24 13:38:02 2009
New Revision: 200940
URL: http://svn.freebsd.org/changeset/base/200940

Log:
  As soon as geom_raid3 reports it's own stripe as sector size, report largest
  underlying provider's stripe, multiplied by number of data disks in array,
  due to transformation done, as array stripe.

Modified:
  head/sys/geom/raid3/g_raid3.c

Modified: head/sys/geom/raid3/g_raid3.c
==============================================================================
--- head/sys/geom/raid3/g_raid3.c	Thu Dec 24 12:31:27 2009	(r200939)
+++ head/sys/geom/raid3/g_raid3.c	Thu Dec 24 13:38:02 2009	(r200940)
@@ -2317,6 +2317,8 @@ static void
 g_raid3_launch_provider(struct g_raid3_softc *sc)
 {
 	struct g_provider *pp;
+	struct g_raid3_disk *disk;
+	int n;
 
 	sx_assert(&sc->sc_lock, SX_LOCKED);
 
@@ -2324,6 +2326,18 @@ g_raid3_launch_provider(struct g_raid3_s
 	pp = g_new_providerf(sc->sc_geom, "raid3/%s", sc->sc_name);
 	pp->mediasize = sc->sc_mediasize;
 	pp->sectorsize = sc->sc_sectorsize;
+	pp->stripesize = 0;
+	pp->stripeoffset = 0;
+	for (n = 0; n < sc->sc_ndisks; n++) {
+		disk = &sc->sc_disks[n];
+		if (disk->d_consumer && disk->d_consumer->provider &&
+		    disk->d_consumer->provider->stripesize > pp->stripesize) {
+			pp->stripesize = disk->d_consumer->provider->stripesize;
+			pp->stripeoffset = disk->d_consumer->provider->stripeoffset;
+		}
+	}
+	pp->stripesize *= sc->sc_ndisks - 1;
+	pp->stripeoffset *= sc->sc_ndisks - 1;
 	sc->sc_provider = pp;
 	g_error_provider(pp, 0);
 	g_topology_unlock();

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 14:32:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 977601065676;
	Thu, 24 Dec 2009 14:32:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8667E8FC1E;
	Thu, 24 Dec 2009 14:32:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOEWBcW032808;
	Thu, 24 Dec 2009 14:32:11 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOEWBSj032804;
	Thu, 24 Dec 2009 14:32:11 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200912241432.nBOEWBSj032804@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 24 Dec 2009 14:32:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200941 - in head/tools/tools: . notescheck
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 14:32:11 -0000

Author: jhb
Date: Thu Dec 24 14:32:11 2009
New Revision: 200941
URL: http://svn.freebsd.org/changeset/base/200941

Log:
  Add a new tool which attempts to check for kernel configuration options that
  are missing from NOTES files.

Added:
  head/tools/tools/notescheck/
  head/tools/tools/notescheck/Makefile   (contents, props changed)
  head/tools/tools/notescheck/notescheck.py   (contents, props changed)
Modified:
  head/tools/tools/README

Modified: head/tools/tools/README
==============================================================================
--- head/tools/tools/README	Thu Dec 24 13:38:02 2009	(r200940)
+++ head/tools/tools/README	Thu Dec 24 14:32:11 2009	(r200941)
@@ -48,6 +48,7 @@ mfc		Merge a directory from HEAD to a br
 mid	 	Create a Message-ID database for mailing lists.
 mwl		Tools specific to the Marvell 88W8363 support
 ncpus		Count the number of processors
+notescheck	Check for missing devices and options in NOTES files.
 npe		Tools specific to the Intel IXP4XXX NPE device
 nxge		A diagnostic tool for the nxge(4) driver
 pciid		Generate src/share/misc/pci_vendors.

Added: head/tools/tools/notescheck/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/notescheck/Makefile	Thu Dec 24 14:32:11 2009	(r200941)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+SCRIPTS=	notescheck.py
+
+.include 

Added: head/tools/tools/notescheck/notescheck.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/notescheck/notescheck.py	Thu Dec 24 14:32:11 2009	(r200941)
@@ -0,0 +1,361 @@
+#!/usr/local/bin/python
+#
+# This script analyzes sys/conf/files*, sys/conf/options*,
+# sys/conf/NOTES, and sys/*/conf/NOTES and checks for inconsistencies
+# such as options or devices that are not specified in any NOTES files
+# or MI devices specified in MD NOTES files.
+#
+# $FreeBSD$
+
+import glob
+import os.path
+import sys
+
+def usage():
+    print >>sys.stderr, "notescheck "
+    print >>sys.stderr
+    print >>sys.stderr, "Where 'path' is a path to a kernel source tree."
+
+# These files are used to determine if a path is a valid kernel source tree.
+requiredfiles = ['conf/files', 'conf/options', 'conf/NOTES']
+
+# This special platform string is used for managing MI options.
+global_platform = 'global'
+
+# This is a global string that represents the current file and line
+# being parsed.
+location = ""
+
+# Format the contents of a set into a sorted, comma-separated string
+def format_set(set):
+    l = []
+    for item in set:
+        l.append(item)
+    if len(l) == 0:
+        return "(empty)"
+    l.sort()
+    if len(l) == 2:
+        return "%s and %s" % (l[0], l[1])
+    s = "%s" % (l[0])
+    if len(l) == 1:
+        return s
+    for item in l[1:-1]:
+        s = "%s, %s" % (s, item)
+    s = "%s, and %s" % (s, l[-1])
+    return s
+
+# This class actually covers both options and devices.  For each named
+# option we maintain two different lists.  One is the list of
+# platforms that the option was defined in via an options or files
+# file.  The other is the list of platforms that the option was tested
+# in via a NOTES file.  All options are stored as lowercase since
+# config(8) treats the names as case-insensitive.
+class Option:
+    def __init__(self, name):
+        self.name = name
+        self.type = None
+        self.defines = set()
+        self.tests = set()
+
+    def set_type(self, type):
+        if self.type is None:
+            self.type = type
+            self.type_location = location
+        elif self.type != type:
+            print "WARN: Attempt to change type of %s from %s to %s%s" % \
+                (self.name, self.type, type, location)
+            print "      Previous type set%s" % (self.type_location)
+
+    def add_define(self, platform):
+        self.defines.add(platform)
+
+    def add_test(self, platform):
+        self.tests.add(platform)
+
+    def title(self):
+        if self.type == 'option':
+            return 'option %s' % (self.name.upper())
+        if self.type == None:
+            return self.name
+        return '%s %s' % (self.type, self.name)
+
+    def warn(self):
+        # If the defined and tested sets are equal, then this option
+        # is ok.
+        if self.defines == self.tests:
+            return
+
+        # If the tested set contains the global platform, then this
+        # option is ok.
+        if global_platform in self.tests:
+            return
+
+        if global_platform in self.defines:
+            # If the device is defined globally ans is never tested, whine.
+            if len(self.tests) == 0:
+                print 'WARN: %s is defined globally but never tested' % \
+                    (self.title())
+                return
+            
+            # If the device is defined globally and is tested on
+            # multiple MD platforms, then it is ok.  This often occurs
+            # for drivers that are shared across multiple, but not
+            # all, platforms (e.g. acpi, agp).
+            if len(self.tests) > 1:
+                return
+
+            # If a device is defined globally but is only tested on a
+            # single MD platform, then whine about this.
+            print 'WARN: %s is defined globally but only tested in %s NOTES' % \
+                (self.title(), format_set(self.tests))
+            return
+
+        # If an option or device is never tested, whine.
+        if len(self.tests) == 0:
+            print 'WARN: %s is defined in %s but never tested' % \
+                (self.title(), format_set(self.defines))
+            return
+
+        # The set of MD platforms where this option is defined, but not tested.
+        notest = self.defines - self.tests
+        if len(notest) != 0:
+            print 'WARN: %s is not tested in %s NOTES' % \
+                (self.title(), format_set(notest))
+            return
+
+        print 'ERROR: bad state for %s: defined in %s, tested in %s' % \
+            (self.title(), format_set(self.defines), format_set(self.tests))
+
+# This class maintains a dictionary of options keyed by name.
+class Options:
+    def __init__(self):
+        self.options = {}
+
+    # Look up the object for a given option by name.  If the option
+    # doesn't already exist, then add a new option.
+    def find(self, name):
+        name = name.lower()
+        if name in self.options:
+            return self.options[name]
+        option = Option(name)
+        self.options[name] = option
+        return option
+
+    # Warn about inconsistencies
+    def warn(self):
+        keys = self.options.keys()
+        keys.sort()
+        for key in keys:
+            option = self.options[key]
+            option.warn()
+
+# Global map of options
+options = Options()
+
+# Look for MD NOTES files to build our list of platforms.  We ignore
+# platforms that do not have a NOTES file.
+def find_platforms(tree):
+    platforms = []
+    for file in glob.glob(tree + '*/conf/NOTES'):
+        if not file.startswith(tree):
+            print >>sys.stderr, "Bad MD NOTES file %s" %(file)
+            sys.exit(1)
+        platforms.append(file[len(tree):].split('/')[0])
+    if global_platform in platforms:
+        print >>sys.stderr, "Found MD NOTES file for global platform"
+        sys.exit(1)
+    return platforms
+
+# Parse a file that has escaped newlines.  Any escaped newlines are
+# coalesced and each logical line is passed to the callback function.
+# This also skips blank lines and comments.
+def parse_file(file, callback, *args):
+    global location
+
+    f = open(file)
+    current = None
+    i = 0
+    for line in f:
+        # Update parsing location
+        i = i + 1
+        location = ' at %s:%d' % (file, i)
+
+        # Trim the newline
+        line = line[:-1]
+
+        # If the previous line had an escaped newline, append this
+        # line to that.
+        if current is not None:
+            line = current + line
+            current = None
+
+        # If the line ends in a '\', set current to the line (minus
+        # the escape) and continue.
+        if len(line) > 0 and line[-1] == '\\':
+            current = line[:-1]
+            continue
+
+        # Skip blank lines or lines with only whitespace
+        if len(line) == 0 or len(line.split()) == 0:
+            continue
+
+        # Skip comment lines.  Any line whose first non-space
+        # character is a '#' is considered a comment.
+        if line.split()[0][0] == '#':
+            continue
+
+        # Invoke the callback on this line
+        callback(line, *args)
+    if current is not None:
+        callback(current, *args)
+
+    location = ""
+
+# Split a line into words on whitespace with the exception that quoted
+# strings are always treated as a single word.
+def tokenize(line):
+    if len(line) == 0:
+        return []
+
+    # First, split the line on quote characters.
+    groups = line.split('"')
+
+    # Ensure we have an even number of quotes.  The 'groups' array
+    # will contain 'number of quotes' + 1 entries, so it should have
+    # an odd number of entries.
+    if len(groups) % 2 == 0:
+        print >>sys.stderr, "Failed to tokenize: %s%s" (line, location)
+        return []
+
+    # String split all the "odd" groups since they are not quoted strings.
+    quoted = False
+    words = []
+    for group in groups:
+        if quoted:
+            words.append(group)
+            quoted = False
+        else:
+            for word in group.split():
+                words.append(word)
+            quoted = True
+    return words
+
+# Parse a sys/conf/files* file adding defines for any options
+# encountered.  Note files does not differentiate between options and
+# devices.
+def parse_files_line(line, platform):
+    words = tokenize(line)
+
+    # Skip include lines.
+    if words[0] == 'include':
+        return
+
+    # Skip standard lines as they have no devices or options.
+    if words[1] == 'standard':
+        return
+
+    # Remaining lines better be optional or mandatory lines.
+    if words[1] != 'optional' and words[1] != 'mandatory':
+        print >>sys.stderr, "Invalid files line: %s%s" % (line, location)
+
+    # Drop the first two words and begin parsing keywords and devices.
+    skip = False
+    for word in words[2:]:
+        if skip:
+            skip = False
+            continue
+
+        # Skip keywords
+        if word == 'no-obj' or word == 'no-implicit-rule' or \
+                word == 'before-depend' or word == 'local' or \
+                word == 'no-depend' or word == 'profiling-routine' or \
+                word == 'nowerror':
+            continue
+
+        # Skip keywords and their following argument
+        if word == 'dependency' or word == 'clean' or \
+                word == 'compile-with' or word == 'warning':
+            skip = True
+            continue
+
+        # Ignore pipes
+        if word == '|':
+            continue
+
+        option = options.find(word)
+        option.add_define(platform)
+
+# Parse a sys/conf/options* file adding defines for any options
+# encountered.  Unlike a files file, options files only add options.
+def parse_options_line(line, platform):
+    # The first word is the option name.
+    name = line.split()[0]
+
+    # Ignore DEV_xxx options.  These are magic options that are
+    # aliases for 'device xxx'.
+    if name.startswith('DEV_'):
+        return
+
+    option = options.find(name)
+    option.add_define(platform)
+    option.set_type('option')
+
+# Parse a sys/conf/NOTES file adding tests for any options or devices
+# encountered.
+def parse_notes_line(line, platform):
+    words = line.split()
+
+    # Skip lines with just whitespace
+    if len(words) == 0:
+        return
+
+    if words[0] == 'device' or words[0] == 'devices':
+        option = options.find(words[1])
+        option.add_test(platform)
+        option.set_type('device')
+        return
+
+    if words[0] == 'option' or words[0] == 'options':
+        option = options.find(words[1].split('=')[0])
+        option.add_test(platform)
+        option.set_type('option')
+        return
+
+def main(argv=None):
+    if argv is None:
+        argv = sys.argv
+    if len(sys.argv) != 2:
+        usage()
+        return 2
+
+    # Ensure the path has a trailing '/'.
+    tree = sys.argv[1]
+    if tree[-1] != '/':
+        tree = tree + '/'
+    for file in requiredfiles:
+        if not os.path.exists(tree + file):
+            print>> sys.stderr, "Kernel source tree missing %s" % (file)
+            return 1
+    
+    platforms = find_platforms(tree)
+
+    # First, parse global files.
+    parse_file(tree + 'conf/files', parse_files_line, global_platform)
+    parse_file(tree + 'conf/options', parse_options_line, global_platform)
+    parse_file(tree + 'conf/NOTES', parse_notes_line, global_platform)
+
+    # Next, parse MD files.
+    for platform in platforms:
+        files_file = tree + 'conf/files.' + platform
+        if os.path.exists(files_file):
+            parse_file(files_file, parse_files_line, platform)
+        options_file = tree + 'conf/options.' + platform
+        if os.path.exists(options_file):
+            parse_file(options_file, parse_options_line, platform)
+        parse_file(tree + platform + '/conf/NOTES', parse_notes_line, platform)
+
+    options.warn()
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main())

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 14:32:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 333D91065676;
	Thu, 24 Dec 2009 14:32:22 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 23ACB8FC08;
	Thu, 24 Dec 2009 14:32:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOEWMhG032846;
	Thu, 24 Dec 2009 14:32:22 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOEWM04032844;
	Thu, 24 Dec 2009 14:32:22 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912241432.nBOEWM04032844@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 14:32:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200942 - head/sys/geom/concat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 14:32:22 -0000

Author: mav
Date: Thu Dec 24 14:32:21 2009
New Revision: 200942
URL: http://svn.freebsd.org/changeset/base/200942

Log:
  Make geom_concat to passthrough stripe parameters of the first component,
  hoping that rest will fit.

Modified:
  head/sys/geom/concat/g_concat.c

Modified: head/sys/geom/concat/g_concat.c
==============================================================================
--- head/sys/geom/concat/g_concat.c	Thu Dec 24 14:32:11 2009	(r200941)
+++ head/sys/geom/concat/g_concat.c	Thu Dec 24 14:32:21 2009	(r200942)
@@ -347,14 +347,14 @@ static void
 g_concat_check_and_run(struct g_concat_softc *sc)
 {
 	struct g_concat_disk *disk;
+	struct g_provider *pp;
 	u_int no, sectorsize = 0;
 	off_t start;
 
 	if (g_concat_nvalid(sc) != sc->sc_ndisks)
 		return;
 
-	sc->sc_provider = g_new_providerf(sc->sc_geom, "concat/%s",
-	    sc->sc_name);
+	pp = g_new_providerf(sc->sc_geom, "concat/%s", sc->sc_name);
 	start = 0;
 	for (no = 0; no < sc->sc_ndisks; no++) {
 		disk = &sc->sc_disks[no];
@@ -371,10 +371,13 @@ g_concat_check_and_run(struct g_concat_s
 			    disk->d_consumer->provider->sectorsize);
 		}
 	}
-	sc->sc_provider->sectorsize = sectorsize;
+	pp->sectorsize = sectorsize;
 	/* We have sc->sc_disks[sc->sc_ndisks - 1].d_end in 'start'. */
-	sc->sc_provider->mediasize = start;
-	g_error_provider(sc->sc_provider, 0);
+	pp->mediasize = start;
+	pp->stripesize = sc->sc_disks[0].d_consumer->provider->stripesize;
+	pp->stripeoffset = sc->sc_disks[0].d_consumer->provider->stripeoffset;
+	sc->sc_provider = pp;
+	g_error_provider(pp, 0);
 
 	G_CONCAT_DEBUG(0, "Device %s activated.", sc->sc_name);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 14:41:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 48C661065692;
	Thu, 24 Dec 2009 14:41:46 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from mail.vega.ru (mail.vega.ru [90.156.167.5])
	by mx1.freebsd.org (Postfix) with ESMTP id F0F328FC08;
	Thu, 24 Dec 2009 14:41:45 +0000 (UTC)
Authentication-Results: mail.vega.ru; dkim=unverified, header.i=@FreeBSD.org
Authentication-Results: mail.vega.ru; domainkeys=; header.sender=
Received: from [10.100.124.99] (helo=edoofus.dev.vega.ru)
	by mail.vega.ru with esmtpsa (TLSv1:AES256-SHA:256)
	(Exim 4.69 (FreeBSD)) (envelope-from )
	id 1NNosn-000MaI-OD; Thu, 24 Dec 2009 17:41:41 +0300
Date: Thu, 24 Dec 2009 17:41:36 +0300
From: Ruslan Ermilov 
To: Doug Barton 
Message-ID: <20091224144136.GA28793@edoofus.dev.vega.ru>
References: <200912211943.nBLJhNUU038425@svn.freebsd.org>
	<200912211459.21766.jhb@freebsd.org>
	<20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<4B3129CD.20908@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4B3129CD.20908@FreeBSD.org>
Cc: src-committers@freebsd.org, jhb@freebsd.org, svn-src-all@freebsd.org,
	marius@alchemy.franken.de, svn-src-head@freebsd.org,
	"M. Warner Losh" 
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 14:41:46 -0000

On Tue, Dec 22, 2009 at 12:19:25PM -0800, Doug Barton wrote:
> In the short term I think we are well served on all fronts to modify
> the build architecture to better support compilers from ports. This
> would actually help with the llvm/clang testing too, and sidestep the
> problems of gplv3 stuff being in the base. TMK there has been no work
> on this direction at all, which is disappointing.

If you take GNU binutils/compiler from ports, I think we can already
do this, and without any changes to the build architecture.  It's
just a matter of defining several make(1) variables, like CC, CXX,
CPP, LD, AS, NM, AR, specifying full paths of the desired binaries,
plus some environment variables (at least STRIPBIN, so that install(1)
calls the correct strip(1) binary).


Cheers,
-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:14:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2A55D1065672;
	Thu, 24 Dec 2009 15:14:23 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A8658FC15;
	Thu, 24 Dec 2009 15:14:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFEMoe033636;
	Thu, 24 Dec 2009 15:14:22 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFEMct033633;
	Thu, 24 Dec 2009 15:14:22 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912241514.nBOFEMct033633@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 24 Dec 2009 15:14:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200943 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:14:23 -0000

Author: jilles
Date: Thu Dec 24 15:14:22 2009
New Revision: 200943
URL: http://svn.freebsd.org/changeset/base/200943

Log:
  sh: Remove setting variables from dotcmd/exportcmd.
  
  It is already done by evalcommand(), unless special-ness has been removed,
  in which case variable assignments should not persist. (These are currently
  always special builtins, but this will change later: command builtin,
  command substitution.)
  
  This also fixes a memory leak when calling . with variable assignments.
  
  Example:
    valgrind --leak-check=full sh -c 'x=1 . /dev/null; x=2'

Modified:
  head/bin/sh/main.c
  head/bin/sh/var.c

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Thu Dec 24 14:32:21 2009	(r200942)
+++ head/bin/sh/main.c	Thu Dec 24 15:14:22 2009	(r200943)
@@ -315,7 +315,6 @@ find_dot_file(char *basename)
 int
 dotcmd(int argc, char **argv)
 {
-	struct strlist *sp;
 	char *fullname;
 
 	if (argc < 2)
@@ -323,9 +322,6 @@ dotcmd(int argc, char **argv)
 
 	exitstatus = 0;
 
-	for (sp = cmdenviron; sp ; sp = sp->next)
-		setvareq(savestr(sp->text), VSTRFIXED|VTEXTFIXED);
-
 	fullname = find_dot_file(argv[1]);
 	setinputfile(fullname, 1);
 	commandname = fullname;

Modified: head/bin/sh/var.c
==============================================================================
--- head/bin/sh/var.c	Thu Dec 24 14:32:21 2009	(r200942)
+++ head/bin/sh/var.c	Thu Dec 24 15:14:22 2009	(r200943)
@@ -607,7 +607,6 @@ exportcmd(int argc, char **argv)
 
 	if (values && argc != 0)
 		error("-p requires no arguments");
-	listsetvar(cmdenviron);
 	if (argc != 0) {
 		while ((name = *argv++) != NULL) {
 			if ((p = strchr(name, '=')) != NULL) {

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:14:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A7AAF106574F;
	Thu, 24 Dec 2009 15:14:35 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 97F9A8FC0C;
	Thu, 24 Dec 2009 15:14:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFEZbN033673;
	Thu, 24 Dec 2009 15:14:35 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFEZbS033671;
	Thu, 24 Dec 2009 15:14:35 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241514.nBOFEZbS033671@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 15:14:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200944 - head/sys/boot/sparc64/loader
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:14:35 -0000

Author: marius
Date: Thu Dec 24 15:14:35 2009
New Revision: 200944
URL: http://svn.freebsd.org/changeset/base/200944

Log:
  Revert r183628 as with the current ata(4) ATAPI DMA with AcerLabs
  M5229 appears to be once again fixed. If this happens to return
  we probably should disable ATAPI DMA in ataacerlabs(4) instead
  just like the Linux libATA does.

Modified:
  head/sys/boot/sparc64/loader/main.c

Modified: head/sys/boot/sparc64/loader/main.c
==============================================================================
--- head/sys/boot/sparc64/loader/main.c	Thu Dec 24 15:14:22 2009	(r200943)
+++ head/sys/boot/sparc64/loader/main.c	Thu Dec 24 15:14:35 2009	(r200944)
@@ -261,7 +261,6 @@ static int
 sparc64_autoload(void)
 {
 
-	setenv("hw.ata.atapi_dma", "0", 0);
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:16:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F02B106568B;
	Thu, 24 Dec 2009 15:16:17 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3F1EE8FC14;
	Thu, 24 Dec 2009 15:16:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFGHOH033756;
	Thu, 24 Dec 2009 15:16:17 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFGHYd033754;
	Thu, 24 Dec 2009 15:16:17 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241516.nBOFGHYd033754@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 15:16:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200945 - head/sys/boot/common
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:16:17 -0000

Author: marius
Date: Thu Dec 24 15:16:16 2009
New Revision: 200945
URL: http://svn.freebsd.org/changeset/base/200945

Log:
  - Consistently wrap debugging in NETIF_DEBUG. This basically merges
    NetBSD rev 1.19.
  - Make the functions match their prototypes regarding static.

Modified:
  head/sys/boot/common/dev_net.c

Modified: head/sys/boot/common/dev_net.c
==============================================================================
--- head/sys/boot/common/dev_net.c	Thu Dec 24 15:14:35 2009	(r200944)
+++ head/sys/boot/common/dev_net.c	Thu Dec 24 15:16:16 2009	(r200945)
@@ -76,7 +76,9 @@ __FBSDID("$FreeBSD$");
 #include "dev_net.h"
 #include "bootstrap.h"
 
+#ifdef	NETIF_DEBUG
 int debug = 0;
+#endif
 
 static int netdev_sock = -1;
 static int netdev_opens;
@@ -100,7 +102,7 @@ struct devsw netdev = {
 	net_print
 };
 
-int
+static int
 net_init(void)
 {
 
@@ -112,7 +114,7 @@ net_init(void)
  * This opens the low-level device and sets f->f_devdata.
  * This is declared with variable arguments...
  */
-int
+static int
 net_open(struct open_file *f, ...)
 {
 	va_list args;
@@ -132,8 +134,10 @@ net_open(struct open_file *f, ...)
 				printf("net_open: netif_open() failed\n");
 				return (ENXIO);
 			}
+#ifdef	NETIF_DEBUG
 			if (debug)
-			printf("net_open: netif_open() succeeded\n");
+				printf("net_open: netif_open() succeeded\n");
+#endif
 		}
 		if (rootip.s_addr == 0) {
 			/* Get root IP address, and path, etc. */
@@ -154,7 +158,7 @@ net_open(struct open_file *f, ...)
 	return (error);
 }
 
-int
+static int
 net_close(struct open_file *f)
 {
 #ifdef	NETIF_DEBUG
@@ -173,15 +177,17 @@ net_close(struct open_file *f)
 		return(0);
 	rootip.s_addr = 0;
 	if (netdev_sock >= 0) {
+#ifdef	NETIF_DEBUG
 		if (debug)
 			printf("net_close: calling netif_close()\n");
+#endif
 		netif_close(netdev_sock);
 		netdev_sock = -1;
 	}
 	return (0);
 }
 
-int
+static int
 net_strategy()
 {
 
@@ -227,9 +233,11 @@ net_getparams(int sock)
 		bootp(sock, BOOTP_NONE);
 	if (myip.s_addr != 0)
 		goto exit;
+#ifdef	NETIF_DEBUG
 	if (debug)
 		printf("net_open: BOOTP failed, trying RARP/RPC...\n");
 #endif
+#endif
 
 	/*
 	 * Use RARP to get our IP address.  This also sets our
@@ -246,8 +254,10 @@ net_getparams(int sock)
 		printf("net_open: bootparam/whoami RPC failed\n");
 		return (EIO);
 	}
+#ifdef	NETIF_DEBUG
 	if (debug)
 		printf("net_open: client name: %s\n", hostname);
+#endif
 
 	/*
 	 * Ignore the gateway from whoami (unreliable).
@@ -261,11 +271,15 @@ net_getparams(int sock)
 	}
 	if (smask) {
 		netmask = smask;
+#ifdef	NETIF_DEBUG
 		if (debug)
-		printf("net_open: subnet mask: %s\n", intoa(netmask));
+			printf("net_open: subnet mask: %s\n", intoa(netmask));
+#endif
 	}
+#ifdef	NETIF_DEBUG
 	if (gateip.s_addr && debug)
 		printf("net_open: net gateway: %s\n", inet_ntoa(gateip));
+#endif
 
 	/* Get the root server and pathname. */
 	if (bp_getfile(sock, "root", &rootip, rootpath)) {
@@ -288,10 +302,12 @@ exit:
 		bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1);
 		bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1);
 	}
+#ifdef	NETIF_DEBUG
 	if (debug) {
 		printf("net_open: server addr: %s\n", inet_ntoa(rootip));
 		printf("net_open: server path: %s\n", rootpath);
 	}
+#endif
 
 	d = socktodesc(sock);
 	sprintf(temp, "%6D", d->myea, ":");

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:23:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C159D106568B;
	Thu, 24 Dec 2009 15:23:51 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B19208FC15;
	Thu, 24 Dec 2009 15:23:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFNptR033939;
	Thu, 24 Dec 2009 15:23:51 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFNpxs033937;
	Thu, 24 Dec 2009 15:23:51 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241523.nBOFNpxs033937@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 15:23:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200946 - head/sys/boot/sparc64/loader
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:23:51 -0000

Author: marius
Date: Thu Dec 24 15:23:51 2009
New Revision: 200946
URL: http://svn.freebsd.org/changeset/base/200946

Log:
  Execute the cleanup handlers before jumping to the kernel just
  like the other architectures do.

Modified:
  head/sys/boot/sparc64/loader/main.c

Modified: head/sys/boot/sparc64/loader/main.c
==============================================================================
--- head/sys/boot/sparc64/loader/main.c	Thu Dec 24 15:16:16 2009	(r200945)
+++ head/sys/boot/sparc64/loader/main.c	Thu Dec 24 15:23:51 2009	(r200946)
@@ -386,6 +386,8 @@ __elfN(exec)(struct preloaded_file *fp)
 	pmap_print_tlb_sun4u();
 #endif
 
+	dev_cleanup();
+
 	entry = e->e_entry;
 
 	OF_release((void *)heapva, HEAPSZ);

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:40:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38018106566B;
	Thu, 24 Dec 2009 15:40:09 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 284208FC0A;
	Thu, 24 Dec 2009 15:40:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFe9U8034282;
	Thu, 24 Dec 2009 15:40:09 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFe9BY034280;
	Thu, 24 Dec 2009 15:40:09 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241540.nBOFe9BY034280@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 15:40:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200947 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:40:09 -0000

Author: marius
Date: Thu Dec 24 15:40:08 2009
New Revision: 200947
URL: http://svn.freebsd.org/changeset/base/200947

Log:
  Add missing locking in intr_bind().

Modified:
  head/sys/sparc64/sparc64/intr_machdep.c

Modified: head/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:23:51 2009	(r200946)
+++ head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:40:08 2009	(r200947)
@@ -450,13 +450,19 @@ int
 intr_bind(int vec, u_char cpu)
 {
 	struct intr_vector *iv;
+	int error;
 
 	if (vec < 0 || vec >= IV_MAX)
 		return (EINVAL);
+	sx_xlock(&intr_table_lock);
 	iv = &intr_vectors[vec];
-	if (iv == NULL)
+	if (iv == NULL) {
+		sx_xunlock(&intr_table_lock);
 		return (EINVAL);
-	return (intr_event_bind(iv->iv_event, cpu));
+	}
+	error = intr_event_bind(iv->iv_event, cpu);
+	sx_xunlock(&intr_table_lock);
+	return (error);
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 15:43:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 53009106566B;
	Thu, 24 Dec 2009 15:43:38 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 425FB8FC1C;
	Thu, 24 Dec 2009 15:43:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOFhcHD034397;
	Thu, 24 Dec 2009 15:43:38 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOFhcMN034391;
	Thu, 24 Dec 2009 15:43:38 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912241543.nBOFhcMN034391@svn.freebsd.org>
From: Marius Strobl 
Date: Thu, 24 Dec 2009 15:43:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200948 - in head/sys/sparc64: include pci sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 15:43:38 -0000

Author: marius
Date: Thu Dec 24 15:43:37 2009
New Revision: 200948
URL: http://svn.freebsd.org/changeset/base/200948

Log:
  Merge from amd64/i386:
  Implement support for interrupt descriptions.

Modified:
  head/sys/sparc64/include/intr_machdep.h
  head/sys/sparc64/pci/psycho.c
  head/sys/sparc64/pci/schizo.c
  head/sys/sparc64/sparc64/intr_machdep.c
  head/sys/sparc64/sparc64/nexus.c

Modified: head/sys/sparc64/include/intr_machdep.h
==============================================================================
--- head/sys/sparc64/include/intr_machdep.h	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/include/intr_machdep.h	Thu Dec 24 15:43:37 2009	(r200948)
@@ -93,6 +93,7 @@ extern struct intr_vector intr_vectors[]
 void	intr_add_cpu(u_int cpu);
 #endif
 int	intr_bind(int vec, u_char cpu);
+int	intr_describe(int vec, void *ih, const char *descr);
 void	intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf,
 	    void *iva);
 void	intr_init1(void);

Modified: head/sys/sparc64/pci/psycho.c
==============================================================================
--- head/sys/sparc64/pci/psycho.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/pci/psycho.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -115,6 +115,7 @@ static bus_alloc_resource_t psycho_alloc
 static bus_activate_resource_t psycho_activate_resource;
 static bus_deactivate_resource_t psycho_deactivate_resource;
 static bus_release_resource_t psycho_release_resource;
+static bus_describe_intr_t psycho_describe_intr;
 static bus_get_dma_tag_t psycho_get_dma_tag;
 static pcib_maxslots_t psycho_maxslots;
 static pcib_read_config_t psycho_read_config;
@@ -139,6 +140,7 @@ static device_method_t psycho_methods[] 
 	DEVMETHOD(bus_activate_resource,	psycho_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,	psycho_deactivate_resource),
 	DEVMETHOD(bus_release_resource,	psycho_release_resource),
+	DEVMETHOD(bus_describe_intr,	psycho_describe_intr),
 	DEVMETHOD(bus_get_dma_tag,	psycho_get_dma_tag),
 
 	/* pcib interface */
@@ -1246,6 +1248,18 @@ psycho_teardown_intr(device_t dev, devic
 	return (bus_generic_teardown_intr(dev, child, vec, cookie));
 }
 
+static int
+psycho_describe_intr(device_t dev, device_t child, struct resource *vec,
+    void *cookie, const char *descr)
+{
+	struct psycho_softc *sc;
+
+	sc = device_get_softc(dev);
+	if (sc->sc_mode == PSYCHO_MODE_SABRE)
+		cookie = ((struct psycho_dma_sync *)cookie)->pds_cookie;
+	return (bus_generic_describe_intr(dev, child, vec, cookie, descr));
+}
+
 static struct resource *
 psycho_alloc_resource(device_t bus, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)

Modified: head/sys/sparc64/pci/schizo.c
==============================================================================
--- head/sys/sparc64/pci/schizo.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/pci/schizo.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -113,6 +113,7 @@ static bus_alloc_resource_t schizo_alloc
 static bus_activate_resource_t schizo_activate_resource;
 static bus_deactivate_resource_t schizo_deactivate_resource;
 static bus_release_resource_t schizo_release_resource;
+static bus_describe_intr_t schizo_describe_intr;
 static bus_get_dma_tag_t schizo_get_dma_tag;
 static pcib_maxslots_t schizo_maxslots;
 static pcib_read_config_t schizo_read_config;
@@ -137,6 +138,7 @@ static device_method_t schizo_methods[] 
 	DEVMETHOD(bus_activate_resource,	schizo_activate_resource),
 	DEVMETHOD(bus_deactivate_resource,	schizo_deactivate_resource),
 	DEVMETHOD(bus_release_resource,	schizo_release_resource),
+	DEVMETHOD(bus_describe_intr,	schizo_describe_intr),
 	DEVMETHOD(bus_get_dma_tag,	schizo_get_dma_tag),
 
 	/* pcib interface */
@@ -1257,6 +1259,18 @@ schizo_teardown_intr(device_t dev, devic
 	return (bus_generic_teardown_intr(dev, child, vec, cookie));
 }
 
+static int
+schizo_describe_intr(device_t dev, device_t child, struct resource *vec,
+    void *cookie, const char *descr)
+{
+	struct schizo_softc *sc;
+
+	sc = device_get_softc(dev);
+	if ((sc->sc_flags & SCHIZO_FLAGS_CDMA) != 0)
+		cookie = ((struct schizo_dma_sync *)cookie)->sds_cookie;
+	return (bus_generic_describe_intr(dev, child, vec, cookie, descr));
+}
+
 static struct resource *
 schizo_alloc_resource(device_t bus, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)

Modified: head/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/sparc64/intr_machdep.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -413,6 +413,31 @@ inthand_remove(int vec, void *cookie)
 	return (error);
 }
 
+/* Add a description to an active interrupt handler. */
+int
+intr_describe(int vec, void *ih, const char *descr)
+{
+	struct intr_vector *iv;
+	int error;
+
+	if (vec < 0 || vec >= IV_MAX)
+		return (EINVAL);
+	sx_xlock(&intr_table_lock);
+	iv = &intr_vectors[vec];
+	if (iv == NULL) {
+		sx_xunlock(&intr_table_lock);
+		return (EINVAL);
+	}
+	error = intr_event_describe_handler(iv->iv_event, ih, descr);
+	if (error) {
+		sx_xunlock(&intr_table_lock);
+		return (error);
+	}
+	intrcnt_updatename(vec, iv->iv_event->ie_fullname, 0);
+	sx_xunlock(&intr_table_lock);
+	return (error);
+}
+
 #ifdef SMP
 /*
  * Support for balancing interrupt sources across CPUs.  For now we just

Modified: head/sys/sparc64/sparc64/nexus.c
==============================================================================
--- head/sys/sparc64/sparc64/nexus.c	Thu Dec 24 15:40:08 2009	(r200947)
+++ head/sys/sparc64/sparc64/nexus.c	Thu Dec 24 15:43:37 2009	(r200948)
@@ -90,12 +90,13 @@ static bus_activate_resource_t nexus_act
 static bus_deactivate_resource_t nexus_deactivate_resource;
 static bus_release_resource_t nexus_release_resource;
 static bus_get_resource_list_t nexus_get_resource_list;
+#ifdef SMP
+static bus_bind_intr_t nexus_bind_intr;
+#endif
+static bus_describe_intr_t nexus_describe_intr;
 static bus_get_dma_tag_t nexus_get_dma_tag;
 static ofw_bus_get_devinfo_t nexus_get_devinfo;
 
-#ifdef SMP
-static int nexus_bind_intr(device_t, device_t, struct resource *, int);
-#endif
 static int nexus_inlist(const char *, const char *const *);
 static struct nexus_devinfo * nexus_setup_dinfo(device_t, phandle_t);
 static void nexus_destroy_dinfo(struct nexus_devinfo *);
@@ -128,6 +129,7 @@ static device_method_t nexus_methods[] =
 #ifdef SMP
 	DEVMETHOD(bus_bind_intr,	nexus_bind_intr),
 #endif
+	DEVMETHOD(bus_describe_intr,	nexus_describe_intr),
 	DEVMETHOD(bus_get_dma_tag,	nexus_get_dma_tag),
 
 	/* ofw_bus interface */
@@ -329,6 +331,14 @@ nexus_bind_intr(device_t dev, device_t c
 }
 #endif
 
+static int
+nexus_describe_intr(device_t dev, device_t child, struct resource *r,
+    void *cookie, const char *descr)
+{
+
+	return (intr_describe(rman_get_start(r), cookie, descr));
+}
+
 static struct resource *
 nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 17:09:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5CB75106568D;
	Thu, 24 Dec 2009 17:09:47 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E05F8FC1C;
	Thu, 24 Dec 2009 17:09:46 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBOH5rJu085011;
	Thu, 24 Dec 2009 10:05:53 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Thu, 24 Dec 2009 10:06:31 -0700 (MST)
Message-Id: <20091224.100631.354966604298475976.imp@bsdimp.com>
To: ru@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <20091224144136.GA28793@edoofus.dev.vega.ru>
References: <20091221.211648.632868945383134253.imp@bsdimp.com>
	<4B3129CD.20908@FreeBSD.org>
	<20091224144136.GA28793@edoofus.dev.vega.ru>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: dougb@freebsd.org, jhb@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, marius@alchemy.franken.de,
	svn-src-head@freebsd.org
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 17:09:47 -0000

In message: <20091224144136.GA28793@edoofus.dev.vega.ru>
            Ruslan Ermilov  writes:
: On Tue, Dec 22, 2009 at 12:19:25PM -0800, Doug Barton wrote:
: > In the short term I think we are well served on all fronts to modify
: > the build architecture to better support compilers from ports. This
: > would actually help with the llvm/clang testing too, and sidestep the
: > problems of gplv3 stuff being in the base. TMK there has been no work
: > on this direction at all, which is disappointing.
: 
: If you take GNU binutils/compiler from ports, I think we can already
: do this, and without any changes to the build architecture.  It's
: just a matter of defining several make(1) variables, like CC, CXX,
: CPP, LD, AS, NM, AR, specifying full paths of the desired binaries,
: plus some environment variables (at least STRIPBIN, so that install(1)
: calls the correct strip(1) binary).

Don't you have to replace them as a pair?  And the list of variables
is kinda long...  And there's no real way to say use gcc from the
tree, but use binutils from ports.

Warner

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 17:22:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12A7A1065676;
	Thu, 24 Dec 2009 17:22:16 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0196C8FC17;
	Thu, 24 Dec 2009 17:22:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOHMFN3036403;
	Thu, 24 Dec 2009 17:22:15 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOHMFdX036400;
	Thu, 24 Dec 2009 17:22:15 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912241722.nBOHMFdX036400@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 24 Dec 2009 17:22:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200950 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 17:22:16 -0000

Author: yongari
Date: Thu Dec 24 17:22:15 2009
New Revision: 200950
URL: http://svn.freebsd.org/changeset/base/200950

Log:
  Implement RX interrupt moderation using one-shot timer interrupt.
  Unlike TX interrupt, ST201 does not provide any mechanism to
  suppress RX interrupts. ste(4) can generate more than 70k RX
  interrupts under heavy RX traffics such that these excessive
  interrupts make system useless to process other useful things.
  Maybe this was the major reason why polling support code was
  introduced to ste(4).
  The STE_COUNTDOWN register provides a programmable counter that
  will generate an interrupt upon its expiration. We program
  STE_DMACTL register to use 3.2us clock rate to drive the counter
  register. Whenever ste(4) serves RX interrupt, the driver rearm
  the timer to expire after STE_IM_RX_TIMER_DEFAULT time and disables
  further generation of RX interrupts. This trick seems to work well
  and ste(4) generates less than 8k RX interrupts even under 64 bytes
  UDP torture test. Combined with TX interrupts, the total number of
  interrupts are less than 10k which looks reasonable on heavily
  loaded controller.
  
  The default RX interrupt moderation time is 150us. Users can change
  the value at any time with dev.ste.%d.int_rx_mod sysctl node.
  Setting it 0 effectively disables the RX interrupt moderation
  feature. Now we have both TX/RX interrupt moderation code so remove
  loop of interrupt handler which resulted in sub-optimal performance
  as well as more register accesses.

Modified:
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Thu Dec 24 17:06:54 2009	(r200949)
+++ head/sys/dev/ste/if_ste.c	Thu Dec 24 17:22:15 2009	(r200950)
@@ -659,7 +659,7 @@ ste_intr(void *xsc)
 {
 	struct ste_softc *sc;
 	struct ifnet *ifp;
-	uint16_t status;
+	uint16_t intrs, status;
 
 	sc = xsc;
 	STE_LOCK(sc);
@@ -671,43 +671,67 @@ ste_intr(void *xsc)
 		return;
 	}
 #endif
-
-	/* See if this is really our interrupt. */
-	if (!(CSR_READ_2(sc, STE_ISR) & STE_ISR_INTLATCH)) {
+	/* Reading STE_ISR_ACK clears STE_IMR register. */
+	status = CSR_READ_2(sc, STE_ISR_ACK);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
 		STE_UNLOCK(sc);
 		return;
 	}
 
-	for (;;) {
-		status = CSR_READ_2(sc, STE_ISR_ACK);
-
-		if (!(status & STE_INTRS))
-			break;
+	intrs = STE_INTRS;
+	if (status == 0xFFFF || (status & intrs) == 0)
+		goto done;
 
-		if (status & STE_ISR_RX_DMADONE)
-			ste_rxeof(sc, -1);
+	if (sc->ste_int_rx_act > 0) {
+		status &= ~STE_ISR_RX_DMADONE;
+		intrs &= ~STE_IMR_RX_DMADONE;
+	}
 
-		if (status & STE_ISR_TX_DMADONE)
+	if ((status & (STE_ISR_SOFTINTR | STE_ISR_RX_DMADONE)) != 0) {
+		ste_rxeof(sc, -1);
+		/*
+		 * The controller has no ability to Rx interrupt
+		 * moderation feature. Receiving 64 bytes frames
+		 * from wire generates too many interrupts which in
+		 * turn make system useless to process other useful
+		 * things. Fortunately ST201 supports single shot
+		 * timer so use the timer to implement Rx interrupt
+		 * moderation in driver. This adds more register
+		 * access but it greatly reduces number of Rx
+		 * interrupts under high network load.
+		 */
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
+		    (sc->ste_int_rx_mod != 0)) {
+			if ((status & STE_ISR_RX_DMADONE) != 0) {
+				CSR_WRITE_2(sc, STE_COUNTDOWN,
+				    STE_TIMER_USECS(sc->ste_int_rx_mod));
+				intrs &= ~STE_IMR_RX_DMADONE;
+				sc->ste_int_rx_act = 1;
+			} else {
+				intrs |= STE_IMR_RX_DMADONE;
+				sc->ste_int_rx_act = 0;
+			}
+		}
+	}
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+		if ((status & STE_ISR_TX_DMADONE) != 0)
 			ste_txeof(sc);
-
-		if (status & STE_ISR_TX_DONE)
+		if ((status & STE_ISR_TX_DONE) != 0)
 			ste_txeoc(sc);
-
-		if (status & STE_ISR_STATS_OFLOW)
+		if ((status & STE_ISR_STATS_OFLOW) != 0)
 			ste_stats_update(sc);
-
-		if (status & STE_ISR_HOSTERR) {
-			ste_init_locked(sc);
+		if ((status & STE_ISR_HOSTERR) != 0) {
 			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+			ste_init_locked(sc);
+			STE_UNLOCK(sc);
+			return;
 		}
+		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+			ste_start_locked(ifp);
+done:
+		/* Re-enable interrupts */
+		CSR_WRITE_2(sc, STE_IMR, intrs);
 	}
-
-	/* Re-enable interrupts */
-	CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
-
-	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		ste_start_locked(ifp);
-
 	STE_UNLOCK(sc);
 }
 
@@ -1538,6 +1562,7 @@ ste_init_rx_list(struct ste_softc *sc)
 	struct ste_list_data *ld;
 	int error, i;
 
+	sc->ste_int_rx_act = 0;
 	cd = &sc->ste_cdata;
 	ld = &sc->ste_ldata;
 	bzero(ld->ste_rx_list, STE_RX_LIST_SZ);
@@ -1684,6 +1709,9 @@ ste_init_locked(struct ste_softc *sc)
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
 	STE_SETBIT4(sc, STE_DMACTL, STE_DMACTL_TXDMA_UNSTALL);
 	ste_wait(sc);
+	/* Select 3.2us timer. */
+	STE_CLRBIT4(sc, STE_DMACTL, STE_DMACTL_COUNTDOWN_SPEED |
+	    STE_DMACTL_COUNTDOWN_MODE);
 
 	/* Enable receiver and transmitter */
 	CSR_WRITE_2(sc, STE_MACCTL0, 0);
@@ -1696,6 +1724,7 @@ ste_init_locked(struct ste_softc *sc)
 	/* Clear stats counters. */
 	ste_stats_clear(sc);
 
+	CSR_WRITE_2(sc, STE_COUNTDOWN, 0);
 	CSR_WRITE_2(sc, STE_ISR, 0xFFFF);
 #ifdef DEVICE_POLLING
 	/* Disable interrupts if we are polling. */
@@ -1733,6 +1762,7 @@ ste_stop(struct ste_softc *sc)
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING|IFF_DRV_OACTIVE);
 
 	CSR_WRITE_2(sc, STE_IMR, 0);
+	CSR_WRITE_2(sc, STE_COUNTDOWN, 0);
 	/* Stop pending DMA. */
 	val = CSR_READ_4(sc, STE_DMACTL);
 	val |= STE_DMACTL_TXDMA_STALL | STE_DMACTL_RXDMA_STALL;
@@ -2105,6 +2135,13 @@ ste_sysctl_node(struct ste_softc *sc)
 	ctx = device_get_sysctl_ctx(sc->ste_dev);
 	child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ste_dev));
 
+	SYSCTL_ADD_INT(ctx, child, OID_AUTO, "int_rx_mod",
+	    CTLFLAG_RW, &sc->ste_int_rx_mod, 0, "ste RX interrupt moderation");
+	/* Pull in device tunables. */
+	sc->ste_int_rx_mod = STE_IM_RX_TIMER_DEFAULT;
+	resource_int_value(device_get_name(sc->ste_dev),
+	    device_get_unit(sc->ste_dev), "int_rx_mod", &sc->ste_int_rx_mod);
+
 	tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD,
 	    NULL, "STE statistics");
 	parent = SYSCTL_CHILDREN(tree);

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Thu Dec 24 17:06:54 2009	(r200949)
+++ head/sys/dev/ste/if_stereg.h	Thu Dec 24 17:22:15 2009	(r200950)
@@ -285,7 +285,8 @@
 
 #define STE_INTRS				\
 	(STE_IMR_RX_DMADONE|STE_IMR_TX_DMADONE|	\
-	STE_IMR_TX_DONE|STE_IMR_HOSTERR)
+	STE_IMR_TX_DONE|STE_IMR_SOFTINTR|	\
+	STE_IMR_HOSTERR)
 
 #define STE_ISR_INTLATCH		0x0001
 #define STE_ISR_HOSTERR			0x0002
@@ -349,6 +350,13 @@
 #define STE_PHYCTL_SPEEDSTAT		0x40
 #define STE_PHYCTL_LINKSTAT		0x80
 
+#define	STE_TIMER_TICKS			32
+#define	STE_TIMER_USECS(x)		((x * 10) / STE_TIMER_TICKS)
+
+#define	STE_IM_RX_TIMER_MIN		0
+#define	STE_IM_RX_TIMER_MAX		209712
+#define	STE_IM_RX_TIMER_DEFAULT		150
+
 /*
  * EEPROM offsets.
  */
@@ -570,6 +578,8 @@ struct ste_softc {
 #define	STE_FLAG_LINK		0x8000
 	int			ste_if_flags;
 	int			ste_timer;
+	int			ste_int_rx_act;
+	int			ste_int_rx_mod;
 	struct ste_list_data	ste_ldata;
 	struct ste_chain_data	ste_cdata;
 	struct callout		ste_callout;

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 17:35:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B23F8106568F;
	Thu, 24 Dec 2009 17:35:28 +0000 (UTC)
	(envelope-from luigi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 882578FC12;
	Thu, 24 Dec 2009 17:35:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOHZSil036685;
	Thu, 24 Dec 2009 17:35:28 GMT (envelope-from luigi@svn.freebsd.org)
Received: (from luigi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOHZSfj036683;
	Thu, 24 Dec 2009 17:35:28 GMT (envelope-from luigi@svn.freebsd.org)
Message-Id: <200912241735.nBOHZSfj036683@svn.freebsd.org>
From: Luigi Rizzo 
Date: Thu, 24 Dec 2009 17:35:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200951 - head/sys/netinet/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 17:35:28 -0000

Author: luigi
Date: Thu Dec 24 17:35:28 2009
New Revision: 200951
URL: http://svn.freebsd.org/changeset/base/200951

Log:
  fix poor indentation resulting from a merge

Modified:
  head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_sockopt.c	Thu Dec 24 17:22:15 2009	(r200950)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c	Thu Dec 24 17:35:28 2009	(r200951)
@@ -311,7 +311,7 @@ del_entry(struct ip_fw_chain *chain, u_i
 			map = get_map(chain, -n, 1 /* locked */);
 		if (n == 0 || map == NULL) {
 			error = EINVAL;
-		break;
+			break;
 		}
 		/* copy the initial part of the map */
 		if (start > 0)
@@ -443,13 +443,13 @@ zero_entry(struct ip_fw_chain *chain, u_
 		for (i = 0; i < chain->n_rules; i++) {
 			rule = chain->map[i];
 			if (rule->rulenum == rulenum) {
-					if (cmd == 0 || rule->set == set)
-						clear_counters(rule, log_only);
+				if (cmd == 0 || rule->set == set)
+					clear_counters(rule, log_only);
 				cleared = 1;
 			}
 			if (rule->rulenum > rulenum)
 				break;
-			}
+		}
 		if (!cleared) {	/* we did not find any matching rules */
 			IPFW_WUNLOCK(chain);
 			return (EINVAL);
@@ -801,16 +801,16 @@ ipfw_getrules(struct ip_fw_chain *chain,
 		}
 		dst = (struct ip_fw *)bp;
 		bcopy(rule, dst, l);
-			/*
-			 * XXX HACK. Store the disable mask in the "next"
-			 * pointer in a wild attempt to keep the ABI the same.
-			 * Why do we do this on EVERY rule?
-			 */
+		/*
+		 * XXX HACK. Store the disable mask in the "next"
+		 * pointer in a wild attempt to keep the ABI the same.
+		 * Why do we do this on EVERY rule?
+		 */
 		bcopy(&V_set_disable, &dst->next_rule, sizeof(V_set_disable));
 		if (dst->timestamp)
 			dst->timestamp += boot_seconds;
 		bp += l;
-		}
+	}
 	ipfw_get_dynamic(&bp, ep); /* protected by the dynamic lock */
 	return (bp - (char *)buf);
 }
@@ -865,9 +865,9 @@ ipfw_ctl(struct sockopt *sopt)
 
 			size = chain->static_len;
 			size += ipfw_dyn_len();
-		if (size >= sopt->sopt_valsize)
-			break;
-		buf = malloc(size, M_TEMP, M_WAITOK);
+			if (size >= sopt->sopt_valsize)
+				break;
+			buf = malloc(size, M_TEMP, M_WAITOK);
 			if (buf == NULL)
 				break;
 			IPFW_UH_RLOCK(chain);
@@ -878,7 +878,7 @@ ipfw_ctl(struct sockopt *sopt)
 			IPFW_UH_RUNLOCK(chain);
 			if (size >= want)
 				error = sooptcopyout(sopt, buf, len);
-		free(buf, M_TEMP);
+			free(buf, M_TEMP);
 			if (size >= want)
 				break;
 		}

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 17:55:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE1FA106566C;
	Thu, 24 Dec 2009 17:55:47 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B37A08FC14;
	Thu, 24 Dec 2009 17:55:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOHtlxW037123;
	Thu, 24 Dec 2009 17:55:47 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOHtluJ037119;
	Thu, 24 Dec 2009 17:55:47 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912241755.nBOHtluJ037119@svn.freebsd.org>
From: Ed Schouten 
Date: Thu, 24 Dec 2009 17:55:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200953 - head/usr.sbin/bsnmpd/modules/snmp_hostres
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 17:55:48 -0000

Author: ed
Date: Thu Dec 24 17:55:47 2009
New Revision: 200953
URL: http://svn.freebsd.org/changeset/base/200953

Log:
  Let the snmp_hostres module use utmpx.
  
  Approved by:	harti

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile	Thu Dec 24 17:35:48 2009	(r200952)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile	Thu Dec 24 17:55:47 2009	(r200953)
@@ -69,8 +69,8 @@ MAN=	snmp_hostres.3
 DEFS=	${MOD}_tree.def
 BMIBS=	BEGEMOT-HOSTRES-MIB.txt
 
-DPADD=	${LIBKVM} ${LIBDEVINFO} ${LIBM} ${LIBGEOM} ${LIBMEMSTAT}
-LDADD=	-lkvm -ldevinfo -lm -lgeom -lmemstat
+DPADD=	${LIBKVM} ${LIBDEVINFO} ${LIBM} ${LIBGEOM} ${LIBMEMSTAT} ${LIBULOG}
+LDADD=	-lkvm -ldevinfo -lm -lgeom -lmemstat -lulog
 
 .include 
 

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c	Thu Dec 24 17:35:48 2009	(r200952)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c	Thu Dec 24 17:55:47 2009	(r200953)
@@ -41,15 +41,13 @@
 #include 
 #include 
 #include 
-#include 
+#define	_ULOG_POSIX_NAMES
+#include 
 
 #include "hostres_snmp.h"
 #include "hostres_oid.h"
 #include "hostres_tree.h"
 
-/* file pointer to keep an open instance of utmp */
-static FILE *utmp_fp;
-
 /* boot timestamp in centi-seconds */
 static uint64_t kernel_boot;
 
@@ -70,9 +68,6 @@ fini_scalars(void)
 {
 
 	free(boot_line);
-
-	if (utmp_fp != NULL)
-		(void)fclose(utmp_fp);
 }
 
 /**
@@ -220,30 +215,15 @@ OS_getSystemInitialLoadParameters(u_char
 static int
 OS_getSystemNumUsers(uint32_t *nu)
 {
-	struct utmp utmp;
-	static int first_time = 1;
-
-	if (utmp_fp == NULL) {
-		if (!first_time)
-			return (SNMP_ERR_GENERR);
-		first_time = 0;
-		if ((utmp_fp = fopen(_PATH_UTMP, "r")) == NULL) {
-			syslog(LOG_ERR, "fopen(%s) failed: %m", _PATH_UTMP);
-			return (SNMP_ERR_GENERR);
-		}
-	}
-
-	/* start with the begining of the utmp file */
-	(void)rewind(utmp_fp);
+	struct utmpx *utmp;
 
+	setutxent();
 	*nu = 0;
-	while (fread(&utmp, sizeof(utmp), 1, utmp_fp) == 1) {
-		if (utmp.ut_name[0] != '\0' && utmp.ut_line[0] != '\0') {
-			if (getpwnam(utmp.ut_name) == NULL)
-				continue;
+	while ((utmp = getutxent()) != NULL) {
+		if (utmp->ut_type == USER_PROCESS)
 			(*nu)++;
-		}
 	}
+	endutxent();
 
 	return (SNMP_ERR_NOERROR);
 }

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c	Thu Dec 24 17:35:48 2009	(r200952)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c	Thu Dec 24 17:55:47 2009	(r200953)
@@ -49,7 +49,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "hostres_snmp.h"
 #include "hostres_oid.h"

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 18:05:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C39E9106566B;
	Thu, 24 Dec 2009 18:05:33 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B2AB58FC15;
	Thu, 24 Dec 2009 18:05:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOI5XPL037352;
	Thu, 24 Dec 2009 18:05:33 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOI5XPB037349;
	Thu, 24 Dec 2009 18:05:33 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912241805.nBOI5XPB037349@svn.freebsd.org>
From: Ed Schouten 
Date: Thu, 24 Dec 2009 18:05:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200954 - head/usr.sbin/syslogd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 18:05:34 -0000

Author: ed
Date: Thu Dec 24 18:05:33 2009
New Revision: 200954
URL: http://svn.freebsd.org/changeset/base/200954

Log:
  Let syslogd use utmpx.
  
  Because strings are guaranteed to be null terminated, there is no need
  for excessive copying of strings, such as the line name.

Modified:
  head/usr.sbin/syslogd/Makefile
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/Makefile
==============================================================================
--- head/usr.sbin/syslogd/Makefile	Thu Dec 24 17:55:47 2009	(r200953)
+++ head/usr.sbin/syslogd/Makefile	Thu Dec 24 18:05:33 2009	(r200954)
@@ -9,8 +9,8 @@ PROG=	syslogd
 MAN=	syslog.conf.5 syslogd.8
 SRCS=	syslogd.c ttymsg.c
 
-DPADD=	${LIBUTIL}
-LDADD=	-lutil
+DPADD=	${LIBULOG} ${LIBUTIL}
+LDADD=	-lulog -lutil
 
 WARNS?=	3
 

Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c	Thu Dec 24 17:55:47 2009	(r200953)
+++ head/usr.sbin/syslogd/syslogd.c	Thu Dec 24 18:05:33 2009	(r200954)
@@ -105,8 +105,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#define	_ULOG_POSIX_NAMES
+#include 
 #include 
-#include 
 
 #include "pathnames.h"
 #include "ttymsg.h"
@@ -171,7 +172,7 @@ struct filed {
 #define PRI_GT	0x4
 	char	*f_program;		/* program this applies to */
 	union {
-		char	f_uname[MAXUNAMES][UT_NAMESIZE+1];
+		char	f_uname[MAXUNAMES][MAXLOGNAME];
 		struct {
 			char	f_hname[MAXHOSTNAMELEN];
 			struct addrinfo *f_addr;
@@ -1342,29 +1343,20 @@ static void
 wallmsg(struct filed *f, struct iovec *iov, const int iovlen)
 {
 	static int reenter;			/* avoid calling ourselves */
-	FILE *uf;
-	struct utmp ut;
+	struct utmpx *ut;
 	int i;
 	const char *p;
-	char line[sizeof(ut.ut_line) + 1];
 
 	if (reenter++)
 		return;
-	if ((uf = fopen(_PATH_UTMP, "r")) == NULL) {
-		logerror(_PATH_UTMP);
-		reenter = 0;
-		return;
-	}
+	setutxent();
 	/* NOSTRICT */
-	while (fread((char *)&ut, sizeof(ut), 1, uf) == 1) {
-		if (ut.ut_name[0] == '\0')
+	while ((ut = getutxent()) != NULL) {
+		if (ut->ut_type != USER_PROCESS)
 			continue;
-		/* We must use strncpy since ut_* may not be NUL terminated. */
-		strncpy(line, ut.ut_line, sizeof(line) - 1);
-		line[sizeof(line) - 1] = '\0';
 		if (f->f_type == F_WALL) {
-			if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME)) !=
-			    NULL) {
+			if ((p = ttymsg(iov, iovlen, ut->ut_line,
+			    TTYMSGTIME)) != NULL) {
 				errno = 0;	/* already in msg */
 				logerror(p);
 			}
@@ -1374,10 +1366,9 @@ wallmsg(struct filed *f, struct iovec *i
 		for (i = 0; i < MAXUNAMES; i++) {
 			if (!f->f_un.f_uname[i][0])
 				break;
-			if (!strncmp(f->f_un.f_uname[i], ut.ut_name,
-			    UT_NAMESIZE)) {
-				if ((p = ttymsg(iov, iovlen, line, TTYMSGTIME))
-				    != NULL) {
+			if (!strcmp(f->f_un.f_uname[i], ut->ut_user)) {
+				if ((p = ttymsg(iov, iovlen, ut->ut_line,
+				    TTYMSGTIME)) != NULL) {
 					errno = 0;	/* already in msg */
 					logerror(p);
 				}
@@ -1385,7 +1376,7 @@ wallmsg(struct filed *f, struct iovec *i
 			}
 		}
 	}
-	(void)fclose(uf);
+	endutxent();
 	reenter = 0;
 }
 
@@ -2002,9 +1993,9 @@ cfline(const char *line, struct filed *f
 		for (i = 0; i < MAXUNAMES && *p; i++) {
 			for (q = p; *q && *q != ','; )
 				q++;
-			(void)strncpy(f->f_un.f_uname[i], p, UT_NAMESIZE);
-			if ((q - p) > UT_NAMESIZE)
-				f->f_un.f_uname[i][UT_NAMESIZE] = '\0';
+			(void)strncpy(f->f_un.f_uname[i], p, MAXLOGNAME - 1);
+			if ((q - p) >= MAXLOGNAME)
+				f->f_un.f_uname[i][MAXLOGNAME - 1] = '\0';
 			else
 				f->f_un.f_uname[i][q - p] = '\0';
 			while (*q == ',' || *q == ' ')

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 18:17:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8213F1065697;
	Thu, 24 Dec 2009 18:17:53 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 70A0E8FC16;
	Thu, 24 Dec 2009 18:17:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOIHrmU037637;
	Thu, 24 Dec 2009 18:17:53 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOIHrLB037635;
	Thu, 24 Dec 2009 18:17:53 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912241817.nBOIHrLB037635@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 24 Dec 2009 18:17:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200955 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 18:17:53 -0000

Author: yongari
Date: Thu Dec 24 18:17:53 2009
New Revision: 200955
URL: http://svn.freebsd.org/changeset/base/200955

Log:
  Add suspend/resume support as well as basic WOL.
  While I'm here simplify SIOCSIFCAP handler.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Thu Dec 24 18:05:33 2009	(r200954)
+++ head/sys/dev/ste/if_ste.c	Thu Dec 24 18:17:53 2009	(r200955)
@@ -94,7 +94,9 @@ static struct ste_type ste_devs[] = {
 static int	ste_attach(device_t);
 static int	ste_detach(device_t);
 static int	ste_probe(device_t);
+static int	ste_resume(device_t);
 static int	ste_shutdown(device_t);
+static int	ste_suspend(device_t);
 
 static int	ste_dma_alloc(struct ste_softc *);
 static void	ste_dma_free(struct ste_softc *);
@@ -123,6 +125,7 @@ static void	ste_reset(struct ste_softc *
 static void	ste_restart_tx(struct ste_softc *);
 static int	ste_rxeof(struct ste_softc *, int);
 static void	ste_rxfilter(struct ste_softc *);
+static void	ste_setwol(struct ste_softc *);
 static void	ste_start(struct ifnet *);
 static void	ste_start_locked(struct ifnet *);
 static void	ste_stats_clear(struct ste_softc *);
@@ -141,6 +144,8 @@ static device_method_t ste_methods[] = {
 	DEVMETHOD(device_attach,	ste_attach),
 	DEVMETHOD(device_detach,	ste_detach),
 	DEVMETHOD(device_shutdown,	ste_shutdown),
+	DEVMETHOD(device_suspend,	ste_suspend),
+	DEVMETHOD(device_resume,	ste_resume),
 
 	/* bus interface */
 	DEVMETHOD(bus_print_child,	bus_generic_print_child),
@@ -1059,7 +1064,7 @@ ste_attach(device_t dev)
 	struct ste_softc *sc;
 	struct ifnet *ifp;
 	u_char eaddr[6];
-	int error = 0, rid;
+	int error = 0, pmc, rid;
 
 	sc = device_get_softc(dev);
 	sc->ste_dev = dev;
@@ -1166,6 +1171,8 @@ ste_attach(device_t dev)
 	 */
 	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
 	ifp->if_capabilities |= IFCAP_VLAN_MTU;
+	if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0)
+		ifp->if_capabilities |= IFCAP_WOL_MAGIC;
 	ifp->if_capenable = ifp->if_capabilities;
 #ifdef DEVICE_POLLING
 	ifp->if_capabilities |= IFCAP_POLLING;
@@ -1642,6 +1649,7 @@ ste_init_locked(struct ste_softc *sc)
 {
 	struct ifnet *ifp;
 	struct mii_data *mii;
+	uint8_t val;
 	int i;
 
 	STE_LOCK_ASSERT(sc);
@@ -1676,6 +1684,12 @@ ste_init_locked(struct ste_softc *sc)
 	/* Init TX descriptors */
 	ste_init_tx_list(sc);
 
+	/* Clear and disable WOL. */
+	val = CSR_READ_1(sc, STE_WAKE_EVENT);
+	val &= ~(STE_WAKEEVENT_WAKEPKT_ENB | STE_WAKEEVENT_MAGICPKT_ENB |
+	    STE_WAKEEVENT_LINKEVT_ENB | STE_WAKEEVENT_WAKEONLAN_ENB);
+	CSR_WRITE_1(sc, STE_WAKE_EVENT, val);
+
 	/* Set the TX freethresh value */
 	CSR_WRITE_1(sc, STE_TX_DMABURST_THRESH, STE_PACKET_SIZE >> 8);
 
@@ -1872,7 +1886,7 @@ ste_ioctl(struct ifnet *ifp, u_long comm
 	struct ste_softc *sc;
 	struct ifreq *ifr;
 	struct mii_data *mii;
-	int error = 0;
+	int error = 0, mask;
 
 	sc = ifp->if_softc;
 	ifr = (struct ifreq *)data;
@@ -1905,31 +1919,31 @@ ste_ioctl(struct ifnet *ifp, u_long comm
 		error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
 		break;
 	case SIOCSIFCAP:
+		STE_LOCK(sc);
+		mask = ifr->ifr_reqcap ^ ifp->if_capenable;
 #ifdef DEVICE_POLLING
-		if (ifr->ifr_reqcap & IFCAP_POLLING &&
-		    !(ifp->if_capenable & IFCAP_POLLING)) {
-			error = ether_poll_register(ste_poll, ifp);
-			if (error)
-				return (error);
-			STE_LOCK(sc);
-			/* Disable interrupts */
-			CSR_WRITE_2(sc, STE_IMR, 0);
-			ifp->if_capenable |= IFCAP_POLLING;
-			STE_UNLOCK(sc);
-			return (error);
-
-		}
-		if (!(ifr->ifr_reqcap & IFCAP_POLLING) &&
-		    ifp->if_capenable & IFCAP_POLLING) {
-			error = ether_poll_deregister(ifp);
-			/* Enable interrupts. */
-			STE_LOCK(sc);
-			CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
-			ifp->if_capenable &= ~IFCAP_POLLING;
-			STE_UNLOCK(sc);
-			return (error);
+		if ((mask & IFCAP_POLLING) != 0 &&
+		    (IFCAP_POLLING & ifp->if_capabilities) != 0) {
+			ifp->if_capenable ^= IFCAP_POLLING;
+			if ((IFCAP_POLLING & ifp->if_capenable) != 0) {
+				error = ether_poll_register(ste_poll, ifp);
+				if (error != 0) {
+					STE_UNLOCK(sc);
+					break;
+				}
+				/* Disable interrupts. */
+				CSR_WRITE_2(sc, STE_IMR, 0);
+			} else {
+				error = ether_poll_deregister(ifp);
+				/* Enable interrupts. */
+				CSR_WRITE_2(sc, STE_IMR, STE_INTRS);
+			}
 		}
 #endif /* DEVICE_POLLING */
+		if ((mask & IFCAP_WOL_MAGIC) != 0 &&
+		    (ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
+			ifp->if_capenable ^= IFCAP_WOL_MAGIC;
+		STE_UNLOCK(sc);
 		break;
 	default:
 		error = ether_ioctl(ifp, command, data);
@@ -2107,12 +2121,50 @@ ste_watchdog(struct ste_softc *sc)
 static int
 ste_shutdown(device_t dev)
 {
+
+	return (ste_suspend(dev));
+}
+
+static int
+ste_suspend(device_t dev)
+{
 	struct ste_softc *sc;
 
 	sc = device_get_softc(dev);
 
 	STE_LOCK(sc);
 	ste_stop(sc);
+	ste_setwol(sc);
+	STE_UNLOCK(sc);
+
+	return (0);
+}
+
+static int
+ste_resume(device_t dev)
+{
+	struct ste_softc *sc;
+	struct ifnet *ifp;
+	int pmc;
+	uint16_t pmstat;
+
+	sc = device_get_softc(dev);
+	STE_LOCK(sc);
+	if (pci_find_extcap(sc->ste_dev, PCIY_PMG, &pmc) == 0) {
+		/* Disable PME and clear PME status. */
+		pmstat = pci_read_config(sc->ste_dev,
+		    pmc + PCIR_POWER_STATUS, 2);
+		if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) {
+			pmstat &= ~PCIM_PSTAT_PMEENABLE;
+			pci_write_config(sc->ste_dev,
+			    pmc + PCIR_POWER_STATUS, pmstat, 2);
+		}
+	}
+	ifp = sc->ste_ifp;
+	if ((ifp->if_flags & IFF_UP) != 0) {
+		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+		ste_init_locked(sc);
+	}
 	STE_UNLOCK(sc);
 
 	return (0);
@@ -2191,3 +2243,35 @@ ste_sysctl_node(struct ste_softc *sc)
 
 #undef STE_SYSCTL_STAT_ADD32
 #undef STE_SYSCTL_STAT_ADD64
+
+static void
+ste_setwol(struct ste_softc *sc)
+{
+	struct ifnet *ifp;
+	uint16_t pmstat;
+	uint8_t val;
+	int pmc;
+
+	STE_LOCK_ASSERT(sc);
+
+	if (pci_find_extcap(sc->ste_dev, PCIY_PMG, &pmc) != 0) {
+		/* Disable WOL. */
+		CSR_READ_1(sc, STE_WAKE_EVENT);
+		CSR_WRITE_1(sc, STE_WAKE_EVENT, 0);
+		return;
+	}
+
+	ifp = sc->ste_ifp;
+	val = CSR_READ_1(sc, STE_WAKE_EVENT);
+	val &= ~(STE_WAKEEVENT_WAKEPKT_ENB | STE_WAKEEVENT_MAGICPKT_ENB |
+	    STE_WAKEEVENT_LINKEVT_ENB | STE_WAKEEVENT_WAKEONLAN_ENB);
+	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
+		val |= STE_WAKEEVENT_MAGICPKT_ENB | STE_WAKEEVENT_WAKEONLAN_ENB;
+	CSR_WRITE_1(sc, STE_WAKE_EVENT, val);
+	/* Request PME. */
+	pmstat = pci_read_config(sc->ste_dev, pmc + PCIR_POWER_STATUS, 2);
+	pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
+	if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0)
+		pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
+	pci_write_config(sc->ste_dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
+}

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 18:29:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 84458106568B; Thu, 24 Dec 2009 18:29:09 +0000 (UTC)
Date: Thu, 24 Dec 2009 18:29:09 +0000
From: Alexey Dokuchaev 
To: John Baldwin 
Message-ID: <20091224182909.GA53308@FreeBSD.org>
References: <200912241432.nBOEWBSj032804@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <200912241432.nBOEWBSj032804@svn.freebsd.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200941 - in head/tools/tools: . notescheck
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 18:29:09 -0000

On Thu, Dec 24, 2009 at 02:32:11PM +0000, John Baldwin wrote:
> Author: jhb
> Date: Thu Dec 24 14:32:11 2009
> New Revision: 200941
> URL: http://svn.freebsd.org/changeset/base/200941
> 
> Log:
>   Add a new tool which attempts to check for kernel configuration options that
>   are missing from NOTES files.

Sounds like very nice tool.  Thanks!

./danfe

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 18:41:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3615E106566B;
	Thu, 24 Dec 2009 18:41:15 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2346C8FC15;
	Thu, 24 Dec 2009 18:41:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOIfERN038091;
	Thu, 24 Dec 2009 18:41:14 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOIfEpb038062;
	Thu, 24 Dec 2009 18:41:14 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912241841.nBOIfEpb038062@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 24 Dec 2009 18:41:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200956 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 18:41:15 -0000

Author: jilles
Date: Thu Dec 24 18:41:14 2009
New Revision: 200956
URL: http://svn.freebsd.org/changeset/base/200956

Log:
  sh: Constify various strings.
  
  Most of this is adding const keywords, but setvar() in var.c had to be
  changed somewhat more.

Modified:
  head/bin/sh/alias.c
  head/bin/sh/alias.h
  head/bin/sh/arith.h
  head/bin/sh/arith.y
  head/bin/sh/cd.c
  head/bin/sh/exec.c
  head/bin/sh/exec.h
  head/bin/sh/expand.c
  head/bin/sh/expand.h
  head/bin/sh/histedit.c
  head/bin/sh/input.c
  head/bin/sh/input.h
  head/bin/sh/mail.c
  head/bin/sh/main.c
  head/bin/sh/main.h
  head/bin/sh/memalloc.c
  head/bin/sh/memalloc.h
  head/bin/sh/myhistedit.h
  head/bin/sh/options.c
  head/bin/sh/options.h
  head/bin/sh/output.c
  head/bin/sh/output.h
  head/bin/sh/parser.c
  head/bin/sh/parser.h
  head/bin/sh/show.c
  head/bin/sh/show.h
  head/bin/sh/var.c
  head/bin/sh/var.h

Modified: head/bin/sh/alias.c
==============================================================================
--- head/bin/sh/alias.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/alias.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -52,13 +52,13 @@ __FBSDID("$FreeBSD$");
 STATIC struct alias *atab[ATABSIZE];
 STATIC int aliases;
 
-STATIC void setalias(char *, char *);
+STATIC void setalias(const char *, const char *);
 STATIC int unalias(const char *);
 STATIC struct alias **hashalias(const char *);
 
 STATIC
 void
-setalias(char *name, char *val)
+setalias(const char *name, const char *val)
 {
 	struct alias *ap, **app;
 
@@ -176,7 +176,7 @@ rmaliases(void)
 }
 
 struct alias *
-lookupalias(char *name, int check)
+lookupalias(const char *name, int check)
 {
 	struct alias *ap = *hashalias(name);
 

Modified: head/bin/sh/alias.h
==============================================================================
--- head/bin/sh/alias.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/alias.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -42,7 +42,7 @@ struct alias {
 	int flag;
 };
 
-struct alias *lookupalias(char *, int);
+struct alias *lookupalias(const char *, int);
 int aliascmd(int, char **);
 int unaliascmd(int, char **);
 void rmaliases(void);

Modified: head/bin/sh/arith.h
==============================================================================
--- head/bin/sh/arith.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/arith.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -34,8 +34,8 @@
 
 #define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3)
 
-extern char *arith_buf, *arith_startbuf;
+extern const char *arith_buf, *arith_startbuf;
 
-arith_t arith(char *);
+arith_t arith(const char *);
 void arith_lex_reset(void);
 int expcmd(int, char **);

Modified: head/bin/sh/arith.y
==============================================================================
--- head/bin/sh/arith.y	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/arith.y	Thu Dec 24 18:41:14 2009	(r200956)
@@ -265,7 +265,7 @@ expr:
 #define YYPARSE_PARAM_TYPE arith_t *
 #define YYPARSE_PARAM result
 
-char *arith_buf, *arith_startbuf;
+const char *arith_buf, *arith_startbuf;
 
 int yylex(void);
 int yyparse(YYPARSE_PARAM_TYPE);
@@ -284,7 +284,7 @@ arith_assign(char *name, arith_t value)
 }
 
 arith_t
-arith(char *s)
+arith(const char *s)
 {
 	arith_t result;
 
@@ -299,7 +299,7 @@ arith(char *s)
 }
 
 static void
-yyerror(char *s)
+yyerror(const char *s)
 {
 
 	yyerrok;
@@ -354,7 +354,7 @@ main(int argc, char *argv[])
 	printf("%d\n", exp(argv[1]));
 }
 
-error(char *s)
+error(const char *s)
 {
 	fprintf(stderr, "exp: %s\n", s);
 	exit(1);

Modified: head/bin/sh/cd.c
==============================================================================
--- head/bin/sh/cd.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/cd.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -80,7 +80,7 @@ int
 cdcmd(int argc, char **argv)
 {
 	char *dest;
-	char *path;
+	const char *path;
 	char *p;
 	struct stat statb;
 	int ch, phys, print = 0;

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/exec.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -98,7 +98,7 @@ int exerrno = 0;			/* Last exec error */
 
 STATIC void tryexec(char *, char **, char **);
 STATIC void printentry(struct tblentry *, int);
-STATIC struct tblentry *cmdlookup(char *, int);
+STATIC struct tblentry *cmdlookup(const char *, int);
 STATIC void delete_cmd_entry(void);
 
 
@@ -109,7 +109,7 @@ STATIC void delete_cmd_entry(void);
  */
 
 void
-shellexec(char **argv, char **envp, char *path, int index)
+shellexec(char **argv, char **envp, const char *path, int index)
 {
 	char *cmdname;
 	int e;
@@ -175,13 +175,13 @@ tryexec(char *cmd, char **argv, char **e
  * NULL.
  */
 
-char *pathopt;
+const char *pathopt;
 
 char *
-padvance(char **path, char *name)
+padvance(const char **path, const char *name)
 {
-	char *p, *q;
-	char *start;
+	const char *p, *start;
+	char *q;
 	int len;
 
 	if (*path == NULL)
@@ -269,7 +269,7 @@ STATIC void
 printentry(struct tblentry *cmdp, int verbose)
 {
 	int index;
-	char *path;
+	const char *path;
 	char *name;
 
 	if (cmdp->cmdtype == CMDNORMAL) {
@@ -310,7 +310,8 @@ printentry(struct tblentry *cmdp, int ve
  */
 
 void
-find_command(char *name, struct cmdentry *entry, int printerr, char *path)
+find_command(const char *name, struct cmdentry *entry, int printerr,
+    const char *path)
 {
 	struct tblentry *cmdp;
 	int index;
@@ -446,7 +447,7 @@ success:
  */
 
 int
-find_builtin(char *name, int *special)
+find_builtin(const char *name, int *special)
 {
 	const struct builtincmd *bp;
 
@@ -608,10 +609,10 @@ STATIC struct tblentry **lastcmdentry;
 
 
 STATIC struct tblentry *
-cmdlookup(char *name, int add)
+cmdlookup(const char *name, int add)
 {
 	int hashval;
-	char *p;
+	const char *p;
 	struct tblentry *cmdp;
 	struct tblentry **pp;
 
@@ -664,7 +665,7 @@ delete_cmd_entry(void)
  */
 
 void
-addcmdentry(char *name, struct cmdentry *entry)
+addcmdentry(const char *name, struct cmdentry *entry)
 {
 	struct tblentry *cmdp;
 
@@ -684,7 +685,7 @@ addcmdentry(char *name, struct cmdentry 
  */
 
 void
-defun(char *name, union node *func)
+defun(const char *name, union node *func)
 {
 	struct cmdentry entry;
 
@@ -701,7 +702,7 @@ defun(char *name, union node *func)
  */
 
 int
-unsetfunc(char *name)
+unsetfunc(const char *name)
 {
 	struct tblentry *cmdp;
 
@@ -767,7 +768,8 @@ typecmd_impl(int argc, char **argv, int 
 		switch (entry.cmdtype) {
 		case CMDNORMAL: {
 			if (strchr(argv[i], '/') == NULL) {
-				char *path = pathval(), *name;
+				const char *path = pathval();
+				char *name;
 				int j = entry.u.index;
 				do {
 					name = padvance(&path, argv[i]);

Modified: head/bin/sh/exec.h
==============================================================================
--- head/bin/sh/exec.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/exec.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -57,20 +57,20 @@ struct cmdentry {
 };
 
 
-extern char *pathopt;		/* set by padvance */
+extern const char *pathopt;	/* set by padvance */
 extern int exerrno;		/* last exec error */
 
-void shellexec(char **, char **, char *, int);
-char *padvance(char **, char *);
+void shellexec(char **, char **, const char *, int);
+char *padvance(const char **, const char *);
 int hashcmd(int, char **);
-void find_command(char *, struct cmdentry *, int, char *);
-int find_builtin(char *, int *);
+void find_command(const char *, struct cmdentry *, int, const char *);
+int find_builtin(const char *, int *);
 void hashcd(void);
 void changepath(const char *);
 void deletefuncs(void);
-void addcmdentry(char *, struct cmdentry *);
-void defun(char *, union node *);
-int unsetfunc(char *);
+void addcmdentry(const char *, struct cmdentry *);
+void defun(const char *, union node *);
+int unsetfunc(const char *);
 int typecmd_impl(int, char **, int);
 int typecmd(int, char **);
 void clearcmdentry(int);

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/expand.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -107,7 +107,7 @@ STATIC void expmeta(char *, char *);
 STATIC void addfname(char *);
 STATIC struct strlist *expsort(struct strlist *);
 STATIC struct strlist *msort(struct strlist *, int);
-STATIC int pmatch(char *, char *, int);
+STATIC int pmatch(const char *, const char *, int);
 STATIC char *cvtnum(int, char *);
 STATIC int collate_range_cmp(int, int);
 
@@ -1338,7 +1338,7 @@ msort(struct strlist *list, int len)
  */
 
 int
-patmatch(char *pattern, char *string, int squoted)
+patmatch(const char *pattern, const char *string, int squoted)
 {
 #ifdef notdef
 	if (pattern[0] == '!' && pattern[1] == '!')
@@ -1350,9 +1350,9 @@ patmatch(char *pattern, char *string, in
 
 
 STATIC int
-pmatch(char *pattern, char *string, int squoted)
+pmatch(const char *pattern, const char *string, int squoted)
 {
-	char *p, *q;
+	const char *p, *q;
 	char c;
 
 	p = pattern;
@@ -1400,7 +1400,7 @@ pmatch(char *pattern, char *string, int 
 			} while (*q++ != '\0');
 			return 0;
 		case '[': {
-			char *endp;
+			const char *endp;
 			int invert, found;
 			char chr;
 
@@ -1504,7 +1504,7 @@ rmescapes(char *str)
  */
 
 int
-casematch(union node *pattern, char *val)
+casematch(union node *pattern, const char *val)
 {
 	struct stackmark smark;
 	int result;

Modified: head/bin/sh/expand.h
==============================================================================
--- head/bin/sh/expand.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/expand.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -58,7 +58,7 @@ union node;
 void expandhere(union node *, int);
 void expandarg(union node *, struct arglist *, int);
 void expari(int);
-int patmatch(char *, char *, int);
+int patmatch(const char *, const char *, int);
 void rmescapes(char *);
-int casematch(union node *, char *);
+int casematch(union node *, const char *);
 int wordexpcmd(int, char **);

Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/histedit.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -406,7 +406,7 @@ fc_replace(const char *s, char *p, char 
 }
 
 int
-not_fcnumber(char *s)
+not_fcnumber(const char *s)
 {
 	if (s == NULL)
 		return (0);
@@ -416,10 +416,10 @@ not_fcnumber(char *s)
 }
 
 int
-str_to_event(char *str, int last)
+str_to_event(const char *str, int last)
 {
 	HistEvent he;
-	char *s = str;
+	const char *s = str;
 	int relative = 0;
 	int i, retval;
 

Modified: head/bin/sh/input.c
==============================================================================
--- head/bin/sh/input.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/input.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -401,7 +401,7 @@ popstring(void)
  */
 
 void
-setinputfile(char *fname, int push)
+setinputfile(const char *fname, int push)
 {
 	int fd;
 	int fd2;

Modified: head/bin/sh/input.h
==============================================================================
--- head/bin/sh/input.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/input.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -54,7 +54,7 @@ int preadateof(void);
 void pungetc(void);
 void pushstring(char *, int, void *);
 void popstring(void);
-void setinputfile(char *, int);
+void setinputfile(const char *, int);
 void setinputfd(int, int);
 void setinputstring(char *, int);
 void popfile(void);

Modified: head/bin/sh/mail.c
==============================================================================
--- head/bin/sh/mail.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/mail.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -72,7 +72,7 @@ void
 chkmail(int silent)
 {
 	int i;
-	char *mpath;
+	const char *mpath;
 	char *p;
 	char *q;
 	struct stackmark smark;

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/main.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -269,7 +269,7 @@ read_profile(char *name)
  */
 
 void
-readcmdfile(char *name)
+readcmdfile(const char *name)
 {
 	int fd;
 
@@ -296,7 +296,7 @@ find_dot_file(char *basename)
 {
 	static char localname[FILENAME_MAX+1];
 	char *fullname;
-	char *path = pathval();
+	const char *path = pathval();
 	struct stat statb;
 
 	/* don't try this for absolute or relative paths */

Modified: head/bin/sh/main.h
==============================================================================
--- head/bin/sh/main.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/main.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -36,7 +36,7 @@
 extern int rootpid;	/* pid of main shell */
 extern int rootshell;	/* true if we aren't a child of the main shell */
 
-void readcmdfile(char *);
+void readcmdfile(const char *);
 void cmdloop(int);
 int dotcmd(int, char **);
 int exitcmd(int, char **);

Modified: head/bin/sh/memalloc.c
==============================================================================
--- head/bin/sh/memalloc.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/memalloc.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -95,7 +95,7 @@ ckfree(pointer p)
  */
 
 char *
-savestr(char *s)
+savestr(const char *s)
 {
 	char *p;
 

Modified: head/bin/sh/memalloc.h
==============================================================================
--- head/bin/sh/memalloc.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/memalloc.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -51,7 +51,7 @@ extern int herefd;
 pointer ckmalloc(size_t);
 pointer ckrealloc(pointer, int);
 void ckfree(pointer);
-char *savestr(char *);
+char *savestr(const char *);
 pointer stalloc(int);
 void stunalloc(pointer);
 void setstackmark(struct stackmark *);

Modified: head/bin/sh/myhistedit.h
==============================================================================
--- head/bin/sh/myhistedit.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/myhistedit.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -39,7 +39,7 @@ extern int displayhist;
 void histedit(void);
 void sethistsize(const char *);
 int histcmd(int, char **);
-int not_fcnumber(char *);
-int str_to_event(char *, int);
+int not_fcnumber(const char *);
+int str_to_event(const char *, int);
 int bindcmd(int, char **);
 

Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/options.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -554,9 +554,10 @@ out:
  */
 
 int
-nextopt(char *optstring)
+nextopt(const char *optstring)
 {
-	char *p, *q;
+	char *p;
+	const char *q;
 	char c;
 
 	if ((p = optptr) == NULL || *p == '\0') {

Modified: head/bin/sh/options.h
==============================================================================
--- head/bin/sh/options.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/options.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -111,5 +111,5 @@ void freeparam(struct shparam *);
 int shiftcmd(int, char **);
 int setcmd(int, char **);
 int getoptscmd(int, char **);
-int nextopt(char *);
+int nextopt(const char *);
 void getoptsreset(const char *);

Modified: head/bin/sh/output.c
==============================================================================
--- head/bin/sh/output.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/output.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -314,7 +314,7 @@ doformat(struct output *dest, const char
  */
 
 int
-xwrite(int fd, char *buf, int nbytes)
+xwrite(int fd, const char *buf, int nbytes)
 {
 	int ntry;
 	int i;

Modified: head/bin/sh/output.h
==============================================================================
--- head/bin/sh/output.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/output.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -68,7 +68,7 @@ void out1fmt(const char *, ...) __printf
 void out2fmt_flush(const char *, ...) __printflike(1, 2);
 void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
 void doformat(struct output *, const char *, va_list) __printflike(2, 0);
-int xwrite(int, char *, int);
+int xwrite(int, const char *, int);
 
 #define outc(c, file)	(--(file)->nleft < 0? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c)))
 #define out1c(c)	outc(c, out1);

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/parser.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -1510,9 +1510,9 @@ noexpand(char *text)
  */
 
 int
-goodname(char *name)
+goodname(const char *name)
 {
-	char *p;
+	const char *p;
 
 	p = name;
 	if (! is_name(*p))

Modified: head/bin/sh/parser.h
==============================================================================
--- head/bin/sh/parser.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/parser.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -77,5 +77,5 @@ extern int whichprompt;		/* 1 == PS1, 2 
 
 union node *parsecmd(int);
 void fixredir(union node *, const char *, int);
-int goodname(char *);
+int goodname(const char *);
 char *getprompt(void *);

Modified: head/bin/sh/show.c
==============================================================================
--- head/bin/sh/show.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/show.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -307,7 +307,7 @@ sh_trace(const char *fmt, ...)
 
 
 void
-trputs(char *s)
+trputs(const char *s)
 {
 	if (tracefile == NULL)
 		return;

Modified: head/bin/sh/show.h
==============================================================================
--- head/bin/sh/show.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/show.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -35,6 +35,6 @@ void showtree(union node *);
 void sh_trace(const char *, ...) __printflike(1, 2);
 void trargs(char **);
 void trputc(int);
-void trputs(char *);
+void trputs(const char *);
 void opentrace(void);
 #endif

Modified: head/bin/sh/var.c
==============================================================================
--- head/bin/sh/var.c	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/var.c	Thu Dec 24 18:41:14 2009	(r200956)
@@ -122,9 +122,9 @@ STATIC const struct varinit varinit[] = 
 
 STATIC struct var *vartab[VTABSIZE];
 
-STATIC struct var **hashvar(char *);
-STATIC int varequal(char *, char *);
-STATIC int localevar(char *);
+STATIC struct var **hashvar(const char *);
+STATIC int varequal(const char *, const char *);
+STATIC int localevar(const char *);
 
 /*
  * Initialize the variable symbol tables and import the environment.
@@ -190,7 +190,7 @@ initvar(void)
  */
 
 int
-setvarsafe(char *name, char *val, int flags)
+setvarsafe(const char *name, const char *val, int flags)
 {
 	struct jmploc jmploc;
 	struct jmploc *const savehandler = handler;
@@ -215,9 +215,9 @@ setvarsafe(char *name, char *val, int fl
  */
 
 void
-setvar(char *name, char *val, int flags)
+setvar(const char *name, const char *val, int flags)
 {
-	char *p, *q;
+	const char *p;
 	int len;
 	int namelen;
 	char *nameeq;
@@ -245,19 +245,18 @@ setvar(char *name, char *val, int flags)
 	} else {
 		len += strlen(val);
 	}
-	p = nameeq = ckmalloc(len);
-	q = name;
-	while (--namelen >= 0)
-		*p++ = *q++;
-	*p++ = '=';
-	*p = '\0';
+	nameeq = ckmalloc(len);
+	memcpy(nameeq, name, namelen);
+	nameeq[namelen] = '=';
 	if (val)
-		scopy(val, p);
+		scopy(val, nameeq + namelen + 1);
+	else
+		nameeq[namelen + 1] = '\0';
 	setvareq(nameeq, flags);
 }
 
 STATIC int
-localevar(char *s)
+localevar(const char *s)
 {
 	static char *lnames[7] = {
 		"ALL", "COLLATE", "CTYPE", "MONETARY",
@@ -283,7 +282,7 @@ localevar(char *s)
  * pointer into environ where the string should not be manipulated.
  */
 static void
-change_env(char *s, int set)
+change_env(const char *s, int set)
 {
 	char *eqp;
 	char *ss;
@@ -389,7 +388,7 @@ listsetvar(struct strlist *list)
  */
 
 char *
-lookupvar(char *name)
+lookupvar(const char *name)
 {
 	struct var *v;
 
@@ -412,7 +411,7 @@ lookupvar(char *name)
  */
 
 char *
-bltinlookup(char *name, int doall)
+bltinlookup(const char *name, int doall)
 {
 	struct strlist *sp;
 	struct var *v;
@@ -796,7 +795,7 @@ unsetcmd(int argc __unused, char **argv 
  */
 
 int
-unsetvar(char *s)
+unsetvar(const char *s)
 {
 	struct var **vpp;
 	struct var *vp;
@@ -836,7 +835,7 @@ unsetvar(char *s)
  */
 
 STATIC struct var **
-hashvar(char *p)
+hashvar(const char *p)
 {
 	unsigned int hashval;
 
@@ -855,7 +854,7 @@ hashvar(char *p)
  */
 
 STATIC int
-varequal(char *p, char *q)
+varequal(const char *p, const char *q)
 {
 	while (*p == *q++) {
 		if (*p++ == '=')

Modified: head/bin/sh/var.h
==============================================================================
--- head/bin/sh/var.h	Thu Dec 24 18:17:53 2009	(r200955)
+++ head/bin/sh/var.h	Thu Dec 24 18:41:14 2009	(r200956)
@@ -101,12 +101,12 @@ extern struct var vhistsize;
 #define mpathset()	((vmpath.flags & VUNSET) == 0)
 
 void initvar(void);
-void setvar(char *, char *, int);
+void setvar(const char *, const char *, int);
 void setvareq(char *, int);
 struct strlist;
 void listsetvar(struct strlist *);
-char *lookupvar(char *);
-char *bltinlookup(char *, int);
+char *lookupvar(const char *);
+char *bltinlookup(const char *, int);
 char **environment(void);
 void shprocvar(void);
 int showvarscmd(int, char **);
@@ -116,5 +116,5 @@ void mklocal(char *);
 void poplocalvars(void);
 int setvarcmd(int, char **);
 int unsetcmd(int, char **);
-int unsetvar(char *);
-int setvarsafe(char *, char *, int);
+int unsetvar(const char *);
+int setvarsafe(const char *, const char *, int);

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 18:50:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C78541065694;
	Thu, 24 Dec 2009 18:50:59 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B67A78FC19;
	Thu, 24 Dec 2009 18:50:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOIoxHK038342;
	Thu, 24 Dec 2009 18:50:59 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOIoxcs038340;
	Thu, 24 Dec 2009 18:50:59 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912241850.nBOIoxcs038340@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 24 Dec 2009 18:50:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200958 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 18:50:59 -0000

Author: yongari
Date: Thu Dec 24 18:50:59 2009
New Revision: 200958
URL: http://svn.freebsd.org/changeset/base/200958

Log:
  Document newly added loader tunable/sysctl variable
  dev.ste.%d.int_rx_mod.
  While I'm here add .Xr vlan as ste(4) supports long frames.

Modified:
  head/share/man/man4/ste.4

Modified: head/share/man/man4/ste.4
==============================================================================
--- head/share/man/man4/ste.4	Thu Dec 24 18:50:58 2009	(r200957)
+++ head/share/man/man4/ste.4	Thu Dec 24 18:50:59 2009	(r200958)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 16, 2005
+.Dd December 24, 2009
 .Dt STE 4
 .Os
 .Sh NAME
@@ -126,6 +126,23 @@ D-Link DFE-550TX
 .It
 D-Link DFE-580TX
 .El
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width "xxxxxx"
+.It Va dev.ste.%d.int_rx_mod
+Maximum number of time to delay RX interrupts.
+The valid range is 0 to 209712 in units of 1us, the default is
+150 (150us).
+The value 0 effectively disables the RX interrupt moderation.
+The resolution of of timer is about 3.2us so finer tuning than
+3.2us wouldn't be available.
+The interface does not need to be brought down and up again before
+a change takes effect.
+.El
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "ste%d: couldn't map ports/memory"
@@ -171,6 +188,7 @@ the card should be configured correctly.
 .Xr netintro 4 ,
 .Xr ng_ether 4 ,
 .Xr polling 4 ,
+.Xr vlan 4 ,
 .Xr ifconfig 8
 .Rs
 .%T Sundance ST201 data sheet

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 20:43:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D78E11065672;
	Thu, 24 Dec 2009 20:43:31 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C6D1A8FC08;
	Thu, 24 Dec 2009 20:43:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOKhVIp040875;
	Thu, 24 Dec 2009 20:43:31 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOKhVV1040873;
	Thu, 24 Dec 2009 20:43:31 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912242043.nBOKhVV1040873@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 24 Dec 2009 20:43:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200965 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 20:43:31 -0000

Author: yongari
Date: Thu Dec 24 20:43:31 2009
New Revision: 200965
URL: http://svn.freebsd.org/changeset/base/200965

Log:
  Update if_iqdrops in case of RX buffer allocation failure.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Thu Dec 24 20:36:37 2009	(r200964)
+++ head/sys/dev/ste/if_ste.c	Thu Dec 24 20:43:31 2009	(r200965)
@@ -798,7 +798,7 @@ ste_rxeof(struct ste_softc *sc, int coun
 		 * can do in this situation.
 		 */
 		if (ste_newbuf(sc, cur_rx) != 0) {
-			ifp->if_ierrors++;
+			ifp->if_iqdrops++;
 			cur_rx->ste_ptr->ste_status = 0;
 			continue;
 		}

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 20:45:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E4D1106566B;
	Thu, 24 Dec 2009 20:45:33 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5DE3E8FC19;
	Thu, 24 Dec 2009 20:45:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOKjXZf040966;
	Thu, 24 Dec 2009 20:45:33 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOKjX04040964;
	Thu, 24 Dec 2009 20:45:33 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912242045.nBOKjX04040964@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 24 Dec 2009 20:45:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200966 - head/sys/dev/ste
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 20:45:33 -0000

Author: yongari
Date: Thu Dec 24 20:45:33 2009
New Revision: 200966
URL: http://svn.freebsd.org/changeset/base/200966

Log:
  ether_ifattach sets if_mtu, remove unnecessary code.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Thu Dec 24 20:43:31 2009	(r200965)
+++ head/sys/dev/ste/if_ste.c	Thu Dec 24 20:45:33 2009	(r200966)
@@ -1150,7 +1150,6 @@ ste_attach(device_t dev)
 
 	ifp->if_softc = sc;
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-	ifp->if_mtu = ETHERMTU;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = ste_ioctl;
 	ifp->if_start = ste_start;

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 20:55:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F0F7B106568F;
	Thu, 24 Dec 2009 20:55:14 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C69928FC14;
	Thu, 24 Dec 2009 20:55:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOKtErH041215;
	Thu, 24 Dec 2009 20:55:14 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOKtE1I041210;
	Thu, 24 Dec 2009 20:55:14 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912242055.nBOKtE1I041210@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 24 Dec 2009 20:55:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200967 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 20:55:15 -0000

Author: jilles
Date: Thu Dec 24 20:55:14 2009
New Revision: 200967
URL: http://svn.freebsd.org/changeset/base/200967

Log:
  sh: Add some __dead2 to indicate functions that do not return.

Modified:
  head/bin/sh/error.c
  head/bin/sh/error.h
  head/bin/sh/exec.h
  head/bin/sh/trap.h

Modified: head/bin/sh/error.c
==============================================================================
--- head/bin/sh/error.c	Thu Dec 24 20:45:33 2009	(r200966)
+++ head/bin/sh/error.c	Thu Dec 24 20:55:14 2009	(r200967)
@@ -67,7 +67,7 @@ volatile sig_atomic_t intpending;
 char *commandname;
 
 
-static void exverror(int, const char *, va_list) __printf0like(2, 0);
+static void exverror(int, const char *, va_list) __printf0like(2, 0) __dead2;
 
 /*
  * Called to raise an exception.  Since C doesn't include exceptions, we

Modified: head/bin/sh/error.h
==============================================================================
--- head/bin/sh/error.h	Thu Dec 24 20:45:33 2009	(r200966)
+++ head/bin/sh/error.h	Thu Dec 24 20:55:14 2009	(r200967)
@@ -78,10 +78,10 @@ extern volatile sig_atomic_t intpending;
 #define CLEAR_PENDING_INT intpending = 0
 #define int_pending() intpending
 
-void exraise(int);
+void exraise(int) __dead2;
 void onint(void);
-void error(const char *, ...) __printf0like(1, 2);
-void exerror(int, const char *, ...) __printf0like(2, 3);
+void error(const char *, ...) __printf0like(1, 2) __dead2;
+void exerror(int, const char *, ...) __printf0like(2, 3) __dead2;
 
 
 /*

Modified: head/bin/sh/exec.h
==============================================================================
--- head/bin/sh/exec.h	Thu Dec 24 20:45:33 2009	(r200966)
+++ head/bin/sh/exec.h	Thu Dec 24 20:55:14 2009	(r200967)
@@ -60,7 +60,7 @@ struct cmdentry {
 extern const char *pathopt;	/* set by padvance */
 extern int exerrno;		/* last exec error */
 
-void shellexec(char **, char **, const char *, int);
+void shellexec(char **, char **, const char *, int) __dead2;
 char *padvance(const char **, const char *);
 int hashcmd(int, char **);
 void find_command(const char *, struct cmdentry *, int, const char *);

Modified: head/bin/sh/trap.h
==============================================================================
--- head/bin/sh/trap.h	Thu Dec 24 20:45:33 2009	(r200966)
+++ head/bin/sh/trap.h	Thu Dec 24 20:55:14 2009	(r200967)
@@ -45,4 +45,4 @@ void ignoresig(int);
 void onsig(int);
 void dotrap(void);
 void setinteractive(int);
-void exitshell(int);
+void exitshell(int) __dead2;

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 21:39:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64ADE106566B;
	Thu, 24 Dec 2009 21:39:31 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 38C158FC21;
	Thu, 24 Dec 2009 21:39:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOLdVsL042038;
	Thu, 24 Dec 2009 21:39:31 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOLdV5P042035;
	Thu, 24 Dec 2009 21:39:31 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912242139.nBOLdV5P042035@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 21:39:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200968 - head/usr.sbin/diskinfo
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 21:39:31 -0000

Author: mav
Date: Thu Dec 24 21:39:30 2009
New Revision: 200968
URL: http://svn.freebsd.org/changeset/base/200968

Log:
  Make diskinfo report disk stripe size and offset. It should help users to
  make file systems optimally aligned and tuned for better performance.

Modified:
  head/usr.sbin/diskinfo/diskinfo.8
  head/usr.sbin/diskinfo/diskinfo.c

Modified: head/usr.sbin/diskinfo/diskinfo.8
==============================================================================
--- head/usr.sbin/diskinfo/diskinfo.8	Thu Dec 24 20:55:14 2009	(r200967)
+++ head/usr.sbin/diskinfo/diskinfo.8	Thu Dec 24 21:39:30 2009	(r200968)
@@ -46,7 +46,8 @@ and optionally runs a naive performance 
 .Pp
 If given no arguments, the output will be a single line per specified device
 with the following fields: device name, sectorsize, media size in bytes,
-media size in sectors, firmware cylinders, firmware heads, and firmware sectors.
+media size in sectors, stripe size, stripe offset, firmware cylinders,
+firmware heads, and firmware sectors.
 The last three fields are only present if the information is available.
 .Pp
 If given the

Modified: head/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- head/usr.sbin/diskinfo/diskinfo.c	Thu Dec 24 20:55:14 2009	(r200967)
+++ head/usr.sbin/diskinfo/diskinfo.c	Thu Dec 24 21:39:30 2009	(r200968)
@@ -58,7 +58,7 @@ main(int argc, char **argv)
 {
 	int i, ch, fd, error;
 	char buf[BUFSIZ], ident[DISK_IDENT_SIZE];
-	off_t	mediasize;
+	off_t	mediasize, stripesize, stripeoffset;
 	u_int	sectorsize, fwsectors, fwheads;
 
 	while ((ch = getopt(argc, argv, "ctv")) != -1) {
@@ -104,11 +104,19 @@ main(int argc, char **argv)
 		error = ioctl(fd, DIOCGFWHEADS, &fwheads);
 		if (error)
 			fwheads = 0;
+		error = ioctl(fd, DIOCGSTRIPESIZE, &stripesize);
+		if (error)
+			stripesize = 0;
+		error = ioctl(fd, DIOCGSTRIPEOFFSET, &stripeoffset);
+		if (error)
+			stripeoffset = 0;
 		if (!opt_v) {
 			printf("%s", argv[i]);
 			printf("\t%u", sectorsize);
 			printf("\t%jd", (intmax_t)mediasize);
 			printf("\t%jd", (intmax_t)mediasize/sectorsize);
+			printf("\t%jd", (intmax_t)stripesize);
+			printf("\t%jd", (intmax_t)stripeoffset);
 			if (fwsectors != 0 && fwheads != 0) {
 				printf("\t%jd", (intmax_t)mediasize /
 				    (fwsectors * fwheads * sectorsize));
@@ -124,6 +132,8 @@ main(int argc, char **argv)
 			    (intmax_t)mediasize, buf);
 			printf("\t%-12jd\t# mediasize in sectors\n",
 			    (intmax_t)mediasize/sectorsize);
+			printf("\t%-12jd\t# stripesize\n", stripesize);
+			printf("\t%-12jd\t# stripeoffset\n", stripeoffset);
 			if (fwsectors != 0 && fwheads != 0) {
 				printf("\t%-12jd\t# Cylinders according to firmware.\n", (intmax_t)mediasize /
 				    (fwsectors * fwheads * sectorsize));

From owner-svn-src-head@FreeBSD.ORG  Thu Dec 24 21:54:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 311E2106566C;
	Thu, 24 Dec 2009 21:54:45 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 209968FC13;
	Thu, 24 Dec 2009 21:54:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBOLsjMJ042327;
	Thu, 24 Dec 2009 21:54:45 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOLsjpV042325;
	Thu, 24 Dec 2009 21:54:45 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912242154.nBOLsjpV042325@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 24 Dec 2009 21:54:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200969 - head/sys/cam/ata
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 24 Dec 2009 21:54:45 -0000

Author: mav
Date: Thu Dec 24 21:54:44 2009
New Revision: 200969
URL: http://svn.freebsd.org/changeset/base/200969

Log:
  Report stripe size only if physical sector size is not equal to logical.

Modified:
  head/sys/cam/ata/ata_da.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Thu Dec 24 21:39:30 2009	(r200968)
+++ head/sys/cam/ata/ata_da.c	Thu Dec 24 21:54:44 2009	(r200969)
@@ -687,9 +687,14 @@ adaregister(struct cam_periph *periph, v
 	softc->disk->d_sectorsize = softc->params.secsize;
 	softc->disk->d_mediasize = (off_t)softc->params.sectors *
 	    softc->params.secsize;
-	softc->disk->d_stripesize = ata_physical_sector_size(&cgd->ident_data);
-	softc->disk->d_stripeoffset = softc->disk->d_stripesize -
-	    ata_logical_sector_offset(&cgd->ident_data);
+	if (ata_physical_sector_size(&cgd->ident_data) !=
+	    softc->params.secsize) {
+		softc->disk->d_stripesize =
+		    ata_physical_sector_size(&cgd->ident_data);
+		softc->disk->d_stripeoffset = (softc->disk->d_stripesize -
+		    ata_logical_sector_offset(&cgd->ident_data)) %
+		    softc->disk->d_stripesize;
+	}
 	/* XXX: these are not actually "firmware" values, so they may be wrong */
 	softc->disk->d_fwsectors = softc->params.secs_per_track;
 	softc->disk->d_fwheads = softc->params.heads;

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 00:23:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5908E106566B;
	Fri, 25 Dec 2009 00:23:47 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4884C8FC19;
	Fri, 25 Dec 2009 00:23:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBP0Nlkh045206;
	Fri, 25 Dec 2009 00:23:47 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBP0NlSZ045204;
	Fri, 25 Dec 2009 00:23:47 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200912250023.nBP0NlSZ045204@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 25 Dec 2009 00:23:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200972 - head/sys/dev/vge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 00:23:47 -0000

Author: yongari
Date: Fri Dec 25 00:23:47 2009
New Revision: 200972
URL: http://svn.freebsd.org/changeset/base/200972

Log:
  Remove wrong assertion.

Modified:
  head/sys/dev/vge/if_vge.c

Modified: head/sys/dev/vge/if_vge.c
==============================================================================
--- head/sys/dev/vge/if_vge.c	Thu Dec 24 23:54:58 2009	(r200971)
+++ head/sys/dev/vge/if_vge.c	Fri Dec 25 00:23:47 2009	(r200972)
@@ -2573,8 +2573,6 @@ vge_stats_clear(struct vge_softc *sc)
 {
 	int i;
 
-	VGE_LOCK_ASSERT(sc);
-
 	CSR_WRITE_1(sc, VGE_MIBCSR,
 	    CSR_READ_1(sc, VGE_MIBCSR) | VGE_MIBCSR_FREEZE);
 	CSR_WRITE_1(sc, VGE_MIBCSR,

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 01:16:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8137D106566B;
	Fri, 25 Dec 2009 01:16:24 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 711FD8FC0A;
	Fri, 25 Dec 2009 01:16:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBP1GONr046445;
	Fri, 25 Dec 2009 01:16:24 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBP1GOHm046443;
	Fri, 25 Dec 2009 01:16:24 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200912250116.nBP1GOHm046443@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 25 Dec 2009 01:16:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200976 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 01:16:24 -0000

Author: rwatson
Date: Fri Dec 25 01:16:24 2009
New Revision: 200976
URL: http://svn.freebsd.org/changeset/base/200976

Log:
  Minor comment tweaks in rmlocks.
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_rmlock.c

Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c	Fri Dec 25 01:15:39 2009	(r200975)
+++ head/sys/kern/kern_rmlock.c	Fri Dec 25 01:16:24 2009	(r200976)
@@ -128,9 +128,9 @@ static struct mtx rm_spinlock;
 MTX_SYSINIT(rm_spinlock, &rm_spinlock, "rm_spinlock", MTX_SPIN);
 
 /*
- * Add or remove tracker from per cpu list.
+ * Add or remove tracker from per-cpu list.
  *
- * The per cpu list can be traversed at any time in forward direction from an
+ * The per-cpu list can be traversed at any time in forward direction from an
  * interrupt on the *local* cpu.
  */
 static void inline
@@ -257,7 +257,7 @@ _rm_rlock_hard(struct rmlock *rm, struct
 		return;
 	}
 
-	/* Remove our tracker from the per cpu list. */
+	/* Remove our tracker from the per-cpu list. */
 	rm_tracker_remove(pc, tracker);
 
 	/* Check to see if the IPI granted us the lock after all. */
@@ -274,8 +274,8 @@ _rm_rlock_hard(struct rmlock *rm, struct
 	 */
 	if ((rm->lock_object.lo_flags & LO_RECURSABLE) != 0) {
 		/*
-		 * Just grand the lock if this thread already have a tracker
-		 * for this lock on the per cpu queue.
+		 * Just grant the lock if this thread already has a tracker
+		 * for this lock on the per-cpu queue.
 		 */
 		for (queue = pc->pc_rm_queue.rmq_next;
 		    queue !=  &pc->pc_rm_queue; queue = queue->rmq_next) {

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 02:44:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD3C810656A3;
	Fri, 25 Dec 2009 02:44:41 +0000 (UTC)
	(envelope-from uqs@spoerlein.net)
Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:198:206::1])
	by mx1.freebsd.org (Postfix) with ESMTP id 55C2C8FC1B;
	Fri, 25 Dec 2009 02:44:41 +0000 (UTC)
Received: from acme.spoerlein.net (localhost.spoerlein.net [IPv6:::1])
	by acme.spoerlein.net (8.14.3/8.14.3) with ESMTP id nBP2ie7l044262
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 25 Dec 2009 03:44:40 +0100 (CET)
	(envelope-from uqs@spoerlein.net)
Received: (from uqs@localhost)
	by acme.spoerlein.net (8.14.3/8.14.3/Submit) id nBP2ieiF044261;
	Fri, 25 Dec 2009 03:44:40 +0100 (CET)
	(envelope-from uqs@spoerlein.net)
Date: Fri, 25 Dec 2009 03:44:40 +0100
From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= 
To: Jilles Tjoelker 
Message-ID: <20091225024439.GD75594@acme.spoerlein.net>
Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= ,
	Jilles Tjoelker , src-committers@freebsd.org,
	svn-src-all@freebsd.org, svn-src-head@freebsd.org
References: <200912212216.nBLMG7gl042491@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200912212216.nBLMG7gl042491@svn.freebsd.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200818 - head/etc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 02:44:41 -0000

On Mon, 21.12.2009 at 22:16:07 +0000, Jilles Tjoelker wrote:
> Author: jilles
> Date: Mon Dec 21 22:16:07 2009
> New Revision: 200818
> URL: http://svn.freebsd.org/changeset/base/200818
> 
> Log:
>   rc.subr: Use pwait in wait_for_pids.
>   
>   This waits for the requested process(es) to terminate, rather than polling
>   with an interval of 2 seconds.
>   
>   If pwait is not available, the old method is used.

A timeout for pwait would be nice, so that we still get a progress
report and not simply a "hang".

The return value for timeout-has-fired-but-PID-is-still-alive and
no-such-PID would have to be different, though.

Btw, I haven't actually tested the current code, perhaps it already
DTRT.

Regards,
Uli

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 06:45:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 71B091065670
	for ; Fri, 25 Dec 2009 06:45:11 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id DE0B88FC1A
	for ; Fri, 25 Dec 2009 06:45:10 +0000 (UTC)
Received: (qmail 9980 invoked by uid 399); 25 Dec 2009 06:45:08 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 25 Dec 2009 06:45:08 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4B345F67.2020306@FreeBSD.org>
Date: Thu, 24 Dec 2009 22:44:55 -0800
From: Doug Barton 
Organization: http://SupersetSolutions.com/
User-Agent: Thunderbird 2.0.0.23 (X11/20091206)
MIME-Version: 1.0
To: =?ISO-8859-1?Q?Ulrich_Sp=F6rlein?= , 
	Jilles Tjoelker ,
	src-committers@freebsd.org, svn-src-all@freebsd.org, 
	svn-src-head@freebsd.org
References: <200912212216.nBLMG7gl042491@svn.freebsd.org>
	<20091225024439.GD75594@acme.spoerlein.net>
In-Reply-To: <20091225024439.GD75594@acme.spoerlein.net>
X-Enigmail-Version: 0.96.0
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Cc: 
Subject: Re: svn commit: r200818 - head/etc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 06:45:11 -0000

Ulrich Spörlein wrote:
> A timeout for pwait would be nice, so that we still get a progress
> report and not simply a "hang".

The code will still print the same "Waiting for PIDS:" message that it
always has prior to running pwait, so you'll know why the shutdown has
paused. With pwait what it will not do is loop back through and print
"N,N,N,N,N." I regard this as a feature. :)

> Btw, I haven't actually tested the current code, perhaps it already
> DTRT.

Generally better to test first, e-mail second. :)


happy happy,

Doug

-- 

	Improve the effectiveness of your Internet presence with
	a domain name makeover!    http://SupersetSolutions.com/


From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 07:59:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 783C71065672;
	Fri, 25 Dec 2009 07:59:31 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 66A168FC0C;
	Fri, 25 Dec 2009 07:59:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBP7xVf6053893;
	Fri, 25 Dec 2009 07:59:31 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBP7xVuA053891;
	Fri, 25 Dec 2009 07:59:31 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912250759.nBP7xVuA053891@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 25 Dec 2009 07:59:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200977 - head/sys/dev/ahci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 07:59:31 -0000

Author: mav
Date: Fri Dec 25 07:59:31 2009
New Revision: 200977
URL: http://svn.freebsd.org/changeset/base/200977

Log:
  Avoid false positive probe on ICH6 chipsets.

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Fri Dec 25 01:16:24 2009	(r200976)
+++ head/sys/dev/ahci/ahci.c	Fri Dec 25 07:59:31 2009	(r200977)
@@ -115,8 +115,8 @@ static struct {
 	{0x43931002, "ATI IXP700",	0},
 	{0x43941002, "ATI IXP800",	0},
 	{0x43951002, "ATI IXP800",	0},
-	{0x26528086, "Intel ICH6",	0},
-	{0x26538086, "Intel ICH6M",	0},
+	{0x26528086, "Intel ICH6",	AHCI_Q_NOFORCE},
+	{0x26538086, "Intel ICH6M",	AHCI_Q_NOFORCE},
 	{0x26818086, "Intel ESB2",	0},
 	{0x26828086, "Intel ESB2",	0},
 	{0x26838086, "Intel ESB2",	0},

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 09:02:42 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63D8B106566B;
	Fri, 25 Dec 2009 09:02:42 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 534058FC16;
	Fri, 25 Dec 2009 09:02:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBP92gn2055302;
	Fri, 25 Dec 2009 09:02:42 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBP92gSW055301;
	Fri, 25 Dec 2009 09:02:42 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912250902.nBP92gSW055301@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 25 Dec 2009 09:02:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200979 - head/contrib/top
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 09:02:42 -0000

Author: ed
Date: Fri Dec 25 09:02:41 2009
New Revision: 200979
URL: http://svn.freebsd.org/changeset/base/200979

Log:
  Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
  
  The maximum user login length should have nothing to do with .

Modified:
  head/contrib/top/username.c

Modified: head/contrib/top/username.c
==============================================================================
--- head/contrib/top/username.c	Fri Dec 25 08:06:35 2009	(r200978)
+++ head/contrib/top/username.c	Fri Dec 25 09:02:41 2009	(r200979)
@@ -30,17 +30,17 @@
  *  This makes the table size independent of the passwd file size.
  */
 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 #include "top.local.h"
 #include "utils.h"
 
 struct hash_el {
     int  uid;
-    char name[UT_NAMESIZE + 1];
+    char name[MAXLOGNAME];
 };
 
 #define    is_empty_hash(x)	(hash_table[x].name[0] == 0)
@@ -129,7 +129,7 @@ int wecare;		/* 1 = enter it always, 0 =
 
     /* empty or wrong slot -- fill it with new value */
     hash_table[hashindex].uid = uid;
-    (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE);
+    (void) strncpy(hash_table[hashindex].name, name, MAXLOGNAME - 1);
     return(hashindex);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 09:58:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3393B106568F;
	Fri, 25 Dec 2009 09:58:20 +0000 (UTC)
	(envelope-from brueffer@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 22F598FC14;
	Fri, 25 Dec 2009 09:58:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBP9wKBk056345;
	Fri, 25 Dec 2009 09:58:20 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBP9wKnV056343;
	Fri, 25 Dec 2009 09:58:20 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200912250958.nBP9wKnV056343@svn.freebsd.org>
From: Christian Brueffer 
Date: Fri, 25 Dec 2009 09:58:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200980 - head/usr.sbin/service
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 09:58:20 -0000

Author: brueffer
Date: Fri Dec 25 09:58:19 2009
New Revision: 200980
URL: http://svn.freebsd.org/changeset/base/200980

Log:
  Provide a better short description and fix SEE ALSO section entries.

Modified:
  head/usr.sbin/service/service.8

Modified: head/usr.sbin/service/service.8
==============================================================================
--- head/usr.sbin/service/service.8	Fri Dec 25 09:02:41 2009	(r200979)
+++ head/usr.sbin/service/service.8	Fri Dec 25 09:58:19 2009	(r200980)
@@ -29,7 +29,7 @@
 .Os
 .Sh NAME
 .Nm service
-.Nd "service command manual page"
+.Nd "manage system services"
 .Sh SYNOPSIS
 .Nm
 .Fl e
@@ -116,8 +116,8 @@ for the names of the rc.d scripts:
 .Dl "}"
 .Dl "complete -F _service service"
 .Sh SEE ALSO
-.Xr bash 1 ,
-.Xr rc.conf 5 .
+.Xr bash 1 Pq Pa ports/shells/bash ,
+.Xr rc.conf 5 ,
 .Xr rc 8 ,
 .Xr rcorder 8
 .Sh HISTORY

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 10:01:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3E8B1065672;
	Fri, 25 Dec 2009 10:01:35 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B37A88FC17;
	Fri, 25 Dec 2009 10:01:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPA1Z1g056495;
	Fri, 25 Dec 2009 10:01:35 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPA1Z4w056493;
	Fri, 25 Dec 2009 10:01:35 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200912251001.nBPA1Z4w056493@svn.freebsd.org>
From: Xin LI 
Date: Fri, 25 Dec 2009 10:01:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200981 - head/usr.bin/killall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 10:01:35 -0000

Author: delphij
Date: Fri Dec 25 10:01:35 2009
New Revision: 200981
URL: http://svn.freebsd.org/changeset/base/200981

Log:
  Document the difference between FreeBSD and traditional System V killall
  commands.
  
  MFC after:	1 month

Modified:
  head/usr.bin/killall/killall.1

Modified: head/usr.bin/killall/killall.1
==============================================================================
--- head/usr.bin/killall/killall.1	Fri Dec 25 09:58:19 2009	(r200980)
+++ head/usr.bin/killall/killall.1	Fri Dec 25 10:01:35 2009	(r200981)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 27, 2009
+.Dd December 25, 2009
 .Os
 .Dt KILLALL 1
 .Sh NAME
@@ -145,6 +145,17 @@ command appeared in
 It has been modeled after the
 .Nm
 command as available on other platforms.
+.Sh IMPLEMENTATION NOTES
+This
+.Fx
+implementation of
+.Nm
+have completely different semantics as compared to the traditional
+.Ux
+System V behavior of
+.Nm ,
+which will kill all processes that the current user is able to
+kill, and is intended to be used by the system shutdown process only.
 .Sh AUTHORS
 .An -nosplit
 The

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 10:30:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBF69106568D;
	Fri, 25 Dec 2009 10:30:54 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BBF0E8FC13;
	Fri, 25 Dec 2009 10:30:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPAUsMx058866;
	Fri, 25 Dec 2009 10:30:54 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPAUsQo058864;
	Fri, 25 Dec 2009 10:30:54 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912251030.nBPAUsQo058864@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 25 Dec 2009 10:30:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200982 - head/libexec/atrun
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 10:30:54 -0000

Author: ed
Date: Fri Dec 25 10:30:54 2009
New Revision: 200982
URL: http://svn.freebsd.org/changeset/base/200982

Log:
  Don't use UT_NAMESIZE here to determine the maximum username length.

Modified:
  head/libexec/atrun/atrun.c

Modified: head/libexec/atrun/atrun.c
==============================================================================
--- head/libexec/atrun/atrun.c	Fri Dec 25 10:01:35 2009	(r200981)
+++ head/libexec/atrun/atrun.c	Fri Dec 25 10:30:54 2009	(r200982)
@@ -49,7 +49,6 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
-#include 
 #ifdef __FreeBSD__
 #include 
 #else
@@ -63,12 +62,6 @@ static const char rcsid[] =
 #include 
 #endif
 
-#if (MAXLOGNAME-1) > UT_NAMESIZE
-#define LOGNAMESIZE UT_NAMESIZE
-#else
-#define LOGNAMESIZE (MAXLOGNAME-1)
-#endif
-
 /* Local headers */
 
 #include "gloadavg.h"
@@ -130,7 +123,7 @@ run_file(const char *filename, uid_t uid
     pid_t pid;
     int fd_out, fd_in;
     int queue;
-    char mailbuf[LOGNAMESIZE + 1], fmt[49];
+    char mailbuf[MAXLOGNAME], fmt[49];
     char *mailname = NULL;
     FILE *stream;
     int send_mail = 0;
@@ -231,7 +224,7 @@ run_file(const char *filename, uid_t uid
 
     snprintf(fmt, sizeof(fmt),
 	"#!/bin/sh\n# atrun uid=%%ld gid=%%ld\n# mail %%%ds %%d",
-                          LOGNAMESIZE);
+                          MAXLOGNAME - 1);
 
     if (fscanf(stream, fmt, &nuid, &ngid, mailbuf, &send_mail) != 4)
 	perrx("File %s is in wrong format - aborting", filename);

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 11:12:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A01901065692;
	Fri, 25 Dec 2009 11:12:05 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7652A8FC1A;
	Fri, 25 Dec 2009 11:12:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPBC5oC059631;
	Fri, 25 Dec 2009 11:12:05 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPBC5oP059628;
	Fri, 25 Dec 2009 11:12:05 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912251112.nBPBC5oP059628@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 25 Dec 2009 11:12:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200983 - head/libexec/talkd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 11:12:05 -0000

Author: ed
Date: Fri Dec 25 11:12:05 2009
New Revision: 200983
URL: http://svn.freebsd.org/changeset/base/200983

Log:
  Let talkd use utmpx instead of utmp.
  
  Because strings are null terminated now, there is no need to copy
  ut_line into a separate buffer first. Also enable WARNS.

Modified:
  head/libexec/talkd/Makefile
  head/libexec/talkd/process.c

Modified: head/libexec/talkd/Makefile
==============================================================================
--- head/libexec/talkd/Makefile	Fri Dec 25 10:30:54 2009	(r200982)
+++ head/libexec/talkd/Makefile	Fri Dec 25 11:12:05 2009	(r200983)
@@ -6,6 +6,10 @@ SRCS=	talkd.c announce.c process.c table
 .PATH:  ${.CURDIR}/../../usr.bin/wall
 MAN=	talkd.8
 CFLAGS+=-I${.CURDIR}/../../usr.bin/wall
-WFORMAT=0
+
+WARNS?=	6
+
+DPADD=	${LIBULOG}
+LDADD=	-lulog
 
 .include 

Modified: head/libexec/talkd/process.c
==============================================================================
--- head/libexec/talkd/process.c	Fri Dec 25 10:30:54 2009	(r200982)
+++ head/libexec/talkd/process.c	Fri Dec 25 11:12:05 2009	(r200983)
@@ -59,6 +59,8 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
+#define	_ULOG_POSIX_NAMES
+#include 
 
 #include "extern.h"
 
@@ -181,55 +183,46 @@ do_announce(CTL_MSG *mp, CTL_RESPONSE *r
 	}
 }
 
-#include 
-
 /*
  * Search utmp for the local user
  */
 int
 find_user(const char *name, char *tty)
 {
-	struct utmp ubuf;
+	struct utmpx *ut;
 	int status;
-	FILE *fd;
 	struct stat statb;
 	time_t best = 0;
-	char line[sizeof(ubuf.ut_line) + 1];
-	char ftty[sizeof(_PATH_DEV) - 1 + sizeof(line)];
+	char ftty[sizeof(_PATH_DEV) - 1 + sizeof(ut->ut_line)];
 
-	if ((fd = fopen(_PATH_UTMP, "r")) == NULL) {
-		warnx("can't read %s", _PATH_UTMP);
-		return (FAILED);
-	}
-#define SCMPN(a, b)	strncmp(a, b, sizeof (a))
+	setutxent();
 	status = NOT_HERE;
 	(void) strcpy(ftty, _PATH_DEV);
-	while (fread((char *) &ubuf, sizeof ubuf, 1, fd) == 1)
-		if (SCMPN(ubuf.ut_name, name) == 0) {
-			strncpy(line, ubuf.ut_line, sizeof(ubuf.ut_line));
-			line[sizeof(ubuf.ut_line)] = '\0';
+	while ((ut = getutxent()) != NULL)
+		if (ut->ut_type == USER_PROCESS &&
+		    strcmp(ut->ut_user, name) == 0) {
 			if (*tty == '\0' || best != 0) {
 				if (best == 0)
 					status = PERMISSION_DENIED;
 				/* no particular tty was requested */
 				(void) strcpy(ftty + sizeof(_PATH_DEV) - 1,
-				    line);
+				    ut->ut_line);
 				if (stat(ftty, &statb) == 0) {
 					if (!(statb.st_mode & 020))
 						continue;
 					if (statb.st_atime > best) {
 						best = statb.st_atime;
-						(void) strcpy(tty, line);
+						(void) strcpy(tty, ut->ut_line);
 						status = SUCCESS;
 						continue;
 					}
 				}
 			}
-			if (strcmp(line, tty) == 0) {
+			if (strcmp(ut->ut_line, tty) == 0) {
 				status = SUCCESS;
 				break;
 			}
 		}
-	fclose(fd);
+	endutxent();
 	return (status);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 15:03:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B3625106568B;
	Fri, 25 Dec 2009 15:03:05 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A21448FC12;
	Fri, 25 Dec 2009 15:03:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPF35A8064235;
	Fri, 25 Dec 2009 15:03:05 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPF35Si064233;
	Fri, 25 Dec 2009 15:03:05 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912251503.nBPF35Si064233@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 15:03:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200987 - head/sys/sparc64/pci
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 15:03:05 -0000

Author: marius
Date: Fri Dec 25 15:03:05 2009
New Revision: 200987
URL: http://svn.freebsd.org/changeset/base/200987

Log:
  - Hook up the default implementations of the MSI/MSI-X pcib_if methods
    so requests may bubble up to a host-PCI bridge driver.
  - Distinguish between PCI and PCIe bridges in the device description
    so it's a bit easier to follow what hangs off of what in the dmesg.
    Unfortunately we can't also tell PCI and PCI-X apart based on the
    information provided in the OFW device tree.
  - Add quirk handling for the ALi M5249 found in Fire-based machines
    which are used as a PCIe-PCIe bridge there. These are obviously
    subtractive decoding as as they have a PCI-ISA bridge on their
    secondary side (and likewise don't include the ISA I/O range in
    their bridge decode) but don't indicate this via the class code.
    Given that this quirk isn't likely to apply to all ALi M5249 and
    I have no datasheet for these chips so I could implement a check
    using the chip specific bits enabling subtractive decoding this
    quirk handling is added to the MD code rather than the MI one.

Modified:
  head/sys/sparc64/pci/ofw_pcib.c

Modified: head/sys/sparc64/pci/ofw_pcib.c
==============================================================================
--- head/sys/sparc64/pci/ofw_pcib.c	Fri Dec 25 14:59:54 2009	(r200986)
+++ head/sys/sparc64/pci/ofw_pcib.c	Fri Dec 25 15:03:05 2009	(r200987)
@@ -3,6 +3,7 @@
  * Copyright (c) 2000 Michael Smith 
  * Copyright (c) 2000 BSDi
  * Copyright (c) 2001 - 2003 Thomas Moestl 
+ * Copyright (c) 2009 by Marius Strobl 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,8 +38,9 @@ __FBSDID("$FreeBSD$");
 #include "opt_ofw_pci.h"
 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -82,6 +84,11 @@ static device_method_t ofw_pcib_methods[
 	DEVMETHOD(pcib_read_config,	pcib_read_config),
 	DEVMETHOD(pcib_write_config,	pcib_write_config),
 	DEVMETHOD(pcib_route_interrupt,	ofw_pcib_gen_route_interrupt),
+	DEVMETHOD(pcib_alloc_msi,	pcib_alloc_msi),
+	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
+	DEVMETHOD(pcib_alloc_msix,	pcib_alloc_msix),
+	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
+	DEVMETHOD(pcib_map_msi,		pcib_map_msi),
 
 	/* ofw_bus interface */
 	DEVMETHOD(ofw_bus_get_node,	ofw_pcib_gen_get_node),
@@ -100,19 +107,49 @@ MODULE_DEPEND(ofw_pcib, pci, 1, 1, 1);
 static int
 ofw_pcib_probe(device_t dev)
 {
+	char desc[sizeof("OFW PCIe-PCIe bridge")];
+	const char *dtype, *pbdtype;
+
+#define	ISDTYPE(dtype, type)						\
+	(((dtype) != NULL) && strcmp((dtype), (type)) == 0)
 
 	if ((pci_get_class(dev) == PCIC_BRIDGE) &&
 	    (pci_get_subclass(dev) == PCIS_BRIDGE_PCI) &&
 	    ofw_bus_get_node(dev) != 0) {
-		device_set_desc(dev, "OFW PCI-PCI bridge");
+		dtype = ofw_bus_get_type(dev);
+		pbdtype = ofw_bus_get_type(device_get_parent(
+		    device_get_parent(dev)));
+		snprintf(desc, sizeof(desc), "OFW PCI%s-PCI%s bridge",
+		    ISDTYPE(pbdtype, OFW_TYPE_PCIE) ? "e" : "",
+		    ISDTYPE(dtype, OFW_TYPE_PCIE) ? "e" : "");
+		device_set_desc_copy(dev, desc);
 		return (0);
 	}
+
+#undef ISDTYPE
+
 	return (ENXIO);
 }
 
 static int
 ofw_pcib_attach(device_t dev)
 {
+	struct ofw_pcib_gen_softc *sc;
+
+	sc = device_get_softc(dev);
+
+	/* Quirk handling */
+	switch (pci_get_devid(dev)) {
+	/*
+	 * The ALi M5249 found in Fire-based machines by definition must me
+	 * subtractive as they have a ISA bridge on their secondary side but
+	 * don't indicate this in the class code although the ISA I/O range
+	 * isn't included in their bridge decode.
+	 */
+	case 0x524910b9:
+		sc->ops_pcib_sc.flags |= PCIB_SUBTRACTIVE;
+		break;
+	}
 
 	ofw_pcib_gen_setup(dev);
 	pcib_attach_common(dev);

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 15:29:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D7FAF106566B;
	Fri, 25 Dec 2009 15:29:18 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C68A58FC0C;
	Fri, 25 Dec 2009 15:29:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPFTIim064736;
	Fri, 25 Dec 2009 15:29:18 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPFTIxS064735;
	Fri, 25 Dec 2009 15:29:18 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912251529.nBPFTIxS064735@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 25 Dec 2009 15:29:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200988 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 15:29:18 -0000

Author: jilles
Date: Fri Dec 25 15:29:18 2009
New Revision: 200988
URL: http://svn.freebsd.org/changeset/base/200988

Log:
  sh: Do not consider a tilde-prefix with expansions in it.
  
  That is, do not do tilde expansion if any of the CTL* bytes (\201-\210), not
  only CTLESC and CTLQUOTEMARK, are encountered. Such an expansion would look
  up a user name with sh's internal representation.
  
  The parser does not currently distinguish between backslashed and
  unbackslashed \201-\210, so tilde expansion of user names with these bytes
  in them is not so easy to fix.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Fri Dec 25 15:03:05 2009	(r200987)
+++ head/bin/sh/expand.c	Fri Dec 25 15:29:18 2009	(r200988)
@@ -271,8 +271,13 @@ exptilde(char *p, int flag)
 
 	while ((c = *p) != '\0') {
 		switch(c) {
-		case CTLESC:
-			return (startp);
+		case CTLESC: /* This means CTL* are always considered quoted. */
+		case CTLVAR:
+		case CTLENDVAR:
+		case CTLBACKQ:
+		case CTLBACKQ | CTLQUOTE:
+		case CTLARI:
+		case CTLENDARI:
 		case CTLQUOTEMARK:
 			return (startp);
 		case ':':

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 15:34:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E9BE1065693;
	Fri, 25 Dec 2009 15:34:55 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au
	[211.29.132.189])
	by mx1.freebsd.org (Postfix) with ESMTP id E55938FC1E;
	Fri, 25 Dec 2009 15:34:54 +0000 (UTC)
Received: from c220-239-235-55.carlnfd3.nsw.optusnet.com.au
	(c220-239-235-55.carlnfd3.nsw.optusnet.com.au [220.239.235.55])
	by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	nBPFYo9Y016872
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 26 Dec 2009 02:34:52 +1100
Date: Sat, 26 Dec 2009 02:34:50 +1100 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Ed Schouten 
In-Reply-To: <200912250902.nBP92gSW055301@svn.freebsd.org>
Message-ID: <20091226014906.Y43539@delplex.bde.org>
References: <200912250902.nBP92gSW055301@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r200979 - head/contrib/top
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 15:34:55 -0000

On Fri, 25 Dec 2009, Ed Schouten wrote:

> Log:
>  Let top(1) use MAXLOGNAME instead of UT_NAMESIZE.
>
>  The maximum user login length should have nothing to do with .

top was trying to be portable.  Its portable parts cannot use MAXLOGNAME,
since that is not in POSIX (I guess it is a BSDism).

> Modified:
>  head/contrib/top/username.c
>
> Modified: head/contrib/top/username.c
> ==============================================================================
> --- head/contrib/top/username.c	Fri Dec 25 08:06:35 2009	(r200978)
> +++ head/contrib/top/username.c	Fri Dec 25 09:02:41 2009	(r200979)
> @@ -30,17 +30,17 @@
>  *  This makes the table size independent of the passwd file size.
>  */
>
> +#include 

top's portable parts also cannot use .  It used to handle this
by only including  in "os.h", and then including "os.h" to
get some unportable bits (mainly via compatibility macros or extra
declarations in "os.h").  "os.h" itself is not so good -- it begins by
including  unconditionally, so it doesn't compile on any
pure POSIX systems.  Then it has garbage like "caddr_t malloc();"
(only used on 16+ year old "BSD" systems).

> #define    is_empty_hash(x)	(hash_table[x].name[0] == 0)
> @@ -129,7 +129,7 @@ int wecare;		/* 1 = enter it always, 0 =
>
>     /* empty or wrong slot -- fill it with new value */
>     hash_table[hashindex].uid = uid;
> -    (void) strncpy(hash_table[hashindex].name, name, UT_NAMESIZE);
> +    (void) strncpy(hash_table[hashindex].name, name, MAXLOGNAME - 1);

MAXLOGNAME is spelled {LOGIN_NAME_MAX} in POSIX.1-2001.  This doesn't
help for top's portablility, since POSIX didn't have this until 2001,
but top is trying to support pre-4.4 BSD.

FreeBSD correctly doesn't define LOGIN_NAME_MAX (except briefly in 2003),
so that this limit isn't fixed and thus broken like UT_NAMESIZE.  So
there is no alternative to spelling {LOGIN_NAME_MAX} in the portable
way (sysconf(_SC_LOGIN_NAME_MAX) plus error handling) for working
portably on POSIX.1-2001 systems.  FreeBSD never uses this spelling in
libc -- there it uses the unportable spelling MAXLOGNAME and in most
places has CTASSERT()s which assumes that MAXLOGNAME is a compile-time
constant.

This is partially fixed in top-3.8beta1.  From username.c:

% #include "os.h"

The correct include, and top now uses autoconf, but "os.h" is still bad
internally.

% 
% #include 
% #include 
% #include 
% 
% #include "top.h"
% #include "utils.h"
% #include "hash.h"
% 
% #define EXPIRETIME (60 * 5)
% 
% /* we need some sort of idea how long usernames can be */
% #ifndef MAXLOGNAME
% #ifdef _POSIX_LOGIN_NAME_MAX 
% #define MAXLOGNAME _POSIX_LOGIN_NAME_MAX 
% #else
% #define MAXLOGNAME 9
% #endif
% #endif

top now essentially uses MAXLOGNAME, but if this is not defined (it
would be defined on FreeBSD by "os.h" including ), then
top uses _POSIX_LOGIN_NAME_MAX on POSIX.1-2001 systems (autoconfi will
have defined HAVE_LIMITS_H which will have caused "os.h" to have
included ); otherwise it uses 9.  But _POSIX_LOGIN_NAME_MAX
is a wrong value to use on most POSIX.1-2001 systems, including FreeBSD.
It is the minimum value permitted by POSIX.1-2001 and is always 9;
thus most of the above ifdef is just an obfuscated spelling of 9.  9
is smaller than {LOGIN_NAME_MAX} on most POSIX.1-2001 systems including
FreeBSD, but is not too bad for top since top is short of space and
barely has space for 9; in fact its display seems to be limited to 9
(8 without the NUL, since TOP_USERNAME_LEN is never defined so the
default of 8 is used).  Thus values > 9 seem to cause at most minor
differences in sorting (when usernames truncated to 8 chars are not
unique) under FreeBSD.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 17:34:43 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D09EF1065670;
	Fri, 25 Dec 2009 17:34:43 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A574C8FC0A;
	Fri, 25 Dec 2009 17:34:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPHYhe7067361;
	Fri, 25 Dec 2009 17:34:43 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPHYhQL067357;
	Fri, 25 Dec 2009 17:34:43 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200912251734.nBPHYhQL067357@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 25 Dec 2009 17:34:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200991 - head/sys/dev/twe
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 17:34:43 -0000

Author: mav
Date: Fri Dec 25 17:34:43 2009
New Revision: 200991
URL: http://svn.freebsd.org/changeset/base/200991

Log:
  Teach twe driver to report array stripe size to GEOM.

Modified:
  head/sys/dev/twe/twe.c
  head/sys/dev/twe/twe_freebsd.c
  head/sys/dev/twe/twevar.h

Modified: head/sys/dev/twe/twe.c
==============================================================================
--- head/sys/dev/twe/twe.c	Fri Dec 25 17:05:55 2009	(r200990)
+++ head/sys/dev/twe/twe.c	Fri Dec 25 17:34:43 2009	(r200991)
@@ -201,7 +201,7 @@ twe_add_unit(struct twe_softc *sc, int u
     int				table, error = 0;
     u_int16_t			dsize;
     TWE_Param			*drives = NULL, *param = NULL;
-    TWE_Unit_Descriptor		*ud;
+    TWE_Array_Descriptor	*ud;
 
     if (unit < 0 || unit > TWE_MAX_UNITS)
 	return (EINVAL);
@@ -244,8 +244,9 @@ twe_add_unit(struct twe_softc *sc, int u
 	error = EIO;
 	goto out;
     }
-    ud = (TWE_Unit_Descriptor *)param->data;
+    ud = (TWE_Array_Descriptor *)param->data;
     dr->td_type = ud->configuration;
+    dr->td_stripe = ud->stripe_size;
 
     /* build synthetic geometry as per controller internal rules */
     if (dr->td_size > 0x200000) {

Modified: head/sys/dev/twe/twe_freebsd.c
==============================================================================
--- head/sys/dev/twe/twe_freebsd.c	Fri Dec 25 17:05:55 2009	(r200990)
+++ head/sys/dev/twe/twe_freebsd.c	Fri Dec 25 17:34:43 2009	(r200991)
@@ -818,6 +818,13 @@ twed_attach(device_t dev)
     sc->twed_disk->d_maxsize = (TWE_MAX_SGL_LENGTH - 1) * PAGE_SIZE;
     sc->twed_disk->d_sectorsize = TWE_BLOCK_SIZE;
     sc->twed_disk->d_mediasize = TWE_BLOCK_SIZE * (off_t)sc->twed_drive->td_size;
+    if (sc->twed_drive->td_type == TWE_UD_CONFIG_RAID0 ||
+	sc->twed_drive->td_type == TWE_UD_CONFIG_RAID5 ||
+	sc->twed_drive->td_type == TWE_UD_CONFIG_RAID10) {
+	    sc->twed_disk->d_stripesize =
+		TWE_BLOCK_SIZE << sc->twed_drive->td_stripe;
+	    sc->twed_disk->d_stripeoffset = 0;
+    }
     sc->twed_disk->d_fwsectors = sc->twed_drive->td_sectors;
     sc->twed_disk->d_fwheads = sc->twed_drive->td_heads;
     sc->twed_disk->d_unit = sc->twed_drive->td_sys_unit;

Modified: head/sys/dev/twe/twevar.h
==============================================================================
--- head/sys/dev/twe/twevar.h	Fri Dec 25 17:05:55 2009	(r200990)
+++ head/sys/dev/twe/twevar.h	Fri Dec 25 17:34:43 2009	(r200991)
@@ -59,6 +59,7 @@ struct twe_drive
     /* unit state and type */
     u_int8_t		td_state;
     u_int8_t		td_type;
+    u_int8_t		td_stripe;
 
     /* handle for attached driver */
     device_t		td_disk;

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 18:05:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F7A11065670;
	Fri, 25 Dec 2009 18:05:06 +0000 (UTC)
	(envelope-from markus@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5D57D8FC1E;
	Fri, 25 Dec 2009 18:05:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPI56xn067942;
	Fri, 25 Dec 2009 18:05:06 GMT (envelope-from markus@svn.freebsd.org)
Received: (from markus@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPI56DZ067940;
	Fri, 25 Dec 2009 18:05:06 GMT (envelope-from markus@svn.freebsd.org)
Message-Id: <200912251805.nBPI56DZ067940@svn.freebsd.org>
From: Markus Brueffer 
Date: Fri, 25 Dec 2009 18:05:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200992 - head/lib/libc/posix1e
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 18:05:06 -0000

Author: markus
Date: Fri Dec 25 18:05:06 2009
New Revision: 200992
URL: http://svn.freebsd.org/changeset/base/200992

Log:
  Use a local copy of entry_d for finding matches. Otherwise, if entry_d pointed
  to an entry of 'acl', all ACL entries starting with entry_d would be deleted.
  
  Reviewed by:	trasz
  Approved by:	emax (mentor)
  MFC after:	3 days

Modified:
  head/lib/libc/posix1e/acl_delete_entry.c

Modified: head/lib/libc/posix1e/acl_delete_entry.c
==============================================================================
--- head/lib/libc/posix1e/acl_delete_entry.c	Fri Dec 25 17:34:43 2009	(r200991)
+++ head/lib/libc/posix1e/acl_delete_entry.c	Fri Dec 25 18:05:06 2009	(r200992)
@@ -75,6 +75,7 @@ int
 acl_delete_entry(acl_t acl, acl_entry_t entry_d)
 {
 	struct acl *acl_int;
+	struct acl_entry entry_int;
 	int i, j, found = 0;
 
 	if (acl == NULL || entry_d == NULL) {
@@ -94,8 +95,12 @@ acl_delete_entry(acl_t acl, acl_entry_t 
 		errno = EINVAL;
 		return (-1);
 	}
+
+	/* Use a local copy to prevent deletion of more than this entry */
+	entry_int = *entry_d;
+
 	for (i = 0; i < acl->ats_acl.acl_cnt;) {
-		if (_entry_matches(&(acl->ats_acl.acl_entry[i]), entry_d)) {
+		if (_entry_matches(&(acl->ats_acl.acl_entry[i]), &entry_int)) {
 			/* ...shift the remaining entries... */
 			for (j = i; j < acl->ats_acl.acl_cnt - 1; ++j)
 				acl->ats_acl.acl_entry[j] =

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 19:38:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ED356106568F;
	Fri, 25 Dec 2009 19:38:12 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DB9A98FC17;
	Fri, 25 Dec 2009 19:38:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPJcCLL069653;
	Fri, 25 Dec 2009 19:38:12 GMT (envelope-from gavin@svn.freebsd.org)
Received: (from gavin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPJcCS4069651;
	Fri, 25 Dec 2009 19:38:12 GMT (envelope-from gavin@svn.freebsd.org)
Message-Id: <200912251938.nBPJcCS4069651@svn.freebsd.org>
From: Gavin Atkinson 
Date: Fri, 25 Dec 2009 19:38:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200993 - head/sys/dev/ae
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 19:38:13 -0000

Author: gavin
Date: Fri Dec 25 19:38:12 2009
New Revision: 200993
URL: http://svn.freebsd.org/changeset/base/200993

Log:
  Small spelling fix, "Ethetnet" -> "Ethernet"
  
  Approved by:	ed (mentor)
  MFC after:	1 week

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==============================================================================
--- head/sys/dev/ae/if_ae.c	Fri Dec 25 18:05:06 2009	(r200992)
+++ head/sys/dev/ae/if_ae.c	Fri Dec 25 19:38:12 2009	(r200993)
@@ -1047,7 +1047,7 @@ ae_get_reg_eaddr(ae_softc_t *sc, uint32_
 	if (AE_CHECK_EADDR_VALID(eaddr) != 0) {
 		if (bootverbose)
 			device_printf(sc->dev,
-			    "Ethetnet address registers are invalid.\n");
+			    "Ethernet address registers are invalid.\n");
 		return (EINVAL);
 	}
 	return (0);

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 19:57:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4603C1065695;
	Fri, 25 Dec 2009 19:57:29 +0000 (UTC)
	(envelope-from gavin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 347838FC19;
	Fri, 25 Dec 2009 19:57:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPJvT1e070030;
	Fri, 25 Dec 2009 19:57:29 GMT (envelope-from gavin@svn.freebsd.org)
Received: (from gavin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPJvTlH070028;
	Fri, 25 Dec 2009 19:57:29 GMT (envelope-from gavin@svn.freebsd.org)
Message-Id: <200912251957.nBPJvTlH070028@svn.freebsd.org>
From: Gavin Atkinson 
Date: Fri, 25 Dec 2009 19:57:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200994 - head/sys/dev/jme
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 19:57:29 -0000

Author: gavin
Date: Fri Dec 25 19:57:28 2009
New Revision: 200994
URL: http://svn.freebsd.org/changeset/base/200994

Log:
  Set the locally-assigned bit in the randomly generated Ethernet address
  if we end up having to generate one.
  
  PR:		kern/133239
  Discussed with:	yongari
  Approved by:	ed (mentor)
  MFC after:	2 weeks

Modified:
  head/sys/dev/jme/if_jme.c

Modified: head/sys/dev/jme/if_jme.c
==============================================================================
--- head/sys/dev/jme/if_jme.c	Fri Dec 25 19:38:12 2009	(r200993)
+++ head/sys/dev/jme/if_jme.c	Fri Dec 25 19:57:28 2009	(r200994)
@@ -465,7 +465,7 @@ jme_reg_macaddr(struct jme_softc *sc)
 		    "generating fake ethernet address.\n");
 		par0 = arc4random();
 		/* Set OUI to JMicron. */
-		sc->jme_eaddr[0] = 0x00;
+		sc->jme_eaddr[0] = 0x02;	/* U/L bit set. */
 		sc->jme_eaddr[1] = 0x1B;
 		sc->jme_eaddr[2] = 0x8C;
 		sc->jme_eaddr[3] = (par0 >> 16) & 0xff;

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 20:03:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E0C2B106566B;
	Fri, 25 Dec 2009 20:03:03 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CF7ED8FC14;
	Fri, 25 Dec 2009 20:03:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPK33cx070185;
	Fri, 25 Dec 2009 20:03:03 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPK33nZ070183;
	Fri, 25 Dec 2009 20:03:03 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200912252003.nBPK33nZ070183@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 25 Dec 2009 20:03:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200995 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 20:03:04 -0000

Author: bz
Date: Fri Dec 25 20:03:03 2009
New Revision: 200995
URL: http://svn.freebsd.org/changeset/base/200995

Log:
  Remove an unused global.
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Fri Dec 25 19:57:28 2009	(r200994)
+++ head/sys/kern/kern_proc.c	Fri Dec 25 20:03:03 2009	(r200995)
@@ -140,7 +140,6 @@ struct sx allproc_lock;
 struct sx proctree_lock;
 struct mtx ppeers_lock;
 uma_zone_t proc_zone;
-uma_zone_t ithread_zone;
 
 int kstack_pages = KSTACK_PAGES;
 SYSCTL_INT(_kern, OID_AUTO, kstack_pages, CTLFLAG_RD, &kstack_pages, 0, "");

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 20:04:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD1E4106568D;
	Fri, 25 Dec 2009 20:04:36 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CBC338FC1D;
	Fri, 25 Dec 2009 20:04:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPK4a1Z070249;
	Fri, 25 Dec 2009 20:04:36 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPK4arI070247;
	Fri, 25 Dec 2009 20:04:36 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912252004.nBPK4arI070247@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 25 Dec 2009 20:04:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200996 - head/lib/libulog
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 20:04:37 -0000

Author: ed
Date: Fri Dec 25 20:04:36 2009
New Revision: 200996
URL: http://svn.freebsd.org/changeset/base/200996

Log:
  Don't corrupt logout entries in utmp files.
  
  An older version of the code used a structure on the stack, instead of a
  pointer to the structure. It looks like I didn't adjust the parameters
  of the write(2) call, causing the first four/eight bytes of the entry to
  be corrupted, instead of writing the entire entry to disk.

Modified:
  head/lib/libulog/ulog_pututxline.c

Modified: head/lib/libulog/ulog_pututxline.c
==============================================================================
--- head/lib/libulog/ulog_pututxline.c	Fri Dec 25 20:03:03 2009	(r200995)
+++ head/lib/libulog/ulog_pututxline.c	Fri Dec 25 20:04:36 2009	(r200996)
@@ -126,7 +126,7 @@ ulog_write_utmp_slow(const struct futmp 
 		    strncmp(utf.ut_line, ut->ut_line, sizeof utf.ut_line) != 0)
 			continue;
 		lseek(fd, -(off_t)sizeof utf, SEEK_CUR);
-		write(fd, &ut, sizeof ut);
+		write(fd, ut, sizeof *ut);
 		found = 1;
 	}
 	close(fd);

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 20:07:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D68E71065670;
	Fri, 25 Dec 2009 20:07:48 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C55838FC08;
	Fri, 25 Dec 2009 20:07:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPK7m9p070342;
	Fri, 25 Dec 2009 20:07:48 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPK7mET070340;
	Fri, 25 Dec 2009 20:07:48 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912252007.nBPK7mET070340@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 25 Dec 2009 20:07:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200997 - head/usr.bin/rwho
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 20:07:48 -0000

Author: ed
Date: Fri Dec 25 20:07:48 2009
New Revision: 200997
URL: http://svn.freebsd.org/changeset/base/200997

Log:
  Let the width of the username column depend on the rwho file format.
  
  Right now the code uses UT_NAMESIZE, but this makes little sense,
  because rwho(1) parses files generated by rwhod(8). Not utmp(5) files.

Modified:
  head/usr.bin/rwho/rwho.c

Modified: head/usr.bin/rwho/rwho.c
==============================================================================
--- head/usr.bin/rwho/rwho.c	Fri Dec 25 20:04:36 2009	(r200996)
+++ head/usr.bin/rwho/rwho.c	Fri Dec 25 20:07:48 2009	(r200997)
@@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 DIR	*dirp;
 
@@ -172,7 +171,7 @@ main(int argc, char *argv[])
 		(void)sprintf(buf, "%s:%-.*s", mp->myhost,
 		   sizeof(mp->myutmp.out_line), mp->myutmp.out_line);
 		printf("%-*.*s %-*s %s",
-		   UT_NAMESIZE, sizeof(mp->myutmp.out_name),
+		   sizeof(mp->myutmp.out_name), sizeof(mp->myutmp.out_name),
 		   mp->myutmp.out_name,
 		   width,
 		   buf,

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 20:21:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 882C01065670;
	Fri, 25 Dec 2009 20:21:35 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 75FB38FC22;
	Fri, 25 Dec 2009 20:21:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPKLZNZ070623;
	Fri, 25 Dec 2009 20:21:35 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPKLZhi070618;
	Fri, 25 Dec 2009 20:21:35 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912252021.nBPKLZhi070618@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 25 Dec 2009 20:21:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200998 - in head: bin/sh
	tools/regression/bin/sh/builtins
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 20:21:35 -0000

Author: jilles
Date: Fri Dec 25 20:21:35 2009
New Revision: 200998
URL: http://svn.freebsd.org/changeset/base/200998

Log:
  sh: Do not run callers' exception handlers in subshells.
  
  Reset the exception handler in the child to main's.
  
  This avoids inappropriate double cleanups or shell duplication when the
  exception is caught, such as 'fc' and future 'command eval' and 'command .'.

Added:
  head/tools/regression/bin/sh/builtins/fc2.0   (contents, props changed)
Modified:
  head/bin/sh/jobs.c
  head/bin/sh/main.c
  head/bin/sh/main.h

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Fri Dec 25 20:07:48 2009	(r200997)
+++ head/bin/sh/jobs.c	Fri Dec 25 20:21:35 2009	(r200998)
@@ -757,6 +757,7 @@ forkshell(struct job *jp, union node *n,
 		TRACE(("Child shell %d\n", (int)getpid()));
 		wasroot = rootshell;
 		rootshell = 0;
+		handler = &main_handler;
 		closescript();
 		INTON;
 		clear_traps();

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Fri Dec 25 20:07:48 2009	(r200997)
+++ head/bin/sh/main.c	Fri Dec 25 20:21:35 2009	(r200998)
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 
 int rootpid;
 int rootshell;
+struct jmploc main_handler;
 
 STATIC void read_profile(char *);
 STATIC char *find_dot_file(char *);
@@ -90,14 +91,13 @@ STATIC char *find_dot_file(char *);
 int
 main(int argc, char *argv[])
 {
-	struct jmploc jmploc;
 	struct stackmark smark;
 	volatile int state;
 	char *shinit;
 
 	(void) setlocale(LC_ALL, "");
 	state = 0;
-	if (setjmp(jmploc.loc)) {
+	if (setjmp(main_handler.loc)) {
 		/*
 		 * When a shell procedure is executed, we raise the
 		 * exception EXSHELLPROC to clean up before executing
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
 		else
 			goto state4;
 	}
-	handler = &jmploc;
+	handler = &main_handler;
 #ifdef DEBUG
 	opentrace();
 	trputs("Shell args:  ");  trargs(argv);

Modified: head/bin/sh/main.h
==============================================================================
--- head/bin/sh/main.h	Fri Dec 25 20:07:48 2009	(r200997)
+++ head/bin/sh/main.h	Fri Dec 25 20:21:35 2009	(r200998)
@@ -35,6 +35,7 @@
 
 extern int rootpid;	/* pid of main shell */
 extern int rootshell;	/* true if we aren't a child of the main shell */
+extern struct jmploc main_handler;	/* top level exception handler */
 
 void readcmdfile(const char *);
 void cmdloop(int);

Added: head/tools/regression/bin/sh/builtins/fc2.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/fc2.0	Fri Dec 25 20:21:35 2009	(r200998)
@@ -0,0 +1,34 @@
+# $FreeBSD$
+set -e
+trap 'echo Broken pipe -- test failed' pipe
+
+P=${TMPDIR:-/tmp}
+cd $P
+T=$(mktemp -d sh-test.XXXXXX)
+cd $T
+
+mkfifo input output error
+HISTFILE=/dev/null sh +m -i output 2>error &
+exec 3>input
+{
+	# Command not found, containing slash
+	echo '/var/empty/nonexistent' >&3
+	# Read error message, shell will read new input now
+	read dummy <&5
+	# Execute bad command again
+	echo 'fc -e true; echo continued' >&3
+	read dummy <&5
+	read line <&4 && [ "$line" = continued ] && : ${rc:=0}
+	exec 3>&-
+	# Old sh duplicates itself after the fc, producing another line
+	# of output.
+	if read line <&4; then
+		echo "Extraneous output: $line"
+		rc=1
+	fi
+} 4&-
+
+rm input output error
+rmdir ${P}/${T}
+exit ${rc:-3}

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 20:44:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC0AC106568F;
	Fri, 25 Dec 2009 20:44:19 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 98FBD8FC0C;
	Fri, 25 Dec 2009 20:44:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPKiJ4Z071082;
	Fri, 25 Dec 2009 20:44:19 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPKiJQp071077;
	Fri, 25 Dec 2009 20:44:19 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200912252044.nBPKiJQp071077@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 25 Dec 2009 20:44:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r200999 - in head/sys/fs: nfs nfsserver
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 20:44:19 -0000

Author: rmacklem
Date: Fri Dec 25 20:44:19 2009
New Revision: 200999
URL: http://svn.freebsd.org/changeset/base/200999

Log:
  Modify the experimental server so that it uses VOP_ACCESSX().
  This is necessary in order to enable NFSv4 ACL support. The
  argument to nfsvno_accchk() was changed to an accmode_t and
  the function nfsrv_aclaccess() was no longer needed and,
  therefore, deleted.
  
  Reviewed by:	trasz
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfs/nfs_commonacl.c
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfs/nfs_commonacl.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonacl.c	Fri Dec 25 20:21:35 2009	(r200998)
+++ head/sys/fs/nfs/nfs_commonacl.c	Fri Dec 25 20:44:19 2009	(r200999)
@@ -437,70 +437,6 @@ nfsrv_buildacl(struct nfsrv_descript *nd
 }
 
 /*
- * Check access for an NFSv4 acl.
- * The vflags are the basic VREAD, VWRITE, VEXEC. The mask is the NFSV4ACE
- * mask bits for the more detailed check.
- * If the more detailed check fails, due to no acl, do a basic one.
- */
-APPLESTATIC int
-nfsrv_aclaccess(vnode_t vp, accmode_t vflags, u_int32_t mask,
-    struct ucred *cred, NFSPROC_T *p)
-{
-	int error = 0;
-	accmode_t access;
-
-	if (nfsrv_useacl == 0) {
-		error = VOP_ACCESS(vp, vflags, cred, p);
-		return (error);
-	}
-
-	/* Convert NFSV4ACE mask to vaccess_t */
-	access = 0;
-	if (mask & NFSV4ACE_READDATA)
-		access |= VREAD;
-	if (mask & NFSV4ACE_LISTDIRECTORY)
-		access |= VREAD;
-	if (mask & NFSV4ACE_WRITEDATA)
-		access |= VWRITE;
-	if (mask & NFSV4ACE_ADDFILE)
-		access |= VWRITE;
-	if (mask & NFSV4ACE_APPENDDATA)
-		access |= VAPPEND;
-	if (mask & NFSV4ACE_ADDSUBDIRECTORY)
-		access |= VAPPEND;
-	if (mask & NFSV4ACE_READNAMEDATTR)
-		access |= VREAD_NAMED_ATTRS;
-	if (mask & NFSV4ACE_WRITENAMEDATTR)
-		access |= VWRITE_NAMED_ATTRS;
-	if (mask & NFSV4ACE_EXECUTE)
-		access |= VEXEC;
-	if (mask & NFSV4ACE_SEARCH)
-		access |= VEXEC;
-	if (mask & NFSV4ACE_DELETECHILD)
-		access |= VDELETE_CHILD;
-	if (mask & NFSV4ACE_READATTRIBUTES)
-		access |= VREAD_ATTRIBUTES;
-	if (mask & NFSV4ACE_WRITEATTRIBUTES)
-		access |= VWRITE_ATTRIBUTES;
-	if (mask & NFSV4ACE_DELETE)
-		access |= VDELETE;
-	if (mask & NFSV4ACE_READACL)
-		access |= VREAD_ACL;
-	if (mask & NFSV4ACE_WRITEACL)
-		access |= VWRITE_ACL;
-	if (mask & NFSV4ACE_WRITEOWNER)
-		access |= VWRITE_OWNER;
-	if (mask & NFSV4ACE_SYNCHRONIZE)
-		access |= VSYNCHRONIZE;
-
-	if (access != 0)
-		error = VOP_ACCESS(vp, access, cred, p);
-	else
-		error = VOP_ACCESS(vp, vflags, cred, p);
-	return (error);
-}
-
-/*
  * Set an NFSv4 acl.
  */
 APPLESTATIC int

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Fri Dec 25 20:21:35 2009	(r200998)
+++ head/sys/fs/nfs/nfs_var.h	Fri Dec 25 20:44:19 2009	(r200999)
@@ -331,8 +331,6 @@ int nfsrv_dissectace(struct nfsrv_descri
     int *, int *, NFSPROC_T *);
 int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
     NFSPROC_T *);
-int nfsrv_aclaccess(vnode_t, accmode_t, u_int32_t, struct ucred *,
-    NFSPROC_T *);
 int nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *,
     NFSPROC_T *);
 int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
@@ -514,8 +512,8 @@ int nfsvno_getattr(vnode_t, struct nfsva
 int nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *,
     NFSPROC_T *, struct nfsexstuff *);
 int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *);
-int nfsvno_accchk(vnode_t, u_int32_t, struct ucred *,
-    struct nfsexstuff *, NFSPROC_T *, int, int);
+int nfsvno_accchk(vnode_t, accmode_t, struct ucred *,
+    struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *);
 int nfsvno_namei(struct nfsrv_descript *, struct nameidata *,
     vnode_t, int, struct nfsexstuff *, NFSPROC_T *, vnode_t *);
 void nfsvno_setpathbuf(struct nameidata *, char **, u_long **);

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c	Fri Dec 25 20:21:35 2009	(r200998)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c	Fri Dec 25 20:44:19 2009	(r200999)
@@ -131,32 +131,20 @@ nfsvno_getfh(struct vnode *vp, fhandle_t
 /*
  * Perform access checking for vnodes obtained from file handles that would
  * refer to files already opened by a Unix client. You cannot just use
- * vn_writechk() and VOP_ACCESS() for two reasons.
- * 1 - You must check for exported rdonly as well as MNT_RDONLY for the write case
+ * vn_writechk() and VOP_ACCESSX() for two reasons.
+ * 1 - You must check for exported rdonly as well as MNT_RDONLY for the write
+ *     case.
  * 2 - The owner is to be given access irrespective of mode bits for some
  *     operations, so that processes that chmod after opening a file don't
  *     break.
  */
 int
-nfsvno_accchk(struct vnode *vp, u_int32_t accessbits, struct ucred *cred,
-    struct nfsexstuff *exp, struct thread *p, int override, int vpislocked)
+nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
+    struct nfsexstuff *exp, struct thread *p, int override, int vpislocked,
+    u_int32_t *supportedtypep)
 {
 	struct vattr vattr;
 	int error = 0, getret = 0;
-	accmode_t accmode;
-
-	/*
-	 * Convert accessbits to Vxxx flags.
-	 */
-	if (accessbits & (NFSV4ACE_WRITEDATA | NFSV4ACE_APPENDDATA |
-	    NFSV4ACE_ADDFILE | NFSV4ACE_ADDSUBDIRECTORY |
-	    NFSV4ACE_DELETECHILD | NFSV4ACE_WRITEATTRIBUTES |
-	    NFSV4ACE_DELETE | NFSV4ACE_WRITEACL | NFSV4ACE_WRITEOWNER))
-		accmode = VWRITE;
-	else if (accessbits & (NFSV4ACE_EXECUTE | NFSV4ACE_SEARCH))
-		accmode = VEXEC;
-	else
-		accmode = VREAD;
 
 	if (accmode & VWRITE) {
 		/* Just vn_writechk() changed to check rdonly */
@@ -166,7 +154,7 @@ nfsvno_accchk(struct vnode *vp, u_int32_
 		 * device resident on the file system.
 		 */
 		if (NFSVNO_EXRDONLY(exp) ||
-			(vp->v_mount->mnt_flag & MNT_RDONLY)) {
+		    (vp->v_mount->mnt_flag & MNT_RDONLY)) {
 			switch (vp->v_type) {
 			case VREG:
 			case VDIR:
@@ -187,22 +175,26 @@ nfsvno_accchk(struct vnode *vp, u_int32_
 	if (vpislocked == 0)
 		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY, p);
 
-#if defined(NFS4_ACL_EXTATTR_NAME) && defined(notyet)
-	/*
-	 * This function should be called once FFS has NFSv4 ACL support
-	 * in it.
-	 */
 	/*
 	 * Should the override still be applied when ACLs are enabled?
 	 */
-	if (nfsrv_useacl != 0 && NFSHASNFS4ACL(vp->v_mount))
-		error = nfsrv_aclaccess(vp, accmode, accessbits, cred, p);
-	else
-#endif
-	if (accessbits == NFSV4ACE_READATTRIBUTES)
-		error = 0;
-	else
-		error = VOP_ACCESS(vp, accmode, cred, p);
+	error = VOP_ACCESSX(vp, accmode, cred, p);
+	if (error != 0 && (accmode & (VDELETE | VDELETE_CHILD))) {
+		/*
+		 * Try again with VEXPLICIT_DENY, to see if the test for
+		 * deletion is supported.
+		 */
+		error = VOP_ACCESSX(vp, accmode | VEXPLICIT_DENY, cred, p);
+		if (error == 0) {
+			if (vp->v_type == VDIR) {
+				accmode &= ~(VDELETE | VDELETE_CHILD);
+				accmode |= VWRITE;
+				error = VOP_ACCESSX(vp, accmode, cred, p);
+			} else if (supportedtypep != NULL) {
+				*supportedtypep &= ~NFSACCESS_DELETE;
+			}
+		}
+	}
 
 	/*
 	 * Allow certain operations for the owner (reads and writes
@@ -790,9 +782,9 @@ nfsvno_createsub(struct nfsrv_descript *
 		else
 			vput(ndp->ni_dvp);
 		if (!error && nvap->na_size != VNOVAL) {
-			error = nfsvno_accchk(*vpp, NFSV4ACE_ADDFILE,
+			error = nfsvno_accchk(*vpp, VWRITE,
 			    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
-			    NFSACCCHK_VPISLOCKED);
+			    NFSACCCHK_VPISLOCKED, NULL);
 			if (!error) {
 				tempsize = nvap->na_size;
 				NFSVNO_ATTRINIT(nvap);
@@ -1334,8 +1326,9 @@ nfsvno_open(struct nfsrv_descript *nd, s
 				else
 					NFSVNO_EXINIT(&nes);
 				nd->nd_repstat = nfsvno_accchk(vp, 
-				    NFSV4ACE_ADDFILE, cred, &nes, p,
-				    NFSACCCHK_NOOVERRIDE,NFSACCCHK_VPISLOCKED);
+				    VWRITE, cred, &nes, p,
+				    NFSACCCHK_NOOVERRIDE,
+				    NFSACCCHK_VPISLOCKED, NULL);
 				nd->nd_repstat = nfsrv_opencheck(clientid,
 				    stateidp, stp, vp, nd, p, nd->nd_repstat);
 				if (!nd->nd_repstat) {
@@ -1481,9 +1474,9 @@ nfsrvd_readdir(struct nfsrv_descript *nd
 #endif
 	}
 	if (!nd->nd_repstat)
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_SEARCH,
+		nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 		    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
-		    NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_VPISLOCKED, NULL);
 	if (nd->nd_repstat) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV3)
@@ -1752,9 +1745,9 @@ nfsrvd_readdirplus(struct nfsrv_descript
 	if (!nd->nd_repstat && cnt == 0)
 		nd->nd_repstat = NFSERR_TOOSMALL;
 	if (!nd->nd_repstat)
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_SEARCH,
+		nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 		    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
-		    NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_VPISLOCKED, NULL);
 	if (nd->nd_repstat) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV3)

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Dec 25 20:21:35 2009	(r200998)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Dec 25 20:44:19 2009	(r200999)
@@ -88,6 +88,7 @@ nfsrvd_access(struct nfsrv_descript *nd,
 	int getret, error = 0;
 	struct nfsvattr nva;
 	u_int32_t testmode, nfsmode, supported = 0;
+	accmode_t deletebit;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, 1, &nva);
@@ -105,26 +106,30 @@ nfsrvd_access(struct nfsrv_descript *nd,
 	}
 	if (nfsmode & NFSACCESS_READ) {
 		supported |= NFSACCESS_READ;
-		if (nfsvno_accchk(vp, NFSV4ACE_READDATA, nd->nd_cred, exp, p,
-		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED))
+		if (nfsvno_accchk(vp, VREAD, nd->nd_cred, exp, p,
+		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED, &supported))
 			nfsmode &= ~NFSACCESS_READ;
 	}
 	if (nfsmode & NFSACCESS_MODIFY) {
 		supported |= NFSACCESS_MODIFY;
-		if (nfsvno_accchk(vp, NFSV4ACE_WRITEDATA, nd->nd_cred, exp, p,
-		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED))
+		if (nfsvno_accchk(vp, VWRITE, nd->nd_cred, exp, p,
+		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED, &supported))
 			nfsmode &= ~NFSACCESS_MODIFY;
 	}
 	if (nfsmode & NFSACCESS_EXTEND) {
 		supported |= NFSACCESS_EXTEND;
-		if (nfsvno_accchk(vp, NFSV4ACE_APPENDDATA, nd->nd_cred, exp, p,
-		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED))
+		if (nfsvno_accchk(vp, VWRITE | VAPPEND, nd->nd_cred, exp, p,
+		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED, &supported))
 			nfsmode &= ~NFSACCESS_EXTEND;
 	}
 	if (nfsmode & NFSACCESS_DELETE) {
 		supported |= NFSACCESS_DELETE;
-		if (nfsvno_accchk(vp, NFSV4ACE_DELETE, nd->nd_cred, exp, p,
-		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED))
+		if (vp->v_type == VDIR)
+			deletebit = VDELETE_CHILD;
+		else
+			deletebit = VDELETE;
+		if (nfsvno_accchk(vp, deletebit, nd->nd_cred, exp, p,
+		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED, &supported))
 			nfsmode &= ~NFSACCESS_DELETE;
 	}
 	if (vnode_vtype(vp) == VDIR)
@@ -133,8 +138,8 @@ nfsrvd_access(struct nfsrv_descript *nd,
 		testmode = NFSACCESS_EXECUTE;
 	if (nfsmode & testmode) {
 		supported |= (nfsmode & testmode);
-		if (nfsvno_accchk(vp, NFSV4ACE_EXECUTE, nd->nd_cred, exp, p,
-		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED))
+		if (nfsvno_accchk(vp, VEXEC, nd->nd_cred, exp, p,
+		    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED, &supported))
 			nfsmode &= ~testmode;
 	}
 	nfsmode &= supported;
@@ -189,9 +194,9 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 		}
 		if (!nd->nd_repstat)
 			nd->nd_repstat = nfsvno_accchk(vp,
-			    NFSV4ACE_READATTRIBUTES,
-			    nd->nd_cred, exp, p,
-			    NFSACCCHK_NOOVERRIDE, NFSACCCHK_VPISLOCKED);
+			    VREAD_ATTRIBUTES,
+			    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
+			    NFSACCCHK_VPISLOCKED, NULL);
 	}
 	if (!nd->nd_repstat)
 		nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p);
@@ -291,8 +296,9 @@ nfsrvd_setattr(struct nfsrv_descript *nd
 			else if (nva2.na_uid != nd->nd_cred->cr_uid ||
 			    NFSVNO_EXSTRICTACCESS(exp))
 				nd->nd_repstat = nfsvno_accchk(vp,
-				    NFSV4ACE_WRITEDATA, nd->nd_cred, exp, p,
-				    NFSACCCHK_NOOVERRIDE,NFSACCCHK_VPISLOCKED);
+				    VWRITE, nd->nd_cred, exp, p,
+				    NFSACCCHK_NOOVERRIDE,
+				    NFSACCCHK_VPISLOCKED, NULL);
 		}
 	}
 	if (!nd->nd_repstat && (nd->nd_flag & ND_NFSV4))
@@ -612,13 +618,13 @@ nfsrvd_read(struct nfsrv_descript *nd, _
 	if (!nd->nd_repstat &&
 	    (nva.na_uid != nd->nd_cred->cr_uid ||
 	     NFSVNO_EXSTRICTACCESS(exp))) {
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_READDATA,
+		nd->nd_repstat = nfsvno_accchk(vp, VREAD,
 		    nd->nd_cred, exp, p,
-		    NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
 		if (nd->nd_repstat)
-			nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_EXECUTE,
-			    nd->nd_cred, exp, p,
-			    NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED);
+			nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
+			    nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
+			    NFSACCCHK_VPISLOCKED, NULL);
 	}
 	if ((nd->nd_flag & ND_NFSV4) && !nd->nd_repstat)
 		nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid,
@@ -788,9 +794,9 @@ nfsrvd_write(struct nfsrv_descript *nd, 
 	if (!nd->nd_repstat &&
 	    (forat.na_uid != nd->nd_cred->cr_uid ||
 	     NFSVNO_EXSTRICTACCESS(exp)))
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_WRITEDATA,
+		nd->nd_repstat = nfsvno_accchk(vp, VWRITE,
 		    nd->nd_cred, exp, p,
-		    NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
 	if ((nd->nd_flag & ND_NFSV4) && !nd->nd_repstat) {
 		nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid,
 		    &stateid, exp, nd, p);
@@ -2146,17 +2152,17 @@ nfsrvd_lock(struct nfsrv_descript *nd, _
 	}
 	if (!nd->nd_repstat) {
 	    if (lflags & NFSLCK_WRITE) {
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_WRITEDATA,
+		nd->nd_repstat = nfsvno_accchk(vp, VWRITE,
 		    nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
-		    NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_VPISLOCKED, NULL);
 	    } else {
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_READDATA,
+		nd->nd_repstat = nfsvno_accchk(vp, VREAD,
 		    nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
-		    NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_VPISLOCKED, NULL);
 		if (nd->nd_repstat)
-		    nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_EXECUTE,
+		    nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 			nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
-			NFSACCCHK_VPISLOCKED);
+			NFSACCCHK_VPISLOCKED, NULL);
 	    }
 	}
 
@@ -2672,15 +2678,15 @@ nfsrvd_open(struct nfsrv_descript *nd, _
 		nd->nd_repstat = NFSERR_INVAL;
 	}
 	if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_WRITEACCESS))
-	    nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_WRITEDATA, nd->nd_cred,
-	        exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED);
+	    nd->nd_repstat = nfsvno_accchk(vp, VWRITE, nd->nd_cred,
+	        exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
 	if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_READACCESS)) {
-	    nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_READDATA, nd->nd_cred,
-	        exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED);
+	    nd->nd_repstat = nfsvno_accchk(vp, VREAD, nd->nd_cred,
+	        exp, p, NFSACCCHK_ALLOWOWNER, NFSACCCHK_VPISLOCKED, NULL);
 	    if (nd->nd_repstat)
-		nd->nd_repstat = nfsvno_accchk(vp, NFSV4ACE_EXECUTE,
+		nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 		    nd->nd_cred, exp, p, NFSACCCHK_ALLOWOWNER,
-		    NFSACCCHK_VPISLOCKED);
+		    NFSACCCHK_VPISLOCKED, NULL);
 	}
 
 	if (!nd->nd_repstat) {

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 21:14:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1764106566B;
	Fri, 25 Dec 2009 21:14:05 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A70628FC13;
	Fri, 25 Dec 2009 21:14:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPLE5uZ071689;
	Fri, 25 Dec 2009 21:14:05 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLE59U071687;
	Fri, 25 Dec 2009 21:14:05 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200912252114.nBPLE59U071687@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 25 Dec 2009 21:14:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201000 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 21:14:05 -0000

Author: bz
Date: Fri Dec 25 21:14:05 2009
New Revision: 201000
URL: http://svn.freebsd.org/changeset/base/201000

Log:
  Remove extra spaces (no functional change).
  
  MFC after:	3 days

Modified:
  head/sys/kern/kern_rmlock.c

Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c	Fri Dec 25 20:44:19 2009	(r200999)
+++ head/sys/kern/kern_rmlock.c	Fri Dec 25 21:14:05 2009	(r201000)
@@ -147,7 +147,7 @@ rm_tracker_add(struct pcpu *pc, struct r
 	next->rmq_prev = &tracker->rmp_cpuQueue;
 
 	/* Update pointer to first element. */
-	pc->pc_rm_queue.rmq_next =  &tracker->rmp_cpuQueue;
+	pc->pc_rm_queue.rmq_next = &tracker->rmp_cpuQueue;
 }
 
 static void inline
@@ -278,7 +278,7 @@ _rm_rlock_hard(struct rmlock *rm, struct
 		 * for this lock on the per-cpu queue.
 		 */
 		for (queue = pc->pc_rm_queue.rmq_next;
-		    queue !=  &pc->pc_rm_queue; queue = queue->rmq_next) {
+		    queue != &pc->pc_rm_queue; queue = queue->rmq_next) {
 			atracker = (struct rm_priotracker *)queue;
 			if ((atracker->rmp_rmlock == rm) &&
 			    (atracker->rmp_thread == tracker->rmp_thread)) {
@@ -337,7 +337,7 @@ _rm_rlock(struct rmlock *rm, struct rm_p
 	 * Fast path to combine two common conditions into a single
 	 * conditional jump.
 	 */
-	if (0 == (td->td_owepreempt |  rm->rm_noreadtoken))
+	if (0 == (td->td_owepreempt | rm->rm_noreadtoken))
 		return;
 
 	/* We do not have a read token and need to acquire one. */
@@ -413,7 +413,7 @@ _rm_wlock(struct rmlock *rm)
 		 * before rm_cleanIPI is called.
 		 */
 #ifdef SMP
-   		smp_rendezvous(smp_no_rendevous_barrier,
+		smp_rendezvous(smp_no_rendevous_barrier,
 		    rm_cleanIPI,
 		    smp_no_rendevous_barrier,
 		    rm);
@@ -487,7 +487,7 @@ _rm_rlock_debug(struct rmlock *rm, struc
 }
 
 void
-_rm_runlock_debug(struct rmlock *rm,  struct rm_priotracker *tracker,
+_rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
     const char *file, int line)
 {
 
@@ -526,7 +526,7 @@ _rm_rlock_debug(struct rmlock *rm, struc
 }
 
 void
-_rm_runlock_debug(struct rmlock *rm,  struct rm_priotracker *tracker,
+_rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
     const char *file, int line)
 {
 

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 21:14:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68637106566C;
	Fri, 25 Dec 2009 21:14:34 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 57EC38FC17;
	Fri, 25 Dec 2009 21:14:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPLEYbK071735;
	Fri, 25 Dec 2009 21:14:34 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLEYW8071733;
	Fri, 25 Dec 2009 21:14:34 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200912252114.nBPLEYW8071733@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Fri, 25 Dec 2009 21:14:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201001 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 21:14:34 -0000

Author: ru
Date: Fri Dec 25 21:14:34 2009
New Revision: 201001
URL: http://svn.freebsd.org/changeset/base/201001

Log:
  Fixed two typos.
  
  Submitted by:	Maxim Dounin 

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Fri Dec 25 21:14:05 2009	(r201000)
+++ head/UPDATING	Fri Dec 25 21:14:34 2009	(r201001)
@@ -161,7 +161,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 20090712: 
 	Padding has been added to struct tcpcb, sackhint and tcpstat in
 	 to facilitate future MFCs and bug fixes whilst
-	maintainig the ABI. However, this change breaks the ABI, so bump
+	maintaining the ABI. However, this change breaks the ABI, so bump
 	__FreeBSD_version to 800102. User space tools that rely on the size of
 	any of these structs (e.g. sockstat) need to be recompiled.
 
@@ -895,7 +895,7 @@ COMMON ITEMS:
 	-------------
 	Avoid using make -j when upgrading.  While generally safe, there are
 	sometimes problems using -j to upgrade.  If your upgrade fails with
-	-j, please try again wtihout -j.  From time to time in the past there
+	-j, please try again without -j.  From time to time in the past there
 	have been problems using -j with buildworld and/or installworld.  This
 	is especially true when upgrading between "distant" versions (eg one
 	that cross a major release boundary or several minor releases, or when

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 21:32:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AB0AF1065679;
	Fri, 25 Dec 2009 21:32:26 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 99CC28FC20;
	Fri, 25 Dec 2009 21:32:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPLWQ6X072122;
	Fri, 25 Dec 2009 21:32:26 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLWQxU072118;
	Fri, 25 Dec 2009 21:32:26 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252132.nBPLWQxU072118@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 21:32:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201003 - head/sys/dev/mk48txx
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 21:32:26 -0000

Author: marius
Date: Fri Dec 25 21:32:26 2009
New Revision: 201003
URL: http://svn.freebsd.org/changeset/base/201003

Log:
  Style changes

Modified:
  head/sys/dev/mk48txx/mk48txx.c
  head/sys/dev/mk48txx/mk48txxreg.h
  head/sys/dev/mk48txx/mk48txxvar.h

Modified: head/sys/dev/mk48txx/mk48txx.c
==============================================================================
--- head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:28:16 2009	(r201002)
+++ head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:32:26 2009	(r201003)
@@ -40,7 +40,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines.
+ * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines
  */
 
 #include 
@@ -59,17 +59,17 @@ __FBSDID("$FreeBSD$");
 
 #include "clock_if.h"
 
-static uint8_t	mk48txx_def_nvrd(device_t, int);
-static void	mk48txx_def_nvwr(device_t, int, uint8_t);
-static void	mk48txx_watchdog(void *, u_int, int *);
+static uint8_t	mk48txx_def_nvrd(device_t dev, int off);
+static void	mk48txx_def_nvwr(device_t dev, int off, uint8_t v);
+static void	mk48txx_watchdog(void *arg, u_int cmd, int *error);
 
-struct {
+static const struct {
 	const char *name;
 	bus_size_t nvramsz;
 	bus_size_t clkoff;
-	int flags;
-#define MK48TXX_EXT_REGISTERS	1	/* Has extended register set */
-} mk48txx_models[] = {
+	u_int flags;
+#define	MK48TXX_EXT_REGISTERS	1	/* Has extended register set. */
+} const mk48txx_models[] = {
 	{ "mk48t02", MK48T02_CLKSZ, MK48T02_CLKOFF, 0 },
 	{ "mk48t08", MK48T08_CLKSZ, MK48T08_CLKOFF, 0 },
 	{ "mk48t18", MK48T18_CLKSZ, MK48T18_CLKOFF, 0 },
@@ -112,7 +112,7 @@ mk48txx_attach(device_t dev)
 
 	if (mk48txx_models[i].flags & MK48TXX_EXT_REGISTERS) {
 		mtx_lock(&sc->sc_mtx);
-	    	if ((*sc->sc_nvrd)(dev, sc->sc_clkoffset + MK48TXX_FLAGS) &
+		if ((*sc->sc_nvrd)(dev, sc->sc_clkoffset + MK48TXX_FLAGS) &
 		    MK48TXX_FLAGS_BL) {
 			mtx_unlock(&sc->sc_mtx);
 			device_printf(dev, "%s: battery low\n", __func__);
@@ -140,7 +140,7 @@ mk48txx_attach(device_t dev)
 		}
 	}
 
-	clock_register(dev, 1000000);	/* 1 second resolution. */
+	clock_register(dev, 1000000);	/* 1 second resolution */
 
 	if ((sc->sc_flag & MK48TXX_WDOG_REGISTER) &&
 	    (mk48txx_models[i].flags & MK48TXX_EXT_REGISTERS)) {

Modified: head/sys/dev/mk48txx/mk48txxreg.h
==============================================================================
--- head/sys/dev/mk48txx/mk48txxreg.h	Fri Dec 25 21:28:16 2009	(r201002)
+++ head/sys/dev/mk48txx/mk48txxreg.h	Fri Dec 25 21:32:26 2009	(r201003)
@@ -59,23 +59,23 @@
  * The first bank of eight registers at offset (nvramsz - 16) is
  * available only on recenter (which?) MK48Txx models.
  */
-#define MK48TXX_FLAGS	0	/* flags register */
-#define MK48TXX_UNUSED	1	/* unused */
-#define MK48TXX_ASEC	2	/* alarm seconds (0..59; BCD) */
-#define MK48TXX_AMIN	3	/* alarm minutes (0..59; BCD) */
-#define MK48TXX_AHOUR	4	/* alarm hours (0..23; BCD) */
-#define MK48TXX_ADAY	5	/* alarm day in month (1..31; BCD) */
-#define MK48TXX_INTR	6	/* interrupts register */
-#define MK48TXX_WDOG	7	/* watchdog register */
-
-#define MK48TXX_ICSR	8	/* control register */
-#define MK48TXX_ISEC	9	/* seconds (0..59; BCD) */
-#define MK48TXX_IMIN	10	/* minutes (0..59; BCD) */
-#define MK48TXX_IHOUR	11	/* hours (0..23; BCD) */
-#define MK48TXX_IWDAY	12	/* weekday (1..7) */
-#define MK48TXX_IDAY	13	/* day in month (1..31; BCD) */
-#define MK48TXX_IMON	14	/* month (1..12; BCD) */
-#define MK48TXX_IYEAR	15	/* year (0..99; BCD) */
+#define	MK48TXX_FLAGS	0	/* flags register */
+#define	MK48TXX_UNUSED	1	/* unused */
+#define	MK48TXX_ASEC	2	/* alarm seconds (0..59; BCD) */
+#define	MK48TXX_AMIN	3	/* alarm minutes (0..59; BCD) */
+#define	MK48TXX_AHOUR	4	/* alarm hours (0..23; BCD) */
+#define	MK48TXX_ADAY	5	/* alarm day in month (1..31; BCD) */
+#define	MK48TXX_INTR	6	/* interrupts register */
+#define	MK48TXX_WDOG	7	/* watchdog register */
+
+#define	MK48TXX_ICSR	8	/* control register */
+#define	MK48TXX_ISEC	9	/* seconds (0..59; BCD) */
+#define	MK48TXX_IMIN	10	/* minutes (0..59; BCD) */
+#define	MK48TXX_IHOUR	11	/* hours (0..23; BCD) */
+#define	MK48TXX_IWDAY	12	/* weekday (1..7) */
+#define	MK48TXX_IDAY	13	/* day in month (1..31; BCD) */
+#define	MK48TXX_IMON	14	/* month (1..12; BCD) */
+#define	MK48TXX_IYEAR	15	/* year (0..99; BCD) */
 
 /*
  * Note that some of the bits below that are not in the first eight
@@ -84,80 +84,80 @@
  */
 
 /* Bits in the flags register (extended only) */
-#define MK48TXX_FLAGS_BL	0x10	/* battery low (read only) */
-#define MK48TXX_FLAGS_AF	0x40	/* alarm flag (read only) */
-#define MK48TXX_FLAGS_WDF	0x80	/* watchdog flag (read only) */
+#define	MK48TXX_FLAGS_BL	0x10	/* battery low (read only) */
+#define	MK48TXX_FLAGS_AF	0x40	/* alarm flag (read only) */
+#define	MK48TXX_FLAGS_WDF	0x80	/* watchdog flag (read only) */
 
 /* Bits in the alarm seconds register (extended only) */
-#define MK48TXX_ASEC_MASK	0x7f	/* mask for alarm seconds */
-#define MK48TXX_ASEC_RPT1	0x80	/* alarm repeat mode bit 1 */
+#define	MK48TXX_ASEC_MASK	0x7f	/* mask for alarm seconds */
+#define	MK48TXX_ASEC_RPT1	0x80	/* alarm repeat mode bit 1 */
 
 /* Bits in the alarm minutes register (extended only) */
-#define MK48TXX_AMIN_MASK	0x7f	/* mask for alarm minutes */
-#define MK48TXX_AMIN_RPT2	0x80	/* alarm repeat mode bit 2 */
+#define	MK48TXX_AMIN_MASK	0x7f	/* mask for alarm minutes */
+#define	MK48TXX_AMIN_RPT2	0x80	/* alarm repeat mode bit 2 */
 
 /* Bits in the alarm hours register (extended only) */
-#define MK48TXX_AHOUR_MASK	0x3f	/* mask for alarm hours */
-#define MK48TXX_AHOUR_RPT3	0x80	/* alarm repeat mode bit 3 */
+#define	MK48TXX_AHOUR_MASK	0x3f	/* mask for alarm hours */
+#define	MK48TXX_AHOUR_RPT3	0x80	/* alarm repeat mode bit 3 */
 
 /* Bits in the alarm day in month register (extended only) */
-#define MK48TXX_ADAY_MASK	0x3f	/* mask for alarm day in month */
-#define MK48TXX_ADAY_RPT4	0x80	/* alarm repeat mode bit 4 */
+#define	MK48TXX_ADAY_MASK	0x3f	/* mask for alarm day in month */
+#define	MK48TXX_ADAY_RPT4	0x80	/* alarm repeat mode bit 4 */
 
 /* Bits in the interrupts register (extended only) */
-#define MK48TXX_INTR_ABE	0x20	/* alarm in battery back-up mode */
-#define MK48TXX_INTR_AFE	0x80	/* alarm flag enable */
+#define	MK48TXX_INTR_ABE	0x20	/* alarm in battery back-up mode */
+#define	MK48TXX_INTR_AFE	0x80	/* alarm flag enable */
 
 /* Bits in the watchdog register (extended only) */
-#define MK48TXX_WDOG_RB_1_16	0x00	/* watchdog resolution 1/16 second */
-#define MK48TXX_WDOG_RB_1_4	0x01	/* watchdog resolution 1/4 second */
-#define MK48TXX_WDOG_RB_1	0x02	/* watchdog resolution 1 second */
-#define MK48TXX_WDOG_RB_4	0x03	/* watchdog resolution 4 seconds */
-#define MK48TXX_WDOG_BMB_MASK	0x7c	/* mask for watchdog multiplier */
-#define MK48TXX_WDOG_BMB_SHIFT	2	/* shift for watchdog multiplier */
-#define MK48TXX_WDOG_WDS	0x80	/* watchdog steering bit */
+#define	MK48TXX_WDOG_RB_1_16	0x00	/* watchdog resolution 1/16 second */
+#define	MK48TXX_WDOG_RB_1_4	0x01	/* watchdog resolution 1/4 second */
+#define	MK48TXX_WDOG_RB_1	0x02	/* watchdog resolution 1 second */
+#define	MK48TXX_WDOG_RB_4	0x03	/* watchdog resolution 4 seconds */
+#define	MK48TXX_WDOG_BMB_MASK	0x7c	/* mask for watchdog multiplier */
+#define	MK48TXX_WDOG_BMB_SHIFT	2	/* shift for watchdog multiplier */
+#define	MK48TXX_WDOG_WDS	0x80	/* watchdog steering bit */
 
 /* Bits in the control register */
-#define MK48TXX_CSR_CALIB_MASK	0x1f	/* mask for calibration step width */
-#define MK48TXX_CSR_SIGN	0x20	/* sign of above calibration witdh */
-#define MK48TXX_CSR_READ	0x40	/* want to read (freeze clock) */
-#define MK48TXX_CSR_WRITE	0x80	/* want to write */
+#define	MK48TXX_CSR_CALIB_MASK	0x1f	/* mask for calibration step width */
+#define	MK48TXX_CSR_SIGN	0x20	/* sign of above calibration witdh */
+#define	MK48TXX_CSR_READ	0x40	/* want to read (freeze clock) */
+#define	MK48TXX_CSR_WRITE	0x80	/* want to write */
 
 /* Bits in the seconds register */
-#define MK48TXX_SEC_MASK	0x7f	/* mask for seconds */
-#define MK48TXX_SEC_ST		0x80	/* stop oscillator */
+#define	MK48TXX_SEC_MASK	0x7f	/* mask for seconds */
+#define	MK48TXX_SEC_ST		0x80	/* stop oscillator */
 
 /* Bits in the minutes register */
-#define MK48TXX_MIN_MASK	0x7f	/* mask for minutes */
+#define	MK48TXX_MIN_MASK	0x7f	/* mask for minutes */
 
 /* Bits in the hours register */
-#define MK48TXX_HOUR_MASK	0x3f	/* mask for hours */
+#define	MK48TXX_HOUR_MASK	0x3f	/* mask for hours */
 
 /* Bits in the century/weekday register */
-#define MK48TXX_WDAY_MASK	0x07	/* mask for weekday */
-#define MK48TXX_WDAY_CB		0x10	/* century bit (extended only) */
-#define MK48TXX_WDAY_CB_SHIFT	4	/* shift for century bit */
-#define MK48TXX_WDAY_CEB	0x20	/* century enable bit (extended only) */
-#define MK48TXX_WDAY_FT		0x40	/* frequency test */
+#define	MK48TXX_WDAY_MASK	0x07	/* mask for weekday */
+#define	MK48TXX_WDAY_CB		0x10	/* century bit (extended only) */
+#define	MK48TXX_WDAY_CB_SHIFT	4	/* shift for century bit */
+#define	MK48TXX_WDAY_CEB	0x20	/* century enable bit (extended only) */
+#define	MK48TXX_WDAY_FT		0x40	/* frequency test */
 
 /* Bits in the day in month register */
-#define MK48TXX_DAY_MASK	0x3f	/* mask for day in month */
+#define	MK48TXX_DAY_MASK	0x3f	/* mask for day in month */
 
 /* Bits in the month register */
-#define MK48TXX_MON_MASK	0x1f	/* mask for month */
+#define	MK48TXX_MON_MASK	0x1f	/* mask for month */
 
 /* Bits in the year register */
-#define MK48TXX_YEAR_MASK	0xff	/* mask for year */
+#define	MK48TXX_YEAR_MASK	0xff	/* mask for year */
 
 /* Model specific NVRAM sizes and clock offsets */
-#define MK48T02_CLKSZ		2048
-#define MK48T02_CLKOFF		0x7f0
+#define	MK48T02_CLKSZ		2048
+#define	MK48T02_CLKOFF		0x7f0
 
-#define MK48T08_CLKSZ		8192
-#define MK48T08_CLKOFF		0x1ff0
+#define	MK48T08_CLKSZ		8192
+#define	MK48T08_CLKOFF		0x1ff0
 
-#define MK48T18_CLKSZ		8192
-#define MK48T18_CLKOFF		0x1ff0
+#define	MK48T18_CLKSZ		8192
+#define	MK48T18_CLKOFF		0x1ff0
 
-#define MK48T59_CLKSZ		8192
-#define MK48T59_CLKOFF		0x1ff0
+#define	MK48T59_CLKSZ		8192
+#define	MK48T59_CLKOFF		0x1ff0

Modified: head/sys/dev/mk48txx/mk48txxvar.h
==============================================================================
--- head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:28:16 2009	(r201002)
+++ head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:32:26 2009	(r201003)
@@ -38,8 +38,8 @@
  * $FreeBSD$
  */
 
-typedef uint8_t (*mk48txx_nvrd_t)(device_t, int);
-typedef void (*mk48txx_nvwr_t)(device_t, int, uint8_t);
+typedef uint8_t (*mk48txx_nvrd_t)(device_t dev, int off);
+typedef void (*mk48txx_nvwr_t)(device_t dev, int off, uint8_t v);
 
 struct mk48txx_softc {
 	bus_space_tag_t		sc_bst;	/* bus space tag */
@@ -53,17 +53,17 @@ struct mk48txx_softc {
 	bus_size_t	sc_clkoffset;	/* Offset in NVRAM to clock bits */
 	u_int		sc_year0;	/* year counter offset */
 	u_int		sc_flag;	/* MD flags */
-#define MK48TXX_NO_CENT_ADJUST	0x0001	/* don't manually adjust century */
-#define MK48TXX_WDOG_REGISTER	0x0002	/* register watchdog */
-#define MK48TXX_WDOG_ENABLE_WDS	0x0004	/* enable watchdog steering bit */
+#define	MK48TXX_NO_CENT_ADJUST	0x0001	/* don't manually adjust century */
+#define	MK48TXX_WDOG_REGISTER	0x0002	/* register watchdog */
+#define	MK48TXX_WDOG_ENABLE_WDS	0x0004	/* enable watchdog steering bit */
 
 	mk48txx_nvrd_t	sc_nvrd;	/* NVRAM/RTC read function */
 	mk48txx_nvwr_t	sc_nvwr;	/* NVRAM/RTC write function */
 };
 
 /* Chip attach function */
-int mk48txx_attach(device_t);
+int mk48txx_attach(device_t dev);
 
 /* Methods for the clock interface */
-int mk48txx_gettime(device_t, struct timespec *);
-int mk48txx_settime(device_t, struct timespec *);
+int mk48txx_gettime(device_t dev, struct timespec *ts);
+int mk48txx_settime(device_t dev, struct timespec *ts);

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 21:41:05 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C0CC91065672;
	Fri, 25 Dec 2009 21:41:05 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AF8CB8FC0A;
	Fri, 25 Dec 2009 21:41:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPLf51D072326;
	Fri, 25 Dec 2009 21:41:05 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLf5R9072322;
	Fri, 25 Dec 2009 21:41:05 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252141.nBPLf5R9072322@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 21:41:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201004 - head/sys/dev/mk48txx
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 21:41:05 -0000

Author: marius
Date: Fri Dec 25 21:41:05 2009
New Revision: 201004
URL: http://svn.freebsd.org/changeset/base/201004

Log:
  Remove clause 3 and 4 from TNF licenses.
  
  Obtained from:	NetBSD

Modified:
  head/sys/dev/mk48txx/mk48txx.c
  head/sys/dev/mk48txx/mk48txxreg.h
  head/sys/dev/mk48txx/mk48txxvar.h

Modified: head/sys/dev/mk48txx/mk48txx.c
==============================================================================
--- head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:32:26 2009	(r201003)
+++ head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:41:05 2009	(r201004)
@@ -13,13 +13,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -33,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- *	from: NetBSD: mk48txx.c,v 1.15 2004/07/05 09:24:31 pk Exp
+ *	$NetBSD: mk48txx.c,v 1.25 2008/04/28 20:23:50 martin Exp $
  */
 
 #include 

Modified: head/sys/dev/mk48txx/mk48txxreg.h
==============================================================================
--- head/sys/dev/mk48txx/mk48txxreg.h	Fri Dec 25 21:32:26 2009	(r201003)
+++ head/sys/dev/mk48txx/mk48txxreg.h	Fri Dec 25 21:41:05 2009	(r201004)
@@ -13,13 +13,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -33,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- *	from: NetBSD: mk48txxreg.h,v 1.7 2003/11/01 22:41:42 tsutsui Exp
+ *	$NetBSD: mk48txxreg.h,v 1.10 2008/04/28 20:23:50 martin Exp $
  *
  * $FreeBSD$
  */

Modified: head/sys/dev/mk48txx/mk48txxvar.h
==============================================================================
--- head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:32:26 2009	(r201003)
+++ head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:41:05 2009	(r201004)
@@ -13,13 +13,6 @@
  * 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.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -33,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- *	from: NetBSD: mk48txxvar.h,v 1.1 2003/11/01 22:41:42 tsutsui Exp
+ *	$NetBSD: mk48txxvar.h,v 1.6 2008/04/28 20:23:50 martin Exp $
  *
  * $FreeBSD$
  */

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 21:53:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 178C01065670;
	Fri, 25 Dec 2009 21:53:21 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F0F1D8FC08;
	Fri, 25 Dec 2009 21:53:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPLrK4w072588;
	Fri, 25 Dec 2009 21:53:20 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPLrK89072584;
	Fri, 25 Dec 2009 21:53:20 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252153.nBPLrK89072584@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 21:53:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201005 - in head/sys: dev/mk48txx sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 21:53:21 -0000

Author: marius
Date: Fri Dec 25 21:53:20 2009
New Revision: 201005
URL: http://svn.freebsd.org/changeset/base/201005

Log:
  - Take advantage of bus_{read,write}_*(9).
  - Set dow = -1 in mk48txx_gettime() because some drivers (for example
    the NetBSD and OpenBSD mk48txx(4)) don't set it correctly.

Modified:
  head/sys/dev/mk48txx/mk48txx.c
  head/sys/dev/mk48txx/mk48txxvar.h
  head/sys/sparc64/sparc64/eeprom.c

Modified: head/sys/dev/mk48txx/mk48txx.c
==============================================================================
--- head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:41:05 2009	(r201004)
+++ head/sys/dev/mk48txx/mk48txx.c	Fri Dec 25 21:53:20 2009	(r201005)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -175,8 +176,16 @@ mk48txx_gettime(device_t dev, struct tim
 	ct.min = FROMBCD(FROMREG(MK48TXX_IMIN, MK48TXX_MIN_MASK));
 	ct.hour = FROMBCD(FROMREG(MK48TXX_IHOUR, MK48TXX_HOUR_MASK));
 	ct.day = FROMBCD(FROMREG(MK48TXX_IDAY, MK48TXX_DAY_MASK));
+#if 0
 	/* Map dow from 1 - 7 to 0 - 6; FROMBCD() isn't necessary here. */
 	ct.dow = FROMREG(MK48TXX_IWDAY, MK48TXX_WDAY_MASK) - 1;
+#else
+	/*
+	 * Set dow = -1 because some drivers (for example the NetBSD and
+	 * OpenBSD mk48txx(4)) don't set it correctly.
+	 */
+	ct.dow = - 1;
+#endif
 	ct.mon = FROMBCD(FROMREG(MK48TXX_IMON, MK48TXX_MON_MASK));
 	year = FROMBCD(FROMREG(MK48TXX_IYEAR, MK48TXX_YEAR_MASK));
 	year += sc->sc_year0;
@@ -266,7 +275,7 @@ mk48txx_def_nvrd(device_t dev, int off)
 	struct mk48txx_softc *sc;
 
 	sc = device_get_softc(dev);
-	return (bus_space_read_1(sc->sc_bst, sc->sc_bsh, off));
+	return (bus_read_1(sc->sc_res, off));
 }
 
 static void
@@ -275,7 +284,7 @@ mk48txx_def_nvwr(device_t dev, int off, 
 	struct mk48txx_softc *sc;
 
 	sc = device_get_softc(dev);
-	bus_space_write_1(sc->sc_bst, sc->sc_bsh, off, v);
+	bus_write_1(sc->sc_res, off, v);
 }
 
 static void

Modified: head/sys/dev/mk48txx/mk48txxvar.h
==============================================================================
--- head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:41:05 2009	(r201004)
+++ head/sys/dev/mk48txx/mk48txxvar.h	Fri Dec 25 21:53:20 2009	(r201005)
@@ -35,8 +35,7 @@ typedef uint8_t (*mk48txx_nvrd_t)(device
 typedef void (*mk48txx_nvwr_t)(device_t dev, int off, uint8_t v);
 
 struct mk48txx_softc {
-	bus_space_tag_t		sc_bst;	/* bus space tag */
-	bus_space_handle_t	sc_bsh;	/* bus space handle */
+	struct resource		*sc_res;/* bus resource */
 
 	struct mtx		sc_mtx;	/* hardware mutex */
 	eventhandler_tag	sc_wet;	/* watchdog event handler tag */

Modified: head/sys/sparc64/sparc64/eeprom.c
==============================================================================
--- head/sys/sparc64/sparc64/eeprom.c	Fri Dec 25 21:41:05 2009	(r201004)
+++ head/sys/sparc64/sparc64/eeprom.c	Fri Dec 25 21:53:20 2009	(r201005)
@@ -107,7 +107,7 @@ DRIVER_MODULE(eeprom, sbus, eeprom_drive
 static int
 eeprom_probe(device_t dev)
 {
- 
+
 	if (strcmp("eeprom", ofw_bus_get_name(dev)) == 0) {
 		device_set_desc(dev, "EEPROM/clock");
 		return (0);
@@ -134,8 +134,6 @@ eeprom_attach(device_t dev)
 		error = ENXIO;
 		goto fail_mtx;
 	}
-	sc->sc_bst = rman_get_bustag(res);
-	sc->sc_bsh = rman_get_bushandle(res);
 
 	if ((sc->sc_model = ofw_bus_get_model(dev)) == NULL) {
 		device_printf(dev, "cannot determine model\n");

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 22:01:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A9C561065696;
	Fri, 25 Dec 2009 22:01:39 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 984D38FC1A;
	Fri, 25 Dec 2009 22:01:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPM1dWW072830;
	Fri, 25 Dec 2009 22:01:39 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPM1dui072827;
	Fri, 25 Dec 2009 22:01:39 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252201.nBPM1dui072827@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 22:01:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201006 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 22:01:39 -0000

Author: marius
Date: Fri Dec 25 22:01:39 2009
New Revision: 201006
URL: http://svn.freebsd.org/changeset/base/201006

Log:
  Add a man page for mk48txx(4).
  
  Requested by:	n_hibma
  Obtained from:	NetBSD (original version)

Added:
  head/share/man/man4/mk48txx.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Fri Dec 25 21:53:20 2009	(r201005)
+++ head/share/man/man4/Makefile	Fri Dec 25 22:01:39 2009	(r201006)
@@ -201,6 +201,7 @@ MAN=	aac.4 \
 	meteor.4 \
 	mfi.4 \
 	miibus.4 \
+	mk48txx.4 \
 	mld.4 \
 	mlx.4 \
 	mly.4 \

Added: head/share/man/man4/mk48txx.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/mk48txx.4	Fri Dec 25 22:01:39 2009	(r201006)
@@ -0,0 +1,230 @@
+.\"	$NetBSD: mk48txx.4,v 1.16 2009/04/10 17:14:07 joerg Exp $
+.\"
+.\" Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 25, 2009
+.Dt MK48TXX 4
+.Os
+.Sh NAME
+.Nm mk48txx
+.Nd
+.Tn Mostek
+time-of-day clock driver
+.Sh SYNOPSIS
+.In sys/eventhandler.h
+.In sys/lock.h
+.In sys/mutex.h
+.In dev/mk48txx/mk48txxvar.h
+.Pp
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device mk48txx"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver is a back-end for several models of
+.Tn Mostek
+time-of-day clock chips.
+It provides access methods to retrieve and set date and time for use with the
+.Dq Li clock
+KOBJ interface.
+.Pp
+To tie an instance of this device to the system, use the
+.Fn mk48txx_attach
+function and the mk48txx_softc structure defined as follows:
+.Pp
+.Ft "int"
+.Fn mk48txx_attach "device_t dev"
+.Pp
+.Bd -literal
+typedef uint8_t (*mk48txx_nvrd_t)(device_t dev, int off);
+typedef void (*mk48txx_nvwr_t)(device_t dev, int off, uint8_t v);
+.Ed
+.Bd -literal
+struct mk48txx_softc {
+	struct resource	sc_res;
+	struct mtx	sc_mtx;
+	eventhandler_tag	sc_wet;
+	const char	*sc_model;
+	bus_size_t	sc_nvramsz;
+	bus_size_t	sc_clkoffset;
+	u_int		sc_year0;
+	u_int		sc_flag;
+	mk48txx_nvrd_t	sc_nvrd;
+	mk48txx_nvwr_t	sc_nvwr;
+};
+.Ed
+.Pp
+.Bl -tag -width indent
+.It Fa sc_res
+The bus resource used for accessing the chip's non-volatile memory
+.Pq including the clock registers ,
+which must be supplied by the front-end when using the default access methods
+.Pq see below .
+Otherwise this member is optional.
+.It Fa sc_mtx
+The hardware mutex used when accessing the chip's non-volatile memory
+.Pq including the clock registers ,
+which must be initialized with
+.Dv MTX_DEF
+by the front-end.
+.It Fa sc_wet
+The event handler tag for the watchdog functionality,
+which is registered by the
+.Fn mk48txx_attach
+function if supported by the chip and specified as part of the
+machine-dependent features
+.Pq see below .
+.It Fa sc_model
+The chip model which this instance should serve.
+This member must be set to one of
+.Dq mk48t02 ,
+.Dq mk48t08 ,
+.Dq mk48t18 ,
+or
+.Dq mk48t59
+by the front-end.
+.It Fa sc_nvramsz
+The size of the non-volatile RAM in the
+.Tn Mostek
+chip,
+which is set by the
+.Fn mk48txx_attach
+function.
+.It Fa sc_clkoffset
+The offset into the control registers of the
+.Tn Mostek
+chip,
+which is set by the the
+.Fn mk48txx_attach
+function.
+.It Fa sc_year0
+The year offset to be used with the
+.Sq year
+counter of the clock,
+which must be set by the front-end.
+This value is generally dependent on the system configuration in which
+the clock device is mounted.
+For instance, on
+.Tn Sun Microsystems
+machines the convention is to have clock's two-digit year represent
+the year since 1968.
+.It Fa sc_flag
+This flag is used to specify machine-dependent features.
+The following flags are supported:
+.Bl -tag -width ".Dv MK48TXX_WDOG_ENABLE_WDS"
+.It Dv MK48TXX_NO_CENT_ADJUST
+If the resulting date retrieved with the
+.Dq Li clock_gettime() method
+would be earlier than January 1, 1970,
+the driver will assume that the chip's year counter actually represents a
+year in the 21st century.
+This behavior can be overridden by setting this flag,
+which causes the
+.Nm
+driver to respect the clock's century bit instead.
+.It Dv MK48TXX_WDOG_REGISTER
+When this flag is set,
+the
+.Nm
+driver will register as a watchdog via the interface defined in
+.Xr 9 watchdog
+if supported by the specific chip model.
+.It Dv MK48TXX_WDOG_ENABLE_WDS
+When this flag is set,
+the
+.Nm
+driver will set the watchdog steering
+.Pq WDS
+bit when enabling the watchdog functionality of the chip.
+enabled
+.Pq see the chip documentation for further information regarding the WDS bit .
+.El
+.It Fa sc_nvread
+.It Fa sc_nvwrite
+These members specify the access methods for reading respectively writing
+clock device registers.
+The default,
+when
+.Dv NULL
+is passed as an access method,
+is to access the chip memory
+.Pq and clock registers
+as if they were direct-mapped using the specified bus resource.
+.Pp
+Otherwise, the driver will call the respective function supplied by the
+front-end to perform the access,
+passing it the offset
+.Va off
+of the chip memory
+.Pq or clock register
+location to be read from or written to, respectively.
+.El
+.Sh HARDWARE
+The following models are supported:
+.Pp
+.Bl -tag -width indent -offset indent -compact
+.It Tn Mostek MK48T02
+.It Tn Mostek MK48T08
+.It Tn Mostek MK48T18
+.It Tn Mostek MK48T59
+.El
+.Sh SEE ALSO
+.Xr intro 4 ,
+.Xr watchdog 9
+.Sh HISTORY
+The
+.Nm mk48txx
+driver appeared in
+.Nx 1.5 .
+The first
+.Fx
+version to include it was
+.Fx 5.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written for
+.Nx
+by
+.An Paul Kranenburg
+.Aq pk@NetBSD.org .
+It was ported to
+.Fx
+by
+.An Thomas Moestl
+.Aq tmm@FreeBSD.org
+and later on improved by
+.An Marius Strobl
+.Aq marius@FreeBSD.org .

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 22:04:01 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2ECDE1065679;
	Fri, 25 Dec 2009 22:04:00 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B2D338FC0A;
	Fri, 25 Dec 2009 22:04:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPM40gK072927;
	Fri, 25 Dec 2009 22:04:00 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPM40Kf072925;
	Fri, 25 Dec 2009 22:04:00 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252204.nBPM40Kf072925@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 22:04:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201007 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 22:04:01 -0000

Author: marius
Date: Fri Dec 25 22:04:00 2009
New Revision: 201007
URL: http://svn.freebsd.org/changeset/base/201007

Log:
  Correct my e-mail address.

Modified:
  head/share/man/man4/gem.4

Modified: head/share/man/man4/gem.4
==============================================================================
--- head/share/man/man4/gem.4	Fri Dec 25 22:01:39 2009	(r201006)
+++ head/share/man/man4/gem.4	Fri Dec 25 22:04:00 2009	(r201007)
@@ -33,7 +33,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2009
+.Dd December 25, 2009
 .Dt GEM 4
 .Os
 .Sh NAME
@@ -150,7 +150,7 @@ by
 .Aq tmm@FreeBSD.org
 and later on improved by
 .An Marius Strobl
-.Aq marus@FreeBSD.org .
+.Aq marius@FreeBSD.org .
 The man page was written by
 .An Thomas Klausner
 .Aq wiz@NetBSD.org .

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 22:53:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A0092106566C;
	Fri, 25 Dec 2009 22:53:46 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8E9D98FC16;
	Fri, 25 Dec 2009 22:53:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPMrkuC074012;
	Fri, 25 Dec 2009 22:53:46 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPMrkMY074007;
	Fri, 25 Dec 2009 22:53:46 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252253.nBPMrkMY074007@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 22:53:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201008 - in head/sys: dev/mc146818 sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 22:53:46 -0000

Author: marius
Date: Fri Dec 25 22:53:46 2009
New Revision: 201008
URL: http://svn.freebsd.org/changeset/base/201008

Log:
  Style changes
  
  Obtained from:	NetBSD (mc146818reg.h)

Modified:
  head/sys/dev/mc146818/mc146818.c
  head/sys/dev/mc146818/mc146818reg.h
  head/sys/dev/mc146818/mc146818var.h
  head/sys/sparc64/sparc64/rtc.c

Modified: head/sys/dev/mc146818/mc146818.c
==============================================================================
--- head/sys/dev/mc146818/mc146818.c	Fri Dec 25 22:04:00 2009	(r201007)
+++ head/sys/dev/mc146818/mc146818.c	Fri Dec 25 22:53:46 2009	(r201008)
@@ -94,7 +94,7 @@ mc146818_attach(device_t dev)
 	(*sc->sc_mcwrite)(dev, MC_REGB, sc->sc_regb);
 	mtx_unlock_spin(&sc->sc_mtx);
 
-	clock_register(dev, 1000000);	/* 1 second resolution. */
+	clock_register(dev, 1000000);	/* 1 second resolution */
 
 	return (0);
 }
@@ -116,7 +116,7 @@ mc146818_gettime(device_t dev, struct ti
 
 	/*
 	 * If MC_REGA_UIP is 0 we have at least 244us before the next
-	 * update. If it's 1 an update is imminent.
+	 * update.  If it's 1 an update is imminent.
 	 */
 	for (;;) {
 		mtx_lock_spin(&sc->sc_mtx);
@@ -260,6 +260,9 @@ mc146818_def_write(device_t dev, u_int r
 	bus_space_write_1(sc->sc_bst, sc->sc_bsh, MC_DATA, val);
 }
 
+#undef MC_ADDR
+#undef MC_DATA
+
 /*
  * Looks like it's common even across platforms to store the century at
  * 0x32 in the NVRAM of the mc146818.
@@ -283,3 +286,5 @@ mc146818_def_setcent(device_t dev, u_int
 	sc = device_get_softc(dev);
 	(*sc->sc_mcwrite)(dev, MC_CENT, cent);
 }
+
+#undef MC_CENT

Modified: head/sys/dev/mc146818/mc146818reg.h
==============================================================================
--- head/sys/dev/mc146818/mc146818reg.h	Fri Dec 25 22:04:00 2009	(r201007)
+++ head/sys/dev/mc146818/mc146818reg.h	Fri Dec 25 22:53:46 2009	(r201008)
@@ -1,17 +1,17 @@
 /*-
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
- * 
+ *
  * Permission to use, copy, modify and distribute this software and
  * its documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
+ *
  * Carnegie Mellon requests users of this software to return to
  *
  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
@@ -22,7 +22,7 @@
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  *
- *	from: NetBSD: mc146818reg.h,v 1.5 2003/11/02 11:07:45 wiz Exp
+ *	$NetBSD: mc146818reg.h,v 1.9 2006/03/08 23:46:25 lukem Exp $
  *
  * $FreeBSD$
  */
@@ -122,8 +122,8 @@
  * Periodic Interrupt Rate Select constants (Control register A)
  */
 #define	MC_RATE_NONE	0x0	/* No periodic interrupt */
-#define	MC_RATE_1	0x1     /* 256 Hz if MC_BASE_32_KHz, else 32768 Hz */
-#define	MC_RATE_2	0x2     /* 128 Hz if MC_BASE_32_KHz, else 16384 Hz */
+#define	MC_RATE_1	0x1	/* 256 Hz if MC_BASE_32_KHz, else 32768 Hz */
+#define	MC_RATE_2	0x2	/* 128 Hz if MC_BASE_32_KHz, else 16384 Hz */
 #define	MC_RATE_8192_Hz	0x3	/* 122.070 us period */
 #define	MC_RATE_4096_Hz	0x4	/* 244.141 us period */
 #define	MC_RATE_2048_Hz	0x5	/* 488.281 us period */
@@ -141,8 +141,8 @@
 /*
  * Time base (divisor select) constants (Control register A)
  */
-#define	MC_BASE_4_MHz	0x00		/* 4MHz crystal */
-#define	MC_BASE_1_MHz	MC_REGA_DV0	/* 1MHz crystal */
-#define	MC_BASE_32_KHz	MC_REGA_DV1	/* 32KHz crystal */
+#define	MC_BASE_4_MHz	0x00		/* 4 MHz crystal */
+#define	MC_BASE_1_MHz	MC_REGA_DV0	/* 1 MHz crystal */
+#define	MC_BASE_32_KHz	MC_REGA_DV1	/* 32 KHz crystal */
 #define	MC_BASE_NONE	(MC_REGA_DV2 | MC_REGA_DV1) /* actually also resets */
 #define	MC_BASE_RESET	(MC_REGA_DV2 | MC_REGA_DV1 | MC_REGA_DV0)

Modified: head/sys/dev/mc146818/mc146818var.h
==============================================================================
--- head/sys/dev/mc146818/mc146818var.h	Fri Dec 25 22:04:00 2009	(r201007)
+++ head/sys/dev/mc146818/mc146818var.h	Fri Dec 25 22:53:46 2009	(r201008)
@@ -38,29 +38,30 @@ struct mc146818_softc {
 	u_char sc_regb;				/* register B */
 
 	u_int sc_year0;				/* year counter offset */
+
 	u_int sc_flag;				/* MD flags */
-#define MC146818_NO_CENT_ADJUST	0x0001		/* don't adjust century */
-#define MC146818_BCD		0x0002		/* use BCD mode */
-#define MC146818_12HR		0x0004		/* use AM/PM mode */
+#define	MC146818_NO_CENT_ADJUST	0x0001		/* don't adjust century */
+#define	MC146818_BCD		0x0002		/* use BCD mode */
+#define	MC146818_12HR		0x0004		/* use AM/PM mode */
 
 	/* MD chip register read/write functions */
-	u_int (*sc_mcread)(device_t, u_int);
-	void (*sc_mcwrite)(device_t, u_int, u_int);
+	u_int (*sc_mcread)(device_t dev, u_int reg);
+	void (*sc_mcwrite)(device_t dev, u_int reg, u_int val);
 	/* MD century get/set functions */
-	u_int (*sc_getcent)(device_t);
-	void (*sc_setcent)(device_t, u_int);
+	u_int (*sc_getcent)(device_t dev);
+	void (*sc_setcent)(device_t dev, u_int cent);
 };
 
 /* Default read/write functions */
-u_int mc146818_def_read(device_t, u_int);
-void mc146818_def_write(device_t, u_int, u_int);
+u_int mc146818_def_read(device_t dev, u_int reg);
+void mc146818_def_write(device_t dev, u_int reg, u_int val);
 
 /* Chip attach function */
 int mc146818_attach(device_t);
 
 /* Methods for the clock interface */
 #ifdef notyet
-int mc146818_getsecs(device_t, int *);
+int mc146818_getsecs(device_t dev, int *secp);
 #endif
-int mc146818_gettime(device_t, struct timespec *);
-int mc146818_settime(device_t, struct timespec *);
+int mc146818_gettime(device_t dev, struct timespec *ts);
+int mc146818_settime(device_t dev, struct timespec *ts);

Modified: head/sys/sparc64/sparc64/rtc.c
==============================================================================
--- head/sys/sparc64/sparc64/rtc.c	Fri Dec 25 22:04:00 2009	(r201007)
+++ head/sys/sparc64/sparc64/rtc.c	Fri Dec 25 22:53:46 2009	(r201008)
@@ -111,7 +111,7 @@ static device_method_t rtc_isa_methods[]
 	DEVMETHOD(clock_gettime,	mc146818_gettime),
 	DEVMETHOD(clock_settime,	mc146818_settime),
 
-	{ 0, 0 }
+	KOBJMETHOD_END
 };
 
 static driver_t rtc_isa_driver = {
@@ -123,8 +123,8 @@ static driver_t rtc_isa_driver = {
 DRIVER_MODULE(rtc, isa, rtc_isa_driver, rtc_devclass, 0, 0);
 #endif
 
-static u_int pc87317_getcent(device_t);
-static void pc87317_setcent(device_t, u_int);
+static u_int pc87317_getcent(device_t dev);
+static void pc87317_setcent(device_t dev, u_int cent);
 
 static int
 rtc_ebus_probe(device_t dev)

From owner-svn-src-head@FreeBSD.ORG  Fri Dec 25 22:58:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F2F1106566B;
	Fri, 25 Dec 2009 22:58:44 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 057138FC18;
	Fri, 25 Dec 2009 22:58:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBPMwh7Q074159;
	Fri, 25 Dec 2009 22:58:43 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBPMwhW2074156;
	Fri, 25 Dec 2009 22:58:43 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200912252258.nBPMwhW2074156@svn.freebsd.org>
From: Marius Strobl 
Date: Fri, 25 Dec 2009 22:58:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201009 - head/sys/dev/mc146818
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 25 Dec 2009 22:58:44 -0000

Author: marius
Date: Fri Dec 25 22:58:43 2009
New Revision: 201009
URL: http://svn.freebsd.org/changeset/base/201009

Log:
  Remove clause 3 from Izumi Tsutsui's licenses.
  
  Obtained from:	NetBSD

Modified:
  head/sys/dev/mc146818/mc146818.c
  head/sys/dev/mc146818/mc146818var.h

Modified: head/sys/dev/mc146818/mc146818.c
==============================================================================
--- head/sys/dev/mc146818/mc146818.c	Fri Dec 25 22:53:46 2009	(r201008)
+++ head/sys/dev/mc146818/mc146818.c	Fri Dec 25 22:58:43 2009	(r201009)
@@ -9,8 +9,6 @@
  * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -23,7 +21,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	from: NetBSD: mc146818.c,v 1.4 2003/11/24 06:20:40 tsutsui Exp
+ *	$NetBSD: mc146818.c,v 1.16 2008/05/14 13:29:28 tsutsui Exp $
  */
 
 #include 

Modified: head/sys/dev/mc146818/mc146818var.h
==============================================================================
--- head/sys/dev/mc146818/mc146818var.h	Fri Dec 25 22:53:46 2009	(r201008)
+++ head/sys/dev/mc146818/mc146818var.h	Fri Dec 25 22:58:43 2009	(r201009)
@@ -9,8 +9,6 @@
  * 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.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -23,7 +21,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	from: NetBSD: mc146818var.h,v 1.3 2003/11/24 06:20:40 tsutsui Exp
+ *	$NetBSD: mc146818var.h,v 1.7 2008/05/14 13:29:29 tsutsui Exp $
  *
  * $FreeBSD$
  */

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 00:46:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 209FE10656A4;
	Sat, 26 Dec 2009 00:46:06 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 104BB8FC26;
	Sat, 26 Dec 2009 00:46:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQ0k5dw076250;
	Sat, 26 Dec 2009 00:46:05 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQ0k5v6076248;
	Sat, 26 Dec 2009 00:46:05 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200912260046.nBQ0k5v6076248@svn.freebsd.org>
From: Xin LI 
Date: Sat, 26 Dec 2009 00:46:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201010 - head/usr.bin/killall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 00:46:06 -0000

Author: delphij
Date: Sat Dec 26 00:46:05 2009
New Revision: 201010
URL: http://svn.freebsd.org/changeset/base/201010

Log:
  Fix grammar and reduce ambiguity.
  
  Submitted by:	b. f. 

Modified:
  head/usr.bin/killall/killall.1

Modified: head/usr.bin/killall/killall.1
==============================================================================
--- head/usr.bin/killall/killall.1	Fri Dec 25 22:58:43 2009	(r201009)
+++ head/usr.bin/killall/killall.1	Sat Dec 26 00:46:05 2009	(r201010)
@@ -150,11 +150,11 @@ This
 .Fx
 implementation of
 .Nm
-have completely different semantics as compared to the traditional
+has completely different semantics as compared to the traditional
 .Ux
 System V behavior of
-.Nm ,
-which will kill all processes that the current user is able to
+.Nm .
+The latter will kill all processes that the current user is able to
 kill, and is intended to be used by the system shutdown process only.
 .Sh AUTHORS
 .An -nosplit

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 08:22:40 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19BAB1065670;
	Sat, 26 Dec 2009 08:22:40 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id CAF008FC16;
	Sat, 26 Dec 2009 08:22:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBQ8HXpk007665;
	Sat, 26 Dec 2009 01:17:33 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Sat, 26 Dec 2009 01:18:13 -0700 (MST)
Message-Id: <20091226.011813.832046103629392276.imp@bsdimp.com>
To: rdivacky@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <20091222190244.GA56837@freebsd.org>
References: <20091222141810.GA17221@freebsd.org>
	
	<20091222190244.GA56837@freebsd.org>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: src-committers@FreeBSD.org, erik@cederstrand.dk, jhb@FreeBSD.org,
	svn-src-all@FreeBSD.org, marius@alchemy.franken.de,
	svn-src-head@FreeBSD.org
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 08:22:40 -0000

In message: <20091222190244.GA56837@freebsd.org>
            Roman Divacky  writes:
: On Tue, Dec 22, 2009 at 04:49:48PM +0100, Erik Cederstrand wrote:
: > Den 22/12/2009 kl. 15.18 skrev Roman Divacky:
: > 
: > > well... llvm provides its own assembler so if the need for newer binutils
: > > comes from need of newer as I believe llvm can help here. or is the linker
: > > the problem?
: > 
: > It does? I was under the impression that this was still very much a WIP (http://llvm.org/releases/2.6/docs/ReleaseNotes.html#mc) and that LLVM still uses the system assembler and linker.
: 
: yes, it's a WIP. what I meant was that there's not so much pressure to import
: newer "as" as we might be getting that from llvm anyway in the time frame...

I'd rather counter with a contrary view.  Given the choice between a
badly licensed, but known to be working tool and a well licensed, but
mostly vapor-ware tool, I'm inclined to go with the former...

I've taken a look at what NetBSD has done in this area, and they have
one sub-tree for all gplv3 code.  Can svn easily exclude a tree?  I
know one can mirror without directories with cvsup...

I think that going the ports route likely isn't going to work too
well.  It can be made to work, but you need more infrastructure in
place and it is less integrated and tested :(

Warner

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 08:28:40 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D34461065670;
	Sat, 26 Dec 2009 08:28:40 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 74C448FC1A;
	Sat, 26 Dec 2009 08:28:40 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nBQ8Lobv007676;
	Sat, 26 Dec 2009 01:21:51 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Sat, 26 Dec 2009 01:22:31 -0700 (MST)
Message-Id: <20091226.012231.475505532728794904.imp@bsdimp.com>
To: dougb@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <4B3129CD.20908@FreeBSD.org>
References: <20091221220004.GA42400@alchemy.franken.de>
	<20091221.211648.632868945383134253.imp@bsdimp.com>
	<4B3129CD.20908@FreeBSD.org>
X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, jhb@FreeBSD.org, marius@alchemy.franken.de
Subject: Re: svn commit: r200797 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 08:28:40 -0000

In message: <4B3129CD.20908@FreeBSD.org>
            Doug Barton  writes:
: M. Warner Losh wrote:
: > We really need newer binutils in the tree.
: > 
: > And we need a way to compiler gplv3 binutils into the system for folks
: > that can do that without consequences...  But many modern processors
: > need to have the gplv3 version of binutils and that will be a
: > continuing problem.  One advantage of FreeBSD is its integration,
: > rather than having to play version whack-a-mole like you do with
: > embedded Linux.
: 
: When "we" last had the gplv3 discussion there were two lines of
: thought that were proposed. One is "import llvm/clang" and the other
: was "improve the infrastructure to support toolchains from ports." I
: know that the llvm/clang project is moving forward, and I think that's
: a great long-term direction.

Assuming that it supports the architectures we need well, which at the
present time it isn't clear that it will...

: In the short term I think we are well served on all fronts to modify
: the build architecture to better support compilers from ports. This
: would actually help with the llvm/clang testing too, and sidestep the
: problems of gplv3 stuff being in the base. TMK there has been no work
: on this direction at all, which is disappointing.

The problem is that it really isn't a terribly viable solution, so why
waste a bunch of time on it?  Does the build-world stop in the middle
and rebuild stuff?  Right now we have finely matched libraries and
compilers, how does one address that problem with the compiler out in
the ports?  You'll need a matched set of binutils as well (well,
matched meaning known compatible here), and the build system has a
strong bias towards the compiler knowing which ones to use..  These
problems can all be surmounted, but it just feels like a big kludge.

: I know that there is a huge cultural bias towards shipping "a complete
: system," and don't get me wrong, I am fully supportive of that. I am
: NOT suggesting that we dike out the existing toolchain. Just that we
: make it easier to use toolchains from ports.

Agreed.  I'll likely be working in this area soon.  Last time I tried,
it was possible, but very difficult and error-prone to do it by
hand...

Warner

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 08:36:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA3A81065670;
	Sat, 26 Dec 2009 08:36:02 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D83148FC08;
	Sat, 26 Dec 2009 08:36:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQ8a2PY001810;
	Sat, 26 Dec 2009 08:36:02 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQ8a2ei001809;
	Sat, 26 Dec 2009 08:36:02 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200912260836.nBQ8a2ei001809@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Sat, 26 Dec 2009 08:36:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201015 - head/sbin/nfsiod
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 08:36:03 -0000

Author: ru
Date: Sat Dec 26 08:36:02 2009
New Revision: 201015
URL: http://svn.freebsd.org/changeset/base/201015

Log:
  - Display current settings when run without options.
  - Revise a manpage to NOT sound confusing. [1]
  
  In collaboration with:	sat [1]

Modified:
  head/sbin/nfsiod/nfsiod.8
  head/sbin/nfsiod/nfsiod.c

Modified: head/sbin/nfsiod/nfsiod.8
==============================================================================
--- head/sbin/nfsiod/nfsiod.8	Sat Dec 26 04:31:18 2009	(r201014)
+++ head/sbin/nfsiod/nfsiod.8	Sat Dec 26 08:36:02 2009	(r201015)
@@ -28,7 +28,7 @@
 .\"     From: @(#)nfsiod.8	8.2 (Berkeley) 2/22/94
 .\" $FreeBSD$
 .\"
-.Dd September 22, 1994
+.Dd December 26, 2009
 .Dt NFSIOD 8
 .Os
 .Sh NAME
@@ -42,33 +42,39 @@ asynchronous I/O server
 .Sh DESCRIPTION
 The
 .Nm
-utility is a kernel process which runs on an
+utility controls the maximum number of
+.Nm
+kernel processes which run on an
 .Tn NFS
 client machine to service asynchronous I/O requests to its server.
-It improves performance but is not required for correct operation.
-.Pp
-This program controls the maximum number of processes that the kernel runs.
+Having
+.Nm
+kernel processes
+improves performance but is not required for correct operation.
 .Pp
-The options are as follows:
+The option is as follows:
 .Bl -tag -width indent
 .It Fl n
-Specify how many servers are permitted to be started.
+Specify how many processes are permitted to be started.
 .El
 .Pp
-A client should run enough daemons to handle its maximum
+Without an option,
+.Nm
+displays the current settings.
+A client should allow enough number of processes to handle its maximum
 level of concurrency, typically four to six.
 .Pp
 If
 .Nm
 detects that the running kernel does not include
 .Tn NFS
-support, it will attempt to load a loadable kernel module containing
+support, it will attempt to load a kernel module containing
 .Tn NFS
 code, using
 .Xr kldload 2 .
 If this fails, or no
 .Tn NFS
-KLD was available,
+module was available,
 .Nm
 exits with an error.
 .Sh EXIT STATUS
@@ -85,3 +91,10 @@ The
 .Nm
 utility first appeared in
 .Bx 4.4 .
+.Pp
+Starting with
+.Fx 5.0 ,
+the utility no longer starts daemons, but only serves as a vfs
+loader and
+.Xr sysctl 3
+wrapper.

Modified: head/sbin/nfsiod/nfsiod.c
==============================================================================
--- head/sbin/nfsiod/nfsiod.c	Sat Dec 26 04:31:18 2009	(r201014)
+++ head/sbin/nfsiod/nfsiod.c	Sat Dec 26 08:36:02 2009	(r201015)
@@ -89,12 +89,12 @@ main(int argc, char *argv[])
 		case 'n':
 			num_servers = atoi(optarg);
 			if (num_servers < 1) {
-				warnx("nfsiod count %d; reset to %d",
+				warnx("nfsiod count %u; reset to %d",
 				    num_servers, 1);
 				num_servers = 1;
 			}
 			if (num_servers > MAXNFSDCNT) {
-				warnx("nfsiod count %d; reset to %d",
+				warnx("nfsiod count %u; reset to %d",
 				    num_servers, MAXNFSDCNT);
 				num_servers = MAXNFSDCNT;
 			}
@@ -109,9 +109,6 @@ main(int argc, char *argv[])
 	if (argc > 0)
 		usage();
 
-	if (num_servers == 0)
-		exit(0);		/* no change */
-
 	len = sizeof iodmin;
 	error = sysctlbyname("vfs.nfs.iodmin", &iodmin, &len, NULL, 0);
 	if (error < 0)
@@ -120,6 +117,11 @@ main(int argc, char *argv[])
 	error = sysctlbyname("vfs.nfs.iodmax", &iodmax, &len, NULL, 0);
 	if (error < 0)
 		err(1, "sysctlbyname(\"vfs.nfs.iodmax\")");
+	if (num_servers == 0) {		/* no change */
+		printf("vfs.nfs.iodmin=%u\nvfs.nfs.iodmax=%u\n",
+		    iodmin, iodmax);
+		exit(0);
+	}
 	/* Catch the case where we're lowering num_servers below iodmin */
 	if (iodmin > num_servers) {
 		iodmin = num_servers;

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 10:06:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A40251065676;
	Sat, 26 Dec 2009 10:06:45 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 92C9D8FC0C;
	Sat, 26 Dec 2009 10:06:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQA6jPV003547;
	Sat, 26 Dec 2009 10:06:45 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQA6jwt003542;
	Sat, 26 Dec 2009 10:06:45 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200912261006.nBQA6jwt003542@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 26 Dec 2009 10:06:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201016 - head/bin/setfacl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 10:06:45 -0000

Author: trasz
Date: Sat Dec 26 10:06:45 2009
New Revision: 201016
URL: http://svn.freebsd.org/changeset/base/201016

Log:
  Improve ACL branding mismatch detection and reporting in some rare cases,
  such as "setfacl -m ''".

Modified:
  head/bin/setfacl/merge.c
  head/bin/setfacl/remove.c
  head/bin/setfacl/setfacl.h
  head/bin/setfacl/util.c

Modified: head/bin/setfacl/merge.c
==============================================================================
--- head/bin/setfacl/merge.c	Sat Dec 26 08:36:02 2009	(r201015)
+++ head/bin/setfacl/merge.c	Sat Dec 26 10:06:45 2009	(r201016)
@@ -100,11 +100,10 @@ merge_acl(acl_t acl, acl_t *prev_acl, co
 	acl_get_brand_np(acl, &acl_brand);
 	acl_get_brand_np(*prev_acl, &prev_acl_brand);
 
-	if (acl_brand != prev_acl_brand) {
+	if (branding_mismatch(acl_brand, prev_acl_brand)) {
 		warnx("%s: branding mismatch; existing ACL is %s, "
 		    "entry to be merged is %s", filename,
-		    prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
-		    acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
+		    brand_name(prev_acl_brand), brand_name(acl_brand));
 		return (-1);
 	}
 
@@ -252,9 +251,10 @@ add_acl(acl_t acl, uint entry_number, ac
 		return (-1);
 	}
 
-	if (acl_brand != ACL_BRAND_NFS4) {
+	if (branding_mismatch(acl_brand, ACL_BRAND_NFS4)) {
 		warnx("%s: branding mismatch; existing ACL is NFSv4, "
-		    "entry to be added is POSIX.1e", filename);
+		    "entry to be added is %s", filename,
+		    brand_name(acl_brand));
 		return (-1);
 	}
 

Modified: head/bin/setfacl/remove.c
==============================================================================
--- head/bin/setfacl/remove.c	Sat Dec 26 08:36:02 2009	(r201015)
+++ head/bin/setfacl/remove.c	Sat Dec 26 10:06:45 2009	(r201016)
@@ -53,11 +53,10 @@ remove_acl(acl_t acl, acl_t *prev_acl, c
 	acl_get_brand_np(acl, &acl_brand);
 	acl_get_brand_np(*prev_acl, &prev_acl_brand);
 
-	if (acl_brand != prev_acl_brand) {
+	if (branding_mismatch(acl_brand, prev_acl_brand)) {
 		warnx("%s: branding mismatch; existing ACL is %s, "
 		    "entry to be removed is %s", filename,
-		    prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e",
-		    acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e");
+		    brand_name(prev_acl_brand), brand_name(acl_brand));
 		return (-1);
 	}
 

Modified: head/bin/setfacl/setfacl.h
==============================================================================
--- head/bin/setfacl/setfacl.h	Sat Dec 26 08:36:02 2009	(r201015)
+++ head/bin/setfacl/setfacl.h	Sat Dec 26 10:06:45 2009	(r201016)
@@ -71,6 +71,8 @@ void   remove_ext(acl_t *prev_acl, const
 int    set_acl_mask(acl_t *prev_acl, const char *filename);
 /* util.c */
 void  *zmalloc(size_t size);
+const char *brand_name(int brand);
+int    branding_mismatch(int brand1, int brand2);
 
 uint       have_mask;
 uint       need_mask;

Modified: head/bin/setfacl/util.c
==============================================================================
--- head/bin/setfacl/util.c	Sat Dec 26 08:36:02 2009	(r201015)
+++ head/bin/setfacl/util.c	Sat Dec 26 10:06:45 2009	(r201016)
@@ -43,3 +43,26 @@ zmalloc(size_t size)
 		err(1, "calloc() failed");
 	return (ptr);
 }
+
+const char *
+brand_name(int brand)
+{
+	switch (brand) {
+	case ACL_BRAND_NFS4:
+		return "NFSv4";
+	case ACL_BRAND_POSIX:
+		return "POSIX.1e";
+	default:
+		return "unknown";
+	}
+}
+
+int
+branding_mismatch(int brand1, int brand2)
+{
+	if (brand1 == ACL_BRAND_UNKNOWN || brand2 == ACL_BRAND_UNKNOWN)
+		return (0);
+	if (brand1 != brand2)
+		return (1);
+	return (1);
+}

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 11:00:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F3CAD1065692;
	Sat, 26 Dec 2009 11:00:18 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E39CA8FC08;
	Sat, 26 Dec 2009 11:00:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQB0IS5008304;
	Sat, 26 Dec 2009 11:00:18 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQB0I9a008302;
	Sat, 26 Dec 2009 11:00:18 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912261100.nBQB0I9a008302@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 26 Dec 2009 11:00:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201017 - head/libexec/talkd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 11:00:19 -0000

Author: ed
Date: Sat Dec 26 11:00:18 2009
New Revision: 201017
URL: http://svn.freebsd.org/changeset/base/201017

Log:
  Unbreak the build.
  
  I increased the WARNS, but it looks like it breaks certain architectures
  with more strict alignment requirements (mips, sparc64, ia64).
  
  Pointy hat to:	me

Modified:
  head/libexec/talkd/Makefile

Modified: head/libexec/talkd/Makefile
==============================================================================
--- head/libexec/talkd/Makefile	Sat Dec 26 10:06:45 2009	(r201016)
+++ head/libexec/talkd/Makefile	Sat Dec 26 11:00:18 2009	(r201017)
@@ -6,8 +6,7 @@ SRCS=	talkd.c announce.c process.c table
 .PATH:  ${.CURDIR}/../../usr.bin/wall
 MAN=	talkd.8
 CFLAGS+=-I${.CURDIR}/../../usr.bin/wall
-
-WARNS?=	6
+WFORMAT=0
 
 DPADD=	${LIBULOG}
 LDADD=	-lulog

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 11:03:11 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E637106566C;
	Sat, 26 Dec 2009 11:03:11 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3465E8FC08;
	Sat, 26 Dec 2009 11:03:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQB3B5c008398;
	Sat, 26 Dec 2009 11:03:11 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQB3BD2008396;
	Sat, 26 Dec 2009 11:03:11 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200912261103.nBQB3BD2008396@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 26 Dec 2009 11:03:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201018 - head/bin/setfacl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 11:03:11 -0000

Author: trasz
Date: Sat Dec 26 11:03:10 2009
New Revision: 201018
URL: http://svn.freebsd.org/changeset/base/201018

Log:
  Fix breakage introduced in last commit.

Modified:
  head/bin/setfacl/util.c

Modified: head/bin/setfacl/util.c
==============================================================================
--- head/bin/setfacl/util.c	Sat Dec 26 11:00:18 2009	(r201017)
+++ head/bin/setfacl/util.c	Sat Dec 26 11:03:10 2009	(r201018)
@@ -64,5 +64,5 @@ branding_mismatch(int brand1, int brand2
 		return (0);
 	if (brand1 != brand2)
 		return (1);
-	return (1);
+	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 11:36:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A5DB106568F;
	Sat, 26 Dec 2009 11:36:10 +0000 (UTC)
	(envelope-from trasz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 607088FC14;
	Sat, 26 Dec 2009 11:36:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQBaA0c009036;
	Sat, 26 Dec 2009 11:36:10 GMT (envelope-from trasz@svn.freebsd.org)
Received: (from trasz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQBaAh3009032;
	Sat, 26 Dec 2009 11:36:10 GMT (envelope-from trasz@svn.freebsd.org)
Message-Id: <200912261136.nBQBaAh3009032@svn.freebsd.org>
From: Edward Tomasz Napierala 
Date: Sat, 26 Dec 2009 11:36:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201019 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 11:36:10 -0000

Author: trasz
Date: Sat Dec 26 11:36:10 2009
New Revision: 201019
URL: http://svn.freebsd.org/changeset/base/201019

Log:
  Now that all the callers seem to be fixed, add KASSERTs to make sure VAPPEND
  is not being used improperly.

Modified:
  head/sys/kern/subr_acl_nfs4.c
  head/sys/kern/subr_acl_posix1e.c
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/subr_acl_nfs4.c
==============================================================================
--- head/sys/kern/subr_acl_nfs4.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/subr_acl_nfs4.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -163,6 +163,14 @@ vaccess_acl_nfs4(enum vtype type, uid_t 
 	int denied, explicitly_denied, access_mask, is_directory,
 	    must_be_owner = 0;
 
+	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND |
+	    VEXPLICIT_DENY | VREAD_NAMED_ATTRS | VWRITE_NAMED_ATTRS |
+	    VDELETE_CHILD | VREAD_ATTRIBUTES | VWRITE_ATTRIBUTES | VDELETE |
+	    VREAD_ACL | VWRITE_ACL | VWRITE_OWNER | VSYNCHRONIZE)) == 0,
+	    ("invalid bit in accmode"));
+	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+	    	("VAPPEND without VWRITE"));
+
 	if (privused != NULL)
 		*privused = 0;
 

Modified: head/sys/kern/subr_acl_posix1e.c
==============================================================================
--- head/sys/kern/subr_acl_posix1e.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/subr_acl_posix1e.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -63,6 +63,8 @@ vaccess_acl_posix1e(enum vtype type, uid
 
 	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
 	    ("invalid bit in accmode"));
+	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+	    	("VAPPEND without VWRITE"));
 
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Dec 26 11:03:10 2009	(r201018)
+++ head/sys/kern/vfs_subr.c	Sat Dec 26 11:36:10 2009	(r201019)
@@ -3534,6 +3534,8 @@ vaccess(enum vtype type, mode_t file_mod
 
 	KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
 	    ("invalid bit in accmode"));
+	KASSERT((accmode & VAPPEND) == 0 || (accmode & VWRITE),
+	    	("VAPPEND without VWRITE"));
 
 	/*
 	 * Look for a normal, non-privileged way to access the file/directory

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 13:54:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CEC271065694;
	Sat, 26 Dec 2009 13:54:36 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9DCD68FC26;
	Sat, 26 Dec 2009 13:54:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQDsanQ011873;
	Sat, 26 Dec 2009 13:54:36 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQDsZ8e011872;
	Sat, 26 Dec 2009 13:54:35 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200912261354.nBQDsZ8e011872@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 26 Dec 2009 13:54:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201020 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 13:54:37 -0000

Author: jilles
Date: Sat Dec 26 13:54:34 2009
New Revision: 201020
URL: http://svn.freebsd.org/changeset/base/201020

Log:
  Remove declaration of function that no longer exists.

Modified:
  head/bin/sh/output.h

Modified: head/bin/sh/output.h
==============================================================================
--- head/bin/sh/output.h	Sat Dec 26 11:36:10 2009	(r201019)
+++ head/bin/sh/output.h	Sat Dec 26 13:54:34 2009	(r201020)
@@ -52,7 +52,6 @@ extern struct output memout;
 extern struct output *out1;
 extern struct output *out2;
 
-void open_mem(char *, int, struct output *);
 void out1str(const char *);
 void out1qstr(const char *);
 void out2str(const char *);

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 13:58:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 226E3106566B;
	Sat, 26 Dec 2009 13:58:53 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 118B88FC14;
	Sat, 26 Dec 2009 13:58:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQDwqrB012002;
	Sat, 26 Dec 2009 13:58:52 GMT (envelope-from jkoshy@svn.freebsd.org)
Received: (from jkoshy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQDwqq4011999;
	Sat, 26 Dec 2009 13:58:52 GMT (envelope-from jkoshy@svn.freebsd.org)
Message-Id: <200912261358.nBQDwqq4011999@svn.freebsd.org>
From: Joseph Koshy 
Date: Sat, 26 Dec 2009 13:58:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201021 - in head/sys: dev/hwpmc sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 13:58:53 -0000

Author: jkoshy
Date: Sat Dec 26 13:58:52 2009
New Revision: 201021
URL: http://svn.freebsd.org/changeset/base/201021

Log:
  Log process mappings for existing processes at PMC start time.
  
  Submitted by:	Marc Unangst  [original patch]
  Tested by:	fabient

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/sys/pmc.h

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Sat Dec 26 13:54:34 2009	(r201020)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Sat Dec 26 13:58:52 2009	(r201021)
@@ -63,6 +63,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 /*
  * Types
  */
@@ -1619,6 +1625,151 @@ pmc_log_kernel_mappings(struct pmc *pm)
 static void
 pmc_log_process_mappings(struct pmc_owner *po, struct proc *p)
 {
+	vm_map_t map;
+	struct vnode *vp;
+	struct vmspace *vm;
+	vm_map_entry_t entry;
+	vm_offset_t last_end;
+	u_int last_timestamp;
+	struct vnode *last_vp;
+	vm_offset_t start_addr;
+	vm_object_t obj, lobj, tobj;
+	char *fullpath, *freepath;
+
+	last_vp = NULL;
+	last_end = (vm_offset_t) 0;
+	fullpath = freepath = NULL;
+
+	if ((vm = vmspace_acquire_ref(p)) == NULL)
+		return;
+
+	map = &vm->vm_map;
+	vm_map_lock_read(map);
+
+	for (entry = map->header.next; entry != &map->header; entry = entry->next) {
+
+		if (entry == NULL) {
+			PMCDBG(LOG,OPS,2, "hwpmc: vm_map entry unexpectedly "
+			    "NULL! pid=%d vm_map=%p\n", p->p_pid, map);
+			break;
+		}
+
+		/*
+		 * We only care about executable map entries.
+		 */
+		if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) ||
+		    !(entry->protection & VM_PROT_EXECUTE) ||
+		    (entry->object.vm_object == NULL)) {
+			continue;
+		}
+
+		obj = entry->object.vm_object;
+		VM_OBJECT_LOCK(obj);
+
+		/* 
+		 * Walk the backing_object list to find the base
+		 * (non-shadowed) vm_object.
+		 */
+		for (lobj = tobj = obj; tobj != NULL; tobj = tobj->backing_object) {
+			if (tobj != obj)
+				VM_OBJECT_LOCK(tobj);
+			if (lobj != obj)
+				VM_OBJECT_UNLOCK(lobj);
+			lobj = tobj;
+		}
+
+		/*
+		 * At this point lobj is the base vm_object and it is locked.
+		 */
+		if (lobj == NULL) {
+			PMCDBG(LOG,OPS,2, "hwpmc: lobj unexpectedly NULL! pid=%d "
+			    "vm_map=%p vm_obj=%p\n", p->p_pid, map, obj);
+			VM_OBJECT_UNLOCK(obj);
+			continue;
+		}
+
+		if (lobj->type != OBJT_VNODE || lobj->handle == NULL) {
+			if (lobj != obj)
+				VM_OBJECT_UNLOCK(lobj);
+			VM_OBJECT_UNLOCK(obj);
+			continue;
+		}
+
+		/*
+		 * Skip contiguous regions that point to the same
+		 * vnode, so we don't emit redundant MAP-IN
+		 * directives.
+		 */
+		if (entry->start == last_end && lobj->handle == last_vp) {
+			last_end = entry->end;
+			if (lobj != obj)
+				VM_OBJECT_UNLOCK(lobj);
+			VM_OBJECT_UNLOCK(obj);
+			continue;
+		}
+
+		/* 
+		 * We don't want to keep the proc's vm_map or this
+		 * vm_object locked while we walk the pathname, since
+		 * vn_fullpath() can sleep.  However, if we drop the
+		 * lock, it's possible for concurrent activity to
+		 * modify the vm_map list.  To protect against this,
+		 * we save the vm_map timestamp before we release the
+		 * lock, and check it after we reacquire the lock
+		 * below.
+		 */
+		start_addr = entry->start;
+		last_end = entry->end;
+		last_timestamp = map->timestamp;
+		vm_map_unlock_read(map);
+
+		vp = lobj->handle;
+		vref(vp);
+		if (lobj != obj)
+			VM_OBJECT_UNLOCK(lobj);
+
+		VM_OBJECT_UNLOCK(obj);
+
+		freepath = NULL;
+		pmc_getfilename(vp, &fullpath, &freepath);
+		last_vp = vp;
+		vrele(vp);
+		vp = NULL;
+		pmclog_process_map_in(po, p->p_pid, start_addr, fullpath);
+		if (freepath)
+			free(freepath, M_TEMP);
+
+		vm_map_lock_read(map);
+
+		/*
+		 * If our saved timestamp doesn't match, this means
+		 * that the vm_map was modified out from under us and
+		 * we can't trust our current "entry" pointer.  Do a
+		 * new lookup for this entry.  If there is no entry
+		 * for this address range, vm_map_lookup_entry() will
+		 * return the previous one, so we always want to go to
+		 * entry->next on the next loop iteration.
+		 * 
+		 * There is an edge condition here that can occur if
+		 * there is no entry at or before this address.  In
+		 * this situation, vm_map_lookup_entry returns
+		 * &map->header, which would cause our loop to abort
+		 * without processing the rest of the map.  However,
+		 * in practice this will never happen for process
+		 * vm_map.  This is because the executable's text
+		 * segment is the first mapping in the proc's address
+		 * space, and this mapping is never removed until the
+		 * process exits, so there will always be a non-header
+		 * entry at or before the requested address for
+		 * vm_map_lookup_entry to return.
+		 */
+		if (map->timestamp != last_timestamp)
+			vm_map_lookup_entry(map, last_end - 1, &entry);
+	}
+
+	vm_map_unlock_read(map);
+	vmspace_free(vm);
+	return;
 }
 
 /*
@@ -1897,7 +2048,7 @@ pmc_allocate_owner_descriptor(struct pro
 
 	/* allocate space for N pointers and one descriptor struct */
 	po = malloc(sizeof(struct pmc_owner), M_PMC, M_WAITOK|M_ZERO);
-	po->po_sscount = po->po_error = po->po_flags = 0;
+	po->po_sscount = po->po_error = po->po_flags = po->po_logprocmaps = 0;
 	po->po_file  = NULL;
 	po->po_owner = p;
 	po->po_kthread = NULL;
@@ -2520,8 +2671,15 @@ pmc_start(struct pmc *pm)
 		po->po_sscount++;
 	}
 
-	/* Log mapping information for all processes in the system. */
-	pmc_log_all_process_mappings(po);
+	/*
+	 * Log mapping information for all existing processes in the
+	 * system.  Subsequent mappings are logged as they happen;
+	 * see pmc_process_mmap().
+	 */
+	if (po->po_logprocmaps == 0) {
+		pmc_log_all_process_mappings(po);
+		po->po_logprocmaps = 1;
+	}
 
 	/*
 	 * Move to the CPU associated with this

Modified: head/sys/sys/pmc.h
==============================================================================
--- head/sys/sys/pmc.h	Sat Dec 26 13:54:34 2009	(r201020)
+++ head/sys/sys/pmc.h	Sat Dec 26 13:58:52 2009	(r201021)
@@ -752,7 +752,8 @@ struct pmc_owner  {
 	struct pmclog_buffer	*po_curbuf;	/* current log buffer */
 	struct file		*po_file;	/* file reference */
 	int			po_error;	/* recorded error */
-	int			po_sscount;	/* # SS PMCs owned */
+	short			po_sscount;	/* # SS PMCs owned */
+	short			po_logprocmaps;	/* global mappings done */
 };
 
 #define	PMC_PO_OWNS_LOGFILE		0x00000001 /* has a log file */

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 14:33:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB3261065670;
	Sat, 26 Dec 2009 14:33:55 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AB0058FC1A;
	Sat, 26 Dec 2009 14:33:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQEXtdb012692;
	Sat, 26 Dec 2009 14:33:55 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQEXtj1012691;
	Sat, 26 Dec 2009 14:33:55 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912261433.nBQEXtj1012691@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 26 Dec 2009 14:33:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201022 - head/libexec/talkd
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 14:33:55 -0000

Author: ed
Date: Sat Dec 26 14:33:55 2009
New Revision: 201022
URL: http://svn.freebsd.org/changeset/base/201022

Log:
  Modify the sources to make WARNS=6 work.

Modified:
  head/libexec/talkd/Makefile
  head/libexec/talkd/process.c

Modified: head/libexec/talkd/Makefile
==============================================================================
--- head/libexec/talkd/Makefile	Sat Dec 26 13:58:52 2009	(r201021)
+++ head/libexec/talkd/Makefile	Sat Dec 26 14:33:55 2009	(r201022)
@@ -6,7 +6,8 @@ SRCS=	talkd.c announce.c process.c table
 .PATH:  ${.CURDIR}/../../usr.bin/wall
 MAN=	talkd.8
 CFLAGS+=-I${.CURDIR}/../../usr.bin/wall
-WFORMAT=0
+
+WARNS?=	6
 
 DPADD=	${LIBULOG}
 LDADD=	-lulog

Modified: head/libexec/talkd/process.c
==============================================================================
--- head/libexec/talkd/process.c	Sat Dec 26 13:58:52 2009	(r201021)
+++ head/libexec/talkd/process.c	Sat Dec 26 14:33:55 2009	(r201022)
@@ -155,8 +155,8 @@ do_announce(CTL_MSG *mp, CTL_RESPONSE *r
 		rp->answer = result;
 		return;
 	}
-#define	satosin(sa)	((struct sockaddr_in *)(sa))
-	hp = gethostbyaddr((char *)&satosin(&mp->ctl_addr)->sin_addr,
+#define	satosin(sa)	((struct sockaddr_in *)(void *)(sa))
+	hp = gethostbyaddr(&satosin(&mp->ctl_addr)->sin_addr,
 		sizeof (struct in_addr), AF_INET);
 	if (hp == (struct hostent *)0) {
 		rp->answer = MACHINE_UNKNOWN;

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 14:39:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 794A11065672;
	Sat, 26 Dec 2009 14:39:23 +0000 (UTC)
	(envelope-from jkoshy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4FB078FC0C;
	Sat, 26 Dec 2009 14:39:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQEdNar012833;
	Sat, 26 Dec 2009 14:39:23 GMT (envelope-from jkoshy@svn.freebsd.org)
Received: (from jkoshy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQEdNDp012831;
	Sat, 26 Dec 2009 14:39:23 GMT (envelope-from jkoshy@svn.freebsd.org)
Message-Id: <200912261439.nBQEdNDp012831@svn.freebsd.org>
From: Joseph Koshy 
Date: Sat, 26 Dec 2009 14:39:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201023 - head/sys/dev/hwpmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 14:39:23 -0000

Author: jkoshy
Date: Sat Dec 26 14:39:23 2009
New Revision: 201023
URL: http://svn.freebsd.org/changeset/base/201023

Log:
  * Support the L1D_CACHE_LD event on Core2 processors.
  * Correct a group of typos: for Core2 programmable events, check
    user supplied umask values against the correct event descriptor
    field.
  
  Submitted by:	Ryan Stone 

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_core.c	Sat Dec 26 14:33:55 2009	(r201022)
+++ head/sys/dev/hwpmc/hwpmc_core.c	Sat Dec 26 14:39:23 2009	(r201023)
@@ -669,7 +669,7 @@ static struct iap_event_descr iap_events
     IAPDESCR(3CH_01H, 0x3C, 0x01, IAP_F_FM | IAP_F_ALLCPUS),
     IAPDESCR(3CH_02H, 0x3C, 0x02, IAP_F_FM | IAP_F_ALLCPUS),
 
-    IAPDESCR(40H, 0x40, IAP_M_MESI, IAP_F_CC),
+    IAPDESCR(40H, 0x40, IAP_M_MESI, IAP_F_CC | IAP_F_CC2),
     IAPDESCR(40H_21H, 0x40, 0x21, IAP_F_FM | IAP_F_CA),
 
     IAPDESCR(41H, 0x41, IAP_M_MESI, IAP_F_CC | IAP_F_CC2),
@@ -1419,17 +1419,17 @@ iap_allocate_pmc(int cpu, int ri, struct
 
 		mask = 0;
 
-		if (ie->iap_flags & IAP_M_CORE) {
+		if (ie->iap_umask & IAP_M_CORE) {
 			if ((c = (config & IAP_F_CORE)) != IAP_CORE_ALL &&
 			    c != IAP_CORE_THIS)
 				return (EINVAL);
 			mask |= IAP_F_CORE;
 		}
 
-		if (ie->iap_flags & IAP_M_AGENT)
+		if (ie->iap_umask & IAP_M_AGENT)
 			mask |= IAP_F_AGENT;
 
-		if (ie->iap_flags & IAP_M_PREFETCH) {
+		if (ie->iap_umask & IAP_M_PREFETCH) {
 
 			if ((c = (config & IAP_F_PREFETCH)) ==
 			    IAP_PREFETCH_RESERVED)
@@ -1438,16 +1438,16 @@ iap_allocate_pmc(int cpu, int ri, struct
 			mask |= IAP_F_PREFETCH;
 		}
 
-		if (ie->iap_flags & IAP_M_MESI)
+		if (ie->iap_umask & IAP_M_MESI)
 			mask |= IAP_F_MESI;
 
-		if (ie->iap_flags & IAP_M_SNOOPRESPONSE)
+		if (ie->iap_umask & IAP_M_SNOOPRESPONSE)
 			mask |= IAP_F_SNOOPRESPONSE;
 
-		if (ie->iap_flags & IAP_M_SNOOPTYPE)
+		if (ie->iap_umask & IAP_M_SNOOPTYPE)
 			mask |= IAP_F_SNOOPTYPE;
 
-		if (ie->iap_flags & IAP_M_TRANSITION)
+		if (ie->iap_umask & IAP_M_TRANSITION)
 			mask |= IAP_F_TRANSITION;
 
 		/*

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 18:03:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8CF9C1065696;
	Sat, 26 Dec 2009 18:03:17 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BD978FC16;
	Sat, 26 Dec 2009 18:03:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQI3H32016988;
	Sat, 26 Dec 2009 18:03:17 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQI3HBt016987;
	Sat, 26 Dec 2009 18:03:17 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200912261803.nBQI3HBt016987@svn.freebsd.org>
From: Robert Watson 
Date: Sat, 26 Dec 2009 18:03:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201024 - head/usr.sbin/wake
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 18:03:17 -0000

Author: rwatson
Date: Sat Dec 26 18:03:16 2009
New Revision: 201024
URL: http://svn.freebsd.org/changeset/base/201024

Log:
  Fix wake(8) synopsis to make it clear that at least one lladdr is required
  as an argument.
  
  Submitted by:	Marc Balmer 
  MFC after:	3 days

Modified:
  head/usr.sbin/wake/wake.8
  head/usr.sbin/wake/wake.c

Modified: head/usr.sbin/wake/wake.8
==============================================================================
--- head/usr.sbin/wake/wake.8	Sat Dec 26 14:39:23 2009	(r201023)
+++ head/usr.sbin/wake/wake.8	Sat Dec 26 18:03:16 2009	(r201024)
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd June 27, 2009
+.Dd December 21, 2009
 .Dt WAKE 8
 .Os
 .Sh NAME
@@ -24,6 +24,7 @@
 .Sh SYNOPSIS
 .Nm
 .Ar interface
+.Ar lladdr
 .Op Ar lladdr ...
 .Sh DESCRIPTION
 The

Modified: head/usr.sbin/wake/wake.c
==============================================================================
--- head/usr.sbin/wake/wake.c	Sat Dec 26 14:39:23 2009	(r201023)
+++ head/usr.sbin/wake/wake.c	Sat Dec 26 18:03:16 2009	(r201024)
@@ -62,7 +62,7 @@ static void
 usage(void)
 {
 
-	(void)fprintf(stderr, "usage: wake interface lladdr...\n");
+	(void)fprintf(stderr, "usage: wake interface lladdr [lladdr ...]\n");
 	exit(1);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 18:32:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FB33106568B;
	Sat, 26 Dec 2009 18:32:35 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6EC668FC16;
	Sat, 26 Dec 2009 18:32:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQIWZxb017715;
	Sat, 26 Dec 2009 18:32:35 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQIWZVQ017713;
	Sat, 26 Dec 2009 18:32:35 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912261832.nBQIWZVQ017713@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 26 Dec 2009 18:32:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201027 - head/usr.sbin/ntp
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 18:32:35 -0000

Author: ed
Date: Sat Dec 26 18:32:35 2009
New Revision: 201027
URL: http://svn.freebsd.org/changeset/base/201027

Log:
  Disable the unneeded inclusion of .
  
  The utmp code in systime.c is not enabled, so including  has no
  effect in our setup. This makes it a little easier for me to migrate to
  .
  
  Approved by:	roberto

Modified:
  head/usr.sbin/ntp/config.h

Modified: head/usr.sbin/ntp/config.h
==============================================================================
--- head/usr.sbin/ntp/config.h	Sat Dec 26 18:25:52 2009	(r201026)
+++ head/usr.sbin/ntp/config.h	Sat Dec 26 18:32:35 2009	(r201027)
@@ -947,7 +947,7 @@
 /* #undef HAVE_UTMPX_H */
 
 /* Define to 1 if you have the  header file. */
-#define HAVE_UTMP_H 1
+/* #undef HAVE_UTMP_H */
 
 /* Define to 1 if you have the  header file. */
 /* #undef HAVE_VALUES_H */

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 19:03:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5417D1065672;
	Sat, 26 Dec 2009 19:03:29 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4038C8FC14;
	Sat, 26 Dec 2009 19:03:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQJ3TQO018353;
	Sat, 26 Dec 2009 19:03:29 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQJ3Taw018341;
	Sat, 26 Dec 2009 19:03:29 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200912261903.nBQJ3Taw018341@svn.freebsd.org>
From: Andrew Thompson 
Date: Sat, 26 Dec 2009 19:03:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201028 - in head/sys/dev/usb: . net serial wlan
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 19:03:29 -0000

Author: thompsa
Date: Sat Dec 26 19:03:28 2009
New Revision: 201028
URL: http://svn.freebsd.org/changeset/base/201028

Log:
  Use macros to strip off USB_VENDOR_ and USB_PRODUCT_ from some id tables to make
  them more compact and readable.

Modified:
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/usbdevs
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_ural.c

Modified: head/sys/dev/usb/net/if_aue.c
==============================================================================
--- head/sys/dev/usb/net/if_aue.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/net/if_aue.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -112,74 +112,76 @@ SYSCTL_INT(_hw_usb_aue, OID_AUTO, debug,
  * Various supported device vendors/products.
  */
 static const struct usb_device_id aue_devs[] = {
-    {USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C460B, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_DSB650TX_PNA, 0)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_UFE1000, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX10, 0)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX1, AUE_FLAG_PNA | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX2, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX4, AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX5, AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX6, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX7, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX8, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_XX9, AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_SS1001, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ACCTON, USB_PRODUCT_ACCTON_USB320_EC, 0)},
-    {USB_VPI(USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII_2, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII_3, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII_4, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUSII, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ADMTEK, USB_PRODUCT_ADMTEK_PEGASUS, AUE_FLAG_PNA | AUE_FLAG_DUAL_PHY)},
-    {USB_VPI(USB_VENDOR_AEI, USB_PRODUCT_AEI_FASTETHERNET, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ALLIEDTELESYN, USB_PRODUCT_ALLIEDTELESYN_ATUSB100, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC110T, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_USB2LAN, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USB100, 0)},
-    {USB_VPI(USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USBE100, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USBEL100, 0)},
-    {USB_VPI(USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USBLP100, AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB_TXS, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB_TX, 0)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX1, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX2, AUE_FLAG_LSYS | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX3, AUE_FLAG_LSYS | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX4, AUE_FLAG_LSYS | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX_PNA, AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650TX, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_ELCON, USB_PRODUCT_ELCON_PLAN, AUE_FLAG_PNA | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSB20, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSBLTX, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSBTX0, 0)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSBTX1, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSBTX2, 0)},
-    {USB_VPI(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_LDUSBTX3, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_ELSA, USB_PRODUCT_ELSA_USB2ETHERNET, 0)},
-    {USB_VPI(USB_VENDOR_GIGABYTE, USB_PRODUCT_GIGABYTE_GNBR402W, 0)},
-    {USB_VPI(USB_VENDOR_HAWKING, USB_PRODUCT_HAWKING_UF100, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_HN210E, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBETTXS, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBETTX, 0)},
-    {USB_VPI(USB_VENDOR_KINGSTON, USB_PRODUCT_KINGSTON_KNU101TX, 0)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100H1, AUE_FLAG_LSYS | AUE_FLAG_PNA)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB100TX, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10TA, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10TX1, AUE_FLAG_LSYS | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10TX2, AUE_FLAG_LSYS | AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10T, AUE_FLAG_LSYS)},
-    {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUA2TX5, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUATX1, 0)},
-    {USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUATX5, 0)},
-    {USB_VPI(USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_MN110, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_FA101, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_SIEMENS, USB_PRODUCT_SIEMENS_SPEEDSTREAM, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_SIIG2, USB_PRODUCT_SIIG2_USBTOETHER, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_SMARTBRIDGES, USB_PRODUCT_SMARTBRIDGES_SMARTNIC, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_SMC, USB_PRODUCT_SMC_2202USB, 0)},
-    {USB_VPI(USB_VENDOR_SMC, USB_PRODUCT_SMC_2206USB, AUE_FLAG_PII)},
-    {USB_VPI(USB_VENDOR_SOHOWARE, USB_PRODUCT_SOHOWARE_NUB100, 0)},
-    {USB_VPI(USB_VENDOR_SOHOWARE, USB_PRODUCT_SOHOWARE_NUB110, AUE_FLAG_PII)},
+#define	AUE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
+    AUE_DEV(3COM, 3C460B, AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, DSB650TX_PNA, 0),
+    AUE_DEV(ABOCOM, UFE1000, AUE_FLAG_LSYS),
+    AUE_DEV(ABOCOM, XX10, 0),
+    AUE_DEV(ABOCOM, XX1, AUE_FLAG_PNA | AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, XX2, AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, XX4, AUE_FLAG_PNA),
+    AUE_DEV(ABOCOM, XX5, AUE_FLAG_PNA),
+    AUE_DEV(ABOCOM, XX6, AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, XX7, AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, XX8, AUE_FLAG_PII),
+    AUE_DEV(ABOCOM, XX9, AUE_FLAG_PNA),
+    AUE_DEV(ACCTON, SS1001, AUE_FLAG_PII),
+    AUE_DEV(ACCTON, USB320_EC, 0),
+    AUE_DEV(ADMTEK, PEGASUSII_2, AUE_FLAG_PII),
+    AUE_DEV(ADMTEK, PEGASUSII_3, AUE_FLAG_PII),
+    AUE_DEV(ADMTEK, PEGASUSII_4, AUE_FLAG_PII),
+    AUE_DEV(ADMTEK, PEGASUSII, AUE_FLAG_PII),
+    AUE_DEV(ADMTEK, PEGASUS, AUE_FLAG_PNA | AUE_FLAG_DUAL_PHY),
+    AUE_DEV(AEI, FASTETHERNET, AUE_FLAG_PII),
+    AUE_DEV(ALLIEDTELESYN, ATUSB100, AUE_FLAG_PII),
+    AUE_DEV(ATEN, UC110T, AUE_FLAG_PII),
+    AUE_DEV(BELKIN, USB2LAN, AUE_FLAG_PII),
+    AUE_DEV(BILLIONTON, USB100, 0),
+    AUE_DEV(BILLIONTON, USBE100, AUE_FLAG_PII),
+    AUE_DEV(BILLIONTON, USBEL100, 0),
+    AUE_DEV(BILLIONTON, USBLP100, AUE_FLAG_PNA),
+    AUE_DEV(COREGA, FETHER_USB_TXS, AUE_FLAG_PII),
+    AUE_DEV(COREGA, FETHER_USB_TX, 0),
+    AUE_DEV(DLINK, DSB650TX1, AUE_FLAG_LSYS),
+    AUE_DEV(DLINK, DSB650TX2, AUE_FLAG_LSYS | AUE_FLAG_PII),
+    AUE_DEV(DLINK, DSB650TX3, AUE_FLAG_LSYS | AUE_FLAG_PII),
+    AUE_DEV(DLINK, DSB650TX4, AUE_FLAG_LSYS | AUE_FLAG_PII),
+    AUE_DEV(DLINK, DSB650TX_PNA, AUE_FLAG_PNA),
+    AUE_DEV(DLINK, DSB650TX, AUE_FLAG_LSYS),
+    AUE_DEV(DLINK, DSB650, AUE_FLAG_LSYS),
+    AUE_DEV(ELCON, PLAN, AUE_FLAG_PNA | AUE_FLAG_PII),
+    AUE_DEV(ELECOM, LDUSB20, AUE_FLAG_PII),
+    AUE_DEV(ELECOM, LDUSBLTX, AUE_FLAG_PII),
+    AUE_DEV(ELECOM, LDUSBTX0, 0),
+    AUE_DEV(ELECOM, LDUSBTX1, AUE_FLAG_LSYS),
+    AUE_DEV(ELECOM, LDUSBTX2, 0),
+    AUE_DEV(ELECOM, LDUSBTX3, AUE_FLAG_LSYS),
+    AUE_DEV(ELSA, USB2ETHERNET, 0),
+    AUE_DEV(GIGABYTE, GNBR402W, 0),
+    AUE_DEV(HAWKING, UF100, AUE_FLAG_PII),
+    AUE_DEV(HP, HN210E, AUE_FLAG_PII),
+    AUE_DEV(IODATA, USBETTXS, AUE_FLAG_PII),
+    AUE_DEV(IODATA, USBETTX, 0),
+    AUE_DEV(KINGSTON, KNU101TX, 0),
+    AUE_DEV(LINKSYS, USB100H1, AUE_FLAG_LSYS | AUE_FLAG_PNA),
+    AUE_DEV(LINKSYS, USB100TX, AUE_FLAG_LSYS),
+    AUE_DEV(LINKSYS, USB10TA, AUE_FLAG_LSYS),
+    AUE_DEV(LINKSYS, USB10TX1, AUE_FLAG_LSYS | AUE_FLAG_PII),
+    AUE_DEV(LINKSYS, USB10TX2, AUE_FLAG_LSYS | AUE_FLAG_PII),
+    AUE_DEV(LINKSYS, USB10T, AUE_FLAG_LSYS),
+    AUE_DEV(MELCO, LUA2TX5, AUE_FLAG_PII),
+    AUE_DEV(MELCO, LUATX1, 0),
+    AUE_DEV(MELCO, LUATX5, 0),
+    AUE_DEV(MICROSOFT, MN110, AUE_FLAG_PII),
+    AUE_DEV(NETGEAR, FA101, AUE_FLAG_PII),
+    AUE_DEV(SIEMENS, SPEEDSTREAM, AUE_FLAG_PII),
+    AUE_DEV(SIIG2, USBTOETHER, AUE_FLAG_PII),
+    AUE_DEV(SMARTBRIDGES, SMARTNIC, AUE_FLAG_PII),
+    AUE_DEV(SMC, 2202USB, 0),
+    AUE_DEV(SMC, 2206USB, AUE_FLAG_PII),
+    AUE_DEV(SOHOWARE, NUB100, 0),
+    AUE_DEV(SOHOWARE, NUB110, AUE_FLAG_PII),
+#undef AUE_DEV
 };
 
 /* prototypes */

Modified: head/sys/dev/usb/net/if_axe.c
==============================================================================
--- head/sys/dev/usb/net/if_axe.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/net/if_axe.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -135,32 +135,34 @@ SYSCTL_INT(_hw_usb_axe, OID_AUTO, debug,
  * Various supported device vendors/products.
  */
 static const struct usb_device_id axe_devs[] = {
-	{USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_UF200, 0)},
-	{USB_VPI(USB_VENDOR_ACERCM, USB_PRODUCT_ACERCM_EP1427X2, 0)},
-	{USB_VPI(USB_VENDOR_APPLE, USB_PRODUCT_APPLE_ETHERNET, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88172, 0)},
-	{USB_VPI(USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88178, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88772A, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC210T, 0)},
-	{USB_VPI(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D5055, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_BILLIONTON, USB_PRODUCT_BILLIONTON_USB2AR, 0)},
-	{USB_VPI(USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_USB200MV2, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB2_TX, 0)},
-	{USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100, 0)},
-	{USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100B1, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_GOODWAY, USB_PRODUCT_GOODWAY_GWUSB2E, 0)},
-	{USB_VPI(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_ETGUS2, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_JVC, USB_PRODUCT_JVC_MP_PRX1, 0)},
-	{USB_VPI(USB_VENDOR_LINKSYS2, USB_PRODUCT_LINKSYS2_USB200M, 0)},
-	{USB_VPI(USB_VENDOR_LINKSYS4, USB_PRODUCT_LINKSYS4_USB1000, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_LUAU2KTX, 0)},
-	{USB_VPI(USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_FA120, 0)},
-	{USB_VPI(USB_VENDOR_OQO, USB_PRODUCT_OQO_ETHER01PLUS, AXE_FLAG_772)},
-	{USB_VPI(USB_VENDOR_PLANEX3, USB_PRODUCT_PLANEX3_GU1000T, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_SITECOM, USB_PRODUCT_SITECOM_LN029, 0)},
-	{USB_VPI(USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_LN028, AXE_FLAG_178)},
-	{USB_VPI(USB_VENDOR_SYSTEMTALKS, USB_PRODUCT_SYSTEMTALKS_SGCX2UL, 0)},
+#define	AXE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
+	AXE_DEV(ABOCOM, UF200, 0),
+	AXE_DEV(ACERCM, EP1427X2, 0),
+	AXE_DEV(APPLE, ETHERNET, AXE_FLAG_772),
+	AXE_DEV(ASIX, AX88172, 0),
+	AXE_DEV(ASIX, AX88178, AXE_FLAG_178),
+	AXE_DEV(ASIX, AX88772, AXE_FLAG_772),
+	AXE_DEV(ASIX, AX88772A, AXE_FLAG_772),
+	AXE_DEV(ATEN, UC210T, 0),
+	AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178),
+	AXE_DEV(BILLIONTON, USB2AR, 0),
+	AXE_DEV(CISCOLINKSYS, USB200MV2, AXE_FLAG_772),
+	AXE_DEV(COREGA, FETHER_USB2_TX, 0),
+	AXE_DEV(DLINK, DUBE100, 0),
+	AXE_DEV(DLINK, DUBE100B1, AXE_FLAG_772),
+	AXE_DEV(GOODWAY, GWUSB2E, 0),
+	AXE_DEV(IODATA, ETGUS2, AXE_FLAG_178),
+	AXE_DEV(JVC, MP_PRX1, 0),
+	AXE_DEV(LINKSYS2, USB200M, 0),
+	AXE_DEV(LINKSYS4, USB1000, AXE_FLAG_178),
+	AXE_DEV(MELCO, LUAU2KTX, 0),
+	AXE_DEV(NETGEAR, FA120, 0),
+	AXE_DEV(OQO, ETHER01PLUS, AXE_FLAG_772),
+	AXE_DEV(PLANEX3, GU1000T, AXE_FLAG_178),
+	AXE_DEV(SITECOM, LN029, 0),
+	AXE_DEV(SITECOMEU, LN028, AXE_FLAG_178),
+	AXE_DEV(SYSTEMTALKS, SGCX2UL, 0),
+#undef AXE_DEV
 };
 
 static device_probe_t axe_probe;

Modified: head/sys/dev/usb/net/if_cue.c
==============================================================================
--- head/sys/dev/usb/net/if_cue.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/net/if_cue.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -90,9 +90,11 @@ __FBSDID("$FreeBSD$");
 /* Belkin F5U111 adapter covered by NETMATE entry */
 
 static const struct usb_device_id cue_devs[] = {
-	{USB_VPI(USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE, 0)},
-	{USB_VPI(USB_VENDOR_CATC, USB_PRODUCT_CATC_NETMATE2, 0)},
-	{USB_VPI(USB_VENDOR_SMARTBRIDGES, USB_PRODUCT_SMARTBRIDGES_SMARTLINK, 0)},
+#define	CUE_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+	CUE_DEV(CATC, NETMATE),
+	CUE_DEV(CATC, NETMATE2),
+	CUE_DEV(SMARTBRIDGES, SMARTLINK),
+#undef CUE_DEV
 };
 
 /* prototypes */

Modified: head/sys/dev/usb/net/if_kue.c
==============================================================================
--- head/sys/dev/usb/net/if_kue.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/net/if_kue.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -102,40 +102,41 @@ __FBSDID("$FreeBSD$");
  * Various supported device vendors/products.
  */
 static const struct usb_device_id kue_devs[] = {
-	{USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C19250, 0)},
-	{USB_VPI(USB_VENDOR_3COM, USB_PRODUCT_3COM_3C460, 0)},
-	{USB_VPI(USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_URE450, 0)},
-	{USB_VPI(USB_VENDOR_ADS, USB_PRODUCT_ADS_UBS10BT, 0)},
-	{USB_VPI(USB_VENDOR_ADS, USB_PRODUCT_ADS_UBS10BTX, 0)},
-	{USB_VPI(USB_VENDOR_AOX, USB_PRODUCT_AOX_USB101, 0)},
-	{USB_VPI(USB_VENDOR_ASANTE, USB_PRODUCT_ASANTE_EA, 0)},
-	{USB_VPI(USB_VENDOR_ATEN, USB_PRODUCT_ATEN_DSB650C, 0)},
-	{USB_VPI(USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC10T, 0)},
-	{USB_VPI(USB_VENDOR_COREGA, USB_PRODUCT_COREGA_ETHER_USB_T, 0)},
-	{USB_VPI(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650C, 0)},
-	{USB_VPI(USB_VENDOR_ENTREGA, USB_PRODUCT_ENTREGA_E45, 0)},
-	{USB_VPI(USB_VENDOR_ENTREGA, USB_PRODUCT_ENTREGA_XX1, 0)},
-	{USB_VPI(USB_VENDOR_ENTREGA, USB_PRODUCT_ENTREGA_XX2, 0)},
-	{USB_VPI(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBETT, 0)},
-	{USB_VPI(USB_VENDOR_JATON, USB_PRODUCT_JATON_EDA, 0)},
-	{USB_VPI(USB_VENDOR_KINGSTON, USB_PRODUCT_KINGSTON_XX1, 0)},
-	{USB_VPI(USB_VENDOR_KLSI, USB_PRODUCT_AOX_USB101, 0)},
-	{USB_VPI(USB_VENDOR_KLSI, USB_PRODUCT_KLSI_DUH3E10BT, 0)},
-	{USB_VPI(USB_VENDOR_KLSI, USB_PRODUCT_KLSI_DUH3E10BTN, 0)},
-	{USB_VPI(USB_VENDOR_LINKSYS, USB_PRODUCT_LINKSYS_USB10T, 0)},
-	{USB_VPI(USB_VENDOR_MOBILITY, USB_PRODUCT_MOBILITY_EA, 0)},
-	{USB_VPI(USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_EA101, 0)},
-	{USB_VPI(USB_VENDOR_NETGEAR, USB_PRODUCT_NETGEAR_EA101X, 0)},
-	{USB_VPI(USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_ENET, 0)},
-	{USB_VPI(USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_ENET2, 0)},
-	{USB_VPI(USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_ENET3, 0)},
-	{USB_VPI(USB_VENDOR_PORTGEAR, USB_PRODUCT_PORTGEAR_EA8, 0)},
-	{USB_VPI(USB_VENDOR_PORTGEAR, USB_PRODUCT_PORTGEAR_EA9, 0)},
-	{USB_VPI(USB_VENDOR_PORTSMITH, USB_PRODUCT_PORTSMITH_EEA, 0)},
-	{USB_VPI(USB_VENDOR_SHARK, USB_PRODUCT_SHARK_PA, 0)},
-	{USB_VPI(USB_VENDOR_SILICOM, USB_PRODUCT_SILICOM_GPE, 0)},
-	{USB_VPI(USB_VENDOR_SILICOM, USB_PRODUCT_SILICOM_U2E, 0)},
-	{USB_VPI(USB_VENDOR_SMC, USB_PRODUCT_SMC_2102USB, 0)},
+#define	KUE_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+	KUE_DEV(3COM, 3C19250),
+	KUE_DEV(3COM, 3C460),
+	KUE_DEV(ABOCOM, URE450),
+	KUE_DEV(ADS, UBS10BT),
+	KUE_DEV(ADS, UBS10BTX),
+	KUE_DEV(AOX, USB101),
+	KUE_DEV(ASANTE, EA),
+	KUE_DEV(ATEN, DSB650C),
+	KUE_DEV(ATEN, UC10T),
+	KUE_DEV(COREGA, ETHER_USB_T),
+	KUE_DEV(DLINK, DSB650C),
+	KUE_DEV(ENTREGA, E45),
+	KUE_DEV(ENTREGA, XX1),
+	KUE_DEV(ENTREGA, XX2),
+	KUE_DEV(IODATA, USBETT),
+	KUE_DEV(JATON, EDA),
+	KUE_DEV(KINGSTON, XX1),
+	KUE_DEV(KLSI, DUH3E10BT),
+	KUE_DEV(KLSI, DUH3E10BTN),
+	KUE_DEV(LINKSYS, USB10T),
+	KUE_DEV(MOBILITY, EA),
+	KUE_DEV(NETGEAR, EA101),
+	KUE_DEV(NETGEAR, EA101X),
+	KUE_DEV(PERACOM, ENET),
+	KUE_DEV(PERACOM, ENET2),
+	KUE_DEV(PERACOM, ENET3),
+	KUE_DEV(PORTGEAR, EA8),
+	KUE_DEV(PORTGEAR, EA9),
+	KUE_DEV(PORTSMITH, EEA),
+	KUE_DEV(SHARK, PA),
+	KUE_DEV(SILICOM, GPE),
+	KUE_DEV(SILICOM, U2E),
+	KUE_DEV(SMC, 2102USB),
+#undef KUE_DEV
 };
 
 /* prototypes */

Modified: head/sys/dev/usb/serial/uftdi.c
==============================================================================
--- head/sys/dev/usb/serial/uftdi.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/serial/uftdi.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -216,43 +216,46 @@ MODULE_DEPEND(uftdi, ucom, 1, 1, 1);
 MODULE_DEPEND(uftdi, usb, 1, 1, 1);
 
 static struct usb_device_id uftdi_devs[] = {
-	{USB_VPI(USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_STK541, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_SENSORTERMINALBOARD, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_DRESDENELEKTRONIK, USB_PRODUCT_DRESDENELEKTRONIK_WIRELESSHANDHELDTERMINAL, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232D, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM4, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SEMC_DSS20, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_631, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_632, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_633, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_634, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_635, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_USBSERIAL, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MX2_3, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MX4_5, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LK202, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LK204, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13M, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13S, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TACTRIX_OPENPORT_13U, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_EISCOU, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_UOPTBR, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_EMCU2D, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PCMSFU, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_EMCU2H, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MAXSTREAM, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CTI_USB_NANO_485, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CTI_USB_MINI_485, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_SIIG2, USB_PRODUCT_SIIG2_US2308, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_VALUECAN, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_NEOVI, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_BBELECTRONICS, USB_PRODUCT_BBELECTRONICS_USOTL4, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_MARVELL, USB_PRODUCT_MARVELL_SHEEVAPLUG, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1, UFTDI_TYPE_8U232AM)},
-	{USB_VPI(USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60F, UFTDI_TYPE_8U232AM)},
+#define	UFTDI_DEV(v,p,t) \
+  { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, UFTDI_TYPE_##t) }
+	UFTDI_DEV(ATMEL, STK541, 8U232AM),
+	UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 8U232AM),
+	UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 8U232AM),
+	UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO),
+	UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM),
+	UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM),
+	UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM),
+	UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM),
+	UFTDI_DEV(FTDI, SEMC_DSS20, 8U232AM),
+	UFTDI_DEV(FTDI, CFA_631, 8U232AM),
+	UFTDI_DEV(FTDI, CFA_632, 8U232AM),
+	UFTDI_DEV(FTDI, CFA_633, 8U232AM),
+	UFTDI_DEV(FTDI, CFA_634, 8U232AM),
+	UFTDI_DEV(FTDI, CFA_635, 8U232AM),
+	UFTDI_DEV(FTDI, USBSERIAL, 8U232AM),
+	UFTDI_DEV(FTDI, MX2_3, 8U232AM),
+	UFTDI_DEV(FTDI, MX4_5, 8U232AM),
+	UFTDI_DEV(FTDI, LK202, 8U232AM),
+	UFTDI_DEV(FTDI, LK204, 8U232AM),
+	UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, 8U232AM),
+	UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, 8U232AM),
+	UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, 8U232AM),
+	UFTDI_DEV(FTDI, EISCOU, 8U232AM),
+	UFTDI_DEV(FTDI, UOPTBR, 8U232AM),
+	UFTDI_DEV(FTDI, EMCU2D, 8U232AM),
+	UFTDI_DEV(FTDI, PCMSFU, 8U232AM),
+	UFTDI_DEV(FTDI, EMCU2H, 8U232AM),
+	UFTDI_DEV(FTDI, MAXSTREAM, 8U232AM),
+	UFTDI_DEV(FTDI, CTI_USB_NANO_485, 8U232AM),
+	UFTDI_DEV(FTDI, CTI_USB_MINI_485, 8U232AM),
+	UFTDI_DEV(SIIG2, US2308, 8U232AM),
+	UFTDI_DEV(INTREPIDCS, VALUECAN, 8U232AM),
+	UFTDI_DEV(INTREPIDCS, NEOVI, 8U232AM),
+	UFTDI_DEV(BBELECTRONICS, USOTL4, 8U232AM),
+	UFTDI_DEV(MARVELL, SHEEVAPLUG, 8U232AM),
+	UFTDI_DEV(MELCO, PCOPRS1, 8U232AM),
+	UFTDI_DEV(RATOC, REXUSB60F, 8U232AM),
+#undef UFTDI_DEV
 };
 
 static int

Modified: head/sys/dev/usb/serial/uplcom.c
==============================================================================
--- head/sys/dev/usb/serial/uplcom.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/serial/uplcom.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -243,57 +243,57 @@ static struct ucom_callback uplcom_callb
 	.ucom_poll = &uplcom_poll,
 };
 
-#define	USB_UPL(v,p,rl,rh,t)				\
-  USB_VENDOR(v), USB_PRODUCT(p), USB_DEV_BCD_GTEQ(rl),	\
-  USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(t)
+#define	UPLCOM_DEV(v,p,rl,rh,t)				\
+  { USB_VENDOR(USB_VENDOR_##v), USB_PRODUCT(USB_PRODUCT_##v##_##p), \
+    USB_DEV_BCD_GTEQ(rl), USB_DEV_BCD_LTEQ(rh), USB_DRIVER_INFO(TYPE_##t) }
 
 static const struct usb_device_id uplcom_devs[] = {
 	/* Belkin F5U257 */
-	{USB_UPL(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U257, 0, 0xFFFF, TYPE_PL2303X)},
+	UPLCOM_DEV(BELKIN, F5U257, 0, 0xFFFF, PL2303X),
 	/* I/O DATA USB-RSAQ */
-	{USB_UPL(USB_VENDOR_IODATA, USB_PRODUCT_IODATA_USBRSAQ, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(IODATA, USBRSAQ, 0, 0xFFFF, PL2303),
 	/* I/O DATA USB-RSAQ2 */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_RSAQ2, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0xFFFF, PL2303),
 	/* I/O DATA USB-RSAQ3 */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_RSAQ3, 0, 0xFFFF, TYPE_PL2303X)},
+	UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0xFFFF, PL2303X),
 	/* PLANEX USB-RS232 URS-03 */
-	{USB_UPL(USB_VENDOR_ATEN, USB_PRODUCT_ATEN_UC232A, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(ATEN, UC232A, 0, 0xFFFF, PL2303),
 	/* TrendNet TU-S9 */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303, 0x0400, 0xFFFF, TYPE_PL2303X)},
+	UPLCOM_DEV(PROLIFIC, PL2303, 0x0400, 0xFFFF, PL2303X),
 	/* ST Lab USB-SERIAL-4 */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303, 0x0300, 0x03FF, TYPE_PL2303X)},
+	UPLCOM_DEV(PROLIFIC, PL2303, 0x0300, 0x03FF, PL2303X),
 	/* IOGEAR/ATEN UC-232A (also ST Lab USB-SERIAL-1) */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303, 0, 0x02FF, TYPE_PL2303)},
+	UPLCOM_DEV(PROLIFIC, PL2303, 0, 0x02FF, PL2303),
 	/* TDK USB-PHS Adapter UHA6400 */
-	{USB_UPL(USB_VENDOR_TDK, USB_PRODUCT_TDK_UHA6400, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(TDK, UHA6400, 0, 0xFFFF, PL2303),
 	/* RATOC REX-USB60 */
-	{USB_UPL(USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(RATOC, REXUSB60, 0, 0xFFFF, PL2303),
 	/* ELECOM UC-SGT */
-	{USB_UPL(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_UCSGT, 0, 0xFFFF, TYPE_PL2303)},
-	{USB_UPL(USB_VENDOR_ELECOM, USB_PRODUCT_ELECOM_UCSGT0, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(ELECOM, UCSGT, 0, 0xFFFF, PL2303),
+	UPLCOM_DEV(ELECOM, UCSGT0, 0, 0xFFFF, PL2303),
 	/* Sagem USB-Serial Controller */
-	{USB_UPL(USB_VENDOR_SAGEM, USB_PRODUCT_SAGEM_USBSERIAL, 0, 0xFFFF, TYPE_PL2303X)},
+	UPLCOM_DEV(SAGEM, USBSERIAL, 0, 0xFFFF, PL2303X),
 	/* Sony Ericsson USB Cable */
-	{USB_UPL(USB_VENDOR_SONYERICSSON, USB_PRODUCT_SONYERICSSON_DCU10, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(SONYERICSSON, DCU10, 0, 0xFFFF, PL2303),
 	/* SOURCENEXT KeikaiDenwa 8 */
-	{USB_UPL(USB_VENDOR_SOURCENEXT, USB_PRODUCT_SOURCENEXT_KEIKAI8, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(SOURCENEXT, KEIKAI8, 0, 0xFFFF, PL2303),
 	/* SOURCENEXT KeikaiDenwa 8 with charger */
-	{USB_UPL(USB_VENDOR_SOURCENEXT, USB_PRODUCT_SOURCENEXT_KEIKAI8_CHG, 0, 0, TYPE_PL2303)},
+	UPLCOM_DEV(SOURCENEXT, KEIKAI8_CHG, 0, 0, PL2303),
 	/* HAL Corporation Crossam2+USB */
-	{USB_UPL(USB_VENDOR_HAL, USB_PRODUCT_HAL_IMR001, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(HAL, IMR001, 0, 0xFFFF, PL2303),
 	/* Sitecom USB to Serial */
-	{USB_UPL(USB_VENDOR_SITECOM, USB_PRODUCT_SITECOM_SERIAL, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(SITECOM, SERIAL, 0, 0xFFFF, PL2303),
 	/* Tripp-Lite U209-000-R */
-	{USB_UPL(USB_VENDOR_TRIPPLITE, USB_PRODUCT_TRIPPLITE_U209, 0, 0xFFFF, TYPE_PL2303X)},
-	{USB_UPL(USB_VENDOR_RADIOSHACK, USB_PRODUCT_RADIOSHACK_USBCABLE, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(TRIPPLITE, U209, 0, 0xFFFF, PL2303X),
+	UPLCOM_DEV(RADIOSHACK, USBCABLE, 0, 0xFFFF, PL2303),
 	/* Prolific Pharos */
-	{USB_UPL(USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PHAROS, 0, 0xFFFF, TYPE_PL2303)},
+	UPLCOM_DEV(PROLIFIC, PHAROS, 0, 0xFFFF, PL2303),
 	/* Willcom W-SIM */
-	{USB_UPL(USB_VENDOR_PROLIFIC2, USB_PRODUCT_PROLIFIC2_WSIM, 0, 0xFFFF, TYPE_PL2303X)},
+	UPLCOM_DEV(PROLIFIC2, WSIM, 0, 0xFFFF, PL2303X),
 	/* Mobile Action MA-620 Infrared Adapter */
-	{USB_UPL(USB_VENDOR_MOBILEACTION, USB_PRODUCT_MOBILEACTION_MA620, 0, 0xFFFF, TYPE_PL2303X)},
-
+	UPLCOM_DEV(MOBILEACTION, MA620, 0, 0xFFFF, PL2303X),
 };
+#undef UPLCOM_DEV
 
 static device_method_t uplcom_methods[] = {
 	DEVMETHOD(device_probe, uplcom_probe),

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/serial/uslcom.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -175,24 +175,26 @@ static struct ucom_callback uslcom_callb
 };
 
 static const struct usb_device_id uslcom_devs[] = {
-    { USB_VPI(USB_VENDOR_BALTECH,	USB_PRODUCT_BALTECH_CARDREADER, 0) },
-    { USB_VPI(USB_VENDOR_DYNASTREAM,	USB_PRODUCT_DYNASTREAM_ANTDEVBOARD, 0) },
-    { USB_VPI(USB_VENDOR_JABLOTRON,	USB_PRODUCT_JABLOTRON_PC60B, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_ARGUSISP, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_CRUMB128, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_DEGREE, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_BURNSIDE, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_HELICOM, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_LIPOWSKY_HARP, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_LIPOWSKY_JTAG, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_LIPOWSKY_LIN, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_POLOLU, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_CP2102, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_CP210X_2, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_SUUNTO, 0) },
-    { USB_VPI(USB_VENDOR_SILABS,	USB_PRODUCT_SILABS_TRAQMATE, 0) },
-    { USB_VPI(USB_VENDOR_SILABS2,	USB_PRODUCT_SILABS2_DCU11CLONE, 0) },
-    { USB_VPI(USB_VENDOR_USI,		USB_PRODUCT_USI_MC60, 0) },
+#define	USLCOM_DEV(v,p)  { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+    USLCOM_DEV(BALTECH, CARDREADER),
+    USLCOM_DEV(DYNASTREAM, ANTDEVBOARD),
+    USLCOM_DEV(JABLOTRON, PC60B),
+    USLCOM_DEV(SILABS, ARGUSISP),
+    USLCOM_DEV(SILABS, CRUMB128),
+    USLCOM_DEV(SILABS, DEGREE),
+    USLCOM_DEV(SILABS, BURNSIDE),
+    USLCOM_DEV(SILABS, HELICOM),
+    USLCOM_DEV(SILABS, LIPOWSKY_HARP),
+    USLCOM_DEV(SILABS, LIPOWSKY_JTAG),
+    USLCOM_DEV(SILABS, LIPOWSKY_LIN),
+    USLCOM_DEV(SILABS, POLOLU),
+    USLCOM_DEV(SILABS, CP2102),
+    USLCOM_DEV(SILABS, CP210X_2),
+    USLCOM_DEV(SILABS, SUUNTO),
+    USLCOM_DEV(SILABS, TRAQMATE),
+    USLCOM_DEV(SILABS2, DCU11CLONE),
+    USLCOM_DEV(USI, MC60),
+#undef USLCOM_DEV
 };
 
 static device_method_t uslcom_methods[] = {

Modified: head/sys/dev/usb/serial/uvisor.c
==============================================================================
--- head/sys/dev/usb/serial/uvisor.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/serial/uvisor.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -261,32 +261,34 @@ MODULE_DEPEND(uvisor, ucom, 1, 1, 1);
 MODULE_DEPEND(uvisor, usb, 1, 1, 1);
 
 static const struct usb_device_id uvisor_devs[] = {
-	{USB_VPI(USB_VENDOR_ACEECA, USB_PRODUCT_ACEECA_MEZ1000, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_GARMIN, USB_PRODUCT_GARMIN_IQUE_3600, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_FOSSIL, USB_PRODUCT_FOSSIL_WRISTPDA, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_VISOR, UVISOR_FLAG_VISOR)},
-	{USB_VPI(USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_HANDSPRING, USB_PRODUCT_HANDSPRING_TREO600, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_M500, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_M505, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_M515, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_I705, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_M125, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_M130, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_Z, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_TUNGSTEN_T, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_ZIRE, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_ZIRE31, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_SAMSUNG, USB_PRODUCT_SAMSUNG_I500, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40, 0)},
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41, 0)},
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_S360, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_NX60, UVISOR_FLAG_PALM4)},
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_35, UVISOR_FLAG_PALM35)},
-/*  {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_25, UVISOR_FLAG_PALM4 )}, */
-	{USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_TJ37, UVISOR_FLAG_PALM4)},
-/*  {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_TH55, UVISOR_FLAG_PALM4 )}, See PR 80935 */
-	{USB_VPI(USB_VENDOR_TAPWAVE, USB_PRODUCT_TAPWAVE_ZODIAC, UVISOR_FLAG_PALM4)},
+#define	UVISOR_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
+	UVISOR_DEV(ACEECA, MEZ1000, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(GARMIN, IQUE_3600, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(FOSSIL, WRISTPDA, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(HANDSPRING, VISOR, UVISOR_FLAG_VISOR),
+	UVISOR_DEV(HANDSPRING, TREO, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(HANDSPRING, TREO600, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, M500, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, M505, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, M515, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, I705, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, M125, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, M130, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, TUNGSTEN_Z, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, TUNGSTEN_T, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, ZIRE, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(PALM, ZIRE31, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(SAMSUNG, I500, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(SONY, CLIE_40, 0),
+	UVISOR_DEV(SONY, CLIE_41, 0),
+	UVISOR_DEV(SONY, CLIE_S360, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(SONY, CLIE_NX60, UVISOR_FLAG_PALM4),
+	UVISOR_DEV(SONY, CLIE_35, UVISOR_FLAG_PALM35),
+/*  UVISOR_DEV(SONY, CLIE_25, UVISOR_FLAG_PALM4 ), */
+	UVISOR_DEV(SONY, CLIE_TJ37, UVISOR_FLAG_PALM4),
+/*  UVISOR_DEV(SONY, CLIE_TH55, UVISOR_FLAG_PALM4 ), See PR 80935 */
+	UVISOR_DEV(TAPWAVE, ZODIAC, UVISOR_FLAG_PALM4),
+#undef UVISOR_DEV
 };
 
 static int

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/usbdevs	Sat Dec 26 19:03:28 2009	(r201028)
@@ -941,6 +941,7 @@ product ASUS RT2573_2		0x1724	RT2573
 product ASUS LCM		0x1726	LCM display
 product ASUS P535		0x420f	ASUS P535 PDA
 product	ASUS GMSC		0x422f	ASUS Generic Mass Storage
+product ASUS RT2570		0x1706	RT2500USB Wireless Adapter
 
 /* ATen products */
 product ATEN UC1284		0x2001	Parallel printer

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/wlan/if_rum.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -86,54 +86,56 @@ SYSCTL_INT(_hw_usb_rum, OID_AUTO, debug,
 #endif
 
 static const struct usb_device_id rum_devs[] = {
-    { USB_VP(USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_HWU54DM) },
-    { USB_VP(USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_RT2573_2) },
-    { USB_VP(USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_RT2573_3) },
-    { USB_VP(USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_RT2573_4) },
-    { USB_VP(USB_VENDOR_ABOCOM,		USB_PRODUCT_ABOCOM_WUG2700) },
-    { USB_VP(USB_VENDOR_AMIT,		USB_PRODUCT_AMIT_CGWLUSB2GO) },
-    { USB_VP(USB_VENDOR_ASUS,		USB_PRODUCT_ASUS_RT2573_1) },
-    { USB_VP(USB_VENDOR_ASUS,		USB_PRODUCT_ASUS_RT2573_2) },
-    { USB_VP(USB_VENDOR_BELKIN,		USB_PRODUCT_BELKIN_F5D7050A) },
-    { USB_VP(USB_VENDOR_BELKIN,		USB_PRODUCT_BELKIN_F5D9050V3) },
-    { USB_VP(USB_VENDOR_CISCOLINKSYS,	USB_PRODUCT_CISCOLINKSYS_WUSB54GC) },
-    { USB_VP(USB_VENDOR_CISCOLINKSYS,	USB_PRODUCT_CISCOLINKSYS_WUSB54GR) },
-    { USB_VP(USB_VENDOR_CONCEPTRONIC2,	USB_PRODUCT_CONCEPTRONIC2_C54RU2) },
-    { USB_VP(USB_VENDOR_COREGA,		USB_PRODUCT_COREGA_CGWLUSB2GL) },
-    { USB_VP(USB_VENDOR_COREGA,		USB_PRODUCT_COREGA_CGWLUSB2GPX) },
-    { USB_VP(USB_VENDOR_DICKSMITH,	USB_PRODUCT_DICKSMITH_CWD854F) },
-    { USB_VP(USB_VENDOR_DICKSMITH,	USB_PRODUCT_DICKSMITH_RT2573) },
-    { USB_VP(USB_VENDOR_DLINK2,		USB_PRODUCT_DLINK2_DWLG122C1) },
-    { USB_VP(USB_VENDOR_DLINK2,		USB_PRODUCT_DLINK2_WUA1340) },
-    { USB_VP(USB_VENDOR_DLINK2,		USB_PRODUCT_DLINK2_DWA111) },
-    { USB_VP(USB_VENDOR_DLINK2,		USB_PRODUCT_DLINK2_DWA110) },
-    { USB_VP(USB_VENDOR_GIGABYTE,	USB_PRODUCT_GIGABYTE_GNWB01GS) },
-    { USB_VP(USB_VENDOR_GIGABYTE,	USB_PRODUCT_GIGABYTE_GNWI05GS) },
-    { USB_VP(USB_VENDOR_GIGASET,	USB_PRODUCT_GIGASET_RT2573) },
-    { USB_VP(USB_VENDOR_GOODWAY,	USB_PRODUCT_GOODWAY_RT2573) },
-    { USB_VP(USB_VENDOR_GUILLEMOT,	USB_PRODUCT_GUILLEMOT_HWGUSB254LB) },
-    { USB_VP(USB_VENDOR_GUILLEMOT,	USB_PRODUCT_GUILLEMOT_HWGUSB254V2AP) },
-    { USB_VP(USB_VENDOR_HUAWEI3COM,	USB_PRODUCT_HUAWEI3COM_WUB320G) },
-    { USB_VP(USB_VENDOR_MELCO,		USB_PRODUCT_MELCO_G54HP) },
-    { USB_VP(USB_VENDOR_MELCO,		USB_PRODUCT_MELCO_SG54HP) },
-    { USB_VP(USB_VENDOR_MSI,		USB_PRODUCT_MSI_RT2573_1) },
-    { USB_VP(USB_VENDOR_MSI,		USB_PRODUCT_MSI_RT2573_2) },
-    { USB_VP(USB_VENDOR_MSI,		USB_PRODUCT_MSI_RT2573_3) },
-    { USB_VP(USB_VENDOR_MSI,		USB_PRODUCT_MSI_RT2573_4) },
-    { USB_VP(USB_VENDOR_NOVATECH,	USB_PRODUCT_NOVATECH_RT2573) },
-    { USB_VP(USB_VENDOR_PLANEX2,	USB_PRODUCT_PLANEX2_GWUS54HP) },
-    { USB_VP(USB_VENDOR_PLANEX2,	USB_PRODUCT_PLANEX2_GWUS54MINI2) },
-    { USB_VP(USB_VENDOR_PLANEX2,	USB_PRODUCT_PLANEX2_GWUSMM) },
-    { USB_VP(USB_VENDOR_QCOM,		USB_PRODUCT_QCOM_RT2573) },
-    { USB_VP(USB_VENDOR_QCOM,		USB_PRODUCT_QCOM_RT2573_2) },
-    { USB_VP(USB_VENDOR_QCOM,		USB_PRODUCT_QCOM_RT2573_3) },
-    { USB_VP(USB_VENDOR_RALINK,		USB_PRODUCT_RALINK_RT2573) },
-    { USB_VP(USB_VENDOR_RALINK,		USB_PRODUCT_RALINK_RT2573_2) },
-    { USB_VP(USB_VENDOR_RALINK,		USB_PRODUCT_RALINK_RT2671) },
-    { USB_VP(USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_WL113R2) },
-    { USB_VP(USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_WL172) },
-    { USB_VP(USB_VENDOR_SPARKLAN,	USB_PRODUCT_SPARKLAN_RT2573) },
-    { USB_VP(USB_VENDOR_SURECOM,	USB_PRODUCT_SURECOM_RT2573) },
+#define	RUM_DEV(v,p)  { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+    RUM_DEV(ABOCOM, HWU54DM),
+    RUM_DEV(ABOCOM, RT2573_2),
+    RUM_DEV(ABOCOM, RT2573_3),
+    RUM_DEV(ABOCOM, RT2573_4),
+    RUM_DEV(ABOCOM, WUG2700),
+    RUM_DEV(AMIT, CGWLUSB2GO),
+    RUM_DEV(ASUS, RT2573_1),
+    RUM_DEV(ASUS, RT2573_2),
+    RUM_DEV(BELKIN, F5D7050A),
+    RUM_DEV(BELKIN, F5D9050V3),
+    RUM_DEV(CISCOLINKSYS, WUSB54GC),
+    RUM_DEV(CISCOLINKSYS, WUSB54GR),
+    RUM_DEV(CONCEPTRONIC2, C54RU2),
+    RUM_DEV(COREGA, CGWLUSB2GL),
+    RUM_DEV(COREGA, CGWLUSB2GPX),
+    RUM_DEV(DICKSMITH, CWD854F),
+    RUM_DEV(DICKSMITH, RT2573),
+    RUM_DEV(DLINK2, DWLG122C1),
+    RUM_DEV(DLINK2, WUA1340),
+    RUM_DEV(DLINK2, DWA111),
+    RUM_DEV(DLINK2, DWA110),
+    RUM_DEV(GIGABYTE, GNWB01GS),
+    RUM_DEV(GIGABYTE, GNWI05GS),
+    RUM_DEV(GIGASET, RT2573),
+    RUM_DEV(GOODWAY, RT2573),
+    RUM_DEV(GUILLEMOT, HWGUSB254LB),
+    RUM_DEV(GUILLEMOT, HWGUSB254V2AP),
+    RUM_DEV(HUAWEI3COM, WUB320G),
+    RUM_DEV(MELCO, G54HP),
+    RUM_DEV(MELCO, SG54HP),
+    RUM_DEV(MSI, RT2573_1),
+    RUM_DEV(MSI, RT2573_2),
+    RUM_DEV(MSI, RT2573_3),
+    RUM_DEV(MSI, RT2573_4),
+    RUM_DEV(NOVATECH, RT2573),
+    RUM_DEV(PLANEX2, GWUS54HP),
+    RUM_DEV(PLANEX2, GWUS54MINI2),
+    RUM_DEV(PLANEX2, GWUSMM),
+    RUM_DEV(QCOM, RT2573),
+    RUM_DEV(QCOM, RT2573_2),
+    RUM_DEV(QCOM, RT2573_3),
+    RUM_DEV(RALINK, RT2573),
+    RUM_DEV(RALINK, RT2573_2),
+    RUM_DEV(RALINK, RT2671),
+    RUM_DEV(SITECOMEU, WL113R2),
+    RUM_DEV(SITECOMEU, WL172),
+    RUM_DEV(SPARKLAN, RT2573),
+    RUM_DEV(SURECOM, RT2573),
+#undef RUM_DEV
 };
 
 MODULE_DEPEND(rum, wlan, 1, 1, 1);

Modified: head/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- head/sys/dev/usb/wlan/if_ural.c	Sat Dec 26 18:32:35 2009	(r201027)
+++ head/sys/dev/usb/wlan/if_ural.c	Sat Dec 26 19:03:28 2009	(r201028)
@@ -92,35 +92,37 @@ SYSCTL_INT(_hw_usb_ural, OID_AUTO, debug
 
 /* various supported device vendors/products */
 static const struct usb_device_id ural_devs[] = {
-	{ USB_VP(USB_VENDOR_ASUS, USB_PRODUCT_ASUS_WL167G) },
-	{ USB_VP(USB_VENDOR_ASUS, USB_PRODUCT_RALINK_RT2570) },
-	{ USB_VP(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7050) },
-	{ USB_VP(USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5D7051) },
-	{ USB_VP(USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_HU200TS) },
-	{ USB_VP(USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54G) },
-	{ USB_VP(USB_VENDOR_CISCOLINKSYS, USB_PRODUCT_CISCOLINKSYS_WUSB54GP) },
-	{ USB_VP(USB_VENDOR_CONCEPTRONIC2, USB_PRODUCT_CONCEPTRONIC2_C54RU) },
-	{ USB_VP(USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWLG122) },
-	{ USB_VP(USB_VENDOR_GIGABYTE, USB_PRODUCT_GIGABYTE_GN54G) },
-	{ USB_VP(USB_VENDOR_GIGABYTE, USB_PRODUCT_GIGABYTE_GNWBKG) },
-	{ USB_VP(USB_VENDOR_GUILLEMOT, USB_PRODUCT_GUILLEMOT_HWGUSB254) },
-	{ USB_VP(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54) },
-	{ USB_VP(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54AI) },
-	{ USB_VP(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_KG54YB) },
-	{ USB_VP(USB_VENDOR_MELCO, USB_PRODUCT_MELCO_NINWIFI) },
-	{ USB_VP(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2570) },
-	{ USB_VP(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2570_2) },
-	{ USB_VP(USB_VENDOR_MSI, USB_PRODUCT_MSI_RT2570_3) },
-	{ USB_VP(USB_VENDOR_NOVATECH, USB_PRODUCT_NOVATECH_NV902) },
-	{ USB_VP(USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570) },
-	{ USB_VP(USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570_2) },
-	{ USB_VP(USB_VENDOR_RALINK, USB_PRODUCT_RALINK_RT2570_3) },
-	{ USB_VP(USB_VENDOR_SIEMENS2, USB_PRODUCT_SIEMENS2_WL54G) },
-	{ USB_VP(USB_VENDOR_SMC, USB_PRODUCT_SMC_2862WG) },
-	{ USB_VP(USB_VENDOR_SPHAIRON, USB_PRODUCT_SPHAIRON_UB801R) },
-	{ USB_VP(USB_VENDOR_SURECOM, USB_PRODUCT_SURECOM_RT2570) },
-	{ USB_VP(USB_VENDOR_VTECH, USB_PRODUCT_VTECH_RT2570) },
-	{ USB_VP(USB_VENDOR_ZINWELL, USB_PRODUCT_ZINWELL_RT2570) },
+#define	URAL_DEV(v,p)  { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) }
+	URAL_DEV(ASUS, WL167G),
+	URAL_DEV(ASUS, RT2570),
+	URAL_DEV(BELKIN, F5D7050),
+	URAL_DEV(BELKIN, F5D7051),
+	URAL_DEV(CISCOLINKSYS, HU200TS),
+	URAL_DEV(CISCOLINKSYS, WUSB54G),
+	URAL_DEV(CISCOLINKSYS, WUSB54GP),
+	URAL_DEV(CONCEPTRONIC2, C54RU),
+	URAL_DEV(DLINK, DWLG122),
+	URAL_DEV(GIGABYTE, GN54G),
+	URAL_DEV(GIGABYTE, GNWBKG),
+	URAL_DEV(GUILLEMOT, HWGUSB254),
+	URAL_DEV(MELCO, KG54),
+	URAL_DEV(MELCO, KG54AI),
+	URAL_DEV(MELCO, KG54YB),
+	URAL_DEV(MELCO, NINWIFI),
+	URAL_DEV(MSI, RT2570),
+	URAL_DEV(MSI, RT2570_2),
+	URAL_DEV(MSI, RT2570_3),
+	URAL_DEV(NOVATECH, NV902),
+	URAL_DEV(RALINK, RT2570),
+	URAL_DEV(RALINK, RT2570_2),
+	URAL_DEV(RALINK, RT2570_3),
+	URAL_DEV(SIEMENS2, WL54G),
+	URAL_DEV(SMC, 2862WG),
+	URAL_DEV(SPHAIRON, UB801R),
+	URAL_DEV(SURECOM, RT2570),
+	URAL_DEV(VTECH, RT2570),
+	URAL_DEV(ZINWELL, RT2570),
+#undef URAL_DEV
 };
 
 static usb_callback_t ural_bulk_read_callback;

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 19:15:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6F316106566C;
	Sat, 26 Dec 2009 19:15:15 +0000 (UTC)
	(envelope-from rmacklem@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5D8AC8FC1F;
	Sat, 26 Dec 2009 19:15:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQJFFBR018692;
	Sat, 26 Dec 2009 19:15:15 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQJFF3E018688;
	Sat, 26 Dec 2009 19:15:15 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200912261915.nBQJFF3E018688@svn.freebsd.org>
From: Rick Macklem 
Date: Sat, 26 Dec 2009 19:15:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201029 - head/sys/fs/nfsclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 19:15:15 -0000

Author: rmacklem
Date: Sat Dec 26 19:15:15 2009
New Revision: 201029
URL: http://svn.freebsd.org/changeset/base/201029

Log:
  When porting the experimental nfs subsystem to the FreeBSD8 krpc,
  I added 3 functions that were already in the experimental client
  under different names. This patch deletes the functions in the
  experimental client and renames the calls to use the other set.
  (This is just removal of duplicated code and does not fix any bug.)
  
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfsclient/nfs.h
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/fs/nfsclient/nfs_clvnops.c

Modified: head/sys/fs/nfsclient/nfs.h
==============================================================================
--- head/sys/fs/nfsclient/nfs.h	Sat Dec 26 19:03:28 2009	(r201028)
+++ head/sys/fs/nfsclient/nfs.h	Sat Dec 26 19:15:15 2009	(r201029)
@@ -67,7 +67,6 @@ int ncl_vinvalbuf(struct vnode *, int, s
 int ncl_asyncio(struct nfsmount *, struct buf *, struct ucred *,
     struct thread *);
 int ncl_doio(struct vnode *, struct buf *, struct ucred *, struct thread *);
-int ncl_msleep(struct thread *, void *, struct mtx *, int, char *, int);
 void ncl_nhinit(void);
 void ncl_nhuninit(void);
 void ncl_nodelock(struct nfsnode *);

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clbio.c	Sat Dec 26 19:03:28 2009	(r201028)
+++ head/sys/fs/nfsclient/nfs_clbio.c	Sat Dec 26 19:15:15 2009	(r201029)
@@ -75,101 +75,6 @@ static int nfs_directio_write(struct vno
     struct ucred *cred, int ioflag);
 
 /*
- * Any signal that can interrupt an NFS operation in an intr mount
- * should be added to this set. SIGSTOP and SIGKILL cannot be masked.
- */
-static int nfs_sig_set[] = {
-	SIGINT,
-	SIGTERM,
-	SIGHUP,
-	SIGKILL,
-	SIGSTOP,
-	SIGQUIT
-};
-
-#ifdef notnow
-/*
- * Check to see if one of the signals in our subset is pending on
- * the process (in an intr mount).
- */
-int
-ncl_sig_pending(sigset_t set)
-{
-	int i;
-	
-	for (i = 0 ; i < sizeof(nfs_sig_set)/sizeof(int) ; i++)
-		if (SIGISMEMBER(set, nfs_sig_set[i]))
-			return (1);
-	return (0);
-}
-#endif
- 
-/*
- * The set/restore sigmask functions are used to (temporarily) overwrite
- * the process p_sigmask during an RPC call (for example). These are also
- * used in other places in the NFS client that might tsleep().
- */
-static void
-ncl_set_sigmask(struct thread *td, sigset_t *oldset)
-{
-	sigset_t newset;
-	int i;
-	struct proc *p;
-	
-	SIGFILLSET(newset);
-	if (td == NULL)
-		td = curthread; /* XXX */
-	p = td->td_proc;
-	/* Remove the NFS set of signals from newset */
-	PROC_LOCK(p);
-	mtx_lock(&p->p_sigacts->ps_mtx);
-	for (i = 0 ; i < sizeof(nfs_sig_set)/sizeof(int) ; i++) {
-		/*
-		 * But make sure we leave the ones already masked
-		 * by the process, ie. remove the signal from the
-		 * temporary signalmask only if it wasn't already
-		 * in p_sigmask.
-		 */
-		if (!SIGISMEMBER(td->td_sigmask, nfs_sig_set[i]) &&
-		    !SIGISMEMBER(p->p_sigacts->ps_sigignore, nfs_sig_set[i]))
-			SIGDELSET(newset, nfs_sig_set[i]);
-	}
-	mtx_unlock(&p->p_sigacts->ps_mtx);
-	PROC_UNLOCK(p);
-	kern_sigprocmask(td, SIG_SETMASK, &newset, oldset, 0);
-}
-
-static void
-ncl_restore_sigmask(struct thread *td, sigset_t *set)
-{
-	if (td == NULL)
-		td = curthread; /* XXX */
-	kern_sigprocmask(td, SIG_SETMASK, set, NULL, 0);
-}
-
-/*
- * NFS wrapper to msleep(), that shoves a new p_sigmask and restores the
- * old one after msleep() returns.
- */
-int
-ncl_msleep(struct thread *td, void *ident, struct mtx *mtx, int priority, char *wmesg, int timo)
-{
-	sigset_t oldset;
-	int error;
-	struct proc *p;
-	
-	if ((priority & PCATCH) == 0)
-		return msleep(ident, mtx, priority, wmesg, timo);
-	if (td == NULL)
-		td = curthread; /* XXX */
-	ncl_set_sigmask(td, &oldset);
-	error = msleep(ident, mtx, priority, wmesg, timo);
-	ncl_restore_sigmask(td, &oldset);
-	p = td->td_proc;
-	return (error);
-}
-
-/*
  * Vnode op for VM getpages.
  */
 int
@@ -1356,9 +1261,9 @@ nfs_getcacheblk(struct vnode *vp, daddr_
 	if (nmp->nm_flag & NFSMNT_INT) {
  		sigset_t oldset;
 
- 		ncl_set_sigmask(td, &oldset);
+ 		newnfs_set_sigmask(td, &oldset);
 		bp = getblk(vp, bn, size, NFS_PCATCH, 0, 0);
- 		ncl_restore_sigmask(td, &oldset);
+ 		newnfs_restore_sigmask(td, &oldset);
 		while (bp == NULL) {
 			if (newnfs_sigintr(nmp, td))
 				return (NULL);
@@ -1544,9 +1449,9 @@ again:
 			NFS_DPF(ASYNCIO,
 				("ncl_asyncio: waiting for mount %p queue to drain\n", nmp));
 			nmp->nm_bufqwant = TRUE;
- 			error = ncl_msleep(td, &nmp->nm_bufq, &ncl_iod_mutex, 
-					   slpflag | PRIBIO,
- 					   "nfsaio", slptimeo);
+ 			error = newnfs_msleep(td, &nmp->nm_bufq, 
+			    &ncl_iod_mutex, slpflag | PRIBIO, "nfsaio",
+  			   slptimeo);
 			if (error) {
 				error2 = newnfs_sigintr(nmp, td);
 				if (error2) {

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c	Sat Dec 26 19:03:28 2009	(r201028)
+++ head/sys/fs/nfsclient/nfs_clvnops.c	Sat Dec 26 19:15:15 2009	(r201029)
@@ -2708,9 +2708,9 @@ loop:
 		mtx_lock(&np->n_mtx);
 		while (np->n_directio_asyncwr > 0) {
 			np->n_flag |= NFSYNCWAIT;
-			error = ncl_msleep(td, (caddr_t)&np->n_directio_asyncwr,
-					   &np->n_mtx, slpflag | (PRIBIO + 1), 
-					   "nfsfsync", 0);
+			error = newnfs_msleep(td, &np->n_directio_asyncwr,
+			    &np->n_mtx, slpflag | (PRIBIO + 1), 
+			    "nfsfsync", 0);
 			if (error) {
 				if (newnfs_sigintr(nmp, td)) {
 					mtx_unlock(&np->n_mtx);

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 20:44:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ED6C7106566C;
	Sat, 26 Dec 2009 20:44:28 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194])
	by mx1.freebsd.org (Postfix) with ESMTP id 562508FC12;
	Sat, 26 Dec 2009 20:44:27 +0000 (UTC)
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id nBQKiORt076828
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 26 Dec 2009 22:44:24 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	nBQKiOh3039795; Sat, 26 Dec 2009 22:44:24 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id nBQKiORt039794; 
	Sat, 26 Dec 2009 22:44:24 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Sat, 26 Dec 2009 22:44:24 +0200
From: Kostik Belousov 
To: Joseph Koshy 
Message-ID: <20091226204424.GE2170@deviant.kiev.zoral.com.ua>
References: <200912261358.nBQDwqq4011999@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="iRaAnoDFBoP0sW/E"
Content-Disposition: inline
In-Reply-To: <200912261358.nBQDwqq4011999@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r201021 - in head/sys: dev/hwpmc sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 20:44:29 -0000


--iRaAnoDFBoP0sW/E
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> +		freepath = NULL;
> +		pmc_getfilename(vp, &fullpath, &freepath);
> +		last_vp = vp;
> +		vrele(vp);
> +		vp = NULL;

You should do VFS_LOCK_GIANT/VFS_UNLOCK_GIANT around vrele(), since
vrele() may need to acquire vnode lock and inactivate the vnode.

--iRaAnoDFBoP0sW/E
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAks2dacACgkQC3+MBN1Mb4hgjgCfYCoG+4+KFcOv8ztmPEFJ/4b5
kH4Anjxf5VPh5wfio4NwnArkLxfk/AAB
=xdWD
-----END PGP SIGNATURE-----

--iRaAnoDFBoP0sW/E--

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 21:27:51 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 71EE71065676;
	Sat, 26 Dec 2009 21:27:51 +0000 (UTC)
	(envelope-from maxim@macomnet.ru)
Received: from mp2.macomnet.net (cl-2958.ham-01.de.sixxs.net
	[IPv6:2001:6f8:900:b8d::2])
	by mx1.freebsd.org (Postfix) with ESMTP id EF2D38FC17;
	Sat, 26 Dec 2009 21:27:50 +0000 (UTC)
Received: from localhost (maxim@localhost [127.0.0.1])
	by mp2.macomnet.net (8.14.3/8.14.3) with ESMTP id nBQLRk3v020840;
	Sun, 27 Dec 2009 00:27:46 +0300 (MSK)
	(envelope-from maxim@macomnet.ru)
Date: Sun, 27 Dec 2009 00:27:46 +0300 (MSK)
From: Maxim Konovalov 
To: Doug Barton 
In-Reply-To: <4A9E8C50.5010402@FreeBSD.org>
Message-ID: <20091227002631.K58324@mp2.macomnet.net>
References: <200909010555.n815tAkx050140@svn.freebsd.org>
	<4A9D4A90.30700@FreeBSD.org>
	<20090902092054.Q27429@mp2.macomnet.net> <4A9E7718.1080503@andric.com>
	<4A9E8C50.5010402@FreeBSD.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Cc: svn-src-head@FreeBSD.ORG, Dimitry Andric ,
	src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG
Subject: Re: svn commit: r196727 - head/share/man/man5
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 21:27:51 -0000

On Wed, 2 Sep 2009, 08:16-0700, Doug Barton wrote:

> Dimitry Andric wrote:
> > On 2009-09-02 07:21, Maxim Konovalov wrote:
> >>> Unless I'm missing something this should be in the src.conf man page
> >>> instead of make.conf.
> >> Please explain why.
> >
> > make.conf(5):
> >      The file make.conf contains system-wide settings that will apply to every
> >      build using make(1) and the standard sys.mk file.
> >
> > src.conf(5):
> >      The src.conf file contains settings that will apply to every build
> >      involving the FreeBSD source tree; see build(7).
> >
> > The MALLOC_PRODUCTION define is used inside the FreeBSD source tree
> > (actually only in jemalloc, it seems).
> >
> > You most likely don't want it to apply 'globally', since third-party
> > programs (e.g. ports) might give a totally different meaning to this
> > define -- or most likely: no meaning at all. :)
>
> That's correct.
>
> Maxim, I forgot to include the pointer to src/tools/build/options in
> my previous mail, so there you go. :)
>
It seems makeman there does not work with anything but WITH_* and
WITHOUT_* options.

-- 
Maxim Konovalov

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 22:06:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C54F106568F;
	Sat, 26 Dec 2009 22:06:56 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B40A8FC19;
	Sat, 26 Dec 2009 22:06:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQM6tRc022428;
	Sat, 26 Dec 2009 22:06:55 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQM6tP6022426;
	Sat, 26 Dec 2009 22:06:55 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200912262206.nBQM6tP6022426@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 26 Dec 2009 22:06:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201031 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 22:06:56 -0000

Author: marcel
Date: Sat Dec 26 22:06:55 2009
New Revision: 201031
URL: http://svn.freebsd.org/changeset/base/201031

Log:
  SYnc with amd64:
  De-support adv_isa.c and aic_isa.c

Modified:
  head/sys/conf/files.ia64

Modified: head/sys/conf/files.ia64
==============================================================================
--- head/sys/conf/files.ia64	Sat Dec 26 20:52:47 2009	(r201030)
+++ head/sys/conf/files.ia64	Sat Dec 26 22:06:55 2009	(r201031)
@@ -45,8 +45,6 @@ contrib/ia64/libuwx/src/uwx_uinfo.c		sta
 contrib/ia64/libuwx/src/uwx_utable.c		standard
 crypto/blowfish/bf_enc.c	optional	crypto | ipsec
 crypto/des/des_enc.c		optional	crypto | ipsec | netsmb
-dev/advansys/adv_isa.c		optional	adv isa
-dev/aic/aic_isa.c		optional	aic isa
 dev/atkbdc/atkbd.c		optional	atkbd atkbdc
 dev/atkbdc/atkbd_atkbdc.c	optional	atkbd atkbdc
 dev/atkbdc/atkbdc.c		optional	atkbdc

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 22:22:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5AFB7106568B;
	Sat, 26 Dec 2009 22:22:10 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 309DB8FC19;
	Sat, 26 Dec 2009 22:22:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQMMA2H022783;
	Sat, 26 Dec 2009 22:22:10 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQMMA0S022781;
	Sat, 26 Dec 2009 22:22:10 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200912262222.nBQMMA0S022781@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 26 Dec 2009 22:22:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201032 - head/sys/ia64/include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 22:22:10 -0000

Author: marcel
Date: Sat Dec 26 22:22:09 2009
New Revision: 201032
URL: http://svn.freebsd.org/changeset/base/201032

Log:
  Use unordered memory loads and stores for the in* and out*
  family of functions.

Modified:
  head/sys/ia64/include/cpufunc.h

Modified: head/sys/ia64/include/cpufunc.h
==============================================================================
--- head/sys/ia64/include/cpufunc.h	Sat Dec 26 22:06:55 2009	(r201031)
+++ head/sys/ia64/include/cpufunc.h	Sat Dec 26 22:22:09 2009	(r201032)
@@ -64,11 +64,10 @@ extern void *ia64_ioport_address(u_int);
 static __inline uint8_t
 inb(unsigned int port)
 {
-	__volatile uint8_t *p;
 	uint8_t v;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	v = *p;
+	v = ia64_ld1(__PIO_ADDR(port));
 	ia64_mf_a();
 	ia64_mf();
 	return (v);
@@ -77,11 +76,10 @@ inb(unsigned int port)
 static __inline uint16_t
 inw(unsigned int port)
 {
-	__volatile uint16_t *p;
 	uint16_t v;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	v = *p;
+	v = ia64_ld2(__PIO_ADDR(port));
 	ia64_mf_a();
 	ia64_mf();
 	return (v);
@@ -90,11 +88,10 @@ inw(unsigned int port)
 static __inline uint32_t
 inl(unsigned int port)
 {
-	volatile uint32_t *p;
 	uint32_t v;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	v = *p;
+	v = ia64_ld4(__PIO_ADDR(port));
 	ia64_mf_a();
 	ia64_mf();
 	return (v);
@@ -127,10 +124,9 @@ insl(unsigned int port, void *addr, size
 static __inline void
 outb(unsigned int port, uint8_t data)
 {
-	volatile uint8_t *p;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	*p = data;
+	ia64_st1(__PIO_ADDR(port), data);
 	ia64_mf_a();
 	ia64_mf();
 }
@@ -138,10 +134,9 @@ outb(unsigned int port, uint8_t data)
 static __inline void
 outw(unsigned int port, uint16_t data)
 {
-	volatile uint16_t *p;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	*p = data;
+	ia64_st2(__PIO_ADDR(port), data);
 	ia64_mf_a();
 	ia64_mf();
 }
@@ -149,10 +144,9 @@ outw(unsigned int port, uint16_t data)
 static __inline void
 outl(unsigned int port, uint32_t data)
 {
-	volatile uint32_t *p;
-	p = __PIO_ADDR(port);
+
 	ia64_mf();
-	*p = data;
+	ia64_st4(__PIO_ADDR(port), data);
 	ia64_mf_a();
 	ia64_mf();
 }

From owner-svn-src-head@FreeBSD.ORG  Sat Dec 26 22:36:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2038D1065693;
	Sat, 26 Dec 2009 22:36:06 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D42D8FC15;
	Sat, 26 Dec 2009 22:36:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBQMa5AR023143;
	Sat, 26 Dec 2009 22:36:05 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBQMa5rO023136;
	Sat, 26 Dec 2009 22:36:05 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200912262236.nBQMa5rO023136@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 26 Dec 2009 22:36:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r201033 - in head: lib/libpam/modules/pam_lastlog
	lib/libulog usr.bin/who usr.sbin/lastlogin
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 26 Dec 2009 22:36:06 -0000

Author: ed
Date: Sat Dec 26 22:36:05 2009
New Revision: 201033
URL: http://svn.freebsd.org/changeset/base/201033

Log:
  Several refinements to libulog's API.
  
  - Only set the fields in the ulog_utmpx structure that are valid for the
    command in question. This means that strings like "shutdown" or "~"
    are not visible to the user anymore.
  - Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
    the `antique' filename. If we ever get rid of utmp, it makes little
    sense calling it by its old name.

Modified:
  head/lib/libpam/modules/pam_lastlog/pam_lastlog.c
  head/lib/libulog/ulog.h
  head/lib/libulog/ulog_getutxent.c
  head/lib/libulog/ulog_setutxfile.3
  head/usr.bin/who/who.c
  head/usr.sbin/lastlogin/lastlogin.c

Modified: head/lib/libpam/modules/pam_lastlog/pam_lastlog.c
==============================================================================
--- head/lib/libpam/modules/pam_lastlog/pam_lastlog.c	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/lib/libpam/modules/pam_lastlog/pam_lastlog.c	Sat Dec 26 22:36:05 2009	(r201033)
@@ -91,7 +91,7 @@ pam_sm_open_session(pam_handle_t *pamh, 
 	}
 
 	if ((flags & PAM_SILENT) == 0) {
-		if (ulog_setutxfile(UTXF_LASTLOG, NULL) != 0) {
+		if (ulog_setutxfile(UTXI_USER, NULL) != 0) {
 			PAM_LOG("Failed to open lastlog database");
 		} else {
 			utx = ulog_getutxuser(user);

Modified: head/lib/libulog/ulog.h
==============================================================================
--- head/lib/libulog/ulog.h	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/lib/libulog/ulog.h	Sat Dec 26 22:36:05 2009	(r201033)
@@ -85,9 +85,9 @@ void	ulog_setutxent(void);
 /* Extensions. */
 struct ulog_utmpx *ulog_getutxuser(const char *);
 int	ulog_setutxfile(int, const char *);
-#define	UTXF_UTMP	0
-#define	UTXF_WTMP	1
-#define	UTXF_LASTLOG	2
+#define	UTXI_TTY	0
+#define	UTXI_TIME	1
+#define	UTXI_USER	2
 
 /* Login/logout utility functions. */
 void	ulog_login(const char *, const char *, const char *);

Modified: head/lib/libulog/ulog_getutxent.c
==============================================================================
--- head/lib/libulog/ulog_getutxent.c	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/lib/libulog/ulog_getutxent.c	Sat Dec 26 22:36:05 2009	(r201033)
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
 #include "ulog_internal.h"
 
 static FILE *ufile;
-static int ufiletype = -1;
+static int ufileindex = -1;
 
 void
 ulog_endutxent(void)
@@ -61,11 +61,8 @@ ulog_futmp_to_utmpx(const struct futmp *
 	strncpy(utx->ut_ ## field, ut->ut_ ## field,			\
 	    MIN(sizeof utx->ut_ ## field - 1, sizeof ut->ut_ ## field));\
 } while (0)
-	COPY_STRING(user);
-	COPY_STRING(line);
-	COPY_STRING(host);
-#undef COPY_STRING
-#define	MATCH(field, value)	(strcmp(utx->ut_ ## field, (value)) == 0)
+#define	MATCH(field, value)	(strncmp(ut->ut_ ## field, (value), \
+					sizeof(ut->ut_ ## field)) == 0)
 	if (MATCH(user, "reboot") && MATCH(line, "~"))
 		utx->ut_type = BOOT_TIME;
 	else if (MATCH(user, "date") && MATCH(line, "|"))
@@ -74,12 +71,23 @@ ulog_futmp_to_utmpx(const struct futmp *
 		utx->ut_type = NEW_TIME;
 	else if (MATCH(user, "shutdown") && MATCH(line, "~"))
 		utx->ut_type = SHUTDOWN_TIME;
-	else if (MATCH(user, "") && MATCH(host, ""))
+	else if (MATCH(user, "") && MATCH(host, "")) {
 		utx->ut_type = DEAD_PROCESS;
-	else if (!MATCH(user, "") && !MATCH(line, "") && ut->ut_time != 0)
+		/* XXX: ut_id and ut_pid missing. ut_line not needed. */
+		COPY_STRING(line);
+	} else if (!MATCH(user, "") && !MATCH(line, "") && ut->ut_time != 0) {
 		utx->ut_type = USER_PROCESS;
-	else
+		/* XXX: ut_id and ut_pid missing. */
+		COPY_STRING(user);
+		COPY_STRING(line);
+		COPY_STRING(host);
+	} else {
+		/* Only set ut_type for EMPTY. */
 		utx->ut_type = EMPTY;
+		return;
+	}
+#undef COPY_STRING
+#undef MATCH
 	utx->ut_tv.tv_sec = _time32_to_time(ut->ut_time);
 	utx->ut_tv.tv_usec = 0;
 }
@@ -93,13 +101,20 @@ ulog_flastlog_to_utmpx(const struct flas
 	strncpy(utx->ut_ ## field, ll->ll_ ## field,			\
 	    MIN(sizeof utx->ut_ ## field - 1, sizeof ll->ll_ ## field));\
 } while (0)
-	COPY_STRING(line);
-	COPY_STRING(host);
-#undef COPY_STRING
-	if (!MATCH(line, "") && ll->ll_time != 0)
+#define	MATCH(field, value)	(strncmp(ll->ll_ ## field, (value), \
+					sizeof(ll->ll_ ## field)) == 0)
+	if (!MATCH(line, "") && ll->ll_time != 0) {
 		utx->ut_type = USER_PROCESS;
-	else
+		/* XXX: ut_id and ut_pid missing. */
+		COPY_STRING(line);
+		COPY_STRING(host);
+	} else {
+		/* Only set ut_type for EMPTY. */
 		utx->ut_type = EMPTY;
+		return;
+	}
+#undef COPY_STRING
+#undef MATCH
 	utx->ut_tv.tv_sec = _time32_to_time(ll->ll_time);
 	utx->ut_tv.tv_usec = 0;
 }
@@ -112,7 +127,7 @@ static inline off_t
 ulog_tell(void)
 {
 
-	if (ufiletype == UTXF_LASTLOG)
+	if (ufileindex == UTXI_USER)
 		return (ftello(ufile) / sizeof(struct flastlog));
 	else
 		return (ftello(ufile) / sizeof(struct futmp));
@@ -132,7 +147,7 @@ ulog_read(off_t off, int whence, int res
 	if (whence == SEEK_SET && ulog_tell() > off)
 		return (NULL);
 
-	if (ufiletype == UTXF_LASTLOG) {
+	if (ufileindex == UTXI_USER) {
 		struct flastlog ll;
 		struct passwd *pw = NULL;
 		uid_t uid;
@@ -192,7 +207,7 @@ ulog_getutxline(const struct ulog_utmpx 
 	if (ufile == NULL)
 		return (NULL);
 
-	if (ufiletype == UTXF_UTMP) {
+	if (ufileindex == UTXI_TTY) {
 		unsigned int slot;
 
 		slot = ulog_ttyslot(line->ut_line);
@@ -228,7 +243,7 @@ ulog_getutxuser(const char *user)
 {
 	struct ulog_utmpx *utx;
 
-	if (ufiletype == UTXF_LASTLOG) {
+	if (ufileindex == UTXI_USER) {
 		struct passwd *pw;
 
 		pw = getpwnam(user);
@@ -258,20 +273,20 @@ ulog_getutxuser(const char *user)
  */
 
 int
-ulog_setutxfile(int type, const char *file)
+ulog_setutxfile(int uidx, const char *file)
 {
 
 	/* Supply default files. */
-	switch (type) {
-	case UTXF_UTMP:
+	switch (uidx) {
+	case UTXI_TTY:
 		if (file == NULL)
 			file = _PATH_UTMP;
 		break;
-	case UTXF_WTMP:
+	case UTXI_TIME:
 		if (file == NULL)
 			file = _PATH_WTMP;
 		break;
-	case UTXF_LASTLOG:
+	case UTXI_USER:
 		if (file == NULL)
 			file = _PATH_LASTLOG;
 		break;
@@ -282,7 +297,7 @@ ulog_setutxfile(int type, const char *fi
 	if (ufile != NULL)
 		fclose(ufile);
 	ufile = fopen(file, "r");
-	ufiletype = type;
+	ufileindex = uidx;
 	if (ufile == NULL)
 		return (-1);
 	return (0);
@@ -298,5 +313,5 @@ void
 ulog_setutxent(void)
 {
 
-	ulog_setutxfile(UTXF_UTMP, NULL);
+	ulog_setutxfile(UTXI_TTY, NULL);
 }

Modified: head/lib/libulog/ulog_setutxfile.3
==============================================================================
--- head/lib/libulog/ulog_setutxfile.3	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/lib/libulog/ulog_setutxfile.3	Sat Dec 26 22:36:05 2009	(r201033)
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .In ulog.h
 .Ft int
-.Fn ulog_setutxfile "int type" "const char *file"
+.Fn ulog_setutxfile "int index" "const char *file"
 .Ft struct ulog_utmpx *
 .Fn ulog_getutxuser "const char *user"
 .Sh DESCRIPTION
@@ -54,17 +54,17 @@ function is similar to
 .Fn ulog_setutxent ,
 but is capable of returning an error code and also gives access to other
 login record files by using one of the following values for
-.Fa type :
-.Bl -tag -width UTXF_LASTLOG
-.It Dv UTXF_UTMP
+.Fa index :
+.Bl -tag -width UTXI_TIME
+.It Dv UTXI_TTY
 Open the default
 .Nm utmp
 file, which is indexed by TTY device.
-.It Dv UTXF_WTMP
+.It Dv UTXI_TIME
 Open the
 .Nm wtmp
 file, which is indexed by time.
-.It Dv UTXF_LASTLOG
+.It Dv UTXI_USER
 Open the
 .Nm lastlog
 file, which is indexed by user ID.
@@ -73,7 +73,7 @@ file, which is indexed by user ID.
 The
 .Fa file
 argument determines the file to be opened.
-If left null, implementation-defined default file is opened.
+If left null, an implementation-defined default file is opened.
 .Pp
 The
 .Fn ulog_getutxuser

Modified: head/usr.bin/who/who.c
==============================================================================
--- head/usr.bin/who/who.c	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/usr.bin/who/who.c	Sat Dec 26 22:36:05 2009	(r201033)
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
 		usage();
 
 	if (*argv != NULL) {
-		if (ulog_setutxfile(UTXF_UTMP, *argv) != 0)
+		if (ulog_setutxfile(UTXI_TTY, *argv) != 0)
 			err(1, "%s", *argv);
 	}
 

Modified: head/usr.sbin/lastlogin/lastlogin.c
==============================================================================
--- head/usr.sbin/lastlogin/lastlogin.c	Sat Dec 26 22:22:09 2009	(r201032)
+++ head/usr.sbin/lastlogin/lastlogin.c	Sat Dec 26 22:36:05 2009	(r201033)
@@ -60,7 +60,7 @@ main(argc, argv)
 		usage();
 	}
 
-	if (ulog_setutxfile(UTXF_LASTLOG, NULL) != 0)
+	if (ulog_setutxfile(UTXI_USER, NULL) != 0)
 		errx(1, "failed to open lastlog database");
 
 	setpassent(1);	/* Keep passwd file pointers open */