From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 00:12:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACE1D1065670; Sun, 25 Oct 2009 00:12:39 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 238B88FC08; Sun, 25 Oct 2009 00:12:38 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c122-106-233-13.belrs3.nsw.optusnet.com.au [122.106.233.13]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n9P0CarC025885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Oct 2009 11:12:37 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n9P0CVRC018922; Sun, 25 Oct 2009 11:12:31 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n9P0CVlP018908; Sun, 25 Oct 2009 11:12:31 +1100 (EST) (envelope-from peter) Date: Sun, 25 Oct 2009 11:12:31 +1100 From: Peter Jeremy To: Alexander Kabaev Message-ID: <20091025001231.GA1817@server.vk2pj.dyndns.org> References: <200910201905.n9KJ5hPe075884@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline In-Reply-To: <200910201905.n9KJ5hPe075884@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r198304 - in stable/8/lib/libc: . gen stdio stdtime string sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 00:12:39 -0000 --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-Oct-20 19:05:43 +0000, Alexander Kabaev wrote: > Make libc.a provide __stack_chk_fail_local weak alias. This is > needed to satisfy static libraries that are compiled with -fpic > and linked into static binary afterwards. Several libraries in > gcc are examples of such static libs. bin/139052 discusses a related problem not addressed by r197277. Any chance of looking into that? --=20 Peter Jeremy --PNTmBPCT7hxwcZjr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iEYEARECAAYFAkrjl+8ACgkQ/opHv/APuIcCAgCgoGsUwwZ+6/ENgZLM1QUjhAsM mkUAoIX29qTq+sLRlwpUjvbaSCOt2xcc =Om1V -----END PGP SIGNATURE----- --PNTmBPCT7hxwcZjr-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 00:28:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3038106566C; Sun, 25 Oct 2009 00:28:01 +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 A81B58FC15; Sun, 25 Oct 2009 00:28: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 n9P0S1BU020289; Sun, 25 Oct 2009 00:28:01 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P0S1CJ020287; Sun, 25 Oct 2009 00:28:01 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200910250028.n9P0S1CJ020287@svn.freebsd.org> From: Ken Smith Date: Sun, 25 Oct 2009 00:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198456 - stable/8/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 00:28:02 -0000 Author: kensmith Date: Sun Oct 25 00:28:01 2009 New Revision: 198456 URL: http://svn.freebsd.org/changeset/base/198456 Log: Prepare for 8.0-RC2 builds. Approved by: re (implicit) Modified: stable/8/sys/conf/newvers.sh Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Sun Oct 25 00:26:24 2009 (r198455) +++ stable/8/sys/conf/newvers.sh Sun Oct 25 00:28:01 2009 (r198456) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.0" -BRANCH="RC1" +BRANCH="RC2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 01:10:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A4EA10656C8; Sun, 25 Oct 2009 01:10:30 +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 202178FC0C; Sun, 25 Oct 2009 01:10: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 n9P1AUYw022332; Sun, 25 Oct 2009 01:10:30 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P1AU5W022331; Sun, 25 Oct 2009 01:10:30 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200910250110.n9P1AU5W022331@svn.freebsd.org> From: Ken Smith Date: Sun, 25 Oct 2009 01:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198460 - releng/8.0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 01:10:30 -0000 Author: kensmith Date: Sun Oct 25 01:10:29 2009 New Revision: 198460 URL: http://svn.freebsd.org/changeset/base/198460 Log: Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure. Approved by: re (implicit) Added: releng/8.0/ (props changed) - copied from r198459, stable/8/ From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 02:48:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F604106566B; Sun, 25 Oct 2009 02:48:29 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E6EA8FC12; Sun, 25 Oct 2009 02:48: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 n9P2mTFc027746; Sun, 25 Oct 2009 02:48:29 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P2mT9i027744; Sun, 25 Oct 2009 02:48:29 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200910250248.n9P2mT9i027744@svn.freebsd.org> From: Alan Cox Date: Sun, 25 Oct 2009 02:48: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: r198463 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 02:48:29 -0000 Author: alc Date: Sun Oct 25 02:48:29 2009 New Revision: 198463 URL: http://svn.freebsd.org/changeset/base/198463 Log: Update a comment to reflect the previous change. Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Sun Oct 25 01:19:55 2009 (r198462) +++ head/sys/kern/sys_process.c Sun Oct 25 02:48:29 2009 (r198463) @@ -279,7 +279,7 @@ proc_rwmem(struct proc *p, struct uio *u } /* - * Now we need to get the page. out_entry, out_prot, wired, + * Now we need to get the page. out_entry, wired, * and single_use aren't used. One would think the vm code * would be a *bit* nicer... We use tmap because * vm_map_lookup() can change the map argument. From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 02:53:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12C1F106566B; Sun, 25 Oct 2009 02:53:16 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qy0-f176.google.com (mail-qy0-f176.google.com [209.85.221.176]) by mx1.freebsd.org (Postfix) with ESMTP id 77BDA8FC17; Sun, 25 Oct 2009 02:53:15 +0000 (UTC) Received: by qyk6 with SMTP id 6so4418179qyk.3 for ; Sat, 24 Oct 2009 19:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=1RA/439RJPc429P/vSEgOobHciy6omycPk/yUB+kFcw=; b=ZBwvhAiz9R8bhzmM1Hig7EpGxxP+OnzbQ4tkIGzSSAZcIqXYwOTt0jApDKw6fg4C/F eEArltCRyx7icG6eT6EfXU/Iy7nMMFRIPiUBd2O73n8F2kaMpFu/a1O1kSB0hO+fB1QP hpMQ2NuluGfJD2RiIilLiH2eLqmVIYizb9m/w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=r8abgJx/wT6h9tDtjsNk5MW6DeJPOJkcl2uDkkDhiIdediB6D49lpaXqfc3HnqN+Ew DIbZ2AJE68DgnVCNu1hHqJKAVl8BrhT5KcLSakGI6fjNfho3leT/zKi8bZveMvdXj7iq SA51UDAKopYIM3AFnaikaReHWBiA95Z9RiDS4= Received: by 10.224.110.65 with SMTP id m1mr6438979qap.225.1256437447557; Sat, 24 Oct 2009 19:24:07 -0700 (PDT) Received: from kan.dnsalias.net (c-24-91-218-112.hsd1.ma.comcast.net [24.91.218.112]) by mx.google.com with ESMTPS id 6sm6265970qwk.44.2009.10.24.19.24.06 (version=SSLv3 cipher=RC4-MD5); Sat, 24 Oct 2009 19:24:06 -0700 (PDT) Date: Sat, 24 Oct 2009 22:24:00 -0400 From: Alexander Kabaev To: Peter Jeremy Message-ID: <20091024222400.6575c6f6@kan.dnsalias.net> In-Reply-To: <20091025001231.GA1817@server.vk2pj.dyndns.org> References: <200910201905.n9KJ5hPe075884@svn.freebsd.org> <20091025001231.GA1817@server.vk2pj.dyndns.org> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.6; amd64-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/88nP58oMYfOLq1VZXABL6ZY"; protocol="application/pgp-signature" Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r198304 - in stable/8/lib/libc: . gen stdio stdtime string sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 02:53:16 -0000 --Sig_/88nP58oMYfOLq1VZXABL6ZY Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sun, 25 Oct 2009 11:12:31 +1100 Peter Jeremy wrote: > On 2009-Oct-20 19:05:43 +0000, Alexander Kabaev > wrote: > > Make libc.a provide __stack_chk_fail_local weak alias. This is > > needed to satisfy static libraries that are compiled with -fpic > > and linked into static binary afterwards. Several libraries in > > gcc are examples of such static libs. >=20 > bin/139052 discusses a related problem not addressed by r197277. > Any chance of looking into that? >=20 > --=20 > Peter Jeremy You are linking in a library compiled with -fstack-protector (libgcov) and do not pass -fstack-protector when running gcc with -fprofile-generator. Consequently, gcc does not link in necessary libssp_nonshared.a. Either you use stack protections or you do not. Please choose. --=20 Alexander Kabaev --Sig_/88nP58oMYfOLq1VZXABL6ZY Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iD8DBQFK47bFQ6z1jMm+XZYRAgKSAJ9MZvvkC1b+/zIcq+lIowx9QvD8yQCeNw06 LM+R90brsp3zglQxbhJv7uM= =EBAD -----END PGP SIGNATURE----- --Sig_/88nP58oMYfOLq1VZXABL6ZY-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 04:34:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C7E1106566B; Sun, 25 Oct 2009 04:34:48 +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 3BEE88FC12; Sun, 25 Oct 2009 04:34: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 n9P4Yl1k041031; Sun, 25 Oct 2009 04:34:47 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P4YlhC041029; Sun, 25 Oct 2009 04:34:47 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200910250434.n9P4YlhC041029@svn.freebsd.org> From: Joseph Koshy Date: Sun, 25 Oct 2009 04:34: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: r198464 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 04:34:48 -0000 Author: jkoshy Date: Sun Oct 25 04:34:47 2009 New Revision: 198464 URL: http://svn.freebsd.org/changeset/base/198464 Log: Inform hwpmc(4) of a thread's impending demise prior to invoking sched_throw(). Debugging help: fabient Review and testing by: fabient Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Oct 25 02:48:29 2009 (r198463) +++ head/sys/kern/kern_thread.c Sun Oct 25 04:34:47 2009 (r198464) @@ -27,6 +27,7 @@ */ #include "opt_witness.h" +#include "opt_hwpmc_hooks.h" #include __FBSDID("$FreeBSD$"); @@ -47,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef HWPMC_HOOKS +#include +#endif #include @@ -417,6 +421,14 @@ thread_exit(void) panic ("thread_exit: Last thread exiting on its own"); } } +#ifdef HWPMC_HOOKS + /* + * If this thread is part of a process that is being tracked by hwpmc(4), + * inform the module of the thread's impending exit. + */ + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); +#endif PROC_UNLOCK(p); thread_lock(td); /* Save our tick information with both the thread and proc locked */ From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 07:27:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A2261065670; Sun, 25 Oct 2009 07:27:40 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 768C78FC15; Sun, 25 Oct 2009 07:27:40 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c122-106-233-13.belrs3.nsw.optusnet.com.au [122.106.233.13]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n9P7RZvO022143 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 25 Oct 2009 18:27:35 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n9P7RXno001952; Sun, 25 Oct 2009 18:27:33 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n9P7RXCK001951; Sun, 25 Oct 2009 18:27:33 +1100 (EST) (envelope-from peter) Date: Sun, 25 Oct 2009 18:27:33 +1100 From: Peter Jeremy To: Alexander Kabaev Message-ID: <20091025072732.GA1898@server.vk2pj.dyndns.org> References: <200910201905.n9KJ5hPe075884@svn.freebsd.org> <20091025001231.GA1817@server.vk2pj.dyndns.org> <20091024222400.6575c6f6@kan.dnsalias.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20091024222400.6575c6f6@kan.dnsalias.net> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r198304 - in stable/8/lib/libc: . gen stdio stdtime string sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 07:27:41 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2009-Oct-24 22:24:00 -0400, Alexander Kabaev wrote: >> bin/139052 discusses a related problem not addressed by r197277. >> Any chance of looking into that? > >You are linking in a library compiled with -fstack-protector >(libgcov) and do not pass -fstack-protector when running gcc with >-fprofile-generator. Consequently, gcc does not link in necessary >libssp_nonshared.a. Well, that explains what is broken. >Either you use stack protections or you do not. Please choose. I haven't specified to use stack protection _anywhere_. The system defaults appear to have been changed so that libgcov is (by default) built with stack protection enabled but gcc doesn't build with stack protection enabled by default, leading to the breakage I reported. This is a POLA violation at best and isn't documented anywhere. If world is going to be built with stack protection on by default then the gcc defaults need to be adjusted to suit. I bumped into this bug whilst trying to build multimedia/x264 with PGO enabled. I'm sure I'm not the only person who is going to get bitten. --=20 Peter Jeremy --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.13 (FreeBSD) iEYEARECAAYFAkrj/eQACgkQ/opHv/APuIfskACbBAmE97dhPBgm9wPoUES4BTk4 HmgAnR2CPkU3YL+pybd7tMgrQTxi4kCm =4g2V -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU-- From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 09:48:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FAB3106566B; Sun, 25 Oct 2009 09:48:22 +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 8EA4E8FC08; Sun, 25 Oct 2009 09:48: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 n9P9mMBi053462; Sun, 25 Oct 2009 09:48:22 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P9mMxo053461; Sun, 25 Oct 2009 09:48:22 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200910250948.n9P9mMxo053461@svn.freebsd.org> From: Rui Paulo Date: Sun, 25 Oct 2009 09:48: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: r198466 - head/sys/tools X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 09:48:22 -0000 Author: rpaulo Date: Sun Oct 25 09:48:21 2009 New Revision: 198466 URL: http://svn.freebsd.org/changeset/base/198466 Log: Output a comment on top of each generated file explaining where it came from. Modified: head/sys/tools/fw_stub.awk Modified: head/sys/tools/fw_stub.awk ============================================================================== --- head/sys/tools/fw_stub.awk Sun Oct 25 08:43:38 2009 (r198465) +++ head/sys/tools/fw_stub.awk Sun Oct 25 09:48:21 2009 (r198466) @@ -121,7 +121,11 @@ ctmpfilename = cfilename ".tmp"; modname = opt_m; gsub(/[-\.]/, "_", modname); -printc("#include \ +printc("/*\ + * Automatically generated by:\ + * $FreeBSD$\ + */\ +#include \ #include \ #include \ #include \ From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 09:58:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 908C4106566B; Sun, 25 Oct 2009 09:58:56 +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 7F7148FC13; Sun, 25 Oct 2009 09:58: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 n9P9wuvG053678; Sun, 25 Oct 2009 09:58:56 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9P9wuoP053676; Sun, 25 Oct 2009 09:58:56 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200910250958.n9P9wuoP053676@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 25 Oct 2009 09:58: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: r198467 - head/sys/compat/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 09:58:56 -0000 Author: bz Date: Sun Oct 25 09:58:56 2009 New Revision: 198467 URL: http://svn.freebsd.org/changeset/base/198467 Log: Unconditionally call the setsockopt for IPV6_V6ONLY for v6 linux sockets no matter whether we are compiled as module or if our default of the net.inet6.ip6.v6only sysctl already matches what we would set. This avoids unnecessary complications with modules, VIMAGES, INET6 and the sysctl value, especially considering that most users will use linux compat as a module. Discussed with: kib, rwatson (weeks ago) Reviewed by: rwatson MFC after: 6 weeks Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun Oct 25 09:48:21 2009 (r198466) +++ head/sys/compat/linux/linux_socket.c Sun Oct 25 09:58:56 2009 (r198467) @@ -639,19 +639,12 @@ linux_socket(struct thread *td, struct l } #ifdef INET6 /* - * Linux AF_INET6 socket has IPV6_V6ONLY setsockopt set to 0 by - * default and some apps depend on this. So, set V6ONLY to 0 - * for Linux apps if the sysctl value is set to 1. + * Linux AF_INET6 socket has IPV6_V6ONLY setsockopt set to 0 by default + * and some apps depend on this. So, set V6ONLY to 0 for Linux apps. + * For simplicity we do this unconditionally of the net.inet6.ip6.v6only + * sysctl value. */ - if (bsd_args.domain == PF_INET6 -#ifndef KLD_MODULE - /* - * XXX: Avoid undefined symbol error with an IPv4 only - * kernel. - */ - && V_ip6_v6only -#endif - ) { + if (bsd_args.domain == PF_INET6) { int v6only; v6only = 0; From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 10:23:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED428106566C; Sun, 25 Oct 2009 10:23:11 +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 D210F8FC1F; Sun, 25 Oct 2009 10: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 n9PANBUA054205; Sun, 25 Oct 2009 10:23:11 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PANBGD054203; Sun, 25 Oct 2009 10:23:11 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200910251023.n9PANBGD054203@svn.freebsd.org> From: Rui Paulo Date: Sun, 25 Oct 2009 10: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: r198468 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 10:23:12 -0000 Author: rpaulo Date: Sun Oct 25 10:23:11 2009 New Revision: 198468 URL: http://svn.freebsd.org/changeset/base/198468 Log: Update firmware images according to the latest iwn updated. "device iwnfw" includes all firmware images, but you can pick just one by using the model number, e.g.: "device iwn4965fw". Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 25 09:58:56 2009 (r198467) +++ head/sys/conf/files Sun Oct 25 10:23:11 2009 (r198468) @@ -1082,20 +1082,48 @@ iwi_monitor.fw optional iwimonitorfw | no-obj no-implicit-rule \ clean "iwi_monitor.fw" dev/iwn/if_iwn.c optional iwn -iwnfw.c optional iwnfw \ - compile-with "${AWK} -f $S/tools/fw_stub.awk iwn.fw:iwnfw:44417 -lintel_iwn -miwn -c${.TARGET}" \ +iwn4965fw.c optional iwn4965fw | iwnfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwn4965.fw:iwn4965fw -miwn4965fw -c${.TARGET}" \ no-implicit-rule before-depend local \ - clean "iwnfw.c" -iwnfw.fwo optional iwnfw \ - dependency "iwn.fw" \ - compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} iwn.fw" \ + clean "iwn4965fw.c" +iwn4965fw.fwo optional iwn4965fw | iwnfw \ + dependency "iwn4965.fw" \ + compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} iwn4965.fw" \ no-implicit-rule \ - clean "iwnfw.fwo" -iwn.fw optional iwnfw \ + clean "iwn4965fw.fwo" +iwn4965.fw optional iwn4965fw | iwnfw \ dependency ".PHONY" \ - compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-4965-4.44.17.fw.uu" \ + compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-4965-228.57.2.23.fw.uu" \ no-obj no-implicit-rule \ - clean "iwn.fw" + clean "iwn4965.fw" +iwn5000fw.c optional iwn5000fw | iwnfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwn5000.fw:iwn5000fw -miwn5000fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "iwn5000fw.c" +iwn5000fw.fwo optional iwn5000fw | iwnfw \ + dependency "iwn5000.fw" \ + compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} iwn5000.fw" \ + no-implicit-rule \ + clean "iwn5000fw.fwo" +iwn5000.fw optional iwn5000fw | iwnfw \ + dependency ".PHONY" \ + compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-5000-5.4.A.11.fw.uu" \ + no-obj no-implicit-rule \ + clean "iwn5000.fw" +iwn5150fw.c optional iwn5150fw | iwnfw \ + compile-with "${AWK} -f $S/tools/fw_stub.awk iwn5150.fw:iwn5150fw -miwn5150fw -c${.TARGET}" \ + no-implicit-rule before-depend local \ + clean "iwn5150fw.c" +iwn5150fw.fwo optional iwn5150fw | iwnfw \ + dependency "iwn5150.fw" \ + compile-with "${LD} -b binary -d -warn-common -r -d -o ${.TARGET} iwn5150.fw" \ + no-implicit-rule \ + clean "iwn5150fw.fwo" +iwn5150.fw optional iwn5150fw | iwnfw \ + dependency ".PHONY" \ + compile-with "uudecode -o ${.TARGET} $S/contrib/dev/iwn/iwlwifi-5150-8.24.2.2.fw.uu" \ + no-obj no-implicit-rule \ + clean "iwn5150.fw" dev/ixgb/if_ixgb.c optional ixgb dev/ixgb/ixgb_ee.c optional ixgb dev/ixgb/ixgb_hw.c optional ixgb From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 10:23:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6532F1065670; Sun, 25 Oct 2009 10:23:42 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from mail-ew0-f218.google.com (mail-ew0-f218.google.com [209.85.219.218]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7DE8FC0A; Sun, 25 Oct 2009 10:23:41 +0000 (UTC) Received: by ewy18 with SMTP id 18so9719415ewy.43 for ; Sun, 25 Oct 2009 03:23:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=SyWXbjwXIRf1ciyeCfPy2pBgAB191ET8Ah/sFVJn68E=; b=TDTtfXz6PKk5+CgbssMzYWLV5Umha1ACAY2VDk4conl8yTDjI/7PlHRI7R2Q2Kw/F/ F9DexkxZGORCtqBw5EAgaNhwGQHfKH9agQnRqDKc0lbU4CWlgsEVySXMbFmEXd3N3+7B ZYPuTOpdzwzwB57XQPC4+ABAQIodoSNbAjktM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=CPuhQD4H5HHjKvo5N8N8IwDsh41gd3a5tzfWAm9rQV0ChbD1x4ie6JfFqkyfWNIovn v6dpm0u7Gl0zgmLB2xxjpauolJTlGuj6aO3vdIxkkxfQgF/Y3pz1JVum40N6tQy1kYDS 0DVVfD/tuE+U1QCNpo28e+o1L/GxCwBtmK8PY= Received: by 10.210.93.4 with SMTP id q4mr1287281ebb.3.1256466220497; Sun, 25 Oct 2009 03:23:40 -0700 (PDT) Received: from mac-mini.lan (bl7-91-11.dsl.telepac.pt [85.240.91.11]) by mx.google.com with ESMTPS id 10sm1022414eyz.19.2009.10.25.03.23.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Oct 2009 03:23:39 -0700 (PDT) Sender: Rui Paulo Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes From: Rui Paulo In-Reply-To: <4AE32A9C.10400@freebsd.org> Date: Sun, 25 Oct 2009 10:23:37 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <200910240955.n9O9tCXP087115@svn.freebsd.org> <4AE32A9C.10400@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198439 - in head/sys: dev/iwn modules/iwnfw modules/iwnfw/iwn4965 modules/iwnfw/iwn5000 modules/iwnfw/iwn5150 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 10:23:42 -0000 On 24 Oct 2009, at 17:26, Nathan Whitehorn wrote: > Rui Paulo wrote: >> Author: rpaulo >> Date: Sat Oct 24 09:55:11 2009 >> New Revision: 198439 >> URL: http://svn.freebsd.org/changeset/base/198439 >> >> Log: >> Updates to the iwn driver: >> * iwnfw has now been split into individual modules so autoloading of >> firmware module(s) does work again. >> * Changes have been made to RUN -> AUTH transition, this should >> fix the >> issue reported by Glen and others. >> * Brandon reported issues in iwn_cmd() with large commands, those >> have >> been fixed to. >> * DEAUTH is now handled correctly. >> Submitted by: Bernhard Schmidt >> > I think you missed some changes to /sys/conf/files, if you want to > build iwnfw into the kernel. /sys/conf/files still references the > old 4965 firmware (breaking the build for kernels including device > iwnfw), and doesn't include the 5000-series firmware at all. Thanks > to you and Bernhard for the update! Oops, thanks for pointing out. I've fixed it. REgards, -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 10:29:37 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D642E106566C; Sun, 25 Oct 2009 10:29:37 +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 C59B98FC16; Sun, 25 Oct 2009 10:29: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 n9PATbdq054336; Sun, 25 Oct 2009 10:29:37 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PATbkZ054334; Sun, 25 Oct 2009 10:29:37 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200910251029.n9PATbkZ054334@svn.freebsd.org> From: Rui Paulo Date: Sun, 25 Oct 2009 10:29: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: r198469 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 10:29:37 -0000 Author: rpaulo Date: Sun Oct 25 10:29:37 2009 New Revision: 198469 URL: http://svn.freebsd.org/changeset/base/198469 Log: Explain that iwn was updated and the firmware images are now split. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Oct 25 10:23:11 2009 (r198468) +++ head/UPDATING Sun Oct 25 10:29:37 2009 (r198469) @@ -22,6 +22,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20091025: + The iwn(4) driver has been updated to support the 5000 and 5150 series. + There's one kernel module for each firmware. Adding "device iwnfw" + to the kernel configuration file means including all three firmware + images inside the kernel. If you want to include just the one for + your wireless card, use the the devices iwn4965fw, iwn5000fw or + iwn5150fw. + 20090926: The rc.d/network_ipv6, IPv6 configuration script has been integrated into rc.d/netif. The changes are the following: From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 10:30:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46BF81065698; Sun, 25 Oct 2009 10:30:55 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from mail-ew0-f218.google.com (mail-ew0-f218.google.com [209.85.219.218]) by mx1.freebsd.org (Postfix) with ESMTP id 571B88FC20; Sun, 25 Oct 2009 10:30:54 +0000 (UTC) Received: by ewy18 with SMTP id 18so9721798ewy.43 for ; Sun, 25 Oct 2009 03:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=0UzxJbkpLmKSDud3aWi5sVmAfOv3FJ4O31TsN5V7JTA=; b=nfnrBHn9qbXm+Ayhc2eaGs6aBzw6jkHreS74a3p4ZgHdtbUKPecUENmoiiqzlz5mFL zJTBfDASfUvqjeJHZAOzSQcfVB9JfHeQcHcSptuAmuZ2+0lHgEa55eevzq5ycVBifqJv ZPpTvdnSnzNBhHcK8JnPdTyxH2xrsxRQBgTR0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=upgaciqi0BZOlLyfXEBlZaSP+Usfk8jCpeEL+k4/R3P1/iIv0Wv6THEvojLahRUYAh xU6sJDrwBnproRgE40OcUkWo0uLHPti+AlbePEUbswP3XH7/892HXt0yWxMZ2j/7fYxb VixHgnFnx+x5DPkJQsI/G1DX2JYRxQ5J59XrA= Received: by 10.210.15.14 with SMTP id 14mr2988331ebo.49.1256466653490; Sun, 25 Oct 2009 03:30:53 -0700 (PDT) Received: from mac-mini.lan (bl7-91-11.dsl.telepac.pt [85.240.91.11]) by mx.google.com with ESMTPS id 7sm10096701eyg.25.2009.10.25.03.30.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Oct 2009 03:30:52 -0700 (PDT) Sender: Rui Paulo Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes From: Rui Paulo In-Reply-To: <200910251023.n9PANBGD054203@svn.freebsd.org> Date: Sun, 25 Oct 2009 10:30:49 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <200910251023.n9PANBGD054203@svn.freebsd.org> To: Rui Paulo X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198468 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 10:30:55 -0000 On 25 Oct 2009, at 10:23, Rui Paulo wrote: > Author: rpaulo > Date: Sun Oct 25 10:23:11 2009 > New Revision: 198468 > URL: http://svn.freebsd.org/changeset/base/198468 > > Log: > Update firmware images according to the latest iwn updated. > "device iwnfw" includes all firmware images, but you can pick just > one > by using the model number, e.g.: "device iwn4965fw". Pointed out by: nwhitehorn@ -- Rui Paulo From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 11:01:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB755106568D; Sun, 25 Oct 2009 11:01:53 +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 99CF38FC17; Sun, 25 Oct 2009 11:01: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 n9PB1r9D056148; Sun, 25 Oct 2009 11:01:53 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PB1rIu056145; Sun, 25 Oct 2009 11:01:53 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200910251101.n9PB1rIu056145@svn.freebsd.org> From: Rui Paulo Date: Sun, 25 Oct 2009 11:01: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: r198470 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 11:01:53 -0000 Author: rpaulo Date: Sun Oct 25 11:01:53 2009 New Revision: 198470 URL: http://svn.freebsd.org/changeset/base/198470 Log: Update according to the latest iwn(4) driver import. Modified: head/share/man/man4/iwn.4 head/share/man/man4/iwnfw.4 Modified: head/share/man/man4/iwn.4 ============================================================================== --- head/share/man/man4/iwn.4 Sun Oct 25 10:29:37 2009 (r198469) +++ head/share/man/man4/iwn.4 Sun Oct 25 11:01:53 2009 (r198470) @@ -25,36 +25,52 @@ .\" .\" $FreeBSD$ .\" -.Dd April 13, 2008 +.Dd October 25, 2009 .Os .Dt IWN 4 .Sh NAME .Nm iwn -.Nd "Intel Wireless WiFi Link 4965AGN IEEE 802.11n driver" +.Nd "Intel Wireless WiFi Link 4965/5000 IEEE 802.11n driver" .Sh SYNOPSIS To compile this driver into the kernel, include the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device iwn" -.Cd "device iwnfw" .Cd "device pci" .Cd "device wlan" .Cd "device firmware" .Ed .Pp +You also need to select a firmware for your device. Chose one from: +.Bd -ragged -offset indent +.Cd "device iwn4965fw" +.Cd "device iwn5000fw" +.Cd "device iwn5100fw" +.Ed +.Pp +Or you can use +.Bd -ragged -offset indent +.Cd "device iwnfw" +.Ed +.Pp +to include them all. +.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent if_iwn_load="YES" +iwn4965fw_load="YES" +iwn5000fw_load="YES" +iwn5100fw_load="YES" .Ed .Sh DESCRIPTION The .Nm driver provides support for .Tn Intel -Wireless WiFi Link 4965AGN PCI-Express network adapters. +Wireless WiFi Link 4965 and 5000 series of PCI-Express network adapters. .Nm supports .Cm station , Modified: head/share/man/man4/iwnfw.4 ============================================================================== --- head/share/man/man4/iwnfw.4 Sun Oct 25 10:29:37 2009 (r198469) +++ head/share/man/man4/iwnfw.4 Sun Oct 25 11:01:53 2009 (r198470) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2009 +.Dd October 25, 2009 .Dt IWNFW 4 .Os .Sh NAME @@ -36,15 +36,26 @@ kernel configuration file: .Cd "device iwnfw" .Ed .Pp +This will include three firmware images inside the kernel. +If you want to pick only the firmware image for your network adapter choose one +of the following: +.Bd -ragged -offset indent +.Cd "device iwn4965fw" +.Cd "device iwn5000fw" +.Cd "device iwn5100fw" +.Ed +.Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -iwnfw_load="YES" +iwn4965fw_load="YES" +iwn5000fw_load="YES" +iwn5100fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Wireless WiFi Link 4965AGN IEEE 802.11n adapters. +Intel Wireless WiFi Link 4965 and 5000 series of IEEE 802.11n adapters. It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 13:00:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BFD9106568B; Sun, 25 Oct 2009 13:00:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id EAB498FC1B; Sun, 25 Oct 2009 13:00:08 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id E286341C6A1; Sun, 25 Oct 2009 14:00:06 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id Um2OUprslVPb; Sun, 25 Oct 2009 14:00:06 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id 3B94341C67E; Sun, 25 Oct 2009 14:00:06 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 5BB5F4448E6; Sun, 25 Oct 2009 12:56:56 +0000 (UTC) Date: Sun, 25 Oct 2009 12:56:56 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Marcel Moolenaar In-Reply-To: <200910211838.n9LIc2wp007206@svn.freebsd.org> Message-ID: <20091025125628.Y91695@maildrop.int.zabbadoz.net> References: <200910211838.n9LIc2wp007206@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 13:00:09 -0000 On Wed, 21 Oct 2009, Marcel Moolenaar wrote: > Author: marcel > Date: Wed Oct 21 18:38:02 2009 > New Revision: 198341 > URL: http://svn.freebsd.org/changeset/base/198341 > > Log: > o Introduce vm_sync_icache() for making the I-cache coherent with > the memory or D-cache, depending on the semantics of the platform. > vm_sync_icache() is basically a wrapper around pmap_sync_icache(), > that translates the vm_map_t argumument to pmap_t. > o Introduce pmap_sync_icache() to all PMAP implementation. For powerpc > it replaces the pmap_page_executable() function, added to solve > the I-cache problem in uiomove_fromphys(). > o In proc_rwmem() call vm_sync_icache() when writing to a page that > has execute permissions. This assures that when breakpoints are > written, the I-cache will be coherent and the process will actually > hit the breakpoint. > o This also fixes the Book-E PMAP implementation that was missing > necessary locking while trying to deal with the I-cache coherency > in pmap_enter() (read: mmu_booke_enter_locked). > > The key property of this change is that the I-cache is made coherent > *after* writes have been done. Doing it in the PMAP layer when adding > or changing a mapping means that the I-cache is made coherent *before* > any writes happen. The difference is key when the I-cache prefetches. mumble, yet another pmap function that lacks a man page:( /bz -- Bjoern A. Zeeb It will not break if you know what you are doing. From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 15:52:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B2CE106566B; Sun, 25 Oct 2009 15:52:32 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AA508FC0A; Sun, 25 Oct 2009 15:52: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 n9PFqV4q062064; Sun, 25 Oct 2009 15:52:31 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PFqVSv062063; Sun, 25 Oct 2009 15:52:31 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200910251552.n9PFqVSv062063@svn.freebsd.org> From: Alexander Kabaev Date: Sun, 25 Oct 2009 15:52: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: r198471 - head/gnu/lib/libgcov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 15:52:32 -0000 Author: kan Date: Sun Oct 25 15:52:31 2009 New Revision: 198471 URL: http://svn.freebsd.org/changeset/base/198471 Log: Compile libgcov without stack protection. It can be linked into both static and dynamic binaries compiled with or without stack protection and should not depend on libssp_nonshared.a symbols. Discussed with: kib PR: bin/139052 Modified: head/gnu/lib/libgcov/Makefile Modified: head/gnu/lib/libgcov/Makefile ============================================================================== --- head/gnu/lib/libgcov/Makefile Sun Oct 25 11:01:53 2009 (r198470) +++ head/gnu/lib/libgcov/Makefile Sun Oct 25 15:52:31 2009 (r198471) @@ -2,6 +2,7 @@ NO_PROFILE= .include +MK_SSP= no .include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt" GCCDIR= ${.CURDIR}/../../../contrib/gcc From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 17:30:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5135C1065693; Sun, 25 Oct 2009 17:30:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40C608FC17; Sun, 25 Oct 2009 17:30: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 n9PHUpRo064546; Sun, 25 Oct 2009 17:30:51 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PHUpLK064544; Sun, 25 Oct 2009 17:30:51 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200910251730.n9PHUpLK064544@svn.freebsd.org> From: Alan Cox Date: Sun, 25 Oct 2009 17:30: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: r198472 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 17:30:51 -0000 Author: alc Date: Sun Oct 25 17:30:50 2009 New Revision: 198472 URL: http://svn.freebsd.org/changeset/base/198472 Log: Eliminate an unnecessary check from vm_fault_prefault(). Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Oct 25 15:52:31 2009 (r198471) +++ head/sys/vm/vm_fault.c Sun Oct 25 17:30:50 2009 (r198472) @@ -1011,8 +1011,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset while ((m = vm_page_lookup(lobject, pindex)) == NULL && lobject->type == OBJT_DEFAULT && (backing_object = lobject->backing_object) != NULL) { - if (lobject->backing_object_offset & PAGE_MASK) - break; + KASSERT((lobject->backing_object_offset & PAGE_MASK) == + 0, ("vm_fault_prefault: unaligned object offset")); pindex += lobject->backing_object_offset >> PAGE_SHIFT; VM_OBJECT_LOCK(backing_object); VM_OBJECT_UNLOCK(lobject); From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 17:47:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00512106566B; Sun, 25 Oct 2009 17:47:52 +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 CA2988FC12; Sun, 25 Oct 2009 17:47: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 n9PHlqaU064869; Sun, 25 Oct 2009 17:47:52 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PHlqDF064867; Sun, 25 Oct 2009 17:47:52 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200910251747.n9PHlqDF064867@svn.freebsd.org> From: Christian Brueffer Date: Sun, 25 Oct 2009 17:47: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: r198473 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 17:47:53 -0000 Author: brueffer Date: Sun Oct 25 17:47:52 2009 New Revision: 198473 URL: http://svn.freebsd.org/changeset/base/198473 Log: Spell out the name of the month. Modified: head/share/man/man4/bge.4 Modified: head/share/man/man4/bge.4 ============================================================================== --- head/share/man/man4/bge.4 Sun Oct 25 17:30:50 2009 (r198472) +++ head/share/man/man4/bge.4 Sun Oct 25 17:47:52 2009 (r198473) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 7, 2009 +.Dd October 7, 2009 .Dt BGE 4 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 20:25:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A0CE106568D; Sun, 25 Oct 2009 20:25:43 +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 0FFF78FC1C; Sun, 25 Oct 2009 20:25:42 +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 n9PKPft7083717; Sun, 25 Oct 2009 21:25:41 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n9PKPfjm083716; Sun, 25 Oct 2009 21:25:41 +0100 (CET) (envelope-from marius) Date: Sun, 25 Oct 2009 21:25:41 +0100 From: Marius Strobl To: Marcel Moolenaar Message-ID: <20091025202541.GC94979@alchemy.franken.de> References: <200910211838.n9LIc2wp007206@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200910211838.n9LIc2wp007206@svn.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: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 20:25:43 -0000 On Wed, Oct 21, 2009 at 06:38:02PM +0000, Marcel Moolenaar wrote: > Author: marcel > Date: Wed Oct 21 18:38:02 2009 > New Revision: 198341 > URL: http://svn.freebsd.org/changeset/base/198341 > > Log: > o Introduce vm_sync_icache() for making the I-cache coherent with > the memory or D-cache, depending on the semantics of the platform. > vm_sync_icache() is basically a wrapper around pmap_sync_icache(), > that translates the vm_map_t argumument to pmap_t. > o Introduce pmap_sync_icache() to all PMAP implementation. For powerpc > it replaces the pmap_page_executable() function, added to solve > the I-cache problem in uiomove_fromphys(). > o In proc_rwmem() call vm_sync_icache() when writing to a page that > has execute permissions. This assures that when breakpoints are > written, the I-cache will be coherent and the process will actually > hit the breakpoint. > o This also fixes the Book-E PMAP implementation that was missing > necessary locking while trying to deal with the I-cache coherency > in pmap_enter() (read: mmu_booke_enter_locked). > > The key property of this change is that the I-cache is made coherent > *after* writes have been done. Doing it in the PMAP layer when adding > or changing a mapping means that the I-cache is made coherent *before* > any writes happen. The difference is key when the I-cache prefetches. > Do you have a simple test case demonstrating the need for I-cache synchronisation? Marius From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 21:37:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 564D91065670; Sun, 25 Oct 2009 21:37:56 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99]) by mx1.freebsd.org (Postfix) with ESMTP id 3E2B98FC08; Sun, 25 Oct 2009 21:37:56 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed Received: from macbook-pro.lan.xcllnt.net (mail.xcllnt.net [75.101.29.67]) by asmtp024.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KS300F74AQV8N10@asmtp024.mac.com>; Sun, 25 Oct 2009 14:37:55 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <20091025202541.GC94979@alchemy.franken.de> Date: Sun, 25 Oct 2009 14:37:40 -0700 Message-id: <36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com> References: <200910211838.n9LIc2wp007206@svn.freebsd.org> <20091025202541.GC94979@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 21:37:56 -0000 On Oct 25, 2009, at 1:25 PM, Marius Strobl wrote: > > Do you have a simple test case demonstrating the need for > I-cache synchronisation? I typically use GDB. If breakpoints aren't being hit or next isn't behaving correctly, you typically have an I-cache problem. If you get to run GDB, you probably already know whether it's needed, because processes tend to die with random signals at startup when the architecture needs explicit I-cache coherency logic and the kernel doesn't have it. A special case I would say is executing from a memory disk. The I/O path contains bcopy() operations, which dirty the D-cache and trigger I-cache coherency bugs pretty well. I didn't have issues with that on my Netra, so I didn't implement pmap_sync_icache for sparc64. This is not to say that it's absolutely not needed, just that GDB didn't expose problems. If sparc64 has some of the same kluges powerpc had, then I-cache coherency is handled in some other (most likely a sub-optimal) way. FYI, -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Sun Oct 25 21:46:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3D301065696; Sun, 25 Oct 2009 21:46:39 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92CC48FC14; Sun, 25 Oct 2009 21:46: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 n9PLkd52069517; Sun, 25 Oct 2009 21:46:39 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9PLkdo3069516; Sun, 25 Oct 2009 21:46:39 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200910252146.n9PLkdo3069516@svn.freebsd.org> From: Ulf Lilleengen Date: Sun, 25 Oct 2009 21:46: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: r198475 - in head: share/man/man4 sys/dev/msk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Oct 2009 21:46:39 -0000 Author: lulf Date: Sun Oct 25 21:46:38 2009 New Revision: 198475 URL: http://svn.freebsd.org/changeset/base/198475 Log: - Add support for Marvell Yukon 88E8042 device. Submitted by: Mario Lobo Approved by: yongari Modified: head/share/man/man4/msk.4 head/sys/dev/msk/if_msk.c head/sys/dev/msk/if_mskreg.h Modified: head/share/man/man4/msk.4 ============================================================================== --- head/share/man/man4/msk.4 Sun Oct 25 19:13:39 2009 (r198474) +++ head/share/man/man4/msk.4 Sun Oct 25 21:46:38 2009 (r198475) @@ -190,6 +190,8 @@ Marvell Yukon 88E8040 Fast Ethernet .It Marvell Yukon 88E8040T Fast Ethernet .It +Marvell Yukon 88E8042 Fast Ethernet +.It Marvell Yukon 88E8048 Fast Ethernet .It Marvell Yukon 88E8050 Gigabit Ethernet Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Sun Oct 25 19:13:39 2009 (r198474) +++ head/sys/dev/msk/if_msk.c Sun Oct 25 21:46:38 2009 (r198475) @@ -201,6 +201,8 @@ static struct msk_product { "Marvell Yukon 88E8040 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8040T, "Marvell Yukon 88E8040T Fast Ethernet" }, + { VENDORID_MARVELL, DEVICEID_MRVL_8042, + "Marvell Yukon 88E8042 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_8048, "Marvell Yukon 88E8048 Fast Ethernet" }, { VENDORID_MARVELL, DEVICEID_MRVL_4361, Modified: head/sys/dev/msk/if_mskreg.h ============================================================================== --- head/sys/dev/msk/if_mskreg.h Sun Oct 25 19:13:39 2009 (r198474) +++ head/sys/dev/msk/if_mskreg.h Sun Oct 25 21:46:38 2009 (r198475) @@ -133,6 +133,7 @@ #define DEVICEID_MRVL_8039 0x4353 #define DEVICEID_MRVL_8040 0x4354 #define DEVICEID_MRVL_8040T 0x4355 +#define DEVICEID_MRVL_8042 0x4357 #define DEVICEID_MRVL_8048 0x435A #define DEVICEID_MRVL_4360 0x4360 #define DEVICEID_MRVL_4361 0x4361 From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 00:01:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 981FD1065676; Mon, 26 Oct 2009 00:01:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EF458FC12; Mon, 26 Oct 2009 00:01: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 n9Q01qa5071921; Mon, 26 Oct 2009 00:01:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9Q01qcw071919; Mon, 26 Oct 2009 00:01:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200910260001.n9Q01qcw071919@svn.freebsd.org> From: Alan Cox Date: Mon, 26 Oct 2009 00:01: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: r198476 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 00:01:52 -0000 Author: alc Date: Mon Oct 26 00:01:52 2009 New Revision: 198476 URL: http://svn.freebsd.org/changeset/base/198476 Log: Simplify the inner loop of vm_fault_copy_entry(). Reviewed by: kib Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Oct 25 21:46:38 2009 (r198475) +++ head/sys/vm/vm_fault.c Mon Oct 26 00:01:52 2009 (r198476) @@ -1133,20 +1133,20 @@ vm_fault_copy_entry(vm_map_t dst_map, vm { vm_object_t backing_object, dst_object, object; vm_object_t src_object; - vm_ooffset_t dst_offset; - vm_ooffset_t src_offset; - vm_pindex_t pindex; + vm_pindex_t dst_pindex, pindex, src_pindex; vm_prot_t prot; vm_offset_t vaddr; vm_page_t dst_m; vm_page_t src_m; + boolean_t src_readonly; #ifdef lint src_map++; #endif /* lint */ src_object = src_entry->object.vm_object; - src_offset = src_entry->offset; + src_pindex = OFF_TO_IDX(src_entry->offset); + src_readonly = (src_entry->protection & VM_PROT_WRITE) == 0; /* * Create the top-level object for the destination entry. (Doesn't @@ -1177,16 +1177,16 @@ vm_fault_copy_entry(vm_map_t dst_map, vm * one from the source object (it should be there) to the destination * object. */ - for (vaddr = dst_entry->start, dst_offset = 0; + for (vaddr = dst_entry->start, dst_pindex = 0; vaddr < dst_entry->end; - vaddr += PAGE_SIZE, dst_offset += PAGE_SIZE) { + vaddr += PAGE_SIZE, dst_pindex++) { /* - * Allocate a page in the destination object + * Allocate a page in the destination object. */ do { - dst_m = vm_page_alloc(dst_object, - OFF_TO_IDX(dst_offset), VM_ALLOC_NORMAL); + dst_m = vm_page_alloc(dst_object, dst_pindex, + VM_ALLOC_NORMAL); if (dst_m == NULL) { VM_OBJECT_UNLOCK(dst_object); VM_WAIT; @@ -1201,10 +1201,9 @@ vm_fault_copy_entry(vm_map_t dst_map, vm */ VM_OBJECT_LOCK(src_object); object = src_object; - pindex = 0; - while ((src_m = vm_page_lookup(object, pindex + - OFF_TO_IDX(dst_offset + src_offset))) == NULL && - (src_entry->protection & VM_PROT_WRITE) == 0 && + pindex = src_pindex + dst_pindex; + while ((src_m = vm_page_lookup(object, pindex)) == NULL && + src_readonly && (backing_object = object->backing_object) != NULL) { /* * Allow fallback to backing objects if we are reading. From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 06:51:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 982DF106566B; Mon, 26 Oct 2009 06:51:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 875DD8FC12; Mon, 26 Oct 2009 06:51:21 +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 n9Q6pLeo080068; Mon, 26 Oct 2009 06:51:21 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9Q6pLfU080067; Mon, 26 Oct 2009 06:51:21 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200910260651.n9Q6pLfU080067@svn.freebsd.org> From: Colin Percival Date: Mon, 26 Oct 2009 06:51: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: r198477 - head/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 06:51:21 -0000 Author: cperciva Date: Mon Oct 26 06:51:20 2009 New Revision: 198477 URL: http://svn.freebsd.org/changeset/base/198477 Log: Eject CDROM after installation if used as source media. Submitted by: randi MFC after: 1 month Modified: head/usr.sbin/sysinstall/cdrom.c Modified: head/usr.sbin/sysinstall/cdrom.c ============================================================================== --- head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 00:01:52 2009 (r198476) +++ head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 06:51:20 2009 (r198477) @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,8 @@ static Boolean previouslyMounted; /* Was static char mountpoint[MAXPATHLEN] = "/dist"; int CDROMInitQuiet; +static void mediaEjectCDROM(Device *dev); + static properties read_props(char *name) { @@ -218,4 +221,23 @@ mediaShutdownCDROM(Device *dev) msgConfirm("Could not unmount the CDROM/DVD from %s: %s", mountpoint, strerror(errno)); else cdromMounted = FALSE; + + mediaEjectCDROM(dev); +} + +static void +mediaEjectCDROM(Device *dev) +{ + int fd = -1; + + msgDebug("Ejecting CDROM/DVD at %s", dev->devname); + + fd = open(dev->devname, O_RDONLY); + + if (fd < 0) + msgDebug("Could not eject the CDROM/DVD from %s: %s", dev->devname, strerror(errno)); + else { + ioctl(fd, CDIOCALLOW); + ioctl(fd, CDIOCEJECT); + } } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 07:43:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8132D1065676; Mon, 26 Oct 2009 07:43:42 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705BA8FC13; Mon, 26 Oct 2009 07:43: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 n9Q7hgW3081071; Mon, 26 Oct 2009 07:43:42 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9Q7hgap081068; Mon, 26 Oct 2009 07:43:42 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200910260743.n9Q7hgap081068@svn.freebsd.org> From: Ulf Lilleengen Date: Mon, 26 Oct 2009 07:43: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: r198478 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 07:43:42 -0000 Author: lulf Date: Mon Oct 26 07:43:41 2009 New Revision: 198478 URL: http://svn.freebsd.org/changeset/base/198478 Log: - Initialize variable in order to avoid GCC warning and enable WARNS=6. PR: bin/139970 Submitted by: Ulrich Spörlein Modified: head/sbin/geom/class/part/Makefile head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/Makefile ============================================================================== --- head/sbin/geom/class/part/Makefile Mon Oct 26 06:51:20 2009 (r198477) +++ head/sbin/geom/class/part/Makefile Mon Oct 26 07:43:41 2009 (r198478) @@ -6,6 +6,4 @@ CLASS= part LDADD= -lutil -WARNS?= 4 - .include Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Mon Oct 26 06:51:20 2009 (r198477) +++ head/sbin/geom/class/part/geom_part.c Mon Oct 26 07:43:41 2009 (r198478) @@ -192,6 +192,7 @@ find_provider(struct ggeom *gp, unsigned unsigned long long sector, bestsector; bestpp = NULL; + bestsector = 0; LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "start"); if (s == NULL) { From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 08:41:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8EFF106566B; Mon, 26 Oct 2009 08:41:10 +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 97F3A8FC19; Mon, 26 Oct 2009 08:41: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 n9Q8fAb0082169; Mon, 26 Oct 2009 08:41:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9Q8fAiK082167; Mon, 26 Oct 2009 08:41:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910260841.n9Q8fAiK082167@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 08:41: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: r198479 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 08:41:10 -0000 Author: mav Date: Mon Oct 26 08:41:10 2009 New Revision: 198479 URL: http://svn.freebsd.org/changeset/base/198479 Log: Fix SATA on nVidia MCP55 chipset. It needs some short time to allow BAR(5) memory access. PR: amd64/128686, amd64/132372, amd64/139156 MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-nvidia.c Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Mon Oct 26 07:43:41 2009 (r198478) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Mon Oct 26 08:41:10 2009 (r198479) @@ -165,7 +165,8 @@ ata_nvidia_chipinit(device_t dev) /* enable control access */ pci_write_config(dev, 0x50, pci_read_config(dev, 0x50, 1) | 0x04,1); - + /* MCP55 seems to need some time to allow r_res2 read. */ + DELAY(10); if (ctlr->chip->cfg1 & NVQ) { /* clear interrupt status */ ATA_OUTL(ctlr->r_res2, offset, 0x00ff00ff); From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 09:16:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C05C1065693; Mon, 26 Oct 2009 09:16:09 +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 2B0648FC16; Mon, 26 Oct 2009 09:16: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 n9Q9G91b082901; Mon, 26 Oct 2009 09:16:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9Q9G9ab082899; Mon, 26 Oct 2009 09:16:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910260916.n9Q9G9ab082899@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 09:16: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: r198480 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 09:16:09 -0000 Author: mav Date: Mon Oct 26 09:16:08 2009 New Revision: 198480 URL: http://svn.freebsd.org/changeset/base/198480 Log: Document atapci kernel module split. PR: amd64/139859 MFC after: 3 days Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 26 08:41:10 2009 (r198479) +++ head/UPDATING Mon Oct 26 09:16:08 2009 (r198480) @@ -632,6 +632,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. userland (libpmc(3)) and the kernel module (hwpmc(4)) in sync. +20081009: + atapci kernel module now includes only generic PCI ATA + driver. AHCI driver moved to ataahci kernel module. + All vendor-specific code moved into separate kernel modules: + ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, + atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, + atamarvell, atamicron, atanational, atanetcell, atanvidia, + atapromise, ataserverworks, atasiliconimage, atasis, atavia + 20080820: The TTY subsystem of the kernel has been replaced by a new implementation, which provides better scalability and an From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 10:01:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60FA5106568D; Mon, 26 Oct 2009 10:01:00 +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 4F4258FC19; Mon, 26 Oct 2009 10:01: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 n9QA10Xm083749; Mon, 26 Oct 2009 10:01:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QA10sk083746; Mon, 26 Oct 2009 10:01:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261001.n9QA10sk083746@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 10:01: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: r198481 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 10:01:00 -0000 Author: mav Date: Mon Oct 26 10:00:59 2009 New Revision: 198481 URL: http://svn.freebsd.org/changeset/base/198481 Log: Add two more VIA SATA chip IDs. PR: kern/135057 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 Mon Oct 26 09:16:08 2009 (r198480) +++ head/sys/dev/ata/ata-pci.h Mon Oct 26 10:00:59 2009 (r198481) @@ -415,6 +415,8 @@ struct ata_pci_controller { #define ATA_VIA8237 0x32271106 #define ATA_VIA8237A 0x05911106 #define ATA_VIA8237S 0x53371106 +#define ATA_VIA8237_5372 0x53721106 +#define ATA_VIA8237_7372 0x73721106 #define ATA_VIA8251 0x33491106 #define ATA_VIA8361 0x31121106 #define ATA_VIA8363 0x03051106 Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Mon Oct 26 09:16:08 2009 (r198480) +++ head/sys/dev/ata/chipsets/ata-via.c Mon Oct 26 10:00:59 2009 (r198481) @@ -103,6 +103,8 @@ ata_via_probe(device_t dev) { ATA_VIA6421, 0x00, 6, VIABAR, ATA_SA150, "6421" }, { ATA_VIA8237A, 0x00, 7, 0x00, ATA_SA150, "8237A" }, { ATA_VIA8237S, 0x00, 7, 0x00, ATA_SA150, "8237S" }, + { ATA_VIA8237_5372, 0x00, 7, 0x00, ATA_SA300, "8237" }, + { ATA_VIA8237_7372, 0x00, 7, 0x00, ATA_SA300, "8237" }, { ATA_VIA8251, 0x00, 0, VIAAHCI, ATA_SA300, "8251" }, { 0, 0, 0, 0, 0, 0 }}; From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 10:07:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C03BB1065693; Mon, 26 Oct 2009 10:07:41 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [66.246.138.153]) by mx1.freebsd.org (Postfix) with ESMTP id 673DC8FC18; Mon, 26 Oct 2009 10:07:41 +0000 (UTC) Received: from unknown (87-194-158-129.bethere.co.uk [87.194.158.129]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 2546A832A; Mon, 26 Oct 2009 10:07:40 +0000 (UTC) Date: Mon, 26 Oct 2009 10:07:35 +0000 From: Bruce Cran To: Alexander Motin Message-ID: <20091026100735.00006cf5@unknown> In-Reply-To: <200910260916.n9Q9G9ab082899@svn.freebsd.org> References: <200910260916.n9Q9G9ab082899@svn.freebsd.org> X-Mailer: Claws Mail 3.7.2cvs15 (GTK+ 2.16.0; i586-pc-mingw32msvc) 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: r198480 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 10:07:41 -0000 On Mon, 26 Oct 2009 09:16:09 +0000 (UTC) Alexander Motin wrote: > Author: mav > Date: Mon Oct 26 09:16:08 2009 > New Revision: 198480 > URL: http://svn.freebsd.org/changeset/base/198480 > > Log: > Document atapci kernel module split. > > PR: amd64/139859 > MFC after: 3 days Could you take a look at kern/133162 please? It contains a patch which adds documentation of the ata modules to /sys/conf/NOTES . -- Bruce Cran From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 10:07:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEB80106568B; Mon, 26 Oct 2009 10:07:52 +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 9D5A28FC1A; Mon, 26 Oct 2009 10:07: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 n9QA7qmU083896; Mon, 26 Oct 2009 10:07:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QA7qB6083894; Mon, 26 Oct 2009 10:07:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261007.n9QA7qB6083894@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 10:07: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: r198482 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 10:07:52 -0000 Author: mav Date: Mon Oct 26 10:07:52 2009 New Revision: 198482 URL: http://svn.freebsd.org/changeset/base/198482 Log: Add IDs for PATA part also. Modified: head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Mon Oct 26 10:00:59 2009 (r198481) +++ head/sys/dev/ata/chipsets/ata-via.c Mon Oct 26 10:07:52 2009 (r198482) @@ -95,6 +95,8 @@ ata_via_probe(device_t dev) { ATA_VIA8237, 0x00, VIA133, 0x00, ATA_UDMA6, "8237" }, { ATA_VIA8237A, 0x00, VIA133, 0x00, ATA_UDMA6, "8237A" }, { ATA_VIA8237S, 0x00, VIA133, 0x00, ATA_UDMA6, "8237S" }, + { 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" }, { 0, 0, 0, 0, 0, 0 }}; static struct ata_chip_id new_ids[] = From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 10:35:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61083106566C; Mon, 26 Oct 2009 10:35:17 +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 3657C8FC0C; Mon, 26 Oct 2009 10:35: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 n9QAZHd4084490; Mon, 26 Oct 2009 10:35:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QAZHGR084488; Mon, 26 Oct 2009 10:35:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261035.n9QAZHGR084488@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 10:35: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: r198483 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 10:35:17 -0000 Author: mav Date: Mon Oct 26 10:35:16 2009 New Revision: 198483 URL: http://svn.freebsd.org/changeset/base/198483 Log: Document new modularised ATA kernel options. PR: kern/133162 MFC after: 3 days Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Oct 26 10:07:52 2009 (r198482) +++ head/sys/conf/NOTES Mon Oct 26 10:35:16 2009 (r198483) @@ -1657,6 +1657,10 @@ device siis # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card # devices. You only need one "device ata" for it to find all # PCI and PC Card ATA/ATAPI devices on modern machines. +# Alternatively, individual bus and chipset drivers may be chosen by using +# the 'atacore' driver then selecting the drivers on a per vendor basis. +# For example to build a system which only supports a VIA chipset, +# omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers. device ata device atadisk # ATA disk drives device ataraid # ATA RAID drives @@ -1665,6 +1669,39 @@ device atapifd # ATAPI floppy drives device atapist # ATAPI tape drives device atapicam # emulate ATAPI devices as SCSI ditto via CAM # needs CAM to be present (scbus & pass) + +# Modular ATA +#device atacore # Core ATA functionality +#device atacard # CARDBUS support +#device atabus # PC98 cbus support +#device ataisa # ISA bus support +#device atapci # PCI bus support; only generic chipset support + +# PCI ATA chipsets +#device ataahci # AHCI SATA +#device ataacard # ACARD +#device ataacerlabs # Acer Labs Inc. (ALI) +#device ataadaptec # Adaptec +#device ataamd # American Micro Devices (AMD) +#device ataati # ATI +#device atacenatek # Cenatek +#device atacypress # Cypress +#device atacyrix # Cyrix +#device atahighpoint # HighPoint +#device ataintel # Intel +#device ataite # Integrated Technology Inc. (ITE) +#device atajmicron # JMicron +#device atamarvell # Marvell +#device atamicron # Micron +#device atanational # National +#device atanetcell # NetCell +#device atanvidia # nVidia +#device atapromise # Promise +#device ataserverworks # ServerWorks +#device atasiliconimage # Silicon Image Inc. (SiI) (formerly CMD) +#device atasis # Silicon Integrated Systems Corp.(SiS) +#device atavia # VIA Technologies Inc. + # # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add: hint.ata.0.at="isa" From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 11:20:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58F2C1065679; Mon, 26 Oct 2009 11:20:15 +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 47B088FC0C; Mon, 26 Oct 2009 11:20: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 n9QBKFpQ086931; Mon, 26 Oct 2009 11:20:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QBKFUw086926; Mon, 26 Oct 2009 11:20:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261120.n9QBKFUw086926@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 11:20: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: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 11:20:15 -0000 Author: mav Date: Mon Oct 26 11:20:14 2009 New Revision: 198486 URL: http://svn.freebsd.org/changeset/base/198486 Log: Increase ATA command timeouts. Some drives need more then 5s to spin-up. PR: kern/111023 Modified: head/sys/dev/ata/ata-disk.c head/sys/dev/ata/ata-queue.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/atapi-cd.c Modified: head/sys/dev/ata/ata-disk.c ============================================================================== --- head/sys/dev/ata/ata-disk.c Mon Oct 26 11:00:37 2009 (r198485) +++ head/sys/dev/ata/ata-disk.c Mon Oct 26 11:20:14 2009 (r198486) @@ -230,7 +230,7 @@ ad_spindown(void *priv) } request->dev = dev; request->flags = ATA_R_CONTROL; - request->timeout = 5; + request->timeout = 10; request->retries = 1; request->callback = ad_power_callback; request->u.ata.command = ATA_STANDBY_IMMEDIATE; @@ -265,7 +265,7 @@ ad_strategy(struct bio *bp) request->timeout = 31; } else { - request->timeout = 5; + request->timeout = 10; } request->retries = 2; request->data = bp->bio_data; @@ -468,7 +468,7 @@ ad_set_geometry(device_t dev) request->u.ata.count = 0; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL | ATA_R_QUIET; - request->timeout = 5; + request->timeout = 10; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) @@ -487,7 +487,7 @@ ad_set_geometry(device_t dev) request->u.ata.count = 1; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL; - request->timeout = 5; + request->timeout = 10; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) Modified: head/sys/dev/ata/ata-queue.c ============================================================================== --- head/sys/dev/ata/ata-queue.c Mon Oct 26 11:00:37 2009 (r198485) +++ head/sys/dev/ata/ata-queue.c Mon Oct 26 11:20:14 2009 (r198486) @@ -135,7 +135,7 @@ ata_controlcmd(device_t dev, u_int8_t co atadev->spindown_state = 0; request->timeout = 31; } else { - request->timeout = 5; + request->timeout = 10; } request->retries = 0; ata_queue_request(request); @@ -389,7 +389,7 @@ ata_completed(void *context, int dummy) request->bytecount = sizeof(struct atapi_sense); request->donecount = 0; request->transfersize = sizeof(struct atapi_sense); - request->timeout = 5; + request->timeout = 10; request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG); request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE); ATA_DEBUG_RQ(request, "autoissue request sense"); Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Mon Oct 26 11:00:37 2009 (r198485) +++ head/sys/dev/ata/ata-raid.c Mon Oct 26 11:20:14 2009 (r198486) @@ -273,7 +273,7 @@ ata_raid_flush(struct bio *bp) request->u.ata.lba = 0; request->u.ata.count = 0; request->u.ata.feature = 0; - request->timeout = 1; + request->timeout = 10; request->retries = 0; request->flags |= ATA_R_ORDERED | ATA_R_DIRECT; ata_queue_request(request); @@ -4371,7 +4371,7 @@ ata_raid_init_request(device_t dev, stru return NULL; } request->dev = dev; - request->timeout = 5; + request->timeout = 10; request->retries = 2; request->callback = ata_raid_done; request->driver = rdp; Modified: head/sys/dev/ata/atapi-cd.c ============================================================================== --- head/sys/dev/ata/atapi-cd.c Mon Oct 26 11:00:37 2009 (r198485) +++ head/sys/dev/ata/atapi-cd.c Mon Oct 26 11:20:14 2009 (r198486) @@ -700,7 +700,7 @@ acd_geom_access(struct g_provider *pp, i request->dev = dev; bcopy(ccb, request->u.atapi.ccb, 16); request->flags = ATA_R_ATAPI; - request->timeout = 5; + request->timeout = 10; ata_queue_request(request); if (!request->error && (request->u.atapi.sense.key == 2 || From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 11:23:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F70110656BC; Mon, 26 Oct 2009 11:23:42 +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 1C8368FC16; Mon, 26 Oct 2009 11:23: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 n9QBNf3D087030; Mon, 26 Oct 2009 11:23:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QBNfJY087028; Mon, 26 Oct 2009 11:23:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261123.n9QBNfJY087028@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 11:23: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: r198487 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 11:23:42 -0000 Author: mav Date: Mon Oct 26 11:23:41 2009 New Revision: 198487 URL: http://svn.freebsd.org/changeset/base/198487 Log: Round timeout up when converting CAM milliseconds to ATA seconds. Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Mon Oct 26 11:20:14 2009 (r198486) +++ head/sys/dev/ata/atapi-cam.c Mon Oct 26 11:23:41 2009 (r198487) @@ -629,7 +629,7 @@ atapi_action(struct cam_sim *sim, union request->data = buf; request->bytecount = len; request->transfersize = min(request->bytecount, 65534); - request->timeout = ccb_h->timeout / 1000; /* XXX lost granularity */ + request->timeout = (ccb_h->timeout + 999) / 1000; request->callback = &atapi_cb; request->flags = request_flags; @@ -732,7 +732,7 @@ atapi_cb(struct ata_request *request) request->data = (caddr_t)&csio->sense_data; request->bytecount = sizeof(struct atapi_sense); request->transfersize = min(request->bytecount, 65534); - request->timeout = csio->ccb_h.timeout / 1000; + request->timeout = (csio->ccb_h.timeout + 999) / 1000; request->retries = 2; request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE; hcb->flags |= AUTOSENSE; From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 11:26:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 812BB10656A3; Mon, 26 Oct 2009 11:26:49 +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 7060B8FC22; Mon, 26 Oct 2009 11:26: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 n9QBQnFX087113; Mon, 26 Oct 2009 11:26:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QBQnVp087111; Mon, 26 Oct 2009 11:26:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200910261126.n9QBQnVp087111@svn.freebsd.org> From: Alexander Motin Date: Mon, 26 Oct 2009 11:26: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: r198488 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 11:26:49 -0000 Author: mav Date: Mon Oct 26 11:26:49 2009 New Revision: 198488 URL: http://svn.freebsd.org/changeset/base/198488 Log: Report SATA speeds to CAM, to not confuse users with low numbers logged. Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Mon Oct 26 11:23:41 2009 (r198487) +++ head/sys/dev/ata/atapi-cam.c Mon Oct 26 11:26:49 2009 (r198488) @@ -414,6 +414,12 @@ atapi_action(struct cam_sim *sim, union case ATA_UDMA6: cpi->base_transfer_speed = 133000; break; + case ATA_SA150: + cpi->base_transfer_speed = 150000; + break; + case ATA_SA300: + cpi->base_transfer_speed = 300000; + break; default: break; } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 13:01:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CC20106566C; Mon, 26 Oct 2009 13:01:30 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BBC88FC1F; Mon, 26 Oct 2009 13:01: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 n9QD1Ucj091087; Mon, 26 Oct 2009 13:01:30 GMT (envelope-from rafan@svn.freebsd.org) Received: (from rafan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QD1UKl091085; Mon, 26 Oct 2009 13:01:30 GMT (envelope-from rafan@svn.freebsd.org) Message-Id: <200910261301.n9QD1UKl091085@svn.freebsd.org> From: Rong-En Fan Date: Mon, 26 Oct 2009 13:01:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198489 - vendor/ncurses/dist/ncurses/base X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 13:01:30 -0000 Author: rafan Date: Mon Oct 26 13:01:29 2009 New Revision: 198489 URL: http://svn.freebsd.org/changeset/base/198489 Log: Pull upstream patch to fix ee(1) crash when received SIGWINCH: modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a SIGWINCH, and discard that value, to avoid confusing application (patch by Eygene Ryabinkin, FreeBSD bin/136223). PR: 136223 Submitted by: Eygene Ryabinkin Obtained from: ncurses-5.7-20091024 snapshot MFC after: 3 days Modified: vendor/ncurses/dist/ncurses/base/lib_getch.c Modified: vendor/ncurses/dist/ncurses/base/lib_getch.c ============================================================================== --- vendor/ncurses/dist/ncurses/base/lib_getch.c Mon Oct 26 11:26:49 2009 (r198488) +++ vendor/ncurses/dist/ncurses/base/lib_getch.c Mon Oct 26 13:01:29 2009 (r198489) @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win, /* resizeterm can push KEY_RESIZE */ if (cooked_key_in_fifo()) { *result = fifo_pull(sp); + /* + * Get the ERR from queue -- it is from WINCH, + * so we should take it out, the "error" is handled. + */ + if (fifo_peek(sp) == -1) + fifo_pull(sp); returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK); } } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 13:03:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A94C5106566C; Mon, 26 Oct 2009 13:03:52 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 982158FC13; Mon, 26 Oct 2009 13:03: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 n9QD3qLv091177; Mon, 26 Oct 2009 13:03:52 GMT (envelope-from rafan@svn.freebsd.org) Received: (from rafan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QD3qX5091175; Mon, 26 Oct 2009 13:03:52 GMT (envelope-from rafan@svn.freebsd.org) Message-Id: <200910261303.n9QD3qX5091175@svn.freebsd.org> From: Rong-En Fan Date: Mon, 26 Oct 2009 13:03: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: r198490 - in head/contrib/ncurses: . ncurses/base X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 13:03:52 -0000 Author: rafan Date: Mon Oct 26 13:03:52 2009 New Revision: 198490 URL: http://svn.freebsd.org/changeset/base/198490 Log: Merge r198489 from vendor/ncurses/dist: Pull upstream patch to fix ee(1) crash when received SIGWINCH: modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a SIGWINCH, and discard that value, to avoid confusing application (patch by Eygene Ryabinkin, FreeBSD bin/136223). PR: 136223 Submitted by: Eygene Ryabinkin Obtained from: ncurses-5.7-20091024 snapshot MFC after: 3 days Modified: head/contrib/ncurses/ (props changed) head/contrib/ncurses/ncurses/base/lib_getch.c Modified: head/contrib/ncurses/ncurses/base/lib_getch.c ============================================================================== --- head/contrib/ncurses/ncurses/base/lib_getch.c Mon Oct 26 13:01:29 2009 (r198489) +++ head/contrib/ncurses/ncurses/base/lib_getch.c Mon Oct 26 13:03:52 2009 (r198490) @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win, /* resizeterm can push KEY_RESIZE */ if (cooked_key_in_fifo()) { *result = fifo_pull(sp); + /* + * Get the ERR from queue -- it is from WINCH, + * so we should take it out, the "error" is handled. + */ + if (fifo_peek(sp) == -1) + fifo_pull(sp); returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK); } } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 14:42:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 6417F1065694; Mon, 26 Oct 2009 14:42:52 +0000 (UTC) Date: Mon, 26 Oct 2009 14:42:52 +0000 From: Alexey Dokuchaev To: Alexander Motin Message-ID: <20091026144252.GA11752@FreeBSD.org> References: <200910261120.n9QBKFUw086926@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200910261120.n9QBKFUw086926@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: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 14:42:52 -0000 On Mon, Oct 26, 2009 at 11:20:15AM +0000, Alexander Motin wrote: > Author: mav > Date: Mon Oct 26 11:20:14 2009 > New Revision: 198486 > URL: http://svn.freebsd.org/changeset/base/198486 > > Log: > Increase ATA command timeouts. Some drives need more then 5s to spin-up. Can't it be factored out into a macro so one does not have to make a bunch of those identical changes over several files shall it be required to adjust timeout again some time in the future? ./danfe From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 14:51:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4DD4106568B; Mon, 26 Oct 2009 14:51:56 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1783B8FC24; Mon, 26 Oct 2009 14:51:54 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA01518; Mon, 26 Oct 2009 16:51:53 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4AE5B788.5060407@freebsd.org> Date: Mon, 26 Oct 2009 16:51:52 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Alexey Dokuchaev References: <200910261120.n9QBKFUw086926@svn.freebsd.org> <20091026144252.GA11752@FreeBSD.org> In-Reply-To: <20091026144252.GA11752@FreeBSD.org> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 14:51:56 -0000 on 26/10/2009 16:42 Alexey Dokuchaev said the following: > On Mon, Oct 26, 2009 at 11:20:15AM +0000, Alexander Motin wrote: >> Author: mav >> Date: Mon Oct 26 11:20:14 2009 >> New Revision: 198486 >> URL: http://svn.freebsd.org/changeset/base/198486 >> >> Log: >> Increase ATA command timeouts. Some drives need more then 5s to spin-up. > > Can't it be factored out into a macro so one does not have to make a bunch > of those identical changes over several files shall it be required to > adjust timeout again some time in the future? If this is to happen, then I'd like them to become sysctls too. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 14:57:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F86F1065670; Mon, 26 Oct 2009 14:57:34 +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 1EBCD8FC0A; Mon, 26 Oct 2009 14:57: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 n9QEvY3C093315; Mon, 26 Oct 2009 14:57:34 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QEvYtc093313; Mon, 26 Oct 2009 14:57:34 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200910261457.n9QEvYtc093313@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 26 Oct 2009 14:57: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: r198491 - head/sbin/mount_nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 14:57:34 -0000 Author: jh Date: Mon Oct 26 14:57:33 2009 New Revision: 198491 URL: http://svn.freebsd.org/changeset/base/198491 Log: Fix parsing of mount options specified with -o in case an option with value is preceded by an option without value (for example -o option1,option2=value). Options must be separated before searching for '='. Also compare pnextopt explicitly against NULL. PR: bin/134069 Approved by: trasz (mentor) Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Mon Oct 26 13:03:52 2009 (r198490) +++ head/sbin/mount_nfs/mount_nfs.c Mon Oct 26 14:57:33 2009 (r198491) @@ -232,16 +232,16 @@ main(int argc, char *argv[]) char *pnextopt = NULL; char *val = ""; pass_flag_to_nmount = 1; - pval = strchr(opt, '='); pnextopt = strchr(opt, ','); + if (pnextopt != NULL) { + *pnextopt = '\0'; + pnextopt++; + } + pval = strchr(opt, '='); if (pval != NULL) { *pval = '\0'; val = pval + 1; } - if (pnextopt) { - *pnextopt = '\0'; - pnextopt++; - } if (strcmp(opt, "bg") == 0) { opflags |= BGRND; pass_flag_to_nmount=0; From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 15:45:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 412F3106568F; Mon, 26 Oct 2009 15:45:18 +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 12C4D8FC0A; Mon, 26 Oct 2009 15:45:18 +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 B934046B0D; Mon, 26 Oct 2009 11:45:17 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id EDCD58A01F; Mon, 26 Oct 2009 11:45:16 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Date: Mon, 26 Oct 2009 08:37:23 -0400 User-Agent: KMail/1.9.7 References: <200910232253.n9NMr10R074584@svn.freebsd.org> In-Reply-To: <200910232253.n9NMr10R074584@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910260837.23479.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 26 Oct 2009 11:45:17 -0400 (EDT) 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, DATE_IN_PAST_03_06,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: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 15:45:18 -0000 On Friday 23 October 2009 6:53:01 pm Marcel Moolenaar wrote: > Author: marcel > Date: Fri Oct 23 22:53:01 2009 > New Revision: 198431 > URL: http://svn.freebsd.org/changeset/base/198431 > > Log: > BIOSes, buggy or otherwise, are i386 or amd64 specific. > Have the early USB takeover enabled for i386 and amd64 > by default. > This also avoids a panic on PowerPC where the resource > isn't released properly and we find a busy resource > when the USB host controller wants to allocate it... Presumably such systems won't set the 'BIOS owned' bit in the their legacy support registers in which case these routines are NOPs (they just read the register, see the bit is clear, and exit). The resource bug sounds like a real one that should be fixed and would probably affect any x86 systems who have USB disabled in the BIOS, so that should be fixed rather than papered over. Please revert. Note that the legacy support register stuff is part of the uhci/ohci/ehci specifications, and that the code to frob it has been part of the same drivers since their inception. If it had been an actual problem then it would have been disabled back when USB was enabled for other architectures. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 15:45:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84340106568B; Mon, 26 Oct 2009 15:45:19 +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 55BF18FC0C; Mon, 26 Oct 2009 15:45:19 +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 07A3A46B03; Mon, 26 Oct 2009 11:45:19 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 4BB118A020; Mon, 26 Oct 2009 11:45:18 -0400 (EDT) From: John Baldwin To: Alexander Motin Date: Mon, 26 Oct 2009 08:40:44 -0400 User-Agent: KMail/1.9.7 References: <200910261035.n9QAZHGR084488@svn.freebsd.org> In-Reply-To: <200910261035.n9QAZHGR084488@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910260840.45033.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 26 Oct 2009 11:45:18 -0400 (EDT) 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, DATE_IN_PAST_03_06,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: r198483 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 15:45:19 -0000 On Monday 26 October 2009 6:35:17 am Alexander Motin wrote: > Author: mav > Date: Mon Oct 26 10:35:16 2009 > New Revision: 198483 > URL: http://svn.freebsd.org/changeset/base/198483 > > Log: > Document new modularised ATA kernel options. Presumably it wouldn't actually hurt to leave these enabled. config(8) is ok with having a file enabled via multiple matching lines in sys/conf/files* IIRC. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 15:47:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1DAF106566B; Mon, 26 Oct 2009 15:47:15 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f209.google.com (mail-bw0-f209.google.com [209.85.218.209]) by mx1.freebsd.org (Postfix) with ESMTP id BA9D98FC24; Mon, 26 Oct 2009 15:47:14 +0000 (UTC) Received: by bwz1 with SMTP id 1so2507166bwz.13 for ; Mon, 26 Oct 2009 08:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=6+EmMMBbLLbMedj8wcrMg+b0MyDOTwmt8n/wB4zqwmU=; b=tbxYhxnDZXgE1o868BfHg3kvHzxctyihFxzzCZJ453AyvqQWDwGMG/S+Tct0rPs7cb FigcY+l+BWmmgI0Q6Ax+rXq+mHKzvE1Uk/HR9FfgBNeqJlQ2roVb9G9+Q9hU+f9e8peF qr2lFT0MAAfYPonEkQXlhfBc1oyzQja8ZzQlI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=AoLPPMfNCTTpV6922t6BSSBVdIHB7txMhkmdxfX73BuiHnJLE7bQ3ribhUsOF0yk9j tzv1tPyrzpewpLgQSok4qHPqKk7rhbLdM8SeohNTbhb+Yh+WF4vqAK5zax4LV+S+CZ1H ZOTyOEwofQzGyqJn+uQS2w51sRGxV0y8UouJM= Received: by 10.103.127.32 with SMTP id e32mr2543038mun.70.1256570270799; Mon, 26 Oct 2009 08:17:50 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id n10sm13854513mue.17.2009.10.26.08.17.48 (version=SSLv3 cipher=RC4-MD5); Mon, 26 Oct 2009 08:17:49 -0700 (PDT) Sender: Alexander Motin Message-ID: <4AE5CBA9.4080605@FreeBSD.org> Date: Mon, 26 Oct 2009 18:17:45 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20090901) MIME-Version: 1.0 To: Andriy Gapon References: <200910261120.n9QBKFUw086926@svn.freebsd.org> <20091026144252.GA11752@FreeBSD.org> <4AE5B788.5060407@freebsd.org> In-Reply-To: <4AE5B788.5060407@freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 15:47:15 -0000 Andriy Gapon wrote: > on 26/10/2009 16:42 Alexey Dokuchaev said the following: >> On Mon, Oct 26, 2009 at 11:20:15AM +0000, Alexander Motin wrote: >>> Author: mav >>> Date: Mon Oct 26 11:20:14 2009 >>> New Revision: 198486 >>> URL: http://svn.freebsd.org/changeset/base/198486 >>> >>> Log: >>> Increase ATA command timeouts. Some drives need more then 5s to spin-up. >> Can't it be factored out into a macro so one does not have to make a bunch >> of those identical changes over several files shall it be required to >> adjust timeout again some time in the future? You are right, but I still hope to obsolete that code some time in the future. > If this is to happen, then I'd like them to become sysctls too. I think it is a bit excessive. System should work just out of the box without such tunings. Timeout is a fatal condition that should not happen within normal operation. The only reason to reduce it is faster fault recovery. But if faults happen often enough to require tuning, you should probably replace hardware. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 15:50:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 307331065679; Mon, 26 Oct 2009 15:50:42 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 851F08FC18; Mon, 26 Oct 2009 15:50:41 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 2345FEB46E8; Mon, 26 Oct 2009 17:50:40 +0200 (EET) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id F27BD451B2; Mon, 26 Oct 2009 17:50:39 +0200 (EET) X-Quarantine-ID: <4CwU9y8-aMp5> X-Virus-Scanned: amavisd-new at ceid.upatras.gr X-Amavis-Alert: BAD HEADER, Duplicate header field: "Cc" Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4CwU9y8-aMp5; Mon, 26 Oct 2009 17:50:39 +0200 (EET) Received: from kobe.laptop (ppp-94-64-232-242.home.otenet.gr [94.64.232.242]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 81717450C6; Mon, 26 Oct 2009 17:50:39 +0200 (EET) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9QFodNm010191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 26 Oct 2009 17:50:39 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n9QFocFn010190; Mon, 26 Oct 2009 17:50:38 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Alexander Motin References: <200910261120.n9QBKFUw086926@svn.freebsd.org> Date: Mon, 26 Oct 2009 17:50:38 +0200 In-Reply-To: <200910261120.n9QBKFUw086926@svn.freebsd.org> (Alexander Motin's message of "Mon, 26 Oct 2009 11:20:15 +0000 (UTC)") Message-ID: <87zl7e2lyp.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org, Andriy Gapon Subject: Re: svn commit: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 15:50:42 -0000 On Mon, 26 Oct 2009 11:20:15 +0000 (UTC), Alexander Motin wrote: > Author: mav > Date: Mon Oct 26 11:20:14 2009 > New Revision: 198486 > URL: http://svn.freebsd.org/changeset/base/198486 > > Log: > Increase ATA command timeouts. Some drives need more then 5s to spin-up. On Mon, 26 Oct 2009 14:42:52 +0000, Alexey Dokuchaev wrote: > Can't it be factored out into a macro so one does not have to make a bunch > of those identical changes over several files shall it be required to > adjust timeout again some time in the future? Yes it can. See attached patch below. On Mon, 26 Oct 2009 16:51:52 +0200, Andriy Gapon wrote: > If this is to happen, then I'd like them to become sysctls too. If it's not a problem, we can add the macro first and then work on making it a sysctl. FWIW, it may also be nice to have a different sysctl for each ata device, or something that can be tuned per bus or per-device with atacontrol. The patch attached below is what we need to make this a compile-time option for kernel config files. It's small enough that I think we can commit this now, and work on the sysctl/atacontrol tunable in the meantime. %%% diff -r 912fc3591cda UPDATING --- a/UPDATING Mon Oct 26 15:41:28 2009 +0200 +++ b/UPDATING Mon Oct 26 17:46:11 2009 +0200 @@ -22,6 +22,11 @@ machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20091026: + The ata(4) driver has been updated to allow rebuilding with a custom + request timeout. ATA_REQUEST_TIMEOUT now defaults to 10 seconds, but + may be set in the kernel configuration file to another value. + 20091025: The iwn(4) driver has been updated to support the 5000 and 5150 series. There's one kernel module for each firmware. Adding "device iwnfw" diff -r 912fc3591cda sys/conf/NOTES --- a/sys/conf/NOTES Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/conf/NOTES Mon Oct 26 17:46:11 2009 +0200 @@ -1716,8 +1716,11 @@ # # ATA_STATIC_ID: controller numbering is static ie depends on location # else the device numbers are dynamically allocated. +# ATA_REQUEST_TIMEOUT: the number of seconds to wait for an ATA request +# before timing out. options ATA_STATIC_ID +#options ATA_REQUEST_TIMEOUT=10 # # Standard floppy disk controllers and floppy tapes, supports diff -r 912fc3591cda sys/conf/options --- a/sys/conf/options Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/conf/options Mon Oct 26 17:46:11 2009 +0200 @@ -350,6 +350,7 @@ # Options used in the 'ata' ATA/ATAPI driver ATA_STATIC_ID opt_ata.h ATA_NOPCI opt_ata.h +ATA_REQUEST_TIMEOUT opt_ata.h # Net stuff. ACCEPT_FILTER_DATA diff -r 912fc3591cda sys/dev/ata/ata-all.h --- a/sys/dev/ata/ata-all.h Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/dev/ata/ata-all.h Mon Oct 26 17:46:11 2009 +0200 @@ -336,6 +336,10 @@ #define ATA_OP_FINISHED 1 #define ATA_MAX_28BIT_LBA 268435455UL +#ifndef ATA_REQUEST_TIMEOUT +#define ATA_REQUEST_TIMEOUT 10 +#endif + /* structure used for composite atomic operations */ #define MAX_COMPOSITES 32 /* u_int32_t bits */ struct ata_composite { diff -r 912fc3591cda sys/dev/ata/ata-disk.c --- a/sys/dev/ata/ata-disk.c Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/dev/ata/ata-disk.c Mon Oct 26 17:46:11 2009 +0200 @@ -230,7 +230,7 @@ } request->dev = dev; request->flags = ATA_R_CONTROL; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 1; request->callback = ad_power_callback; request->u.ata.command = ATA_STANDBY_IMMEDIATE; @@ -265,7 +265,7 @@ request->timeout = 31; } else { - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; } request->retries = 2; request->data = bp->bio_data; @@ -468,7 +468,7 @@ request->u.ata.count = 0; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL | ATA_R_QUIET; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) @@ -487,7 +487,7 @@ request->u.ata.count = 1; request->u.ata.feature = 0; request->flags = ATA_R_CONTROL; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->retries = 0; ata_queue_request(request); if (request->status & ATA_S_ERROR) diff -r 912fc3591cda sys/dev/ata/ata-queue.c --- a/sys/dev/ata/ata-queue.c Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/dev/ata/ata-queue.c Mon Oct 26 17:46:11 2009 +0200 @@ -135,7 +135,7 @@ atadev->spindown_state = 0; request->timeout = 31; } else { - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; } request->retries = 0; ata_queue_request(request); @@ -389,7 +389,7 @@ request->bytecount = sizeof(struct atapi_sense); request->donecount = 0; request->transfersize = sizeof(struct atapi_sense); - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG); request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE); ATA_DEBUG_RQ(request, "autoissue request sense"); diff -r 912fc3591cda sys/dev/ata/atapi-cd.c --- a/sys/dev/ata/atapi-cd.c Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/dev/ata/atapi-cd.c Mon Oct 26 17:46:11 2009 +0200 @@ -700,7 +700,7 @@ request->dev = dev; bcopy(ccb, request->u.atapi.ccb, 16); request->flags = ATA_R_ATAPI; - request->timeout = 10; + request->timeout = ATA_REQUEST_TIMEOUT; ata_queue_request(request); if (!request->error && (request->u.atapi.sense.key == 2 || diff -r 912fc3591cda sys/i386/conf/KOBE --- a/sys/i386/conf/KOBE Mon Oct 26 15:41:28 2009 +0200 +++ b/sys/i386/conf/KOBE Mon Oct 26 17:46:11 2009 +0200 @@ -90,6 +90,7 @@ device atapicam # emulate ATAPI devices as SCSI ditto via CAM # needs CAM to be present (scbus & pass) options ATA_STATIC_ID # Static device numbering +options ATA_REQUEST_TIMEOUT=12 # SCSI peripherals device scbus # SCSI bus (required for SCSI) %%% From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 16:22:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB1DA106566B; Mon, 26 Oct 2009 16:22:10 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 6176B8FC19; Mon, 26 Oct 2009 16:22:10 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 8BF4FEB46E6; Mon, 26 Oct 2009 17:58:00 +0200 (EET) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 6CFCA451B2; Mon, 26 Oct 2009 17:58:00 +0200 (EET) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YEfVAqDRR-vL; Mon, 26 Oct 2009 17:58:00 +0200 (EET) Received: from kobe.laptop (ppp-94-64-232-242.home.otenet.gr [94.64.232.242]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 32D8D450C6; Mon, 26 Oct 2009 17:58:00 +0200 (EET) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9QFvxqE010242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 26 Oct 2009 17:57:59 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n9QFvxnE010241; Mon, 26 Oct 2009 17:57:59 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Alexander Motin References: <200910261120.n9QBKFUw086926@svn.freebsd.org> <87zl7e2lyp.fsf@kobe.laptop> Date: Mon, 26 Oct 2009 17:57:59 +0200 In-Reply-To: <87zl7e2lyp.fsf@kobe.laptop> (Giorgos Keramidas's message of "Mon, 26 Oct 2009 17:50:38 +0200") Message-ID: <87r5sq2lmg.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org, Andriy Gapon Subject: Re: svn commit: r198486 - head/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 16:22:10 -0000 On Mon, 26 Oct 2009 17:50:38 +0200, Giorgos Keramidas wrote: > diff -r 912fc3591cda sys/i386/conf/KOBE > --- a/sys/i386/conf/KOBE Mon Oct 26 15:41:28 2009 +0200 > +++ b/sys/i386/conf/KOBE Mon Oct 26 17:46:11 2009 +0200 > @@ -90,6 +90,7 @@ > device atapicam # emulate ATAPI devices as SCSI ditto via CAM > # needs CAM to be present (scbus & pass) > options ATA_STATIC_ID # Static device numbering > +options ATA_REQUEST_TIMEOUT=12 > > # SCSI peripherals > device scbus # SCSI bus (required for SCSI) This hunk is for my local kernel config file. Please ignore it. From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 16:33:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F319106568B; Mon, 26 Oct 2009 16:33:05 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout029.mac.com (asmtpout029.mac.com [17.148.16.104]) by mx1.freebsd.org (Postfix) with ESMTP id 55DEC8FC17; Mon, 26 Oct 2009 16:33:04 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp029.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KS4006WARAONC40@asmtp029.mac.com>; Mon, 26 Oct 2009 09:33:04 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <200910260837.23479.jhb@freebsd.org> Date: Mon, 26 Oct 2009 09:32:48 -0700 Message-id: <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910260837.23479.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 16:33:05 -0000 On Oct 26, 2009, at 5:37 AM, John Baldwin wrote: >> Log: >> BIOSes, buggy or otherwise, are i386 or amd64 specific. >> Have the early USB takeover enabled for i386 and amd64 >> by default. >> This also avoids a panic on PowerPC where the resource >> isn't released properly and we find a busy resource >> when the USB host controller wants to allocate it... > > Presumably such systems won't set the 'BIOS owned' bit in the their > legacy > support registers in which case these routines are NOPs (they just > read the > register, see the bit is clear, and exit). The resource bug sounds > like a > real one that should be fixed and would probably affect any x86 > systems who > have USB disabled in the BIOS, so that should be fixed rather than > papered > over. Please revert. *sigh* The change was made because 1) doing this as part of the PCI code is unnecessary for non-PC HW, and 2) it's entirely untested on non-PC HW and the gratuitous change can therefore only do harm -- he, guess what, it did do harm. Unless people fix the resource stuff this change cannot be reverted. After the resource fix has gone in, I still object to this being reverted on grounds of gratuitous code bloat. I say this with ARM, MIPS and PowerPC/Book-E in mind. > Note that the legacy support register stuff is part of the uhci/ohci/ > ehci > specifications, and that the code to frob it has been part of the same > drivers since their inception. If it had been an actual problem > then it > would have been disabled back when USB was enabled for other > architectures. This is entirely besides the point... -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 16:50:35 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32E48106566C; Mon, 26 Oct 2009 16:50:35 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id C0A2A8FC08; Mon, 26 Oct 2009 16:50:33 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA04151; Mon, 26 Oct 2009 18:50:29 +0200 (EET) (envelope-from avg@freebsd.org) Message-ID: <4AE5D355.8020107@freebsd.org> Date: Mon, 26 Oct 2009 18:50:29 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Marcel Moolenaar References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910260837.23479.jhb@freebsd.org> <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> In-Reply-To: <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> X-Enigmail-Version: 0.95.7 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, John Baldwin Subject: Re: svn commit: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 16:50:35 -0000 on 26/10/2009 18:32 Marcel Moolenaar said the following: > > The change was made because 1) doing this as part of the PCI code is > unnecessary for non-PC HW, and 2) it's entirely untested on non-PC > HW and the gratuitous change can therefore only do harm -- he, guess > what, it did do harm. > > Unless people fix the resource stuff this change cannot be reverted. Well, I think that maybe people who could fix this might not have the hardware that is need to reproduce and test the problem. So they need help of people who do have the hardware and can reproduce the problem. Perhaps, just disabling the code _and_ stopping there is what should not be done. > After the resource fix has gone in, I still object to this being > reverted on grounds of gratuitous code bloat. I say this with ARM, > MIPS and PowerPC/Book-E in mind. Well, PCI USB controller drivers would also have this bloat, but I am not sure if hardware for the platforms you listed has PCI *HCI controllers. Besides, only code execution is now disabled, the code itself is still present, which also can be considered as a form of bloat. Perhaps #if defined (arch1) ... would be more appropriate here? I am not sure. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 16:57:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BB951065696; Mon, 26 Oct 2009 16:57:24 +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 6B4838FC17; Mon, 26 Oct 2009 16:57:24 +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 E9E0946B3B; Mon, 26 Oct 2009 12:57:23 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 363858A01B; Mon, 26 Oct 2009 12:57:23 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Date: Mon, 26 Oct 2009 12:54:49 -0400 User-Agent: KMail/1.9.7 References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910260837.23479.jhb@freebsd.org> <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> In-Reply-To: <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910261254.49768.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 26 Oct 2009 12:57:23 -0400 (EDT) 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: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 16:57:24 -0000 On Monday 26 October 2009 12:32:48 pm Marcel Moolenaar wrote: > > On Oct 26, 2009, at 5:37 AM, John Baldwin wrote: > > >> Log: > >> BIOSes, buggy or otherwise, are i386 or amd64 specific. > >> Have the early USB takeover enabled for i386 and amd64 > >> by default. > >> This also avoids a panic on PowerPC where the resource > >> isn't released properly and we find a busy resource > >> when the USB host controller wants to allocate it... > > > > > > Presumably such systems won't set the 'BIOS owned' bit in the their > > legacy > > support registers in which case these routines are NOPs (they just > > read the > > register, see the bit is clear, and exit). The resource bug sounds > > like a > > real one that should be fixed and would probably affect any x86 > > systems who > > have USB disabled in the BIOS, so that should be fixed rather than > > papered > > over. Please revert. > > *sigh* > > The change was made because 1) doing this as part of the PCI code is > unnecessary for non-PC HW, and 2) it's entirely untested on non-PC > HW and the gratuitous change can therefore only do harm -- he, guess > what, it did do harm. > > Unless people fix the resource stuff this change cannot be reverted. > > After the resource fix has gone in, I still object to this being > reverted on grounds of gratuitous code bloat. I say this with ARM, > MIPS and PowerPC/Book-E in mind. You didn't remove anything, you merely toggled the setting of a variable. Code bloat is a non-argument in that case. Could you care to provide details on the resource issue you are encountering? I don't see any obvious resource leaks, etc. in the current set of changes. > > Note that the legacy support register stuff is part of the uhci/ohci/ > > ehci > > specifications, and that the code to frob it has been part of the same > > drivers since their inception. If it had been an actual problem > > then it > > would have been disabled back when USB was enabled for other > > architectures. > > This is entirely besides the point... It is not beside the point because the code was not just added, it is being moved. Presumably the code will be removed from the host controller drivers shortly since it is no longer needed. I repeat that if the code caused real problems it would not be present in the actual host controller drivers. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 17:27:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEB47106566B; Mon, 26 Oct 2009 17:27:30 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D9028FC08; Mon, 26 Oct 2009 17:27: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 n9QHRUVU096259; Mon, 26 Oct 2009 17:27:30 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QHRULf096257; Mon, 26 Oct 2009 17:27:30 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <200910261727.n9QHRULf096257@svn.freebsd.org> From: Maksim Yevmenkin Date: Mon, 26 Oct 2009 17:27: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: r198492 - head/lib/libbluetooth X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 17:27:30 -0000 Author: emax Date: Mon Oct 26 17:27:30 2009 New Revision: 198492 URL: http://svn.freebsd.org/changeset/base/198492 Log: Fix typo in bluetooth.3 Do not use reserved C++ keyword "new" MFC after: 1 month Modified: head/lib/libbluetooth/bluetooth.3 head/lib/libbluetooth/bluetooth.h Modified: head/lib/libbluetooth/bluetooth.3 ============================================================================== --- head/lib/libbluetooth/bluetooth.3 Mon Oct 26 14:57:33 2009 (r198491) +++ head/lib/libbluetooth/bluetooth.3 Mon Oct 26 17:27:30 2009 (r198492) @@ -272,7 +272,7 @@ otherwise 0. .Pp The .Fn bt_devinfo -function populates prodivded +function populates provided .Vt bt_devinfo structure with the information about given Bluetooth device. The caller is expected to pass Bluetooth device name in the Modified: head/lib/libbluetooth/bluetooth.h ============================================================================== --- head/lib/libbluetooth/bluetooth.h Mon Oct 26 14:57:33 2009 (r198491) +++ head/lib/libbluetooth/bluetooth.h Mon Oct 26 17:27:30 2009 (r198492) @@ -163,8 +163,8 @@ int bt_devclose(int s); int bt_devsend (int s, uint16_t opcode, void *param, size_t plen); ssize_t bt_devrecv (int s, void *buf, size_t size, time_t to); int bt_devreq (int s, struct bt_devreq *r, time_t to); -int bt_devfilter(int s, struct bt_devfilter const *new, - struct bt_devfilter *old); +int bt_devfilter(int s, struct bt_devfilter const *newp, + struct bt_devfilter *oldp); void bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type); void bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type); int bt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type); From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 17:37:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34565106566B; Mon, 26 Oct 2009 17:37:34 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99]) by mx1.freebsd.org (Postfix) with ESMTP id 1BBB08FC15; Mon, 26 Oct 2009 17:37:33 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp024.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KS400LH1UADJXA0@asmtp024.mac.com>; Mon, 26 Oct 2009 10:37:27 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <200910261254.49768.jhb@freebsd.org> Date: Mon, 26 Oct 2009 10:37:25 -0700 Message-id: <936EBD5F-31D2-4B6A-94E7-D9DB8FD236FE@mac.com> References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910260837.23479.jhb@freebsd.org> <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> <200910261254.49768.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 17:37:34 -0000 On Oct 26, 2009, at 9:54 AM, John Baldwin wrote: > On Monday 26 October 2009 12:32:48 pm Marcel Moolenaar wrote: >> >> On Oct 26, 2009, at 5:37 AM, John Baldwin wrote: >> >>>> Log: >>>> BIOSes, buggy or otherwise, are i386 or amd64 specific. >>>> Have the early USB takeover enabled for i386 and amd64 >>>> by default. >>>> This also avoids a panic on PowerPC where the resource >>>> isn't released properly and we find a busy resource >>>> when the USB host controller wants to allocate it... >>> >> >> >>> Presumably such systems won't set the 'BIOS owned' bit in the their >>> legacy >>> support registers in which case these routines are NOPs (they just >>> read the >>> register, see the bit is clear, and exit). The resource bug sounds >>> like a >>> real one that should be fixed and would probably affect any x86 >>> systems who >>> have USB disabled in the BIOS, so that should be fixed rather than >>> papered >>> over. Please revert. >> >> *sigh* >> >> The change was made because 1) doing this as part of the PCI code is >> unnecessary for non-PC HW, and 2) it's entirely untested on non-PC >> HW and the gratuitous change can therefore only do harm -- he, guess >> what, it did do harm. >> >> Unless people fix the resource stuff this change cannot be reverted. >> >> After the resource fix has gone in, I still object to this being >> reverted on grounds of gratuitous code bloat. I say this with ARM, >> MIPS and PowerPC/Book-E in mind. > > You didn't remove anything, you merely toggled the setting of a > variable. Oops... Brainfart. I thought I did wrapped the whole logic... /me resets brain If someone is willing to fix the resource issue, I'm more than happy to test patches. In the mean time we should keep the change to avoid unnecessary productivity loss by people impacted by the kernel panic. Once the resource issue is fixed, I don't care in particular what the default is as long as the logic gets executed some time... -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 17:42:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25270106566C; Mon, 26 Oct 2009 17:42:04 +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 E95FC8FC13; Mon, 26 Oct 2009 17:42: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 n9QHg3Xg096578; Mon, 26 Oct 2009 17:42:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QHg37O096576; Mon, 26 Oct 2009 17:42:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200910261742.n9QHg37O096576@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Oct 2009 17:42: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: r198493 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 17:42:04 -0000 Author: jhb Date: Mon Oct 26 17:42:03 2009 New Revision: 198493 URL: http://svn.freebsd.org/changeset/base/198493 Log: Fix some spelling nits. Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Oct 26 17:27:30 2009 (r198492) +++ head/sys/kern/kern_cpuset.c Mon Oct 26 17:42:03 2009 (r198493) @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); * not. This means that anonymous sets are immutable because they may be * shared. To modify an anonymous set a new set is created with the desired * mask and the same parent as the existing anonymous set. This gives the - * illusion of each thread having a private mask.A + * illusion of each thread having a private mask. * * Via the syscall apis a user may ask to retrieve or modify the root, base, * or mask that is discovered via a pid, tid, or setid. Modifying a set @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); * Modifying a pid or tid's mask applies only to that tid but must still * exist within the assigned parent set. * - * A thread may not be assigned to a a group seperate from other threads in + * A thread may not be assigned to a a group separate from other threads in * the process. This is to remove ambiguity when the setid is queried with * a pid argument. There is no other technical limitation. * @@ -98,7 +98,7 @@ __FBSDID("$FreeBSD$"); * * A simple application should not concern itself with sets at all and * rather apply masks to its own threads via CPU_WHICH_TID and a -1 id - * meaning 'curthread'. It may query availble cpus for that tid with a + * meaning 'curthread'. It may query available cpus for that tid with a * getaffinity call using (CPU_LEVEL_CPUSET, CPU_WHICH_PID, -1, ...). */ static uma_zone_t cpuset_zone; @@ -153,7 +153,7 @@ cpuset_refbase(struct cpuset *set) } /* - * Release a reference in a context where it is safe to allocte. + * Release a reference in a context where it is safe to allocate. */ void cpuset_rel(struct cpuset *set) @@ -752,7 +752,7 @@ cpuset_setproc_update_set(struct proc *p /* * This is called once the final set of system cpus is known. Modifies - * the root set and all children and mark the root readonly. + * the root set and all children and mark the root read-only. */ static void cpuset_init(void *arg) From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 17:45:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DB6A106568D; Mon, 26 Oct 2009 17:45:41 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 1AB788FC1C; Mon, 26 Oct 2009 17:45:40 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 264C0581BD; Mon, 26 Oct 2009 12:45:40 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id YMxWXhPSxvFF; Mon, 26 Oct 2009 12:45:40 -0500 (CDT) Received: from wanderer.tachypleus.net (i3-dhcp-172-16-55-200.icecube.wisc.edu [172.16.55.200]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 0512C581A0; Mon, 26 Oct 2009 12:45:39 -0500 (CDT) Message-ID: <4AE5E043.8070804@freebsd.org> Date: Mon, 26 Oct 2009 12:45:39 -0500 From: Nathan Whitehorn User-Agent: Thunderbird 2.0.0.23 (X11/20090909) MIME-Version: 1.0 To: John Baldwin References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910260837.23479.jhb@freebsd.org> <8082A638-C5BA-42F9-8C2E-DA31EF084840@mac.com> <200910261254.49768.jhb@freebsd.org> In-Reply-To: <200910261254.49768.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org Subject: Re: svn commit: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 17:45:41 -0000 John Baldwin wrote: > On Monday 26 October 2009 12:32:48 pm Marcel Moolenaar wrote: > >> On Oct 26, 2009, at 5:37 AM, John Baldwin wrote: >> >> >>>> Log: >>>> BIOSes, buggy or otherwise, are i386 or amd64 specific. >>>> Have the early USB takeover enabled for i386 and amd64 >>>> by default. >>>> This also avoids a panic on PowerPC where the resource >>>> isn't released properly and we find a busy resource >>>> when the USB host controller wants to allocate it... >>>> >> >>> Presumably such systems won't set the 'BIOS owned' bit in the their >>> legacy >>> support registers in which case these routines are NOPs (they just >>> read the >>> register, see the bit is clear, and exit). The resource bug sounds >>> like a >>> real one that should be fixed and would probably affect any x86 >>> systems who >>> have USB disabled in the BIOS, so that should be fixed rather than >>> papered >>> over. Please revert. >>> >> *sigh* >> >> The change was made because 1) doing this as part of the PCI code is >> unnecessary for non-PC HW, and 2) it's entirely untested on non-PC >> HW and the gratuitous change can therefore only do harm -- he, guess >> what, it did do harm. >> >> Unless people fix the resource stuff this change cannot be reverted. >> >> After the resource fix has gone in, I still object to this being >> reverted on grounds of gratuitous code bloat. I say this with ARM, >> MIPS and PowerPC/Book-E in mind. >> > > You didn't remove anything, you merely toggled the setting of a variable. > Code bloat is a non-argument in that case. Could you care to provide details > on the resource issue you are encountering? I don't see any obvious resource > leaks, etc. in the current set of changes. > > The real problem in this case is that the bus_(deactivate|release)_resource methods are not implemented on several PCI bus drivers on PowerPC (e.g. uninorth, where this problem arose). Up until now, I guess it has never mattered. -Nathan From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 18:02:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D92AE1065694; Mon, 26 Oct 2009 18:02:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 935E08FC19; Mon, 26 Oct 2009 18:02: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 n9QI250S097096; Mon, 26 Oct 2009 18:02:05 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QI25bB097094; Mon, 26 Oct 2009 18:02:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200910261802.n9QI25bB097094@svn.freebsd.org> From: Alan Cox Date: Mon, 26 Oct 2009 18:02: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: r198494 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 18:02:06 -0000 Author: alc Date: Mon Oct 26 18:02:05 2009 New Revision: 198494 URL: http://svn.freebsd.org/changeset/base/198494 Log: There is no need to "busy" a page when the object is locked for the duration of the operation. Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Mon Oct 26 17:42:03 2009 (r198493) +++ head/sys/fs/tmpfs/tmpfs_subr.c Mon Oct 26 18:02:05 2009 (r198494) @@ -906,10 +906,9 @@ tmpfs_reg_resize(struct vnode *vp, off_t if (zerolen > 0) { m = vm_page_grab(uobj, OFF_TO_IDX(newsize), - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + VM_ALLOC_NOBUSY | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); pmap_zero_page_area(m, PAGE_SIZE - zerolen, zerolen); - vm_page_wakeup(m); } VM_OBJECT_UNLOCK(uobj); From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 18:13:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3BC3106568F; Mon, 26 Oct 2009 18:13:59 +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 74BEE8FC1E; Mon, 26 Oct 2009 18:13:59 +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 167BF46B2C; Mon, 26 Oct 2009 14:13:59 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 37ED28A01B; Mon, 26 Oct 2009 14:13:58 -0400 (EDT) From: John Baldwin To: Nathan Whitehorn Date: Mon, 26 Oct 2009 14:13:03 -0400 User-Agent: KMail/1.9.7 References: <200910232253.n9NMr10R074584@svn.freebsd.org> <200910261254.49768.jhb@freebsd.org> <4AE5E043.8070804@freebsd.org> In-Reply-To: <4AE5E043.8070804@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910261413.04317.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 26 Oct 2009 14:13:58 -0400 (EDT) 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, Marcel Moolenaar , src-committers@freebsd.org Subject: Re: svn commit: r198431 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 18:13:59 -0000 On Monday 26 October 2009 1:45:39 pm Nathan Whitehorn wrote: > John Baldwin wrote: > > On Monday 26 October 2009 12:32:48 pm Marcel Moolenaar wrote: > > > >> On Oct 26, 2009, at 5:37 AM, John Baldwin wrote: > >> > >> > >>>> Log: > >>>> BIOSes, buggy or otherwise, are i386 or amd64 specific. > >>>> Have the early USB takeover enabled for i386 and amd64 > >>>> by default. > >>>> This also avoids a panic on PowerPC where the resource > >>>> isn't released properly and we find a busy resource > >>>> when the USB host controller wants to allocate it... > >>>> > >> > >>> Presumably such systems won't set the 'BIOS owned' bit in the their > >>> legacy > >>> support registers in which case these routines are NOPs (they just > >>> read the > >>> register, see the bit is clear, and exit). The resource bug sounds > >>> like a > >>> real one that should be fixed and would probably affect any x86 > >>> systems who > >>> have USB disabled in the BIOS, so that should be fixed rather than > >>> papered > >>> over. Please revert. > >>> > >> *sigh* > >> > >> The change was made because 1) doing this as part of the PCI code is > >> unnecessary for non-PC HW, and 2) it's entirely untested on non-PC > >> HW and the gratuitous change can therefore only do harm -- he, guess > >> what, it did do harm. > >> > >> Unless people fix the resource stuff this change cannot be reverted. > >> > >> After the resource fix has gone in, I still object to this being > >> reverted on grounds of gratuitous code bloat. I say this with ARM, > >> MIPS and PowerPC/Book-E in mind. > >> > > > > You didn't remove anything, you merely toggled the setting of a variable. > > Code bloat is a non-argument in that case. Could you care to provide details > > on the resource issue you are encountering? I don't see any obvious resource > > leaks, etc. in the current set of changes. > > > > > The real problem in this case is that the > bus_(deactivate|release)_resource methods are not implemented on several > PCI bus drivers on PowerPC (e.g. uninorth, where this problem arose). Up > until now, I guess it has never mattered. Ahh, ok. I'm fine with having it off for those architectures that can't yet handle it with the hope they will be fixed. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 18:32:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93EBF10656A4; Mon, 26 Oct 2009 18:32:06 +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 8307D8FC1B; Mon, 26 Oct 2009 18:32: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 n9QIW6lW097772; Mon, 26 Oct 2009 18:32:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QIW6In097770; Mon, 26 Oct 2009 18:32:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200910261832.n9QIW6In097770@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Oct 2009 18:32: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: r198495 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 18:32:06 -0000 Author: jhb Date: Mon Oct 26 18:32:06 2009 New Revision: 198495 URL: http://svn.freebsd.org/changeset/base/198495 Log: Another nit that both I and ispell missed. Submitted by: Ben Kaduk minimarmot of gmail Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Oct 26 18:02:05 2009 (r198494) +++ head/sys/kern/kern_cpuset.c Mon Oct 26 18:32:06 2009 (r198495) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); * Modifying a pid or tid's mask applies only to that tid but must still * exist within the assigned parent set. * - * A thread may not be assigned to a a group separate from other threads in + * A thread may not be assigned to a group separate from other threads in * the process. This is to remove ambiguity when the setid is queried with * a pid argument. There is no other technical limitation. * From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 18:57:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9486106566B; Mon, 26 Oct 2009 18:57:57 +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 D3ACE8FC18; Mon, 26 Oct 2009 18:57: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 n9QIvvxQ000117; Mon, 26 Oct 2009 18:57:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QIvvcZ000107; Mon, 26 Oct 2009 18:57:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200910261857.n9QIvvcZ000107@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Oct 2009 18:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198496 - in stable/7: etc etc/mtree include sys sys/contrib/pf sys/dev/mfi usr.sbin usr.sbin/acpi usr.sbin/adduser usr.sbin/arp usr.sbin/bluetooth usr.sbin/bluetooth/btpand usr.sbin/bl... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 18:57:58 -0000 Author: jhb Date: Mon Oct 26 18:57:57 2009 New Revision: 198496 URL: http://svn.freebsd.org/changeset/base/198496 Log: MFC 196200,196211,196280-196282: Introduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6 controllers. Controller, array, and drive status can be checked, basic attributes can be changed, and arrays and spares can be created and deleted. Controller firmware can also be flashed. This does not replace MegaCLI, found in ports, as that is officially sanctioned and supported by LSI and includes vastly more functionality. However, mfiutil is open source and guaranteed to provide basic functionality, which can be especially useful if you have a problem and can't get MegaCLI to work. Added: stable/7/usr.sbin/mfiutil/ (props changed) - copied from r196200, head/usr.sbin/mfiutil/ stable/7/usr.sbin/mfiutil/mfiutil.8 (contents, props changed) - copied, changed from r196280, head/usr.sbin/mfiutil/mfiutil.8 Modified: stable/7/etc/ (props changed) stable/7/etc/mtree/BSD.include.dist stable/7/etc/termcap.small (props changed) stable/7/include/ (props changed) stable/7/include/Makefile stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/mfi/mfi_ioctl.h stable/7/sys/dev/mfi/mfireg.h stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/Makefile stable/7/usr.sbin/acpi/ (props changed) stable/7/usr.sbin/adduser/ (props changed) stable/7/usr.sbin/arp/ (props changed) stable/7/usr.sbin/bluetooth/ (props changed) stable/7/usr.sbin/bluetooth/btpand/ (props changed) stable/7/usr.sbin/bluetooth/hcsecd/ (props changed) stable/7/usr.sbin/bluetooth/hcseriald/ (props changed) stable/7/usr.sbin/bluetooth/rfcomm_pppd/ (props changed) stable/7/usr.sbin/bluetooth/sdpd/ (props changed) stable/7/usr.sbin/bsnmpd/modules/snmp_pf/ (props changed) stable/7/usr.sbin/burncd/ (props changed) stable/7/usr.sbin/cdcontrol/ (props changed) stable/7/usr.sbin/chown/ (props changed) stable/7/usr.sbin/chroot/ (props changed) stable/7/usr.sbin/config/ (props changed) stable/7/usr.sbin/cpucontrol/ (props changed) stable/7/usr.sbin/crashinfo/ (props changed) stable/7/usr.sbin/cron/ (props changed) stable/7/usr.sbin/cron/cron/ (props changed) stable/7/usr.sbin/crunch/ (props changed) stable/7/usr.sbin/eeprom/ (props changed) stable/7/usr.sbin/extattr/ (props changed) stable/7/usr.sbin/fdcontrol/ (props changed) stable/7/usr.sbin/fdformat/ (props changed) stable/7/usr.sbin/fdread/ (props changed) stable/7/usr.sbin/fdwrite/ (props changed) stable/7/usr.sbin/freebsd-update/ (props changed) stable/7/usr.sbin/fwcontrol/ (props changed) stable/7/usr.sbin/gstat/ (props changed) stable/7/usr.sbin/iostat/ (props changed) stable/7/usr.sbin/jail/ (props changed) stable/7/usr.sbin/jexec/ (props changed) stable/7/usr.sbin/jls/ (props changed) stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/makefs/ (props changed) stable/7/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/7/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/7/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/7/usr.sbin/makefs/getid.c (props changed) stable/7/usr.sbin/mergemaster/ (props changed) stable/7/usr.sbin/mfiutil/Makefile stable/7/usr.sbin/mfiutil/mfi_drive.c stable/7/usr.sbin/mountd/ (props changed) stable/7/usr.sbin/mtree/ (props changed) stable/7/usr.sbin/ndiscvt/ (props changed) stable/7/usr.sbin/newsyslog/newsyslog.conf.5 (props changed) stable/7/usr.sbin/nscd/ (props changed) stable/7/usr.sbin/ntp/ (props changed) stable/7/usr.sbin/pciconf/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) stable/7/usr.sbin/pmcstat/ (props changed) stable/7/usr.sbin/portsnap/ (props changed) stable/7/usr.sbin/powerd/ (props changed) stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/pstat/ (props changed) stable/7/usr.sbin/pw/ (props changed) stable/7/usr.sbin/pwd_mkdb/ (props changed) stable/7/usr.sbin/rpc.lockd/ (props changed) stable/7/usr.sbin/rpc.statd/ (props changed) stable/7/usr.sbin/rpc.yppasswdd/ (props changed) stable/7/usr.sbin/sade/ (props changed) stable/7/usr.sbin/setfib/ (props changed) stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/syslogd/ (props changed) stable/7/usr.sbin/traceroute/ (props changed) stable/7/usr.sbin/traceroute6/ (props changed) stable/7/usr.sbin/tzsetup/ (props changed) stable/7/usr.sbin/wpa/wpa_supplicant/ (props changed) stable/7/usr.sbin/ypserv/ (props changed) stable/7/usr.sbin/zic/ (props changed) Modified: stable/7/etc/mtree/BSD.include.dist ============================================================================== --- stable/7/etc/mtree/BSD.include.dist Mon Oct 26 18:32:06 2009 (r198495) +++ stable/7/etc/mtree/BSD.include.dist Mon Oct 26 18:57:57 2009 (r198496) @@ -102,6 +102,8 @@ .. lmc .. + mfi + .. mpt mpilib .. Modified: stable/7/include/Makefile ============================================================================== --- stable/7/include/Makefile Mon Oct 26 18:32:06 2009 (r198495) +++ stable/7/include/Makefile Mon Oct 26 18:57:57 2009 (r198496) @@ -43,7 +43,7 @@ LDIRS= bsm cam geom net net80211 netatal LSUBDIRS= cam/scsi \ dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \ - dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \ + dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi dev/ofw \ dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \ Modified: stable/7/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- stable/7/sys/dev/mfi/mfi_ioctl.h Mon Oct 26 18:32:06 2009 (r198495) +++ stable/7/sys/dev/mfi/mfi_ioctl.h Mon Oct 26 18:57:57 2009 (r198496) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */ struct iovec32 { u_int32_t iov_base; Modified: stable/7/sys/dev/mfi/mfireg.h ============================================================================== --- stable/7/sys/dev/mfi/mfireg.h Mon Oct 26 18:32:06 2009 (r198495) +++ stable/7/sys/dev/mfi/mfireg.h Mon Oct 26 18:57:57 2009 (r198496) @@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$"); #define MFI_ODCR0 0xa0 /* outbound doorbell clear register0 */ #define MFI_OSP0 0xb0 /* outbound scratch pad0 */ #define MFI_1078_EIM 0x80000004 /* 1078 enable intrrupt mask */ -#define MFI_RMI 0x2 /* reply message interrupt */ +#define MFI_RMI 0x2 /* reply message interrupt */ #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ @@ -151,15 +151,41 @@ typedef enum { MFI_DCMD_CTRL_EVENT_GETINFO = 0x01040100, MFI_DCMD_CTRL_EVENT_GET = 0x01040300, MFI_DCMD_CTRL_EVENT_WAIT = 0x01040500, + MFI_DCMD_PR_GET_STATUS = 0x01070100, + MFI_DCMD_PR_GET_PROPERTIES = 0x01070200, + MFI_DCMD_PR_SET_PROPERTIES = 0x01070300, + MFI_DCMD_PR_START = 0x01070400, + MFI_DCMD_PR_STOP = 0x01070500, + MFI_DCMD_TIME_SECS_GET = 0x01080201, + MFI_DCMD_FLASH_FW_OPEN = 0x010f0100, + MFI_DCMD_FLASH_FW_DOWNLOAD = 0x010f0200, + MFI_DCMD_FLASH_FW_FLASH = 0x010f0300, + MFI_DCMD_FLASH_FW_CLOSE = 0x010f0400, + MFI_DCMD_PD_GET_LIST = 0x02010000, + MFI_DCMD_PD_GET_INFO = 0x02020000, + MFI_DCMD_PD_STATE_SET = 0x02030100, + MFI_DCMD_PD_REBUILD_START = 0x02040100, + MFI_DCMD_PD_REBUILD_ABORT = 0x02040200, + MFI_DCMD_PD_CLEAR_START = 0x02050100, + MFI_DCMD_PD_CLEAR_ABORT = 0x02050200, + MFI_DCMD_PD_GET_PROGRESS = 0x02060000, + MFI_DCMD_PD_LOCATE_START = 0x02070100, + MFI_DCMD_PD_LOCATE_STOP = 0x02070200, MFI_DCMD_LD_GET_LIST = 0x03010000, MFI_DCMD_LD_GET_INFO = 0x03020000, MFI_DCMD_LD_GET_PROP = 0x03030000, MFI_DCMD_LD_SET_PROP = 0x03040000, + MFI_DCMD_LD_INIT_START = 0x03060100, MFI_DCMD_LD_DELETE = 0x03090000, MFI_DCMD_CFG_READ = 0x04010000, MFI_DCMD_CFG_ADD = 0x04020000, MFI_DCMD_CFG_CLEAR = 0x04030000, + MFI_DCMD_CFG_MAKE_SPARE = 0x04040000, + MFI_DCMD_CFG_REMOVE_SPARE = 0x04050000, MFI_DCMD_CFG_FOREIGN_IMPORT = 0x04060400, + MFI_DCMD_BBU_GET_STATUS = 0x05010000, + MFI_DCMD_BBU_GET_CAPACITY_INFO =0x05020000, + MFI_DCMD_BBU_GET_DESIGN_INFO = 0x05030000, MFI_DCMD_CLUSTER = 0x08000000, MFI_DCMD_CLUSTER_RESET_ALL = 0x08010100, MFI_DCMD_CLUSTER_RESET_LD = 0x08010200 @@ -245,6 +271,9 @@ typedef enum { MFI_STAT_RESERVATION_IN_PROGRESS, MFI_STAT_I2C_ERRORS_DETECTED, MFI_STAT_PCI_ERRORS_DETECTED, + MFI_STAT_DIAG_FAILED, + MFI_STAT_BOOT_MSG_PENDING, + MFI_STAT_FOREIGN_CONFIG_INCOMPLETE, MFI_STAT_INVALID_STATUS = 0xFF } mfi_status_t; @@ -303,6 +332,17 @@ typedef enum { MR_LD_CACHE_ALLOW_WRITE_CACHE = 0x20, MR_LD_CACHE_ALLOW_READ_CACHE = 0x40 } mfi_ld_cache; +#define MR_LD_CACHE_MASK 0x7f + +#define MR_LD_CACHE_POLICY_READ_AHEAD_NONE 0 +#define MR_LD_CACHE_POLICY_READ_AHEAD_ALWAYS MR_LD_CACHE_READ_AHEAD +#define MR_LD_CACHE_POLICY_READ_AHEAD_ADAPTIVE \ + (MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE) +#define MR_LD_CACHE_POLICY_WRITE_THROUGH 0 +#define MR_LD_CACHE_POLICY_WRITE_BACK MR_LD_CACHE_WRITE_BACK +#define MR_LD_CACHE_POLICY_IO_CACHED \ + (MR_LD_CACHE_ALLOW_WRITE_CACHE | MR_LD_CACHE_ALLOW_READ_CACHE) +#define MR_LD_CACHE_POLICY_IO_DIRECT 0 typedef enum { MR_PD_CACHE_UNCHANGED = 0, @@ -320,6 +360,7 @@ typedef enum { #define MFI_DEFAULT_ID -1 #define MFI_MAX_LUN 8 #define MFI_MAX_LD 64 +#define MFI_MAX_PD 256 #define MFI_FRAME_SIZE 64 #define MFI_MBOX_SIZE 12 @@ -866,12 +907,10 @@ union mfi_pd_ddf_type { } __packed; struct mfi_pd_progress { - struct { - uint32_t rbld : 1; - uint32_t patrol : 1; - uint32_t clear : 1; - uint32_t reserved: 29; - } active; + uint32_t active; +#define MFI_PD_PROGRESS_REBUILD (1<<0) +#define MFI_PD_PROGRESS_PATROL (1<<1) +#define MFI_PD_PROGRESS_CLEAR (1<<2) struct mfi_progress rbld; struct mfi_progress patrol; struct mfi_progress clear; @@ -890,8 +929,8 @@ struct mfi_pd_info { uint32_t other_err_count; uint32_t pred_fail_count; uint32_t last_pred_fail_event_seq_num; - uint16_t fw_state; - uint8_t disable_for_removal; + uint16_t fw_state; /* MFI_PD_STATE_* */ + uint8_t disabled_for_removal; uint8_t link_speed; union mfi_pd_ddf_type state; struct { @@ -918,7 +957,7 @@ struct mfi_pd_address { uint16_t encl_device_id; uint8_t encl_index; uint8_t slot_number; - uint8_t scsi_dev_type; + uint8_t scsi_dev_type; /* 0 = disk */ uint8_t connect_port_bitmap; uint64_t sas_addr[2]; } __packed; @@ -926,12 +965,19 @@ struct mfi_pd_address { struct mfi_pd_list { uint32_t size; uint32_t count; - uint8_t data; - /* - struct mfi_pd_address addr[]; - */ + struct mfi_pd_address addr[0]; } __packed; +enum mfi_pd_state { + MFI_PD_STATE_UNCONFIGURED_GOOD = 0x00, + MFI_PD_STATE_UNCONFIGURED_BAD = 0x01, + MFI_PD_STATE_HOT_SPARE = 0x02, + MFI_PD_STATE_OFFLINE = 0x10, + MFI_PD_STATE_FAILED = 0x11, + MFI_PD_STATE_REBUILD = 0x14, + MFI_PD_STATE_ONLINE = 0x18 +}; + union mfi_ld_ref { struct { uint8_t target_id; @@ -986,6 +1032,9 @@ struct mfi_ld_params { uint8_t span_depth; uint8_t state; uint8_t init_state; +#define MFI_LD_PARAMS_INIT_NO 0 +#define MFI_LD_PARAMS_INIT_QUICK 1 +#define MFI_LD_PARAMS_INIT_FULL 2 uint8_t is_consistent; uint8_t reserved[23]; } __packed; @@ -995,7 +1044,7 @@ struct mfi_ld_progress { #define MFI_LD_PROGRESS_CC (1<<0) #define MFI_LD_PROGRESS_BGI (1<<1) #define MFI_LD_PROGRESS_FGI (1<<2) -#define MFI_LD_PORGRESS_RECON (1<<3) +#define MFI_LD_PROGRESS_RECON (1<<3) struct mfi_progress cc; struct mfi_progress bgi; struct mfi_progress fgi; @@ -1028,26 +1077,18 @@ struct mfi_ld_info { uint8_t reserved2[16]; } __packed; -union mfi_spare_type { - struct { - uint8_t is_dedicate :1; - uint8_t is_revertable :1; - uint8_t is_encl_affinity :1; - uint8_t reserved :5; - } v; - uint8_t type; -} __packed; - #define MAX_ARRAYS 16 struct mfi_spare { union mfi_pd_ref ref; - union mfi_spare_type spare_type; + uint8_t spare_type; +#define MFI_SPARE_DEDICATED (1 << 0) +#define MFI_SPARE_REVERTIBLE (1 << 1) +#define MFI_SPARE_ENCL_AFFINITY (1 << 2) uint8_t reserved[2]; uint8_t array_count; - uint16_t array_refd[MAX_ARRAYS]; + uint16_t array_ref[MAX_ARRAYS]; } __packed; -#define MAX_ROW_SIZE 32 struct mfi_array { uint64_t size; uint8_t num_drives; @@ -1055,13 +1096,13 @@ struct mfi_array { uint16_t array_ref; uint8_t pad[20]; struct { - union mfi_pd_ref ref; - uint16_t fw_state; + union mfi_pd_ref ref; /* 0xffff == missing drive */ + uint16_t fw_state; /* MFI_PD_STATE_* */ struct { uint8_t pd; uint8_t slot; } encl; - } pd[MAX_ROW_SIZE]; + } pd[0]; } __packed; struct mfi_config_data { @@ -1073,13 +1114,117 @@ struct mfi_config_data { uint16_t spares_count; uint16_t spares_size; uint8_t reserved[16]; - uint8_t data; - /* - struct mfi_array array[]; - struct mfi_ld_config ld[]; - struct mfi_spare spare[]; - */ -} __packed; + struct mfi_array array[0]; + struct mfi_ld_config ld[0]; + struct mfi_spare spare[0]; +} __packed; + +struct mfi_bbu_capacity_info { + uint16_t relative_charge; + uint16_t absolute_charge; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint16_t run_time_to_empty; + uint16_t average_time_to_empty; + uint16_t average_time_to_full; + uint16_t cycle_count; + uint16_t max_error; + uint16_t remaining_capacity_alarm; + uint16_t remaining_time_alarm; + uint8_t reserved[26]; +} __packed; + +struct mfi_bbu_design_info { + uint32_t mfg_date; + uint16_t design_capacity; + uint16_t design_voltage; + uint16_t spec_info; + uint16_t serial_number; + uint16_t pack_stat_config; + uint8_t mfg_name[12]; + uint8_t device_name[8]; + uint8_t device_chemistry[8]; + uint8_t mfg_data[8]; + uint8_t reserved[17]; +} __packed; + +struct mfi_ibbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_system_state; + uint16_t charger_system_ctrl; + uint16_t charging_current; + uint16_t absolute_charge; + uint16_t max_error; + uint8_t reserved[18]; +} __packed; + +struct mfi_bbu_state { + uint16_t gas_guage_status; + uint16_t relative_charge; + uint16_t charger_status; + uint16_t remaining_capacity; + uint16_t full_charge_capacity; + uint8_t is_SOH_good; + uint8_t reserved[21]; +} __packed; + +union mfi_bbu_status_detail { + struct mfi_ibbu_state ibbu; + struct mfi_bbu_state bbu; +}; + +struct mfi_bbu_status { + uint8_t battery_type; +#define MFI_BBU_TYPE_NONE 0 +#define MFI_BBU_TYPE_IBBU 1 +#define MFI_BBU_TYPE_BBU 2 + uint8_t reserved; + uint16_t voltage; + int16_t current; + uint16_t temperature; + uint32_t fw_status; +#define MFI_BBU_STATE_PACK_MISSING (1 << 0) +#define MFI_BBU_STATE_VOLTAGE_LOW (1 << 1) +#define MFI_BBU_STATE_TEMPERATURE_HIGH (1 << 2) +#define MFI_BBU_STATE_CHARGE_ACTIVE (1 << 0) +#define MFI_BBU_STATE_DISCHARGE_ACTIVE (1 << 0) + uint8_t pad[20]; + union mfi_bbu_status_detail detail; +} __packed; + +enum mfi_pr_state { + MFI_PR_STATE_STOPPED = 0, + MFI_PR_STATE_READY = 1, + MFI_PR_STATE_ACTIVE = 2, + MFI_PR_STATE_ABORTED = 0xff +}; + +struct mfi_pr_status { + uint32_t num_iteration; + uint8_t state; + uint8_t num_pd_done; + uint8_t reserved[10]; +}; + +enum mfi_pr_opmode { + MFI_PR_OPMODE_AUTO = 0, + MFI_PR_OPMODE_MANUAL = 1, + MFI_PR_OPMODE_DISABLED = 2 +}; + +struct mfi_pr_properties { + uint8_t op_mode; + uint8_t max_pd; + uint8_t reserved; + uint8_t exclude_ld_count; + uint16_t excluded_ld[MFI_MAX_LD]; + uint8_t cur_pd_map[MFI_MAX_PD / 8]; + uint8_t last_pd_map[MFI_MAX_PD / 8]; + uint32_t next_exec; + uint32_t exec_freq; + uint32_t clear_freq; +}; #define MFI_SCSI_MAX_TARGETS 128 #define MFI_SCSI_MAX_LUNS 8 Modified: stable/7/usr.sbin/Makefile ============================================================================== --- stable/7/usr.sbin/Makefile Mon Oct 26 18:32:06 2009 (r198495) +++ stable/7/usr.sbin/Makefile Mon Oct 26 18:57:57 2009 (r198496) @@ -91,6 +91,7 @@ SUBDIR= ${_ac} \ manctl \ memcontrol \ mergemaster \ + mfiutil \ mixer \ ${_mld6query} \ mlxcontrol \ Modified: stable/7/usr.sbin/mfiutil/Makefile ============================================================================== --- head/usr.sbin/mfiutil/Makefile Thu Aug 13 23:18:45 2009 (r196200) +++ stable/7/usr.sbin/mfiutil/Makefile Mon Oct 26 18:57:57 2009 (r198496) @@ -3,6 +3,7 @@ PROG= mfiutil SRCS= mfiutil.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c mfi_flash.c \ mfi_patrol.c mfi_show.c mfi_volume.c +MAN8= mfiutil.8 CFLAGS+= -fno-builtin-strftime WARNS?=3 Modified: stable/7/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_drive.c Thu Aug 13 23:18:45 2009 (r196200) +++ stable/7/usr.sbin/mfiutil/mfi_drive.c Mon Oct 26 18:57:57 2009 (r198496) @@ -75,8 +75,9 @@ int mfi_lookup_drive(int fd, char *drive, uint16_t *device_id) { struct mfi_pd_list *list; - long val; uint8_t encl, slot; + long val; + u_int i; char *cp; /* Look for a raw device id first. */ @@ -117,15 +118,15 @@ mfi_lookup_drive(int fd, char *drive, ui return (errno); } - for (val = 0; val < list->count; val++) { - if (list->addr[val].scsi_dev_type != 0) + for (i = 0; i < list->count; i++) { + if (list->addr[i].scsi_dev_type != 0) continue; if (((encl == 0xff && - list->addr[val].encl_device_id == 0xffff) || - list->addr[val].encl_index == encl) && - list->addr[val].slot_number == slot) { - *device_id = list->addr[val].device_id; + list->addr[i].encl_device_id == 0xffff) || + list->addr[i].encl_index == encl) && + list->addr[i].slot_number == slot) { + *device_id = list->addr[i].device_id; free(list); return (0); } Copied and modified: stable/7/usr.sbin/mfiutil/mfiutil.8 (from r196280, head/usr.sbin/mfiutil/mfiutil.8) ============================================================================== --- head/usr.sbin/mfiutil/mfiutil.8 Mon Aug 17 06:05:55 2009 (r196280, copy source) +++ stable/7/usr.sbin/mfiutil/mfiutil.8 Mon Oct 26 18:57:57 2009 (r198496) @@ -27,8 +27,8 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2008 -.Dt MFIUTIL 1 +.Dd August 16, 2009 +.Dt MFIUTIL 8 .Os .Sh NAME .Nm mfiutil @@ -161,9 +161,6 @@ on the volume may be specified by the co device, such as .Em mfid0 . -Note that this second method only works on OS versions -.Dv 6.2-YAHOO-20070510 -and later. .Pp Drives may be specified in two forms. First, @@ -562,13 +559,8 @@ patrol read starting in 5 minutes: .Pp .Sh SEE ALSO .Xr mfi 4 -.Sh BUGS -On 64-bit OS versions -.Dv 6.2-YAHOO-20070514 -and earlier, -the -.Xr mfi 4 -driver does not properly report firmware errors to 32-bit versions of -.Nm . -As a result, -some commands may fail even though they do not report any errors. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 19:06:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 499DE1065676; Mon, 26 Oct 2009 19:06:06 +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 E7C5D8FC1B; Mon, 26 Oct 2009 19:06: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 n9QJ65fh000809; Mon, 26 Oct 2009 19:06:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QJ65Io000806; Mon, 26 Oct 2009 19:06:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200910261906.n9QJ65Io000806@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Oct 2009 19:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198497 - in stable/7/usr.sbin: . acpi adduser arp bluetooth bluetooth/btpand bluetooth/hcsecd bluetooth/hcseriald bluetooth/rfcomm_pppd bluetooth/sdpd bsnmpd/modules/snmp_pf burncd cdc... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 19:06:06 -0000 Author: jhb Date: Mon Oct 26 19:06:05 2009 New Revision: 198497 URL: http://svn.freebsd.org/changeset/base/198497 Log: MFC 196212,196283: Add mptutil, a basic utility for managing MPT SCSI/SATA/SAS controllers. Drive and controller status can be reported, basic attributes changed, and arrays and spares can be created and deleted. Added: stable/7/usr.sbin/mptutil/ (props changed) - copied from r196212, head/usr.sbin/mptutil/ Modified: stable/7/usr.sbin/ (props changed) stable/7/usr.sbin/Makefile stable/7/usr.sbin/acpi/ (props changed) stable/7/usr.sbin/adduser/ (props changed) stable/7/usr.sbin/arp/ (props changed) stable/7/usr.sbin/bluetooth/ (props changed) stable/7/usr.sbin/bluetooth/btpand/ (props changed) stable/7/usr.sbin/bluetooth/hcsecd/ (props changed) stable/7/usr.sbin/bluetooth/hcseriald/ (props changed) stable/7/usr.sbin/bluetooth/rfcomm_pppd/ (props changed) stable/7/usr.sbin/bluetooth/sdpd/ (props changed) stable/7/usr.sbin/bsnmpd/modules/snmp_pf/ (props changed) stable/7/usr.sbin/burncd/ (props changed) stable/7/usr.sbin/cdcontrol/ (props changed) stable/7/usr.sbin/chown/ (props changed) stable/7/usr.sbin/chroot/ (props changed) stable/7/usr.sbin/config/ (props changed) stable/7/usr.sbin/cpucontrol/ (props changed) stable/7/usr.sbin/crashinfo/ (props changed) stable/7/usr.sbin/cron/ (props changed) stable/7/usr.sbin/cron/cron/ (props changed) stable/7/usr.sbin/crunch/ (props changed) stable/7/usr.sbin/eeprom/ (props changed) stable/7/usr.sbin/extattr/ (props changed) stable/7/usr.sbin/fdcontrol/ (props changed) stable/7/usr.sbin/fdformat/ (props changed) stable/7/usr.sbin/fdread/ (props changed) stable/7/usr.sbin/fdwrite/ (props changed) stable/7/usr.sbin/freebsd-update/ (props changed) stable/7/usr.sbin/fwcontrol/ (props changed) stable/7/usr.sbin/gstat/ (props changed) stable/7/usr.sbin/iostat/ (props changed) stable/7/usr.sbin/jail/ (props changed) stable/7/usr.sbin/jexec/ (props changed) stable/7/usr.sbin/jls/ (props changed) stable/7/usr.sbin/lpr/ (props changed) stable/7/usr.sbin/makefs/ (props changed) stable/7/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/7/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/7/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/7/usr.sbin/makefs/getid.c (props changed) stable/7/usr.sbin/mergemaster/ (props changed) stable/7/usr.sbin/mfiutil/ (props changed) stable/7/usr.sbin/mfiutil/mfiutil.8 (props changed) stable/7/usr.sbin/mountd/ (props changed) stable/7/usr.sbin/mptutil/mptutil.8 stable/7/usr.sbin/mtree/ (props changed) stable/7/usr.sbin/ndiscvt/ (props changed) stable/7/usr.sbin/newsyslog/newsyslog.conf.5 (props changed) stable/7/usr.sbin/nscd/ (props changed) stable/7/usr.sbin/ntp/ (props changed) stable/7/usr.sbin/pciconf/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) stable/7/usr.sbin/pmcstat/ (props changed) stable/7/usr.sbin/portsnap/ (props changed) stable/7/usr.sbin/powerd/ (props changed) stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/pstat/ (props changed) stable/7/usr.sbin/pw/ (props changed) stable/7/usr.sbin/pwd_mkdb/ (props changed) stable/7/usr.sbin/rpc.lockd/ (props changed) stable/7/usr.sbin/rpc.statd/ (props changed) stable/7/usr.sbin/rpc.yppasswdd/ (props changed) stable/7/usr.sbin/sade/ (props changed) stable/7/usr.sbin/setfib/ (props changed) stable/7/usr.sbin/sysinstall/ (props changed) stable/7/usr.sbin/syslogd/ (props changed) stable/7/usr.sbin/traceroute/ (props changed) stable/7/usr.sbin/traceroute6/ (props changed) stable/7/usr.sbin/tzsetup/ (props changed) stable/7/usr.sbin/wpa/wpa_supplicant/ (props changed) stable/7/usr.sbin/ypserv/ (props changed) stable/7/usr.sbin/zic/ (props changed) Modified: stable/7/usr.sbin/Makefile ============================================================================== --- stable/7/usr.sbin/Makefile Mon Oct 26 18:57:57 2009 (r198496) +++ stable/7/usr.sbin/Makefile Mon Oct 26 19:06:05 2009 (r198497) @@ -101,6 +101,7 @@ SUBDIR= ${_ac} \ ${_mount_smbfs} \ ${_moused} \ ${_mptable} \ + mptutil \ mtest \ mtree \ ${_named} \ Modified: stable/7/usr.sbin/mptutil/mptutil.8 ============================================================================== --- head/usr.sbin/mptutil/mptutil.8 Fri Aug 14 13:13:12 2009 (r196212) +++ stable/7/usr.sbin/mptutil/mptutil.8 Mon Oct 26 19:06:05 2009 (r198497) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2008 +.Dd August 16, 2009 .Dt MPTUTIL 8 .Os .Sh NAME @@ -349,8 +349,6 @@ as a global hot spare: .Sh SEE ALSO .Xr mpt 4 .Sh BUGS -Deleting volumes usually provokes a kernel crash in OS versions older than -.Dv 6.3-YAHOO-20080722 . .Pp The handling of spare drives appears to be unreliable. The @@ -381,3 +379,8 @@ configurations may not work reliably. .Pp Drive configuration commands result in an excessive flood of messages on the console. +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 8.0 . From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 19:10:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 264CF106566B; Mon, 26 Oct 2009 19:10:55 +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 F005E8FC1C; Mon, 26 Oct 2009 19:10: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 n9QJAsgb001250; Mon, 26 Oct 2009 19:10:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QJAsPE001249; Mon, 26 Oct 2009 19:10:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200910261910.n9QJAsPE001249@svn.freebsd.org> From: John Baldwin Date: Mon, 26 Oct 2009 19:10: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: r198498 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 19:10:55 -0000 Author: jhb Date: Mon Oct 26 19:10:54 2009 New Revision: 198498 URL: http://svn.freebsd.org/changeset/base/198498 Log: Trim empty mergeinfo. Modified: head/usr.sbin/mfiutil/mfiutil.8 (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 19:21:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8827106566C; Mon, 26 Oct 2009 19:21:14 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-bw0-f209.google.com (mail-bw0-f209.google.com [209.85.218.209]) by mx1.freebsd.org (Postfix) with ESMTP id E83E48FC24; Mon, 26 Oct 2009 19:21:13 +0000 (UTC) Received: by bwz1 with SMTP id 1so2707546bwz.13 for ; Mon, 26 Oct 2009 12:21:12 -0700 (PDT) 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=kv3WhDxXkF/G1FZqZSw8VstblGV6rptZB9LmV3yfXME=; b=w5dRW5i3qadXKYc+r/QOLc6fosgcCUaVSHgTP50P7x+buonBz4o+EhraKBJShh1210 vFYqopZ+NjEzkY8uP5ucyYwrTx09ZmYRN9ED6fbMdORyc5j6q6m99bTHARtwVxf76t+H Xod83WsJMuSOAK7cMh8ZzoZzH9WJQb4n9HSAE= 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=TN91+75UTX6vCeEGGidDed77/847i1hlz+BsqcJiMxkN3slZLX7Na0NSI7301qqi8z bY3CtwNNdUNsBtgknD4wSlgK87WaXJ0N+bLDkGKg1ZlcktkMcz1dRq7BJ/+2taeDixfY IRtxhTR4D2W38dL2nTE83IX7L+kJdElZMQCks= MIME-Version: 1.0 Received: by 10.204.33.7 with SMTP id f7mr4687916bkd.123.1256584872296; Mon, 26 Oct 2009 12:21:12 -0700 (PDT) In-Reply-To: <200910261857.n9QIvvcZ000107@svn.freebsd.org> References: <200910261857.n9QIvvcZ000107@svn.freebsd.org> Date: Mon, 26 Oct 2009 22:21:10 +0300 Message-ID: From: pluknet To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r198496 - in stable/7: etc etc/mtree include sys sys/contrib/pf sys/dev/mfi usr.sbin usr.sbin/acpi usr.sbin/adduser usr.sbin/arp usr.sbin/bluetooth usr.sbin/bluetooth/btpand usr.sbin/bl... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 19:21:14 -0000 2009/10/26 John Baldwin : > Author: jhb > Date: Mon Oct 26 18:57:57 2009 > New Revision: 198496 > URL: http://svn.freebsd.org/changeset/base/198496 > > Log: > =A0MFC 196200,196211,196280-196282: > =A0Introduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PE= RC5/6 > =A0controllers. =A0Controller, array, and drive status can be checked, ba= sic > =A0attributes can be changed, and arrays and spares can be created and de= leted. > =A0Controller firmware can also be flashed. > > =A0This does not replace MegaCLI, found in ports, as that is officially s= anctioned > =A0and supported by LSI and includes vastly more functionality. =A0Howeve= r, mfiutil > =A0is open source and guaranteed to provide basic functionality, which ca= n be > =A0especially useful if you have a problem and can't get MegaCLI to work. > John, thank you very much for mfc'ing those nice mfi- and mptutil! It's interesting to know if this can be mfc'ed to 6 safely in principle, without breaking some of existing interfaces. I tried to use both on 6, and my experience was quite successful. > +.Sh HISTORY > +The > +.Nm > +utility first appeared in > +.Fx 8.0 . Please don't forget to change it to 7.3. Thank you again! --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 19:23:35 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62A9B1065679; Mon, 26 Oct 2009 19:23:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 517928FC15; Mon, 26 Oct 2009 19:23: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 n9QJNYoA002422; Mon, 26 Oct 2009 19:23:34 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QJNYop002420; Mon, 26 Oct 2009 19:23:34 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200910261923.n9QJNYop002420@svn.freebsd.org> From: Michael Tuexen Date: Mon, 26 Oct 2009 19:23: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: r198499 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 19:23:35 -0000 Author: tuexen Date: Mon Oct 26 19:23:34 2009 New Revision: 198499 URL: http://svn.freebsd.org/changeset/base/198499 Log: Improve the round robin stream scheduler. Approved by: rrs (mentor) MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Mon Oct 26 19:10:54 2009 (r198498) +++ head/sys/netinet/sctp_output.c Mon Oct 26 19:23:34 2009 (r198499) @@ -7169,20 +7169,14 @@ sctp_select_a_stream(struct sctp_tcb *st /* Find the next stream to use */ if (asoc->last_out_stream == NULL) { - strq = asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel); - if (asoc->last_out_stream == NULL) { - /* huh nothing on the wheel, TSNH */ - return (NULL); - } - goto done_it; - } - strq = TAILQ_NEXT(asoc->last_out_stream, next_spoke); -done_it: - if (strq == NULL) { - strq = asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel); + strq = TAILQ_FIRST(&asoc->out_wheel); + } else { + strq = TAILQ_NEXT(asoc->last_out_stream, next_spoke); + if (strq == NULL) { + strq = TAILQ_FIRST(&asoc->out_wheel); + } } return (strq); - } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 20:11:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8627A106566B; Mon, 26 Oct 2009 20:11:18 +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 E609F8FC1D; Mon, 26 Oct 2009 20:11:17 +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 n9QKBGY5095749; Mon, 26 Oct 2009 21:11:16 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n9QKBGAO095748; Mon, 26 Oct 2009 21:11:16 +0100 (CET) (envelope-from marius) Date: Mon, 26 Oct 2009 21:11:16 +0100 From: Marius Strobl To: Marcel Moolenaar Message-ID: <20091026201116.GS27159@alchemy.franken.de> References: <200910211838.n9LIc2wp007206@svn.freebsd.org> <20091025202541.GC94979@alchemy.franken.de> <36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com> 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: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 20:11:18 -0000 On Sun, Oct 25, 2009 at 02:37:40PM -0700, Marcel Moolenaar wrote: > > On Oct 25, 2009, at 1:25 PM, Marius Strobl wrote: > > > >Do you have a simple test case demonstrating the need for > >I-cache synchronisation? > > I typically use GDB. If breakpoints aren't being hit or > next isn't behaving correctly, you typically have an > I-cache problem. If you get to run GDB, you probably > already know whether it's needed, because processes > tend to die with random signals at startup when the > architecture needs explicit I-cache coherency logic > and the kernel doesn't have it. A special case I would > say is executing from a memory disk. The I/O path > contains bcopy() operations, which dirty the D-cache > and trigger I-cache coherency bugs pretty well. > > I didn't have issues with that on my Netra, so I didn't > implement pmap_sync_icache for sparc64. This is not to > say that it's absolutely not needed, just that GDB didn't > expose problems. If sparc64 has some of the same kluges > powerpc had, then I-cache coherency is handled in some > other (most likely a sub-optimal) way. > The cheetah-class CPUs, i.e. USIII and later, take care of I$ coherency themselves, unlike the spitfire ones (see also cheetah_icache_page_inval() vs. spitfire_icache_page_inval()). So your Netra 20/T4 shouldn't exhibit such problems while spitfire-based machines likely require the I$ to be flushed. I currently can't think of any existing code which would ensure I$ consistency after the writes have been performed, not even as a side-effect. The proper solution probalby is to make pmap_sync_icache() a wrapper around icache_page_inval(). Marius From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 20:23:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFC1B1065676; Mon, 26 Oct 2009 20:23:15 +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 AD9E58FC14; Mon, 26 Oct 2009 20:23: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 n9QKNFtQ008162; Mon, 26 Oct 2009 20:23:15 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QKNF19008158; Mon, 26 Oct 2009 20:23:15 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200910262023.n9QKNF19008158@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Oct 2009 20:23: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: r198500 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 20:23:15 -0000 Author: thompsa Date: Mon Oct 26 20:23:15 2009 New Revision: 198500 URL: http://svn.freebsd.org/changeset/base/198500 Log: Remove usb controller takeover code now that it is handled by the pci code. Reminded by: jhb Reviewed by: HPS Modified: head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Oct 26 19:23:34 2009 (r198499) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Oct 26 20:23:15 2009 (r198500) @@ -102,8 +102,6 @@ __FBSDID("$FreeBSD$"); #define PCI_EHCI_BASE_REG 0x10 -static void ehci_pci_takecontroller(device_t self); - static device_probe_t ehci_pci_probe; static device_attach_t ehci_pci_attach; static device_detach_t ehci_pci_detach; @@ -129,7 +127,6 @@ ehci_pci_resume(device_t self) { ehci_softc_t *sc = device_get_softc(self); - ehci_pci_takecontroller(self); ehci_resume(sc); bus_generic_resume(self); @@ -414,7 +411,6 @@ ehci_pci_attach(device_t self) sc->sc_intr_hdl = NULL; goto error; } - ehci_pci_takecontroller(self); /* Undocumented quirks taken from Linux */ @@ -506,51 +502,6 @@ ehci_pci_detach(device_t self) return (0); } -static void -ehci_pci_takecontroller(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - uint32_t cparams; - uint32_t eec; - uint16_t to; - uint8_t eecp; - uint8_t bios_sem; - - cparams = EREAD4(sc, EHCI_HCCPARAMS); - - /* Synchronise with the BIOS if it owns the controller. */ - for (eecp = EHCI_HCC_EECP(cparams); eecp != 0; - eecp = EHCI_EECP_NEXT(eec)) { - eec = pci_read_config(self, eecp, 4); - if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) { - continue; - } - bios_sem = pci_read_config(self, eecp + - EHCI_LEGSUP_BIOS_SEM, 1); - if (bios_sem == 0) { - continue; - } - device_printf(sc->sc_bus.bdev, "waiting for BIOS " - "to give up control\n"); - pci_write_config(self, eecp + - EHCI_LEGSUP_OS_SEM, 1, 1); - to = 500; - while (1) { - bios_sem = pci_read_config(self, eecp + - EHCI_LEGSUP_BIOS_SEM, 1); - if (bios_sem == 0) - break; - - if (--to == 0) { - device_printf(sc->sc_bus.bdev, - "timed out waiting for BIOS\n"); - break; - } - usb_pause_mtx(NULL, hz / 100); /* wait 10ms */ - } - } -} - static driver_t ehci_driver = { .name = "ehci", Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Mon Oct 26 19:23:34 2009 (r198499) +++ head/sys/dev/usb/controller/ohci.c Mon Oct 26 20:23:15 2009 (r198500) @@ -175,30 +175,6 @@ ohci_controller_init(ohci_softc_t *sc) uint32_t per; uint32_t desca; - /* Determine in what context we are running. */ - ctl = OREAD4(sc, OHCI_CONTROL); - if (ctl & OHCI_IR) { - /* SMM active, request change */ - DPRINTF("SMM active, request owner change\n"); - OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR); - for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { - usb_pause_mtx(NULL, hz / 1000); - ctl = OREAD4(sc, OHCI_CONTROL); - } - if (ctl & OHCI_IR) { - device_printf(sc->sc_bus.bdev, - "SMM does not respond, resetting\n"); - OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); - goto reset; - } - } else { - DPRINTF("cold started\n"); -reset: - /* controller was cold started */ - usb_pause_mtx(NULL, - USB_MS_TO_TICKS(USB_BUS_RESET_DELAY)); - } - /* * This reset should not be necessary according to the OHCI spec, but * without it some controllers do not start. Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Oct 26 19:23:34 2009 (r198499) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Oct 26 20:23:15 2009 (r198500) @@ -115,8 +115,6 @@ uhci_pci_resume(device_t self) { uhci_softc_t *sc = device_get_softc(self); - pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); - uhci_resume(sc); bus_generic_resume(self); @@ -363,19 +361,6 @@ uhci_pci_attach(device_t self) sc->sc_intr_hdl = NULL; goto error; } - /* - * Set the PIRQD enable bit and switch off all the others. We don't - * want legacy support to interfere with us XXX Does this also mean - * that the BIOS won't touch the keyboard anymore if it is connected - * to the ports of the root hub? - */ -#ifdef USB_DEBUG - if (pci_read_config(self, PCI_LEGSUP, 2) != PCI_LEGSUP_USBPIRQDEN) { - device_printf(self, "LegSup = 0x%04x\n", - pci_read_config(self, PCI_LEGSUP, 2)); - } -#endif - pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); err = uhci_init(sc); if (!err) { From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 20:33:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3B57106566B; Mon, 26 Oct 2009 20:33:03 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out2.tiscali.nl (smtp-out2.tiscali.nl [195.241.79.177]) by mx1.freebsd.org (Postfix) with ESMTP id 8537D8FC0C; Mon, 26 Oct 2009 20:33:03 +0000 (UTC) Received: from [212.123.145.58] (helo=sjakie.klop.ws) by smtp-out2.tiscali.nl with esmtp (Exim) (envelope-from ) id 1N2W35-0007xZ-Uj; Mon, 26 Oct 2009 21:20:16 +0100 Received: from 82-170-177-25.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id B150F13353; Mon, 26 Oct 2009 21:20:08 +0100 (CET) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: "Colin Percival" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <200910260651.n9Q6pLfU080067@svn.freebsd.org> Date: Mon, 26 Oct 2009 21:20:08 +0100 MIME-Version: 1.0 From: "Ronald Klop" Message-ID: In-Reply-To: <200910260651.n9Q6pLfU080067@svn.freebsd.org> User-Agent: Opera Mail/10.00 (FreeBSD) Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r198477 - head/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 20:33:04 -0000 I'm no committer, but isn't it nice to close the fd? Ronald. On Mon, 26 Oct 2009 07:51:21 +0100, Colin Percival = =20 wrote: > Author: cperciva > Date: Mon Oct 26 06:51:20 2009 > New Revision: 198477 > URL: http://svn.freebsd.org/changeset/base/198477 > > Log: > Eject CDROM after installation if used as source media. > Submitted by: randi > MFC after: 1 month > > Modified: > head/usr.sbin/sysinstall/cdrom.c > > Modified: head/usr.sbin/sysinstall/cdrom.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 00:01:52 2009 (r198476) > +++ head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 06:51:20 2009 (r198477) > @@ -43,6 +43,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -58,6 +59,8 @@ static Boolean previouslyMounted; /* Was > static char mountpoint[MAXPATHLEN] =3D "/dist"; > int CDROMInitQuiet; > +static void mediaEjectCDROM(Device *dev); > + > static properties > read_props(char *name) > { > @@ -218,4 +221,23 @@ mediaShutdownCDROM(Device *dev) > msgConfirm("Could not unmount the CDROM/DVD from %s: %s", mountpoint,= =20 > strerror(errno)); > else > cdromMounted =3D FALSE; > + > + mediaEjectCDROM(dev); > +} > + > +static void > +mediaEjectCDROM(Device *dev) > +{ > + int fd =3D -1; > + > + msgDebug("Ejecting CDROM/DVD at %s", dev->devname); > + > + fd =3D open(dev->devname, O_RDONLY); > +=09 > + if (fd < 0) > + msgDebug("Could not eject the CDROM/DVD from %s: %s", dev->devname, = =20 > strerror(errno)); > + else { > + ioctl(fd, CDIOCALLOW); > + ioctl(fd, CDIOCEJECT); > + } > } > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 20:53:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E047106566B; Mon, 26 Oct 2009 20:53:50 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout023.mac.com (asmtpout023.mac.com [17.148.16.98]) by mx1.freebsd.org (Postfix) with ESMTP id 340CE8FC08; Mon, 26 Oct 2009 20:53:49 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp023.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KS5001RK3DO6U60@asmtp023.mac.com>; Mon, 26 Oct 2009 13:53:48 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <20091026201116.GS27159@alchemy.franken.de> Date: Mon, 26 Oct 2009 13:53:47 -0700 Message-id: <63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com> References: <200910211838.n9LIc2wp007206@svn.freebsd.org> <20091025202541.GC94979@alchemy.franken.de> <36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com> <20091026201116.GS27159@alchemy.franken.de> To: Marius Strobl X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 20:53:50 -0000 On Oct 26, 2009, at 1:11 PM, Marius Strobl wrote: > The cheetah-class CPUs, i.e. USIII and later, take care of > I$ coherency themselves, unlike the spitfire ones (see also > cheetah_icache_page_inval() vs. spitfire_icache_page_inval()). This explains why I didn't see any I-cache coherency issues :-) > I currently can't think of any existing code which would > ensure I$ consistency after the writes have been performed, > not even as a side-effect. The proper solution probalby is to > make pmap_sync_icache() a wrapper around icache_page_inval(). I concur. Do we have any spitfire-based sparc64 boxes in the cluster or do you have one? -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 21:14:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E67106566B; Mon, 26 Oct 2009 21:14:03 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout029.mac.com (asmtpout029.mac.com [17.148.16.104]) by mx1.freebsd.org (Postfix) with ESMTP id 9B3C08FC15; Mon, 26 Oct 2009 21:14:03 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp029.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KS500K5P4AUOB10@asmtp029.mac.com>; Mon, 26 Oct 2009 14:13:43 -0700 (PDT) From: Marcel Moolenaar In-reply-to: <200910262023.n9QKNF19008158@svn.freebsd.org> Date: Mon, 26 Oct 2009 14:13:42 -0700 Message-id: References: <200910262023.n9QKNF19008158@svn.freebsd.org> To: Andrew Thompson X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198500 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 21:14:03 -0000 On Oct 26, 2009, at 1:23 PM, Andrew Thompson wrote: > Author: thompsa > Date: Mon Oct 26 20:23:15 2009 > New Revision: 198500 > URL: http://svn.freebsd.org/changeset/base/198500 > > Log: > Remove usb controller takeover code now that it is handled by the > pci code. Uhm.. PCI does it conditionally, based on a tunable. If the handover is not done early by the PCI code, then it may still need to be done "late" by the USB drivers, right? When and where is it done "late" now that this code is removed? -- Marcel Moolenaar xcllnt@mac.com From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 21:38:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07E351065679; Mon, 26 Oct 2009 21:38:52 +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 CE0548FC12; Mon, 26 Oct 2009 21:38:51 +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 55CA846B06; Mon, 26 Oct 2009 17:38:51 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 8CC7D8A01B; Mon, 26 Oct 2009 17:38:50 -0400 (EDT) From: John Baldwin To: Andrew Thompson Date: Mon, 26 Oct 2009 17:38:45 -0400 User-Agent: KMail/1.9.7 References: <200910262023.n9QKNF19008158@svn.freebsd.org> In-Reply-To: <200910262023.n9QKNF19008158@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910261738.46087.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 26 Oct 2009 17:38:50 -0400 (EDT) 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: r198500 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 21:38:52 -0000 On Monday 26 October 2009 4:23:15 pm Andrew Thompson wrote: > Author: thompsa > Date: Mon Oct 26 20:23:15 2009 > New Revision: 198500 > URL: http://svn.freebsd.org/changeset/base/198500 > > Log: > Remove usb controller takeover code now that it is handled by the pci code. > > Reminded by: jhb > Reviewed by: HPS Hmm, the drivers might still need it for resume actually. Either that or the PCI bus will need to do the takeover work during resume. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 21:44:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D99A2106566B; Mon, 26 Oct 2009 21:44:15 +0000 (UTC) (envelope-from andy@fud.org.nz) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.27]) by mx1.freebsd.org (Postfix) with ESMTP id 61C138FC0A; Mon, 26 Oct 2009 21:44:15 +0000 (UTC) Received: by qw-out-2122.google.com with SMTP id 9so768140qwb.7 for ; Mon, 26 Oct 2009 14:44:14 -0700 (PDT) MIME-Version: 1.0 Sender: andy@fud.org.nz Received: by 10.220.122.229 with SMTP id m37mr9129164vcr.15.1256593454734; Mon, 26 Oct 2009 14:44:14 -0700 (PDT) In-Reply-To: <200910261738.46087.jhb@freebsd.org> References: <200910262023.n9QKNF19008158@svn.freebsd.org> <200910261738.46087.jhb@freebsd.org> Date: Tue, 27 Oct 2009 10:44:14 +1300 X-Google-Sender-Auth: 5e35dac8e8406f1b Message-ID: <1280352d0910261444v57c6c97aue6ae06fc6dc36641@mail.gmail.com> From: Andrew Thompson To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198500 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 21:44:15 -0000 2009/10/27 John Baldwin : > On Monday 26 October 2009 4:23:15 pm Andrew Thompson wrote: >> Author: thompsa >> Date: Mon Oct 26 20:23:15 2009 >> New Revision: 198500 >> URL: http://svn.freebsd.org/changeset/base/198500 >> >> Log: >> =A0 Remove usb controller takeover code now that it is handled by the pc= i > code. >> >> =A0 Reminded by: =A0 =A0 =A0 =A0jhb >> =A0 Reviewed by: =A0 =A0 =A0 =A0HPS > > Hmm, the drivers might still need it for resume actually. =A0Either that = or the > PCI bus will need to do the takeover work during resume. As Marcel points out having hw.pci.usb_early_takeover set to zero will break. I should revert this for now. Andrew From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 21:47:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AEE0106568F; Mon, 26 Oct 2009 21:47: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 ED7768FC1C; Mon, 26 Oct 2009 21:47: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 n9QLlG4x011295; Mon, 26 Oct 2009 21:47:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QLlG3E011291; Mon, 26 Oct 2009 21:47:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200910262147.n9QLlG3E011291@svn.freebsd.org> From: Andrew Thompson Date: Mon, 26 Oct 2009 21:47: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: r198501 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 21:47:17 -0000 Author: thompsa Date: Mon Oct 26 21:47:16 2009 New Revision: 198501 URL: http://svn.freebsd.org/changeset/base/198501 Log: Revert r198500 for now, this will break situations when hw.pci.usb_early_takeover is set to zero and the SMM release is never done. Pointed out by: marcel Modified: head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Oct 26 20:23:15 2009 (r198500) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Oct 26 21:47:16 2009 (r198501) @@ -102,6 +102,8 @@ __FBSDID("$FreeBSD$"); #define PCI_EHCI_BASE_REG 0x10 +static void ehci_pci_takecontroller(device_t self); + static device_probe_t ehci_pci_probe; static device_attach_t ehci_pci_attach; static device_detach_t ehci_pci_detach; @@ -127,6 +129,7 @@ ehci_pci_resume(device_t self) { ehci_softc_t *sc = device_get_softc(self); + ehci_pci_takecontroller(self); ehci_resume(sc); bus_generic_resume(self); @@ -411,6 +414,7 @@ ehci_pci_attach(device_t self) sc->sc_intr_hdl = NULL; goto error; } + ehci_pci_takecontroller(self); /* Undocumented quirks taken from Linux */ @@ -502,6 +506,51 @@ ehci_pci_detach(device_t self) return (0); } +static void +ehci_pci_takecontroller(device_t self) +{ + ehci_softc_t *sc = device_get_softc(self); + uint32_t cparams; + uint32_t eec; + uint16_t to; + uint8_t eecp; + uint8_t bios_sem; + + cparams = EREAD4(sc, EHCI_HCCPARAMS); + + /* Synchronise with the BIOS if it owns the controller. */ + for (eecp = EHCI_HCC_EECP(cparams); eecp != 0; + eecp = EHCI_EECP_NEXT(eec)) { + eec = pci_read_config(self, eecp, 4); + if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) { + continue; + } + bios_sem = pci_read_config(self, eecp + + EHCI_LEGSUP_BIOS_SEM, 1); + if (bios_sem == 0) { + continue; + } + device_printf(sc->sc_bus.bdev, "waiting for BIOS " + "to give up control\n"); + pci_write_config(self, eecp + + EHCI_LEGSUP_OS_SEM, 1, 1); + to = 500; + while (1) { + bios_sem = pci_read_config(self, eecp + + EHCI_LEGSUP_BIOS_SEM, 1); + if (bios_sem == 0) + break; + + if (--to == 0) { + device_printf(sc->sc_bus.bdev, + "timed out waiting for BIOS\n"); + break; + } + usb_pause_mtx(NULL, hz / 100); /* wait 10ms */ + } + } +} + static driver_t ehci_driver = { .name = "ehci", Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Mon Oct 26 20:23:15 2009 (r198500) +++ head/sys/dev/usb/controller/ohci.c Mon Oct 26 21:47:16 2009 (r198501) @@ -175,6 +175,30 @@ ohci_controller_init(ohci_softc_t *sc) uint32_t per; uint32_t desca; + /* Determine in what context we are running. */ + ctl = OREAD4(sc, OHCI_CONTROL); + if (ctl & OHCI_IR) { + /* SMM active, request change */ + DPRINTF("SMM active, request owner change\n"); + OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_OCR); + for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) { + usb_pause_mtx(NULL, hz / 1000); + ctl = OREAD4(sc, OHCI_CONTROL); + } + if (ctl & OHCI_IR) { + device_printf(sc->sc_bus.bdev, + "SMM does not respond, resetting\n"); + OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET); + goto reset; + } + } else { + DPRINTF("cold started\n"); +reset: + /* controller was cold started */ + usb_pause_mtx(NULL, + USB_MS_TO_TICKS(USB_BUS_RESET_DELAY)); + } + /* * This reset should not be necessary according to the OHCI spec, but * without it some controllers do not start. Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Oct 26 20:23:15 2009 (r198500) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Oct 26 21:47:16 2009 (r198501) @@ -115,6 +115,8 @@ uhci_pci_resume(device_t self) { uhci_softc_t *sc = device_get_softc(self); + pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); + uhci_resume(sc); bus_generic_resume(self); @@ -361,6 +363,19 @@ uhci_pci_attach(device_t self) sc->sc_intr_hdl = NULL; goto error; } + /* + * Set the PIRQD enable bit and switch off all the others. We don't + * want legacy support to interfere with us XXX Does this also mean + * that the BIOS won't touch the keyboard anymore if it is connected + * to the ports of the root hub? + */ +#ifdef USB_DEBUG + if (pci_read_config(self, PCI_LEGSUP, 2) != PCI_LEGSUP_USBPIRQDEN) { + device_printf(self, "LegSup = 0x%04x\n", + pci_read_config(self, PCI_LEGSUP, 2)); + } +#endif + pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); err = uhci_init(sc); if (!err) { From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 22:00:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59711106566B; Mon, 26 Oct 2009 22:00:27 +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 4868F8FC17; Mon, 26 Oct 2009 22: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 n9QM0QVA011601; Mon, 26 Oct 2009 22:00:26 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QM0QEg011599; Mon, 26 Oct 2009 22:00:26 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200910262200.n9QM0QEg011599@svn.freebsd.org> From: Marius Strobl Date: Mon, 26 Oct 2009 22:00: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: r198502 - head/sys/sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 22:00:27 -0000 Author: marius Date: Mon Oct 26 22:00:26 2009 New Revision: 198502 URL: http://svn.freebsd.org/changeset/base/198502 Log: Sync with the other archs and wrapper the prototype of in_cksum_skip(9) in #ifdef _KERNEL. Submitted by: Ulrich Spoerlein MFC after: 1 month Modified: head/sys/sparc64/include/in_cksum.h Modified: head/sys/sparc64/include/in_cksum.h ============================================================================== --- head/sys/sparc64/include/in_cksum.h Mon Oct 26 21:47:16 2009 (r198501) +++ head/sys/sparc64/include/in_cksum.h Mon Oct 26 22:00:26 2009 (r198502) @@ -164,6 +164,8 @@ in_cksum_hdr(struct ip *ip) return (__ret); } +#ifdef _KERNEL u_short in_cksum_skip(struct mbuf *m, int len, int skip); +#endif #endif /* _MACHINE_IN_CKSUM_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 23:24:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9CB8106566B; Mon, 26 Oct 2009 23:24:59 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8EB98FC18; Mon, 26 Oct 2009 23:24: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 n9QNOxkK013445; Mon, 26 Oct 2009 23:24:59 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9QNOxFM013443; Mon, 26 Oct 2009 23:24:59 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200910262324.n9QNOxFM013443@svn.freebsd.org> From: Colin Percival Date: Mon, 26 Oct 2009 23:24: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: r198503 - head/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 23:24:59 -0000 Author: cperciva Date: Mon Oct 26 23:24:59 2009 New Revision: 198503 URL: http://svn.freebsd.org/changeset/base/198503 Log: Don't leak a file descriptor when ejecting a CDROM. Submitted by: Ronald Klop, trhodes Note to self: don't do commits while half-asleep Modified: head/usr.sbin/sysinstall/cdrom.c Modified: head/usr.sbin/sysinstall/cdrom.c ============================================================================== --- head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 22:00:26 2009 (r198502) +++ head/usr.sbin/sysinstall/cdrom.c Mon Oct 26 23:24:59 2009 (r198503) @@ -239,5 +239,6 @@ mediaEjectCDROM(Device *dev) else { ioctl(fd, CDIOCALLOW); ioctl(fd, CDIOCEJECT); + close(fd); } } From owner-svn-src-all@FreeBSD.ORG Mon Oct 26 23:26:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 5F34710656FE for ; Mon, 26 Oct 2009 23:26:48 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from xps.daemonology.net (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx2.freebsd.org (Postfix) with SMTP id 8A7FB156D16 for ; Mon, 26 Oct 2009 23:26:45 +0000 (UTC) Received: (qmail 18793 invoked from network); 26 Oct 2009 23:26:45 -0000 Received: from unknown (HELO xps.daemonology.net) (127.0.0.1) by localhost with SMTP; 26 Oct 2009 23:26:45 -0000 Message-ID: <4AE63034.3040308@freebsd.org> Date: Mon, 26 Oct 2009 16:26:44 -0700 From: Colin Percival User-Agent: Thunderbird 2.0.0.23 (X11/20090919) MIME-Version: 1.0 To: Ronald Klop References: <200910260651.n9Q6pLfU080067@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 0.96.0 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: r198477 - head/usr.sbin/sysinstall X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2009 23:26:48 -0000 Ronald Klop wrote: > I'm no committer, but isn't it nice to close the fd? Indeed -- I need to be more awake when I do commits in the future. :-) I've fixed this now; thanks for pointing it out. -- Colin Percival Security Officer, FreeBSD | freebsd.org | The power to serve Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 00:05:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 164C810656AC; Tue, 27 Oct 2009 00:05:33 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-ew0-f218.google.com (mail-ew0-f218.google.com [209.85.219.218]) by mx1.freebsd.org (Postfix) with ESMTP id 2AA3D8FC1F; Tue, 27 Oct 2009 00:05:31 +0000 (UTC) Received: by ewy18 with SMTP id 18so11028856ewy.43 for ; Mon, 26 Oct 2009 17:05:31 -0700 (PDT) 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; bh=i+s2jtK9YMxp1jjbYO40/LmSJjmFUwJuDCZtwzK3V74=; b=pxzVQ6fPCfEHzWsMnVMm6GINWr5UNjwr+ZT5G7S8Dx+/hOoL9sRjGp/msDPTvt2mok MHs1LvahKK3w9N/3Z9ft9Z4xPXFXGgH149C59AOULZNRjZfjtxUeTLmBO5YidR4anHMz MDRS3+mrzNLeDdcnuoaOkHoPSl1eJZYq3AMU0= 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; b=iCYFLAnFVYUd9siF/1+wCiuypbShH82lhwYd4w5fgmKdc/Bt37C/MYsp9/HHtyY7ni yCws1JpZk0/IVlhsdTfWzjMsMgYlypspRvrpCAmTLdo7TB++0U4ZJyLLis85N4HLWKnV z2j332X5qrj3oFEy52JQzlXOP6tNqOZrXxXwY= MIME-Version: 1.0 Received: by 10.211.173.11 with SMTP id a11mr7993662ebp.42.1256601931102; Mon, 26 Oct 2009 17:05:31 -0700 (PDT) In-Reply-To: <200910212059.n9LKxDDQ010447@svn.freebsd.org> References: <200910212059.n9LKxDDQ010447@svn.freebsd.org> Date: Mon, 26 Oct 2009 20:05:31 -0400 Message-ID: <47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com> From: Ben Kaduk To: Edwin Groothuis Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198351 - head/share/zoneinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 00:05:33 -0000 On Wed, Oct 21, 2009 at 4:59 PM, Edwin Groothuis wrote: > Author: edwin > Date: Wed Oct 21 20:59:12 2009 > New Revision: 198351 > URL: http://svn.freebsd.org/changeset/base/198351 > > Log: > After the installation of the /usr/share/zoneinfo, run tzsetup if > /var/db/zoneinfo exists. > > MFC after: 1 week > > Modified: > head/share/zoneinfo/Makefile > > Modified: head/share/zoneinfo/Makefile > ============================================================================== > --- head/share/zoneinfo/Makefile Wed Oct 21 20:55:04 2009 (r198350) > +++ head/share/zoneinfo/Makefile Wed Oct 21 20:59:12 2009 (r198351) > @@ -54,4 +54,24 @@ beforeinstall: > ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ > ${.CURDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/ > > +afterinstall: > + @# > + @# If the file /var/db/zoneinfo exists, and it is owned by root:wheel, > + @# and the contents of it exists in /usr/share/zoneinfo, then reinstall > + @# it. > + @# > + @if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \ > + -a -G ${DESTDIR}/var/db/zoneinfo ]; then \ > + zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \ > + if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \ > + if [ ! -z "${DESTDIR}" ]; then \ > + optC="-C ${DESTDIR}"; \ > + fi; \ > + echo "Updating /etc/localtime"; \ > + tzsetup ${optC} -r; \ This breaks installworld for me. Replacing tzsetup with a hardcoded /usr/sbin/tzsetup allowed installworld to finish. The end of the installworld log is up at http://stuff.mit.edu/afs/sipb.mit.edu/user/kaduk/freebsd/iw.txt -Ben Kaduk > + fi; \ > + else \ > + echo "Run tzsetup(8) manually to update /etc/localtime."; \ > + fi > + > .include > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 00:43:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A73E106568B; Tue, 27 Oct 2009 00:43:03 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp113-58.static.internode.on.net [150.101.113.58]) by mx1.freebsd.org (Postfix) with ESMTP id C1EB68FC21; Tue, 27 Oct 2009 00:43:02 +0000 (UTC) Received: by k7.mavetju.org (Postfix, from userid 1001) id 957BA4515E; Tue, 27 Oct 2009 11:42:13 +1100 (EST) Date: Tue, 27 Oct 2009 11:42:13 +1100 From: Edwin Groothuis To: Ben Kaduk Message-ID: <20091027004213.GA13626@mavetju.org> References: <200910212059.n9LKxDDQ010447@svn.freebsd.org> <47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com> 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: r198351 - head/share/zoneinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 00:43:03 -0000 On Mon, Oct 26, 2009 at 08:05:31PM -0400, Ben Kaduk wrote: > > + fi; \ > > + echo "Updating /etc/localtime"; \ > > + tzsetup ${optC} -r; \ > > > This breaks installworld for me. Replacing tzsetup with a hardcoded > /usr/sbin/tzsetup allowed installworld to finish. ===> share/zoneinfo (install) umask 022; cd /usr/src/share/zoneinfo; zic -D -d /usr/share/zoneinfo -p America/New_York -u root -g wheel -m 444 -y /usr/obj/usr/src/share/zoneinfo/yearistype africa antarctica asia australasia etcetera europe factory northamerica southamerica "factory", line 11: warning: time zone abbreviation differs from POSIX standard (Local time zone must be set--use tzsetup) install -o root -g wheel -m 444 /usr/src/share/zoneinfo/zone.tab /usr/share/zoneinfo/ Updating /etc/localtime tzsetup: not found *** Error code 127 I'll check it out, just wonder why you can run zic(8) but not tzsetup(8). They are both in /usr/sbin. Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 04:53:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B00C106566B; Tue, 27 Oct 2009 04:53:33 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2593D8FC0A; Tue, 27 Oct 2009 04:53:31 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id GAA13705; Tue, 27 Oct 2009 06:53:15 +0200 (EET) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1N2e3X-000NyQ-DJ; Tue, 27 Oct 2009 06:53:15 +0200 Message-ID: <4AE67CA3.5080109@freebsd.org> Date: Tue, 27 Oct 2009 06:52:51 +0200 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Edwin Groothuis References: <200910212059.n9LKxDDQ010447@svn.freebsd.org> <47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com> <20091027004213.GA13626@mavetju.org> In-Reply-To: <20091027004213.GA13626@mavetju.org> X-Enigmail-Version: 0.96.0 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, Ben Kaduk Subject: Re: svn commit: r198351 - head/share/zoneinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 04:53:33 -0000 on 27/10/2009 02:42 Edwin Groothuis said the following: > On Mon, Oct 26, 2009 at 08:05:31PM -0400, Ben Kaduk wrote: >>> + fi; \ >>> + echo "Updating /etc/localtime"; \ >>> + tzsetup ${optC} -r; \ >> >> This breaks installworld for me. Replacing tzsetup with a hardcoded >> /usr/sbin/tzsetup allowed installworld to finish. > > ===> share/zoneinfo (install) > umask 022; cd /usr/src/share/zoneinfo; zic -D -d /usr/share/zoneinfo -p America/New_York -u root -g wheel -m 444 -y /usr/obj/usr/src/share/zoneinfo/yearistype africa antarctica asia australasia etcetera europe factory northamerica southamerica > "factory", line 11: warning: time zone abbreviation differs from POSIX standard (Local time zone must be set--use tzsetup) > install -o root -g wheel -m 444 /usr/src/share/zoneinfo/zone.tab /usr/share/zoneinfo/ > Updating /etc/localtime > tzsetup: not found > *** Error code 127 > > I'll check it out, just wonder why you can run zic(8) but not > tzsetup(8). They are both in /usr/sbin. Perhaps ITOOLS variable has something to do with this. (installworld may be executed from a rather unpopulated environment). -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 06:46:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97954106566B; Tue, 27 Oct 2009 06:46:07 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp113-58.static.internode.on.net [150.101.113.58]) by mx1.freebsd.org (Postfix) with ESMTP id 35E5C8FC13; Tue, 27 Oct 2009 06:46:06 +0000 (UTC) Received: by k7.mavetju.org (Postfix, from userid 1001) id BA80045167; Tue, 27 Oct 2009 17:45:17 +1100 (EST) Date: Tue, 27 Oct 2009 17:45:17 +1100 From: Edwin Groothuis To: Ben Kaduk Message-ID: <20091027064517.GA34072@mavetju.org> References: <200910212059.n9LKxDDQ010447@svn.freebsd.org> <47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com> <20091027004213.GA13626@mavetju.org> <4AE67CA3.5080109@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AE67CA3.5080109@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r198351 - head/share/zoneinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 06:46:07 -0000 On Tue, Oct 27, 2009 at 06:52:51AM +0200, Andriy Gapon wrote: > on 27/10/2009 02:42 Edwin Groothuis said the following: > > On Mon, Oct 26, 2009 at 08:05:31PM -0400, Ben Kaduk wrote: > >>> + fi; \ > >>> + echo "Updating /etc/localtime"; \ > >>> + tzsetup ${optC} -r; \ > >> > >> This breaks installworld for me. Replacing tzsetup with a hardcoded > >> /usr/sbin/tzsetup allowed installworld to finish. > > > > ===> share/zoneinfo (install) > > umask 022; cd /usr/src/share/zoneinfo; zic -D -d /usr/share/zoneinfo -p America/New_York -u root -g wheel -m 444 -y /usr/obj/usr/src/share/zoneinfo/yearistype africa antarctica asia australasia etcetera europe factory northamerica southamerica > > "factory", line 11: warning: time zone abbreviation differs from POSIX standard (Local time zone must be set--use tzsetup) > > install -o root -g wheel -m 444 /usr/src/share/zoneinfo/zone.tab /usr/share/zoneinfo/ > > Updating /etc/localtime > > tzsetup: not found > > *** Error code 127 > > > > I'll check it out, just wonder why you can run zic(8) but not > > tzsetup(8). They are both in /usr/sbin. > > Perhaps ITOOLS variable has something to do with this. > (installworld may be executed from a rather unpopulated environment). Ben, Can you confirm that this resolves it? Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 198253) +++ Makefile.inc1 (working copy) @@ -599,11 +599,14 @@ .if ${MK_INFO} != "no" _install-info= install-info .endif +.if ${MK_ZONEINFO} != "no" +_zoneinfo= zic tzsetup +.endif ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep ${_install-info} \ ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ - test true uname wc zic + test true uname wc ${_zoneinfo} # # distributeworld Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:15:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F1AA1065676; Tue, 27 Oct 2009 10:15:58 +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 5E5158FC12; Tue, 27 Oct 2009 10:15: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 n9RAFwqw028190; Tue, 27 Oct 2009 10:15:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RAFwZJ028187; Tue, 27 Oct 2009 10:15:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271015.n9RAFwZJ028187@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 10:15: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: r198505 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:15:58 -0000 Author: kib Date: Tue Oct 27 10:15:58 2009 New Revision: 198505 URL: http://svn.freebsd.org/changeset/base/198505 Log: When protection of wired read-only mapping is changed to read-write, install new shadow object behind the map entry and copy the pages from the underlying objects to it. This makes the mprotect(2) call to actually perform the requested operation instead of silently do nothing and return success, that causes SIGSEGV on later write access to the mapping. Reuse vm_fault_copy_entry() to do the copying, modifying it to behave correctly when src_entry == dst_entry. Reviewed by: alc MFC after: 3 weeks Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_map.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Mon Oct 26 23:39:07 2009 (r198504) +++ head/sys/vm/vm_fault.c Tue Oct 27 10:15:58 2009 (r198505) @@ -1119,7 +1119,10 @@ vm_fault_unwire(vm_map_t map, vm_offset_ * Routine: * vm_fault_copy_entry * Function: - * Copy all of the pages from a wired-down map entry to another. + * Create new shadow object backing dst_entry with private copy of + * all underlying pages. When src_entry is equal to dst_entry, + * function implements COW for wired-down map entry. Otherwise, + * it forks wired entry into dst_map. * * In/out conditions: * The source and destination maps must be locked for write. @@ -1131,19 +1134,20 @@ vm_fault_copy_entry(vm_map_t dst_map, vm vm_map_entry_t dst_entry, vm_map_entry_t src_entry, vm_ooffset_t *fork_charge) { - vm_object_t backing_object, dst_object, object; - vm_object_t src_object; + vm_object_t backing_object, dst_object, object, src_object; vm_pindex_t dst_pindex, pindex, src_pindex; - vm_prot_t prot; + vm_prot_t access, prot; vm_offset_t vaddr; vm_page_t dst_m; vm_page_t src_m; - boolean_t src_readonly; + boolean_t src_readonly, upgrade; #ifdef lint src_map++; #endif /* lint */ + upgrade = src_entry == dst_entry; + src_object = src_entry->object.vm_object; src_pindex = OFF_TO_IDX(src_entry->offset); src_readonly = (src_entry->protection & VM_PROT_WRITE) == 0; @@ -1160,17 +1164,34 @@ vm_fault_copy_entry(vm_map_t dst_map, vm #endif VM_OBJECT_LOCK(dst_object); - KASSERT(dst_entry->object.vm_object == NULL, + KASSERT(upgrade || dst_entry->object.vm_object == NULL, ("vm_fault_copy_entry: vm_object not NULL")); dst_entry->object.vm_object = dst_object; dst_entry->offset = 0; - dst_object->uip = curthread->td_ucred->cr_ruidinfo; - uihold(dst_object->uip); dst_object->charge = dst_entry->end - dst_entry->start; - KASSERT(dst_entry->uip == NULL, - ("vm_fault_copy_entry: leaked swp charge")); - *fork_charge += dst_object->charge; - prot = dst_entry->max_protection; + if (fork_charge != NULL) { + KASSERT(dst_entry->uip == NULL, + ("vm_fault_copy_entry: leaked swp charge")); + dst_object->uip = curthread->td_ucred->cr_ruidinfo; + uihold(dst_object->uip); + *fork_charge += dst_object->charge; + } else { + dst_object->uip = dst_entry->uip; + dst_entry->uip = NULL; + } + access = prot = dst_entry->max_protection; + /* + * If not an upgrade, then enter the mappings in the pmap as + * read and/or execute accesses. Otherwise, enter them as + * write accesses. + * + * A writeable large page mapping is only created if all of + * the constituent small page mappings are modified. Marking + * PTEs as modified on inception allows promotion to happen + * without taking potentially large number of soft faults. + */ + if (!upgrade) + access &= ~VM_PROT_WRITE; /* * Loop through all of the pages in the entry's range, copying each @@ -1221,21 +1242,30 @@ vm_fault_copy_entry(vm_map_t dst_map, vm VM_OBJECT_UNLOCK(dst_object); /* - * Enter it in the pmap as a read and/or execute access. + * Enter it in the pmap. If a wired, copy-on-write + * mapping is being replaced by a write-enabled + * mapping, then wire that new mapping. */ - pmap_enter(dst_map->pmap, vaddr, prot & ~VM_PROT_WRITE, dst_m, - prot, FALSE); + pmap_enter(dst_map->pmap, vaddr, access, dst_m, prot, upgrade); /* * Mark it no longer busy, and put it on the active list. */ VM_OBJECT_LOCK(dst_object); vm_page_lock_queues(); - vm_page_activate(dst_m); + if (upgrade) { + vm_page_unwire(src_m, 0); + vm_page_wire(dst_m); + } else + vm_page_activate(dst_m); vm_page_unlock_queues(); vm_page_wakeup(dst_m); } VM_OBJECT_UNLOCK(dst_object); + if (upgrade) { + dst_entry->eflags &= ~(MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY); + vm_object_deallocate(src_object); + } } Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Mon Oct 26 23:39:07 2009 (r198504) +++ head/sys/vm/vm_map.c Tue Oct 27 10:15:58 2009 (r198505) @@ -1805,10 +1805,10 @@ int vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end, vm_prot_t new_prot, boolean_t set_max) { - vm_map_entry_t current; - vm_map_entry_t entry; + vm_map_entry_t current, entry; vm_object_t obj; struct uidinfo *uip; + vm_prot_t old_prot; vm_map_lock(map); @@ -1897,9 +1897,8 @@ vm_map_protect(vm_map_t map, vm_offset_t */ current = entry; while ((current != &map->header) && (current->start < end)) { - vm_prot_t old_prot; - old_prot = current->protection; + if (set_max) current->protection = (current->max_protection = new_prot) & @@ -1907,6 +1906,13 @@ vm_map_protect(vm_map_t map, vm_offset_t else current->protection = new_prot; + if ((current->eflags & (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED)) + == (MAP_ENTRY_COW | MAP_ENTRY_USER_WIRED) && + (current->protection & VM_PROT_WRITE) != 0 && + (old_prot & VM_PROT_WRITE) == 0) { + vm_fault_copy_entry(map, map, current, current, NULL); + } + /* * Update physical map if necessary. Worry about copy-on-write * here. From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:19:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 377311065679; Tue, 27 Oct 2009 10:19:21 +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 9C38F8FC1F; Tue, 27 Oct 2009 10:19:20 +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 n9RAJGqB033937 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Oct 2009 12:19:16 +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 n9RAJG7D000925; Tue, 27 Oct 2009 12:19:16 +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 n9RAJGRE000924; Tue, 27 Oct 2009 12:19:16 +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: Tue, 27 Oct 2009 12:19:16 +0200 From: Kostik Belousov To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20091027101915.GD2160@deviant.kiev.zoral.com.ua> References: <200910271015.n9RAFwZJ028187@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/4AxN65oSelVOBJV" Content-Disposition: inline In-Reply-To: <200910271015.n9RAFwZJ028187@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: Subject: Re: svn commit: r198505 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:19:21 -0000 --/4AxN65oSelVOBJV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 27, 2009 at 10:15:58AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Tue Oct 27 10:15:58 2009 > New Revision: 198505 > URL: http://svn.freebsd.org/changeset/base/198505 >=20 > Log: > When protection of wired read-only mapping is changed to read-write, of private wired read-only mapping > install new shadow object behind the map entry and copy the pages > from the underlying objects to it. This makes the mprotect(2) call to > actually perform the requested operation instead of silently do nothing > and return success, that causes SIGSEGV on later write access to the > mapping. --/4AxN65oSelVOBJV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkrmySMACgkQC3+MBN1Mb4giKQCfcPWCg+UStNc4qGocYZrFFN2W zqEAn1Lb88i/VpbKFiIQw5CqFYWcj8Ve =Z7vS -----END PGP SIGNATURE----- --/4AxN65oSelVOBJV-- From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:42:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41AA6106566B; Tue, 27 Oct 2009 10:42:25 +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 303D58FC08; Tue, 27 Oct 2009 10:42: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 n9RAgO1O028755; Tue, 27 Oct 2009 10:42:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RAgOcT028750; Tue, 27 Oct 2009 10:42:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271042.n9RAgOcT028750@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 10:42: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: r198506 - in head/sys: compat/freebsd32 kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:42:25 -0000 Author: kib Date: Tue Oct 27 10:42:24 2009 New Revision: 198506 URL: http://svn.freebsd.org/changeset/base/198506 Log: In kern_sigsuspend(), better manipulate thread signal mask using kern_sigprocmask() to properly notify other possible candidate threads for signal delivery. Since sigsuspend() shall only return to usermode after a signal was delivered, do cursig/postsig loop immediately after waiting for signal, repeating the wait if wakeup was spurious due to race with other thread fetching signal from the process queue before us. Add thread_suspend_check() call to allow the thread to be stopped or killed while in loop. Modify last argument of kern_sigprocmask() from boolean to flags, allowing the function to be called with locked proc. Convertion of the callers that supplied 1 to the old argument will be done in the next commit, and due to SIGPROCMASK_OLD value equial to 1, code is formally correct in between. Reviewed by: davidxu Tested by: pho MFC after: 1 month Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_sig.c head/sys/sys/signalvar.h head/sys/sys/syscallsubr.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:15:58 2009 (r198505) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:42:24 2009 (r198506) @@ -2579,21 +2579,10 @@ int ofreebsd32_sigsuspend(struct thread *td, struct ofreebsd32_sigsuspend_args *uap) { - struct proc *p = td->td_proc; sigset_t mask; - PROC_LOCK(p); - td->td_oldsigmask = td->td_sigmask; - td->td_pflags |= TDP_OLDMASK; OSIG2SIG(uap->mask, mask); - SIG_CANTMASK(mask); - SIGSETLO(td->td_sigmask, mask); - signotify(td); - while (msleep(&p->p_sigacts, &p->p_mtx, PPAUSE|PCATCH, "opause", 0) == 0) - /* void */; - PROC_UNLOCK(p); - /* always return EINTR rather than ERESTART... */ - return (EINTR); + return (kern_sigsuspend(td, mask)); } struct sigstack32 { Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Oct 27 10:15:58 2009 (r198505) +++ head/sys/kern/kern_sig.c Tue Oct 27 10:42:24 2009 (r198506) @@ -970,14 +970,15 @@ execsigs(struct proc *p) */ int kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset, - int old) + int flags) { sigset_t new_block, oset1; struct proc *p; int error; p = td->td_proc; - PROC_LOCK(p); + if (!(flags & SIGPROCMASK_PROC_LOCKED)) + PROC_LOCK(p); if (oset != NULL) *oset = td->td_sigmask; @@ -999,7 +1000,7 @@ kern_sigprocmask(struct thread *td, int case SIG_SETMASK: SIG_CANTMASK(*set); oset1 = td->td_sigmask; - if (old) + if (flags & SIGPROCMASK_OLD) SIGSETLO(td->td_sigmask, *set); else td->td_sigmask = *set; @@ -1025,7 +1026,8 @@ kern_sigprocmask(struct thread *td, int if (p->p_numthreads != 1) reschedule_signals(p, new_block); - PROC_UNLOCK(p); + if (!(flags & SIGPROCMASK_PROC_LOCKED)) + PROC_UNLOCK(p); return (error); } @@ -1458,6 +1460,7 @@ int kern_sigsuspend(struct thread *td, sigset_t mask) { struct proc *p = td->td_proc; + int has_sig, sig; /* * When returning from sigsuspend, we want @@ -1467,13 +1470,28 @@ kern_sigsuspend(struct thread *td, sigse * to indicate this. */ PROC_LOCK(p); - td->td_oldsigmask = td->td_sigmask; + kern_sigprocmask(td, SIG_SETMASK, &mask, &td->td_oldsigmask, + SIGPROCMASK_PROC_LOCKED); td->td_pflags |= TDP_OLDMASK; - SIG_CANTMASK(mask); - td->td_sigmask = mask; - signotify(td); - while (msleep(&p->p_sigacts, &p->p_mtx, PPAUSE|PCATCH, "pause", 0) == 0) - /* void */; + + /* + * Process signals now. Otherwise, we can get spurious wakeup + * due to signal entered process queue, but delivered to other + * thread. But sigsuspend should return only on signal + * delivery. + */ + for (has_sig = 0; !has_sig;) { + while (msleep(&p->p_sigacts, &p->p_mtx, PPAUSE|PCATCH, "pause", + 0) == 0) + /* void */; + thread_suspend_check(0); + mtx_lock(&p->p_sigacts->ps_mtx); + while ((sig = cursig(td, SIG_STOP_ALLOWED)) != 0) { + postsig(sig); + has_sig = 1; + } + mtx_unlock(&p->p_sigacts->ps_mtx); + } PROC_UNLOCK(p); /* always return EINTR rather than ERESTART... */ return (EINTR); @@ -1495,21 +1513,10 @@ osigsuspend(td, uap) struct thread *td; struct osigsuspend_args *uap; { - struct proc *p = td->td_proc; sigset_t mask; - PROC_LOCK(p); - td->td_oldsigmask = td->td_sigmask; - td->td_pflags |= TDP_OLDMASK; OSIG2SIG(uap->mask, mask); - SIG_CANTMASK(mask); - SIGSETLO(td->td_sigmask, mask); - signotify(td); - while (msleep(&p->p_sigacts, &p->p_mtx, PPAUSE|PCATCH, "opause", 0) == 0) - /* void */; - PROC_UNLOCK(p); - /* always return EINTR rather than ERESTART... */ - return (EINTR); + return (kern_sigsuspend(td, mask)); } #endif /* COMPAT_43 */ Modified: head/sys/sys/signalvar.h ============================================================================== --- head/sys/sys/signalvar.h Tue Oct 27 10:15:58 2009 (r198505) +++ head/sys/sys/signalvar.h Tue Oct 27 10:42:24 2009 (r198506) @@ -316,6 +316,10 @@ extern int kern_logsigexit; /* Sysctl va #define SIG_STOP_ALLOWED 100 #define SIG_STOP_NOT_ALLOWED 101 +/* flags for kern_sigprocmask */ +#define SIGPROCMASK_OLD 0x0001 +#define SIGPROCMASK_PROC_LOCKED 0x0002 + /* * Machine-independent functions: */ @@ -359,7 +363,8 @@ void sigqueue_delete_stopmask_proc(struc void sigqueue_take(ksiginfo_t *ksi); int kern_sigtimedwait(struct thread *, sigset_t, ksiginfo_t *, struct timespec *); - +int kern_sigprocmask(struct thread *td, int how, + sigset_t *set, sigset_t *oset, int flags); /* * Machine-dependent functions: */ Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Oct 27 10:15:58 2009 (r198505) +++ head/sys/sys/syscallsubr.h Tue Oct 27 10:42:24 2009 (r198506) @@ -190,8 +190,6 @@ int kern_shmctl(struct thread *td, int s int kern_sigaction(struct thread *td, int sig, struct sigaction *act, struct sigaction *oact, int flags); int kern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss); -int kern_sigprocmask(struct thread *td, int how, - sigset_t *set, sigset_t *oset, int old); int kern_sigsuspend(struct thread *td, sigset_t mask); int kern_stat(struct thread *td, char *path, enum uio_seg pathseg, struct stat *sbp); From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:47:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DB49106566B; Tue, 27 Oct 2009 10:47:59 +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 694C58FC14; Tue, 27 Oct 2009 10:47: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 n9RAlxtG028917; Tue, 27 Oct 2009 10:47:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RAlxTw028900; Tue, 27 Oct 2009 10:47:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271047.n9RAlxTw028900@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 10:47: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: r198507 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux32 arm/arm compat/freebsd32 i386/i386 i386/linux ia64/ia64 kern mips/mips pc98/pc98 powerpc/aim powerpc/booke sparc64/sparc64 su... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:47:59 -0000 Author: kib Date: Tue Oct 27 10:47:58 2009 New Revision: 198507 URL: http://svn.freebsd.org/changeset/base/198507 Log: In r197963, a race with thread being selected for signal delivery while in kernel mode, and later changing signal mask to block the signal, was fixed for sigprocmask(2) and ptread_exit(3). The same race exists for sigreturn(2), setcontext(2) and swapcontext(2) syscalls. Use kern_sigprocmask() instead of direct manipulation of td_sigmask to reschedule newly blocked signals, closing the race. Reviewed by: davidxu Tested by: pho MFC after: 1 month Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/machdep.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/i386/i386/machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/ia64/ia64/machdep.c head/sys/kern/kern_context.c head/sys/kern/kern_sig.c head/sys/mips/mips/pm_machdep.c head/sys/pc98/pc98/machdep.c head/sys/powerpc/aim/machdep.c head/sys/powerpc/booke/machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/sun4v/sun4v/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/amd64/amd64/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -415,7 +415,7 @@ sigreturn(td, uap) ucontext_t uc; struct proc *p = td->td_proc; struct trapframe *regs; - const ucontext_t *ucp; + ucontext_t *ucp; long rflags; int cs, error, ret; ksiginfo_t ksi; @@ -478,7 +478,6 @@ sigreturn(td, uap) td->td_pcb->pcb_fsbase = ucp->uc_mcontext.mc_fsbase; td->td_pcb->pcb_gsbase = ucp->uc_mcontext.mc_gsbase; - PROC_LOCK(p); #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; @@ -486,10 +485,7 @@ sigreturn(td, uap) td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); td->td_pcb->pcb_flags |= PCB_FULLCTX; td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/amd64/ia32/ia32_signal.c Tue Oct 27 10:47:58 2009 (r198507) @@ -244,10 +244,8 @@ freebsd32_setcontext(struct thread *td, if (ret == 0) { ret = ia32_set_mcontext(td, &uc.uc_mcontext); if (ret == 0) { - SIG_CANTMASK(uc.uc_sigmask); - PROC_LOCK(td->td_proc); - td->td_sigmask = uc.uc_sigmask; - PROC_UNLOCK(td->td_proc); + kern_sigprocmask(td, SIG_SETMASK, + &uc.uc_sigmask, NULL, 0); } } } @@ -273,10 +271,8 @@ freebsd32_swapcontext(struct thread *td, if (ret == 0) { ret = ia32_set_mcontext(td, &uc.uc_mcontext); if (ret == 0) { - SIG_CANTMASK(uc.uc_sigmask); - PROC_LOCK(td->td_proc); - td->td_sigmask = uc.uc_sigmask; - PROC_UNLOCK(td->td_proc); + kern_sigprocmask(td, SIG_SETMASK, + &uc.uc_sigmask, NULL, 0); } } } @@ -544,9 +540,8 @@ freebsd4_freebsd32_sigreturn(td, uap) } */ *uap; { struct ia32_ucontext4 uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const struct ia32_ucontext4 *ucp; + struct ia32_ucontext4 *ucp; int cs, eflags, error; ksiginfo_t ksi; @@ -610,11 +605,7 @@ freebsd4_freebsd32_sigreturn(td, uap) regs->tf_fs = ucp->uc_mcontext.mc_fs; regs->tf_gs = ucp->uc_mcontext.mc_gs; - PROC_LOCK(p); - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } @@ -631,9 +622,8 @@ freebsd32_sigreturn(td, uap) } */ *uap; { struct ia32_ucontext uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const struct ia32_ucontext *ucp; + struct ia32_ucontext *ucp; int cs, eflags, error, ret; ksiginfo_t ksi; @@ -702,11 +692,7 @@ freebsd32_sigreturn(td, uap) regs->tf_gs = ucp->uc_mcontext.mc_gs; regs->tf_flags = TF_HASSEGS; - PROC_LOCK(p); - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); td->td_pcb->pcb_full_iret = 1; return (EJUSTRETURN); } Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Oct 27 10:47:58 2009 (r198507) @@ -565,9 +565,9 @@ linux_sendsig(sig_t catcher, ksiginfo_t int linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) { - struct proc *p = td->td_proc; struct l_sigframe frame; struct trapframe *regs; + sigset_t bmask; l_sigset_t lmask; int eflags, i; ksiginfo_t ksi; @@ -623,11 +623,8 @@ linux_sigreturn(struct thread *td, struc lmask.__bits[0] = frame.sf_sc.sc_mask; for (i = 0; i < (LINUX_NSIG_WORDS-1); i++) lmask.__bits[i+1] = frame.sf_extramask[i]; - PROC_LOCK(p); - linux_to_bsd_sigset(&lmask, &td->td_sigmask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + linux_to_bsd_sigset(&lmask, &bmask); + kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); /* * Restore signal context. @@ -666,9 +663,9 @@ linux_sigreturn(struct thread *td, struc int linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) { - struct proc *p = td->td_proc; struct l_ucontext uc; struct l_sigcontext *context; + sigset_t bmask; l_stack_t *lss; stack_t ss; struct trapframe *regs; @@ -725,11 +722,8 @@ linux_rt_sigreturn(struct thread *td, st return(EINVAL); } - PROC_LOCK(p); - linux_to_bsd_sigset(&uc.uc_sigmask, &td->td_sigmask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + linux_to_bsd_sigset(&uc.uc_sigmask, &bmask); + kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); /* * Restore signal context Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/arm/arm/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -605,7 +605,6 @@ sigreturn(td, uap) const struct __ucontext *sigcntxp; } */ *uap; { - struct proc *p = td->td_proc; struct sigframe sf; struct trapframe *tf; int spsr; @@ -627,11 +626,7 @@ sigreturn(td, uap) set_mcontext(td, &sf.sf_uc.uc_mcontext); /* Restore signal mask. */ - PROC_LOCK(p); - td->td_sigmask = sf.sf_uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &sf.sf_uc.uc_sigmask, NULL, 0); return (EJUSTRETURN); } Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:47:58 2009 (r198507) @@ -2482,7 +2482,7 @@ ofreebsd32_sigprocmask(struct thread *td int error; OSIG2SIG(uap->mask, set); - error = kern_sigprocmask(td, uap->how, &set, &oset, 1); + error = kern_sigprocmask(td, uap->how, &set, &oset, SIGPROCMASK_OLD); SIG2OSIG(oset, td->td_retval[0]); return (error); } @@ -2546,15 +2546,11 @@ int ofreebsd32_sigblock(struct thread *td, struct ofreebsd32_sigblock_args *uap) { - struct proc *p = td->td_proc; - sigset_t set; + sigset_t set, oset; OSIG2SIG(uap->mask, set); - SIG_CANTMASK(set); - PROC_LOCK(p); - SIG2OSIG(td->td_sigmask, td->td_retval[0]); - SIGSETOR(td->td_sigmask, set); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_BLOCK, &set, &oset, 0); + SIG2OSIG(oset, td->td_retval[0]); return (0); } @@ -2562,16 +2558,11 @@ int ofreebsd32_sigsetmask(struct thread *td, struct ofreebsd32_sigsetmask_args *uap) { - struct proc *p = td->td_proc; - sigset_t set; + sigset_t set, oset; OSIG2SIG(uap->mask, set); - SIG_CANTMASK(set); - PROC_LOCK(p); - SIG2OSIG(td->td_sigmask, td->td_retval[0]); - SIGSETLO(td->td_sigmask, set); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &set, &oset, 0); + SIG2OSIG(oset, td->td_retval[0]); return (0); } Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/i386/i386/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -756,7 +756,6 @@ osigreturn(td, uap) struct osigcontext sc; struct trapframe *regs; struct osigcontext *scp; - struct proc *p = td->td_proc; int eflags, error; ksiginfo_t ksi; @@ -856,17 +855,14 @@ osigreturn(td, uap) regs->tf_eip = scp->sc_pc; regs->tf_eflags = eflags; - PROC_LOCK(p); #if defined(COMPAT_43) if (scp->sc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - SIGSETOLD(td->td_sigmask, scp->sc_mask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, (sigset_t *)&scp->sc_mask, NULL, + SIGPROCMASK_OLD); return (EJUSTRETURN); } #endif /* COMPAT_43 */ @@ -883,9 +879,8 @@ freebsd4_sigreturn(td, uap) } */ *uap; { struct ucontext4 uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const struct ucontext4 *ucp; + struct ucontext4 *ucp; int cs, eflags, error; ksiginfo_t ksi; @@ -973,18 +968,13 @@ freebsd4_sigreturn(td, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } - PROC_LOCK(p); #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); return (EJUSTRETURN); } #endif /* COMPAT_FREEBSD4 */ @@ -1000,9 +990,8 @@ sigreturn(td, uap) } */ *uap; { ucontext_t uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const ucontext_t *ucp; + ucontext_t *ucp; int cs, eflags, error, ret; ksiginfo_t ksi; @@ -1094,7 +1083,6 @@ sigreturn(td, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } - PROC_LOCK(p); #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; @@ -1102,10 +1090,7 @@ sigreturn(td, uap) td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); return (EJUSTRETURN); } Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/i386/linux/linux_sysvec.c Tue Oct 27 10:47:58 2009 (r198507) @@ -667,10 +667,10 @@ linux_sendsig(sig_t catcher, ksiginfo_t int linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args) { - struct proc *p = td->td_proc; struct l_sigframe frame; struct trapframe *regs; l_sigset_t lmask; + sigset_t bmask; int eflags, i; ksiginfo_t ksi; @@ -725,11 +725,8 @@ linux_sigreturn(struct thread *td, struc lmask.__bits[0] = frame.sf_sc.sc_mask; for (i = 0; i < (LINUX_NSIG_WORDS-1); i++) lmask.__bits[i+1] = frame.sf_extramask[i]; - PROC_LOCK(p); - linux_to_bsd_sigset(&lmask, &td->td_sigmask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + linux_to_bsd_sigset(&lmask, &bmask); + kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); /* * Restore signal context. @@ -767,9 +764,9 @@ linux_sigreturn(struct thread *td, struc int linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args) { - struct proc *p = td->td_proc; struct l_ucontext uc; struct l_sigcontext *context; + sigset_t bmask; l_stack_t *lss; stack_t ss; struct trapframe *regs; @@ -826,11 +823,8 @@ linux_rt_sigreturn(struct thread *td, st return(EINVAL); } - PROC_LOCK(p); - linux_to_bsd_sigset(&uc.uc_sigmask, &td->td_sigmask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + linux_to_bsd_sigset(&uc.uc_sigmask, &bmask); + kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0); /* * Restore signal context Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/ia64/ia64/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -1056,11 +1056,9 @@ sigreturn(struct thread *td, { ucontext_t uc; struct trapframe *tf; - struct proc *p; struct pcb *pcb; tf = td->td_frame; - p = td->td_proc; pcb = td->td_pcb; /* @@ -1072,17 +1070,13 @@ sigreturn(struct thread *td, set_mcontext(td, &uc.uc_mcontext); - PROC_LOCK(p); #if defined(COMPAT_43) if (sigonstack(tf->tf_special.sp)) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); return (EJUSTRETURN); } Modified: head/sys/kern/kern_context.c ============================================================================== --- head/sys/kern/kern_context.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/kern/kern_context.c Tue Oct 27 10:47:58 2009 (r198507) @@ -89,10 +89,8 @@ setcontext(struct thread *td, struct set if (ret == 0) { ret = set_mcontext(td, &uc.uc_mcontext); if (ret == 0) { - SIG_CANTMASK(uc.uc_sigmask); - PROC_LOCK(td->td_proc); - td->td_sigmask = uc.uc_sigmask; - PROC_UNLOCK(td->td_proc); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, + NULL, 0); } } } @@ -118,10 +116,8 @@ swapcontext(struct thread *td, struct sw if (ret == 0) { ret = set_mcontext(td, &uc.uc_mcontext); if (ret == 0) { - SIG_CANTMASK(uc.uc_sigmask); - PROC_LOCK(td->td_proc); - td->td_sigmask = uc.uc_sigmask; - PROC_UNLOCK(td->td_proc); + kern_sigprocmask(td, SIG_SETMASK, + &uc.uc_sigmask, NULL, 0); } } } Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/kern/kern_sig.c Tue Oct 27 10:47:58 2009 (r198507) @@ -1396,15 +1396,11 @@ osigblock(td, uap) register struct thread *td; struct osigblock_args *uap; { - struct proc *p = td->td_proc; - sigset_t set; + sigset_t set, oset; OSIG2SIG(uap->mask, set); - SIG_CANTMASK(set); - PROC_LOCK(p); - SIG2OSIG(td->td_sigmask, td->td_retval[0]); - SIGSETOR(td->td_sigmask, set); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_BLOCK, &set, &oset, 0); + SIG2OSIG(oset, td->td_retval[0]); return (0); } @@ -1418,16 +1414,11 @@ osigsetmask(td, uap) struct thread *td; struct osigsetmask_args *uap; { - struct proc *p = td->td_proc; - sigset_t set; + sigset_t set, oset; OSIG2SIG(uap->mask, set); - SIG_CANTMASK(set); - PROC_LOCK(p); - SIG2OSIG(td->td_sigmask, td->td_retval[0]); - SIGSETLO(td->td_sigmask, set); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &set, &oset, 0); + SIG2OSIG(oset, td->td_retval[0]); return (0); } #endif /* COMPAT_43 */ @@ -1845,6 +1836,7 @@ void trapsignal(struct thread *td, ksiginfo_t *ksi) { struct sigacts *ps; + sigset_t mask; struct proc *p; int sig; int code; @@ -1868,8 +1860,11 @@ trapsignal(struct thread *td, ksiginfo_t (*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], ksi, &td->td_sigmask); SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]); - if (!SIGISMEMBER(ps->ps_signodefer, sig)) - SIGADDSET(td->td_sigmask, sig); + if (!SIGISMEMBER(ps->ps_signodefer, sig)) { + SIGEMPTYSET(mask); + SIGADDSET(mask, sig); + kern_sigprocmask(td, SIG_BLOCK, &mask, NULL, 0); + } if (SIGISMEMBER(ps->ps_sigreset, sig)) { /* * See kern_sigaction() for origin of this code. @@ -2683,7 +2678,7 @@ postsig(sig) struct sigacts *ps; sig_t action; ksiginfo_t ksi; - sigset_t returnmask; + sigset_t returnmask, mask; KASSERT(sig != 0, ("postsig")); @@ -2738,9 +2733,15 @@ postsig(sig) } else returnmask = td->td_sigmask; - SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]); - if (!SIGISMEMBER(ps->ps_signodefer, sig)) - SIGADDSET(td->td_sigmask, sig); + kern_sigprocmask(td, SIG_BLOCK, + &ps->ps_catchmask[_SIG_IDX(sig)], NULL, + SIGPROCMASK_PROC_LOCKED); + if (!SIGISMEMBER(ps->ps_signodefer, sig)) { + SIGEMPTYSET(mask); + SIGADDSET(mask, sig); + kern_sigprocmask(td, SIG_BLOCK, &mask, NULL, + SIGPROCMASK_PROC_LOCKED); + } if (SIGISMEMBER(ps->ps_sigreset, sig)) { /* Modified: head/sys/mips/mips/pm_machdep.c ============================================================================== --- head/sys/mips/mips/pm_machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/mips/mips/pm_machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -213,13 +213,11 @@ int sigreturn(struct thread *td, struct sigreturn_args *uap) { struct trapframe *regs; - const ucontext_t *ucp; - struct proc *p; + ucontext_t *ucp; ucontext_t uc; int error; ucp = &uc; - p = td->td_proc; error = copyin(uap->sigcntxp, &uc, sizeof(uc)); if (error != 0) @@ -229,7 +227,7 @@ sigreturn(struct thread *td, struct sigr /* #ifdef DEBUG */ if (ucp->uc_mcontext.mc_regs[ZERO] != UCONTEXT_MAGIC) { - printf("sigreturn: pid %d, ucp %p\n", p->p_pid, ucp); + printf("sigreturn: pid %d, ucp %p\n", td->td_proc->p_pid, ucp); printf(" old sp %x ra %x pc %x\n", regs->sp, regs->ra, regs->pc); printf(" new sp %x ra %x pc %x z %x\n", @@ -253,11 +251,8 @@ sigreturn(struct thread *td, struct sigr regs->mullo = ucp->uc_mcontext.mullo; regs->mulhi = ucp->uc_mcontext.mulhi; - PROC_LOCK(p); - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); + return(EJUSTRETURN); } Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/pc98/pc98/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -686,7 +686,6 @@ osigreturn(td, uap) struct osigcontext sc; struct trapframe *regs; struct osigcontext *scp; - struct proc *p = td->td_proc; int eflags, error; ksiginfo_t ksi; @@ -786,17 +785,14 @@ osigreturn(td, uap) regs->tf_eip = scp->sc_pc; regs->tf_eflags = eflags; - PROC_LOCK(p); #if defined(COMPAT_43) if (scp->sc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - SIGSETOLD(td->td_sigmask, scp->sc_mask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, (sigset_t *)&scp->sc_mask, NULL, + SIGPROCMASK_OLD); return (EJUSTRETURN); } #endif /* COMPAT_43 */ @@ -813,9 +809,8 @@ freebsd4_sigreturn(td, uap) } */ *uap; { struct ucontext4 uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const struct ucontext4 *ucp; + struct ucontext4 *ucp; int cs, eflags, error; ksiginfo_t ksi; @@ -903,18 +898,13 @@ freebsd4_sigreturn(td, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } - PROC_LOCK(p); #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif - - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); return (EJUSTRETURN); } #endif /* COMPAT_FREEBSD4 */ @@ -930,9 +920,8 @@ sigreturn(td, uap) } */ *uap; { ucontext_t uc; - struct proc *p = td->td_proc; struct trapframe *regs; - const ucontext_t *ucp; + ucontext_t *ucp; int cs, eflags, error, ret; ksiginfo_t ksi; @@ -1024,18 +1013,14 @@ sigreturn(td, uap) bcopy(&ucp->uc_mcontext.mc_fs, regs, sizeof(*regs)); } - PROC_LOCK(p); #if defined(COMPAT_43) if (ucp->uc_mcontext.mc_onstack & 1) td->td_sigstk.ss_flags |= SS_ONSTACK; else td->td_sigstk.ss_flags &= ~SS_ONSTACK; #endif + kern_sigprocmask(td, SIG_SETMASK, &ucp->uc_sigmask, NULL, 0); - td->td_sigmask = ucp->uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); return (EJUSTRETURN); } Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/powerpc/aim/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -692,7 +692,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, int sigreturn(struct thread *td, struct sigreturn_args *uap) { - struct proc *p; ucontext_t uc; int error; @@ -707,12 +706,7 @@ sigreturn(struct thread *td, struct sigr if (error != 0) return (error); - p = td->td_proc; - PROC_LOCK(p); - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); Modified: head/sys/powerpc/booke/machdep.c ============================================================================== --- head/sys/powerpc/booke/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/powerpc/booke/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -665,7 +665,6 @@ set_mcontext(struct thread *td, const mc int sigreturn(struct thread *td, struct sigreturn_args *uap) { - struct proc *p; ucontext_t uc; int error; @@ -680,12 +679,7 @@ sigreturn(struct thread *td, struct sigr if (error != 0) return (error); - p = td->td_proc; - PROC_LOCK(p); - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/sparc64/sparc64/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -653,11 +653,7 @@ sigreturn(struct thread *td, struct sigr if (error != 0) return (error); - PROC_LOCK(p); - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR4(KTR_SIG, "sigreturn: return td=%p pc=%#lx sp=%#lx tstate=%#lx", td, mc->mc_tpc, mc->mc_sp, mc->mc_tstate); Modified: head/sys/sun4v/sun4v/machdep.c ============================================================================== --- head/sys/sun4v/sun4v/machdep.c Tue Oct 27 10:42:24 2009 (r198506) +++ head/sys/sun4v/sun4v/machdep.c Tue Oct 27 10:47:58 2009 (r198507) @@ -667,11 +667,7 @@ sigreturn(struct thread *td, struct sigr if (error != 0) return (error); - PROC_LOCK(p); - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); CTR4(KTR_SIG, "sigreturn: return td=%p pc=%#lx sp=%#lx tstate=%#lx", td, mc->mc_tpc, mc->mc_sp, mc->mc_tstate); From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:55:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA41F106568D; Tue, 27 Oct 2009 10:55:34 +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 A79D68FC0A; Tue, 27 Oct 2009 10:55: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 n9RAtYQk029115; Tue, 27 Oct 2009 10:55:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RAtYM5029106; Tue, 27 Oct 2009 10:55:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271055.n9RAtYM5029106@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 10:55: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: r198508 - in head: lib/libc/gen lib/libc/sys lib/libthr/thread sys/compat/freebsd32 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:55:34 -0000 Author: kib Date: Tue Oct 27 10:55:34 2009 New Revision: 198508 URL: http://svn.freebsd.org/changeset/base/198508 Log: Current pselect(3) is implemented in usermode and thus vulnerable to well-known race condition, which elimination was the reason for the function appearance in first place. If sigmask supplied as argument to pselect() enables a signal, the signal might be delivered before thread called select(2), causing lost wakeup. Reimplement pselect() in kernel, making change of sigmask and sleep atomic. Since signal shall be delivered to the usermode, but sigmask restored, set TDP_OLDMASK and save old mask in td_oldsigmask. The TDP_OLDMASK should be cleared by ast() in case signal was not gelivered during syscall execution. Reviewed by: davidxu Tested by: pho MFC after: 1 month Deleted: head/lib/libc/gen/pselect.c Modified: head/lib/libc/sys/Symbol.map head/lib/libthr/thread/thr_syscalls.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/subr_trap.c head/sys/kern/sys_generic.c head/sys/kern/syscalls.master head/sys/sys/syscallsubr.h Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Tue Oct 27 10:47:58 2009 (r198507) +++ head/lib/libc/sys/Symbol.map Tue Oct 27 10:55:34 2009 (r198508) @@ -211,6 +211,7 @@ FBSD_1.0 { posix_openpt; preadv; profil; + pselect; ptrace; pwritev; quotactl; @@ -781,6 +782,8 @@ FBSDprivate_1.0 { __sys_preadv; _profil; __sys_profil; + _pselect; + __sys_pselect; _ptrace; __sys_ptrace; _pwritev; Modified: head/lib/libthr/thread/thr_syscalls.c ============================================================================== --- head/lib/libthr/thread/thr_syscalls.c Tue Oct 27 10:47:58 2009 (r198507) +++ head/lib/libthr/thread/thr_syscalls.c Tue Oct 27 10:55:34 2009 (r198508) @@ -104,6 +104,8 @@ extern int __sys_accept(int, struct sock extern int __sys_connect(int, const struct sockaddr *, socklen_t); extern int __sys_fsync(int); extern int __sys_msync(void *, size_t, int); +extern int __sys_pselect(int, fd_set *, fd_set *, fd_set *, + const struct timespec *, const sigset_t *); extern int __sys_poll(struct pollfd *, unsigned, int); extern ssize_t __sys_recv(int, void *, size_t, int); extern ssize_t __sys_recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); @@ -394,7 +396,7 @@ ___pselect(int count, fd_set *rfds, fd_s int ret; _thr_cancel_enter(curthread); - ret = __pselect(count, rfds, wfds, efds, timo, mask); + ret = __sys_pselect(count, rfds, wfds, efds, timo, mask); _thr_cancel_leave(curthread); return (ret); Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 27 10:55:34 2009 (r198508) @@ -593,6 +593,41 @@ freebsd32_select(struct thread *td, stru sizeof(int32_t) * 8)); } +int +freebsd32_pselect(struct thread *td, struct freebsd32_pselect_args *uap) +{ + struct timespec32 ts32; + struct timespec ts; + struct timeval tv, *tvp; + sigset_t set, *uset; + int error; + + if (uap->ts != NULL) { + error = copyin(uap->ts, &ts32, sizeof(ts32)); + if (error != 0) + return (error); + CP(ts32, ts, tv_sec); + CP(ts32, ts, tv_nsec); + TIMESPEC_TO_TIMEVAL(&tv, &ts); + tvp = &tv; + } else + tvp = NULL; + if (uap->sm != NULL) { + error = copyin(uap->sm, &set, sizeof(set)); + if (error != 0) + return (error); + uset = &set; + } else + uset = NULL; + /* + * XXX big-endian needs to convert the fd_sets too. + * XXX Do pointers need PTRIN()? + */ + error = kern_pselect(td, uap->nd, uap->in, uap->ou, uap->ex, tvp, + uset, sizeof(int32_t) * 8); + return (error); +} + /* * Copy 'count' items into the destination list pointed to by uap->eventlist. */ Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/compat/freebsd32/syscalls.master Tue Oct 27 10:55:34 2009 (r198508) @@ -909,3 +909,7 @@ 519 AUE_PDKILL UNIMPL pdkill 520 AUE_PDGETPID UNIMPL pdgetpid 521 AUE_PDWAIT UNIMPL pdwait +522 AUE_SELECT STD { int freebsd32_pselect(int nd, fd_set *in, \ + fd_set *ou, fd_set *ex, \ + const struct timespec32 *ts, \ + const sigset_t *sm); } Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/kern/subr_trap.c Tue Oct 27 10:55:34 2009 (r198508) @@ -245,6 +245,11 @@ ast(struct trapframe *framep) PROC_UNLOCK(p); } + if (td->td_pflags & TDP_OLDMASK) { + td->td_pflags &= ~TDP_OLDMASK; + kern_sigprocmask(td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0); + } + userret(td, framep); mtx_assert(&Giant, MA_NOTOWNED); } Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/kern/sys_generic.c Tue Oct 27 10:55:34 2009 (r198508) @@ -751,6 +751,58 @@ poll_no_poll(int events) return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); } +int +pselect(struct thread *td, struct pselect_args *uap) +{ + struct timespec ts; + struct timeval tv, *tvp; + sigset_t set, *uset; + int error; + + if (uap->ts != NULL) { + error = copyin(uap->ts, &ts, sizeof(ts)); + if (error != 0) + return (error); + TIMESPEC_TO_TIMEVAL(&tv, &ts); + tvp = &tv; + } else + tvp = NULL; + if (uap->sm != NULL) { + error = copyin(uap->sm, &set, sizeof(set)); + if (error != 0) + return (error); + uset = &set; + } else + uset = NULL; + return (kern_pselect(td, uap->nd, uap->in, uap->ou, uap->ex, tvp, + uset, NFDBITS)); +} + +int +kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, fd_set *ex, + struct timeval *tvp, sigset_t *uset, int abi_nfdbits) +{ + int error; + + if (uset != NULL) { + error = kern_sigprocmask(td, SIG_SETMASK, uset, + &td->td_oldsigmask, 0); + if (error != 0) + return (error); + td->td_pflags |= TDP_OLDMASK; + /* + * Make sure that ast() is called on return to + * usermode and TDP_OLDMASK is cleared, restoring old + * sigmask. + */ + thread_lock(td); + td->td_flags |= TDF_ASTPENDING; + thread_unlock(td); + } + error = kern_select(td, nd, in, ou, ex, tvp, abi_nfdbits); + return (error); +} + #ifndef _SYS_SYSPROTO_H_ struct select_args { int nd; @@ -759,9 +811,7 @@ struct select_args { }; #endif int -select(td, uap) - register struct thread *td; - register struct select_args *uap; +select(struct thread *td, struct select_args *uap) { struct timeval tv, *tvp; int error; Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/kern/syscalls.master Tue Oct 27 10:55:34 2009 (r198508) @@ -919,5 +919,9 @@ 519 AUE_PDKILL UNIMPL pdkill 520 AUE_PDGETPID UNIMPL pdgetpid 521 AUE_PDWAIT UNIMPL pdwait +522 AUE_SELECT STD { int pselect(int nd, fd_set *in, \ + fd_set *ou, fd_set *ex, \ + const struct timespec *ts, \ + const sigset_t *sm); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Oct 27 10:47:58 2009 (r198507) +++ head/sys/sys/syscallsubr.h Tue Oct 27 10:55:34 2009 (r198508) @@ -148,6 +148,8 @@ int kern_pathconf(struct thread *td, cha int name, u_long flags); int kern_pipe(struct thread *td, int fildes[2]); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); +int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, + fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data); int kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset); From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 10:57:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96D921065670; Tue, 27 Oct 2009 10:57:53 +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 86BF78FC24; Tue, 27 Oct 2009 10:57: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 n9RAvrZk029236; Tue, 27 Oct 2009 10:57:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RAvrfn029233; Tue, 27 Oct 2009 10:57:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271057.n9RAvrfn029233@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 10:57: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: r198509 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 10:57:53 -0000 Author: kib Date: Tue Oct 27 10:57:53 2009 New Revision: 198509 URL: http://svn.freebsd.org/changeset/base/198509 Log: Commit libc files missed in r198508 Modified: head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/pselect.3 Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Tue Oct 27 10:55:34 2009 (r198508) +++ head/lib/libc/gen/Makefile.inc Tue Oct 27 10:57:53 2009 (r198509) @@ -21,7 +21,7 @@ SRCS+= __getosreldate.c __xuname.c \ initgroups.c isatty.c isinf.c isnan.c jrand48.c lcong48.c \ lockf.c lrand48.c mrand48.c nftw.c nice.c \ nlist.c nrand48.c opendir.c \ - pause.c pmadvise.c popen.c posix_spawn.c pselect.c \ + pause.c pmadvise.c popen.c posix_spawn.c \ psignal.c pw_scan.c pwcache.c \ raise.c readdir.c readpassphrase.c rewinddir.c \ scandir.c seed48.c seekdir.c sem.c semctl.c \ Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Tue Oct 27 10:55:34 2009 (r198508) +++ head/lib/libc/gen/Symbol.map Tue Oct 27 10:57:53 2009 (r198509) @@ -223,7 +223,6 @@ FBSD_1.0 { posix_madvise; popen; pclose; - pselect; psignal; raise; readdir; @@ -454,7 +453,6 @@ FBSDprivate_1.0 { __opendir2; __pause; _pause; - __pselect; __pw_scan; /* Used by (at least) libutil */ __raise; _raise; Modified: head/lib/libc/gen/pselect.3 ============================================================================== --- head/lib/libc/gen/pselect.3 Tue Oct 27 10:55:34 2009 (r198508) +++ head/lib/libc/gen/pselect.3 Tue Oct 27 10:57:53 2009 (r198509) @@ -88,11 +88,6 @@ for a more detailed discussion of the se for macros used to manipulate the .Vt "fd_set" data type. -.Sh IMPLEMENTATION NOTES -The -.Fn pselect -function is implemented in the C library as a wrapper around -.Fn select . .Sh RETURN VALUES The .Fn pselect From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 11:01:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00A501065676; Tue, 27 Oct 2009 11:01:16 +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 E48CB8FC1D; Tue, 27 Oct 2009 11:01: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 n9RB1FYK029439; Tue, 27 Oct 2009 11:01:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RB1F1i029435; Tue, 27 Oct 2009 11:01:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271101.n9RB1F1i029435@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 11:01: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: r198510 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 11:01:16 -0000 Author: kib Date: Tue Oct 27 11:01:15 2009 New Revision: 198510 URL: http://svn.freebsd.org/changeset/base/198510 Log: Regenerate Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Tue Oct 27 10:57:53 2009 (r198509) +++ head/sys/kern/init_sysent.c Tue Oct 27 11:01:15 2009 (r198510) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #include "opt_compat.h" @@ -556,4 +556,5 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 519 = pdkill */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 520 = pdgetpid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 521 = pdwait */ + { AS(pselect_args), (sy_call_t *)pselect, AUE_SELECT, NULL, 0, 0, 0 }, /* 522 = pselect */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Tue Oct 27 10:57:53 2009 (r198509) +++ head/sys/kern/syscalls.c Tue Oct 27 11:01:15 2009 (r198510) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 198508 2009-10-27 10:55:34Z kib */ const char *syscallnames[] = { @@ -529,4 +529,5 @@ const char *syscallnames[] = { "#519", /* 519 = pdkill */ "#520", /* 520 = pdgetpid */ "#521", /* 521 = pdwait */ + "pselect", /* 522 = pselect */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Tue Oct 27 10:57:53 2009 (r198509) +++ head/sys/kern/systrace_args.c Tue Oct 27 11:01:15 2009 (r198510) @@ -3072,6 +3072,18 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } + /* pselect */ + case 522: { + struct pselect_args *p = params; + iarg[0] = p->nd; /* int */ + uarg[1] = (intptr_t) p->in; /* fd_set * */ + uarg[2] = (intptr_t) p->ou; /* fd_set * */ + uarg[3] = (intptr_t) p->ex; /* fd_set * */ + uarg[4] = (intptr_t) p->ts; /* const struct timespec * */ + uarg[5] = (intptr_t) p->sm; /* const sigset_t * */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -8154,6 +8166,31 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* pselect */ + case 522: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "fd_set *"; + break; + case 2: + p = "fd_set *"; + break; + case 3: + p = "fd_set *"; + break; + case 4: + p = "const struct timespec *"; + break; + case 5: + p = "const sigset_t *"; + break; + default: + break; + }; + break; default: break; }; From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 11:01:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8653F1065679; Tue, 27 Oct 2009 11:01:40 +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 75EA28FC17; Tue, 27 Oct 2009 11:01: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 n9RB1eSV029483; Tue, 27 Oct 2009 11:01:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RB1eM1029479; Tue, 27 Oct 2009 11:01:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271101.n9RB1eM1029479@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 11:01: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: r198511 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 11:01:40 -0000 Author: kib Date: Tue Oct 27 11:01:40 2009 New Revision: 198511 URL: http://svn.freebsd.org/changeset/base/198511 Log: Regenerate Modified: head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Tue Oct 27 11:01:15 2009 (r198510) +++ head/sys/sys/syscall.h Tue Oct 27 11:01:40 2009 (r198511) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #define SYS_syscall 0 @@ -428,4 +428,5 @@ #define SYS_msgctl 511 #define SYS_shmctl 512 #define SYS_lpathconf 513 -#define SYS_MAXSYSCALL 522 +#define SYS_pselect 522 +#define SYS_MAXSYSCALL 523 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Tue Oct 27 11:01:15 2009 (r198510) +++ head/sys/sys/syscall.mk Tue Oct 27 11:01:40 2009 (r198511) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 197636 2009-09-30 08:46:01Z rwatson +# created from FreeBSD: head/sys/kern/syscalls.master 198508 2009-10-27 10:55:34Z kib MIASM = \ syscall.o \ exit.o \ @@ -376,4 +376,5 @@ MIASM = \ __semctl.o \ msgctl.o \ shmctl.o \ - lpathconf.o + lpathconf.o \ + pselect.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Tue Oct 27 11:01:15 2009 (r198510) +++ head/sys/sys/sysproto.h Tue Oct 27 11:01:40 2009 (r198511) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/kern/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #ifndef _SYS_SYSPROTO_H_ @@ -1641,6 +1641,14 @@ struct lpathconf_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)]; }; +struct pselect_args { + char nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)]; + char in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)]; + char ou_l_[PADL_(fd_set *)]; fd_set * ou; char ou_r_[PADR_(fd_set *)]; + char ex_l_[PADL_(fd_set *)]; fd_set * ex; char ex_r_[PADR_(fd_set *)]; + char ts_l_[PADL_(const struct timespec *)]; const struct timespec * ts; char ts_r_[PADR_(const struct timespec *)]; + char sm_l_[PADL_(const sigset_t *)]; const sigset_t * sm; char sm_r_[PADR_(const sigset_t *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1999,6 +2007,7 @@ int __semctl(struct thread *, struct __s int msgctl(struct thread *, struct msgctl_args *); int shmctl(struct thread *, struct shmctl_args *); int lpathconf(struct thread *, struct lpathconf_args *); +int pselect(struct thread *, struct pselect_args *); #ifdef COMPAT_43 @@ -2671,6 +2680,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_msgctl AUE_MSGCTL #define SYS_AUE_shmctl AUE_SHMCTL #define SYS_AUE_lpathconf AUE_LPATHCONF +#define SYS_AUE_pselect AUE_SELECT #undef PAD_ #undef PADL_ From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 11:02:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 291D6106568D; Tue, 27 Oct 2009 11:02:05 +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 189AD8FC27; Tue, 27 Oct 2009 11:02: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 n9RB248n029532; Tue, 27 Oct 2009 11:02:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RB24WA029527; Tue, 27 Oct 2009 11:02:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200910271102.n9RB24WA029527@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 27 Oct 2009 11:02: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: r198512 - head/sys/compat/freebsd32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 11:02:05 -0000 Author: kib Date: Tue Oct 27 11:02:04 2009 New Revision: 198512 URL: http://svn.freebsd.org/changeset/base/198512 Log: Regenerate Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Tue Oct 27 11:01:40 2009 (r198511) +++ head/sys/compat/freebsd32/freebsd32_proto.h Tue Oct 27 11:02:04 2009 (r198512) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -453,6 +453,14 @@ struct freebsd32_shmctl_args { char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; char buf_l_[PADL_(struct shmid_ds32 *)]; struct shmid_ds32 * buf; char buf_r_[PADR_(struct shmid_ds32 *)]; }; +struct freebsd32_pselect_args { + char nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)]; + char in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)]; + char ou_l_[PADL_(fd_set *)]; fd_set * ou; char ou_r_[PADR_(fd_set *)]; + char ex_l_[PADL_(fd_set *)]; fd_set * ex; char ex_r_[PADR_(fd_set *)]; + char ts_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * ts; char ts_r_[PADR_(const struct timespec32 *)]; + char sm_l_[PADL_(const sigset_t *)]; const sigset_t * sm; char sm_r_[PADR_(const sigset_t *)]; +}; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); @@ -536,6 +544,7 @@ int freebsd32_jail_set(struct thread *, int freebsd32_semctl(struct thread *, struct freebsd32_semctl_args *); int freebsd32_msgctl(struct thread *, struct freebsd32_msgctl_args *); int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); +int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *); #ifdef COMPAT_43 @@ -814,6 +823,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL #define FREEBSD32_SYS_AUE_freebsd32_msgctl AUE_MSGCTL #define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL +#define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT #undef PAD_ #undef PADL_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Tue Oct 27 11:01:40 2009 (r198511) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Tue Oct 27 11:02:04 2009 (r198512) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #define FREEBSD32_SYS_syscall 0 @@ -382,4 +382,5 @@ #define FREEBSD32_SYS_freebsd32_msgctl 511 #define FREEBSD32_SYS_freebsd32_shmctl 512 #define FREEBSD32_SYS_lpathconf 513 -#define FREEBSD32_SYS_MAXSYSCALL 522 +#define FREEBSD32_SYS_freebsd32_pselect 522 +#define FREEBSD32_SYS_MAXSYSCALL 523 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Oct 27 11:01:40 2009 (r198511) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Oct 27 11:02:04 2009 (r198512) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib */ const char *freebsd32_syscallnames[] = { @@ -529,4 +529,5 @@ const char *freebsd32_syscallnames[] = { "#519", /* 519 = pdkill */ "#520", /* 520 = pdgetpid */ "#521", /* 521 = pdwait */ + "freebsd32_pselect", /* 522 = freebsd32_pselect */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Tue Oct 27 11:01:40 2009 (r198511) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Tue Oct 27 11:02:04 2009 (r198512) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 197636 2009-09-30 08:46:01Z rwatson + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 198508 2009-10-27 10:55:34Z kib */ #include "opt_compat.h" @@ -566,4 +566,5 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 519 = pdkill */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 520 = pdgetpid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 521 = pdwait */ + { AS(freebsd32_pselect_args), (sy_call_t *)freebsd32_pselect, AUE_SELECT, NULL, 0, 0, 0 }, /* 522 = freebsd32_pselect */ }; From owner-svn-src-all@FreeBSD.ORG Tue Oct 27 11:08:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768D7106566B; Tue, 27 Oct 2009 11:08:25 +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 2FC1B8FC0A; Tue, 27 Oct 2009 11:08: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 n9RB8PYF029670; Tue, 27 Oct 2009 11:08:25 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RB8P2H029668; Tue, 27 Oct 2009 11:08:25 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200910271108.n9RB8P2H029668@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 27 Oct 2009 11:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198513 - vendor/tzdata/dist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2009 11:08:25 -0000 Author: edwin Date: Tue Oct 27 11:08:24 2009 New Revision: 198513 URL: http://svn.freebsd.org/changeset/base/198513 Log: Vendor import of tzdata2009p - Argentina will not go in DST this year. Obtained from: ftp://elsie.nci.nih.gov/pub/ Modified: vendor/tzdata/dist/southamerica Modified: vendor/tzdata/dist/southamerica ============================================================================== --- vendor/tzdata/dist/southamerica Tue Oct 27 11:02:04 2009 (r198512) +++ vendor/tzdata/dist/southamerica Tue Oct 27 11:08:24 2009 (r198513) @@ -1,5 +1,5 @@ #
-# @(#)southamerica	8.37
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,44 +403,39 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
-# From Alexander Krivenyshev (2009-09-19):
-# Some  Argentinian Provinces (Buenos Aires, Entre Ríos) are opposing to the
-# Daylight Saving Time for the 2009-2010 season.
-#
-# (Spanish)
-# "El cambio de huso horario en Entre Ríos deberá ser aprobado por la
-# Legislatura":
-# 
-# http://www.analisisdigital.com.ar/noticias.php?ed=1&di=0&no=110168
-# 
-# English translation - "The time zone change in Entre Rios must be approved by
-# the Legislature."
-#
-# (Spanish)
-# "Mar del Plata no quiere cambiar la hora."
-# 
-# http://www.mensajeroweb.com.ar/index.php?x=nota/33861/1/mar-del-plata-no-quiere-cambiar-la-hora
-# 
-# English translation - "Mar del Plata is not to change the time"
-#
-# or
-# (some English translation)
-# 
-# http://www.worldtimezone.com/dst_news/dst_news_argentina07.html
-# 
-
-# From Arthur David Olson (2009-09-22):
-# "Mar del Plata no quiere cambiar la hora" translates to
-# "Mar del Plata doesn't want to change the time"
-# (less definitive than "is not to").
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
+#
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -560,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -574,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 11:09:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6947D1065676;
	Tue, 27 Oct 2009 11:09: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 3F5488FC0C;
	Tue, 27 Oct 2009 11:09: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 n9RB945n029727;
	Tue, 27 Oct 2009 11:09:04 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RB94CG029726;
	Tue, 27 Oct 2009 11:09:04 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910271109.n9RB94CG029726@svn.freebsd.org>
From: Edwin Groothuis 
Date: Tue, 27 Oct 2009 11:09:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-vendor@freebsd.org
X-SVN-Group: vendor
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198514 - vendor/tzdata/tzdata2009p
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 11:09:04 -0000

Author: edwin
Date: Tue Oct 27 11:09:03 2009
New Revision: 198514
URL: http://svn.freebsd.org/changeset/base/198514

Log:
  Tag of tzdata2009p

Added:
  vendor/tzdata/tzdata2009p/
     - copied from r198513, vendor/tzdata/dist/

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 11:13:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A358F1065676;
	Tue, 27 Oct 2009 11:13:51 +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 91E348FC08;
	Tue, 27 Oct 2009 11:13: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 n9RBDpvs029900;
	Tue, 27 Oct 2009 11:13:51 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RBDpSt029898;
	Tue, 27 Oct 2009 11:13:51 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910271113.n9RBDpSt029898@svn.freebsd.org>
From: Edwin Groothuis 
Date: Tue, 27 Oct 2009 11:13: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: r198515 - head/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 11:13:51 -0000

Author: edwin
Date: Tue Oct 27 11:13:51 2009
New Revision: 198515
URL: http://svn.freebsd.org/changeset/base/198515

Log:
  MFV of tzdata2009p
  Merge of r198513
  
  - Argentina does not go to DST this year.

Modified:
  head/share/zoneinfo/   (props changed)
  head/share/zoneinfo/southamerica

Modified: head/share/zoneinfo/southamerica
==============================================================================
--- head/share/zoneinfo/southamerica	Tue Oct 27 11:09:03 2009	(r198514)
+++ head/share/zoneinfo/southamerica	Tue Oct 27 11:13:51 2009	(r198515)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.37
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,44 +403,39 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
-# From Alexander Krivenyshev (2009-09-19):
-# Some  Argentinian Provinces (Buenos Aires, Entre Ríos) are opposing to the
-# Daylight Saving Time for the 2009-2010 season.
-#
-# (Spanish)
-# "El cambio de huso horario en Entre Ríos deberá ser aprobado por la
-# Legislatura":
-# 
-# http://www.analisisdigital.com.ar/noticias.php?ed=1&di=0&no=110168
-# 
-# English translation - "The time zone change in Entre Rios must be approved by
-# the Legislature."
-#
-# (Spanish)
-# "Mar del Plata no quiere cambiar la hora."
-# 
-# http://www.mensajeroweb.com.ar/index.php?x=nota/33861/1/mar-del-plata-no-quiere-cambiar-la-hora
-# 
-# English translation - "Mar del Plata is not to change the time"
-#
-# or
-# (some English translation)
-# 
-# http://www.worldtimezone.com/dst_news/dst_news_argentina07.html
-# 
-
-# From Arthur David Olson (2009-09-22):
-# "Mar del Plata no quiere cambiar la hora" translates to
-# "Mar del Plata doesn't want to change the time"
-# (less definitive than "is not to").
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
+#
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -560,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -574,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 14:33:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6BD6F1065696;
	Tue, 27 Oct 2009 14:33:22 +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 407FD8FC20;
	Tue, 27 Oct 2009 14:33: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 n9REXMZf033708;
	Tue, 27 Oct 2009 14:33:22 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9REXMLx033707;
	Tue, 27 Oct 2009 14:33:22 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <200910271433.n9REXMLx033707@svn.freebsd.org>
From: Andrew Gallatin 
Date: Tue, 27 Oct 2009 14:33:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198516 - in stable/7/sys: . contrib/pf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 14:33:22 -0000

Author: gallatin
Date: Tue Oct 27 14:33:21 2009
New Revision: 198516
URL: http://svn.freebsd.org/changeset/base/198516

Log:
  MFC of r178332 - Unbreak firmware.ko build without kernel
  
  Actual patch was comitted in r198446; this just updates svn props

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 14:36:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ABB6C106568F;
	Tue, 27 Oct 2009 14:36:37 +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 7FB1B8FC27;
	Tue, 27 Oct 2009 14:36: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 n9REabiY033818;
	Tue, 27 Oct 2009 14:36:37 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9REabY7033817;
	Tue, 27 Oct 2009 14:36:37 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <200910271436.n9REabY7033817@svn.freebsd.org>
From: Andrew Gallatin 
Date: Tue, 27 Oct 2009 14:36:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198517 - in stable/6/sys: . conf contrib/pf dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 14:36:37 -0000

Author: gallatin
Date: Tue Oct 27 14:36:37 2009
New Revision: 198517
URL: http://svn.freebsd.org/changeset/base/198517

Log:
  MFC of r178332 - Unbreak firmware.ko build without kernel
  
  Actual patch was comitted in r198447; this just updates svn props

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 14:37:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 74335106566B;
	Tue, 27 Oct 2009 14:37:25 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 635288FC13;
	Tue, 27 Oct 2009 14:37: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 n9REbPJp033870;
	Tue, 27 Oct 2009 14:37:25 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9REbPhW033868;
	Tue, 27 Oct 2009 14:37:25 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910271437.n9REbPhW033868@svn.freebsd.org>
From: Ed Maste 
Date: Tue, 27 Oct 2009 14:37: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: r198518 - head/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 14:37:25 -0000

Author: emaste
Date: Tue Oct 27 14:37:25 2009
New Revision: 198518
URL: http://svn.freebsd.org/changeset/base/198518

Log:
  Add link for callout_schedule(9).

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Tue Oct 27 14:36:37 2009	(r198517)
+++ head/share/man/man9/Makefile	Tue Oct 27 14:37:25 2009	(r198518)
@@ -1222,6 +1222,7 @@ MLINKS+=timeout.9 callout.9 \
 	timeout.9 callout_init_rw.9 \
 	timeout.9 callout_pending.9 \
 	timeout.9 callout_reset.9 \
+	timeout.9 callout_schedule.9 \
 	timeout.9 callout_stop.9 \
 	timeout.9 untimeout.9
 MLINKS+=ucred.9 crcopy.9 \

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 17:12:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CDC6C106566C;
	Tue, 27 Oct 2009 17:12:59 +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 BCF448FC17;
	Tue, 27 Oct 2009 17:12: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 n9RHCxcr037013;
	Tue, 27 Oct 2009 17:12:59 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RHCxgV037011;
	Tue, 27 Oct 2009 17:12:59 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <200910271712.n9RHCxgV037011@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 27 Oct 2009 17:12: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: r198519 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 17:12:59 -0000

Author: jh
Date: Tue Oct 27 17:12:59 2009
New Revision: 198519
URL: http://svn.freebsd.org/changeset/base/198519

Log:
  Don't ignore the return value of g_modevent() in acd_modevent().
  
  Approved by:	trasz (mentor)

Modified:
  head/sys/dev/ata/atapi-cd.c

Modified: head/sys/dev/ata/atapi-cd.c
==============================================================================
--- head/sys/dev/ata/atapi-cd.c	Tue Oct 27 14:37:25 2009	(r198518)
+++ head/sys/dev/ata/atapi-cd.c	Tue Oct 27 17:12:59 2009	(r198519)
@@ -1905,8 +1905,7 @@ static devclass_t acd_devclass;
 static int
 acd_modevent(module_t mod, int what, void *arg)  
 {
-    g_modevent(0, what, &acd_class);
-    return 0;
+    return g_modevent(0, what, &acd_class);
 }
  
 DRIVER_MODULE(acd, ata, acd_driver, acd_devclass, acd_modevent, NULL);

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 17:14:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0E6A4106568B;
	Tue, 27 Oct 2009 17:14:23 +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 F1E658FC1B;
	Tue, 27 Oct 2009 17:14: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 n9RHEM1u037071;
	Tue, 27 Oct 2009 17:14:22 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RHEMfM037069;
	Tue, 27 Oct 2009 17:14:22 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <200910271714.n9RHEMfM037069@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 27 Oct 2009 17: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: r198520 - head/sys/dev/fdc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 17:14:23 -0000

Author: jh
Date: Tue Oct 27 17:14:22 2009
New Revision: 198520
URL: http://svn.freebsd.org/changeset/base/198520

Log:
  Don't ignore the return value of g_modevent() in fdc_modevent().
  
  Approved by:	trasz (mentor)

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

Modified: head/sys/dev/fdc/fdc.c
==============================================================================
--- head/sys/dev/fdc/fdc.c	Tue Oct 27 17:12:59 2009	(r198519)
+++ head/sys/dev/fdc/fdc.c	Tue Oct 27 17:14:22 2009	(r198520)
@@ -2068,8 +2068,7 @@ static int
 fdc_modevent(module_t mod, int type, void *data)
 {
 
-	g_modevent(NULL, type, &g_fd_class);
-	return (0);
+	return (g_modevent(NULL, type, &g_fd_class));
 }
 
 DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, fdc_modevent, 0);

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 17:22:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0187D106568B;
	Tue, 27 Oct 2009 17:22:04 +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 E406B8FC08;
	Tue, 27 Oct 2009 17:22: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 n9RHM3dP037257;
	Tue, 27 Oct 2009 17:22:03 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RHM33c037255;
	Tue, 27 Oct 2009 17:22:03 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910271722.n9RHM33c037255@svn.freebsd.org>
From: Christian Brueffer 
Date: Tue, 27 Oct 2009 17:22: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: r198521 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 17:22:04 -0000

Author: brueffer
Date: Tue Oct 27 17:22:03 2009
New Revision: 198521
URL: http://svn.freebsd.org/changeset/base/198521

Log:
  Fix typos and mdoc style.

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

Modified: head/share/man/man4/iwn.4
==============================================================================
--- head/share/man/man4/iwn.4	Tue Oct 27 17:14:22 2009	(r198520)
+++ head/share/man/man4/iwn.4	Tue Oct 27 17:22:03 2009	(r198521)
@@ -42,7 +42,8 @@ kernel configuration file:
 .Cd "device firmware"
 .Ed
 .Pp
-You also need to select a firmware for your device. Chose one from:
+You also need to select a firmware for your device.
+Choose one from:
 .Bd -ragged -offset indent
 .Cd "device iwn4965fw"
 .Cd "device iwn5000fw"
@@ -57,7 +58,7 @@ Or you can use
 to include them all.
 .Pp
 Alternatively, to load the driver as a
-module at boot time, place the following line in
+module at boot time, place the following lines in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 if_iwn_load="YES"

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 17:54:35 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3FA1106566C;
	Tue, 27 Oct 2009 17:54:35 +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 B7C598FC0C;
	Tue, 27 Oct 2009 17:54:35 +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 3FA2346B03;
	Tue, 27 Oct 2009 13:54:35 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 843638A01D;
	Tue, 27 Oct 2009 13:54:34 -0400 (EDT)
From: John Baldwin 
To: Konstantin Belousov 
Date: Tue, 27 Oct 2009 10:23:52 -0400
User-Agent: KMail/1.9.7
References: <200910271057.n9RAvrfn029233@svn.freebsd.org>
In-Reply-To: <200910271057.n9RAvrfn029233@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200910271023.52882.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 27 Oct 2009 13:54:34 -0400 (EDT)
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,
	DATE_IN_PAST_03_06,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: r198509 - head/lib/libc/gen
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 17:54:36 -0000

On Tuesday 27 October 2009 6:57:53 am Konstantin Belousov wrote:
> Author: kib
> Date: Tue Oct 27 10:57:53 2009
> New Revision: 198509
> URL: http://svn.freebsd.org/changeset/base/198509
> 
> Log:
>   Commit libc files missed in r198508
> 
> Modified:
>   head/lib/libc/gen/Makefile.inc
>   head/lib/libc/gen/Symbol.map
>   head/lib/libc/gen/pselect.3

Hmm, shouldn't gen/pselect.3 get moved to sys/pselect.2 now?

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 17:54:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F0FE1106566B;
	Tue, 27 Oct 2009 17:54:36 +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 BFA298FC13;
	Tue, 27 Oct 2009 17:54:36 +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 689E346B06;
	Tue, 27 Oct 2009 13:54:36 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id A37638A020;
	Tue, 27 Oct 2009 13:54:35 -0400 (EDT)
From: John Baldwin 
To: pluknet 
Date: Tue, 27 Oct 2009 13:54:31 -0400
User-Agent: KMail/1.9.7
References: <200910261857.n9QIvvcZ000107@svn.freebsd.org>
	
In-Reply-To: 
MIME-Version: 1.0
Content-Disposition: inline
Message-Id: <200910271354.32185.jhb@freebsd.org>
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Tue, 27 Oct 2009 13:54:35 -0400 (EDT)
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-stable@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, svn-src-stable-7@freebsd.org
Subject: Re: svn commit: r198496 - in stable/7: etc etc/mtree include sys
	sys/contrib/pf sys/dev/mfi usr.sbin usr.sbin/acpi
	usr.sbin/adduser usr.sbin/arp usr.sbin/bluetooth
	usr.sbin/bluetooth/btpand usr.sbin/bl...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 17:54:37 -0000

On Monday 26 October 2009 3:21:10 pm pluknet wrote:
> 2009/10/26 John Baldwin :
> > Author: jhb
> > Date: Mon Oct 26 18:57:57 2009
> > New Revision: 198496
> > URL: http://svn.freebsd.org/changeset/base/198496
> >
> > Log:
> > =A0MFC 196200,196211,196280-196282:
> > =A0Introduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell=
=20
PERC5/6
> > =A0controllers. =A0Controller, array, and drive status can be checked, =
basic
> > =A0attributes can be changed, and arrays and spares can be created and=
=20
deleted.
> > =A0Controller firmware can also be flashed.
> >
> > =A0This does not replace MegaCLI, found in ports, as that is officially=
=20
sanctioned
> > =A0and supported by LSI and includes vastly more functionality. =A0Howe=
ver,=20
mfiutil
> > =A0is open source and guaranteed to provide basic functionality, which =
can=20
be
> > =A0especially useful if you have a problem and can't get MegaCLI to wor=
k.
> >
>=20
> John, thank you very much for mfc'ing those nice mfi- and mptutil!
> It's interesting to know if this can be mfc'ed to 6 safely in principle,
> without breaking some of existing interfaces.
> I tried to use both on 6, and my experience was quite successful.

They should both work fine on 6, though I do not have any plans to MFC them
in FreeBSD itself.  mfiutil has even been known to work on 4.x. :)  Also, 8=
=2E0=20
will ship before 7.3. :)

=2D-=20
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 18:17:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3D3BF106566C;
	Tue, 27 Oct 2009 18:17:08 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2C6448FC08;
	Tue, 27 Oct 2009 18:17: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 n9RIH7dL038430;
	Tue, 27 Oct 2009 18:17:07 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RIH7x9038428;
	Tue, 27 Oct 2009 18:17:07 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200910271817.n9RIH7x9038428@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 27 Oct 2009 18:17: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: r198522 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 18:17:08 -0000

Author: tuexen
Date: Tue Oct 27 18:17:07 2009
New Revision: 198522
URL: http://svn.freebsd.org/changeset/base/198522

Log:
  Bugfix: Use formula from section 7.2.3 of RFC 4960. Reported by Martin Becke.
  
  Approved by: rrs (mentor)
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_cc_functions.c

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Tue Oct 27 17:22:03 2009	(r198521)
+++ head/sys/netinet/sctp_cc_functions.c	Tue Oct 27 18:17:07 2009	(r198522)
@@ -348,7 +348,7 @@ sctp_cwnd_update_after_timeout(struct sc
 {
 	int old_cwnd = net->cwnd;
 
-	net->ssthresh = max(net->cwnd / 2, 2 * net->mtu);
+	net->ssthresh = max(net->cwnd / 2, 4 * net->mtu);
 	net->cwnd = net->mtu;
 	net->partial_bytes_acked = 0;
 

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 18:30:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4E7B1065698;
	Tue, 27 Oct 2009 18:30:26 +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 C267D8FC2A;
	Tue, 27 Oct 2009 18:30: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 n9RIUQZK038782;
	Tue, 27 Oct 2009 18:30:26 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RIUQHT038779;
	Tue, 27 Oct 2009 18:30:26 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <200910271830.n9RIUQHT038779@svn.freebsd.org>
From: Andrew Gallatin 
Date: Tue, 27 Oct 2009 18:30:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198523 - in stable/7/sys: . contrib/pf dev/mxge
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 18:30:27 -0000

Author: gallatin
Date: Tue Oct 27 18:30:26 2009
New Revision: 198523
URL: http://svn.freebsd.org/changeset/base/198523

Log:
  MFC: recent mxge watchdog improvements:
  
  194909: add a dying flag (as a dependency)
  198250: Move mxge(4)'s NIC watchdog reset handler to a taskqueue
  198303: Check config space to react more quickly to failures

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/mxge/if_mxge.c
  stable/7/sys/dev/mxge/if_mxge_var.h

Modified: stable/7/sys/dev/mxge/if_mxge.c
==============================================================================
--- stable/7/sys/dev/mxge/if_mxge.c	Tue Oct 27 18:17:07 2009	(r198522)
+++ stable/7/sys/dev/mxge/if_mxge.c	Tue Oct 27 18:30:26 2009	(r198523)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3368,7 +3369,6 @@ mxge_open(mxge_softc_t *sc)
 	}
 	sc->ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
 
 	return 0;
 
@@ -3385,7 +3385,6 @@ mxge_close(mxge_softc_t *sc, int down)
 	mxge_cmd_t cmd;
 	int err, old_down_cnt;
 
-	callout_stop(&sc->co_hdl);
 	sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	if (!down) {
 		old_down_cnt = sc->down_cnt;
@@ -3457,7 +3456,7 @@ mxge_read_reboot(mxge_softc_t *sc)
 	return (pci_read_config(dev, vs + 0x14, 4));
 }
 
-static int
+static void
 mxge_watchdog_reset(mxge_softc_t *sc)
 {
 	struct pci_devinfo *dinfo;
@@ -3488,7 +3487,6 @@ mxge_watchdog_reset(mxge_softc_t *sc)
 		cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2);
 		if (cmd == 0xffff) {
 			device_printf(sc->dev, "NIC disappeared!\n");
-			return (err);
 		}
 	}
 	if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) {
@@ -3547,18 +3545,40 @@ mxge_watchdog_reset(mxge_softc_t *sc)
 		}
 		sc->watchdog_resets++;
 	} else {
-		device_printf(sc->dev, "NIC did not reboot, ring state:\n");
-		device_printf(sc->dev, "tx.req=%d tx.done=%d\n",
-			      sc->ss->tx.req, sc->ss->tx.done);
-		device_printf(sc->dev, "pkt_done=%d fw=%d\n",
-			      sc->ss->tx.pkt_done,
-			      be32toh(sc->ss->fw_stats->send_done_count));
-		device_printf(sc->dev, "not resetting\n");
+		device_printf(sc->dev,
+			      "NIC did not reboot, not resetting\n");
+		err = 0;
 	}
-	if (err)
+	if (err) {
 		device_printf(sc->dev, "watchdog reset failed\n");
+	} else {
+		if (sc->dying == 2)
+			sc->dying = 0;
+		callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
+	}
+}
 
-	return (err);
+static void
+mxge_watchdog_task(void *arg, int pending)
+{
+	mxge_softc_t *sc = arg;
+
+
+	mtx_lock(&sc->driver_mtx);
+	mxge_watchdog_reset(sc);
+	mtx_unlock(&sc->driver_mtx);
+}
+
+static void
+mxge_warn_stuck(mxge_softc_t *sc, mxge_tx_ring_t *tx, int slice)
+{
+	tx = &sc->ss[slice].tx;
+	device_printf(sc->dev, "slice %d struck? ring state:\n", slice);
+	device_printf(sc->dev, "tx.req=%d tx.done=%d\n",
+		      tx->req, tx->done);
+	device_printf(sc->dev, "pkt_done=%d fw=%d\n",
+		      tx->pkt_done,
+		      be32toh(sc->ss->fw_stats->send_done_count));
 }
 
 static int
@@ -3574,11 +3594,14 @@ mxge_watchdog(mxge_softc_t *sc)
 	    tx->watchdog_req != tx->watchdog_done &&
 	    tx->done == tx->watchdog_done) {
 		/* check for pause blocking before resetting */
-		if (tx->watchdog_rx_pause == rx_pause)
-			err = mxge_watchdog_reset(sc);
-		else
+		if (tx->watchdog_rx_pause == rx_pause) {
+			mxge_warn_stuck(sc, tx, 0);
+			taskqueue_enqueue(sc->tq, &sc->watchdog_task);
+			return (ENXIO);
+		} else {
 			device_printf(sc->dev, "Flow control blocking "
 				      "xmits, check link partner\n");
+		}
 	}
 
 	tx->watchdog_req = tx->req;
@@ -3590,7 +3613,7 @@ mxge_watchdog(mxge_softc_t *sc)
 	return (err);
 }
 
-static void
+static u_long
 mxge_update_stats(mxge_softc_t *sc)
 {
 	struct mxge_slice_state *ss;
@@ -3602,23 +3625,45 @@ mxge_update_stats(mxge_softc_t *sc)
 		ipackets += ss->ipackets;
 	}
 	sc->ifp->if_ipackets = ipackets;
-
+	return ipackets;
 }
+
 static void
 mxge_tick(void *arg)
 {
 	mxge_softc_t *sc = arg;
+	u_long pkts = 0;
 	int err = 0;
+	int running, ticks;
+	uint16_t cmd;
 
-	/* aggregate stats from different slices */
-	mxge_update_stats(sc);
-	if (!sc->watchdog_countdown) {
-		err = mxge_watchdog(sc);
-		sc->watchdog_countdown = 4;
+	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);
+		if (!sc->watchdog_countdown) {
+			err = mxge_watchdog(sc);
+			sc->watchdog_countdown = 4;
+		}
+		sc->watchdog_countdown--;
+	}
+	if (pkts == 0) {
+		/* ensure NIC did not suffer h/w fault while idle */
+		cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2);		
+		if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) {
+			sc->dying = 2;
+			taskqueue_enqueue(sc->tq, &sc->watchdog_task);
+			err = ENXIO;
+		}
+		/* look less often if NIC is idle */
+		ticks *= 4;
 	}
-	sc->watchdog_countdown--;
+
 	if (err == 0)
-		callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
+		callout_reset(&sc->co_hdl, ticks, mxge_tick, sc);
 
 }
 
@@ -3689,6 +3734,10 @@ mxge_ioctl(struct ifnet *ifp, u_long com
 
 	case SIOCSIFFLAGS:
 		mtx_lock(&sc->driver_mtx);
+		if (sc->dying) {
+			mtx_unlock(&sc->driver_mtx);
+			return EINVAL;
+		}
 		if (ifp->if_flags & IFF_UP) {
 			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 				err = mxge_open(sc);
@@ -4211,6 +4260,17 @@ mxge_attach(device_t dev)
 	sc->dev = dev;
 	mxge_fetch_tunables(sc);
 
+	TASK_INIT(&sc->watchdog_task, 1, mxge_watchdog_task, sc);
+	sc->tq = taskqueue_create_fast("mxge_taskq", M_WAITOK,
+				       taskqueue_thread_enqueue,
+				       &sc->tq);
+	if (sc->tq == NULL) {
+		err = ENOMEM;
+		goto abort_with_nothing;
+	}
+	taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
+				device_get_nameunit(sc->dev));
+
 	err = bus_dma_tag_create(NULL,			/* parent */
 				 1,			/* alignment */
 				 0,			/* boundary */
@@ -4227,7 +4287,7 @@ mxge_attach(device_t dev)
 	if (err != 0) {
 		device_printf(sc->dev, "Err %d allocating parent dmat\n",
 			      err);
-		goto abort_with_nothing;
+		goto abort_with_tq;
 	}
 
 	ifp = sc->ifp = if_alloc(IFT_ETHER);
@@ -4354,12 +4414,14 @@ mxge_attach(device_t dev)
 		     mxge_media_status);
 	mxge_set_media(sc, IFM_ETHER | IFM_AUTO);
 	mxge_media_probe(sc);
+	sc->dying = 0;
 	ether_ifattach(ifp, sc->mac_addr);
 	/* ether_ifattach sets mtu to 1500 */
 	if (ifp->if_capabilities & IFCAP_JUMBO_MTU)
 		ifp->if_mtu = 9000;
 
 	mxge_add_sysctls(sc);
+	callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
 	return 0;
 
 abort_with_rings:
@@ -4381,7 +4443,12 @@ abort_with_lock:
 	if_free(ifp);
 abort_with_parent_dmat:
 	bus_dma_tag_destroy(sc->parent_dmat);
-
+abort_with_tq:
+	if (sc->tq != NULL) {
+		taskqueue_drain(sc->tq, &sc->watchdog_task);
+		taskqueue_free(sc->tq);
+		sc->tq = NULL;
+	}
 abort_with_nothing:
 	return err;
 }
@@ -4397,10 +4464,16 @@ mxge_detach(device_t dev)
 		return EBUSY;
 	}
 	mtx_lock(&sc->driver_mtx);
+	sc->dying = 1;
 	if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING)
 		mxge_close(sc, 0);
 	mtx_unlock(&sc->driver_mtx);
 	ether_ifdetach(sc->ifp);
+	if (sc->tq != NULL) {
+		taskqueue_drain(sc->tq, &sc->watchdog_task);
+		taskqueue_free(sc->tq);
+		sc->tq = NULL;
+	}
 	callout_drain(&sc->co_hdl);
 	ifmedia_removeall(&sc->media);
 	mxge_dummy_rdma(sc, 0);

Modified: stable/7/sys/dev/mxge/if_mxge_var.h
==============================================================================
--- stable/7/sys/dev/mxge/if_mxge_var.h	Tue Oct 27 18:17:07 2009	(r198522)
+++ stable/7/sys/dev/mxge/if_mxge_var.h	Tue Oct 27 18:30:26 2009	(r198523)
@@ -248,8 +248,11 @@ struct mxge_softc {
 	int need_media_probe;
 	int num_slices;
 	int rx_ring_size;
+	int dying;
 	mxge_dma_t dmabench_dma;
 	struct callout co_hdl;
+	struct taskqueue *tq;
+	struct task watchdog_task;
 	struct sysctl_oid *slice_sysctl_tree;
 	struct sysctl_ctx_list slice_sysctl_ctx;
 	char *mac_addr_string;

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 18:30:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A3CB10656AA;
	Tue, 27 Oct 2009 18:30:56 +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 874B58FC34;
	Tue, 27 Oct 2009 18:30: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 n9RIUuOh038826;
	Tue, 27 Oct 2009 18:30:56 GMT
	(envelope-from gallatin@svn.freebsd.org)
Received: (from gallatin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RIUuWA038823;
	Tue, 27 Oct 2009 18:30:56 GMT
	(envelope-from gallatin@svn.freebsd.org)
Message-Id: <200910271830.n9RIUuWA038823@svn.freebsd.org>
From: Andrew Gallatin 
Date: Tue, 27 Oct 2009 18:30:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198524 - in stable/6/sys: . conf contrib/pf dev/cxgb
	dev/mxge
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 18:30:56 -0000

Author: gallatin
Date: Tue Oct 27 18:30:56 2009
New Revision: 198524
URL: http://svn.freebsd.org/changeset/base/198524

Log:
  MFC: recent mxge watchdog improvements:
  
  194909: add a dying flag (as a dependency)
  198250: Move mxge(4)'s NIC watchdog reset handler to a taskqueue
  198303: Check config space to react more quickly to failures

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/cxgb/   (props changed)
  stable/6/sys/dev/mxge/if_mxge.c
  stable/6/sys/dev/mxge/if_mxge_var.h

Modified: stable/6/sys/dev/mxge/if_mxge.c
==============================================================================
--- stable/6/sys/dev/mxge/if_mxge.c	Tue Oct 27 18:30:26 2009	(r198523)
+++ stable/6/sys/dev/mxge/if_mxge.c	Tue Oct 27 18:30:56 2009	(r198524)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3368,7 +3369,6 @@ mxge_open(mxge_softc_t *sc)
 	}
 	sc->ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
 
 	return 0;
 
@@ -3385,15 +3385,13 @@ mxge_close(mxge_softc_t *sc, int down)
 	mxge_cmd_t cmd;
 	int err, old_down_cnt;
 
-	callout_stop(&sc->co_hdl);
 	sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	if (!down) {
 		old_down_cnt = sc->down_cnt;
 		mb();
 		err = mxge_send_cmd(sc, MXGEFW_CMD_ETHERNET_DOWN, &cmd);
 		if (err) {
-			device_printf(sc->dev,
-				      "Couldn't bring down link\n");
+			device_printf(sc->dev, "Couldn't bring down link\n");
 		}
 		if (old_down_cnt == sc->down_cnt) {
 			/* wait for down irq */
@@ -3458,7 +3456,7 @@ mxge_read_reboot(mxge_softc_t *sc)
 	return (pci_read_config(dev, vs + 0x14, 4));
 }
 
-static int
+static void
 mxge_watchdog_reset(mxge_softc_t *sc)
 {
 	struct pci_devinfo *dinfo;
@@ -3489,7 +3487,6 @@ mxge_watchdog_reset(mxge_softc_t *sc)
 		cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2);
 		if (cmd == 0xffff) {
 			device_printf(sc->dev, "NIC disappeared!\n");
-			return (err);
 		}
 	}
 	if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) {
@@ -3548,18 +3545,40 @@ mxge_watchdog_reset(mxge_softc_t *sc)
 		}
 		sc->watchdog_resets++;
 	} else {
-		device_printf(sc->dev, "NIC did not reboot, ring state:\n");
-		device_printf(sc->dev, "tx.req=%d tx.done=%d\n",
-			      sc->ss->tx.req, sc->ss->tx.done);
-		device_printf(sc->dev, "pkt_done=%d fw=%d\n",
-			      sc->ss->tx.pkt_done,
-			      be32toh(sc->ss->fw_stats->send_done_count));
-		device_printf(sc->dev, "not resetting\n");
+		device_printf(sc->dev,
+			      "NIC did not reboot, not resetting\n");
+		err = 0;
 	}
-	if (err)
+	if (err) {
 		device_printf(sc->dev, "watchdog reset failed\n");
+	} else {
+		if (sc->dying == 2)
+			sc->dying = 0;
+		callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
+	}
+}
 
-	return (err);
+static void
+mxge_watchdog_task(void *arg, int pending)
+{
+	mxge_softc_t *sc = arg;
+
+
+	mtx_lock(&sc->driver_mtx);
+	mxge_watchdog_reset(sc);
+	mtx_unlock(&sc->driver_mtx);
+}
+
+static void
+mxge_warn_stuck(mxge_softc_t *sc, mxge_tx_ring_t *tx, int slice)
+{
+	tx = &sc->ss[slice].tx;
+	device_printf(sc->dev, "slice %d struck? ring state:\n", slice);
+	device_printf(sc->dev, "tx.req=%d tx.done=%d\n",
+		      tx->req, tx->done);
+	device_printf(sc->dev, "pkt_done=%d fw=%d\n",
+		      tx->pkt_done,
+		      be32toh(sc->ss->fw_stats->send_done_count));
 }
 
 static int
@@ -3575,11 +3594,14 @@ mxge_watchdog(mxge_softc_t *sc)
 	    tx->watchdog_req != tx->watchdog_done &&
 	    tx->done == tx->watchdog_done) {
 		/* check for pause blocking before resetting */
-		if (tx->watchdog_rx_pause == rx_pause)
-			err = mxge_watchdog_reset(sc);
-		else
+		if (tx->watchdog_rx_pause == rx_pause) {
+			mxge_warn_stuck(sc, tx, 0);
+			taskqueue_enqueue(sc->tq, &sc->watchdog_task);
+			return (ENXIO);
+		} else {
 			device_printf(sc->dev, "Flow control blocking "
 				      "xmits, check link partner\n");
+		}
 	}
 
 	tx->watchdog_req = tx->req;
@@ -3591,7 +3613,7 @@ mxge_watchdog(mxge_softc_t *sc)
 	return (err);
 }
 
-static void
+static u_long
 mxge_update_stats(mxge_softc_t *sc)
 {
 	struct mxge_slice_state *ss;
@@ -3603,23 +3625,45 @@ mxge_update_stats(mxge_softc_t *sc)
 		ipackets += ss->ipackets;
 	}
 	sc->ifp->if_ipackets = ipackets;
-
+	return ipackets;
 }
+
 static void
 mxge_tick(void *arg)
 {
 	mxge_softc_t *sc = arg;
+	u_long pkts = 0;
 	int err = 0;
+	int running, ticks;
+	uint16_t cmd;
 
-	/* aggregate stats from different slices */
-	mxge_update_stats(sc);
-	if (!sc->watchdog_countdown) {
-		err = mxge_watchdog(sc);
-		sc->watchdog_countdown = 4;
+	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);
+		if (!sc->watchdog_countdown) {
+			err = mxge_watchdog(sc);
+			sc->watchdog_countdown = 4;
+		}
+		sc->watchdog_countdown--;
+	}
+	if (pkts == 0) {
+		/* ensure NIC did not suffer h/w fault while idle */
+		cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2);		
+		if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) {
+			sc->dying = 2;
+			taskqueue_enqueue(sc->tq, &sc->watchdog_task);
+			err = ENXIO;
+		}
+		/* look less often if NIC is idle */
+		ticks *= 4;
 	}
-	sc->watchdog_countdown--;
+
 	if (err == 0)
-		callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
+		callout_reset(&sc->co_hdl, ticks, mxge_tick, sc);
 
 }
 
@@ -3690,6 +3734,10 @@ mxge_ioctl(struct ifnet *ifp, u_long com
 
 	case SIOCSIFFLAGS:
 		mtx_lock(&sc->driver_mtx);
+		if (sc->dying) {
+			mtx_unlock(&sc->driver_mtx);
+			return EINVAL;
+		}
 		if (ifp->if_flags & IFF_UP) {
 			if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
 				err = mxge_open(sc);
@@ -4212,6 +4260,17 @@ mxge_attach(device_t dev)
 	sc->dev = dev;
 	mxge_fetch_tunables(sc);
 
+	TASK_INIT(&sc->watchdog_task, 1, mxge_watchdog_task, sc);
+	sc->tq = taskqueue_create_fast("mxge_taskq", M_WAITOK,
+				       taskqueue_thread_enqueue,
+				       &sc->tq);
+	if (sc->tq == NULL) {
+		err = ENOMEM;
+		goto abort_with_nothing;
+	}
+	taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
+				device_get_nameunit(sc->dev));
+
 	err = bus_dma_tag_create(NULL,			/* parent */
 				 1,			/* alignment */
 				 0,			/* boundary */
@@ -4228,7 +4287,7 @@ mxge_attach(device_t dev)
 	if (err != 0) {
 		device_printf(sc->dev, "Err %d allocating parent dmat\n",
 			      err);
-		goto abort_with_nothing;
+		goto abort_with_tq;
 	}
 
 	ifp = sc->ifp = if_alloc(IFT_ETHER);
@@ -4355,12 +4414,14 @@ mxge_attach(device_t dev)
 		     mxge_media_status);
 	mxge_set_media(sc, IFM_ETHER | IFM_AUTO);
 	mxge_media_probe(sc);
+	sc->dying = 0;
 	ether_ifattach(ifp, sc->mac_addr);
 	/* ether_ifattach sets mtu to 1500 */
 	if (ifp->if_capabilities & IFCAP_JUMBO_MTU)
 		ifp->if_mtu = 9000;
 
 	mxge_add_sysctls(sc);
+	callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc);
 	return 0;
 
 abort_with_rings:
@@ -4382,7 +4443,12 @@ abort_with_lock:
 	if_free(ifp);
 abort_with_parent_dmat:
 	bus_dma_tag_destroy(sc->parent_dmat);
-
+abort_with_tq:
+	if (sc->tq != NULL) {
+		taskqueue_drain(sc->tq, &sc->watchdog_task);
+		taskqueue_free(sc->tq);
+		sc->tq = NULL;
+	}
 abort_with_nothing:
 	return err;
 }
@@ -4398,10 +4464,16 @@ mxge_detach(device_t dev)
 		return EBUSY;
 	}
 	mtx_lock(&sc->driver_mtx);
+	sc->dying = 1;
 	if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING)
 		mxge_close(sc, 0);
 	mtx_unlock(&sc->driver_mtx);
 	ether_ifdetach(sc->ifp);
+	if (sc->tq != NULL) {
+		taskqueue_drain(sc->tq, &sc->watchdog_task);
+		taskqueue_free(sc->tq);
+		sc->tq = NULL;
+	}
 	callout_drain(&sc->co_hdl);
 	ifmedia_removeall(&sc->media);
 	mxge_dummy_rdma(sc, 0);

Modified: stable/6/sys/dev/mxge/if_mxge_var.h
==============================================================================
--- stable/6/sys/dev/mxge/if_mxge_var.h	Tue Oct 27 18:30:26 2009	(r198523)
+++ stable/6/sys/dev/mxge/if_mxge_var.h	Tue Oct 27 18:30:56 2009	(r198524)
@@ -247,8 +247,11 @@ struct mxge_softc {
 	int need_media_probe;
 	int num_slices;
 	int rx_ring_size;
+	int dying;
 	mxge_dma_t dmabench_dma;
 	struct callout co_hdl;
+	struct taskqueue *tq;
+	struct task watchdog_task;
 	struct sysctl_oid *slice_sysctl_tree;
 	struct sysctl_ctx_list slice_sysctl_ctx;
 	char *mac_addr_string;

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 19:13:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E56A1065679;
	Tue, 27 Oct 2009 19:13:00 +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 089BB8FC08;
	Tue, 27 Oct 2009 19:12:59 +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
	n9RJCwfC010588; Tue, 27 Oct 2009 20:12:58 +0100 (CET)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.3/8.14.3/Submit) id n9RJCwsp010587;
	Tue, 27 Oct 2009 20:12:58 +0100 (CET) (envelope-from marius)
Date: Tue, 27 Oct 2009 20:12:58 +0100
From: Marius Strobl 
To: Marcel Moolenaar 
Message-ID: <20091027191258.GU27159@alchemy.franken.de>
References: <200910211838.n9LIc2wp007206@svn.freebsd.org>
	<20091025202541.GC94979@alchemy.franken.de>
	<36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com>
	<20091026201116.GS27159@alchemy.franken.de>
	<63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com>
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: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv
	i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim
	powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64
	sun4v/sun4v vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 19:13:00 -0000

On Mon, Oct 26, 2009 at 01:53:47PM -0700, Marcel Moolenaar wrote:
> 
> On Oct 26, 2009, at 1:11 PM, Marius Strobl wrote:
> 
> >The cheetah-class CPUs, i.e. USIII and later, take care of
> >I$ coherency themselves, unlike the spitfire ones (see also
> >cheetah_icache_page_inval() vs. spitfire_icache_page_inval()).
> 
> This explains why I didn't see any I-cache coherency issues :-)
> 
> >I currently can't think of any existing code which would
> >ensure I$ consistency after the writes have been performed,
> >not even as a side-effect. The proper solution probalby is to
> >make pmap_sync_icache() a wrapper around icache_page_inval().
> 
> I concur. Do we have any spitfire-based sparc64 boxes in the
> cluster or do you have one?

We don't have any sparc64 machine in the cluster since panther
died although there we're some nice replacements offered for
donation but unfortunately it seems getting a machine into the
cluster is next to impossible.
Do you want something particularly tested on a spitfire-based
machine?

Marius


From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 19:37:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 45D50106566B;
	Tue, 27 Oct 2009 19:37:38 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BEA08FC27;
	Tue, 27 Oct 2009 19:37: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 n9RJbc6v040163;
	Tue, 27 Oct 2009 19:37:38 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RJbbC5040160;
	Tue, 27 Oct 2009 19:37:37 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910271937.n9RJbbC5040160@svn.freebsd.org>
From: Ed Maste 
Date: Tue, 27 Oct 2009 19:37: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: r198525 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 19:37:38 -0000

Author: emaste
Date: Tue Oct 27 19:37:37 2009
New Revision: 198525
URL: http://svn.freebsd.org/changeset/base/198525

Log:
  Whitespace fixup: 8 spaces -> tab

Modified:
  head/sys/dev/aac/aac.c
  head/sys/dev/aac/aac_cam.c

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Tue Oct 27 18:30:56 2009	(r198524)
+++ head/sys/dev/aac/aac.c	Tue Oct 27 19:37:37 2009	(r198525)
@@ -229,7 +229,7 @@ static int		aac_query_disk(struct aac_so
 static int		aac_get_pci_info(struct aac_softc *sc, caddr_t uptr);
 static int		aac_supported_features(struct aac_softc *sc, caddr_t uptr);
 static void		aac_ioctl_event(struct aac_softc *sc,
-				        struct aac_event *event, void *arg);
+					struct aac_event *event, void *arg);
 static struct aac_mntinforesp *
 	aac_get_container_info(struct aac_softc *sc, struct aac_fib *fib, int cid);
 
@@ -3618,7 +3618,7 @@ aac_query_disk(struct aac_softc *sc, cad
 		query_disk.Lun = 0;
 		query_disk.UnMapped = 0;
 		sprintf(&query_disk.diskDeviceName[0], "%s%d",
-		        disk->ad_disk->d_name, disk->ad_disk->d_unit);
+			disk->ad_disk->d_name, disk->ad_disk->d_unit);
 	}
 	mtx_unlock(&sc->aac_container_lock);
 

Modified: head/sys/dev/aac/aac_cam.c
==============================================================================
--- head/sys/dev/aac/aac_cam.c	Tue Oct 27 18:30:56 2009	(r198524)
+++ head/sys/dev/aac/aac_cam.c	Tue Oct 27 19:37:37 2009	(r198525)
@@ -272,10 +272,10 @@ aac_cam_action(struct cam_sim *sim, unio
 		strncpy(cpi->hba_vid, "Adaptec", HBA_IDLEN);
 		strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
 		cpi->unit_number = cam_sim_unit(sim);
-                cpi->transport = XPORT_SPI;
-                cpi->transport_version = 2;
-                cpi->protocol = PROTO_SCSI;
-                cpi->protocol_version = SCSI_REV_2;
+		cpi->transport = XPORT_SPI;
+		cpi->transport_version = 2;
+		cpi->protocol = PROTO_SCSI;
+		cpi->protocol_version = SCSI_REV_2;
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_done(ccb);
 		return;

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 19:56:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57747106568D;
	Tue, 27 Oct 2009 19:56:22 +0000 (UTC) (envelope-from xcllnt@mac.com)
Received: from asmtpout024.mac.com (asmtpout024.mac.com [17.148.16.99])
	by mx1.freebsd.org (Postfix) with ESMTP id 3CE708FC16;
	Tue, 27 Oct 2009 19:56:22 +0000 (UTC)
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; charset=us-ascii; format=flowed
Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36])
	by asmtp024.mac.com
	(Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008;
	32bit)) with ESMTPSA id <0KS600E1GVDI4X20@asmtp024.mac.com>; Tue,
	27 Oct 2009 12:56:07 -0700 (PDT)
From: Marcel Moolenaar 
In-reply-to: <20091027191258.GU27159@alchemy.franken.de>
Date: Tue, 27 Oct 2009 12:56:06 -0700
Message-id: <767E6364-0F58-447F-A6EA-9E08A8065C8F@mac.com>
References: <200910211838.n9LIc2wp007206@svn.freebsd.org>
	<20091025202541.GC94979@alchemy.franken.de>
	<36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com>
	<20091026201116.GS27159@alchemy.franken.de>
	<63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com>
	<20091027191258.GU27159@alchemy.franken.de>
To: Marius Strobl 
X-Mailer: Apple Mail (2.1076)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv
 i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke
 powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 19:56:22 -0000


On Oct 27, 2009, at 12:12 PM, Marius Strobl wrote:

>> I concur. Do we have any spitfire-based sparc64 boxes in the
>> cluster or do you have one?
>

> Do you want something particularly tested on a spitfire-based
> machine?

Any I-cache related change, really. My Netra is not going to
tell me anything. I'm fine leaving it up to spitfire-based
sparc64 owners to fill in the gaps, but I generally prefer to
be as complete as possible when making infrastructure changes.

FYI,

-- 
Marcel Moolenaar
xcllnt@mac.com




From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 20:55:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EC13106566B;
	Tue, 27 Oct 2009 20:55:03 +0000 (UTC) (envelope-from simon@nitro.dk)
Received: from mx.nitro.dk (unknown [77.75.165.90])
	by mx1.freebsd.org (Postfix) with ESMTP id 4A72C8FC13;
	Tue, 27 Oct 2009 20:55:03 +0000 (UTC)
Received: from arthur.nitro.dk (arthur.bofh [192.168.2.3])
	by mx.nitro.dk (Postfix) with ESMTP id 933E22D4866;
	Tue, 27 Oct 2009 20:55:02 +0000 (UTC)
Received: by arthur.nitro.dk (Postfix, from userid 1000)
	id 72C6D5C0A; Tue, 27 Oct 2009 21:55:02 +0100 (CET)
Date: Tue, 27 Oct 2009 21:55:02 +0100
From: "Simon L. Nielsen" 
To: Marius Strobl 
Message-ID: <20091027205501.GA1245@arthur.nitro.dk>
References: <200910211838.n9LIc2wp007206@svn.freebsd.org>
	<20091025202541.GC94979@alchemy.franken.de>
	<36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com>
	<20091026201116.GS27159@alchemy.franken.de>
	<63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com>
	<20091027191258.GU27159@alchemy.franken.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091027191258.GU27159@alchemy.franken.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	Marcel Moolenaar , src-committers@freebsd.org
Subject: Re: svn commit: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv
 i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/booke
 powerpc/include powerpc/powerpc sparc64/sparc64 sun4v/sun4v vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 20:55:03 -0000

On 2009.10.27 20:12:58 +0100, Marius Strobl wrote:

> We don't have any sparc64 machine in the cluster since panther
> died although there we're some nice replacements offered for
> donation but unfortunately it seems getting a machine into the
> cluster is next to impossible.

We have some sparc64 systems at ISC which are currently use for
package building, though they seem to be all Ultra Sparc IIi (at least
from the docs I could find now).

-- 
Simon L. Nielsen

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:02:43 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 031DD1065670;
	Tue, 27 Oct 2009 21:02:43 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC9188FC13;
	Tue, 27 Oct 2009 21: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 n9RL2g2N041923;
	Tue, 27 Oct 2009 21:02:42 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RL2gWN041919;
	Tue, 27 Oct 2009 21:02:42 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910272102.n9RL2gWN041919@svn.freebsd.org>
From: Ed Maste 
Date: Tue, 27 Oct 2009 21:02:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198528 - in stable/6/sys: . conf contrib/pf dev/aac
	dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:02:43 -0000

Author: emaste
Date: Tue Oct 27 21:02:42 2009
New Revision: 198528
URL: http://svn.freebsd.org/changeset/base/198528

Log:
  MFC r188743,r188940
  
    Use outbound message register 0 instead of mailbox 7 in
    aac_{rx,rkt}_get_fwstatus, as done in Adaptec's vendor driver as well as
    the Linux drivers.
  
    Submitted by:   jkim, from Adaptec's driver
  
  ==
  
    SVN rev 188743 modified aac_rx_get_fwstatus to use the AAC_RX_OMR0
    register instead of AAC_RX_FWSTATUS, as that is the way it's done in
    Adaptec's vendor driver and in the Linux drivers.  (The same applies
    to aac_rkt_get_fwstatus as well.)
  
    However, a concern has been raised about the compatibility of this
    change and old hardware / firmware versions.  In the absense of
    specific information, revert to the original behaviour if the firmware
    does not support the "New comm." interface.  Users of old cards or
    firmware haven't reported the problems that are potentially solved by
    switching to OMR0.

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/aac/aac.c
  stable/6/sys/dev/aac/aacreg.h
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/aac/aac.c
==============================================================================
--- stable/6/sys/dev/aac/aac.c	Tue Oct 27 20:41:55 2009	(r198527)
+++ stable/6/sys/dev/aac/aac.c	Tue Oct 27 21:02:42 2009	(r198528)
@@ -2373,7 +2373,8 @@ aac_rx_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_FWSTATUS));
+	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RX_OMR0 : AAC_RX_FWSTATUS));
 }
 
 static int
@@ -2392,7 +2393,8 @@ aac_rkt_get_fwstatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS));
+	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RKT_OMR0 : AAC_RKT_FWSTATUS));
 }
 
 /*

Modified: stable/6/sys/dev/aac/aacreg.h
==============================================================================
--- stable/6/sys/dev/aac/aacreg.h	Tue Oct 27 20:41:55 2009	(r198527)
+++ stable/6/sys/dev/aac/aacreg.h	Tue Oct 27 21:02:42 2009	(r198528)
@@ -1495,6 +1495,8 @@ enum {
  * and other related adapters.
  */
 
+#define AAC_RX_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RX_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RX_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RX_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RX_IIMR		0x28	/* inbound interrupt mask register */
@@ -1512,6 +1514,8 @@ enum {
  * Unsurprisingly, it's quite similar to the i960!
  */
 
+#define AAC_RKT_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RKT_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RKT_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RKT_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RKT_IIMR		0x28	/* inbound interrupt mask register */

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:05:11 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 987201065676;
	Tue, 27 Oct 2009 21:05:11 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (unknown [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 4D9BA8FC0A;
	Tue, 27 Oct 2009 21:05:11 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n9RKxAs2083503;
	Tue, 27 Oct 2009 14:59:10 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 27 Oct 2009 14:59:23 -0600 (MDT)
Message-Id: <20091027.145923.1661903621.imp@bsdimp.com>
To: rwatson@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: 
References: <200910242028.n9OKSg2u010197@svn.freebsd.org>
	
X-Mailer: Mew version 5.2 on Emacs 21.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, marcel@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r198451 - head/sys/ia64/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:05:11 -0000

In message: 
            Robert Watson  writes:
: 
: On Sat, 24 Oct 2009, Marcel Moolenaar wrote:
: 
: > Log:
: >  A 32KB kernel stack is not quite enough. The new USB stack is a bit
: >  more stack hungry as compared to the old one that my RX2660 gets
: >  a machine check and spontaneously reboots at the time the USB DVD
: >  drive is found and attached to CAM as a mass storage device. This
: >  doesn't happen always, but definitely varies per kernel build.
: >  Likewise when using a 128-byte printf buffer. The additional 128
: >  bytes that printf needs seems to be enough to have the memory stack
: >  and register stack collide and causing a machine check.
: 
: I recently noticed, somewhat to my surprise, that BPF drops a 512-byte buffer 
: on the stack while running filters...

Would another pass of huge stack function scrubbing be useful?

Warner

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:09:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3FDA4106568D;
	Tue, 27 Oct 2009 21:09:53 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 145F68FC16;
	Tue, 27 Oct 2009 21:09: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 n9RL9q8m042091;
	Tue, 27 Oct 2009 21:09:52 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9RL9qSm042088;
	Tue, 27 Oct 2009 21:09:52 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910272109.n9RL9qSm042088@svn.freebsd.org>
From: Ed Maste 
Date: Tue, 27 Oct 2009 21:09:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198529 - in stable/7/sys: . contrib/pf dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:09:53 -0000

Author: emaste
Date: Tue Oct 27 21:09:52 2009
New Revision: 198529
URL: http://svn.freebsd.org/changeset/base/198529

Log:
  MFC r188743,r188940
  
    Use outbound message register 0 instead of mailbox 7 in
    aac_{rx,rkt}_get_fwstatus, as done in Adaptec's vendor driver as well as
    the Linux drivers.
  
    Submitted by:   jkim, from Adaptec's driver
  
  ==
  
    SVN rev 188743 modified aac_rx_get_fwstatus to use the AAC_RX_OMR0
    register instead of AAC_RX_FWSTATUS, as that is the way it's done in
    Adaptec's vendor driver and in the Linux drivers.  (The same applies
    to aac_rkt_get_fwstatus as well.)
  
    However, a concern has been raised about the compatibility of this
    change and old hardware / firmware versions.  In the absense of
    specific information, revert to the original behaviour if the firmware
    does not support the "New comm." interface.  Users of old cards or
    firmware haven't reported the problems that are potentially solved by
    switching to OMR0.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/aac/aac.c
  stable/7/sys/dev/aac/aacreg.h

Modified: stable/7/sys/dev/aac/aac.c
==============================================================================
--- stable/7/sys/dev/aac/aac.c	Tue Oct 27 21:02:42 2009	(r198528)
+++ stable/7/sys/dev/aac/aac.c	Tue Oct 27 21:09:52 2009	(r198529)
@@ -2375,7 +2375,8 @@ aac_rx_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_FWSTATUS));
+	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RX_OMR0 : AAC_RX_FWSTATUS));
 }
 
 static int
@@ -2394,7 +2395,8 @@ aac_rkt_get_fwstatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS));
+	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	    AAC_RKT_OMR0 : AAC_RKT_FWSTATUS));
 }
 
 /*

Modified: stable/7/sys/dev/aac/aacreg.h
==============================================================================
--- stable/7/sys/dev/aac/aacreg.h	Tue Oct 27 21:02:42 2009	(r198528)
+++ stable/7/sys/dev/aac/aacreg.h	Tue Oct 27 21:09:52 2009	(r198529)
@@ -1495,6 +1495,8 @@ enum {
  * and other related adapters.
  */
 
+#define AAC_RX_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RX_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RX_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RX_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RX_IIMR		0x28	/* inbound interrupt mask register */
@@ -1512,6 +1514,8 @@ enum {
  * Unsurprisingly, it's quite similar to the i960!
  */
 
+#define AAC_RKT_OMR0		0x18	/* outbound message register 0 */
+#define AAC_RKT_OMR1		0x1c	/* outbound message register 1 */
 #define AAC_RKT_IDBR		0x20	/* inbound doorbell register */
 #define AAC_RKT_IISR		0x24	/* inbound interrupt status register */
 #define AAC_RKT_IIMR		0x28	/* inbound interrupt mask register */

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:11:33 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 37EAF1065692;
	Tue, 27 Oct 2009 21:11:33 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (unknown [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id D2A438FC27;
	Tue, 27 Oct 2009 21:11:32 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n9RL76XN083549;
	Tue, 27 Oct 2009 15:07:06 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 27 Oct 2009 15:07:19 -0600 (MDT)
Message-Id: <20091027.150719.-1219478921.imp@bsdimp.com>
To: mav@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <200910261123.n9QBNfJY087028@svn.freebsd.org>
References: <200910261123.n9QBNfJY087028@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.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
Subject: Re: svn commit: r198487 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:11:33 -0000

In message: <200910261123.n9QBNfJY087028@svn.freebsd.org>
            Alexander Motin  writes:
: Author: mav
: Date: Mon Oct 26 11:23:41 2009
: New Revision: 198487
: URL: http://svn.freebsd.org/changeset/base/198487
: 
: Log:
:   Round timeout up when converting CAM milliseconds to ATA seconds.

This implements ceil(timeout) rather than round(timeout).  Is that
intended?

Warner

: -	request->timeout = ccb_h->timeout / 1000; /* XXX lost granularity */
: +	request->timeout = (ccb_h->timeout + 999) / 1000;
...
: -		request->timeout = csio->ccb_h.timeout / 1000;
: +		request->timeout = (csio->ccb_h.timeout + 999) / 1000;

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:17:51 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9F7631065670;
	Tue, 27 Oct 2009 21:17:51 +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 1E1668FC14;
	Tue, 27 Oct 2009 21:17:50 +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
	n9RLHncv021222; Tue, 27 Oct 2009 22:17:49 +0100 (CET)
	(envelope-from marius@alchemy.franken.de)
Received: (from marius@localhost)
	by alchemy.franken.de (8.14.3/8.14.3/Submit) id n9RLHnxa021221;
	Tue, 27 Oct 2009 22:17:49 +0100 (CET) (envelope-from marius)
Date: Tue, 27 Oct 2009 22:17:49 +0100
From: Marius Strobl 
To: "Simon L. Nielsen" 
Message-ID: <20091027211749.GV27159@alchemy.franken.de>
References: <200910211838.n9LIc2wp007206@svn.freebsd.org>
	<20091025202541.GC94979@alchemy.franken.de>
	<36313C38-9B60-4BF3-885C-5BAAA915DCFE@mac.com>
	<20091026201116.GS27159@alchemy.franken.de>
	<63FB238C-D66F-486B-AB5B-DA7C2423A78B@mac.com>
	<20091027191258.GU27159@alchemy.franken.de>
	<20091027205501.GA1245@arthur.nitro.dk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091027205501.GA1245@arthur.nitro.dk>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	Marcel Moolenaar , src-committers@FreeBSD.org
Subject: Re: svn commit: r198341 - in head/sys: amd64/amd64 arm/arm arm/mv
	i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim
	powerpc/booke powerpc/include powerpc/powerpc sparc64/sparc64
	sun4v/sun4v vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:17:51 -0000

On Tue, Oct 27, 2009 at 09:55:02PM +0100, Simon L. Nielsen wrote:
> On 2009.10.27 20:12:58 +0100, Marius Strobl wrote:
> 
> > We don't have any sparc64 machine in the cluster since panther
> > died although there we're some nice replacements offered for
> > donation but unfortunately it seems getting a machine into the
> > cluster is next to impossible.
> 
> We have some sparc64 systems at ISC which are currently use for
> package building, though they seem to be all Ultra Sparc IIi (at least
> from the docs I could find now).

I of course meant the lack of a sparc64 machine in the cluster
at Yahoo! with dumpster mounted and available to all developers.

Marius


From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:28:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F0A5106566B;
	Tue, 27 Oct 2009 21:28:55 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.159])
	by mx1.freebsd.org (Postfix) with ESMTP id C27A38FC0A;
	Tue, 27 Oct 2009 21:28:54 +0000 (UTC)
Received: by fg-out-1718.google.com with SMTP id d23so114175fga.13
	for ; Tue, 27 Oct 2009 14:28:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:x-enigmail-version:content-type:content-transfer-encoding;
	bh=2yCJzr4T8BIybonudztHoIUWhygWgmGfmLThgfrnnWU=;
	b=vAu8qRHRySdJQcKD10m9zhmokckzKBBin69sbEVfP1R+fuV5x7omAsprq3AvX9dJRO
	UuIPN6j4dLLu3cVB1TmbiNzkCUkKSuK/cTJZc6SQKPJW1bZyod++UJQECMT3HRoWwK92
	eke0/ALfzqn1wTT7IvKjO8JvwhHJuSHaXD+RI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	b=ts9oAiu4TOeZCyCq0QZBIYQ0xnN3k4UNv+l901WfVmNNVgbwOziCnyDVbcjsm7X5u7
	f8NWA3PmS+s8ZRLDX3PRQY3BXrSO4cLtZXVanWl4D6cFYu65f3XiJffk5BFI4FdmdFs7
	+0d9g5vFlJKigqBhGvg/TrwQCLPBk2qQZpYyw=
Received: by 10.102.197.14 with SMTP id u14mr6917388muf.39.1256678933583;
	Tue, 27 Oct 2009 14:28:53 -0700 (PDT)
Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226])
	by mx.google.com with ESMTPS id 23sm1679194mum.14.2009.10.27.14.28.52
	(version=SSLv3 cipher=RC4-MD5); Tue, 27 Oct 2009 14:28:52 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4AE76611.4030104@FreeBSD.org>
Date: Tue, 27 Oct 2009 23:28:49 +0200
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.23 (X11/20090901)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200910261123.n9QBNfJY087028@svn.freebsd.org>
	<20091027.150719.-1219478921.imp@bsdimp.com>
In-Reply-To: <20091027.150719.-1219478921.imp@bsdimp.com>
X-Enigmail-Version: 0.96.0
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: r198487 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:28:55 -0000

M. Warner Losh wrote:
> In message: <200910261123.n9QBNfJY087028@svn.freebsd.org>
>             Alexander Motin  writes:
> : Author: mav
> : Date: Mon Oct 26 11:23:41 2009
> : New Revision: 198487
> : URL: http://svn.freebsd.org/changeset/base/198487
> : 
> : Log:
> :   Round timeout up when converting CAM milliseconds to ATA seconds.
> 
> This implements ceil(timeout) rather than round(timeout).  Is that
> intended?

Yes. It is better to turn 400ms to 1s rather then 0. Usually timeouts
aren't so short to make it important, but I have seen such case once, so
it is possible to predict another.

-- 
Alexander Motin

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 21:47:31 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D5D0106566B;
	Tue, 27 Oct 2009 21:47:31 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (unknown [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 1A82F8FC0C;
	Tue, 27 Oct 2009 21:47:30 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n9RLg0hq083780;
	Tue, 27 Oct 2009 15:42:00 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Tue, 27 Oct 2009 15:42:13 -0600 (MDT)
Message-Id: <20091027.154213.1640491474.imp@bsdimp.com>
To: mav@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <4AE76611.4030104@FreeBSD.org>
References: <200910261123.n9QBNfJY087028@svn.freebsd.org>
	<20091027.150719.-1219478921.imp@bsdimp.com>
	<4AE76611.4030104@FreeBSD.org>
X-Mailer: Mew version 5.2 on Emacs 21.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
Subject: Re: svn commit: r198487 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 21:47:31 -0000

In message: <4AE76611.4030104@FreeBSD.org>
            Alexander Motin  writes:
: M. Warner Losh wrote:
: > In message: <200910261123.n9QBNfJY087028@svn.freebsd.org>
: >             Alexander Motin  writes:
: > : Author: mav
: > : Date: Mon Oct 26 11:23:41 2009
: > : New Revision: 198487
: > : URL: http://svn.freebsd.org/changeset/base/198487
: > : 
: > : Log:
: > :   Round timeout up when converting CAM milliseconds to ATA seconds.
: > 
: > This implements ceil(timeout) rather than round(timeout).  Is that
: > intended?
: 
: Yes. It is better to turn 400ms to 1s rather then 0. Usually timeouts
: aren't so short to make it important, but I have seen such case once, so
: it is possible to predict another.

OK.  I was curious because the commit message was ambiguous and could
be taken to mean two different things.  If that's the real intent,
then the code does that and I'm happy.

Warner

From owner-svn-src-all@FreeBSD.ORG  Tue Oct 27 23:48:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FD57106566C;
	Tue, 27 Oct 2009 23:48:56 +0000 (UTC)
	(envelope-from minimarmot@gmail.com)
Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A35C8FC20;
	Tue, 27 Oct 2009 23:48:54 +0000 (UTC)
Received: by ey-out-2122.google.com with SMTP id 9so87850eyd.9
	for ; Tue, 27 Oct 2009 16:48:54 -0700 (PDT)
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;
	bh=ysfEfC0aRUg5GUMHco5NrCmdi1MI76+P+jeJGYlfBqQ=;
	b=uvDwrz6I+201L3zxNolrZxyTLgjzRkrIGDtiEB0stZNRqzOBxfgWBt6/311MmVvzjB
	P8flwu7Nve8SXNoEcKb8rTRsc81JAZ5B/uepahBzWj44JkOnHa3TnyF2N/9L2wTGtbOE
	HgCOvfRqje6xUxrfvJqe4BGEAV5xJ9tvUkbNs=
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;
	b=MUpnn26BxCUNMyGpiOdUU7xnNuchdTr6eozd3sLVpKdjm81PQsN/3JkgmFYZzVzXQR
	/20K/RIyXAZPYNDAfs6Rk64BBDZjYBQYU82nrqmLh/nlSM6iDg+qoxsEUkkhPeL7saIi
	IeJwPDwOGvIbM2/B292EGSpXDGI6Hz3y2eZk0=
MIME-Version: 1.0
Received: by 10.211.131.36 with SMTP id i36mr446747ebn.33.1256687334231; Tue, 
	27 Oct 2009 16:48:54 -0700 (PDT)
In-Reply-To: <20091027064517.GA34072@mavetju.org>
References: <200910212059.n9LKxDDQ010447@svn.freebsd.org>
	<47d0403c0910261705s68cd23dcq67433dd831603416@mail.gmail.com>
	<20091027004213.GA13626@mavetju.org> <4AE67CA3.5080109@freebsd.org>
	<20091027064517.GA34072@mavetju.org>
Date: Tue, 27 Oct 2009 19:48:54 -0400
Message-ID: <47d0403c0910271648v71670fecn4ef3a9e2b80d6eaa@mail.gmail.com>
From: Ben Kaduk 
To: Edwin Groothuis 
Content-Type: text/plain; charset=ISO-8859-1
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Andriy Gapon 
Subject: Re: svn commit: r198351 - head/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 27 Oct 2009 23:48:56 -0000

On Tue, Oct 27, 2009 at 2:45 AM, Edwin Groothuis  wrote:
> On Tue, Oct 27, 2009 at 06:52:51AM +0200, Andriy Gapon wrote:
>> on 27/10/2009 02:42 Edwin Groothuis said the following:
>> > On Mon, Oct 26, 2009 at 08:05:31PM -0400, Ben Kaduk wrote:
>> >>> +                       fi; \
>> >>> +                       echo "Updating /etc/localtime"; \
>> >>> +                       tzsetup ${optC} -r; \
>> >>
>> >> This breaks installworld for me.  Replacing tzsetup with a hardcoded
>> >> /usr/sbin/tzsetup allowed installworld to finish.
>> >
>> > ===> share/zoneinfo (install)
>> > umask 022; cd /usr/src/share/zoneinfo;  zic -D -d /usr/share/zoneinfo -p America/New_York  -u root -g wheel -m 444   -y /usr/obj/usr/src/share/zoneinfo/yearistype africa antarctica asia australasia etcetera europe  factory northamerica southamerica
>> > "factory", line 11: warning: time zone abbreviation differs from POSIX standard (Local time zone must be set--use tzsetup)
>> > install -o root -g wheel -m 444  /usr/src/share/zoneinfo/zone.tab /usr/share/zoneinfo/
>> > Updating /etc/localtime
>> > tzsetup: not found
>> > *** Error code 127
>> >
>> > I'll check it out, just wonder why you can run zic(8) but not
>> > tzsetup(8). They are both in /usr/sbin.
>>
>> Perhaps ITOOLS variable has something to do with this.
>> (installworld may be executed from a rather unpopulated environment).
>
> Ben,
>
> Can you confirm that this resolves it?

Edwin,

Yes, this patch works well.  (Reverting my hack caused installworld to
fail again, and applying this patch allowed it to work.)

Thanks!

-Ben Kaduk



>
> Index: Makefile.inc1
> ===================================================================
> --- Makefile.inc1       (revision 198253)
> +++ Makefile.inc1       (working copy)
> @@ -599,11 +599,14 @@
>  .if ${MK_INFO} != "no"
>  _install-info= install-info
>  .endif
> +.if ${MK_ZONEINFO} != "no"
> +_zoneinfo=     zic tzsetup
> +.endif
>
>  ITOOLS=        [ awk cap_mkdb cat chflags chmod chown \
>        date echo egrep find grep ${_install-info} \
>        ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
> -       test true uname wc zic
> +       test true uname wc ${_zoneinfo}
>
>  #
>  # distributeworld
>
> Edwin
> --
> Edwin Groothuis         Website: http://www.mavetju.org/
> edwin@mavetju.org       Weblog:  http://www.mavetju.org/weblog/
>

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 01:53:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2B383106568F;
	Wed, 28 Oct 2009 01:53:26 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 18C928FC17;
	Wed, 28 Oct 2009 01:53: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 n9S1rPZj047293;
	Wed, 28 Oct 2009 01:53:25 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9S1rPN3047291;
	Wed, 28 Oct 2009 01:53:25 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910280153.n9S1rPN3047291@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 01:53:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198532 - in stable/6/sys: . conf contrib/pf dev/aac
	dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 01:53:26 -0000

Author: emaste
Date: Wed Oct 28 01:53:25 2009
New Revision: 198532
URL: http://svn.freebsd.org/changeset/base/198532

Log:
  MFC r180072,182967
  
    Add explicit PCI IDs for the following Adaptec RAID Series 2 adapters:
  
      Adaptec RAID 2045
      Adaptec RAID 2405
      Adaptec RAID 2445
      Adaptec RAID 2805
  
    Correct whitespace.

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/aac/aac_pci.c
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/aac/aac_pci.c
==============================================================================
--- stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 00:01:20 2009	(r198531)
+++ stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 01:53:25 2009	(r198532)
@@ -245,7 +245,15 @@ struct aac_ident
 	{0x9005, 0x0285, 0x9005, 0x02d0, AAC_HWIF_I960RX, 0,
 	 "Adaptec RAID 52445"},
 	{0x9005, 0x0285, 0x9005, 0x02d1, AAC_HWIF_I960RX, 0,
-        "Adaptec RAID 5405"},
+	 "Adaptec RAID 5405"},
+	{0x9005, 0x0285, 0x9005, 0x02d4, AAC_HWIF_I960RX, 0,
+	 "Adaptec RAID 2045"},
+	{0x9005, 0x0285, 0x9005, 0x02d5, AAC_HWIF_I960RX, 0,
+	 "Adaptec RAID 2405"},
+	{0x9005, 0x0285, 0x9005, 0x02d6, AAC_HWIF_I960RX, 0,
+	 "Adaptec RAID 2445"},
+	{0x9005, 0x0285, 0x9005, 0x02d7, AAC_HWIF_I960RX, 0,
+	 "Adaptec RAID 2805"},
 	{0x9005, 0x0286, 0x1014, 0x9580, AAC_HWIF_RKT, 0,
 	 "IBM ServeRAID-8k"},
 	{0x9005, 0x0285, 0x1014, 0x034d, AAC_HWIF_I960RX, 0,

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 02:20:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE05F106566B;
	Wed, 28 Oct 2009 02:20:29 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA4FA8FC22;
	Wed, 28 Oct 2009 02:20: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 n9S2KTqp047897;
	Wed, 28 Oct 2009 02:20:29 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9S2KTne047891;
	Wed, 28 Oct 2009 02:20:29 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910280220.n9S2KTne047891@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 02:20:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198533 - in stable/7/sys: . contrib/pf dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 02:20:30 -0000

Author: emaste
Date: Wed Oct 28 02:20:29 2009
New Revision: 198533
URL: http://svn.freebsd.org/changeset/base/198533

Log:
  MFC r188896
  
    Sync with the official Adaptec vendor driver:
  
    [1]	Add the support for the NARK controller which seems a variant of
  	the i960Rx.
    [2]	Split up memory regions and other resources in 2 different parts
  	as long as NARK uses them separately (it is not clear to me
  	why though as long as there are no more informations available
  	on this controller). Please note that in all the other cases,
  	the regions overlaps leaving the default behaviour for all the
  	other controllers.
    [3]	Implement a clock daemon responsible for maintain updated the
  	wall clock time of the controller (run any 30 minutes).
  
  (Replace callout_schedule with callout_reset for [3].)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/aac/aac.c
  stable/7/sys/dev/aac/aac_debug.c
  stable/7/sys/dev/aac/aac_pci.c
  stable/7/sys/dev/aac/aacreg.h
  stable/7/sys/dev/aac/aacvar.h

Modified: stable/7/sys/dev/aac/aac.c
==============================================================================
--- stable/7/sys/dev/aac/aac.c	Wed Oct 28 01:53:25 2009	(r198532)
+++ stable/7/sys/dev/aac/aac.c	Wed Oct 28 02:20:29 2009	(r198533)
@@ -71,6 +71,7 @@ static void	aac_startup(void *arg);
 static void	aac_add_container(struct aac_softc *sc,
 				  struct aac_mntinforesp *mir, int f);
 static void	aac_get_bus_info(struct aac_softc *sc);
+static void	aac_daemon(void *arg);
 
 /* Command Processing */
 static void	aac_timeout(struct aac_softc *sc);
@@ -292,6 +293,9 @@ aac_attach(struct aac_softc *sc)
 	TAILQ_INIT(&sc->aac_container_tqh);
 	TAILQ_INIT(&sc->aac_ev_cmfree);
 
+	/* Initialize the clock daemon callout. */
+	callout_init_mtx(&sc->aac_daemontime, &sc->aac_io_lock, 0);
+
 	/*
 	 * Initialize the adapter.
 	 */
@@ -349,9 +353,34 @@ aac_attach(struct aac_softc *sc)
 		aac_get_bus_info(sc);
 	}
 
+	mtx_lock(&sc->aac_io_lock);
+	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
+	mtx_unlock(&sc->aac_io_lock);
+
 	return(0);
 }
 
+static void
+aac_daemon(void *arg)
+{
+	struct timeval tv;
+	struct aac_softc *sc;
+	struct aac_fib *fib;
+
+	sc = arg;
+	mtx_assert(&sc->aac_io_lock, MA_OWNED);
+
+	if (callout_pending(&sc->aac_daemontime) ||
+	    callout_active(&sc->aac_daemontime) == 0)
+		return;
+	getmicrotime(&tv);
+	aac_alloc_sync_fib(sc, &fib);
+	*(uint32_t *)fib->data = tv.tv_sec;
+	aac_sync_fib(sc, SendHostTime, 0, fib, sizeof(uint32_t));
+	aac_release_sync_fib(sc);
+	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
+}
+
 void
 aac_add_event(struct aac_softc *sc, struct aac_event *event)
 {
@@ -632,9 +661,12 @@ aac_free(struct aac_softc *sc)
 		bus_dma_tag_destroy(sc->aac_parent_dmat);
 
 	/* release the register window mapping */
-	if (sc->aac_regs_resource != NULL)
+	if (sc->aac_regs_res0 != NULL)
+		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
+				     sc->aac_regs_rid0, sc->aac_regs_res0);
+	if (sc->aac_hwif == AAC_HWIF_NARK && sc->aac_regs_res1 != NULL)
 		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
-				     sc->aac_regs_rid, sc->aac_regs_resource);
+				     sc->aac_regs_rid1, sc->aac_regs_res1);
 }
 
 /*
@@ -654,6 +686,8 @@ aac_detach(device_t dev)
 	if (sc->aac_state & AAC_STATE_OPEN)
 		return(EBUSY);
 
+	callout_drain(&sc->aac_daemontime);
+
 	/* Remove the child containers */
 	while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) {
 		error = device_delete_child(dev, co->co_disk);
@@ -834,7 +868,7 @@ aac_new_intr(void *arg)
 			}
 			index &= ~2;
 			for (i = 0; i < sizeof(struct aac_fib)/4; ++i)
-				((u_int32_t *)fib)[i] = AAC_GETREG4(sc, index + i*4);
+				((u_int32_t *)fib)[i] = AAC_MEM1_GETREG4(sc, index + i*4);
 			aac_handle_aif(sc, fib);
 			free(fib, M_AACBUF);
 
@@ -1754,26 +1788,33 @@ aac_check_firmware(struct aac_softc *sc)
 
 	/* Remap mem. resource, if required */
 	if ((sc->flags & AAC_FLAGS_NEW_COMM) &&
-		atu_size > rman_get_size(sc->aac_regs_resource)) {
+		atu_size > rman_get_size(sc->aac_regs_res1)) {
 		bus_release_resource(
 			sc->aac_dev, SYS_RES_MEMORY,
-			sc->aac_regs_rid, sc->aac_regs_resource);
-		sc->aac_regs_resource = bus_alloc_resource(
-			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid,
+			sc->aac_regs_rid1, sc->aac_regs_res1);
+		sc->aac_regs_res1 = bus_alloc_resource(
+			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid1,
 			0ul, ~0ul, atu_size, RF_ACTIVE);
-		if (sc->aac_regs_resource == NULL) {
-			sc->aac_regs_resource = bus_alloc_resource_any(
+		if (sc->aac_regs_res1 == NULL) {
+			sc->aac_regs_res1 = bus_alloc_resource_any(
 				sc->aac_dev, SYS_RES_MEMORY,
-				&sc->aac_regs_rid, RF_ACTIVE);
-			if (sc->aac_regs_resource == NULL) {
+				&sc->aac_regs_rid1, RF_ACTIVE);
+			if (sc->aac_regs_res1 == NULL) {
 				device_printf(sc->aac_dev,
 				    "couldn't allocate register window\n");
 				return (ENXIO);
 			}
 			sc->flags &= ~AAC_FLAGS_NEW_COMM;
 		}
-		sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-		sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+
+		if (sc->aac_hwif == AAC_HWIF_NARK) {
+			sc->aac_regs_res0 = sc->aac_regs_res1;
+			sc->aac_regs_rid0 = sc->aac_regs_rid1;
+			sc->aac_btag0 = sc->aac_btag1;
+			sc->aac_bhandle0 = sc->aac_bhandle1;
+		}
 	}
 
 	/* Read preferred settings */
@@ -1944,10 +1985,10 @@ aac_init(struct aac_softc *sc)
 	 */
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		AAC_SETREG4(sc, AAC_RX_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, ~0);
 		break;
 	case AAC_HWIF_RKT:
-		AAC_SETREG4(sc, AAC_RKT_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, ~0);
 		break;
 	default:
 		break;
@@ -2367,7 +2408,7 @@ aac_sa_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_FWSTATUS));
+	return(AAC_MEM0_GETREG4(sc, AAC_SA_FWSTATUS));
 }
 
 static int
@@ -2375,7 +2416,7 @@ aac_rx_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
 	    AAC_RX_OMR0 : AAC_RX_FWSTATUS));
 }
 
@@ -2386,7 +2427,7 @@ aac_fa_get_fwstatus(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_FWSTATUS);
+	val = AAC_MEM0_GETREG4(sc, AAC_FA_FWSTATUS);
 	return (val);
 }
 
@@ -2395,7 +2436,7 @@ aac_rkt_get_fwstatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
 	    AAC_RKT_OMR0 : AAC_RKT_FWSTATUS));
 }
 
@@ -2408,7 +2449,7 @@ aac_sa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
 }
 
 static void
@@ -2416,7 +2457,7 @@ aac_rx_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IDBR, qbit);
 }
 
 static void
@@ -2424,7 +2465,7 @@ aac_fa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
 	AAC_FA_HACK(sc);
 }
 
@@ -2433,7 +2474,7 @@ aac_rkt_qnotify(struct aac_softc *sc, in
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IDBR, qbit);
 }
 
 /*
@@ -2444,7 +2485,7 @@ aac_sa_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG2(sc, AAC_SA_DOORBELL0));
+	return(AAC_MEM0_GETREG2(sc, AAC_SA_DOORBELL0));
 }
 
 static int
@@ -2452,7 +2493,7 @@ aac_rx_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_ODBR));
 }
 
 static int
@@ -2462,7 +2503,7 @@ aac_fa_get_istatus(struct aac_softc *sc)
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG2(sc, AAC_FA_DOORBELL0);
+	val = AAC_MEM0_GETREG2(sc, AAC_FA_DOORBELL0);
 	return (val);
 }
 
@@ -2471,7 +2512,7 @@ aac_rkt_get_istatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_ODBR));
 }
 
 /*
@@ -2482,7 +2523,7 @@ aac_sa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
 }
 
 static void
@@ -2490,7 +2531,7 @@ aac_rx_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, mask);
 }
 
 static void
@@ -2498,7 +2539,7 @@ aac_fa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
 	AAC_FA_HACK(sc);
 }
 
@@ -2507,7 +2548,7 @@ aac_rkt_clear_istatus(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, mask);
 }
 
 /*
@@ -2519,11 +2560,11 @@ aac_sa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_SA_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2532,11 +2573,11 @@ aac_rx_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2545,15 +2586,15 @@ aac_fa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_FA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX, command);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
 	AAC_FA_HACK(sc);
 }
 
@@ -2563,11 +2604,11 @@ aac_rkt_set_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
 }
 
 /*
@@ -2578,7 +2619,7 @@ aac_sa_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2586,7 +2627,7 @@ aac_rx_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2596,7 +2637,7 @@ aac_fa_get_mailbox(struct aac_softc *sc,
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
+	val = AAC_MEM1_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
 	return (val);
 }
 
@@ -2605,7 +2646,7 @@ aac_rkt_get_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
 }
 
 /*
@@ -2617,9 +2658,9 @@ aac_sa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
 	}
 }
 
@@ -2630,11 +2671,11 @@ aac_rx_set_interrupts(struct aac_softc *
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RX_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~0);
 	}
 }
 
@@ -2644,10 +2685,10 @@ aac_fa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 		AAC_FA_HACK(sc);
 	} else {
-		AAC_SETREG2((sc), AAC_FA_MASK0, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0, ~0);
 		AAC_FA_HACK(sc);
 	}
 }
@@ -2659,11 +2700,11 @@ aac_rkt_set_interrupts(struct aac_softc 
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RKT_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~0);
 	}
 }
 
@@ -2677,19 +2718,19 @@ aac_rx_send_command(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RX_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RX_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RX_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IQUE, index);
 	return 0;
 }
 
@@ -2700,19 +2741,19 @@ aac_rkt_send_command(struct aac_softc *s
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RKT_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IQUE, index);
 	return 0;
 }
 
@@ -2724,7 +2765,7 @@ aac_rx_get_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_OQUE));
 }
 
 static int
@@ -2732,7 +2773,7 @@ aac_rkt_get_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_OQUE));
 }
 
 static void
@@ -2740,7 +2781,7 @@ aac_rx_set_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RX_OQUE, index);
 }
 
 static void
@@ -2748,7 +2789,7 @@ aac_rkt_set_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_OQUE, index);
 }
 
 /*

Modified: stable/7/sys/dev/aac/aac_debug.c
==============================================================================
--- stable/7/sys/dev/aac/aac_debug.c	Wed Oct 28 01:53:25 2009	(r198532)
+++ stable/7/sys/dev/aac/aac_debug.c	Wed Oct 28 02:20:29 2009	(r198533)
@@ -134,17 +134,18 @@ aac_printstate0(void)
 	aac_print_queues(sc);
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
+	case AAC_HWIF_NARK:
 		device_printf(sc->aac_dev, "IDBR 0x%08x  IIMR 0x%08x  "
-		    "IISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_IDBR),
-		    AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
+		    "IISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_IDBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_IIMR), AAC_MEM0_GETREG4(sc, AAC_RX_IISR));
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
-		AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
 			    AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
 		break;
 	case AAC_HWIF_STRONGARM:
 		/* XXX implement */

Modified: stable/7/sys/dev/aac/aac_pci.c
==============================================================================
--- stable/7/sys/dev/aac/aac_pci.c	Wed Oct 28 01:53:25 2009	(r198532)
+++ stable/7/sys/dev/aac/aac_pci.c	Wed Oct 28 02:20:29 2009	(r198533)
@@ -374,21 +374,32 @@ aac_pci_attach(device_t dev)
 	/*
 	 * Allocate the PCI register window.
 	 */
-	sc->aac_regs_rid = PCIR_BAR(0);
-	if ((sc->aac_regs_resource = bus_alloc_resource_any(sc->aac_dev,
-							    SYS_RES_MEMORY,
-							    &sc->aac_regs_rid,
-							    RF_ACTIVE)) ==
-							    NULL) {
+	sc->aac_regs_rid0 = PCIR_BAR(0);
+	if ((sc->aac_regs_res0 = bus_alloc_resource_any(sc->aac_dev,
+	    SYS_RES_MEMORY, &sc->aac_regs_rid0, RF_ACTIVE)) == NULL) {
 		device_printf(sc->aac_dev,
-			      "couldn't allocate register window\n");
+		    "couldn't allocate register window 0\n");
 		goto out;
 	}
-	sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-	sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+	sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
+	sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
 
-	/* assume failure is 'out of memory' */
-	error = ENOMEM;
+	if (sc->aac_hwif == AAC_HWIF_NARK) {
+		sc->aac_regs_rid1 = PCIR_BAR(1);
+		if ((sc->aac_regs_res1 = bus_alloc_resource_any(sc->aac_dev,
+		    SYS_RES_MEMORY, &sc->aac_regs_rid1, RF_ACTIVE)) == NULL) {
+			device_printf(sc->aac_dev,
+			    "couldn't allocate register window 1\n");
+			goto out;
+		}
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+	} else {
+		sc->aac_regs_res1 = sc->aac_regs_res0;
+		sc->aac_regs_rid1 = sc->aac_regs_rid0;
+		sc->aac_btag1 = sc->aac_btag0;
+		sc->aac_bhandle1 = sc->aac_bhandle0;
+	}
 
 	/*
 	 * Allocate the parent bus DMA tag appropriate for our PCI interface.
@@ -418,7 +429,8 @@ aac_pci_attach(device_t dev)
 	sc->aac_hwif = id->hwif;
 	switch(sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx");
+	case AAC_HWIF_NARK:
+		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
 		sc->aac_if = aac_rx_interface;
 		break;
 	case AAC_HWIF_STRONGARM:

Modified: stable/7/sys/dev/aac/aacreg.h
==============================================================================
--- stable/7/sys/dev/aac/aacreg.h	Wed Oct 28 01:53:25 2009	(r198532)
+++ stable/7/sys/dev/aac/aacreg.h	Wed Oct 28 02:20:29 2009	(r198533)
@@ -1468,7 +1468,7 @@ enum {
 #define	AAC_FA_FWSTATUS			0x2c	/* Mailbox 7 */
 #define	AAC_FA_INTSRC			0x900
 
-#define AAC_FA_HACK(sc)	(void)AAC_GETREG4(sc, AAC_FA_INTSRC)
+#define AAC_FA_HACK(sc)	(void)AAC_MEM0_GETREG4(sc, AAC_FA_INTSRC)
 
 /*
  * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based

Modified: stable/7/sys/dev/aac/aacvar.h
==============================================================================
--- stable/7/sys/dev/aac/aacvar.h	Wed Oct 28 01:53:25 2009	(r198532)
+++ stable/7/sys/dev/aac/aacvar.h	Wed Oct 28 02:20:29 2009	(r198533)
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -259,18 +260,31 @@ extern struct aac_interface	aac_rkt_inte
 #define AAC_GET_OUTB_QUEUE(sc)		((sc)->aac_if.aif_get_outb_queue((sc)))
 #define AAC_SET_OUTB_QUEUE(sc, idx)	((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
 
-#define AAC_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG4(sc, reg)		bus_space_read_4 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG2(sc, reg)		bus_space_read_2 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG1(sc, reg)		bus_space_read_1 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
+#define AAC_MEM0_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+
+#define AAC_MEM1_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
 
 /* fib context (IOCTL) */
 struct aac_fib_context {
@@ -287,11 +301,10 @@ struct aac_softc 
 {
 	/* bus connections */
 	device_t		aac_dev;
-	struct resource		*aac_regs_resource;	/* register interface
-							 * window */
-	int			aac_regs_rid;		/* resource ID */
-	bus_space_handle_t	aac_bhandle;		/* bus space handle */
-	bus_space_tag_t		aac_btag;		/* bus space tag */
+	struct resource		*aac_regs_res0, *aac_regs_res1; /* reg. if. window */
+	int			aac_regs_rid0, aac_regs_rid1;		/* resource ID */
+	bus_space_handle_t	aac_bhandle0, aac_bhandle1;		/* bus space handle */
+	bus_space_tag_t		aac_btag0, aac_btag1;		/* bus space tag */
 	bus_dma_tag_t		aac_parent_dmat;	/* parent DMA tag */
 	bus_dma_tag_t		aac_buffer_dmat;	/* data buffer/command
 							 * DMA tag */
@@ -315,6 +328,7 @@ struct aac_softc 
 #define AAC_HWIF_STRONGARM	1
 #define AAC_HWIF_FALCON		2
 #define AAC_HWIF_RKT		3
+#define	AAC_HWIF_NARK		4
 #define AAC_HWIF_UNKNOWN	-1
 	bus_dma_tag_t		aac_common_dmat;	/* common structure
 							 * DMA tag */
@@ -398,6 +412,8 @@ struct aac_softc 
 	u_int32_t		scsi_method_id;
 	TAILQ_HEAD(,aac_sim)	aac_sim_tqh;
 
+	struct callout	aac_daemontime;		/* clock daemon callout */
+
 	u_int32_t	aac_max_fibs;           /* max. FIB count */
 	u_int32_t	aac_max_fibs_alloc;		/* max. alloc. per alloc_commands() */
 	u_int32_t	aac_max_fib_size;		/* max. FIB size */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 07:05:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 418421065676;
	Wed, 28 Oct 2009 07:05:33 +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 3184D8FC12;
	Wed, 28 Oct 2009 07: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 n9S75WkG053311;
	Wed, 28 Oct 2009 07:05:32 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9S75WSa053309;
	Wed, 28 Oct 2009 07:05:32 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910280705.n9S75WSa053309@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 28 Oct 2009 07:05: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: r198535 - head
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 07:05:33 -0000

Author: edwin
Date: Wed Oct 28 07:05:32 2009
New Revision: 198535
URL: http://svn.freebsd.org/changeset/base/198535

Log:
  Now that the zoneinfo data is automatically updated when a new world
  is installed, we should at least have the tzsetup tool available!
  
  Suggested by:	Andriy Gapon 
  Noticed by:	Ben Kaduk 
  MFC after:	1 week

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Wed Oct 28 03:34:05 2009	(r198534)
+++ head/Makefile.inc1	Wed Oct 28 07:05:32 2009	(r198535)
@@ -599,11 +599,14 @@ installcheck_UGID:
 .if ${MK_INFO} != "no"
 _install-info=	install-info
 .endif
+.if ${MK_ZONEINFO} != "no"
+_zoneinfo=	zic tzsetup
+.endif
 
 ITOOLS=	[ awk cap_mkdb cat chflags chmod chown \
 	date echo egrep find grep ${_install-info} \
 	ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
-	test true uname wc zic
+	test true uname wc ${_zoneinfo}
 
 #
 # distributeworld

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 10:06:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57722106568B;
	Wed, 28 Oct 2009 10:06:28 +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 46ACF8FC23;
	Wed, 28 Oct 2009 10:06: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 n9SA6RwR057815;
	Wed, 28 Oct 2009 10:06:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SA6R5t057813;
	Wed, 28 Oct 2009 10:06:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281006.n9SA6R5t057813@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 10:06: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: r198537 - head/sys/boot/common
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 10:06:28 -0000

Author: brueffer
Date: Wed Oct 28 10:06:27 2009
New Revision: 198537
URL: http://svn.freebsd.org/changeset/base/198537

Log:
  Close a file descriptor leak in an error case.
  
  PR:		138374
  Submitted by:	Patroklos Argyroudis 
  MFC after:	1 week

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

Modified: head/sys/boot/common/commands.c
==============================================================================
--- head/sys/boot/common/commands.c	Wed Oct 28 09:55:42 2009	(r198536)
+++ head/sys/boot/common/commands.c	Wed Oct 28 10:06:27 2009	(r198537)
@@ -150,6 +150,7 @@ command_help(int argc, char *argv[]) 
 	break;
     default:
 	command_errmsg = "usage is 'help  []";
+	close(hfd);
 	return(CMD_ERROR);
     }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 11:14:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0657F106566C;
	Wed, 28 Oct 2009 11:14:33 +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 DD0908FC18;
	Wed, 28 Oct 2009 11:14: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 n9SBEWiq060185;
	Wed, 28 Oct 2009 11:14:32 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SBEWh0060180;
	Wed, 28 Oct 2009 11:14:32 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910281114.n9SBEWh0060180@svn.freebsd.org>
From: Konstantin Belousov 
Date: Wed, 28 Oct 2009 11:14: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: r198538 - in head: . lib/libc/gen lib/libc/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 11:14:33 -0000

Author: kib
Date: Wed Oct 28 11:14:32 2009
New Revision: 198538
URL: http://svn.freebsd.org/changeset/base/198538

Log:
  Move pselect(3) man page to section 2.
  
  Noted by:	jhb
  MFC after:	1 month

Added:
  head/lib/libc/sys/pselect.2
     - copied, changed from r198524, head/lib/libc/gen/pselect.3
Deleted:
  head/lib/libc/gen/pselect.3
Modified:
  head/ObsoleteFiles.inc
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/sys/Makefile.inc

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Oct 28 10:06:27 2009	(r198537)
+++ head/ObsoleteFiles.inc	Wed Oct 28 11:14:32 2009	(r198538)
@@ -14,6 +14,8 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20091027: pselect.3 implemented as syscall
+OLD_FILES+=usr/share/man/man3/pselect.3.gz
 # 20091005: fusword.9 and susword.9 removed
 OLD_FILES+=usr/share/man/man9/fusword.9.gz
 OLD_FILES+=usr/share/man/man9/susword.9.gz

Modified: head/lib/libc/gen/Makefile.inc
==============================================================================
--- head/lib/libc/gen/Makefile.inc	Wed Oct 28 10:06:27 2009	(r198537)
+++ head/lib/libc/gen/Makefile.inc	Wed Oct 28 11:14:32 2009	(r198538)
@@ -62,7 +62,7 @@ MAN+=	alarm.3 arc4random.3 \
 	posix_spawnattr_getpgroup.3 posix_spawnattr_getschedparam.3 \
 	posix_spawnattr_getschedpolicy.3 posix_spawnattr_init.3 \
 	posix_spawnattr_getsigdefault.3 posix_spawnattr_getsigmask.3 \
-	pselect.3 psignal.3 pwcache.3 \
+	psignal.3 pwcache.3 \
 	raise.3 rand48.3 readpassphrase.3 rfork_thread.3 \
 	scandir.3 sem_destroy.3 sem_getvalue.3 sem_init.3 \
 	sem_open.3 sem_post.3 sem_timedwait.3 sem_wait.3 \

Modified: head/lib/libc/sys/Makefile.inc
==============================================================================
--- head/lib/libc/sys/Makefile.inc	Wed Oct 28 10:06:27 2009	(r198537)
+++ head/lib/libc/sys/Makefile.inc	Wed Oct 28 11:14:32 2009	(r198538)
@@ -83,7 +83,8 @@ MAN+=	abort2.2 accept.2 access.2 acct.2 
 	mq_setattr.2 \
 	msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \
 	msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \
-	pathconf.2 pipe.2 poll.2 posix_openpt.2 profil.2 ptrace.2 quotactl.2 \
+	pathconf.2 pipe.2 poll.2 posix_openpt.2 profil.2 \
+	pselect.2 ptrace.2 quotactl.2 \
 	read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \
 	rtprio.2
 .if !defined(NO_P1003_1B)

Copied and modified: head/lib/libc/sys/pselect.2 (from r198524, head/lib/libc/gen/pselect.3)
==============================================================================
--- head/lib/libc/gen/pselect.3	Tue Oct 27 18:30:56 2009	(r198524, copy source)
+++ head/lib/libc/sys/pselect.2	Wed Oct 28 11:14:32 2009	(r198538)
@@ -28,8 +28,8 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 16, 2002
-.Dt PSELECT 3
+.Dd October 27, 2009
+.Dt PSELECT 2
 .Os
 .Sh NAME
 .Nm pselect
@@ -116,7 +116,7 @@ The
 function first appeared in
 .Fx 5.0 .
 .Sh AUTHORS
-The
+The first implementation of
 .Fn pselect
 function and this manual page were written by
 .An Garrett Wollman Aq wollman@FreeBSD.org .

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 12:10:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 984161065676;
	Wed, 28 Oct 2009 12:10:29 +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 8683F8FC28;
	Wed, 28 Oct 2009 12:10: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 n9SCATQw061161;
	Wed, 28 Oct 2009 12:10:29 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SCAT61061159;
	Wed, 28 Oct 2009 12:10:29 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281210.n9SCAT61061159@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 12:10: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: r198539 - head/sys/netinet/libalias
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 12:10:29 -0000

Author: brueffer
Date: Wed Oct 28 12:10:29 2009
New Revision: 198539
URL: http://svn.freebsd.org/changeset/base/198539

Log:
  Close a stream file descriptor leak.
  
  PR:		138130
  Submitted by:	Patroklos Argyroudis 
  MFC after:	1 week

Modified:
  head/sys/netinet/libalias/alias.c

Modified: head/sys/netinet/libalias/alias.c
==============================================================================
--- head/sys/netinet/libalias/alias.c	Wed Oct 28 11:14:32 2009	(r198538)
+++ head/sys/netinet/libalias/alias.c	Wed Oct 28 12:10:29 2009	(r198539)
@@ -1669,6 +1669,7 @@ LibAliasRefreshModules(void)
 			LibAliasLoadModule(buf);
 		}
 	}
+	fclose(fd);
 	return (0);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 13:38:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A579106568D;
	Wed, 28 Oct 2009 13:38:07 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6672B8FC20;
	Wed, 28 Oct 2009 13:38: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 n9SDc7Up062773;
	Wed, 28 Oct 2009 13:38:07 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SDc7MU062767;
	Wed, 28 Oct 2009 13:38:07 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910281338.n9SDc7MU062767@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 13:38:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198540 - in stable/6/sys: . conf contrib/pf dev/aac
	dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 13:38:07 -0000

Author: emaste
Date: Wed Oct 28 13:38:07 2009
New Revision: 198540
URL: http://svn.freebsd.org/changeset/base/198540

Log:
  MFC r188896
  
    Sync with the official Adaptec vendor driver:
  
    [1] Add the support for the NARK controller which seems a variant of
        the i960Rx.
    [2] Split up memory regions and other resources in 2 different parts
        as long as NARK uses them separately (it is not clear to me
        why though as long as there are no more informations available
        on this controller). Please note that in all the other cases,
        the regions overlaps leaving the default behaviour for all the
        other controllers.
    [3] Implement a clock daemon responsible for maintain updated the
        wall clock time of the controller (run any 30 minutes).
  
  (Replace callout_schedule with callout_reset for [3].)

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/aac/aac.c
  stable/6/sys/dev/aac/aac_debug.c
  stable/6/sys/dev/aac/aac_pci.c
  stable/6/sys/dev/aac/aacreg.h
  stable/6/sys/dev/aac/aacvar.h
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/aac/aac.c
==============================================================================
--- stable/6/sys/dev/aac/aac.c	Wed Oct 28 12:10:29 2009	(r198539)
+++ stable/6/sys/dev/aac/aac.c	Wed Oct 28 13:38:07 2009	(r198540)
@@ -71,6 +71,7 @@ static void	aac_startup(void *arg);
 static void	aac_add_container(struct aac_softc *sc,
 				  struct aac_mntinforesp *mir, int f);
 static void	aac_get_bus_info(struct aac_softc *sc);
+static void	aac_daemon(void *arg);
 
 /* Command Processing */
 static void	aac_timeout(struct aac_softc *sc);
@@ -292,6 +293,9 @@ aac_attach(struct aac_softc *sc)
 	TAILQ_INIT(&sc->aac_container_tqh);
 	TAILQ_INIT(&sc->aac_ev_cmfree);
 
+	/* Initialize the clock daemon callout. */
+	callout_init_mtx(&sc->aac_daemontime, &sc->aac_io_lock, 0);
+
 	/*
 	 * Initialize the adapter.
 	 */
@@ -349,9 +353,34 @@ aac_attach(struct aac_softc *sc)
 		aac_get_bus_info(sc);
 	}
 
+	mtx_lock(&sc->aac_io_lock);
+	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
+	mtx_unlock(&sc->aac_io_lock);
+
 	return(0);
 }
 
+static void
+aac_daemon(void *arg)
+{
+	struct timeval tv;
+	struct aac_softc *sc;
+	struct aac_fib *fib;
+
+	sc = arg;
+	mtx_assert(&sc->aac_io_lock, MA_OWNED);
+
+	if (callout_pending(&sc->aac_daemontime) ||
+	    callout_active(&sc->aac_daemontime) == 0)
+		return;
+	getmicrotime(&tv);
+	aac_alloc_sync_fib(sc, &fib);
+	*(uint32_t *)fib->data = tv.tv_sec;
+	aac_sync_fib(sc, SendHostTime, 0, fib, sizeof(uint32_t));
+	aac_release_sync_fib(sc);
+	callout_schedule(&sc->aac_daemontime, 30 * 60 * hz);
+}
+
 void
 aac_add_event(struct aac_softc *sc, struct aac_event *event)
 {
@@ -632,9 +661,12 @@ aac_free(struct aac_softc *sc)
 		bus_dma_tag_destroy(sc->aac_parent_dmat);
 
 	/* release the register window mapping */
-	if (sc->aac_regs_resource != NULL)
+	if (sc->aac_regs_res0 != NULL)
+		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
+				     sc->aac_regs_rid0, sc->aac_regs_res0);
+	if (sc->aac_hwif == AAC_HWIF_NARK && sc->aac_regs_res1 != NULL)
 		bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
-				     sc->aac_regs_rid, sc->aac_regs_resource);
+				     sc->aac_regs_rid1, sc->aac_regs_res1);
 }
 
 /*
@@ -654,6 +686,8 @@ aac_detach(device_t dev)
 	if (sc->aac_state & AAC_STATE_OPEN)
 		return(EBUSY);
 
+	callout_drain(&sc->aac_daemontime);
+
 	/* Remove the child containers */
 	while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) {
 		error = device_delete_child(dev, co->co_disk);
@@ -834,7 +868,7 @@ aac_new_intr(void *arg)
 			}
 			index &= ~2;
 			for (i = 0; i < sizeof(struct aac_fib)/4; ++i)
-				((u_int32_t *)fib)[i] = AAC_GETREG4(sc, index + i*4);
+				((u_int32_t *)fib)[i] = AAC_MEM1_GETREG4(sc, index + i*4);
 			aac_handle_aif(sc, fib);
 			free(fib, M_AACBUF);
 
@@ -1753,26 +1787,33 @@ aac_check_firmware(struct aac_softc *sc)
 
 	/* Remap mem. resource, if required */
 	if ((sc->flags & AAC_FLAGS_NEW_COMM) &&
-		atu_size > rman_get_size(sc->aac_regs_resource)) {
+		atu_size > rman_get_size(sc->aac_regs_res1)) {
 		bus_release_resource(
 			sc->aac_dev, SYS_RES_MEMORY,
-			sc->aac_regs_rid, sc->aac_regs_resource);
-		sc->aac_regs_resource = bus_alloc_resource(
-			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid,
+			sc->aac_regs_rid1, sc->aac_regs_res1);
+		sc->aac_regs_res1 = bus_alloc_resource(
+			sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid1,
 			0ul, ~0ul, atu_size, RF_ACTIVE);
-		if (sc->aac_regs_resource == NULL) {
-			sc->aac_regs_resource = bus_alloc_resource_any(
+		if (sc->aac_regs_res1 == NULL) {
+			sc->aac_regs_res1 = bus_alloc_resource_any(
 				sc->aac_dev, SYS_RES_MEMORY,
-				&sc->aac_regs_rid, RF_ACTIVE);
-			if (sc->aac_regs_resource == NULL) {
+				&sc->aac_regs_rid1, RF_ACTIVE);
+			if (sc->aac_regs_res1 == NULL) {
 				device_printf(sc->aac_dev,
 				    "couldn't allocate register window\n");
 				return (ENXIO);
 			}
 			sc->flags &= ~AAC_FLAGS_NEW_COMM;
 		}
-		sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-		sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+
+		if (sc->aac_hwif == AAC_HWIF_NARK) {
+			sc->aac_regs_res0 = sc->aac_regs_res1;
+			sc->aac_regs_rid0 = sc->aac_regs_rid1;
+			sc->aac_btag0 = sc->aac_btag1;
+			sc->aac_bhandle0 = sc->aac_bhandle1;
+		}
 	}
 
 	/* Read preferred settings */
@@ -1943,10 +1984,10 @@ aac_init(struct aac_softc *sc)
 	 */
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		AAC_SETREG4(sc, AAC_RX_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, ~0);
 		break;
 	case AAC_HWIF_RKT:
-		AAC_SETREG4(sc, AAC_RKT_ODBR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, ~0);
 		break;
 	default:
 		break;
@@ -2365,7 +2406,7 @@ aac_sa_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_FWSTATUS));
+	return(AAC_MEM0_GETREG4(sc, AAC_SA_FWSTATUS));
 }
 
 static int
@@ -2373,7 +2414,7 @@ aac_rx_get_fwstatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
 	    AAC_RX_OMR0 : AAC_RX_FWSTATUS));
 }
 
@@ -2384,7 +2425,7 @@ aac_fa_get_fwstatus(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_FWSTATUS);
+	val = AAC_MEM0_GETREG4(sc, AAC_FA_FWSTATUS);
 	return (val);
 }
 
@@ -2393,7 +2434,7 @@ aac_rkt_get_fwstatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
+	return(AAC_MEM0_GETREG4(sc, sc->flags & AAC_FLAGS_NEW_COMM ?
 	    AAC_RKT_OMR0 : AAC_RKT_FWSTATUS));
 }
 
@@ -2406,7 +2447,7 @@ aac_sa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL1_SET, qbit);
 }
 
 static void
@@ -2414,7 +2455,7 @@ aac_rx_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IDBR, qbit);
 }
 
 static void
@@ -2422,7 +2463,7 @@ aac_fa_qnotify(struct aac_softc *sc, int
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
 	AAC_FA_HACK(sc);
 }
 
@@ -2431,7 +2472,7 @@ aac_rkt_qnotify(struct aac_softc *sc, in
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_IDBR, qbit);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IDBR, qbit);
 }
 
 /*
@@ -2442,7 +2483,7 @@ aac_sa_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG2(sc, AAC_SA_DOORBELL0));
+	return(AAC_MEM0_GETREG2(sc, AAC_SA_DOORBELL0));
 }
 
 static int
@@ -2450,7 +2491,7 @@ aac_rx_get_istatus(struct aac_softc *sc)
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_ODBR));
 }
 
 static int
@@ -2460,7 +2501,7 @@ aac_fa_get_istatus(struct aac_softc *sc)
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG2(sc, AAC_FA_DOORBELL0);
+	val = AAC_MEM0_GETREG2(sc, AAC_FA_DOORBELL0);
 	return (val);
 }
 
@@ -2469,7 +2510,7 @@ aac_rkt_get_istatus(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_ODBR));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_ODBR));
 }
 
 /*
@@ -2480,7 +2521,7 @@ aac_sa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_SA_DOORBELL0_CLEAR, mask);
 }
 
 static void
@@ -2488,7 +2529,7 @@ aac_rx_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RX_ODBR, mask);
 }
 
 static void
@@ -2496,7 +2537,7 @@ aac_fa_clear_istatus(struct aac_softc *s
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
+	AAC_MEM0_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
 	AAC_FA_HACK(sc);
 }
 
@@ -2505,7 +2546,7 @@ aac_rkt_clear_istatus(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_ODBR, mask);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_ODBR, mask);
 }
 
 /*
@@ -2517,11 +2558,11 @@ aac_sa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_SA_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_SA_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2530,11 +2571,11 @@ aac_rx_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RX_MAILBOX + 16, arg3);
 }
 
 static void
@@ -2543,15 +2584,15 @@ aac_fa_set_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_FA_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX, command);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 4, arg0);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
 	AAC_FA_HACK(sc);
-	AAC_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
 	AAC_FA_HACK(sc);
 }
 
@@ -2561,11 +2602,11 @@ aac_rkt_set_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX, command);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
-	AAC_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX, command);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
+	AAC_MEM1_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
 }
 
 /*
@@ -2576,7 +2617,7 @@ aac_sa_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2584,7 +2625,7 @@ aac_rx_get_mailbox(struct aac_softc *sc,
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
 }
 
 static int
@@ -2594,7 +2635,7 @@ aac_fa_get_mailbox(struct aac_softc *sc,
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
+	val = AAC_MEM1_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
 	return (val);
 }
 
@@ -2603,7 +2644,7 @@ aac_rkt_get_mailbox(struct aac_softc *sc
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
+	return(AAC_MEM1_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
 }
 
 /*
@@ -2615,9 +2656,9 @@ aac_sa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_SA_MASK0_SET, ~0);
 	}
 }
 
@@ -2628,11 +2669,11 @@ aac_rx_set_interrupts(struct aac_softc *
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RX_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, ~0);
 	}
 }
 
@@ -2642,10 +2683,10 @@ aac_fa_set_interrupts(struct aac_softc *
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "%sable interrupts", enable ? "en" : "dis");
 
 	if (enable) {
-		AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
 		AAC_FA_HACK(sc);
 	} else {
-		AAC_SETREG2((sc), AAC_FA_MASK0, ~0);
+		AAC_MEM0_SETREG2((sc), AAC_FA_MASK0, ~0);
 		AAC_FA_HACK(sc);
 	}
 }
@@ -2657,11 +2698,11 @@ aac_rkt_set_interrupts(struct aac_softc 
 
 	if (enable) {
 		if (sc->flags & AAC_FLAGS_NEW_COMM)
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INT_NEW_COMM);
 		else
-			AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
+			AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
 	} else {
-		AAC_SETREG4(sc, AAC_RKT_OIMR, ~0);
+		AAC_MEM0_SETREG4(sc, AAC_RKT_OIMR, ~0);
 	}
 }
 
@@ -2675,19 +2716,19 @@ aac_rx_send_command(struct aac_softc *sc
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RX_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RX_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RX_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RX_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RX_IQUE, index);
 	return 0;
 }
 
@@ -2698,19 +2739,19 @@ aac_rkt_send_command(struct aac_softc *s
 
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "send command (new comm.)");
 
-	index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+	index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
-		index = AAC_GETREG4(sc, AAC_RKT_IQUE);
+		index = AAC_MEM0_GETREG4(sc, AAC_RKT_IQUE);
 	if (index == 0xffffffffL)
 		return index;
 	aac_enqueue_busy(cm);
 	device = index;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys & 0xffffffffUL));
 	device += 4;
-	AAC_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
+	AAC_MEM1_SETREG4(sc, device, (u_int32_t)(cm->cm_fibphys >> 32));
 	device += 4;
-	AAC_SETREG4(sc, device, cm->cm_fib->Header.Size);
-	AAC_SETREG4(sc, AAC_RKT_IQUE, index);
+	AAC_MEM1_SETREG4(sc, device, cm->cm_fib->Header.Size);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_IQUE, index);
 	return 0;
 }
 
@@ -2722,7 +2763,7 @@ aac_rx_get_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RX_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RX_OQUE));
 }
 
 static int
@@ -2730,7 +2771,7 @@ aac_rkt_get_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	return(AAC_GETREG4(sc, AAC_RKT_OQUE));
+	return(AAC_MEM0_GETREG4(sc, AAC_RKT_OQUE));
 }
 
 static void
@@ -2738,7 +2779,7 @@ aac_rx_set_outb_queue(struct aac_softc *
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RX_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RX_OQUE, index);
 }
 
 static void
@@ -2746,7 +2787,7 @@ aac_rkt_set_outb_queue(struct aac_softc 
 {
 	fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-	AAC_SETREG4(sc, AAC_RKT_OQUE, index);
+	AAC_MEM0_SETREG4(sc, AAC_RKT_OQUE, index);
 }
 
 /*

Modified: stable/6/sys/dev/aac/aac_debug.c
==============================================================================
--- stable/6/sys/dev/aac/aac_debug.c	Wed Oct 28 12:10:29 2009	(r198539)
+++ stable/6/sys/dev/aac/aac_debug.c	Wed Oct 28 13:38:07 2009	(r198540)
@@ -134,17 +134,18 @@ aac_printstate0(void)
 	aac_print_queues(sc);
 	switch (sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
+	case AAC_HWIF_NARK:
 		device_printf(sc->aac_dev, "IDBR 0x%08x  IIMR 0x%08x  "
-		    "IISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_IDBR),
-		    AAC_GETREG4(sc, AAC_RX_IIMR), AAC_GETREG4(sc, AAC_RX_IISR));
+		    "IISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_IDBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_IIMR), AAC_MEM0_GETREG4(sc, AAC_RX_IISR));
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
-		AAC_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
+		AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
 			    AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
 		device_printf(sc->aac_dev, "ODBR 0x%08x  OIMR 0x%08x  "
-		    "OISR 0x%08x\n", AAC_GETREG4(sc, AAC_RX_ODBR),
-		    AAC_GETREG4(sc, AAC_RX_OIMR), AAC_GETREG4(sc, AAC_RX_OISR));
+		    "OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
+		    AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
 		break;
 	case AAC_HWIF_STRONGARM:
 		/* XXX implement */

Modified: stable/6/sys/dev/aac/aac_pci.c
==============================================================================
--- stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 12:10:29 2009	(r198539)
+++ stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 13:38:07 2009	(r198540)
@@ -374,21 +374,32 @@ aac_pci_attach(device_t dev)
 	/*
 	 * Allocate the PCI register window.
 	 */
-	sc->aac_regs_rid = PCIR_BAR(0);
-	if ((sc->aac_regs_resource = bus_alloc_resource_any(sc->aac_dev,
-							    SYS_RES_MEMORY,
-							    &sc->aac_regs_rid,
-							    RF_ACTIVE)) ==
-							    NULL) {
+	sc->aac_regs_rid0 = PCIR_BAR(0);
+	if ((sc->aac_regs_res0 = bus_alloc_resource_any(sc->aac_dev,
+	    SYS_RES_MEMORY, &sc->aac_regs_rid0, RF_ACTIVE)) == NULL) {
 		device_printf(sc->aac_dev,
-			      "couldn't allocate register window\n");
+		    "couldn't allocate register window 0\n");
 		goto out;
 	}
-	sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
-	sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
+	sc->aac_btag0 = rman_get_bustag(sc->aac_regs_res0);
+	sc->aac_bhandle0 = rman_get_bushandle(sc->aac_regs_res0);
 
-	/* assume failure is 'out of memory' */
-	error = ENOMEM;
+	if (sc->aac_hwif == AAC_HWIF_NARK) {
+		sc->aac_regs_rid1 = PCIR_BAR(1);
+		if ((sc->aac_regs_res1 = bus_alloc_resource_any(sc->aac_dev,
+		    SYS_RES_MEMORY, &sc->aac_regs_rid1, RF_ACTIVE)) == NULL) {
+			device_printf(sc->aac_dev,
+			    "couldn't allocate register window 1\n");
+			goto out;
+		}
+		sc->aac_btag1 = rman_get_bustag(sc->aac_regs_res1);
+		sc->aac_bhandle1 = rman_get_bushandle(sc->aac_regs_res1);
+	} else {
+		sc->aac_regs_res1 = sc->aac_regs_res0;
+		sc->aac_regs_rid1 = sc->aac_regs_rid0;
+		sc->aac_btag1 = sc->aac_btag0;
+		sc->aac_bhandle1 = sc->aac_bhandle0;
+	}
 
 	/*
 	 * Allocate the parent bus DMA tag appropriate for our PCI interface.
@@ -418,7 +429,8 @@ aac_pci_attach(device_t dev)
 	sc->aac_hwif = id->hwif;
 	switch(sc->aac_hwif) {
 	case AAC_HWIF_I960RX:
-		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx");
+	case AAC_HWIF_NARK:
+		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx/NARK");
 		sc->aac_if = aac_rx_interface;
 		break;
 	case AAC_HWIF_STRONGARM:

Modified: stable/6/sys/dev/aac/aacreg.h
==============================================================================
--- stable/6/sys/dev/aac/aacreg.h	Wed Oct 28 12:10:29 2009	(r198539)
+++ stable/6/sys/dev/aac/aacreg.h	Wed Oct 28 13:38:07 2009	(r198540)
@@ -1468,7 +1468,7 @@ enum {
 #define	AAC_FA_FWSTATUS			0x2c	/* Mailbox 7 */
 #define	AAC_FA_INTSRC			0x900
 
-#define AAC_FA_HACK(sc)	(void)AAC_GETREG4(sc, AAC_FA_INTSRC)
+#define AAC_FA_HACK(sc)	(void)AAC_MEM0_GETREG4(sc, AAC_FA_INTSRC)
 
 /*
  * Register definitions for the Adaptec AAC-364 'Jalapeno I/II' adapters, based

Modified: stable/6/sys/dev/aac/aacvar.h
==============================================================================
--- stable/6/sys/dev/aac/aacvar.h	Wed Oct 28 12:10:29 2009	(r198539)
+++ stable/6/sys/dev/aac/aacvar.h	Wed Oct 28 13:38:07 2009	(r198540)
@@ -30,6 +30,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -259,18 +260,31 @@ extern struct aac_interface	aac_rkt_inte
 #define AAC_GET_OUTB_QUEUE(sc)		((sc)->aac_if.aif_get_outb_queue((sc)))
 #define AAC_SET_OUTB_QUEUE(sc, idx)	((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
 
-#define AAC_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG4(sc, reg)		bus_space_read_4 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG2(sc, reg)		bus_space_read_2 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
-#define AAC_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag, \
-					sc->aac_bhandle, reg, val)
-#define AAC_GETREG1(sc, reg)		bus_space_read_1 (sc->aac_btag, \
-					sc->aac_bhandle, reg)
+#define AAC_MEM0_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+#define AAC_MEM0_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg, val)
+#define AAC_MEM0_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag0, \
+					sc->aac_bhandle0, reg)
+
+#define AAC_MEM1_SETREG4(sc, reg, val)	bus_space_write_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG4(sc, reg)	bus_space_read_4(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG2(sc, reg, val)	bus_space_write_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG2(sc, reg)	bus_space_read_2(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
+#define AAC_MEM1_SETREG1(sc, reg, val)	bus_space_write_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg, val)
+#define AAC_MEM1_GETREG1(sc, reg)	bus_space_read_1(sc->aac_btag1, \
+					sc->aac_bhandle1, reg)
 
 /* fib context (IOCTL) */
 struct aac_fib_context {
@@ -287,11 +301,10 @@ struct aac_softc 
 {
 	/* bus connections */
 	device_t		aac_dev;
-	struct resource		*aac_regs_resource;	/* register interface
-							 * window */
-	int			aac_regs_rid;		/* resource ID */
-	bus_space_handle_t	aac_bhandle;		/* bus space handle */
-	bus_space_tag_t		aac_btag;		/* bus space tag */
+	struct resource		*aac_regs_res0, *aac_regs_res1; /* reg. if. window */
+	int			aac_regs_rid0, aac_regs_rid1;		/* resource ID */
+	bus_space_handle_t	aac_bhandle0, aac_bhandle1;		/* bus space handle */
+	bus_space_tag_t		aac_btag0, aac_btag1;		/* bus space tag */
 	bus_dma_tag_t		aac_parent_dmat;	/* parent DMA tag */
 	bus_dma_tag_t		aac_buffer_dmat;	/* data buffer/command
 							 * DMA tag */
@@ -315,6 +328,7 @@ struct aac_softc 
 #define AAC_HWIF_STRONGARM	1
 #define AAC_HWIF_FALCON		2
 #define AAC_HWIF_RKT		3
+#define	AAC_HWIF_NARK		4
 #define AAC_HWIF_UNKNOWN	-1
 	bus_dma_tag_t		aac_common_dmat;	/* common structure
 							 * DMA tag */
@@ -398,6 +412,8 @@ struct aac_softc 
 	u_int32_t		scsi_method_id;
 	TAILQ_HEAD(,aac_sim)	aac_sim_tqh;
 
+	struct callout	aac_daemontime;		/* clock daemon callout */
+
 	u_int32_t	aac_max_fibs;           /* max. FIB count */
 	u_int32_t	aac_max_fibs_alloc;		/* max. alloc. per alloc_commands() */
 	u_int32_t	aac_max_fib_size;		/* max. FIB size */

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 13:50:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6495106568B;
	Wed, 28 Oct 2009 13:50:28 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 94FE88FC2B;
	Wed, 28 Oct 2009 13:50: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 n9SDoS50063012;
	Wed, 28 Oct 2009 13:50:28 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SDoSDY063010;
	Wed, 28 Oct 2009 13:50:28 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910281350.n9SDoSDY063010@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 13:50: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: r198541 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 13:50:28 -0000

Author: emaste
Date: Wed Oct 28 13:50:28 2009
New Revision: 198541
URL: http://svn.freebsd.org/changeset/base/198541

Log:
  Do first controller time sync after 1 minute, as in Adaptec's vendor
  driver.

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

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Wed Oct 28 13:38:07 2009	(r198540)
+++ head/sys/dev/aac/aac.c	Wed Oct 28 13:50:28 2009	(r198541)
@@ -354,7 +354,7 @@ aac_attach(struct aac_softc *sc)
 	}
 
 	mtx_lock(&sc->aac_io_lock);
-	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
+	callout_reset(&sc->aac_daemontime, 60 * hz, aac_daemon, sc);
 	mtx_unlock(&sc->aac_io_lock);
 
 	return(0);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 14:13:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3A74F106568D;
	Wed, 28 Oct 2009 14:13:46 +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 292C98FC35;
	Wed, 28 Oct 2009 14:13: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 n9SEDkWl063461;
	Wed, 28 Oct 2009 14:13:46 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SEDkjd063459;
	Wed, 28 Oct 2009 14:13:46 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281413.n9SEDkjd063459@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 14:13: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: r198542 - head/lib/libstand
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 14:13:46 -0000

Author: brueffer
Date: Wed Oct 28 14:13:45 2009
New Revision: 198542
URL: http://svn.freebsd.org/changeset/base/198542

Log:
  Initialize f_rabuf in the raw device case. A subsequent close()
  later on would try to free it, leading to a crash.
  
  PR:		93998
  Submitted by:	neel
  MFC after:	1 week

Modified:
  head/lib/libstand/open.c

Modified: head/lib/libstand/open.c
==============================================================================
--- head/lib/libstand/open.c	Wed Oct 28 13:50:28 2009	(r198541)
+++ head/lib/libstand/open.c	Wed Oct 28 14:13:45 2009	(r198542)
@@ -113,6 +113,7 @@ open(const char *fname, int mode)
     /* see if we opened a raw device; otherwise, 'file' is the file name. */
     if (file == (char *)0 || *file == '\0') {
 	f->f_flags |= F_RAW;
+	f->f_rabuf = NULL;
 	return (fd);
     }
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 14:39:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC4F3106568D;
	Wed, 28 Oct 2009 14:39:27 +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 AB1CA8FC1E;
	Wed, 28 Oct 2009 14:39: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 n9SEdREb064025;
	Wed, 28 Oct 2009 14:39:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SEdR5V064023;
	Wed, 28 Oct 2009 14:39:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281439.n9SEdR5V064023@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 14:39: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: r198543 - head/share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 14:39:27 -0000

Author: brueffer
Date: Wed Oct 28 14:39:27 2009
New Revision: 198543
URL: http://svn.freebsd.org/changeset/base/198543

Log:
  Fix date (1) and SEE ALSO section.
  
  Submitted by:	Ulrich Spoerlein (1)
  MFC after:	1 week

Modified:
  head/share/man/man5/regdomain.5

Modified: head/share/man/man5/regdomain.5
==============================================================================
--- head/share/man/man5/regdomain.5	Wed Oct 28 14:13:45 2009	(r198542)
+++ head/share/man/man5/regdomain.5	Wed Oct 28 14:39:27 2009	(r198543)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd Apri 13, 2008
+.Dd April 13, 2008
 .Dt REGDOMAIN 5
 .Os
 .Sh NAME
@@ -44,5 +44,5 @@ This file should be changed only to refl
 XML database of 802.11 regulatory constraints
 .El
 .Sh SEE ALSO
-.Xr wlan 4
-.Xr ifconfig 8 ,
+.Xr wlan 4 ,
+.Xr ifconfig 8

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 15:01:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C73D1065692;
	Wed, 28 Oct 2009 15:01:20 +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 4BA928FC1C;
	Wed, 28 Oct 2009 15:01: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 n9SF1Kef064516;
	Wed, 28 Oct 2009 15:01:20 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SF1K9X064514;
	Wed, 28 Oct 2009 15:01:20 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200910281501.n9SF1K9X064514@svn.freebsd.org>
From: Ken Smith 
Date: Wed, 28 Oct 2009 15:01:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-svnadmin@freebsd.org
X-SVN-Group: svnadmin
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198544 - svnadmin/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 15:01:20 -0000

Author: kensmith
Date: Wed Oct 28 15:01:18 2009
New Revision: 198544
URL: http://svn.freebsd.org/changeset/base/198544

Log:
  Add releng/8.0, approval by re@ required.  Release stable/8 to *conservative*
  normal developer activity (please don't make taking care of things destined
  for the release more difficult than necessary).
  
  Approved by:	core (implicit)

Modified:
  svnadmin/conf/approvers

Modified: svnadmin/conf/approvers
==============================================================================
--- svnadmin/conf/approvers	Wed Oct 28 14:39:27 2009	(r198543)
+++ svnadmin/conf/approvers	Wed Oct 28 15:01:18 2009	(r198544)
@@ -17,8 +17,9 @@
 # $FreeBSD$
 #
 #^head/				re
-^stable/8/			re
+#^stable/8/			re
 #^stable/7/			re
+^releng/8.0/			re
 ^releng/7.[0-2]/		(security-officer|so)
 ^releng/6.[0-4]/		(security-officer|so)
 ^releng/5.[0-5]/		(security-officer|so)

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 15:09:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1B93106566C;
	Wed, 28 Oct 2009 15:09:21 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E00DB8FC12;
	Wed, 28 Oct 2009 15:09:21 +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 n9SF9L3E064700;
	Wed, 28 Oct 2009 15:09:21 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SF9Li2064698;
	Wed, 28 Oct 2009 15:09:21 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910281509.n9SF9Li2064698@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 15:09:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198545 - in stable/7/sys: . contrib/pf dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 15:09:22 -0000

Author: emaste
Date: Wed Oct 28 15:09:21 2009
New Revision: 198545
URL: http://svn.freebsd.org/changeset/base/198545

Log:
  MFC r185376:
  
    Remove duplicate 2610SA entry.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/aac/aac_pci.c

Modified: stable/7/sys/dev/aac/aac_pci.c
==============================================================================
--- stable/7/sys/dev/aac/aac_pci.c	Wed Oct 28 15:01:18 2009	(r198544)
+++ stable/7/sys/dev/aac/aac_pci.c	Wed Oct 28 15:09:21 2009	(r198545)
@@ -168,8 +168,6 @@ struct aac_ident
 	 "ICP ICP9014RO SCSI RAID"},
 	{0x9005, 0x0285, 0x9005, 0x0294, AAC_HWIF_I960RX, 0,
 	 "Adaptec SATA RAID 2026ZCR"},
-	{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, 0,
-	 "Adaptec SATA RAID 2610SA"},
 	{0x9005, 0x0285, 0x9005, 0x0296, AAC_HWIF_I960RX, 0,
 	 "Adaptec SCSI RAID 2240S"},
 	{0x9005, 0x0285, 0x9005, 0x0297, AAC_HWIF_I960RX, 0,

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 15:22:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F9CF10656A4;
	Wed, 28 Oct 2009 15:22:59 +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 0EFA88FC1A;
	Wed, 28 Oct 2009 15:22: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 n9SFMwYT065066;
	Wed, 28 Oct 2009 15:22:58 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SFMwKF065064;
	Wed, 28 Oct 2009 15:22:58 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281522.n9SFMwKF065064@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 15:22: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: r198546 - head/sys/dev/amr
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 15:22:59 -0000

Author: brueffer
Date: Wed Oct 28 15:22:58 2009
New Revision: 198546
URL: http://svn.freebsd.org/changeset/base/198546

Log:
  Remove spurious `)`
  
  PR:		137758
  Submitted by:	Henning Petersen 
  MFC after:	1 week

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

Modified: head/sys/dev/amr/amr.c
==============================================================================
--- head/sys/dev/amr/amr.c	Wed Oct 28 15:09:21 2009	(r198545)
+++ head/sys/dev/amr/amr.c	Wed Oct 28 15:22:58 2009	(r198546)
@@ -225,7 +225,7 @@ amr_attach(struct amr_softc *sc)
     }
 
 #ifdef AMR_BOARD_INIT
-    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc))))
+    if ((AMR_IS_QUARTZ(sc) ? amr_quartz_init(sc) : amr_std_init(sc)))
 	return(ENXIO);
 #endif
 

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 15:36:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E01E51065676;
	Wed, 28 Oct 2009 15:36:55 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE75C8FC1B;
	Wed, 28 Oct 2009 15:36: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 n9SFat5Q065381;
	Wed, 28 Oct 2009 15:36:55 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SFatZu065379;
	Wed, 28 Oct 2009 15:36:55 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910281536.n9SFatZu065379@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 15:36:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198547 - in stable/6/sys: . conf contrib/pf dev/aac
	dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 15:36:56 -0000

Author: emaste
Date: Wed Oct 28 15:36:55 2009
New Revision: 198547
URL: http://svn.freebsd.org/changeset/base/198547

Log:
  MFC r185376:
  
    Remove duplicate 2610SA entry.

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/contrib/pf/   (props changed)
  stable/6/sys/dev/aac/aac_pci.c
  stable/6/sys/dev/cxgb/   (props changed)

Modified: stable/6/sys/dev/aac/aac_pci.c
==============================================================================
--- stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 15:22:58 2009	(r198546)
+++ stable/6/sys/dev/aac/aac_pci.c	Wed Oct 28 15:36:55 2009	(r198547)
@@ -168,8 +168,6 @@ struct aac_ident
 	 "ICP ICP9014RO SCSI RAID"},
 	{0x9005, 0x0285, 0x9005, 0x0294, AAC_HWIF_I960RX, 0,
 	 "Adaptec SATA RAID 2026ZCR"},
-	{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, 0,
-	 "Adaptec SATA RAID 2610SA"},
 	{0x9005, 0x0285, 0x9005, 0x0296, AAC_HWIF_I960RX, 0,
 	 "Adaptec SCSI RAID 2240S"},
 	{0x9005, 0x0285, 0x9005, 0x0297, AAC_HWIF_I960RX, 0,

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 15:58:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ADE5E106568F;
	Wed, 28 Oct 2009 15:58:15 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9C8418FC0A;
	Wed, 28 Oct 2009 15:58: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 n9SFwF5A065849;
	Wed, 28 Oct 2009 15:58:15 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SFwFQh065847;
	Wed, 28 Oct 2009 15:58:15 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910281558.n9SFwFQh065847@svn.freebsd.org>
From: Ed Maste 
Date: Wed, 28 Oct 2009 15:58:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198548 - stable/6/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 15:58:15 -0000

Author: emaste
Date: Wed Oct 28 15:58:15 2009
New Revision: 198548
URL: http://svn.freebsd.org/changeset/base/198548

Log:
  Replace callout_schedule (which doesn't exist on 6.x) with callout_reset.

Modified:
  stable/6/sys/dev/aac/aac.c

Modified: stable/6/sys/dev/aac/aac.c
==============================================================================
--- stable/6/sys/dev/aac/aac.c	Wed Oct 28 15:36:55 2009	(r198547)
+++ stable/6/sys/dev/aac/aac.c	Wed Oct 28 15:58:15 2009	(r198548)
@@ -378,7 +378,7 @@ aac_daemon(void *arg)
 	*(uint32_t *)fib->data = tv.tv_sec;
 	aac_sync_fib(sc, SendHostTime, 0, fib, sizeof(uint32_t));
 	aac_release_sync_fib(sc);
-	callout_schedule(&sc->aac_daemontime, 30 * 60 * hz);
+	callout_reset(&sc->aac_daemontime, 30 * 60 * hz, aac_daemon, sc);
 }
 
 void

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 16:54:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E2C071065676;
	Wed, 28 Oct 2009 16:54:48 +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 D16248FC2B;
	Wed, 28 Oct 2009 16:54: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 n9SGsmDs066968;
	Wed, 28 Oct 2009 16:54:48 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SGsmW3066966;
	Wed, 28 Oct 2009 16:54:48 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281654.n9SGsmW3066966@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 16:54:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198549 - stable/8/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 16:54:49 -0000

Author: brueffer
Date: Wed Oct 28 16:54:48 2009
New Revision: 198549
URL: http://svn.freebsd.org/changeset/base/198549

Log:
  MFC: r198313
  
  Improve the description of the malofw kernel module installation.

Modified:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/malo.4

Modified: stable/8/share/man/man4/malo.4
==============================================================================
--- stable/8/share/man/man4/malo.4	Wed Oct 28 15:58:15 2009	(r198548)
+++ stable/8/share/man/man4/malo.4	Wed Oct 28 16:54:48 2009	(r198549)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"/
-.Dd March 26, 2009
+.Dd October 21, 2009
 .Dt MALO 4
 .Os
 .Sh NAME
@@ -71,14 +71,19 @@ For more information on configuring this
 .Pp
 This driver requires the
 .Nm malofw
-be installed before it will work.
+firmware kernel module be installed before it will work.
 The firmware files are not publicly available.
-A package of the firmware which can be installed via
-.Xr pkg_add 1
-with:
+A port of the firmware can be found at:
 .Bd -literal -offset indent
 http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz
 .Ed
+.Pp
+The firmware kernel module can be installed by extracting
+the archive and running
+.Ql make install clean
+in the
+.Pa malo-firmware-1.4
+directory.
 .Sh HARDWARE
 The following cards are among those supported by the
 .Nm

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 17:41:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9CAF5106568D;
	Wed, 28 Oct 2009 17:41:29 +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 8B5488FC21;
	Wed, 28 Oct 2009 17:41: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 n9SHfTQN067942;
	Wed, 28 Oct 2009 17:41:29 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SHfTCR067940;
	Wed, 28 Oct 2009 17:41:29 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281741.n9SHfTCR067940@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 17:41:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198551 - stable/7/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 17:41:29 -0000

Author: brueffer
Date: Wed Oct 28 17:41:29 2009
New Revision: 198551
URL: http://svn.freebsd.org/changeset/base/198551

Log:
  MFC: r198313
  
  Improve the description of the malofw kernel module installation.

Modified:
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man4/malo.4

Modified: stable/7/share/man/man4/malo.4
==============================================================================
--- stable/7/share/man/man4/malo.4	Wed Oct 28 17:03:20 2009	(r198550)
+++ stable/7/share/man/man4/malo.4	Wed Oct 28 17:41:29 2009	(r198551)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"/
-.Dd March 26, 2009
+.Dd October 21, 2009
 .Dt MALO 4
 .Os
 .Sh NAME
@@ -69,25 +69,21 @@ The
 driver provides support for Marvell Libertas 88W8335 based PCI
 network adapters.
 .Pp
-This driver requires firmware to be loaded before it will work.
-These firmware files are from the
-.Ox
-.Nm
-driver.
-.Pp
-A package for the firmware which can be installed via
-.Xr pkg_add 1
-can be found at:
+This driver requires the
+.Nm malofw
+firmware kernel module be installed before it will work.
+The firmware files are not publicly available.
+A port of the firmware can be found at:
 .Bd -literal -offset indent
 http://weongyo.org/project/malo/malo-firmware-1.4.tar.gz
 .Ed
 .Pp
-This package must be installed before
-.Xr ifconfig 8
-will work.
-.Pp 
-For more information on configuring this device, see
-.Xr ifconfig 8 .
+The firmware kernel module can be installed by extracting
+the archive and running
+.Ql make install clean
+in the
+.Pa malo-firmware-1.4
+directory.
 .Sh HARDWARE
 The following cards are among those supported by the
 .Nm

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 17:46:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CC2C3106568D;
	Wed, 28 Oct 2009 17:46:05 +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 A125E8FC19;
	Wed, 28 Oct 2009 17:46: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 n9SHk5cc068082;
	Wed, 28 Oct 2009 17:46:05 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SHk5Cx068079;
	Wed, 28 Oct 2009 17:46:05 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281746.n9SHk5Cx068079@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 17:46:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198552 - stable/8/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 17:46:05 -0000

Author: brueffer
Date: Wed Oct 28 17:46:05 2009
New Revision: 198552
URL: http://svn.freebsd.org/changeset/base/198552

Log:
  MFC: r198363
  
  List more dependencies for these drivers. While here, convert
  atapicam(4) to use our standard section 4 SYNOPSIS layout.

Modified:
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man4/atapicam.4
  stable/8/share/man/man4/umass.4

Modified: stable/8/share/man/man4/atapicam.4
==============================================================================
--- stable/8/share/man/man4/atapicam.4	Wed Oct 28 17:41:29 2009	(r198551)
+++ stable/8/share/man/man4/atapicam.4	Wed Oct 28 17:46:05 2009	(r198552)
@@ -27,14 +27,29 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 23, 2002
+.Dd October 22, 2009
 .Dt ATAPICAM 4
 .Os
 .Sh NAME
 .Nm atapicam
 .Nd CAM XPT (transport) module for ATAPI devices
 .Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device cam"
+.Cd "device ata"
 .Cd "device atapicam"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+atapicam_load="YES"
+.Ed
 .Sh DESCRIPTION
 The ATAPI/CAM module allows ATAPI devices (CD-ROM, CD-RW, DVD drives,
 floppy drives such as Iomega Zip, tape drives) to be accessed through

Modified: stable/8/share/man/man4/umass.4
==============================================================================
--- stable/8/share/man/man4/umass.4	Wed Oct 28 17:41:29 2009	(r198551)
+++ stable/8/share/man/man4/umass.4	Wed Oct 28 17:46:05 2009	(r198552)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 22, 2006
+.Dd October 22, 2009
 .Dt UMASS 4
 .Os
 .Sh NAME
@@ -38,6 +38,9 @@ To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device cam"
+.Cd "device usb"
 .Cd "device umass"
 .Ed
 .Pp

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 17:46:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 02BFF106566B;
	Wed, 28 Oct 2009 17:46:54 +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 CB7C58FC27;
	Wed, 28 Oct 2009 17:46: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 n9SHkqba068141;
	Wed, 28 Oct 2009 17:46:52 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SHkqBq068138;
	Wed, 28 Oct 2009 17:46:52 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910281746.n9SHkqBq068138@svn.freebsd.org>
From: Christian Brueffer 
Date: Wed, 28 Oct 2009 17:46:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198553 - stable/7/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 17:46:54 -0000

Author: brueffer
Date: Wed Oct 28 17:46:52 2009
New Revision: 198553
URL: http://svn.freebsd.org/changeset/base/198553

Log:
  MFC: r198363
  
  List more dependencies for these drivers. While here, convert
  atapicam(4) to use our standard section 4 SYNOPSIS layout.

Modified:
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man4/atapicam.4
  stable/7/share/man/man4/umass.4

Modified: stable/7/share/man/man4/atapicam.4
==============================================================================
--- stable/7/share/man/man4/atapicam.4	Wed Oct 28 17:46:05 2009	(r198552)
+++ stable/7/share/man/man4/atapicam.4	Wed Oct 28 17:46:52 2009	(r198553)
@@ -27,14 +27,29 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 23, 2002
+.Dd October 22, 2009
 .Dt ATAPICAM 4
 .Os
 .Sh NAME
 .Nm atapicam
 .Nd CAM XPT (transport) module for ATAPI devices
 .Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device cam"
+.Cd "device ata"
 .Cd "device atapicam"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+atapicam_load="YES"
+.Ed
 .Sh DESCRIPTION
 The ATAPI/CAM module allows ATAPI devices (CD-ROM, CD-RW, DVD drives,
 floppy drives such as Iomega Zip, tape drives) to be accessed through

Modified: stable/7/share/man/man4/umass.4
==============================================================================
--- stable/7/share/man/man4/umass.4	Wed Oct 28 17:46:05 2009	(r198552)
+++ stable/7/share/man/man4/umass.4	Wed Oct 28 17:46:52 2009	(r198553)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 22, 2006
+.Dd October 22, 2009
 .Dt UMASS 4
 .Os
 .Sh NAME
@@ -38,6 +38,9 @@ To compile this driver into the kernel,
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device scbus"
+.Cd "device cam"
+.Cd "device usb"
 .Cd "device umass"
 .Ed
 .Pp

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 20:17:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CBE72106568D;
	Wed, 28 Oct 2009 20:17:54 +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 B9F138FC22;
	Wed, 28 Oct 2009 20:17: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 n9SKHsUC070970;
	Wed, 28 Oct 2009 20:17:54 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SKHsSb070967;
	Wed, 28 Oct 2009 20:17:54 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910282017.n9SKHsSb070967@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 28 Oct 2009 20:17: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: r198554 - in head/sys: amd64/linux32 i386/linux
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 20:17:55 -0000

Author: jhb
Date: Wed Oct 28 20:17:54 2009
New Revision: 198554
URL: http://svn.freebsd.org/changeset/base/198554

Log:
  Fix some problems with effective mmap() offsets > 32 bits.  This was
  partially fixed on amd64 earlier.  Rather than forcing linux_mmap_common()
  to use a 32-bit offset, have it accept a 64-bit file offset.  This offset
  is then passed to the real mmap() call.  Rather than inventing a structure
  to hold the normal linux_mmap args that has a 64-bit offset, just pass
  each of the arguments individually to linux_mmap_common() since that more
  closes matches the existing style of various kern_foo() functions.
  
  Submitted by:	Christian Zander @ Nvidia
  MFC after:	1 week

Modified:
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/i386/linux/linux_machdep.c

Modified: head/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- head/sys/amd64/linux32/linux32_machdep.c	Wed Oct 28 17:46:52 2009	(r198553)
+++ head/sys/amd64/linux32/linux32_machdep.c	Wed Oct 28 20:17:54 2009	(r198554)
@@ -91,6 +91,10 @@ linux_to_bsd_sigaltstack(int lsa)
 	return (bsa);
 }
 
+static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
+		    l_size_t len, l_int prot, l_int flags, l_int fd,
+		    l_loff_t pos);
+
 int
 bsd_to_linux_sigaltstack(int bsa)
 {
@@ -759,12 +763,9 @@ linux_clone(struct thread *td, struct li
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
 
-static int linux_mmap_common(struct thread *, struct l_mmap_argv *);
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-	struct l_mmap_argv linux_args;
 
 #ifdef DEBUG
 	if (ldebug(mmap2))
@@ -773,14 +774,9 @@ linux_mmap2(struct thread *td, struct li
 		    args->flags, args->fd, args->pgoff);
 #endif
 
-	linux_args.addr = PTROUT(args->addr);
-	linux_args.len = args->len;
-	linux_args.prot = args->prot;
-	linux_args.flags = args->flags;
-	linux_args.fd = args->fd;
-	linux_args.pgoff = args->pgoff;
-
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot,
+		args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
+		PAGE_SIZE));
 }
 
 int
@@ -799,15 +795,15 @@ linux_mmap(struct thread *td, struct lin
 		    linux_args.addr, linux_args.len, linux_args.prot,
 		    linux_args.flags, linux_args.fd, linux_args.pgoff);
 #endif
-	if ((linux_args.pgoff % PAGE_SIZE) != 0)
-		return (EINVAL);
-	linux_args.pgoff /= PAGE_SIZE;
 
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, linux_args.addr, linux_args.len,
+	    linux_args.prot, linux_args.flags, linux_args.fd,
+	    (uint32_t)linux_args.pgoff));
 }
 
 static int
-linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
+linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
+    l_int flags, l_int fd, l_loff_t pos)
 {
 	struct proc *p = td->td_proc;
 	struct mmap_args /* {
@@ -830,21 +826,20 @@ linux_mmap_common(struct thread *td, str
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */
-	if (! ((linux_args->flags & LINUX_MAP_SHARED) ^
-	    (linux_args->flags & LINUX_MAP_PRIVATE)))
+	if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE)))
 		return (EINVAL);
 
-	if (linux_args->flags & LINUX_MAP_SHARED)
+	if (flags & LINUX_MAP_SHARED)
 		bsd_args.flags |= MAP_SHARED;
-	if (linux_args->flags & LINUX_MAP_PRIVATE)
+	if (flags & LINUX_MAP_PRIVATE)
 		bsd_args.flags |= MAP_PRIVATE;
-	if (linux_args->flags & LINUX_MAP_FIXED)
+	if (flags & LINUX_MAP_FIXED)
 		bsd_args.flags |= MAP_FIXED;
-	if (linux_args->flags & LINUX_MAP_ANON)
+	if (flags & LINUX_MAP_ANON)
 		bsd_args.flags |= MAP_ANON;
 	else
 		bsd_args.flags |= MAP_NOSYNC;
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN)
+	if (flags & LINUX_MAP_GROWSDOWN)
 		bsd_args.flags |= MAP_STACK;
 
 	/*
@@ -852,12 +847,12 @@ linux_mmap_common(struct thread *td, str
 	 * on Linux/i386. We do this to ensure maximum compatibility.
 	 * Linux/ia64 does the same in i386 emulation mode.
 	 */
-	bsd_args.prot = linux_args->prot;
+	bsd_args.prot = prot;
 	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
 		bsd_args.prot |= PROT_READ | PROT_EXEC;
 
 	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd;
+	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd;
 	if (bsd_args.fd != -1) {
 		/*
 		 * Linux follows Solaris mmap(2) description:
@@ -882,7 +877,7 @@ linux_mmap_common(struct thread *td, str
 		fdrop(fp, td);
 	}
 
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
+	if (flags & LINUX_MAP_GROWSDOWN) {
 		/*
 		 * The Linux MAP_GROWSDOWN option does not limit auto
 		 * growth of the region.  Linux mmap with this option
@@ -905,8 +900,7 @@ linux_mmap_common(struct thread *td, str
 		 * fixed size of (STACK_SIZE - GUARD_SIZE).
 		 */
 
-		if ((caddr_t)PTRIN(linux_args->addr) + linux_args->len >
-		    p->p_vmspace->vm_maxsaddr) {
+		if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) {
 			/*
 			 * Some Linux apps will attempt to mmap
 			 * thread stacks near the top of their
@@ -937,19 +931,19 @@ linux_mmap_common(struct thread *td, str
 		 * we map the full stack, since we don't have a way
 		 * to autogrow it.
 		 */
-		if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-			bsd_args.len = linux_args->len;
+		if (len > STACK_SIZE - GUARD_SIZE) {
+			bsd_args.addr = (caddr_t)PTRIN(addr);
+			bsd_args.len = len;
 		} else {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
-			    (STACK_SIZE - GUARD_SIZE - linux_args->len);
+			bsd_args.addr = (caddr_t)PTRIN(addr) -
+			    (STACK_SIZE - GUARD_SIZE - len);
 			bsd_args.len = STACK_SIZE - GUARD_SIZE;
 		}
 	} else {
-		bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-		bsd_args.len  = linux_args->len;
+		bsd_args.addr = (caddr_t)PTRIN(addr);
+		bsd_args.len  = len;
 	}
-	bsd_args.pos = (off_t)linux_args->pgoff * PAGE_SIZE;
+	bsd_args.pos = pos;
 
 #ifdef DEBUG
 	if (ldebug(mmap))

Modified: head/sys/i386/linux/linux_machdep.c
==============================================================================
--- head/sys/i386/linux/linux_machdep.c	Wed Oct 28 17:46:52 2009	(r198553)
+++ head/sys/i386/linux/linux_machdep.c	Wed Oct 28 20:17:54 2009	(r198554)
@@ -93,6 +93,10 @@ struct l_old_select_argv {
 	struct l_timeval	*timeout;
 };
 
+static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
+		    l_size_t len, l_int prot, l_int flags, l_int fd,
+		    l_loff_t pos);
+
 int
 linux_to_bsd_sigaltstack(int lsa)
 {
@@ -591,12 +595,9 @@ linux_clone(struct thread *td, struct li
 #define STACK_SIZE  (2 * 1024 * 1024)
 #define GUARD_SIZE  (4 * PAGE_SIZE)
 
-static int linux_mmap_common(struct thread *, struct l_mmap_argv *);
-
 int
 linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
 {
-	struct l_mmap_argv linux_args;
 
 #ifdef DEBUG
 	if (ldebug(mmap2))
@@ -605,14 +606,9 @@ linux_mmap2(struct thread *td, struct li
 		    args->flags, args->fd, args->pgoff);
 #endif
 
-	linux_args.addr = args->addr;
-	linux_args.len = args->len;
-	linux_args.prot = args->prot;
-	linux_args.flags = args->flags;
-	linux_args.fd = args->fd;
-	linux_args.pgoff = args->pgoff * PAGE_SIZE;
-
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, args->addr, args->len, args->prot,
+		args->flags, args->fd, (uint64_t)(uint32_t)args->pgoff *
+		PAGE_SIZE));
 }
 
 int
@@ -632,11 +628,14 @@ linux_mmap(struct thread *td, struct lin
 		    linux_args.flags, linux_args.fd, linux_args.pgoff);
 #endif
 
-	return (linux_mmap_common(td, &linux_args));
+	return (linux_mmap_common(td, linux_args.addr, linux_args.len,
+	    linux_args.prot, linux_args.flags, linux_args.fd,
+	    (uint32_t)linux_args.pgoff));
 }
 
 static int
-linux_mmap_common(struct thread *td, struct l_mmap_argv *linux_args)
+linux_mmap_common(struct thread *td, l_uintptr_t addr, l_size_t len, l_int prot,
+    l_int flags, l_int fd, l_loff_t pos)
 {
 	struct proc *p = td->td_proc;
 	struct mmap_args /* {
@@ -659,21 +658,20 @@ linux_mmap_common(struct thread *td, str
 	 * Linux mmap(2):
 	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
 	 */
-	if (! ((linux_args->flags & LINUX_MAP_SHARED) ^
-	    (linux_args->flags & LINUX_MAP_PRIVATE)))
+	if (!((flags & LINUX_MAP_SHARED) ^ (flags & LINUX_MAP_PRIVATE)))
 		return (EINVAL);
 
-	if (linux_args->flags & LINUX_MAP_SHARED)
+	if (flags & LINUX_MAP_SHARED)
 		bsd_args.flags |= MAP_SHARED;
-	if (linux_args->flags & LINUX_MAP_PRIVATE)
+	if (flags & LINUX_MAP_PRIVATE)
 		bsd_args.flags |= MAP_PRIVATE;
-	if (linux_args->flags & LINUX_MAP_FIXED)
+	if (flags & LINUX_MAP_FIXED)
 		bsd_args.flags |= MAP_FIXED;
-	if (linux_args->flags & LINUX_MAP_ANON)
+	if (flags & LINUX_MAP_ANON)
 		bsd_args.flags |= MAP_ANON;
 	else
 		bsd_args.flags |= MAP_NOSYNC;
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN)
+	if (flags & LINUX_MAP_GROWSDOWN)
 		bsd_args.flags |= MAP_STACK;
 
 	/*
@@ -681,12 +679,12 @@ linux_mmap_common(struct thread *td, str
 	 * on Linux/i386. We do this to ensure maximum compatibility.
 	 * Linux/ia64 does the same in i386 emulation mode.
 	 */
-	bsd_args.prot = linux_args->prot;
+	bsd_args.prot = prot;
 	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
 		bsd_args.prot |= PROT_READ | PROT_EXEC;
 
 	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
-	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : linux_args->fd;
+	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : fd;
 	if (bsd_args.fd != -1) {
 		/*
 		 * Linux follows Solaris mmap(2) description:
@@ -711,9 +709,9 @@ linux_mmap_common(struct thread *td, str
 		fdrop(fp, td);
 	}
 
-	if (linux_args->flags & LINUX_MAP_GROWSDOWN) {
+	if (flags & LINUX_MAP_GROWSDOWN) {
 		/* 
-		 * The linux MAP_GROWSDOWN option does not limit auto
+		 * The Linux MAP_GROWSDOWN option does not limit auto
 		 * growth of the region.  Linux mmap with this option
 		 * takes as addr the inital BOS, and as len, the initial
 		 * region size.  It can then grow down from addr without
@@ -734,8 +732,7 @@ linux_mmap_common(struct thread *td, str
 		 * fixed size of (STACK_SIZE - GUARD_SIZE).
 		 */
 
-		if ((caddr_t)PTRIN(linux_args->addr) + linux_args->len >
-		    p->p_vmspace->vm_maxsaddr) {
+		if ((caddr_t)PTRIN(addr) + len > p->p_vmspace->vm_maxsaddr) {
 			/* 
 			 * Some linux apps will attempt to mmap
 			 * thread stacks near the top of their
@@ -766,19 +763,19 @@ linux_mmap_common(struct thread *td, str
 		 * we map the full stack, since we don't have a way
 		 * to autogrow it.
 		 */
-		if (linux_args->len > STACK_SIZE - GUARD_SIZE) {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-			bsd_args.len = linux_args->len;
+		if (len > STACK_SIZE - GUARD_SIZE) {
+			bsd_args.addr = (caddr_t)PTRIN(addr);
+			bsd_args.len = len;
 		} else {
-			bsd_args.addr = (caddr_t)PTRIN(linux_args->addr) -
-			    (STACK_SIZE - GUARD_SIZE - linux_args->len);
+			bsd_args.addr = (caddr_t)PTRIN(addr) -
+			    (STACK_SIZE - GUARD_SIZE - len);
 			bsd_args.len = STACK_SIZE - GUARD_SIZE;
 		}
 	} else {
-		bsd_args.addr = (caddr_t)PTRIN(linux_args->addr);
-		bsd_args.len  = linux_args->len;
+		bsd_args.addr = (caddr_t)PTRIN(addr);
+		bsd_args.len  = len;
 	}
-	bsd_args.pos = linux_args->pgoff;
+	bsd_args.pos = pos;
 
 #ifdef DEBUG
 	if (ldebug(mmap))

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:07:43 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EE6811065692;
	Wed, 28 Oct 2009 21:07:42 +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 DB7AA8FC0C;
	Wed, 28 Oct 2009 21:07: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 n9SL7gdO071983;
	Wed, 28 Oct 2009 21:07:42 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SL7gtp071979;
	Wed, 28 Oct 2009 21:07:42 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910282107.n9SL7gtp071979@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 28 Oct 2009 21:07:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198555 - stable/8/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:07:43 -0000

Author: edwin
Date: Wed Oct 28 21:07:42 2009
New Revision: 198555
URL: http://svn.freebsd.org/changeset/base/198555

Log:
  MFC of r197597, r198270, r198515:
  
  MFC of tzdata2009n:
  - Pakistan will go out DST on 1 October.
  - Headsup for changes in Argentina.
  
  MFC of tzdata2009o:
  - Somoa has not moved to DST this year (comment only)
  - Bangladesh stays on DST for now.
  - Pakistan went back to standard time in 1 October 2009
  
  MFC of tzdata2009p:
  - Argentina does not go to DST this year.
  
  Approved by:	re (Ken Smith)

Modified:
  stable/8/share/zoneinfo/   (props changed)
  stable/8/share/zoneinfo/asia
  stable/8/share/zoneinfo/australasia
  stable/8/share/zoneinfo/southamerica

Modified: stable/8/share/zoneinfo/asia
==============================================================================
--- stable/8/share/zoneinfo/asia	Wed Oct 28 20:17:54 2009	(r198554)
+++ stable/8/share/zoneinfo/asia	Wed Oct 28 21:07:42 2009	(r198555)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.40
+# @(#)asia	8.42
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,11 +172,30 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
-# From Arthur David Olson (2009-07-11):
-# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
-# can appear in the Dhaka binary file and for the benefit of old glibc
-# reimplementations of the time zone software that mishandle permanent DST.
-# A change will be required once the end date is known.
+# From Alexander Krivenyshev (2009-09-25):
+# Bangladesh won't go back to Standard Time from October 1, 2009, 
+# instead it will continue DST measure till the cabinet makes a fresh decision. 
+#
+# Following report by same newspaper-"The Daily Star Friday":
+# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1"
+# 
+# http://www.thedailystar.net/newDesign/news-details.php?nid=107021
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html
+# 
+
+# From Steffen Thorsen (2009-10-13):
+# IANS (Indo-Asian News Service) now reports:
+# Bangladesh has decided that the clock advanced by an hour to make 
+# maximum use of daylight hours as an energy saving measure would 
+# "continue for an indefinite period."
+#
+# One of many places where it is published:
+# 
+# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
+# 
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
@@ -186,8 +205,7 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST	2010
-			6:00	-	BDT
+			6:00	1:00	BDST
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1674,16 +1692,66 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # advance clocks in the country by one hour from April 15 to
 # conserve energy"
 
-# From Arthur David Olson (2009-04-10):
-# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+# From Steffen Thorsen (2009-09-17):
+# "The News International," Pakistan reports that: "The Federal
+# Government has decided to restore the previous time by moving the
+# clocks backward by one hour from October 1. A formal announcement to
+# this effect will be made after the Prime Minister grants approval in
+# this regard." 
+# 
+# http://www.thenews.com.pk/updates.asp?id=87168
+# 
+
+# From Alexander Krivenyshev (2009-09-28):
+# According to Associated Press Of Pakistan, it is confirmed that
+# Pakistan clocks across the country would be turned back by an hour from October
+# 1, 2009.
+#
+# "Clocks to go back one hour from 1 Oct"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=86715&Itemid=2
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan07.htm
+# 
+
+# From Steffen Thorsen (2009-09-29):
+# Alexander Krivenyshev wrote:
+# > According to Associated Press Of Pakistan, it is confirmed that
+# > Pakistan clocks across the country would be turned back by an hour from October
+# > 1, 2009.
+#
+# Now they seem to have changed their mind, November 1 is the new date:
+# 
+# http://www.thenews.com.pk/top_story_detail.asp?Id=24742
+# 
+# "The country's clocks will be reversed by one hour on November 1.
+# Officials of Federal Ministry for Interior told this to Geo News on
+# Monday."
+#
+# And more importantly, it seems that these dates will be kept every year:
+# "It has now been decided that clocks will be wound forward by one hour
+# on April 15 and reversed by an hour on November 1 every year without
+# obtaining prior approval, the officials added."
+#
+# We have confirmed this year's end date with both with the Ministry of
+# Water and Power and the Pakistan Electric Power Company:
+# 
+# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# 
+
+# From Christoph Goehre (2009-10-01):
+# [T]he German Consulate General in Karachi reported me today that Pakistan
+# will go back to standard time on 1st of November.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: stable/8/share/zoneinfo/australasia
==============================================================================
--- stable/8/share/zoneinfo/australasia	Wed Oct 28 20:17:54 2009	(r198554)
+++ stable/8/share/zoneinfo/australasia	Wed Oct 28 21:07:42 2009	(r198555)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.13
+# @(#)australasia	8.14
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -457,6 +457,36 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 # 
 
+# From Alexander Krivenyshev (2009-10-03):
+# First, my deepest condolences to people of Samoa islands and all families and
+# loved ones around the world who lost their lives in the earthquake and tsunami.
+#
+# Considering the recent devastation on Samoa by earthquake and tsunami and that
+# many government offices/ ministers are closed- not sure if "Daylight Saving
+# Bill 2009" will be implemented in next few days- on October 4, 2009.
+#
+# Here is reply from Consulate-General of Samoa in New Zealand
+# ---------------------------
+# Consul General
+# consulgeneral@samoaconsulate.org.nz
+#
+# Talofa Alexander,
+#
+# Thank you for your sympathy for our country but at this time we have not
+# been informed about the Daylight Savings Time Change.  Most Ministries in
+# Apia are closed or relocating due to weather concerns.
+#
+# When we do find out if they are still proceeding with the time change we
+# will advise you soonest.
+#
+# Kind Regards,
+# Lana
+# for: Consul General
+
+# From Steffen Thorsen (2009-10-05):
+# We have called a hotel in Samoa and asked about local time there - they 
+# are still on standard time.
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

Modified: stable/8/share/zoneinfo/southamerica
==============================================================================
--- stable/8/share/zoneinfo/southamerica	Wed Oct 28 20:17:54 2009	(r198554)
+++ stable/8/share/zoneinfo/southamerica	Wed Oct 28 21:07:42 2009	(r198555)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.36
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,15 +403,40 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
 #
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Buenos Aires (BA), Capital Federal (CF),
@@ -530,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -544,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:08:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D3692106568D;
	Wed, 28 Oct 2009 21:08:20 +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 A96C38FC18;
	Wed, 28 Oct 2009 21:08: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 n9SL8Kdx072031;
	Wed, 28 Oct 2009 21:08:20 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SL8KG9072030;
	Wed, 28 Oct 2009 21:08:20 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910282108.n9SL8KG9072030@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 28 Oct 2009 21:08:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198556 - stable/8/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:08:20 -0000

Author: jhb
Date: Wed Oct 28 21:08:20 2009
New Revision: 198556
URL: http://svn.freebsd.org/changeset/base/198556

Log:
  MFC: Remove spurious README and an old version of the manpage.

Deleted:
  stable/8/usr.sbin/mfiutil/README
  stable/8/usr.sbin/mfiutil/mfiutil.1

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:11:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2A946106566B;
	Wed, 28 Oct 2009 21:11:14 +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 008378FC22;
	Wed, 28 Oct 2009 21:11: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 n9SLBDd1072265;
	Wed, 28 Oct 2009 21:11:13 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLBDaY072264;
	Wed, 28 Oct 2009 21:11:13 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910282111.n9SLBDaY072264@svn.freebsd.org>
From: John Baldwin 
Date: Wed, 28 Oct 2009 21:11:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198557 - releng/8.0/usr.sbin/mfiutil
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:11:14 -0000

Author: jhb
Date: Wed Oct 28 21:11:13 2009
New Revision: 198557
URL: http://svn.freebsd.org/changeset/base/198557

Log:
  MFC: Remove spurious README and an old version of the manpage.
  
  Approved by:	re (kib)

Deleted:
  releng/8.0/usr.sbin/mfiutil/README
  releng/8.0/usr.sbin/mfiutil/mfiutil.1

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:12:35 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B3CD106568B;
	Wed, 28 Oct 2009 21:12:35 +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 08DB68FC08;
	Wed, 28 Oct 2009 21:12: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 n9SLCYBK072335;
	Wed, 28 Oct 2009 21:12:34 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLCYnq072331;
	Wed, 28 Oct 2009 21:12:34 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910282112.n9SLCYnq072331@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 28 Oct 2009 21:12:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198558 - releng/8.0/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:12:35 -0000

Author: edwin
Date: Wed Oct 28 21:12:34 2009
New Revision: 198558
URL: http://svn.freebsd.org/changeset/base/198558

Log:
  MFC of r197597, r198270, r198515.
  
  MFC of tzdata2009n:
  - Pakistan will go out DST on 1 October.
  - Headsup for changes in Argentina.
  
  MFC of tzdata2009o:
  - Somoa has not moved to DST this year (comment only)
  - Bangladesh stays on DST for now.
  - Pakistan went back to standard time in 1 October 2009
  
  MFC of tzdata2009p:
  - Argentina does not go to DST this year.
  
  Approved by:	re (Ken Smith)

Modified:
  releng/8.0/share/zoneinfo/   (props changed)
  releng/8.0/share/zoneinfo/asia
  releng/8.0/share/zoneinfo/australasia
  releng/8.0/share/zoneinfo/southamerica

Modified: releng/8.0/share/zoneinfo/asia
==============================================================================
--- releng/8.0/share/zoneinfo/asia	Wed Oct 28 21:11:13 2009	(r198557)
+++ releng/8.0/share/zoneinfo/asia	Wed Oct 28 21:12:34 2009	(r198558)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.40
+# @(#)asia	8.42
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,11 +172,30 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
-# From Arthur David Olson (2009-07-11):
-# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
-# can appear in the Dhaka binary file and for the benefit of old glibc
-# reimplementations of the time zone software that mishandle permanent DST.
-# A change will be required once the end date is known.
+# From Alexander Krivenyshev (2009-09-25):
+# Bangladesh won't go back to Standard Time from October 1, 2009, 
+# instead it will continue DST measure till the cabinet makes a fresh decision. 
+#
+# Following report by same newspaper-"The Daily Star Friday":
+# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1"
+# 
+# http://www.thedailystar.net/newDesign/news-details.php?nid=107021
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html
+# 
+
+# From Steffen Thorsen (2009-10-13):
+# IANS (Indo-Asian News Service) now reports:
+# Bangladesh has decided that the clock advanced by an hour to make 
+# maximum use of daylight hours as an energy saving measure would 
+# "continue for an indefinite period."
+#
+# One of many places where it is published:
+# 
+# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
+# 
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
@@ -186,8 +205,7 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST	2010
-			6:00	-	BDT
+			6:00	1:00	BDST
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1674,16 +1692,66 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # advance clocks in the country by one hour from April 15 to
 # conserve energy"
 
-# From Arthur David Olson (2009-04-10):
-# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+# From Steffen Thorsen (2009-09-17):
+# "The News International," Pakistan reports that: "The Federal
+# Government has decided to restore the previous time by moving the
+# clocks backward by one hour from October 1. A formal announcement to
+# this effect will be made after the Prime Minister grants approval in
+# this regard." 
+# 
+# http://www.thenews.com.pk/updates.asp?id=87168
+# 
+
+# From Alexander Krivenyshev (2009-09-28):
+# According to Associated Press Of Pakistan, it is confirmed that
+# Pakistan clocks across the country would be turned back by an hour from October
+# 1, 2009.
+#
+# "Clocks to go back one hour from 1 Oct"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=86715&Itemid=2
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan07.htm
+# 
+
+# From Steffen Thorsen (2009-09-29):
+# Alexander Krivenyshev wrote:
+# > According to Associated Press Of Pakistan, it is confirmed that
+# > Pakistan clocks across the country would be turned back by an hour from October
+# > 1, 2009.
+#
+# Now they seem to have changed their mind, November 1 is the new date:
+# 
+# http://www.thenews.com.pk/top_story_detail.asp?Id=24742
+# 
+# "The country's clocks will be reversed by one hour on November 1.
+# Officials of Federal Ministry for Interior told this to Geo News on
+# Monday."
+#
+# And more importantly, it seems that these dates will be kept every year:
+# "It has now been decided that clocks will be wound forward by one hour
+# on April 15 and reversed by an hour on November 1 every year without
+# obtaining prior approval, the officials added."
+#
+# We have confirmed this year's end date with both with the Ministry of
+# Water and Power and the Pakistan Electric Power Company:
+# 
+# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# 
+
+# From Christoph Goehre (2009-10-01):
+# [T]he German Consulate General in Karachi reported me today that Pakistan
+# will go back to standard time on 1st of November.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: releng/8.0/share/zoneinfo/australasia
==============================================================================
--- releng/8.0/share/zoneinfo/australasia	Wed Oct 28 21:11:13 2009	(r198557)
+++ releng/8.0/share/zoneinfo/australasia	Wed Oct 28 21:12:34 2009	(r198558)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.13
+# @(#)australasia	8.14
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -457,6 +457,36 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 # 
 
+# From Alexander Krivenyshev (2009-10-03):
+# First, my deepest condolences to people of Samoa islands and all families and
+# loved ones around the world who lost their lives in the earthquake and tsunami.
+#
+# Considering the recent devastation on Samoa by earthquake and tsunami and that
+# many government offices/ ministers are closed- not sure if "Daylight Saving
+# Bill 2009" will be implemented in next few days- on October 4, 2009.
+#
+# Here is reply from Consulate-General of Samoa in New Zealand
+# ---------------------------
+# Consul General
+# consulgeneral@samoaconsulate.org.nz
+#
+# Talofa Alexander,
+#
+# Thank you for your sympathy for our country but at this time we have not
+# been informed about the Daylight Savings Time Change.  Most Ministries in
+# Apia are closed or relocating due to weather concerns.
+#
+# When we do find out if they are still proceeding with the time change we
+# will advise you soonest.
+#
+# Kind Regards,
+# Lana
+# for: Consul General
+
+# From Steffen Thorsen (2009-10-05):
+# We have called a hotel in Samoa and asked about local time there - they 
+# are still on standard time.
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

Modified: releng/8.0/share/zoneinfo/southamerica
==============================================================================
--- releng/8.0/share/zoneinfo/southamerica	Wed Oct 28 21:11:13 2009	(r198557)
+++ releng/8.0/share/zoneinfo/southamerica	Wed Oct 28 21:12:34 2009	(r198558)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.36
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,15 +403,40 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
 #
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Buenos Aires (BA), Capital Federal (CF),
@@ -530,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -544,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:13:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3FE951065676;
	Wed, 28 Oct 2009 21:13:13 +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 2CACE8FC29;
	Wed, 28 Oct 2009 21:13: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 n9SLDDEY072388;
	Wed, 28 Oct 2009 21:13:13 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLDDun072384;
	Wed, 28 Oct 2009 21:13:13 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910282113.n9SLDDun072384@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 28 Oct 2009 21:13:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198559 - stable/7/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:13:13 -0000

Author: edwin
Date: Wed Oct 28 21:13:12 2009
New Revision: 198559
URL: http://svn.freebsd.org/changeset/base/198559

Log:
  MFC of r198270, r198515.
  
  MFC of tzdata2009o:
  - Somoa has not moved to DST this year (comment only)
  - Bangladesh stays on DST for now.
  - Pakistan went back to standard time in 1 October 2009
  
  MFC of tzdata2009p:
  - Argentina does not go to DST this year.

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/asia
  stable/7/share/zoneinfo/australasia
  stable/7/share/zoneinfo/southamerica

Modified: stable/7/share/zoneinfo/asia
==============================================================================
--- stable/7/share/zoneinfo/asia	Wed Oct 28 21:12:34 2009	(r198558)
+++ stable/7/share/zoneinfo/asia	Wed Oct 28 21:13:12 2009	(r198559)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.41
+# @(#)asia	8.42
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,11 +172,30 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
-# From Arthur David Olson (2009-07-11):
-# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
-# can appear in the Dhaka binary file and for the benefit of old glibc
-# reimplementations of the time zone software that mishandle permanent DST.
-# A change will be required once the end date is known.
+# From Alexander Krivenyshev (2009-09-25):
+# Bangladesh won't go back to Standard Time from October 1, 2009, 
+# instead it will continue DST measure till the cabinet makes a fresh decision. 
+#
+# Following report by same newspaper-"The Daily Star Friday":
+# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1"
+# 
+# http://www.thedailystar.net/newDesign/news-details.php?nid=107021
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html
+# 
+
+# From Steffen Thorsen (2009-10-13):
+# IANS (Indo-Asian News Service) now reports:
+# Bangladesh has decided that the clock advanced by an hour to make 
+# maximum use of daylight hours as an energy saving measure would 
+# "continue for an indefinite period."
+#
+# One of many places where it is published:
+# 
+# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
+# 
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
@@ -186,8 +205,7 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST	2010
-			6:00	-	BDT
+			6:00	1:00	BDST
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1684,13 +1702,56 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # http://www.thenews.com.pk/updates.asp?id=87168
 # 
 
+# From Alexander Krivenyshev (2009-09-28):
+# According to Associated Press Of Pakistan, it is confirmed that
+# Pakistan clocks across the country would be turned back by an hour from October
+# 1, 2009.
+#
+# "Clocks to go back one hour from 1 Oct"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=86715&Itemid=2
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan07.htm
+# 
+
+# From Steffen Thorsen (2009-09-29):
+# Alexander Krivenyshev wrote:
+# > According to Associated Press Of Pakistan, it is confirmed that
+# > Pakistan clocks across the country would be turned back by an hour from October
+# > 1, 2009.
+#
+# Now they seem to have changed their mind, November 1 is the new date:
+# 
+# http://www.thenews.com.pk/top_story_detail.asp?Id=24742
+# 
+# "The country's clocks will be reversed by one hour on November 1.
+# Officials of Federal Ministry for Interior told this to Geo News on
+# Monday."
+#
+# And more importantly, it seems that these dates will be kept every year:
+# "It has now been decided that clocks will be wound forward by one hour
+# on April 15 and reversed by an hour on November 1 every year without
+# obtaining prior approval, the officials added."
+#
+# We have confirmed this year's end date with both with the Ministry of
+# Water and Power and the Pakistan Electric Power Company:
+# 
+# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# 
+
+# From Christoph Goehre (2009-10-01):
+# [T]he German Consulate General in Karachi reported me today that Pakistan
+# will go back to standard time on 1st of November.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	only	-	Oct	1	0:00	0	-
+Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Wed Oct 28 21:12:34 2009	(r198558)
+++ stable/7/share/zoneinfo/australasia	Wed Oct 28 21:13:12 2009	(r198559)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.13
+# @(#)australasia	8.14
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -457,6 +457,36 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 # 
 
+# From Alexander Krivenyshev (2009-10-03):
+# First, my deepest condolences to people of Samoa islands and all families and
+# loved ones around the world who lost their lives in the earthquake and tsunami.
+#
+# Considering the recent devastation on Samoa by earthquake and tsunami and that
+# many government offices/ ministers are closed- not sure if "Daylight Saving
+# Bill 2009" will be implemented in next few days- on October 4, 2009.
+#
+# Here is reply from Consulate-General of Samoa in New Zealand
+# ---------------------------
+# Consul General
+# consulgeneral@samoaconsulate.org.nz
+#
+# Talofa Alexander,
+#
+# Thank you for your sympathy for our country but at this time we have not
+# been informed about the Daylight Savings Time Change.  Most Ministries in
+# Apia are closed or relocating due to weather concerns.
+#
+# When we do find out if they are still proceeding with the time change we
+# will advise you soonest.
+#
+# Kind Regards,
+# Lana
+# for: Consul General
+
+# From Steffen Thorsen (2009-10-05):
+# We have called a hotel in Samoa and asked about local time there - they 
+# are still on standard time.
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

Modified: stable/7/share/zoneinfo/southamerica
==============================================================================
--- stable/7/share/zoneinfo/southamerica	Wed Oct 28 21:12:34 2009	(r198558)
+++ stable/7/share/zoneinfo/southamerica	Wed Oct 28 21:13:12 2009	(r198559)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.37
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,44 +403,39 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
-# From Alexander Krivenyshev (2009-09-19):
-# Some  Argentinian Provinces (Buenos Aires, Entre Ríos) are opposing to the
-# Daylight Saving Time for the 2009-2010 season.
-#
-# (Spanish)
-# "El cambio de huso horario en Entre Ríos deberá ser aprobado por la
-# Legislatura":
-# 
-# http://www.analisisdigital.com.ar/noticias.php?ed=1&di=0&no=110168
-# 
-# English translation - "The time zone change in Entre Rios must be approved by
-# the Legislature."
-#
-# (Spanish)
-# "Mar del Plata no quiere cambiar la hora."
-# 
-# http://www.mensajeroweb.com.ar/index.php?x=nota/33861/1/mar-del-plata-no-quiere-cambiar-la-hora
-# 
-# English translation - "Mar del Plata is not to change the time"
-#
-# or
-# (some English translation)
-# 
-# http://www.worldtimezone.com/dst_news/dst_news_argentina07.html
-# 
-
-# From Arthur David Olson (2009-09-22):
-# "Mar del Plata no quiere cambiar la hora" translates to
-# "Mar del Plata doesn't want to change the time"
-# (less definitive than "is not to").
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
+#
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -560,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -574,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:13:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B990106568B;
	Wed, 28 Oct 2009 21:13:58 +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 8849A8FC19;
	Wed, 28 Oct 2009 21:13: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 n9SLDw0c072444;
	Wed, 28 Oct 2009 21:13:58 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLDwx2072440;
	Wed, 28 Oct 2009 21:13:58 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910282113.n9SLDwx2072440@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 28 Oct 2009 21:13:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198560 - stable/6/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:13:58 -0000

Author: edwin
Date: Wed Oct 28 21:13:58 2009
New Revision: 198560
URL: http://svn.freebsd.org/changeset/base/198560

Log:
  MFC of r198270, r198515.
  
  MFC of tzdata2009o:
  - Somoa has not moved to DST this year (comment only)
  - Bangladesh stays on DST for now.
  - Pakistan went back to standard time in 1 October 2009
  
  MFC of tzdata2009p:
  - Argentina does not go to DST this year.

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/asia
  stable/6/share/zoneinfo/australasia
  stable/6/share/zoneinfo/southamerica

Modified: stable/6/share/zoneinfo/asia
==============================================================================
--- stable/6/share/zoneinfo/asia	Wed Oct 28 21:13:12 2009	(r198559)
+++ stable/6/share/zoneinfo/asia	Wed Oct 28 21:13:58 2009	(r198560)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.41
+# @(#)asia	8.42
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,11 +172,30 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
-# From Arthur David Olson (2009-07-11):
-# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
-# can appear in the Dhaka binary file and for the benefit of old glibc
-# reimplementations of the time zone software that mishandle permanent DST.
-# A change will be required once the end date is known.
+# From Alexander Krivenyshev (2009-09-25):
+# Bangladesh won't go back to Standard Time from October 1, 2009, 
+# instead it will continue DST measure till the cabinet makes a fresh decision. 
+#
+# Following report by same newspaper-"The Daily Star Friday":
+# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1"
+# 
+# http://www.thedailystar.net/newDesign/news-details.php?nid=107021
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html
+# 
+
+# From Steffen Thorsen (2009-10-13):
+# IANS (Indo-Asian News Service) now reports:
+# Bangladesh has decided that the clock advanced by an hour to make 
+# maximum use of daylight hours as an energy saving measure would 
+# "continue for an indefinite period."
+#
+# One of many places where it is published:
+# 
+# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
+# 
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
@@ -186,8 +205,7 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST	2010
-			6:00	-	BDT
+			6:00	1:00	BDST
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1684,13 +1702,56 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # http://www.thenews.com.pk/updates.asp?id=87168
 # 
 
+# From Alexander Krivenyshev (2009-09-28):
+# According to Associated Press Of Pakistan, it is confirmed that
+# Pakistan clocks across the country would be turned back by an hour from October
+# 1, 2009.
+#
+# "Clocks to go back one hour from 1 Oct"
+# 
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=86715&Itemid=2
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan07.htm
+# 
+
+# From Steffen Thorsen (2009-09-29):
+# Alexander Krivenyshev wrote:
+# > According to Associated Press Of Pakistan, it is confirmed that
+# > Pakistan clocks across the country would be turned back by an hour from October
+# > 1, 2009.
+#
+# Now they seem to have changed their mind, November 1 is the new date:
+# 
+# http://www.thenews.com.pk/top_story_detail.asp?Id=24742
+# 
+# "The country's clocks will be reversed by one hour on November 1.
+# Officials of Federal Ministry for Interior told this to Geo News on
+# Monday."
+#
+# And more importantly, it seems that these dates will be kept every year:
+# "It has now been decided that clocks will be wound forward by one hour
+# on April 15 and reversed by an hour on November 1 every year without
+# obtaining prior approval, the officials added."
+#
+# We have confirmed this year's end date with both with the Ministry of
+# Water and Power and the Pakistan Electric Power Company:
+# 
+# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
+# 
+
+# From Christoph Goehre (2009-10-01):
+# [T]he German Consulate General in Karachi reported me today that Pakistan
+# will go back to standard time on 1st of November.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	only	-	Oct	1	0:00	0	-
+Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: stable/6/share/zoneinfo/australasia
==============================================================================
--- stable/6/share/zoneinfo/australasia	Wed Oct 28 21:13:12 2009	(r198559)
+++ stable/6/share/zoneinfo/australasia	Wed Oct 28 21:13:58 2009	(r198560)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.13
+# @(#)australasia	8.14
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -457,6 +457,36 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 # http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
 # 
 
+# From Alexander Krivenyshev (2009-10-03):
+# First, my deepest condolences to people of Samoa islands and all families and
+# loved ones around the world who lost their lives in the earthquake and tsunami.
+#
+# Considering the recent devastation on Samoa by earthquake and tsunami and that
+# many government offices/ ministers are closed- not sure if "Daylight Saving
+# Bill 2009" will be implemented in next few days- on October 4, 2009.
+#
+# Here is reply from Consulate-General of Samoa in New Zealand
+# ---------------------------
+# Consul General
+# consulgeneral@samoaconsulate.org.nz
+#
+# Talofa Alexander,
+#
+# Thank you for your sympathy for our country but at this time we have not
+# been informed about the Daylight Savings Time Change.  Most Ministries in
+# Apia are closed or relocating due to weather concerns.
+#
+# When we do find out if they are still proceeding with the time change we
+# will advise you soonest.
+#
+# Kind Regards,
+# Lana
+# for: Consul General
+
+# From Steffen Thorsen (2009-10-05):
+# We have called a hotel in Samoa and asked about local time there - they 
+# are still on standard time.
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

Modified: stable/6/share/zoneinfo/southamerica
==============================================================================
--- stable/6/share/zoneinfo/southamerica	Wed Oct 28 21:13:12 2009	(r198559)
+++ stable/6/share/zoneinfo/southamerica	Wed Oct 28 21:13:58 2009	(r198560)
@@ -1,5 +1,5 @@
 # 
-# @(#)southamerica	8.37
+# @(#)southamerica	8.40
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -215,9 +215,23 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
 # 
 
+# From fullinet (2009-10-18):
+# As announced in
+# 
+# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
+# 
+# (an official .gob.ar) under title: "Sin Cambio de Hora" (english: "No hour change")
+#
+# "Por el momento, el Gobierno Nacional resolvio no modificar la hora
+# oficial, decision que estaba en estudio para su implementacion el
+# domingo 18 de octubre. Desde el Ministerio de Planificacion se anuncio
+# que la Argentina hoy, en estas condiciones meteorologicas, no necesita
+# la modificacion del huso horario, ya que 2009 nos encuentra con
+# crecimiento en la produccion y distribucion energetica."
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
-Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
-Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S
+Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
+Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
  
 # From Mariano Absatz (2004-05-21):
 # Today it was officially published that the Province of Mendoza is changing
@@ -389,44 +403,39 @@ Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:0
 # during 2009, this timezone change will run from 00:00 the third Sunday
 # in March until 24:00 of the second Saturday in October.
 
-# From Arthur David Olson (2009-03-16):
-# The unofficial claim at
-# 
-# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
-# 
-# is that "The province will most likely follow the next daylight saving schedule,
-# which is planned for the second Sunday in October."
-
-# From Alexander Krivenyshev (2009-09-19):
-# Some  Argentinian Provinces (Buenos Aires, Entre Ríos) are opposing to the
-# Daylight Saving Time for the 2009-2010 season.
-#
-# (Spanish)
-# "El cambio de huso horario en Entre Ríos deberá ser aprobado por la
-# Legislatura":
-# 
-# http://www.analisisdigital.com.ar/noticias.php?ed=1&di=0&no=110168
-# 
-# English translation - "The time zone change in Entre Rios must be approved by
-# the Legislature."
-#
-# (Spanish)
-# "Mar del Plata no quiere cambiar la hora."
-# 
-# http://www.mensajeroweb.com.ar/index.php?x=nota/33861/1/mar-del-plata-no-quiere-cambiar-la-hora
-# 
-# English translation - "Mar del Plata is not to change the time"
-#
-# or
-# (some English translation)
-# 
-# http://www.worldtimezone.com/dst_news/dst_news_argentina07.html
-# 
-
-# From Arthur David Olson (2009-09-22):
-# "Mar del Plata no quiere cambiar la hora" translates to
-# "Mar del Plata doesn't want to change the time"
-# (less definitive than "is not to").
+# From Mariano Absatz (2009-10-16):
+# ...the Province of San Luis is a case in itself.
+#
+# The Law at
+# 
+# is ambiguous because establishes a calendar from the 2nd Sunday in
+# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
+# complement of that starting on the 2nd Sunday of March at 0:00 and
+# ending on the 2nd Saturday of March at 24:00.
+#
+# This clearly breaks every time the 1st of March or October is a Sunday.
+#
+# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
+# Sunday of October and March.
+#
+# The problem is that the changes in the rest of the Provinces that did
+# change in 2007/2008, were made according to the Federal Law and Decrees
+# that did so on the 3rd Sunday of October and March.
+#
+# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
+# (October 11th) at 0:00.
+#
+# So I guess a new set of rules, besides "Arg", must be made and the last
+# America/Argentina/San_Luis entries should change to use these...
+#
+# I'm enclosing a patch that does what I say... regretfully, the San Luis
+# timezone must be called "WART/WARST" even when most of the time (like,
+# right now) WARST == ART... that is, since last Sunday, all the country
+# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
+# of the country calls it "ART".
+# ...
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -560,6 +569,10 @@ Zone America/Argentina/Mendoza -4:35:16 
 			-3:00	-	ART
 #
 # San Luis (SL)
+
+Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May
 			-4:00	-	ART	1930 Dec
@@ -574,8 +587,7 @@ Zone America/Argentina/San_Luis -4:25:24
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART	2009 Mar 15
-			-4:00	Arg	WAR%sT
+			-4:00	SanLuis	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:43:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EF6771065670;
	Wed, 28 Oct 2009 21:43:16 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DCB5F8FC2A;
	Wed, 28 Oct 2009 21:43: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 n9SLhGeY073292;
	Wed, 28 Oct 2009 21:43:16 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLhGhd073290;
	Wed, 28 Oct 2009 21:43:16 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <200910282143.n9SLhGhd073290@svn.freebsd.org>
From: Qing Li 
Date: Wed, 28 Oct 2009 21:43:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198566 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:43:17 -0000

Author: qingli
Date: Wed Oct 28 21:43:16 2009
New Revision: 198566
URL: http://svn.freebsd.org/changeset/base/198566

Log:
  MFC	r198353
  
  Verify "smp_started" is true before calling
  sched_bind() and sched_unbind().
  
  Reviewed by:	kmacy

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/flowtable.c

Modified: stable/8/sys/net/flowtable.c
==============================================================================
--- stable/8/sys/net/flowtable.c	Wed Oct 28 21:41:23 2009	(r198565)
+++ stable/8/sys/net/flowtable.c	Wed Oct 28 21:43:16 2009	(r198566)
@@ -963,15 +963,19 @@ flowtable_clean_vnet(void)
 				if (CPU_ABSENT(i))
 					continue;
 
-				thread_lock(curthread);
-				sched_bind(curthread, i);
-				thread_unlock(curthread);
+				if (smp_started == 1) {
+					thread_lock(curthread);
+					sched_bind(curthread, i);
+					thread_unlock(curthread);
+				}
 
 				flowtable_free_stale(ft, NULL);
 
-				thread_lock(curthread);
-				sched_unbind(curthread);
-				thread_unlock(curthread);
+				if (smp_started == 1) {
+					thread_lock(curthread);
+					sched_unbind(curthread);
+					thread_unlock(curthread);
+				}
 			}
 		} else {
 			flowtable_free_stale(ft, NULL);

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 21:45:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B657D1065679;
	Wed, 28 Oct 2009 21:45:25 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A38308FC1C;
	Wed, 28 Oct 2009 21:45: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 n9SLjPKD073402;
	Wed, 28 Oct 2009 21:45:25 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SLjPek073398;
	Wed, 28 Oct 2009 21:45:25 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <200910282145.n9SLjPek073398@svn.freebsd.org>
From: Qing Li 
Date: Wed, 28 Oct 2009 21:45:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198567 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet netinet6
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 21:45:25 -0000

Author: qingli
Date: Wed Oct 28 21:45:25 2009
New Revision: 198567
URL: http://svn.freebsd.org/changeset/base/198567

Log:
  MFC	r198418
  
  Use the correct option name in the preprocessor command to enable
  or disable diagnostic messages.
  
  Reviewed by:	ru

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/if_ether.c
  stable/8/sys/netinet/in.c
  stable/8/sys/netinet6/in6.c

Modified: stable/8/sys/netinet/if_ether.c
==============================================================================
--- stable/8/sys/netinet/if_ether.c	Wed Oct 28 21:43:16 2009	(r198566)
+++ stable/8/sys/netinet/if_ether.c	Wed Oct 28 21:45:25 2009	(r198567)
@@ -172,7 +172,7 @@ arptimer(void *arg)
 	    callout_active(&lle->la_timer))) {
 		(void) llentry_free(lle);
 	}
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
 	else {
 		struct sockaddr *l3addr = L3_ADDR(lle);
 		log(LOG_INFO, "arptimer issue: %p, IPv4 address: \"%s\"\n", lle,

Modified: stable/8/sys/netinet/in.c
==============================================================================
--- stable/8/sys/netinet/in.c	Wed Oct 28 21:43:16 2009	(r198566)
+++ stable/8/sys/netinet/in.c	Wed Oct 28 21:45:25 2009	(r198567)
@@ -1327,7 +1327,7 @@ in_lltable_rtcheck(struct ifnet *ifp, co
 	/* XXX rtalloc1 should take a const param */
 	rt = rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0);
 	if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) {
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
 		log(LOG_INFO, "IPv4 address: \"%s\" is not on the network\n",
 		    inet_ntoa(((const struct sockaddr_in *)l3addr)->sin_addr));
 #endif
@@ -1366,7 +1366,7 @@ in_lltable_lookup(struct lltable *llt, u
 			break;
 	}
 	if (lle == NULL) {
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
 		if (flags & LLE_DELETE)
 			log(LOG_INFO, "interface address is missing from cache = %p  in delete\n", lle);	
 #endif
@@ -1400,7 +1400,7 @@ in_lltable_lookup(struct lltable *llt, u
 			LLE_WLOCK(lle);
 			lle->la_flags = LLE_DELETED;
 			LLE_WUNLOCK(lle);
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
 			log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);	
 #endif
 		}

Modified: stable/8/sys/netinet6/in6.c
==============================================================================
--- stable/8/sys/netinet6/in6.c	Wed Oct 28 21:43:16 2009	(r198566)
+++ stable/8/sys/netinet6/in6.c	Wed Oct 28 21:45:25 2009	(r198567)
@@ -2430,7 +2430,7 @@ in6_lltable_lookup(struct lltable *llt, 
 			LLE_WLOCK(lle);
 			lle->la_flags = LLE_DELETED;
 			LLE_WUNLOCK(lle);
-#ifdef DIAGNOSTICS
+#ifdef DIAGNOSTIC
 			log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);	
 #endif	
 		}

From owner-svn-src-all@FreeBSD.ORG  Wed Oct 28 22:00:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 32ADA106566B;
	Wed, 28 Oct 2009 22:00:50 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 209E68FC17;
	Wed, 28 Oct 2009 22: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 n9SM0o7i073778;
	Wed, 28 Oct 2009 22:00:50 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9SM0oav073776;
	Wed, 28 Oct 2009 22:00:50 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <200910282200.n9SM0oav073776@svn.freebsd.org>
From: Qing Li 
Date: Wed, 28 Oct 2009 22:00:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198568 - in releng/8.0/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 28 Oct 2009 22:00:50 -0000

Author: qingli
Date: Wed Oct 28 22:00:49 2009
New Revision: 198568
URL: http://svn.freebsd.org/changeset/base/198568

Log:
  MFC	r198353
  
  Verify "smp_started" is true before calling
  sched_bind() and sched_unbind().
  
  Reviewed by:	kmacy
  Approved by:	re

Modified:
  releng/8.0/sys/   (props changed)
  releng/8.0/sys/amd64/include/xen/   (props changed)
  releng/8.0/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.0/sys/contrib/dev/acpica/   (props changed)
  releng/8.0/sys/contrib/pf/   (props changed)
  releng/8.0/sys/dev/xen/xenpci/   (props changed)
  releng/8.0/sys/net/flowtable.c

Modified: releng/8.0/sys/net/flowtable.c
==============================================================================
--- releng/8.0/sys/net/flowtable.c	Wed Oct 28 21:45:25 2009	(r198567)
+++ releng/8.0/sys/net/flowtable.c	Wed Oct 28 22:00:49 2009	(r198568)
@@ -963,15 +963,19 @@ flowtable_clean_vnet(void)
 				if (CPU_ABSENT(i))
 					continue;
 
-				thread_lock(curthread);
-				sched_bind(curthread, i);
-				thread_unlock(curthread);
+				if (smp_started == 1) {
+					thread_lock(curthread);
+					sched_bind(curthread, i);
+					thread_unlock(curthread);
+				}
 
 				flowtable_free_stale(ft, NULL);
 
-				thread_lock(curthread);
-				sched_unbind(curthread);
-				thread_unlock(curthread);
+				if (smp_started == 1) {
+					thread_lock(curthread);
+					sched_unbind(curthread);
+					thread_unlock(curthread);
+				}
 			}
 		} else {
 			flowtable_free_stale(ft, NULL);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 01:16:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C2E8106566B
	for ; Thu, 29 Oct 2009 01:16:19 +0000 (UTC)
	(envelope-from noreplyhere@ymail.com)
Received: from [119.208.167.104] (173-126-163-157.pools.spcsdns.net
	[173.126.163.157])
	by mx1.freebsd.org (Postfix) with SMTP id C742A8FC19
	for ; Thu, 29 Oct 2009 01:16:13 +0000 (UTC)
Received: from [119.208.167.104][127.0.0.1] by [119.208.167.104][127.0.0.1]
	(SMTPD32); Wed, 28 Oct 2009 18:16:14 -0700
Message-ID: 
From: "Deployment Division" 
To: 
Date: Wed, 28 Oct 2009 18:14:22 -0700
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Content-Type: text/plain; charset="windows-1252"
X-Content-Filtered-By: Mailman/MimeDel 2.1.5
Subject: Email Marketing Works
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 01:16:19 -0000


        Can't see the notification? [1]View = this=20 notice online.

   Want=20 to get in front of 1 Million targeted = prospects=20 
   For=20 only $599?

   Use=20 our dedicated mailing servers 
   and=20 rent our email database.
                                  3D""=20
                                  3D""=20

   We will make this short and sweet. We can get your = products in=20
   front of millions of OPT IN customers for a fraction of the cost of =
   any=20 other advertising medium.

   When you join us - You will gain access to a powerful=20 tool.

   We have access to 200 million consumers, 35 million = homeowners
   and=20 45 Million Businesses within the United States and much more=20
   outside.

   Please contact us to get our FREE info packet and = learn how we=20
   can help you increase sales like never = before.
     * Graphics Team Designs AD=20
     * You Pick Your Target Audience=20
     * OPT-IN Customer List = Compiled=20
     * Scrub Do not E-mail = Database=20
     * Deploy Millions of = E-mails=20
     * Track Click & Open = Rates=20
     * Direct Traffic To Your Web = site=20
     * Customer Contacts You=20
     * Blast Can Be Broken Up=20

                                  3D""=20

   CALL 1=20 (888) 313-2220 To Get FREE=20 Information!

   [2]unsubscr= ibe

References

   1. 3D"http://img17.imageshack.us/img17/8099/importantnotice.png"
   2. 3D"http://img17.imageshack.us/img17/8099/importantnotice.png"

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 01:51:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8DE87106566B;
	Thu, 29 Oct 2009 01:51:48 +0000 (UTC)
	(envelope-from jhellenthal@gmail.com)
Received: from mail-gx0-f218.google.com (mail-gx0-f218.google.com
	[209.85.217.218])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B7EB8FC0C;
	Thu, 29 Oct 2009 01:51:47 +0000 (UTC)
Received: by gxk10 with SMTP id 10so1317413gxk.3
	for ; Wed, 28 Oct 2009 18:51:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:date:from:to:cc
	:subject:in-reply-to:message-id:references:user-agent
	:x-openpgp-key-id:x-openpgp-key-fingerprint:mime-version
	:content-type; bh=2xIsiT7mbmaHWMwMCPLjxwNnUXNs7gRgucz7Nm/ufEM=;
	b=v87tXZ5YzFfrStYst7jVr0SKLhQW/yfSCfEF70Cbg24Xi7VdpQjZHtidZP6MM9kXQ1
	TO4LddYd4Whcc1zShgdVfToygyFrPxnriKvXHplBfnnwPSf2GwE8EpXygomFuA7HPTrO
	9wTyPAa+DPljxF002Hv5d3GnnTT5HARi8u8j0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:date:from:to:cc:subject:in-reply-to:message-id:references
	:user-agent:x-openpgp-key-id:x-openpgp-key-fingerprint:mime-version
	:content-type;
	b=NkVrGYn3ywWc6FAX8hk3RsOt+Kv/t9kT4FAGbi8jLa6N9ucoA47uVf1CX9DssHW068
	LilSiUe92Nu95veNjKz2Wq0HaCDJksCT5K6pz5WMnHRW83Rjibwv2FfRfVg8oXzhbVjE
	/i1KM/p1LybWo2B2uNnK2Fcqa4WL3tITGXET0=
Received: by 10.151.94.1 with SMTP id w1mr30448049ybl.214.1256779219338;
	Wed, 28 Oct 2009 18:20:19 -0700 (PDT)
Received: from ppp-22.152.dialinfree.com (ppp-22.152.dialinfree.com
	[209.172.22.152])
	by mx.google.com with ESMTPS id 5sm561874ywd.53.2009.10.28.18.20.05
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Wed, 28 Oct 2009 18:20:17 -0700 (PDT)
Sender: "J. Hellenthal" 
Date: Wed, 28 Oct 2009 21:20:00 -0400
From: jhell 
To: Christian Brueffer 
In-Reply-To: <200910281746.n9SHkqBq068138@svn.freebsd.org>
Message-ID: 
References: <200910281746.n9SHkqBq068138@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
X-OpenPGP-Key-Id: 0x89D8547E
X-OpenPGP-Key-Fingerprint: 85EF E26B 07BB 3777 76BE  B12A 9057 8789 89D8 547E
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-all@freebsd.org
Subject: Re: svn commit: r198553 - stable/7/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 01:51:48 -0000


On Wed, 28 Oct 2009 13:46, brueffer@ wrote:
> Author: brueffer
> Date: Wed Oct 28 17:46:52 2009
> New Revision: 198553
> URL: http://svn.freebsd.org/changeset/base/198553
>
> Log:
>  MFC: r198363
>
>  List more dependencies for these drivers. While here, convert
>  atapicam(4) to use our standard section 4 SYNOPSIS layout.
>
> Modified:
>  stable/7/share/man/man4/   (props changed)
>  stable/7/share/man/man4/atapicam.4
>  stable/7/share/man/man4/umass.4
>
--------------------------------------------------------------
>>> stage 1: configuring the kernel
--------------------------------------------------------------
cd /usr/src/sys/i386/conf; 
PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin 
config  -d /usr/obj/usr/src/sys/SH4500  /usr/src/sys/i386/conf/SH4500
config: Error: device "cam" is unknown

cam is not a device or a option on stable/7 or before. Maybe stable/8 -> ? 
or is this planned to be turned into a device ?.

Already included without extra added options here on r198529M stable/7

# kldstat -v |grep cam
                 41 cam
#

Best regards.

-- 

  ;; dataix.net!jhell         2048R/89D8547E 2009-09-30
  ;; BSD since FreeBSD 4.2    Linux since Slackware 2.1
  ;; 85EF E26B 07BB 3777 76BE  B12A 9057 8789 89D8 547E


From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 09:27:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84058106568B;
	Thu, 29 Oct 2009 09:27:10 +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 7279F8FC14;
	Thu, 29 Oct 2009 09:27: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 n9T9RAGI089992;
	Thu, 29 Oct 2009 09:27:10 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9T9RAS4089990;
	Thu, 29 Oct 2009 09:27:10 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200910290927.n9T9RAS4089990@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Thu, 29 Oct 2009 09:27: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: r198570 - head/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 09:27:10 -0000

Author: ru
Date: Thu Oct 29 09:27:09 2009
New Revision: 198570
URL: http://svn.freebsd.org/changeset/base/198570

Log:
  HZ is now 1000 on most platforms, update a comment.
  
  Reviewed by:	phk, markm

Modified:
  head/sys/sys/time.h

Modified: head/sys/sys/time.h
==============================================================================
--- head/sys/sys/time.h	Thu Oct 29 05:18:02 2009	(r198569)
+++ head/sys/sys/time.h	Thu Oct 29 09:27:09 2009	(r198570)
@@ -283,7 +283,7 @@ extern struct timeval boottime;
  *
  * Functions with the "get" prefix returns a less precise result
  * much faster than the functions without "get" prefix and should
- * be used where a precision of 10 msec is acceptable or where
+ * be used where a precision of 1/hz seconds is acceptable or where
  * performance is priority. (NB: "precision", _not_ "resolution" !) 
  * 
  */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 09:45:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7F5AD1065753;
	Thu, 29 Oct 2009 09:45:05 +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 6E9D58FC12;
	Thu, 29 Oct 2009 09:45: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 n9T9j5ph090377;
	Thu, 29 Oct 2009 09:45:05 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9T9j5NQ090375;
	Thu, 29 Oct 2009 09:45:05 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200910290945.n9T9j5NQ090375@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Thu, 29 Oct 2009 09:45: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: r198571 - head/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 09:45:05 -0000

Author: ru
Date: Thu Oct 29 09:45:05 2009
New Revision: 198571
URL: http://svn.freebsd.org/changeset/base/198571

Log:
  Back in 2003, get_cyclecount() was changed to use binuptime() instead
  of nanotime().  Reflect this change in a manpage.
  
  Reviewed by:	phk, markm

Modified:
  head/share/man/man9/get_cyclecount.9

Modified: head/share/man/man9/get_cyclecount.9
==============================================================================
--- head/share/man/man9/get_cyclecount.9	Thu Oct 29 09:27:09 2009	(r198570)
+++ head/share/man/man9/get_cyclecount.9	Thu Oct 29 09:45:05 2009	(r198571)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 20, 2000
+.Dd October 24, 2009
 .Dt GET_CYCLECOUNT 9
 .Os
 .Sh NAME
@@ -65,10 +65,10 @@ do not have such a register,
 so
 .Fn get_cyclecount
 on these platforms
-returns the number of nanoseconds
+returns a (non-monotonic) combination of numbers
 represented by the
 structure returned by
-.Xr nanotime 9 .
+.Xr binuptime 9 .
 .Pp
 The
 .Tn Pentium
@@ -77,18 +77,12 @@ processors all use the
 register.
 .Pp
 The
-.Tn Alpha
-processors use the
-.Li PCC
-register.
-.Pp
-The
 .Tn IA64
 processors use the
 .Li AR.ITC
 register.
 .Sh SEE ALSO
-.Xr nanotime 9
+.Xr binuptime 9
 .Sh HISTORY
 The
 .Fn get_cyclecount

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 09:45:49 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15DA9106568D;
	Thu, 29 Oct 2009 09:45:49 +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 02DD28FC1C;
	Thu, 29 Oct 2009 09:45: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 n9T9jmd5090425;
	Thu, 29 Oct 2009 09:45:48 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9T9jm2f090423;
	Thu, 29 Oct 2009 09:45:48 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910290945.n9T9jm2f090423@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 09:45:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198572 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/ata/chipsets dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 09:45:49 -0000

Author: mav
Date: Thu Oct 29 09:45:48 2009
New Revision: 198572
URL: http://svn.freebsd.org/changeset/base/198572

Log:
  Fix SATA on nVidia MCP55 chipset. It needs some short time to allow BAR(5)
  memory access.
  
  PR:		amd64/128686, amd64/132372, amd64/139156

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ata/chipsets/ata-nvidia.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-nvidia.c	Thu Oct 29 09:45:05 2009	(r198571)
+++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c	Thu Oct 29 09:45:48 2009	(r198572)
@@ -165,7 +165,8 @@ ata_nvidia_chipinit(device_t dev)
 
 	    /* enable control access */
 	    pci_write_config(dev, 0x50, pci_read_config(dev, 0x50, 1) | 0x04,1);
-
+	    /* MCP55 seems to need some time to allow r_res2 read. */
+	    DELAY(10);
 	    if (ctlr->chip->cfg1 & NVQ) {
 		/* clear interrupt status */
 		ATA_OUTL(ctlr->r_res2, offset, 0x00ff00ff);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 09:51:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DAABF1065698;
	Thu, 29 Oct 2009 09:51: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 B0C488FC12;
	Thu, 29 Oct 2009 09:51: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 n9T9pDgp090619;
	Thu, 29 Oct 2009 09:51:13 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9T9pDFt090617;
	Thu, 29 Oct 2009 09:51:13 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200910290951.n9T9pDFt090617@svn.freebsd.org>
From: Ruslan Ermilov 
Date: Thu, 29 Oct 2009 09:51: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: r198573 - head/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 09:51:14 -0000

Author: ru
Date: Thu Oct 29 09:51:13 2009
New Revision: 198573
URL: http://svn.freebsd.org/changeset/base/198573

Log:
  Update some comments regarding ktr(4).

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Thu Oct 29 09:45:48 2009	(r198572)
+++ head/sys/conf/NOTES	Thu Oct 29 09:51:13 2009	(r198573)
@@ -402,8 +402,7 @@ options 	KTRACE			#kernel tracing
 options 	KTRACE_REQUEST_POOL=101
 
 #
-# KTR is a kernel tracing mechanism imported from BSD/OS.  Currently
-# it has no userland interface aside from a few sysctl's.  It is
+# KTR is a kernel tracing facility imported from BSD/OS.  It is
 # enabled with the KTR option.  KTR_ENTRIES defines the number of
 # entries in the circular trace buffer; it must be a power of two.
 # KTR_COMPILE defines the mask of events to compile into the kernel as
@@ -413,7 +412,7 @@ options 	KTRACE_REQUEST_POOL=101
 # events, with bit X corresponding to CPU X.  KTR_VERBOSE enables
 # dumping of KTR events to the console by default.  This functionality
 # can be toggled via the debug.ktr_verbose sysctl and defaults to off
-# if KTR_VERBOSE is not defined.
+# if KTR_VERBOSE is not defined.  See ktr(4) and ktrdump(8) for details.
 #
 options 	KTR
 options 	KTR_ENTRIES=1024
@@ -424,7 +423,7 @@ options 	KTR_VERBOSE
 
 #
 # ALQ(9) is a facility for the asynchronous queuing of records from the kernel
-# to a vnode, and is employed by services such as KTR(4) to produce trace
+# to a vnode, and is employed by services such as ktr(4) to produce trace
 # files based on a kernel event stream.  Records are written asynchronously
 # in a worker thread.
 #
@@ -618,9 +617,9 @@ options 	SCTP_WITH_NO_CSUM
 # I have not yet commited the tools to get and print
 # the logs, I will do that eventually .. before then
 # if you want them send me an email rrs@freebsd.org
-# You basically must have KTR enabled for these
+# You basically must have ktr(4) enabled for these
 # and you then set the sysctl to turn on/off various
-# logging bits. Use ktrdump to pull the log and run
+# logging bits. Use ktrdump(8) to pull the log and run
 # it through a dispaly program.. and graphs and other
 # things too.
 #

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 09:58:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BDC9106566C;
	Thu, 29 Oct 2009 09:58:16 +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 672E08FC28;
	Thu, 29 Oct 2009 09:58: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 n9T9wGsv090811;
	Thu, 29 Oct 2009 09:58:16 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9T9wGVD090808;
	Thu, 29 Oct 2009 09:58:16 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910290958.n9T9wGVD090808@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 09:58:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198574 - in stable/8: . bin/csh bin/sh
	cddl/compat/opensolaris cddl/contrib/opensolaris
	cddl/lib/libnvpair contrib/bind9 contrib/bzip2 contrib/cpio
	contrib/csup contrib/ee contrib/file...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 09:58:16 -0000

Author: mav
Date: Thu Oct 29 09:58:16 2009
New Revision: 198574
URL: http://svn.freebsd.org/changeset/base/198574

Log:
  MFC rev. 198480, 198483:
  Document new modularised ATA kernel modules and options.
  
  PR:             kern/133162, amd64/139859

Modified:
  stable/8/   (props changed)
  stable/8/ObsoleteFiles.inc   (props changed)
  stable/8/UPDATING   (contents, props changed)
  stable/8/bin/csh/   (props changed)
  stable/8/bin/sh/   (props changed)
  stable/8/cddl/compat/opensolaris/   (props changed)
  stable/8/cddl/contrib/opensolaris/   (props changed)
  stable/8/cddl/lib/libnvpair/   (props changed)
  stable/8/contrib/bind9/   (props changed)
  stable/8/contrib/bzip2/   (props changed)
  stable/8/contrib/cpio/   (props changed)
  stable/8/contrib/csup/   (props changed)
  stable/8/contrib/ee/   (props changed)
  stable/8/contrib/file/   (props changed)
  stable/8/contrib/gdb/   (props changed)
  stable/8/contrib/gdtoa/   (props changed)
  stable/8/contrib/less/   (props changed)
  stable/8/contrib/libpcap/   (props changed)
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/netcat/   (props changed)
  stable/8/contrib/ntp/   (props changed)
  stable/8/contrib/openbsm/   (props changed)
  stable/8/contrib/openpam/   (props changed)
  stable/8/contrib/pf/   (props changed)
  stable/8/contrib/sendmail/   (props changed)
  stable/8/contrib/tcpdump/   (props changed)
  stable/8/contrib/tcsh/   (props changed)
  stable/8/contrib/top/   (props changed)
  stable/8/contrib/top/install-sh   (props changed)
  stable/8/contrib/traceroute/   (props changed)
  stable/8/contrib/wpa/   (props changed)
  stable/8/crypto/openssh/   (props changed)
  stable/8/crypto/openssl/   (props changed)
  stable/8/etc/   (props changed)
  stable/8/gnu/usr.bin/patch/   (props changed)
  stable/8/include/   (props changed)
  stable/8/kerberos5/lib/libgssapi_krb5/   (props changed)
  stable/8/kerberos5/lib/libgssapi_spnego/   (props changed)
  stable/8/lib/libarchive/   (props changed)
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/gen/   (props changed)
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)
  stable/8/lib/libdevinfo/   (props changed)
  stable/8/lib/libdisk/   (props changed)
  stable/8/lib/libkvm/   (props changed)
  stable/8/lib/libthr/   (props changed)
  stable/8/lib/libusb/   (props changed)
  stable/8/lib/libusb/usb.h   (props changed)
  stable/8/lib/libutil/   (props changed)
  stable/8/libexec/rtld-elf/   (props changed)
  stable/8/release/   (props changed)
  stable/8/release/doc/   (props changed)
  stable/8/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  stable/8/sbin/   (props changed)
  stable/8/sbin/bsdlabel/   (props changed)
  stable/8/sbin/camcontrol/   (props changed)
  stable/8/sbin/dhclient/   (props changed)
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/ifconfig/   (props changed)
  stable/8/sbin/ipfw/   (props changed)
  stable/8/sbin/mksnap_ffs/   (props changed)
  stable/8/sbin/mount/   (props changed)
  stable/8/sbin/mount_nfs/   (props changed)
  stable/8/sbin/umount/   (props changed)
  stable/8/share/man/man4/   (props changed)
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man7/   (props changed)
  stable/8/share/man/man9/   (props changed)
  stable/8/share/timedef/   (props changed)
  stable/8/share/zoneinfo/   (props changed)
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/NOTES
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/tools/regression/bin/sh/   (props changed)
  stable/8/tools/regression/lib/msun/test-conj.t   (props changed)
  stable/8/tools/regression/poll/   (props changed)
  stable/8/tools/regression/priv/   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pkill-_g.t   (props changed)
  stable/8/tools/tools/ath/common/dumpregs.h   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5210.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5211.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5212.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5416.c   (props changed)
  stable/8/tools/tools/termcap/termcap.pl   (props changed)
  stable/8/tools/tools/vimage/   (props changed)
  stable/8/usr.bin/calendar/calendars/calendar.freebsd   (props changed)
  stable/8/usr.bin/csup/   (props changed)
  stable/8/usr.bin/fstat/   (props changed)
  stable/8/usr.bin/look/   (props changed)
  stable/8/usr.bin/netstat/   (props changed)
  stable/8/usr.bin/procstat/   (props changed)
  stable/8/usr.bin/w/   (props changed)
  stable/8/usr.bin/whois/   (props changed)
  stable/8/usr.sbin/   (props changed)
  stable/8/usr.sbin/arp/   (props changed)
  stable/8/usr.sbin/dumpcis/cardinfo.h   (props changed)
  stable/8/usr.sbin/dumpcis/cis.h   (props changed)
  stable/8/usr.sbin/freebsd-update/   (props changed)
  stable/8/usr.sbin/iostat/   (props changed)
  stable/8/usr.sbin/jls/   (props changed)
  stable/8/usr.sbin/lpr/   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  stable/8/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  stable/8/usr.sbin/makefs/getid.c   (props changed)
  stable/8/usr.sbin/mfiutil/mfiutil.8   (props changed)
  stable/8/usr.sbin/ndp/   (props changed)
  stable/8/usr.sbin/ntp/   (props changed)
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/pstat/   (props changed)
  stable/8/usr.sbin/sysinstall/   (props changed)
  stable/8/usr.sbin/traceroute6/   (props changed)
  stable/8/usr.sbin/wpa/   (props changed)
  stable/8/usr.sbin/zic/   (props changed)

Modified: stable/8/UPDATING
==============================================================================
--- stable/8/UPDATING	Thu Oct 29 09:51:13 2009	(r198573)
+++ stable/8/UPDATING	Thu Oct 29 09:58:16 2009	(r198574)
@@ -566,6 +566,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	userland (libpmc(3)) and the kernel module (hwpmc(4)) in
 	sync.
 
+20081009:
+	atapci kernel module now includes only generic PCI ATA
+	driver. AHCI driver moved to ataahci kernel module.
+	All vendor-specific code moved into separate kernel modules:
+	ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek,
+	atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron,
+	atamarvell, atamicron, atanational, atanetcell, atanvidia,
+	atapromise, ataserverworks, atasiliconimage, atasis, atavia
+
 20080820:
 	The TTY subsystem of the kernel has been replaced by a new
 	implementation, which provides better scalability and an

Modified: stable/8/sys/conf/NOTES
==============================================================================
--- stable/8/sys/conf/NOTES	Thu Oct 29 09:51:13 2009	(r198573)
+++ stable/8/sys/conf/NOTES	Thu Oct 29 09:58:16 2009	(r198574)
@@ -1657,6 +1657,10 @@ device		siis
 # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card
 # devices. You only need one "device ata" for it to find all
 # PCI and PC Card ATA/ATAPI devices on modern machines.
+# Alternatively, individual bus and chipset drivers may be chosen by using
+# the 'atacore' driver then selecting the drivers on a per vendor basis.
+# For example to build a system which only supports a VIA chipset,
+# omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
 device		ata
 device		atadisk		# ATA disk drives
 device		ataraid		# ATA RAID drives
@@ -1665,6 +1669,39 @@ device		atapifd		# ATAPI floppy drives
 device		atapist		# ATAPI tape drives
 device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
 				# needs CAM to be present (scbus & pass)
+
+# Modular ATA
+#device		atacore		# Core ATA functionality
+#device		atacard		# CARDBUS support
+#device		atabus		# PC98 cbus support
+#device		ataisa		# ISA bus support
+#device		atapci		# PCI bus support; only generic chipset support
+
+# PCI ATA chipsets
+#device		ataahci		# AHCI SATA
+#device		ataacard	# ACARD
+#device		ataacerlabs	# Acer Labs Inc. (ALI)
+#device		ataadaptec	# Adaptec
+#device		ataamd		# American Micro Devices (AMD)
+#device		ataati		# ATI
+#device		atacenatek	# Cenatek
+#device		atacypress	# Cypress
+#device		atacyrix	# Cyrix
+#device		atahighpoint	# HighPoint
+#device		ataintel	# Intel
+#device		ataite		# Integrated Technology Inc. (ITE)
+#device		atajmicron	# JMicron
+#device		atamarvell	# Marvell
+#device		atamicron	# Micron
+#device		atanational	# National
+#device		atanetcell	# NetCell
+#device		atanvidia	# nVidia
+#device		atapromise	# Promise
+#device		ataserverworks	# ServerWorks
+#device		atasiliconimage	# Silicon Image Inc. (SiI) (formerly CMD)
+#device		atasis		# Silicon Integrated Systems Corp.(SiS)
+#device		atavia		# VIA Technologies Inc.
+
 #
 # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add:
 hint.ata.0.at="isa"

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 10:03:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0483C106566B;
	Thu, 29 Oct 2009 10:03:09 +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 E807B8FC16;
	Thu, 29 Oct 2009 10:03: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 n9TA38xQ091070;
	Thu, 29 Oct 2009 10:03:08 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TA38an091068;
	Thu, 29 Oct 2009 10:03:08 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291003.n9TA38an091068@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 10:03: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: r198575 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 10:03:09 -0000

Author: kib
Date: Thu Oct 29 10:03:08 2009
New Revision: 198575
URL: http://svn.freebsd.org/changeset/base/198575

Log:
  Fix style issue.

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Thu Oct 29 09:58:16 2009	(r198574)
+++ head/sys/kern/uipc_syscalls.c	Thu Oct 29 10:03:08 2009	(r198575)
@@ -2016,7 +2016,7 @@ retry_space:
 		 * Loop and construct maximum sized mbuf chain to be bulk
 		 * dumped into socket buffer.
 		 */
-		while(space > loopbytes) {
+		while (space > loopbytes) {
 			vm_pindex_t pindex;
 			vm_offset_t pgoff;
 			struct mbuf *m0;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 10:05:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E738E106568F;
	Thu, 29 Oct 2009 10:05:08 +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 D40E08FC28;
	Thu, 29 Oct 2009 10:05: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 n9TA58mH091197;
	Thu, 29 Oct 2009 10:05:08 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TA585X091194;
	Thu, 29 Oct 2009 10:05:08 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291005.n9TA585X091194@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 10:05:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198576 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/ata dev/ata/chipsets dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 10:05:09 -0000

Author: mav
Date: Thu Oct 29 10:05:08 2009
New Revision: 198576
URL: http://svn.freebsd.org/changeset/base/198576

Log:
  MFC rev. 198481, 198482:
  Add two more VIA SATA chip IDs.
  
  PR:		kern/135057

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ata/ata-pci.h
  stable/8/sys/dev/ata/chipsets/ata-via.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/8/sys/dev/ata/ata-pci.h	Thu Oct 29 10:03:08 2009	(r198575)
+++ stable/8/sys/dev/ata/ata-pci.h	Thu Oct 29 10:05:08 2009	(r198576)
@@ -415,6 +415,8 @@ struct ata_pci_controller {
 #define ATA_VIA8237             0x32271106
 #define ATA_VIA8237A            0x05911106
 #define ATA_VIA8237S		0x53371106
+#define ATA_VIA8237_5372	0x53721106
+#define ATA_VIA8237_7372	0x73721106
 #define ATA_VIA8251             0x33491106
 #define ATA_VIA8361             0x31121106
 #define ATA_VIA8363             0x03051106

Modified: stable/8/sys/dev/ata/chipsets/ata-via.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-via.c	Thu Oct 29 10:03:08 2009	(r198575)
+++ stable/8/sys/dev/ata/chipsets/ata-via.c	Thu Oct 29 10:05:08 2009	(r198576)
@@ -95,6 +95,8 @@ ata_via_probe(device_t dev)
      { ATA_VIA8237,   0x00, VIA133, 0x00,    ATA_UDMA6, "8237" },
      { ATA_VIA8237A,  0x00, VIA133, 0x00,    ATA_UDMA6, "8237A" },
      { ATA_VIA8237S,  0x00, VIA133, 0x00,    ATA_UDMA6, "8237S" },
+     { 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" },
      { 0, 0, 0, 0, 0, 0 }};
     static struct ata_chip_id new_ids[] =
@@ -103,6 +105,8 @@ ata_via_probe(device_t dev)
      { ATA_VIA6421,   0x00, 6,      VIABAR,  ATA_SA150, "6421" },
      { ATA_VIA8237A,  0x00, 7,      0x00,    ATA_SA150, "8237A" },
      { ATA_VIA8237S,  0x00, 7,      0x00,    ATA_SA150, "8237S" },
+     { ATA_VIA8237_5372, 0x00, 7,   0x00,    ATA_SA300, "8237" },
+     { ATA_VIA8237_7372, 0x00, 7,   0x00,    ATA_SA300, "8237" },
      { ATA_VIA8251,   0x00, 0,      VIAAHCI, ATA_SA300, "8251" },
      { 0, 0, 0, 0, 0, 0 }};
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 10:35:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C55B106566B;
	Thu, 29 Oct 2009 10:35:51 +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 290058FC1C;
	Thu, 29 Oct 2009 10:35: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 n9TAZojx091952;
	Thu, 29 Oct 2009 10:35:50 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TAZoVf091950;
	Thu, 29 Oct 2009 10:35:50 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291035.n9TAZoVf091950@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 10:35:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198577 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/ata dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 10:35:51 -0000

Author: mav
Date: Thu Oct 29 10:35:50 2009
New Revision: 198577
URL: http://svn.freebsd.org/changeset/base/198577

Log:
  MFC rev. 198488:
  Report SATA speeds to CAM, to not confuse users with low numbers logged.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ata/atapi-cam.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ata/atapi-cam.c
==============================================================================
--- stable/8/sys/dev/ata/atapi-cam.c	Thu Oct 29 10:05:08 2009	(r198576)
+++ stable/8/sys/dev/ata/atapi-cam.c	Thu Oct 29 10:35:50 2009	(r198577)
@@ -414,6 +414,12 @@ atapi_action(struct cam_sim *sim, union 
 	    case ATA_UDMA6:
 		cpi->base_transfer_speed = 133000;
 		break;
+	    case ATA_SA150:
+		cpi->base_transfer_speed = 150000;
+		break;
+	    case ATA_SA300:
+		cpi->base_transfer_speed = 300000;
+		break;
 	    default:
 		break;
 	    }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 10:38:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C5565106568D;
	Thu, 29 Oct 2009 10:38:17 +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 B237E8FC0C;
	Thu, 29 Oct 2009 10:38: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 n9TAcHDL092042;
	Thu, 29 Oct 2009 10:38:17 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TAcHdp092040;
	Thu, 29 Oct 2009 10:38:17 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291038.n9TAcHdp092040@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 10:38:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198578 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/ata dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 10:38:17 -0000

Author: mav
Date: Thu Oct 29 10:38:17 2009
New Revision: 198578
URL: http://svn.freebsd.org/changeset/base/198578

Log:
  MFC rev. 198487:
  Round timeout up when converting CAM milliseconds to ATA seconds.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/ata/atapi-cam.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/ata/atapi-cam.c
==============================================================================
--- stable/8/sys/dev/ata/atapi-cam.c	Thu Oct 29 10:35:50 2009	(r198577)
+++ stable/8/sys/dev/ata/atapi-cam.c	Thu Oct 29 10:38:17 2009	(r198578)
@@ -635,7 +635,7 @@ atapi_action(struct cam_sim *sim, union 
 	request->data = buf;
 	request->bytecount = len;
 	request->transfersize = min(request->bytecount, 65534);
-	request->timeout = ccb_h->timeout / 1000; /* XXX lost granularity */
+	request->timeout = (ccb_h->timeout + 999) / 1000;
 	request->callback = &atapi_cb;
 	request->flags = request_flags;
 
@@ -738,7 +738,7 @@ atapi_cb(struct ata_request *request)
 		request->data = (caddr_t)&csio->sense_data;
 		request->bytecount = sizeof(struct atapi_sense);
 		request->transfersize = min(request->bytecount, 65534);
-		request->timeout = csio->ccb_h.timeout / 1000;
+		request->timeout = (csio->ccb_h.timeout + 999) / 1000;
 		request->retries = 2;
 		request->flags = ATA_R_QUIET|ATA_R_ATAPI|ATA_R_IMMEDIATE;
 		hcb->flags |= AUTOSENSE;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 11:00:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3BB53106566C;
	Thu, 29 Oct 2009 11:00:40 +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 297678FC2E;
	Thu, 29 Oct 2009 11:00: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 n9TB0eCM093815;
	Thu, 29 Oct 2009 11:00:40 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TB0eIo093813;
	Thu, 29 Oct 2009 11:00:40 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910291100.n9TB0eIo093813@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 29 Oct 2009 11:00:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198579 - in stable/7/lib/libc: . stdtime
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 11:00:40 -0000

Author: edwin
Date: Thu Oct 29 11:00:39 2009
New Revision: 198579
URL: http://svn.freebsd.org/changeset/base/198579

Log:
  MFC of r197189
  
  Improve the way failure of pthread_key_create() gets detected.
  
  PR:           threads/138603
  Submitted by: Mikulas Patocka

Modified:
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/stdtime/localtime.c

Modified: stable/7/lib/libc/stdtime/localtime.c
==============================================================================
--- stable/7/lib/libc/stdtime/localtime.c	Thu Oct 29 10:38:17 2009	(r198578)
+++ stable/7/lib/libc/stdtime/localtime.c	Thu Oct 29 11:00:39 2009	(r198579)
@@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$");
 #include "namespace.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "private.h"
@@ -1413,12 +1414,15 @@ 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) {
 		_pthread_mutex_lock(&localtime_mutex);
 		if (localtime_key < 0) {
-			if (_pthread_key_create(&localtime_key, free) < 0) {
+			if ((r = _pthread_key_create(&localtime_key, free))
+			    != 0) {
 				_pthread_mutex_unlock(&localtime_mutex);
+				errno = r;
 				return(NULL);
 			}
 		}
@@ -1510,12 +1514,14 @@ const time_t * const	timep;
 	static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER;
 	static pthread_key_t gmtime_key = -1;
 	struct tm *p_tm;
+	int r;
 
 	if (__isthreaded != 0) {
 		_pthread_mutex_lock(&gmtime_mutex);
 		if (gmtime_key < 0) {
-			if (_pthread_key_create(&gmtime_key, free) < 0) {
+			if ((r = _pthread_key_create(&gmtime_key, free)) != 0) {
 				_pthread_mutex_unlock(&gmtime_mutex);
+				errno = r;
 				return(NULL);
 			}
 		}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 11:52:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B59A61065696;
	Thu, 29 Oct 2009 11:52:26 +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 9B9538FC0A;
	Thu, 29 Oct 2009 11:52: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 n9TBqQbp095314;
	Thu, 29 Oct 2009 11:52:26 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TBqQu3095312;
	Thu, 29 Oct 2009 11:52:26 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291152.n9TBqQu3095312@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 11:52:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198580 - in releng/8.0/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/ata/chipsets dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 11:52:26 -0000

Author: mav
Date: Thu Oct 29 11:52:26 2009
New Revision: 198580
URL: http://svn.freebsd.org/changeset/base/198580

Log:
  MFC rev. 198479:
  Fix SATA on nVidia MCP55 chipset. It needs some short time to allow
  BAR(5) memory access.
  
  PR:		amd64/128686, amd64/132372, amd64/139156
  Approved by:	re (kib)

Modified:
  releng/8.0/sys/   (props changed)
  releng/8.0/sys/amd64/include/xen/   (props changed)
  releng/8.0/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.0/sys/contrib/dev/acpica/   (props changed)
  releng/8.0/sys/contrib/pf/   (props changed)
  releng/8.0/sys/dev/ata/chipsets/ata-nvidia.c
  releng/8.0/sys/dev/xen/xenpci/   (props changed)

Modified: releng/8.0/sys/dev/ata/chipsets/ata-nvidia.c
==============================================================================
--- releng/8.0/sys/dev/ata/chipsets/ata-nvidia.c	Thu Oct 29 11:00:39 2009	(r198579)
+++ releng/8.0/sys/dev/ata/chipsets/ata-nvidia.c	Thu Oct 29 11:52:26 2009	(r198580)
@@ -165,7 +165,8 @@ ata_nvidia_chipinit(device_t dev)
 
 	    /* enable control access */
 	    pci_write_config(dev, 0x50, pci_read_config(dev, 0x50, 1) | 0x04,1);
-
+	    /* MCP55 seems to need some time to allow r_res2 read. */
+	    DELAY(10);
 	    if (ctlr->chip->cfg1 & NVQ) {
 		/* clear interrupt status */
 		ATA_OUTL(ctlr->r_res2, offset, 0x00ff00ff);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 12:19:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D38B4106566B;
	Thu, 29 Oct 2009 12:19:10 +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 C27238FC17;
	Thu, 29 Oct 2009 12:19: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 n9TCJAgP096068;
	Thu, 29 Oct 2009 12:19:10 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TCJAR7096066;
	Thu, 29 Oct 2009 12:19:10 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <200910291219.n9TCJAR7096066@svn.freebsd.org>
From: Rui Paulo 
Date: Thu, 29 Oct 2009 12:19: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: r198581 - head/sys/net80211
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 12:19:10 -0000

Author: rpaulo
Date: Thu Oct 29 12:19:10 2009
New Revision: 198581
URL: http://svn.freebsd.org/changeset/base/198581

Log:
  Update the route's sequence number upon receiving a RANN.
  
  MFC after:	3 days

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- head/sys/net80211/ieee80211_hwmp.c	Thu Oct 29 11:52:26 2009	(r198580)
+++ head/sys/net80211/ieee80211_hwmp.c	Thu Oct 29 12:19:10 2009	(r198581)
@@ -1239,15 +1239,18 @@ hwmp_recv_rann(struct ieee80211vap *vap,
 		return;
 	}
 	hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
-	if (HWMP_SEQ_GT(rann->rann_seq, hr->hr_seq) && rann->rann_ttl > 1 &&
-	    rann->rann_hopcount < hs->hs_maxhops &&
-	    (ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) {
-		memcpy(&prann, rann, sizeof(prann));
-		prann.rann_hopcount += 1;
-		prann.rann_ttl -= 1;
-		prann.rann_metric += ms->ms_pmetric->mpm_metric(ni);
-		hwmp_send_rann(vap->iv_bss, vap->iv_myaddr, broadcastaddr,
-		    &prann);
+	if (HWMP_SEQ_GT(rann->rann_seq, hr->hr_seq)) {
+		hr->hr_seq = rann->rann_seq;
+		if (rann->rann_ttl > 1 &&
+		    rann->rann_hopcount < hs->hs_maxhops &&
+		    (ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) {
+			memcpy(&prann, rann, sizeof(prann));
+			prann.rann_hopcount += 1;
+			prann.rann_ttl -= 1;
+			prann.rann_metric += ms->ms_pmetric->mpm_metric(ni);
+			hwmp_send_rann(vap->iv_bss, vap->iv_myaddr,
+			    broadcastaddr, &prann);
+		}
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:27:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2C9A1106566C;
	Thu, 29 Oct 2009 13:27:15 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1B4D08FC13;
	Thu, 29 Oct 2009 13:27: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 n9TDRESR097508;
	Thu, 29 Oct 2009 13:27:15 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDREeJ097506;
	Thu, 29 Oct 2009 13:27:14 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910291327.n9TDREeJ097506@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 29 Oct 2009 13:27: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: r198582 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:27:15 -0000

Author: nwhitehorn
Date: Thu Oct 29 13:27:14 2009
New Revision: 198582
URL: http://svn.freebsd.org/changeset/base/198582

Log:
  Turn off use of ATA_A_4BIT on modern hardware. This flag was already
  obsoleted in 1996 by ATA-2, and crashes some modern hardware like some
  revisions of the Serverworks K2 SATA controller. Even very ancient
  hardware seems not to require it. In the unlikely event this causes
  problems, the previous behavior can be re-enabled by defining
  ATA_LEGACY_SUPPORT at the top of this file.
  
  Reviewed by:	Alexander Motin 

Modified:
  head/sys/dev/ata/ata-all.h

Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Thu Oct 29 12:19:10 2009	(r198581)
+++ head/sys/dev/ata/ata-all.h	Thu Oct 29 13:27:14 2009	(r198582)
@@ -26,6 +26,11 @@
  * $FreeBSD$
  */
 
+#if 0
+#define	ATA_LEGACY_SUPPORT		/* Enable obsolete features that break
+					 * some modern devices */
+#endif
+
 /* ATA register defines */
 #define ATA_DATA                        0       /* (RW) data */
 
@@ -81,7 +86,11 @@
 #define ATA_PC98_CTLOFFSET              0x10c   /* do for PC98 devices */
 #define         ATA_A_IDS               0x02    /* disable interrupts */
 #define         ATA_A_RESET             0x04    /* RESET controller */
-#define         ATA_A_4BIT              0x08    /* 4 head bits */
+#ifdef	ATA_LEGACY_SUPPORT			
+#define         ATA_A_4BIT              0x08    /* 4 head bits: obsolete 1996 */
+#else
+#define         ATA_A_4BIT              0x00 
+#endif
 #define         ATA_A_HOB               0x80    /* High Order Byte enable */
 
 /* SATA register defines */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:28:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 013D21065696;
	Thu, 29 Oct 2009 13:28:38 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA9888FC15;
	Thu, 29 Oct 2009 13:28: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 n9TDSbHF097571;
	Thu, 29 Oct 2009 13:28:37 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDSbUC097569;
	Thu, 29 Oct 2009 13:28:37 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910291328.n9TDSbUC097569@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 29 Oct 2009 13:28: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: r198583 - head/sys/dev/ata/chipsets
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:28:38 -0000

Author: nwhitehorn
Date: Thu Oct 29 13:28:37 2009
New Revision: 198583
URL: http://svn.freebsd.org/changeset/base/198583

Log:
  Add some magic taken from OS X and Linux to support early revision K2
  SATA controllers, like those found on the G5 Xserve.
  
  Reviewed by:	mav

Modified:
  head/sys/dev/ata/chipsets/ata-serverworks.c

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-serverworks.c	Thu Oct 29 13:27:14 2009	(r198582)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c	Thu Oct 29 13:28:37 2009	(r198583)
@@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef __powerpc__
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -106,6 +109,13 @@ static int
 ata_serverworks_status(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);
+    struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
+
+    /*
+     * Check if this interrupt belongs to our channel.
+     */
+    if (!(ATA_INL(ctlr->r_res2, 0x1f80) & (1 << ch->unit)))
+	return (0);
 
     /*
      * We need to do a 4-byte read on the status reg before the values
@@ -208,8 +218,29 @@ ata_serverworks_ch_attach(device_t dev)
     ch->hw.tf_write = ata_serverworks_tf_write;
 #ifdef __powerpc__
     ch->hw.status = ata_serverworks_status;
+
+    /* Make sure that our interrupt is edge triggered */
+    powerpc_config_intr(bus_get_resource_start(device_get_parent(dev),
+	SYS_RES_IRQ, 0), INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH);
 #endif
 
+    if (ctlr->chip->chipid == ATA_K2) {
+	/*
+	 * The revision 1 K2 SATA controller has interesting bugs. Patch them.
+	 * These magic numbers regulate interrupt delivery in the first few
+	 * cases and are pure magic in the last case.
+	 *
+	 * Values obtained from the Darwin driver.
+	 */
+
+	ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, 0x04);
+	ATA_IDX_OUTL(ch, ATA_SERROR, 0xffffffff);
+	ATA_IDX_OUTL(ch, ATA_SCONTROL, 0x00000300);
+	ATA_OUTL(ctlr->r_res2, ch_offset + 0x88, 0);
+	ATA_OUTL(ctlr->r_res2, ch_offset + 0x80,
+	    ATA_INL(ctlr->r_res2, ch_offset + 0x80) & ~0x00040000);
+    }
+
     /* chip does not reliably do 64K DMA transfers */
     ch->dma.max_iosize = 64 * DEV_BSIZE;
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:41:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF791106566B;
	Thu, 29 Oct 2009 13:41:05 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 935B48FC16;
	Thu, 29 Oct 2009 13: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 n9TDf58H097868;
	Thu, 29 Oct 2009 13:41:05 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDf5aC097866;
	Thu, 29 Oct 2009 13:41:05 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910291341.n9TDf5aC097866@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 29 Oct 2009 13:41:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198584 - in stable/7/sys: . contrib/pf dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:41:05 -0000

Author: emaste
Date: Thu Oct 29 13:41:05 2009
New Revision: 198584
URL: http://svn.freebsd.org/changeset/base/198584

Log:
  MFC r195614:
  
    Get correct maxio from the controller and drop the tunable.
    The default (64K) is too pessimistic for "new comm" hardware.
    Also, this is bad because multiple controllers get limited by
    the global tunable.
  
  At this point stable/7 and stable/8 are in sync, modulo KPI changes.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/aac/aac_disk.c

Modified: stable/7/sys/dev/aac/aac_disk.c
==============================================================================
--- stable/7/sys/dev/aac/aac_disk.c	Thu Oct 29 13:28:37 2009	(r198583)
+++ stable/7/sys/dev/aac/aac_disk.c	Thu Oct 29 13:41:05 2009	(r198584)
@@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -83,18 +82,8 @@ static driver_t aac_disk_driver = {
 	sizeof(struct aac_disk)
 };
 
-#define AAC_MAXIO	65536
-
 DRIVER_MODULE(aacd, aac, aac_disk_driver, aac_disk_devclass, 0, 0);
 
-/* sysctl tunables */
-static unsigned int aac_iosize_max = AAC_MAXIO;	/* due to limits of the card */
-TUNABLE_INT("hw.aac.iosize_max", &aac_iosize_max);
-
-SYSCTL_DECL(_hw_aac);
-SYSCTL_UINT(_hw_aac, OID_AUTO, iosize_max, CTLFLAG_RDTUN, &aac_iosize_max, 0,
-	    "Max I/O size per transfer to an array");
-
 /*
  * Handle open from generic layer.
  *
@@ -236,7 +225,7 @@ aac_dump_map_sg64(void *arg, bus_dma_seg
 /*
  * Dump memory out to an array
  *
- * Send out one command at a time with up to AAC_MAXIO of data.
+ * Send out one command at a time with up to maxio of data.
  */
 static int
 aac_disk_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length)
@@ -244,7 +233,7 @@ aac_disk_dump(void *arg, void *virtual, 
 	struct aac_disk *ad;
 	struct aac_softc *sc;
 	struct aac_fib *fib;
-	size_t len;
+	size_t len, maxio;
 	int size;
 	static bus_dmamap_t dump_datamap;
 	static int first = 0;
@@ -272,7 +261,8 @@ aac_disk_dump(void *arg, void *virtual, 
 	fib = &sc->aac_common->ac_sync_fib;
 
 	while (length > 0) {
-		len = (length > AAC_MAXIO) ? AAC_MAXIO : length;
+		maxio = sc->aac_max_sectors << 9;
+		len = (length > maxio) ? maxio : length;
 		if ((sc->flags & AAC_FLAGS_SG_64BIT) == 0) {
 			struct aac_blockwrite *bw;
 			bw = (struct aac_blockwrite *)&fib->data[0];
@@ -408,7 +398,7 @@ aac_disk_attach(device_t dev)
 	sc->ad_disk = disk_alloc();
 	sc->ad_disk->d_drv1 = sc;
 	sc->ad_disk->d_name = "aacd";
-	sc->ad_disk->d_maxsize = aac_iosize_max;
+	sc->ad_disk->d_maxsize = sc->ad_controller->aac_max_sectors << 9;
 	sc->ad_disk->d_open = aac_disk_open;
 	sc->ad_disk->d_close = aac_disk_close;
 	sc->ad_disk->d_strategy = aac_disk_strategy;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:45:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E323106568D;
	Thu, 29 Oct 2009 13:45:00 +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 3364C8FC08;
	Thu, 29 Oct 2009 13:45: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 n9TDiwrK097996;
	Thu, 29 Oct 2009 13:44:58 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDiwTO097994;
	Thu, 29 Oct 2009 13:44:58 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291344.n9TDiwTO097994@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 13:44: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: r198585 - head/sbin/ddb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:45:00 -0000

Author: jhb
Date: Thu Oct 29 13:44:58 2009
New Revision: 198585
URL: http://svn.freebsd.org/changeset/base/198585

Log:
  When extracting the capture buffer from a crashdump, only read the valid
  portion of the capture buffer (db_capture_bufoff vs db_capture_bufsize).
  This could result in outputting garbage (e.g. lots of 'p' characters if
  DIAGNOSTIC is enabled) after the end of the capture buffer.  While here,
  fix a spelling nit.
  
  Reported by:	Mikolaj Golub  to my trociny of gmail
  MFC after:	3 days

Modified:
  head/sbin/ddb/ddb_capture.c

Modified: head/sbin/ddb/ddb_capture.c
==============================================================================
--- head/sbin/ddb/ddb_capture.c	Thu Oct 29 13:41:05 2009	(r198584)
+++ head/sbin/ddb/ddb_capture.c	Thu Oct 29 13:44:58 2009	(r198585)
@@ -95,24 +95,24 @@ kread_symbol(kvm_t *kvm, int index, void
 static void
 ddb_capture_print_kvm(kvm_t *kvm)
 {
-	u_int db_capture_bufsize;
+	u_int db_capture_bufoff;
 	char *buffer, *db_capture_buf;
 
 	if (kread_symbol(kvm, X_DB_CAPTURE_BUF, &db_capture_buf,
 	    sizeof(db_capture_buf), 0) < 0)
 		errx(-1, "kvm: unable to read db_capture_buf");
 
-	if (kread_symbol(kvm, X_DB_CAPTURE_BUFSIZE, &db_capture_bufsize,
-	    sizeof(db_capture_bufsize), 0) < 0)
-		errx(-1, "kvm: unable to read db_capture_bufsize");
+	if (kread_symbol(kvm, X_DB_CAPTURE_BUFOFF, &db_capture_bufoff,
+	    sizeof(db_capture_bufoff), 0) < 0)
+		errx(-1, "kvm: unable to read db_capture_bufoff");
 
-	buffer = malloc(db_capture_bufsize + 1);
+	buffer = malloc(db_capture_bufoff + 1);
 	if (buffer == NULL)
-		err(-1, "malloc: db_capture_bufsize (%u)",
-		    db_capture_bufsize);
-	bzero(buffer, db_capture_bufsize + 1);
+		err(-1, "malloc: db_capture_bufoff (%u)",
+		    db_capture_bufoff);
+	bzero(buffer, db_capture_bufoff + 1);
 
-	if (kread(kvm, db_capture_buf, buffer, db_capture_bufsize, 0) < 0)
+	if (kread(kvm, db_capture_buf, buffer, db_capture_bufoff, 0) < 0)
 		errx(-1, "kvm: unable to read buffer");
 
 	printf("%s\n", buffer);
@@ -161,7 +161,7 @@ ddb_capture_status_kvm(kvm_t *kvm)
 		errx(-1, "kvm: unable to read db_capture_bufsize");
 	if (kread_symbol(kvm, X_DB_CAPTURE_INPROGRESS,
 	    &db_capture_inprogress, sizeof(db_capture_inprogress), 0) < 0)
-		err(-1, "kvm: unable to read db_capture_inpgoress");
+		err(-1, "kvm: unable to read db_capture_inprogress");
 	printf("%u/%u bytes used\n", db_capture_bufoff, db_capture_bufsize);
 	if (db_capture_inprogress)
 		printf("capture is on\n");

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:45:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95281106568D;
	Thu, 29 Oct 2009 13:45:33 +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 847D18FC1F;
	Thu, 29 Oct 2009 13: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 n9TDjXER098055;
	Thu, 29 Oct 2009 13:45:33 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDjXAV098053;
	Thu, 29 Oct 2009 13:45:33 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291345.n9TDjXAV098053@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 13: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: r198586 - head/usr.sbin/crashinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:45:33 -0000

Author: jhb
Date: Thu Oct 29 13:45:33 2009
New Revision: 198586
URL: http://svn.freebsd.org/changeset/base/198586

Log:
  Include the output of the ddb(4) capture buffer.
  
  Submitted by:	Mikolaj Golub  to my trociny of gmail
  MFC after:	3 days

Modified:
  head/usr.sbin/crashinfo/crashinfo.sh

Modified: head/usr.sbin/crashinfo/crashinfo.sh
==============================================================================
--- head/usr.sbin/crashinfo/crashinfo.sh	Thu Oct 29 13:44:58 2009	(r198585)
+++ head/usr.sbin/crashinfo/crashinfo.sh	Thu Oct 29 13:45:33 2009	(r198586)
@@ -304,3 +304,10 @@ echo "----------------------------------
 echo "kernel config"
 echo
 config -x $KERNEL
+
+echo
+echo "------------------------------------------------------------------------"
+echo "ddb capture buffer"
+echo
+
+ddb capture -M $VMCORE -N $KERNEL print

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 13:52:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7E0B6106566B;
	Thu, 29 Oct 2009 13:52:34 +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 6D9048FC1E;
	Thu, 29 Oct 2009 13:52: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 n9TDqY8h098258;
	Thu, 29 Oct 2009 13:52:34 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TDqYCT098256;
	Thu, 29 Oct 2009 13:52:34 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291352.n9TDqYCT098256@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 13:52: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: r198587 - head/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 13:52:34 -0000

Author: mav
Date: Thu Oct 29 13:52:34 2009
New Revision: 198587
URL: http://svn.freebsd.org/changeset/base/198587

Log:
  Define identify fields described in CF specification.

Modified:
  head/sys/sys/ata.h

Modified: head/sys/sys/ata.h
==============================================================================
--- head/sys/sys/ata.h	Thu Oct 29 13:45:33 2009	(r198586)
+++ head/sys/sys/ata.h	Thu Oct 29 13:52:34 2009	(r198587)
@@ -226,7 +226,11 @@ struct ata_params {
 /*128*/ u_int16_t       security_status;
 	u_int16_t       reserved129[31];
 /*160*/ u_int16_t       cfa_powermode1;
-	u_int16_t       reserved161[15];
+	u_int16_t       reserved161;
+/*162*/ u_int16_t       cfa_kms_support;
+/*163*/ u_int16_t       cfa_trueide_modes;
+/*164*/ u_int16_t       cfa_memory_modes;
+	u_int16_t       reserved165[11];
 /*176*/ u_int8_t        media_serial[60];
 /*206*/ u_int16_t       sct;
 	u_int16_t       reserved206[2];

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:22:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 728021065693;
	Thu, 29 Oct 2009 14:22:09 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 619CE8FC1C;
	Thu, 29 Oct 2009 14:22: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 n9TEM9rw098993;
	Thu, 29 Oct 2009 14:22:09 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TEM9iL098991;
	Thu, 29 Oct 2009 14:22:09 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910291422.n9TEM9iL098991@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Thu, 29 Oct 2009 14:22: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: r198588 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:22:09 -0000

Author: nwhitehorn
Date: Thu Oct 29 14:22:09 2009
New Revision: 198588
URL: http://svn.freebsd.org/changeset/base/198588

Log:
  Turn off Altivec data-stream prefetching before going into power-save
  mode on those CPUs that need it.

Modified:
  head/sys/powerpc/aim/machdep.c

Modified: head/sys/powerpc/aim/machdep.c
==============================================================================
--- head/sys/powerpc/aim/machdep.c	Thu Oct 29 13:52:34 2009	(r198587)
+++ head/sys/powerpc/aim/machdep.c	Thu Oct 29 14:22:09 2009	(r198588)
@@ -897,8 +897,10 @@ void
 cpu_idle(int busy)
 {
 	uint32_t msr;
+	uint16_t vers;
 
 	msr = mfmsr();
+	vers = mfpvr() >> 16;
 
 #ifdef INVARIANTS
 	if ((msr & PSL_EE) != PSL_EE) {
@@ -908,9 +910,25 @@ cpu_idle(int busy)
 	}
 #endif
 	if (powerpc_pow_enabled) {
-		powerpc_sync();
-		mtmsr(msr | PSL_POW);
-		isync();
+		switch (vers) {
+		case IBM970:
+		case IBM970FX:
+		case IBM970MP:
+		case MPC7447A:
+		case MPC7448:
+		case MPC7450:
+		case MPC7455:
+		case MPC7457:
+			__asm __volatile("\
+			    dssall; sync; mtmsr %0; isync"
+			    :: "r"(msr | PSL_POW));
+			break;
+		default:
+			powerpc_sync();
+			mtmsr(msr | PSL_POW);
+			isync();
+			break;
+		}
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:34:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D72B1065670;
	Thu, 29 Oct 2009 14:34: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 1951E8FC17;
	Thu, 29 Oct 2009 14:34: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 n9TEY24V099349;
	Thu, 29 Oct 2009 14:34:02 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TEY2Sj099334;
	Thu, 29 Oct 2009 14:34:02 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291434.n9TEY2Sj099334@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 14:34:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198589 - in stable/7/sys: . amd64/amd64 amd64/include
	conf contrib/pf i386/i386 i386/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:34:03 -0000

Author: jhb
Date: Thu Oct 29 14:34:02 2009
New Revision: 198589
URL: http://svn.freebsd.org/changeset/base/198589

Log:
  MFC 192050, 192343, 192440:
  Implement simple machine check support for amd64 and i386.  It is disabled
  by default but can be enabled via the 'hw.mca.enabled' tunable.

Added:
  stable/7/sys/amd64/amd64/mca.c
     - copied, changed from r192050, head/sys/amd64/amd64/mca.c
  stable/7/sys/amd64/include/mca.h
     - copied unchanged from r192050, head/sys/amd64/include/mca.h
  stable/7/sys/i386/i386/mca.c
     - copied, changed from r192050, head/sys/i386/i386/mca.c
  stable/7/sys/i386/include/mca.h
     - copied unchanged from r192050, head/sys/i386/include/mca.h
Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/machdep.c
  stable/7/sys/amd64/amd64/mp_machdep.c
  stable/7/sys/amd64/amd64/trap.c
  stable/7/sys/amd64/include/specialreg.h
  stable/7/sys/conf/files.amd64
  stable/7/sys/conf/files.i386
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/i386/i386/machdep.c
  stable/7/sys/i386/i386/mp_machdep.c
  stable/7/sys/i386/i386/trap.c
  stable/7/sys/i386/include/specialreg.h

Modified: stable/7/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/machdep.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/amd64/amd64/machdep.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -109,6 +109,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -261,6 +262,7 @@ cpu_startup(dummy)
 	vm_pager_bufferinit();
 
 	cpu_setregs();
+	mca_init();
 }
 
 /*

Copied and modified: stable/7/sys/amd64/amd64/mca.c (from r192050, head/sys/amd64/amd64/mca.c)
==============================================================================
--- head/sys/amd64/amd64/mca.c	Wed May 13 17:53:04 2009	(r192050, copy source)
+++ stable/7/sys/amd64/amd64/mca.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -55,10 +55,15 @@ struct mca_internal {
 
 static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture");
 
-static struct sysctl_oid *mca_sysctl_tree;
-
 static int mca_count;		/* Number of records stored. */
 
+SYSCTL_NODE(_hw, OID_AUTO, mca, CTLFLAG_RD, NULL, "Machine Check Architecture");
+
+static int mca_enabled = 0;
+TUNABLE_INT("hw.mca.enabled", &mca_enabled);
+SYSCTL_INT(_hw_mca, OID_AUTO, enabled, CTLFLAG_RDTUN, &mca_enabled, 0,
+    "Administrative toggle for machine check support");
+
 static STAILQ_HEAD(, mca_internal) mca_records;
 static struct callout mca_timer;
 static int mca_ticks = 3600;	/* Check hourly by default. */
@@ -346,7 +351,7 @@ mca_scan(int mcip)
 
 	/* When handling a MCE#, treat the OVER flag as non-restartable. */
 	if (mcip)
-		ucmask = MC_STATUS_OVER;
+		ucmask |= MC_STATUS_OVER;
 	mcg_cap = rdmsr(MSR_MCG_CAP);
 	for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
 		rec = mca_record_entry(i);
@@ -426,7 +431,7 @@ static void
 mca_startup(void *dummy)
 {
 
-	if (!(cpu_feature & CPUID_MCA))
+	if (!mca_enabled || !(cpu_feature & CPUID_MCA))
 		return;
 
 	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan,
@@ -442,17 +447,15 @@ mca_setup(void)
 	STAILQ_INIT(&mca_records);
 	TASK_INIT(&mca_task, 0x8000, mca_scan_cpus, NULL);
 	callout_init(&mca_timer, CALLOUT_MPSAFE);
-	mca_sysctl_tree = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw),
-	    OID_AUTO, "mca", CTLFLAG_RW, NULL, "MCA container");
-	SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "count", CTLFLAG_RD, &mca_count, 0, "Record count");
-	SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "interval", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &mca_ticks,
 	    0, sysctl_mca_ticks, "I",
 	    "Periodic interval in seconds to scan for machine checks");
-	SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "records", CTLFLAG_RD, sysctl_mca_records, "Machine check records");
-	SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "force_scan", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0,
 	    sysctl_mca_scan, "I", "Force an immediate scan for machine checks");
 }
@@ -465,7 +468,7 @@ mca_init(void)
 	int i;
 
 	/* MCE is required. */
-	if (!(cpu_feature & CPUID_MCE))
+	if (!mca_enabled || !(cpu_feature & CPUID_MCE))
 		return;
 
 	if (cpu_feature & CPUID_MCA) {
@@ -488,10 +491,6 @@ mca_init(void)
 			if (!(i == 0 && (cpu_id & 0xf00) == 0x600))
 				wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL);
 
-			/* XXX: Better CPU test needed here. */
-			if ((cpu_id & 0xf00) == 0xf00)
-				mca_record_entry(i);
-
 			/* Clear all errors. */
 			wrmsr(MSR_MC_STATUS(i), 0);
 		}

Modified: stable/7/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/mp_machdep.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/amd64/amd64/mp_machdep.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -562,6 +563,8 @@ init_secondary(void)
 	KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
 	PCPU_SET(curthread, PCPU_GET(idlethread));
 
+	mca_init();
+
 	mtx_lock_spin(&ap_boot_mtx);
 
 	/* Init local apic for irq's */

Modified: stable/7/sys/amd64/amd64/trap.c
==============================================================================
--- stable/7/sys/amd64/amd64/trap.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/amd64/amd64/trap.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef SMP
@@ -228,6 +229,12 @@ trap(struct trapframe *frame)
 		goto out;
 #endif
 
+	if (type == T_MCHK) {
+		if (!mca_intr())
+			trap_fatal(frame, 0);
+		goto out;
+	}
+
 #ifdef KDTRACE_HOOKS
 	/*
 	 * A trap can occur while DTrace executes a probe. Before

Copied: stable/7/sys/amd64/include/mca.h (from r192050, head/sys/amd64/include/mca.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/sys/amd64/include/mca.h	Thu Oct 29 14:34:02 2009	(r198589, copy of r192050, head/sys/amd64/include/mca.h)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2009 Advanced Computing Technologies LLC
+ * Written by: John H. Baldwin 
+ * 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$
+ */
+
+#ifndef __MACHINE_MCA_H__
+#define	__MACHINE_MCA_H__
+
+struct mca_record {
+	uint64_t	mr_status;
+	uint64_t	mr_addr;
+	uint64_t	mr_misc;
+	uint64_t	mr_tsc;
+	int		mr_apic_id;
+};
+
+#ifdef _KERNEL
+
+void	mca_init(void);
+int	mca_intr(void);
+
+#endif
+
+#endif /* !__MACHINE_MCA_H__ */

Modified: stable/7/sys/amd64/include/specialreg.h
==============================================================================
--- stable/7/sys/amd64/include/specialreg.h	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/amd64/include/specialreg.h	Thu Oct 29 14:34:02 2009	(r198589)
@@ -339,6 +339,34 @@
 #define	DIR1			0xff
 
 /*
+ * Machine Check register constants.
+ */
+#define	MCG_CAP_COUNT		0x000000ff
+#define	MCG_CAP_CTL_P		0x00000100
+#define	MCG_CAP_EXT_P		0x00000200
+#define	MCG_CAP_TES_P		0x00000800
+#define	MCG_CAP_EXT_CNT		0x00ff0000
+#define	MCG_STATUS_RIPV		0x00000001
+#define	MCG_STATUS_EIPV		0x00000002
+#define	MCG_STATUS_MCIP		0x00000004
+#define	MCG_CTL_ENABLE		0xffffffffffffffffUL
+#define	MCG_CTL_DISABLE		0x0000000000000000UL
+#define	MSR_MC_CTL(x)		(MSR_MC0_CTL + (x) * 4)
+#define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
+#define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
+#define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
+#define	MC_STATUS_MCA_ERROR	0x000000000000ffffUL
+#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000UL
+#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000UL
+#define	MC_STATUS_PCC		0x0200000000000000UL
+#define	MC_STATUS_ADDRV		0x0400000000000000UL
+#define	MC_STATUS_MISCV		0x0800000000000000UL
+#define	MC_STATUS_EN		0x1000000000000000UL
+#define	MC_STATUS_UC		0x2000000000000000UL
+#define	MC_STATUS_OVER		0x4000000000000000UL
+#define	MC_STATUS_VAL		0x8000000000000000UL
+
+/*
  * The following four 3-byte registers control the non-cacheable regions.
  * These registers must be written as three separate bytes.
  *

Modified: stable/7/sys/conf/files.amd64
==============================================================================
--- stable/7/sys/conf/files.amd64	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/conf/files.amd64	Thu Oct 29 14:34:02 2009	(r198589)
@@ -99,6 +99,7 @@ amd64/amd64/legacy.c		standard
 amd64/amd64/local_apic.c	standard
 amd64/amd64/locore.S		standard	no-obj
 amd64/amd64/machdep.c		standard
+amd64/amd64/mca.c		standard
 amd64/amd64/mem.c		optional	mem
 amd64/amd64/minidump_machdep.c	standard
 amd64/amd64/mp_machdep.c	optional	smp

Modified: stable/7/sys/conf/files.i386
==============================================================================
--- stable/7/sys/conf/files.i386	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/conf/files.i386	Thu Oct 29 14:34:02 2009	(r198589)
@@ -282,6 +282,7 @@ i386/i386/local_apic.c		optional apic
 i386/i386/locore.s		standard	no-obj
 i386/i386/longrun.c		optional cpu_enable_longrun
 i386/i386/machdep.c		standard
+i386/i386/mca.c			standard
 i386/i386/mem.c			optional mem
 i386/i386/minidump_machdep.c	standard
 i386/i386/mp_clock.c		optional smp

Modified: stable/7/sys/i386/i386/machdep.c
==============================================================================
--- stable/7/sys/i386/i386/machdep.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/i386/i386/machdep.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -114,6 +114,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -290,6 +291,7 @@ cpu_startup(dummy)
 	vm_pager_bufferinit();
 
 	cpu_setregs();
+	mca_init();
 }
 
 /*

Copied and modified: stable/7/sys/i386/i386/mca.c (from r192050, head/sys/i386/i386/mca.c)
==============================================================================
--- head/sys/i386/i386/mca.c	Wed May 13 17:53:04 2009	(r192050, copy source)
+++ stable/7/sys/i386/i386/mca.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -55,10 +55,15 @@ struct mca_internal {
 
 static MALLOC_DEFINE(M_MCA, "MCA", "Machine Check Architecture");
 
-static struct sysctl_oid *mca_sysctl_tree;
-
 static int mca_count;		/* Number of records stored. */
 
+SYSCTL_NODE(_hw, OID_AUTO, mca, CTLFLAG_RD, NULL, "Machine Check Architecture");
+
+static int mca_enabled = 0;
+TUNABLE_INT("hw.mca.enabled", &mca_enabled);
+SYSCTL_INT(_hw_mca, OID_AUTO, enabled, CTLFLAG_RDTUN, &mca_enabled, 0,
+    "Administrative toggle for machine check support");
+
 static STAILQ_HEAD(, mca_internal) mca_records;
 static struct callout mca_timer;
 static int mca_ticks = 3600;	/* Check hourly by default. */
@@ -346,7 +351,7 @@ mca_scan(int mcip)
 
 	/* When handling a MCE#, treat the OVER flag as non-restartable. */
 	if (mcip)
-		ucmask = MC_STATUS_OVER;
+		ucmask |= MC_STATUS_OVER;
 	mcg_cap = rdmsr(MSR_MCG_CAP);
 	for (i = 0; i < (mcg_cap & MCG_CAP_COUNT); i++) {
 		rec = mca_record_entry(i);
@@ -426,7 +431,7 @@ static void
 mca_startup(void *dummy)
 {
 
-	if (!(cpu_feature & CPUID_MCA))
+	if (!mca_enabled || !(cpu_feature & CPUID_MCA))
 		return;
 
 	callout_reset(&mca_timer, mca_ticks * hz, mca_periodic_scan,
@@ -442,17 +447,15 @@ mca_setup(void)
 	STAILQ_INIT(&mca_records);
 	TASK_INIT(&mca_task, 0x8000, mca_scan_cpus, NULL);
 	callout_init(&mca_timer, CALLOUT_MPSAFE);
-	mca_sysctl_tree = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw),
-	    OID_AUTO, "mca", CTLFLAG_RW, NULL, "MCA container");
-	SYSCTL_ADD_INT(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "count", CTLFLAG_RD, &mca_count, 0, "Record count");
-	SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "interval", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, &mca_ticks,
 	    0, sysctl_mca_ticks, "I",
 	    "Periodic interval in seconds to scan for machine checks");
-	SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "records", CTLFLAG_RD, sysctl_mca_records, "Machine check records");
-	SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(mca_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_PROC(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO,
 	    "force_scan", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0,
 	    sysctl_mca_scan, "I", "Force an immediate scan for machine checks");
 }
@@ -465,7 +468,7 @@ mca_init(void)
 	int i;
 
 	/* MCE is required. */
-	if (!(cpu_feature & CPUID_MCE))
+	if (!mca_enabled || !(cpu_feature & CPUID_MCE))
 		return;
 
 	if (cpu_feature & CPUID_MCA) {
@@ -488,10 +491,6 @@ mca_init(void)
 			if (!(i == 0 && (cpu_id & 0xf00) == 0x600))
 				wrmsr(MSR_MC_CTL(i), 0xffffffffffffffffUL);
 
-			/* XXX: Better CPU test needed here. */
-			if ((cpu_id & 0xf00) == 0xf00)
-				mca_record_entry(i);
-
 			/* Clear all errors. */
 			wrmsr(MSR_MC_STATUS(i), 0);
 		}

Modified: stable/7/sys/i386/i386/mp_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/mp_machdep.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/i386/i386/mp_machdep.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -612,6 +613,8 @@ init_secondary(void)
 	KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread"));
 	PCPU_SET(curthread, PCPU_GET(idlethread));
 
+	mca_init();
+
 	mtx_lock_spin(&ap_boot_mtx);
 
 	/* Init local apic for irq's */

Modified: stable/7/sys/i386/i386/trap.c
==============================================================================
--- stable/7/sys/i386/i386/trap.c	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/i386/i386/trap.c	Thu Oct 29 14:34:02 2009	(r198589)
@@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #ifdef SMP
@@ -242,6 +243,12 @@ trap(struct trapframe *frame)
 	    goto out;
 #endif
 
+	if (type == T_MCHK) {
+		if (!mca_intr())
+			trap_fatal(frame, 0);
+		goto out;
+	}
+
 #ifdef KDTRACE_HOOKS
 	/*
 	 * A trap can occur while DTrace executes a probe. Before

Copied: stable/7/sys/i386/include/mca.h (from r192050, head/sys/i386/include/mca.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/sys/i386/include/mca.h	Thu Oct 29 14:34:02 2009	(r198589, copy of r192050, head/sys/i386/include/mca.h)
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2009 Advanced Computing Technologies LLC
+ * Written by: John H. Baldwin 
+ * 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$
+ */
+
+#ifndef __MACHINE_MCA_H__
+#define	__MACHINE_MCA_H__
+
+struct mca_record {
+	uint64_t	mr_status;
+	uint64_t	mr_addr;
+	uint64_t	mr_misc;
+	uint64_t	mr_tsc;
+	int		mr_apic_id;
+};
+
+#ifdef _KERNEL
+
+void	mca_init(void);
+int	mca_intr(void);
+
+#endif
+
+#endif /* !__MACHINE_MCA_H__ */

Modified: stable/7/sys/i386/include/specialreg.h
==============================================================================
--- stable/7/sys/i386/include/specialreg.h	Thu Oct 29 14:22:09 2009	(r198588)
+++ stable/7/sys/i386/include/specialreg.h	Thu Oct 29 14:34:02 2009	(r198589)
@@ -408,6 +408,34 @@
 #define	DIR1			0xff
 
 /*
+ * Machine Check register constants.
+ */
+#define	MCG_CAP_COUNT		0x000000ff
+#define	MCG_CAP_CTL_P		0x00000100
+#define	MCG_CAP_EXT_P		0x00000200
+#define	MCG_CAP_TES_P		0x00000800
+#define	MCG_CAP_EXT_CNT		0x00ff0000
+#define	MCG_STATUS_RIPV		0x00000001
+#define	MCG_STATUS_EIPV		0x00000002
+#define	MCG_STATUS_MCIP		0x00000004
+#define	MCG_CTL_ENABLE		0xffffffffffffffffUL
+#define	MCG_CTL_DISABLE		0x0000000000000000UL
+#define	MSR_MC_CTL(x)		(MSR_MC0_CTL + (x) * 4)
+#define	MSR_MC_STATUS(x)	(MSR_MC0_STATUS + (x) * 4)
+#define	MSR_MC_ADDR(x)		(MSR_MC0_ADDR + (x) * 4)
+#define	MSR_MC_MISC(x)		(MSR_MC0_MISC + (x) * 4)
+#define	MC_STATUS_MCA_ERROR	0x000000000000ffffUL
+#define	MC_STATUS_MODEL_ERROR	0x00000000ffff0000UL
+#define	MC_STATUS_OTHER_INFO	0x01ffffff00000000UL
+#define	MC_STATUS_PCC		0x0200000000000000UL
+#define	MC_STATUS_ADDRV		0x0400000000000000UL
+#define	MC_STATUS_MISCV		0x0800000000000000UL
+#define	MC_STATUS_EN		0x1000000000000000UL
+#define	MC_STATUS_UC		0x2000000000000000UL
+#define	MC_STATUS_OVER		0x4000000000000000UL
+#define	MC_STATUS_VAL		0x8000000000000000UL
+
+/*
  * The following four 3-byte registers control the non-cacheable regions.
  * These registers must be written as three separate bytes.
  *

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:34:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 463501065700;
	Thu, 29 Oct 2009 14:34:25 +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 35A7B8FC0C;
	Thu, 29 Oct 2009 14:34: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 n9TEYO89099390;
	Thu, 29 Oct 2009 14:34:24 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TEYOVJ099388;
	Thu, 29 Oct 2009 14:34:24 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291434.n9TEYOVJ099388@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 14:34: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: r198590 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:34:25 -0000

Author: kib
Date: Thu Oct 29 14:34:24 2009
New Revision: 198590
URL: http://svn.freebsd.org/changeset/base/198590

Log:
  Trapsignal() calls kern_sigprocmask() when delivering catched signal
  with proc lock held.
  
  Reported and tested by:	Mykola Dzham  freebsd at levsha org ua
  MFC after:	1 month

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Thu Oct 29 14:34:02 2009	(r198589)
+++ head/sys/kern/kern_sig.c	Thu Oct 29 14:34:24 2009	(r198590)
@@ -1863,7 +1863,8 @@ trapsignal(struct thread *td, ksiginfo_t
 		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
 			SIGEMPTYSET(mask);
 			SIGADDSET(mask, sig);
-			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL, 0);
+			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
+			    SIGPROCMASK_PROC_LOCKED);
 		}
 		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
 			/*

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:40:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B7C3106566C;
	Thu, 29 Oct 2009 14:40:21 +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 389588FC08;
	Thu, 29 Oct 2009 14:40:21 +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 n9TEeL9q099562;
	Thu, 29 Oct 2009 14:40:21 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TEeLL2099559;
	Thu, 29 Oct 2009 14:40:21 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291440.n9TEeLL2099559@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 14:40:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198591 - in stable/8/usr.sbin/acpi: . acpidump
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:40:21 -0000

Author: jhb
Date: Thu Oct 29 14:40:21 2009
New Revision: 198591
URL: http://svn.freebsd.org/changeset/base/198591

Log:
  MFC 196555:
  - Use the headers from ACPI-CA to define various constants and structures
    for table layouts, etc. rather than homerolling our own structures and
    constants in acpidump.h.
  - Verify the extended checksum on the RSDP.
  - Handle new ACPI 3.0 fields in MADT including X2APIC entries and
    UIDs for local SAPICs.
  - Add handling for new ACPI 3.0 flags in the FADT.

Modified:
  stable/8/usr.sbin/acpi/   (props changed)
  stable/8/usr.sbin/acpi/acpidump/acpi.c
  stable/8/usr.sbin/acpi/acpidump/acpi_user.c
  stable/8/usr.sbin/acpi/acpidump/acpidump.c
  stable/8/usr.sbin/acpi/acpidump/acpidump.h

Modified: stable/8/usr.sbin/acpi/acpidump/acpi.c
==============================================================================
--- stable/8/usr.sbin/acpi/acpidump/acpi.c	Thu Oct 29 14:34:24 2009	(r198590)
+++ stable/8/usr.sbin/acpi/acpidump/acpi.c	Thu Oct 29 14:40:21 2009	(r198591)
@@ -47,31 +47,36 @@
 #define END_COMMENT	" */\n"
 
 static void	acpi_print_string(char *s, size_t length);
-static void	acpi_print_gas(struct ACPIgas *gas);
-static int	acpi_get_fadt_revision(struct FADTbody *fadt);
-static void	acpi_handle_fadt(struct ACPIsdt *fadt);
+static void	acpi_print_gas(ACPI_GENERIC_ADDRESS *gas);
+static int	acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt);
+static void	acpi_handle_fadt(ACPI_TABLE_HEADER *fadt);
 static void	acpi_print_cpu(u_char cpu_id);
-static void	acpi_print_local_apic(u_char cpu_id, u_char apic_id,
-				      u_int32_t flags);
-static void	acpi_print_io_apic(u_char apic_id, u_int32_t int_base,
-				   u_int64_t apic_addr);
-static void	acpi_print_mps_flags(u_int16_t flags);
-static void	acpi_print_intr(u_int32_t intr, u_int16_t mps_flags);
-static void	acpi_print_apic(struct MADT_APIC *mp);
-static void	acpi_handle_apic(struct ACPIsdt *sdp);
-static void	acpi_handle_hpet(struct ACPIsdt *sdp);
+static void	acpi_print_cpu_uid(uint32_t uid, char *uid_string);
+static void	acpi_print_local_apic(uint32_t apic_id, uint32_t flags);
+static void	acpi_print_io_apic(uint32_t apic_id, uint32_t int_base,
+		    uint64_t apic_addr);
+static void	acpi_print_mps_flags(uint16_t flags);
+static void	acpi_print_intr(uint32_t intr, uint16_t mps_flags);
+static void	acpi_print_local_nmi(u_int lint, uint16_t mps_flags);
+static void	acpi_print_madt(ACPI_SUBTABLE_HEADER *mp);
+static void	acpi_handle_madt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
 static void	acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
 		    uint32_t flags);
-static void	acpi_print_srat_memory(struct SRAT_memory *mp);
-static void	acpi_print_srat(struct SRATentry *srat);
-static void	acpi_handle_srat(struct ACPIsdt *sdp);
-static void	acpi_print_sdt(struct ACPIsdt *sdp);
-static void	acpi_print_fadt(struct ACPIsdt *sdp);
-static void	acpi_print_facs(struct FACSbody *facs);
-static void	acpi_print_dsdt(struct ACPIsdt *dsdp);
-static struct ACPIsdt *acpi_map_sdt(vm_offset_t pa);
-static void	acpi_print_rsd_ptr(struct ACPIrsdp *rp);
-static void	acpi_handle_rsdt(struct ACPIsdt *rsdp);
+static void	acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp);
+static void	acpi_print_srat(ACPI_SUBTABLE_HEADER *srat);
+static void	acpi_handle_srat(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_sdt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_fadt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_facs(ACPI_TABLE_FACS *facs);
+static void	acpi_print_dsdt(ACPI_TABLE_HEADER *dsdp);
+static ACPI_TABLE_HEADER *acpi_map_sdt(vm_offset_t pa);
+static void	acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp);
+static void	acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp);
+static void	acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
+		    void (*action)(ACPI_SUBTABLE_HEADER *));
 
 /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */
 static int addr_size;
@@ -92,41 +97,44 @@ acpi_print_string(char *s, size_t length
 }
 
 static void
-acpi_print_gas(struct ACPIgas *gas)
+acpi_print_gas(ACPI_GENERIC_ADDRESS *gas)
 {
-	switch(gas->address_space_id) {
+	switch(gas->SpaceId) {
 	case ACPI_GAS_MEMORY:
-		printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_IO:
-		printf("0x%02lx:%u[%u] (IO)", (u_long)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_PCI:
-		printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->address >> 32),
-		       (uint16_t)((gas->address >> 16) & 0xffff),
-		       (uint16_t)gas->address);
+		printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
+		       (uint16_t)((gas->Address >> 16) & 0xffff),
+		       (uint16_t)gas->Address);
 		break;
 	/* XXX How to handle these below? */
 	case ACPI_GAS_EMBEDDED:
-		printf("0x%x:%u[%u] (EC)", (uint16_t)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%x:%u[%u] (EC)", (uint16_t)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_SMBUS:
-		printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
+	case ACPI_GAS_CMOS:
+	case ACPI_GAS_PCIBAR:
+	case ACPI_GAS_DATATABLE:
 	case ACPI_GAS_FIXED:
 	default:
-		printf("0x%08lx (?)", (u_long)gas->address);
+		printf("0x%08lx (?)", (u_long)gas->Address);
 		break;
 	}
 }
 
 /* The FADT revision indicates whether we use the DSDT or X_DSDT addresses. */
 static int
-acpi_get_fadt_revision(struct FADTbody *fadt)
+acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt)
 {
 	int fadt_revision;
 
@@ -141,8 +149,8 @@ acpi_get_fadt_revision(struct FADTbody *
 		 * 32 and 64 bit versions don't match, prefer the 32 bit
 		 * version for all subsequent tables.
 		 */
-		if (fadt->facs_ptr != 0 &&
-		    (fadt->x_facs_ptr & 0xffffffff) != fadt->facs_ptr)
+		if (fadt->Facs != 0 &&
+		    (fadt->XFacs & 0xffffffff) != fadt->Facs)
 			fadt_revision = 1;
 	} else
 		fadt_revision = 1;
@@ -150,35 +158,52 @@ acpi_get_fadt_revision(struct FADTbody *
 }
 
 static void
-acpi_handle_fadt(struct ACPIsdt *sdp)
+acpi_handle_fadt(ACPI_TABLE_HEADER *sdp)
 {
-	struct ACPIsdt	*dsdp;
-	struct FACSbody	*facs;
-	struct FADTbody *fadt;
+	ACPI_TABLE_HEADER *dsdp;
+	ACPI_TABLE_FACS	*facs;
+	ACPI_TABLE_FADT *fadt;
 	int		fadt_revision;
 
-	fadt = (struct FADTbody *)sdp->body;
+	fadt = (ACPI_TABLE_FADT *)sdp;
 	acpi_print_fadt(sdp);
 
 	fadt_revision = acpi_get_fadt_revision(fadt);
 	if (fadt_revision == 1)
-		facs = (struct FACSbody *)acpi_map_sdt(fadt->facs_ptr);
+		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->Facs);
 	else
-		facs = (struct FACSbody *)acpi_map_sdt(fadt->x_facs_ptr);
-	if (memcmp(facs->signature, "FACS", 4) != 0 || facs->len < 64)
+		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->XFacs);
+	if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64)
 		errx(1, "FACS is corrupt");
 	acpi_print_facs(facs);
 
 	if (fadt_revision == 1)
-		dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->dsdt_ptr);
+		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt);
 	else
-		dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->x_dsdt_ptr);
-	if (acpi_checksum(dsdp, dsdp->len))
+		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt);
+	if (acpi_checksum(dsdp, dsdp->Length))
 		errx(1, "DSDT is corrupt");
 	acpi_print_dsdt(dsdp);
 }
 
 static void
+acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
+    void (*action)(ACPI_SUBTABLE_HEADER *))
+{
+	ACPI_SUBTABLE_HEADER *subtable;
+	char *end;
+
+	subtable = first;
+	end = (char *)table + table->Length;
+	while ((char *)subtable < end) {
+		printf("\n");
+		action(subtable);
+		subtable = (ACPI_SUBTABLE_HEADER *)((char *)subtable +
+		    subtable->Length);
+	}
+}
+
+static void
 acpi_print_cpu(u_char cpu_id)
 {
 
@@ -190,219 +215,264 @@ acpi_print_cpu(u_char cpu_id)
 }
 
 static void
-acpi_print_local_apic(u_char cpu_id, u_char apic_id, u_int32_t flags)
+acpi_print_cpu_uid(uint32_t uid, char *uid_string)
 {
-	acpi_print_cpu(cpu_id);
+
+	printf("\tUID=%d", uid);
+	if (uid_string != NULL)
+		printf(" (%s)", uid_string);
+	printf("\n");
+}
+
+static void
+acpi_print_local_apic(uint32_t apic_id, uint32_t flags)
+{
+
 	printf("\tFlags={");
-	if (flags & ACPI_MADT_APIC_LOCAL_FLAG_ENABLED)
+	if (flags & ACPI_MADT_ENABLED)
 		printf("ENABLED");
 	else
 		printf("DISABLED");
 	printf("}\n");
-	printf("\tAPIC ID=%d\n", (u_int)apic_id);
+	printf("\tAPIC ID=%d\n", apic_id);
 }
 
 static void
-acpi_print_io_apic(u_char apic_id, u_int32_t int_base, u_int64_t apic_addr)
+acpi_print_io_apic(uint32_t apic_id, uint32_t int_base, uint64_t apic_addr)
 {
-	printf("\tAPIC ID=%d\n", (u_int)apic_id);
+
+	printf("\tAPIC ID=%d\n", apic_id);
 	printf("\tINT BASE=%d\n", int_base);
-	printf("\tADDR=0x%016jx\n", apic_addr);
+	printf("\tADDR=0x%016jx\n", (uintmax_t)apic_addr);
 }
 
 static void
-acpi_print_mps_flags(u_int16_t flags)
+acpi_print_mps_flags(uint16_t flags)
 {
 
 	printf("\tFlags={Polarity=");
-	switch (flags & MPS_INT_FLAG_POLARITY_MASK) {
-	case MPS_INT_FLAG_POLARITY_CONFORM:
+	switch (flags & ACPI_MADT_POLARITY_MASK) {
+	case ACPI_MADT_POLARITY_CONFORMS:
 		printf("conforming");
 		break;
-	case MPS_INT_FLAG_POLARITY_HIGH:
+	case ACPI_MADT_POLARITY_ACTIVE_HIGH:
 		printf("active-hi");
 		break;
-	case MPS_INT_FLAG_POLARITY_LOW:
+	case ACPI_MADT_POLARITY_ACTIVE_LOW:
 		printf("active-lo");
 		break;
 	default:
-		printf("0x%x", flags & MPS_INT_FLAG_POLARITY_MASK);
+		printf("0x%x", flags & ACPI_MADT_POLARITY_MASK);
 		break;
 	}
 	printf(", Trigger=");
-	switch (flags & MPS_INT_FLAG_TRIGGER_MASK) {
-	case MPS_INT_FLAG_TRIGGER_CONFORM:
+	switch (flags & ACPI_MADT_TRIGGER_MASK) {
+	case ACPI_MADT_TRIGGER_CONFORMS:
 		printf("conforming");
 		break;
-	case MPS_INT_FLAG_TRIGGER_EDGE:
+	case ACPI_MADT_TRIGGER_EDGE:
 		printf("edge");
 		break;
-	case MPS_INT_FLAG_TRIGGER_LEVEL:
+	case ACPI_MADT_TRIGGER_LEVEL:
 		printf("level");
 		break;
 	default:
-		printf("0x%x", (flags & MPS_INT_FLAG_TRIGGER_MASK) >> 2);
+		printf("0x%x", (flags & ACPI_MADT_TRIGGER_MASK) >> 2);
 	}
 	printf("}\n");
 }
 
 static void
-acpi_print_intr(u_int32_t intr, u_int16_t mps_flags)
+acpi_print_intr(uint32_t intr, uint16_t mps_flags)
 {
 
-	printf("\tINTR=%d\n", (u_int)intr);
+	printf("\tINTR=%d\n", intr);
+	acpi_print_mps_flags(mps_flags);
+}
+
+static void
+acpi_print_local_nmi(u_int lint, uint16_t mps_flags)
+{
+
+	printf("\tLINT Pin=%d\n", lint);
 	acpi_print_mps_flags(mps_flags);
 }
 
 const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override", "NMI",
-			     "Local NMI", "Local APIC Override", "IO SAPIC",
-			     "Local SAPIC", "Platform Interrupt" };
-const char *platform_int_types[] = { "PMI", "INIT",
+			     "Local APIC NMI", "Local APIC Override",
+			     "IO SAPIC", "Local SAPIC", "Platform Interrupt",
+			     "Local X2APIC", "Local X2APIC NMI" };
+const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT",
 				     "Corrected Platform Error" };
 
 static void
-acpi_print_apic(struct MADT_APIC *mp)
+acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
 {
+	ACPI_MADT_LOCAL_APIC *lapic;
+	ACPI_MADT_IO_APIC *ioapic;
+	ACPI_MADT_INTERRUPT_OVERRIDE *over;
+	ACPI_MADT_NMI_SOURCE *nmi;
+	ACPI_MADT_LOCAL_APIC_NMI *lapic_nmi;
+	ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic_over;
+	ACPI_MADT_IO_SAPIC *iosapic;
+	ACPI_MADT_LOCAL_SAPIC *lsapic;
+	ACPI_MADT_INTERRUPT_SOURCE *isrc;
+	ACPI_MADT_LOCAL_X2APIC *x2apic;
+	ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi;
 
-	if (mp->type < sizeof(apic_types) / sizeof(apic_types[0]))
-		printf("\tType=%s\n", apic_types[mp->type]);
+	if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0]))
+		printf("\tType=%s\n", apic_types[mp->Type]);
 	else
-		printf("\tType=%d (unknown)\n", mp->type);
-	switch (mp->type) {
-	case ACPI_MADT_APIC_TYPE_LOCAL_APIC:
-		acpi_print_local_apic(mp->body.local_apic.cpu_id,
-		    mp->body.local_apic.apic_id, mp->body.local_apic.flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_IO_APIC:
-		acpi_print_io_apic(mp->body.io_apic.apic_id,
-		    mp->body.io_apic.int_base,
-		    mp->body.io_apic.apic_addr);
-		break;
-	case ACPI_MADT_APIC_TYPE_INT_OVERRIDE:
-		printf("\tBUS=%d\n", (u_int)mp->body.int_override.bus);
-		printf("\tIRQ=%d\n", (u_int)mp->body.int_override.source);
-		acpi_print_intr(mp->body.int_override.intr,
-		    mp->body.int_override.mps_flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_NMI:
-		acpi_print_intr(mp->body.nmi.intr, mp->body.nmi.mps_flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_NMI:
-		acpi_print_cpu(mp->body.local_nmi.cpu_id);
-		printf("\tLINT Pin=%d\n", mp->body.local_nmi.lintpin);
-		acpi_print_mps_flags(mp->body.local_nmi.mps_flags);
+		printf("\tType=%d (unknown)\n", mp->Type);
+	switch (mp->Type) {
+	case ACPI_MADT_TYPE_LOCAL_APIC:
+		lapic = (ACPI_MADT_LOCAL_APIC *)mp;
+		acpi_print_cpu(lapic->ProcessorId);
+		acpi_print_local_apic(lapic->Id, lapic->LapicFlags);
+		break;
+	case ACPI_MADT_TYPE_IO_APIC:
+		ioapic = (ACPI_MADT_IO_APIC *)mp;
+		acpi_print_io_apic(ioapic->Id, ioapic->GlobalIrqBase,
+		    ioapic->Address);
+		break;
+	case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
+		over = (ACPI_MADT_INTERRUPT_OVERRIDE *)mp;
+		printf("\tBUS=%d\n", (u_int)over->Bus);
+		printf("\tIRQ=%d\n", (u_int)over->SourceIrq);
+		acpi_print_intr(over->GlobalIrq, over->IntiFlags);
+		break;
+	case ACPI_MADT_TYPE_NMI_SOURCE:
+		nmi = (ACPI_MADT_NMI_SOURCE *)mp;
+		acpi_print_intr(nmi->GlobalIrq, nmi->IntiFlags);
+		break;
+	case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+		lapic_nmi = (ACPI_MADT_LOCAL_APIC_NMI *)mp;
+		acpi_print_cpu(lapic_nmi->ProcessorId);
+		acpi_print_local_nmi(lapic_nmi->Lint, lapic_nmi->IntiFlags);
 		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_OVERRIDE:
+	case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
+		lapic_over = (ACPI_MADT_LOCAL_APIC_OVERRIDE *)mp;
 		printf("\tLocal APIC ADDR=0x%016jx\n",
-		    mp->body.local_apic_override.apic_addr);
-		break;
-	case ACPI_MADT_APIC_TYPE_IO_SAPIC:
-		acpi_print_io_apic(mp->body.io_sapic.apic_id,
-		    mp->body.io_sapic.int_base,
-		    mp->body.io_sapic.apic_addr);
-		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_SAPIC:
-		acpi_print_local_apic(mp->body.local_sapic.cpu_id,
-		    mp->body.local_sapic.apic_id, mp->body.local_sapic.flags);
-		printf("\tAPIC EID=%d\n", (u_int)mp->body.local_sapic.apic_eid);
+		    (uintmax_t)lapic_over->Address);
 		break;
-	case ACPI_MADT_APIC_TYPE_INT_SRC:
-		printf("\tType=%s\n",
-		    platform_int_types[mp->body.int_src.type]);
-		printf("\tCPU ID=%d\n", (u_int)mp->body.int_src.cpu_id);
-		printf("\tCPU EID=%d\n", (u_int)mp->body.int_src.cpu_id);
-		printf("\tSAPIC Vector=%d\n",
-		    (u_int)mp->body.int_src.sapic_vector);
-		acpi_print_intr(mp->body.int_src.intr,
-		    mp->body.int_src.mps_flags);
+	case ACPI_MADT_TYPE_IO_SAPIC:
+		iosapic = (ACPI_MADT_IO_SAPIC *)mp;
+		acpi_print_io_apic(iosapic->Id, iosapic->GlobalIrqBase,
+		    iosapic->Address);
+		break;
+	case ACPI_MADT_TYPE_LOCAL_SAPIC:
+		lsapic = (ACPI_MADT_LOCAL_SAPIC *)mp;
+		acpi_print_cpu(lsapic->ProcessorId);
+		acpi_print_local_apic(lsapic->Id, lsapic->LapicFlags);
+		printf("\tAPIC EID=%d\n", (u_int)lsapic->Eid);
+		if (mp->Length > __offsetof(ACPI_MADT_LOCAL_SAPIC, Uid))
+			acpi_print_cpu_uid(lsapic->Uid, lsapic->UidString);
+		break;
+	case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
+		isrc = (ACPI_MADT_INTERRUPT_SOURCE *)mp;
+		if (isrc->Type < sizeof(platform_int_types) /
+		    sizeof(platform_int_types[0]))
+			printf("\tType=%s\n", platform_int_types[isrc->Type]);
+		else
+			printf("\tType=%d (unknown)\n", isrc->Type);
+		printf("\tAPIC ID=%d\n", (u_int)isrc->Id);
+		printf("\tAPIC EID=%d\n", (u_int)isrc->Eid);
+		printf("\tSAPIC Vector=%d\n", (u_int)isrc->IoSapicVector);
+		acpi_print_intr(isrc->GlobalIrq, isrc->IntiFlags);
+		break;
+	case ACPI_MADT_TYPE_LOCAL_X2APIC:
+		x2apic = (ACPI_MADT_LOCAL_X2APIC *)mp;
+		acpi_print_cpu_uid(x2apic->Uid, NULL);
+		acpi_print_local_apic(x2apic->LocalApicId, x2apic->LapicFlags);
+		break;
+	case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
+		x2apic_nmi = (ACPI_MADT_LOCAL_X2APIC_NMI *)mp;
+		acpi_print_cpu_uid(x2apic_nmi->Uid, NULL);
+		acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags);
 		break;
 	}
 }
 
 static void
-acpi_handle_apic(struct ACPIsdt *sdp)
+acpi_handle_madt(ACPI_TABLE_HEADER *sdp)
 {
-	struct MADTbody *madtp;
-	struct MADT_APIC *madt_apicp;
+	ACPI_TABLE_MADT *madt;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	madtp = (struct MADTbody *) sdp->body;
-	printf("\tLocal APIC ADDR=0x%08x\n", madtp->lapic_addr);
+	madt = (ACPI_TABLE_MADT *)sdp;
+	printf("\tLocal APIC ADDR=0x%08x\n", madt->Address);
 	printf("\tFlags={");
-	if (madtp->flags & ACPI_APIC_FLAG_PCAT_COMPAT)
+	if (madt->Flags & ACPI_MADT_PCAT_COMPAT)
 		printf("PC-AT");
 	printf("}\n");
-	madt_apicp = (struct MADT_APIC *)madtp->body;
-	while (((uintptr_t)madt_apicp) - ((uintptr_t)sdp) < sdp->len) {
-		printf("\n");
-		acpi_print_apic(madt_apicp);
-		madt_apicp = (struct MADT_APIC *) ((char *)madt_apicp +
-		    madt_apicp->len);
-	}
+	acpi_walk_subtables(sdp, (madt + 1), acpi_print_madt);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_hpet(struct ACPIsdt *sdp)
+acpi_handle_hpet(ACPI_TABLE_HEADER *sdp)
 {
-	struct HPETbody *hpetp;
+	ACPI_TABLE_HPET *hpet;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	hpetp = (struct HPETbody *) sdp->body;
-	printf("\tHPET Number=%d\n", hpetp->hpet_number);
+	hpet = (ACPI_TABLE_HPET *)sdp;
+	printf("\tHPET Number=%d\n", hpet->Sequence);
 	printf("\tADDR=");
-	acpi_print_gas(&hpetp->genaddr);
-	printf("\tHW Rev=0x%x\n", hpetp->block_hwrev);
-	printf("\tComparitors=%d\n", hpetp->block_comparitors);
-	printf("\tCounter Size=%d\n", hpetp->block_counter_size);
+	acpi_print_gas(&hpet->Address);
+	printf("\tHW Rev=0x%x\n", hpet->Id & ACPI_HPET_ID_HARDWARE_REV_ID);
+	printf("\tComparators=%d\n", (hpet->Id & ACPI_HPET_ID_COMPARATORS) >>
+	    8);
+	printf("\tCounter Size=%d\n", hpet->Id & ACPI_HPET_ID_COUNT_SIZE_CAP ?
+	    1 : 0);
 	printf("\tLegacy IRQ routing capable={");
-	if (hpetp->block_legacy_capable)
+	if (hpet->Id & ACPI_HPET_ID_LEGACY_CAPABLE)
 		printf("TRUE}\n");
 	else
 		printf("FALSE}\n");
-	printf("\tPCI Vendor ID=0x%04x\n", hpetp->block_pcivendor);
-	printf("\tMinimal Tick=%d\n", hpetp->clock_tick);
+	printf("\tPCI Vendor ID=0x%04x\n", hpet->Id >> 16);
+	printf("\tMinimal Tick=%d\n", hpet->MinimumTick);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_ecdt(struct ACPIsdt *sdp)
+acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp)
 {
-	struct ECDTbody *ecdt;
+	ACPI_TABLE_ECDT *ecdt;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	ecdt = (struct ECDTbody *) sdp->body;
+	ecdt = (ACPI_TABLE_ECDT *)sdp;
 	printf("\tEC_CONTROL=");
-	acpi_print_gas(&ecdt->ec_control);
+	acpi_print_gas(&ecdt->Control);
 	printf("\n\tEC_DATA=");
-	acpi_print_gas(&ecdt->ec_data);
-	printf("\n\tUID=%#x, ", ecdt->uid);
-	printf("GPE_BIT=%#x\n", ecdt->gpe_bit);
-	printf("\tEC_ID=%s\n", ecdt->ec_id);
+	acpi_print_gas(&ecdt->Data);
+	printf("\n\tUID=%#x, ", ecdt->Uid);
+	printf("GPE_BIT=%#x\n", ecdt->Gpe);
+	printf("\tEC_ID=%s\n", ecdt->Id);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_mcfg(struct ACPIsdt *sdp)
+acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp)
 {
-	struct MCFGbody *mcfg;
-	u_int i, e;
+	ACPI_TABLE_MCFG *mcfg;
+	ACPI_MCFG_ALLOCATION *alloc;
+	u_int i, entries;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	mcfg = (struct MCFGbody *) sdp->body;
-
-	e = (sdp->len - ((caddr_t)&mcfg->s[0] - (caddr_t)sdp)) /
-	    sizeof(*mcfg->s);
-	for (i = 0; i < e; i++, mcfg++) {
+	mcfg = (ACPI_TABLE_MCFG *)sdp;
+	entries = (sdp->Length - sizeof(ACPI_TABLE_MCFG)) /
+	    sizeof(ACPI_MCFG_ALLOCATION);
+	alloc = (ACPI_MCFG_ALLOCATION *)(mcfg + 1);
+	for (i = 0; i < entries; i++, alloc++) {
 		printf("\n");
-		printf("\tBase Address=0x%016jx\n", mcfg->s[i].baseaddr);
-		printf("\tSegment Group=0x%04x\n", mcfg->s[i].seg_grp);
-		printf("\tStart Bus=%d\n", mcfg->s[i].start);
-		printf("\tEnd Bus=%d\n", mcfg->s[i].end);
+		printf("\tBase Address=0x%016jx\n", alloc->Address);
+		printf("\tSegment Group=0x%04x\n", alloc->PciSegment);
+		printf("\tStart Bus=%d\n", alloc->StartBusNumber);
+		printf("\tEnd Bus=%d\n", alloc->EndBusNumber);
 	}
 	printf(END_COMMENT);
 }
@@ -423,108 +493,109 @@ acpi_print_srat_cpu(uint32_t apic_id, ui
 }
 
 static void
-acpi_print_srat_memory(struct SRAT_memory *mp)
+acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp)
 {
 
 	printf("\tFlags={");
-	if (mp->flags & ACPI_SRAT_MEM_ENABLED)
+	if (mp->Flags & ACPI_SRAT_MEM_ENABLED)
 		printf("ENABLED");
 	else
 		printf("DISABLED");
-	if (mp->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)
+	if (mp->Flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)
 		printf(",HOT_PLUGGABLE");
-	if (mp->flags & ACPI_SRAT_MEM_NON_VOLATILE)
+	if (mp->Flags & ACPI_SRAT_MEM_NON_VOLATILE)
 		printf(",NON_VOLATILE");
 	printf("}\n");
-	printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->base_address);
-	printf("\tLength=0x%016jx\n", (uintmax_t)mp->length);
-	printf("\tProximity Domain=%d\n", mp->proximity_domain);
+	printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->BaseAddress);
+	printf("\tLength=0x%016jx\n", (uintmax_t)mp->Length);
+	printf("\tProximity Domain=%d\n", mp->ProximityDomain);
 }
 
 const char *srat_types[] = { "CPU", "Memory", "X2APIC" };
 
 static void
-acpi_print_srat(struct SRATentry *srat)
+acpi_print_srat(ACPI_SUBTABLE_HEADER *srat)
 {
+	ACPI_SRAT_CPU_AFFINITY *cpu;
+	ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic;
 
-	if (srat->type < sizeof(srat_types) / sizeof(srat_types[0]))
-		printf("\tType=%s\n", srat_types[srat->type]);
+	if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0]))
+		printf("\tType=%s\n", srat_types[srat->Type]);
 	else
-		printf("\tType=%d (unknown)\n", srat->type);
-	switch (srat->type) {
+		printf("\tType=%d (unknown)\n", srat->Type);
+	switch (srat->Type) {
 	case ACPI_SRAT_TYPE_CPU_AFFINITY:
-		acpi_print_srat_cpu(srat->body.cpu.apic_id,
-		    srat->body.cpu.proximity_domain_hi[2] << 24 |
-		    srat->body.cpu.proximity_domain_hi[1] << 16 |
-		    srat->body.cpu.proximity_domain_hi[0] << 0 |
-		    srat->body.cpu.proximity_domain_lo, srat->body.cpu.flags);
+		cpu = (ACPI_SRAT_CPU_AFFINITY *)srat;
+		acpi_print_srat_cpu(cpu->ApicId,
+		    cpu->ProximityDomainHi[2] << 24 |
+		    cpu->ProximityDomainHi[1] << 16 |
+		    cpu->ProximityDomainHi[0] << 0 |
+		    cpu->ProximityDomainLo, cpu->Flags);
 		break;
 	case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
-		acpi_print_srat_memory(&srat->body.mem);
+		acpi_print_srat_memory((ACPI_SRAT_MEM_AFFINITY *)srat);
 		break;
 	case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
-		acpi_print_srat_cpu(srat->body.x2apic.apic_id,
-		    srat->body.x2apic.proximity_domain,
-		    srat->body.x2apic.flags);
+		x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)srat;
+		acpi_print_srat_cpu(x2apic->ApicId, x2apic->ProximityDomain,
+		    x2apic->Flags);
 		break;
 	}
 }
 
 static void
-acpi_handle_srat(struct ACPIsdt *sdp)
+acpi_handle_srat(ACPI_TABLE_HEADER *sdp)
 {
-	struct SRATbody *sratp;
-	struct SRATentry *entry;
+	ACPI_TABLE_SRAT *srat;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	sratp = (struct SRATbody *)sdp->body;
-	printf("\tTable Revision=%d\n", sratp->table_revision);
-	entry = sratp->body;
-	while (((uintptr_t)entry) - ((uintptr_t)sdp) < sdp->len) {
-		printf("\n");
-		acpi_print_srat(entry);
-		entry = (struct SRATentry *)((char *)entry + entry->len);
-	}
+	srat = (ACPI_TABLE_SRAT *)sdp;
+	printf("\tTable Revision=%d\n", srat->TableRevision);
+	acpi_walk_subtables(sdp, (srat + 1), acpi_print_srat);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_print_sdt(struct ACPIsdt *sdp)
+acpi_print_sdt(ACPI_TABLE_HEADER *sdp)
 {
 	printf("  ");
-	acpi_print_string(sdp->signature, 4);
+	acpi_print_string(sdp->Signature, ACPI_NAME_SIZE);
 	printf(": Length=%d, Revision=%d, Checksum=%d,\n",
-	       sdp->len, sdp->rev, sdp->check);
+	       sdp->Length, sdp->Revision, sdp->Checksum);
 	printf("\tOEMID=");
-	acpi_print_string(sdp->oemid, 6);
+	acpi_print_string(sdp->OemId, ACPI_OEM_ID_SIZE);
 	printf(", OEM Table ID=");
-	acpi_print_string(sdp->oemtblid, 8);
-	printf(", OEM Revision=0x%x,\n", sdp->oemrev);
+	acpi_print_string(sdp->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
+	printf(", OEM Revision=0x%x,\n", sdp->OemRevision);
 	printf("\tCreator ID=");
-	acpi_print_string(sdp->creator, 4);
-	printf(", Creator Revision=0x%x\n", sdp->crerev);
+	acpi_print_string(sdp->AslCompilerId, ACPI_NAME_SIZE);
+	printf(", Creator Revision=0x%x\n", sdp->AslCompilerRevision);
 }
 
 static void
-acpi_print_rsdt(struct ACPIsdt *rsdp)
+acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
 {
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
 	int	i, entries;
 	u_long	addr;
 
+	rsdt = (ACPI_TABLE_RSDT *)rsdp;
+	xsdt = (ACPI_TABLE_XSDT *)rsdp;
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(rsdp);
-	entries = (rsdp->len - SIZEOF_SDT_HDR) / addr_size;
+	entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size;
 	printf("\tEntries={ ");
 	for (i = 0; i < entries; i++) {
 		if (i > 0)
 			printf(", ");
 		switch (addr_size) {
 		case 4:
-			addr = le32dec((char*)rsdp->body + i * addr_size);
+			addr = le32toh(rsdt->TableOffsetEntry[i]);
 			break;
 		case 8:
-			addr = le64dec((char*)rsdp->body + i * addr_size);
+			addr = le64toh(xsdt->TableOffsetEntry[i]);
 			break;
 		default:
 			addr = 0;
@@ -542,138 +613,147 @@ static const char *acpi_pm_profiles[] = 
 };
 
 static void
-acpi_print_fadt(struct ACPIsdt *sdp)
+acpi_print_fadt(ACPI_TABLE_HEADER *sdp)
 {
-	struct FADTbody *fadt;
+	ACPI_TABLE_FADT *fadt;
 	const char *pm;
 	char	    sep;
 
-	fadt = (struct FADTbody *)sdp->body;
+	fadt = (ACPI_TABLE_FADT *)sdp;
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->facs_ptr,
-	       fadt->dsdt_ptr);
-	printf("\tINT_MODEL=%s\n", fadt->int_model ? "APIC" : "PIC");
-	if (fadt->pm_profile >= sizeof(acpi_pm_profiles) / sizeof(char *))
+	printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->Facs,
+	       fadt->Dsdt);
+	printf("\tINT_MODEL=%s\n", fadt->Model ? "APIC" : "PIC");
+	if (fadt->PreferredProfile >= sizeof(acpi_pm_profiles) / sizeof(char *))
 		pm = "Reserved";
 	else
-		pm = acpi_pm_profiles[fadt->pm_profile];
-	printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->pm_profile);
-	printf("\tSCI_INT=%d\n", fadt->sci_int);
-	printf("\tSMI_CMD=0x%x, ", fadt->smi_cmd);
-	printf("ACPI_ENABLE=0x%x, ", fadt->acpi_enable);
-	printf("ACPI_DISABLE=0x%x, ", fadt->acpi_disable);
-	printf("S4BIOS_REQ=0x%x\n", fadt->s4biosreq);
-	printf("\tPSTATE_CNT=0x%x\n", fadt->pstate_cnt);
+		pm = acpi_pm_profiles[fadt->PreferredProfile];
+	printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->PreferredProfile);
+	printf("\tSCI_INT=%d\n", fadt->SciInterrupt);
+	printf("\tSMI_CMD=0x%x, ", fadt->SmiCommand);
+	printf("ACPI_ENABLE=0x%x, ", fadt->AcpiEnable);
+	printf("ACPI_DISABLE=0x%x, ", fadt->AcpiDisable);
+	printf("S4BIOS_REQ=0x%x\n", fadt->S4BiosRequest);
+	printf("\tPSTATE_CNT=0x%x\n", fadt->PstateControl);
 	printf("\tPM1a_EVT_BLK=0x%x-0x%x\n",
-	       fadt->pm1a_evt_blk,
-	       fadt->pm1a_evt_blk + fadt->pm1_evt_len - 1);
-	if (fadt->pm1b_evt_blk != 0)
+	       fadt->Pm1aEventBlock,
+	       fadt->Pm1aEventBlock + fadt->Pm1EventLength - 1);
+	if (fadt->Pm1bEventBlock != 0)
 		printf("\tPM1b_EVT_BLK=0x%x-0x%x\n",
-		       fadt->pm1b_evt_blk,
-		       fadt->pm1b_evt_blk + fadt->pm1_evt_len - 1);
+		       fadt->Pm1bEventBlock,
+		       fadt->Pm1bEventBlock + fadt->Pm1EventLength - 1);
 	printf("\tPM1a_CNT_BLK=0x%x-0x%x\n",
-	       fadt->pm1a_cnt_blk,
-	       fadt->pm1a_cnt_blk + fadt->pm1_cnt_len - 1);
-	if (fadt->pm1b_cnt_blk != 0)
+	       fadt->Pm1aControlBlock,
+	       fadt->Pm1aControlBlock + fadt->Pm1ControlLength - 1);
+	if (fadt->Pm1bControlBlock != 0)
 		printf("\tPM1b_CNT_BLK=0x%x-0x%x\n",
-		       fadt->pm1b_cnt_blk,
-		       fadt->pm1b_cnt_blk + fadt->pm1_cnt_len - 1);
-	if (fadt->pm2_cnt_blk != 0)
+		       fadt->Pm1bControlBlock,
+		       fadt->Pm1bControlBlock + fadt->Pm1ControlLength - 1);
+	if (fadt->Pm2ControlBlock != 0)
 		printf("\tPM2_CNT_BLK=0x%x-0x%x\n",
-		       fadt->pm2_cnt_blk,
-		       fadt->pm2_cnt_blk + fadt->pm2_cnt_len - 1);
+		       fadt->Pm2ControlBlock,
+		       fadt->Pm2ControlBlock + fadt->Pm2ControlLength - 1);
 	printf("\tPM_TMR_BLK=0x%x-0x%x\n",
-	       fadt->pm_tmr_blk,
-	       fadt->pm_tmr_blk + fadt->pm_tmr_len - 1);
-	if (fadt->gpe0_blk != 0)
+	       fadt->PmTimerBlock,
+	       fadt->PmTimerBlock + fadt->PmTimerLength - 1);
+	if (fadt->Gpe0Block != 0)
 		printf("\tGPE0_BLK=0x%x-0x%x\n",
-		       fadt->gpe0_blk,
-		       fadt->gpe0_blk + fadt->gpe0_len - 1);
-	if (fadt->gpe1_blk != 0)
+		       fadt->Gpe0Block,
+		       fadt->Gpe0Block + fadt->Gpe0BlockLength - 1);
+	if (fadt->Gpe1Block != 0)
 		printf("\tGPE1_BLK=0x%x-0x%x, GPE1_BASE=%d\n",
-		       fadt->gpe1_blk,
-		       fadt->gpe1_blk + fadt->gpe1_len - 1,
-		       fadt->gpe1_base);
-	if (fadt->cst_cnt != 0)
-		printf("\tCST_CNT=0x%x\n", fadt->cst_cnt);
+		       fadt->Gpe1Block,
+		       fadt->Gpe1Block + fadt->Gpe1BlockLength - 1,
+		       fadt->Gpe1Base);
+	if (fadt->CstControl != 0)
+		printf("\tCST_CNT=0x%x\n", fadt->CstControl);
 	printf("\tP_LVL2_LAT=%d us, P_LVL3_LAT=%d us\n",
-	       fadt->p_lvl2_lat, fadt->p_lvl3_lat);
+	       fadt->C2Latency, fadt->C3Latency);
 	printf("\tFLUSH_SIZE=%d, FLUSH_STRIDE=%d\n",
-	       fadt->flush_size, fadt->flush_stride);
+	       fadt->FlushSize, fadt->FlushStride);
 	printf("\tDUTY_OFFSET=%d, DUTY_WIDTH=%d\n",
-	       fadt->duty_off, fadt->duty_width);
+	       fadt->DutyOffset, fadt->DutyWidth);
 	printf("\tDAY_ALRM=%d, MON_ALRM=%d, CENTURY=%d\n",
-	       fadt->day_alrm, fadt->mon_alrm, fadt->century);
+	       fadt->DayAlarm, fadt->MonthAlarm, fadt->Century);
 
 #define PRINTFLAG(var, flag) do {			\
-	if ((var) & FADT_FLAG_## flag) {		\
+	if ((var) & ACPI_FADT_## flag) {		\
 		printf("%c%s", sep, #flag); sep = ',';	\
 	}						\
 } while (0)
 
 	printf("\tIAPC_BOOT_ARCH=");
 	sep = '{';
-	PRINTFLAG(fadt->iapc_boot_arch, LEGACY_DEV);
-	PRINTFLAG(fadt->iapc_boot_arch, 8042);
-	if (fadt->iapc_boot_arch != 0)
+	PRINTFLAG(fadt->BootFlags, LEGACY_DEVICES);
+	PRINTFLAG(fadt->BootFlags, 8042);
+	PRINTFLAG(fadt->BootFlags, NO_VGA);
+	PRINTFLAG(fadt->BootFlags, NO_MSI);
+	PRINTFLAG(fadt->BootFlags, NO_ASPM);
+	if (fadt->BootFlags != 0)
 		printf("}");
 	printf("\n");
 
 	printf("\tFlags=");
 	sep = '{';
-	PRINTFLAG(fadt->flags, WBINVD);
-	PRINTFLAG(fadt->flags, WBINVD_FLUSH);
-	PRINTFLAG(fadt->flags, PROC_C1);
-	PRINTFLAG(fadt->flags, P_LVL2_UP);
-	PRINTFLAG(fadt->flags, PWR_BUTTON);
-	PRINTFLAG(fadt->flags, SLP_BUTTON);
-	PRINTFLAG(fadt->flags, FIX_RTC);
-	PRINTFLAG(fadt->flags, RTC_S4);
-	PRINTFLAG(fadt->flags, TMR_VAL_EXT);
-	PRINTFLAG(fadt->flags, DCK_CAP);
-	PRINTFLAG(fadt->flags, RESET_REG);
-	PRINTFLAG(fadt->flags, SEALED_CASE);
-	PRINTFLAG(fadt->flags, HEADLESS);
-	PRINTFLAG(fadt->flags, CPU_SW_SLP);
-	if (fadt->flags != 0)
+	PRINTFLAG(fadt->Flags, WBINVD);
+	PRINTFLAG(fadt->Flags, WBINVD_FLUSH);
+	PRINTFLAG(fadt->Flags, C1_SUPPORTED);
+	PRINTFLAG(fadt->Flags, C2_MP_SUPPORTED);
+	PRINTFLAG(fadt->Flags, POWER_BUTTON);
+	PRINTFLAG(fadt->Flags, SLEEP_BUTTON);
+	PRINTFLAG(fadt->Flags, FIXED_RTC);
+	PRINTFLAG(fadt->Flags, S4_RTC_WAKE);
+	PRINTFLAG(fadt->Flags, 32BIT_TIMER);
+	PRINTFLAG(fadt->Flags, DOCKING_SUPPORTED);
+	PRINTFLAG(fadt->Flags, RESET_REGISTER);
+	PRINTFLAG(fadt->Flags, SEALED_CASE);
+	PRINTFLAG(fadt->Flags, HEADLESS);
+	PRINTFLAG(fadt->Flags, SLEEP_TYPE);
+	PRINTFLAG(fadt->Flags, PCI_EXPRESS_WAKE);
+	PRINTFLAG(fadt->Flags, PLATFORM_CLOCK);
+	PRINTFLAG(fadt->Flags, S4_RTC_VALID);
+	PRINTFLAG(fadt->Flags, REMOTE_POWER_ON);
+	PRINTFLAG(fadt->Flags, APIC_CLUSTER);
+	PRINTFLAG(fadt->Flags, APIC_PHYSICAL);
+	if (fadt->Flags != 0)
 		printf("}\n");
 
 #undef PRINTFLAG
 
-	if (fadt->flags & FADT_FLAG_RESET_REG) {
+	if (fadt->Flags & ACPI_FADT_RESET_REGISTER) {
 		printf("\tRESET_REG=");
-		acpi_print_gas(&fadt->reset_reg);
-		printf(", RESET_VALUE=%#x\n", fadt->reset_value);
+		acpi_print_gas(&fadt->ResetRegister);
+		printf(", RESET_VALUE=%#x\n", fadt->ResetValue);
 	}
 	if (acpi_get_fadt_revision(fadt) > 1) {
-		printf("\tX_FACS=0x%08lx, ", (u_long)fadt->x_facs_ptr);
-		printf("X_DSDT=0x%08lx\n", (u_long)fadt->x_dsdt_ptr);
+		printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs);
+		printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt);
 		printf("\tX_PM1a_EVT_BLK=");
-		acpi_print_gas(&fadt->x_pm1a_evt_blk);
-		if (fadt->x_pm1b_evt_blk.address != 0) {
+		acpi_print_gas(&fadt->XPm1aEventBlock);
+		if (fadt->XPm1bEventBlock.Address != 0) {
 			printf("\n\tX_PM1b_EVT_BLK=");
-			acpi_print_gas(&fadt->x_pm1b_evt_blk);
+			acpi_print_gas(&fadt->XPm1bEventBlock);
 		}
 		printf("\n\tX_PM1a_CNT_BLK=");
-		acpi_print_gas(&fadt->x_pm1a_cnt_blk);
-		if (fadt->x_pm1b_cnt_blk.address != 0) {
+		acpi_print_gas(&fadt->XPm1aControlBlock);
+		if (fadt->XPm1bControlBlock.Address != 0) {
 			printf("\n\tX_PM1b_CNT_BLK=");
-			acpi_print_gas(&fadt->x_pm1b_cnt_blk);
+			acpi_print_gas(&fadt->XPm1bControlBlock);
 		}
-		if (fadt->x_pm1b_cnt_blk.address != 0) {
+		if (fadt->XPm2ControlBlock.Address != 0) {
 			printf("\n\tX_PM2_CNT_BLK=");
-			acpi_print_gas(&fadt->x_pm2_cnt_blk);
+			acpi_print_gas(&fadt->XPm2ControlBlock);
 		}
 		printf("\n\tX_PM_TMR_BLK=");
-		acpi_print_gas(&fadt->x_pm_tmr_blk);
-		if (fadt->x_gpe0_blk.address != 0) {
+		acpi_print_gas(&fadt->XPmTimerBlock);
+		if (fadt->XGpe0Block.Address != 0) {
 			printf("\n\tX_GPE0_BLK=");
-			acpi_print_gas(&fadt->x_gpe0_blk);
+			acpi_print_gas(&fadt->XGpe0Block);
 		}
-		if (fadt->x_gpe1_blk.address != 0) {
+		if (fadt->XGpe1Block.Address != 0) {
 			printf("\n\tX_GPE1_BLK=");
-			acpi_print_gas(&fadt->x_gpe1_blk);
+			acpi_print_gas(&fadt->XGpe1Block);
 		}
 		printf("\n");
 	}
@@ -682,38 +762,38 @@ acpi_print_fadt(struct ACPIsdt *sdp)
 }
 
 static void
-acpi_print_facs(struct FACSbody *facs)
+acpi_print_facs(ACPI_TABLE_FACS *facs)
 {
 	printf(BEGIN_COMMENT);
-	printf("  FACS:\tLength=%u, ", facs->len);
-	printf("HwSig=0x%08x, ", facs->hw_sig);
-	printf("Firm_Wake_Vec=0x%08x\n", facs->firm_wake_vec);
+	printf("  FACS:\tLength=%u, ", facs->Length);
+	printf("HwSig=0x%08x, ", facs->HardwareSignature);
+	printf("Firm_Wake_Vec=0x%08x\n", facs->FirmwareWakingVector);
 
 	printf("\tGlobal_Lock=");
-	if (facs->global_lock != 0) {
-		if (facs->global_lock & FACS_FLAG_LOCK_PENDING)
+	if (facs->GlobalLock != 0) {
+		if (facs->GlobalLock & ACPI_GLOCK_PENDING)
 			printf("PENDING,");
-		if (facs->global_lock & FACS_FLAG_LOCK_OWNED)
+		if (facs->GlobalLock & ACPI_GLOCK_OWNED)
 			printf("OWNED");
 	}
 	printf("\n");
 
 	printf("\tFlags=");
-	if (facs->flags & FACS_FLAG_S4BIOS_F)
+	if (facs->Flags & ACPI_FACS_S4_BIOS_PRESENT)
 		printf("S4BIOS");
 	printf("\n");
 
-	if (facs->x_firm_wake_vec != 0) {
+	if (facs->XFirmwareWakingVector != 0) {
 		printf("\tX_Firm_Wake_Vec=%08lx\n",
-		       (u_long)facs->x_firm_wake_vec);
+		       (u_long)facs->XFirmwareWakingVector);
 	}
-	printf("\tVersion=%u\n", facs->version);
+	printf("\tVersion=%u\n", facs->Version);
 

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

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:52:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DE7E106568B;
	Thu, 29 Oct 2009 14:52:33 +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 6AE418FC1B;
	Thu, 29 Oct 2009 14:52: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 n9TEqXQH099861;
	Thu, 29 Oct 2009 14:52:33 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TEqX7L099858;
	Thu, 29 Oct 2009 14:52:33 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291452.n9TEqX7L099858@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 14:52:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198592 - in stable/7/usr.sbin/acpi: . acpidump
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:52:33 -0000

Author: jhb
Date: Thu Oct 29 14:52:32 2009
New Revision: 198592
URL: http://svn.freebsd.org/changeset/base/198592

Log:
  MFC 196555:
  - Use the headers from ACPI-CA to define various constants and structures
    for table layouts, etc. rather than homerolling our own structures and
    constants in acpidump.h.
  - Verify the extended checksum on the RSDP.
  - One side effect in this branch is that we lose support for parsing SRAT
    X2APIC entries since the ACPI-CA headers do not include those.  I have
    yet to see one of these in the wild, however.

Modified:
  stable/7/usr.sbin/acpi/   (props changed)
  stable/7/usr.sbin/acpi/acpidump/acpi.c
  stable/7/usr.sbin/acpi/acpidump/acpi_user.c
  stable/7/usr.sbin/acpi/acpidump/acpidump.c
  stable/7/usr.sbin/acpi/acpidump/acpidump.h

Modified: stable/7/usr.sbin/acpi/acpidump/acpi.c
==============================================================================
--- stable/7/usr.sbin/acpi/acpidump/acpi.c	Thu Oct 29 14:40:21 2009	(r198591)
+++ stable/7/usr.sbin/acpi/acpidump/acpi.c	Thu Oct 29 14:52:32 2009	(r198592)
@@ -45,31 +45,36 @@
 #define END_COMMENT	" */\n"
 
 static void	acpi_print_string(char *s, size_t length);
-static void	acpi_print_gas(struct ACPIgas *gas);
-static int	acpi_get_fadt_revision(struct FADTbody *fadt);
-static void	acpi_handle_fadt(struct ACPIsdt *fadt);
+static void	acpi_print_gas(ACPI_GENERIC_ADDRESS *gas);
+static int	acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt);
+static void	acpi_handle_fadt(ACPI_TABLE_HEADER *fadt);
 static void	acpi_print_cpu(u_char cpu_id);
-static void	acpi_print_local_apic(u_char cpu_id, u_char apic_id,
-				      u_int32_t flags);
-static void	acpi_print_io_apic(u_char apic_id, u_int32_t int_base,
-				   u_int64_t apic_addr);
-static void	acpi_print_mps_flags(u_int16_t flags);
-static void	acpi_print_intr(u_int32_t intr, u_int16_t mps_flags);
-static void	acpi_print_apic(struct MADT_APIC *mp);
-static void	acpi_handle_apic(struct ACPIsdt *sdp);
-static void	acpi_handle_hpet(struct ACPIsdt *sdp);
+static void	acpi_print_cpu_uid(uint32_t uid, char *uid_string);
+static void	acpi_print_local_apic(uint32_t apic_id, uint32_t flags);
+static void	acpi_print_io_apic(uint32_t apic_id, uint32_t int_base,
+		    uint64_t apic_addr);
+static void	acpi_print_mps_flags(uint16_t flags);
+static void	acpi_print_intr(uint32_t intr, uint16_t mps_flags);
+static void	acpi_print_local_nmi(u_int lint, uint16_t mps_flags);
+static void	acpi_print_madt(ACPI_SUBTABLE_HEADER *mp);
+static void	acpi_handle_madt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
+static void	acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
 static void	acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
 		    uint32_t flags);
-static void	acpi_print_srat_memory(struct SRAT_memory *mp);
-static void	acpi_print_srat(struct SRATentry *srat);
-static void	acpi_handle_srat(struct ACPIsdt *sdp);
-static void	acpi_print_sdt(struct ACPIsdt *sdp);
-static void	acpi_print_fadt(struct ACPIsdt *sdp);
-static void	acpi_print_facs(struct FACSbody *facs);
-static void	acpi_print_dsdt(struct ACPIsdt *dsdp);
-static struct ACPIsdt *acpi_map_sdt(vm_offset_t pa);
-static void	acpi_print_rsd_ptr(struct ACPIrsdp *rp);
-static void	acpi_handle_rsdt(struct ACPIsdt *rsdp);
+static void	acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp);
+static void	acpi_print_srat(ACPI_SUBTABLE_HEADER *srat);
+static void	acpi_handle_srat(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_sdt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_fadt(ACPI_TABLE_HEADER *sdp);
+static void	acpi_print_facs(ACPI_TABLE_FACS *facs);
+static void	acpi_print_dsdt(ACPI_TABLE_HEADER *dsdp);
+static ACPI_TABLE_HEADER *acpi_map_sdt(vm_offset_t pa);
+static void	acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp);
+static void	acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp);
+static void	acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
+		    void (*action)(ACPI_SUBTABLE_HEADER *));
 
 /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */
 static int addr_size;
@@ -90,41 +95,44 @@ acpi_print_string(char *s, size_t length
 }
 
 static void
-acpi_print_gas(struct ACPIgas *gas)
+acpi_print_gas(ACPI_GENERIC_ADDRESS *gas)
 {
-	switch(gas->address_space_id) {
+	switch(gas->SpaceId) {
 	case ACPI_GAS_MEMORY:
-		printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_IO:
-		printf("0x%02lx:%u[%u] (IO)", (u_long)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_PCI:
-		printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->address >> 32),
-		       (uint16_t)((gas->address >> 16) & 0xffff),
-		       (uint16_t)gas->address);
+		printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
+		       (uint16_t)((gas->Address >> 16) & 0xffff),
+		       (uint16_t)gas->Address);
 		break;
 	/* XXX How to handle these below? */
 	case ACPI_GAS_EMBEDDED:
-		printf("0x%x:%u[%u] (EC)", (uint16_t)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%x:%u[%u] (EC)", (uint16_t)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_SMBUS:
-		printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->address,
-		       gas->bit_offset, gas->bit_width);
+		printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->Address,
+		       gas->BitOffset, gas->BitWidth);
 		break;
+	case ACPI_GAS_CMOS:
+	case ACPI_GAS_PCIBAR:
+	case ACPI_GAS_DATATABLE:
 	case ACPI_GAS_FIXED:
 	default:
-		printf("0x%08lx (?)", (u_long)gas->address);
+		printf("0x%08lx (?)", (u_long)gas->Address);
 		break;
 	}
 }
 
 /* The FADT revision indicates whether we use the DSDT or X_DSDT addresses. */
 static int
-acpi_get_fadt_revision(struct FADTbody *fadt)
+acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt)
 {
 	int fadt_revision;
 
@@ -139,8 +147,8 @@ acpi_get_fadt_revision(struct FADTbody *
 		 * 32 and 64 bit versions don't match, prefer the 32 bit
 		 * version for all subsequent tables.
 		 */
-		if (fadt->facs_ptr != 0 &&
-		    (fadt->x_facs_ptr & 0xffffffff) != fadt->facs_ptr)
+		if (fadt->Facs != 0 &&
+		    (fadt->XFacs & 0xffffffff) != fadt->Facs)
 			fadt_revision = 1;
 	} else
 		fadt_revision = 1;
@@ -148,35 +156,52 @@ acpi_get_fadt_revision(struct FADTbody *
 }
 
 static void
-acpi_handle_fadt(struct ACPIsdt *sdp)
+acpi_handle_fadt(ACPI_TABLE_HEADER *sdp)
 {
-	struct ACPIsdt	*dsdp;
-	struct FACSbody	*facs;
-	struct FADTbody *fadt;
+	ACPI_TABLE_HEADER *dsdp;
+	ACPI_TABLE_FACS	*facs;
+	ACPI_TABLE_FADT *fadt;
 	int		fadt_revision;
 
-	fadt = (struct FADTbody *)sdp->body;
+	fadt = (ACPI_TABLE_FADT *)sdp;
 	acpi_print_fadt(sdp);
 
 	fadt_revision = acpi_get_fadt_revision(fadt);
 	if (fadt_revision == 1)
-		facs = (struct FACSbody *)acpi_map_sdt(fadt->facs_ptr);
+		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->Facs);
 	else
-		facs = (struct FACSbody *)acpi_map_sdt(fadt->x_facs_ptr);
-	if (memcmp(facs->signature, "FACS", 4) != 0 || facs->len < 64)
+		facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->XFacs);
+	if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64)
 		errx(1, "FACS is corrupt");
 	acpi_print_facs(facs);
 
 	if (fadt_revision == 1)
-		dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->dsdt_ptr);
+		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt);
 	else
-		dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->x_dsdt_ptr);
-	if (acpi_checksum(dsdp, dsdp->len))
+		dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt);
+	if (acpi_checksum(dsdp, dsdp->Length))
 		errx(1, "DSDT is corrupt");
 	acpi_print_dsdt(dsdp);
 }
 
 static void
+acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
+    void (*action)(ACPI_SUBTABLE_HEADER *))
+{
+	ACPI_SUBTABLE_HEADER *subtable;
+	char *end;
+
+	subtable = first;
+	end = (char *)table + table->Length;
+	while ((char *)subtable < end) {
+		printf("\n");
+		action(subtable);
+		subtable = (ACPI_SUBTABLE_HEADER *)((char *)subtable +
+		    subtable->Length);
+	}
+}
+
+static void
 acpi_print_cpu(u_char cpu_id)
 {
 
@@ -188,219 +213,251 @@ acpi_print_cpu(u_char cpu_id)
 }
 
 static void
-acpi_print_local_apic(u_char cpu_id, u_char apic_id, u_int32_t flags)
+acpi_print_cpu_uid(uint32_t uid, char *uid_string)
+{
+
+	printf("\tUID=%d", uid);
+	if (uid_string != NULL)
+		printf(" (%s)", uid_string);
+	printf("\n");
+}
+
+static void
+acpi_print_local_apic(uint32_t apic_id, uint32_t flags)
 {
-	acpi_print_cpu(cpu_id);
+
 	printf("\tFlags={");
-	if (flags & ACPI_MADT_APIC_LOCAL_FLAG_ENABLED)
+	if (flags & ACPI_MADT_ENABLED)
 		printf("ENABLED");
 	else
 		printf("DISABLED");
 	printf("}\n");
-	printf("\tAPIC ID=%d\n", (u_int)apic_id);
+	printf("\tAPIC ID=%d\n", apic_id);
 }
 
 static void
-acpi_print_io_apic(u_char apic_id, u_int32_t int_base, u_int64_t apic_addr)
+acpi_print_io_apic(uint32_t apic_id, uint32_t int_base, uint64_t apic_addr)
 {
-	printf("\tAPIC ID=%d\n", (u_int)apic_id);
+
+	printf("\tAPIC ID=%d\n", apic_id);
 	printf("\tINT BASE=%d\n", int_base);
-	printf("\tADDR=0x%016jx\n", apic_addr);
+	printf("\tADDR=0x%016jx\n", (uintmax_t)apic_addr);
 }
 
 static void
-acpi_print_mps_flags(u_int16_t flags)
+acpi_print_mps_flags(uint16_t flags)
 {
 
 	printf("\tFlags={Polarity=");
-	switch (flags & MPS_INT_FLAG_POLARITY_MASK) {
-	case MPS_INT_FLAG_POLARITY_CONFORM:
+	switch (flags & ACPI_MADT_POLARITY_MASK) {
+	case ACPI_MADT_POLARITY_CONFORMS:
 		printf("conforming");
 		break;
-	case MPS_INT_FLAG_POLARITY_HIGH:
+	case ACPI_MADT_POLARITY_ACTIVE_HIGH:
 		printf("active-hi");
 		break;
-	case MPS_INT_FLAG_POLARITY_LOW:
+	case ACPI_MADT_POLARITY_ACTIVE_LOW:
 		printf("active-lo");
 		break;
 	default:
-		printf("0x%x", flags & MPS_INT_FLAG_POLARITY_MASK);
+		printf("0x%x", flags & ACPI_MADT_POLARITY_MASK);
 		break;
 	}
 	printf(", Trigger=");
-	switch (flags & MPS_INT_FLAG_TRIGGER_MASK) {
-	case MPS_INT_FLAG_TRIGGER_CONFORM:
+	switch (flags & ACPI_MADT_TRIGGER_MASK) {
+	case ACPI_MADT_TRIGGER_CONFORMS:
 		printf("conforming");
 		break;
-	case MPS_INT_FLAG_TRIGGER_EDGE:
+	case ACPI_MADT_TRIGGER_EDGE:
 		printf("edge");
 		break;
-	case MPS_INT_FLAG_TRIGGER_LEVEL:
+	case ACPI_MADT_TRIGGER_LEVEL:
 		printf("level");
 		break;
 	default:
-		printf("0x%x", (flags & MPS_INT_FLAG_TRIGGER_MASK) >> 2);
+		printf("0x%x", (flags & ACPI_MADT_TRIGGER_MASK) >> 2);
 	}
 	printf("}\n");
 }
 
 static void
-acpi_print_intr(u_int32_t intr, u_int16_t mps_flags)
+acpi_print_intr(uint32_t intr, uint16_t mps_flags)
+{
+
+	printf("\tINTR=%d\n", intr);
+	acpi_print_mps_flags(mps_flags);
+}
+
+static void
+acpi_print_local_nmi(u_int lint, uint16_t mps_flags)
 {
 
-	printf("\tINTR=%d\n", (u_int)intr);
+	printf("\tLINT Pin=%d\n", lint);
 	acpi_print_mps_flags(mps_flags);
 }
 
 const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override", "NMI",
-			     "Local NMI", "Local APIC Override", "IO SAPIC",
-			     "Local SAPIC", "Platform Interrupt" };
-const char *platform_int_types[] = { "PMI", "INIT",
+			     "Local APIC NMI", "Local APIC Override",
+			     "IO SAPIC", "Local SAPIC", "Platform Interrupt" };
+const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT",
 				     "Corrected Platform Error" };
 
 static void
-acpi_print_apic(struct MADT_APIC *mp)
+acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
 {
-
-	if (mp->type < sizeof(apic_types) / sizeof(apic_types[0]))
-		printf("\tType=%s\n", apic_types[mp->type]);
-	else
-		printf("\tType=%d (unknown)\n", mp->type);
-	switch (mp->type) {
-	case ACPI_MADT_APIC_TYPE_LOCAL_APIC:
-		acpi_print_local_apic(mp->body.local_apic.cpu_id,
-		    mp->body.local_apic.apic_id, mp->body.local_apic.flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_IO_APIC:
-		acpi_print_io_apic(mp->body.io_apic.apic_id,
-		    mp->body.io_apic.int_base,
-		    mp->body.io_apic.apic_addr);
-		break;
-	case ACPI_MADT_APIC_TYPE_INT_OVERRIDE:
-		printf("\tBUS=%d\n", (u_int)mp->body.int_override.bus);
-		printf("\tIRQ=%d\n", (u_int)mp->body.int_override.source);
-		acpi_print_intr(mp->body.int_override.intr,
-		    mp->body.int_override.mps_flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_NMI:
-		acpi_print_intr(mp->body.nmi.intr, mp->body.nmi.mps_flags);
-		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_NMI:
-		acpi_print_cpu(mp->body.local_nmi.cpu_id);
-		printf("\tLINT Pin=%d\n", mp->body.local_nmi.lintpin);
-		acpi_print_mps_flags(mp->body.local_nmi.mps_flags);
+	ACPI_MADT_LOCAL_APIC *lapic;
+	ACPI_MADT_IO_APIC *ioapic;
+	ACPI_MADT_INTERRUPT_OVERRIDE *over;
+	ACPI_MADT_NMI_SOURCE *nmi;
+	ACPI_MADT_LOCAL_APIC_NMI *lapic_nmi;
+	ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic_over;
+	ACPI_MADT_IO_SAPIC *iosapic;
+	ACPI_MADT_LOCAL_SAPIC *lsapic;
+	ACPI_MADT_INTERRUPT_SOURCE *isrc;
+
+	if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0]))
+		printf("\tType=%s\n", apic_types[mp->Type]);
+	else
+		printf("\tType=%d (unknown)\n", mp->Type);
+	switch (mp->Type) {
+	case ACPI_MADT_TYPE_LOCAL_APIC:
+		lapic = (ACPI_MADT_LOCAL_APIC *)mp;
+		acpi_print_cpu(lapic->ProcessorId);
+		acpi_print_local_apic(lapic->Id, lapic->LapicFlags);
+		break;
+	case ACPI_MADT_TYPE_IO_APIC:
+		ioapic = (ACPI_MADT_IO_APIC *)mp;
+		acpi_print_io_apic(ioapic->Id, ioapic->GlobalIrqBase,
+		    ioapic->Address);
+		break;
+	case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
+		over = (ACPI_MADT_INTERRUPT_OVERRIDE *)mp;
+		printf("\tBUS=%d\n", (u_int)over->Bus);
+		printf("\tIRQ=%d\n", (u_int)over->SourceIrq);
+		acpi_print_intr(over->GlobalIrq, over->IntiFlags);
+		break;
+	case ACPI_MADT_TYPE_NMI_SOURCE:
+		nmi = (ACPI_MADT_NMI_SOURCE *)mp;
+		acpi_print_intr(nmi->GlobalIrq, nmi->IntiFlags);
+		break;
+	case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+		lapic_nmi = (ACPI_MADT_LOCAL_APIC_NMI *)mp;
+		acpi_print_cpu(lapic_nmi->ProcessorId);
+		acpi_print_local_nmi(lapic_nmi->Lint, lapic_nmi->IntiFlags);
 		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_OVERRIDE:
+	case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
+		lapic_over = (ACPI_MADT_LOCAL_APIC_OVERRIDE *)mp;
 		printf("\tLocal APIC ADDR=0x%016jx\n",
-		    mp->body.local_apic_override.apic_addr);
+		    (uintmax_t)lapic_over->Address);
 		break;
-	case ACPI_MADT_APIC_TYPE_IO_SAPIC:
-		acpi_print_io_apic(mp->body.io_sapic.apic_id,
-		    mp->body.io_sapic.int_base,
-		    mp->body.io_sapic.apic_addr);
+	case ACPI_MADT_TYPE_IO_SAPIC:
+		iosapic = (ACPI_MADT_IO_SAPIC *)mp;
+		acpi_print_io_apic(iosapic->Id, iosapic->GlobalIrqBase,
+		    iosapic->Address);
 		break;
-	case ACPI_MADT_APIC_TYPE_LOCAL_SAPIC:
-		acpi_print_local_apic(mp->body.local_sapic.cpu_id,
-		    mp->body.local_sapic.apic_id, mp->body.local_sapic.flags);
-		printf("\tAPIC EID=%d\n", (u_int)mp->body.local_sapic.apic_eid);
+	case ACPI_MADT_TYPE_LOCAL_SAPIC:
+		lsapic = (ACPI_MADT_LOCAL_SAPIC *)mp;
+		acpi_print_cpu(lsapic->ProcessorId);
+		acpi_print_local_apic(lsapic->Id, lsapic->LapicFlags);
+		printf("\tAPIC EID=%d\n", (u_int)lsapic->Eid);
+		if (mp->Length > __offsetof(ACPI_MADT_LOCAL_SAPIC, Uid))
+			acpi_print_cpu_uid(lsapic->Uid, lsapic->UidString);
 		break;
-	case ACPI_MADT_APIC_TYPE_INT_SRC:
-		printf("\tType=%s\n",
-		    platform_int_types[mp->body.int_src.type]);
-		printf("\tCPU ID=%d\n", (u_int)mp->body.int_src.cpu_id);
-		printf("\tCPU EID=%d\n", (u_int)mp->body.int_src.cpu_id);
-		printf("\tSAPIC Vector=%d\n",
-		    (u_int)mp->body.int_src.sapic_vector);
-		acpi_print_intr(mp->body.int_src.intr,
-		    mp->body.int_src.mps_flags);
+	case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
+		isrc = (ACPI_MADT_INTERRUPT_SOURCE *)mp;
+		if (isrc->Type < sizeof(platform_int_types) /
+		    sizeof(platform_int_types[0]))
+			printf("\tType=%s\n", platform_int_types[isrc->Type]);
+		else
+			printf("\tType=%d (unknown)\n", isrc->Type);
+		printf("\tAPIC ID=%d\n", (u_int)isrc->Id);
+		printf("\tAPIC EID=%d\n", (u_int)isrc->Eid);
+		printf("\tSAPIC Vector=%d\n", (u_int)isrc->IoSapicVector);
+		acpi_print_intr(isrc->GlobalIrq, isrc->IntiFlags);
 		break;
 	}
 }
 
 static void
-acpi_handle_apic(struct ACPIsdt *sdp)
+acpi_handle_madt(ACPI_TABLE_HEADER *sdp)
 {
-	struct MADTbody *madtp;
-	struct MADT_APIC *madt_apicp;
+	ACPI_TABLE_MADT *madt;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	madtp = (struct MADTbody *) sdp->body;
-	printf("\tLocal APIC ADDR=0x%08x\n", madtp->lapic_addr);
+	madt = (ACPI_TABLE_MADT *)sdp;
+	printf("\tLocal APIC ADDR=0x%08x\n", madt->Address);
 	printf("\tFlags={");
-	if (madtp->flags & ACPI_APIC_FLAG_PCAT_COMPAT)
+	if (madt->Flags & ACPI_MADT_PCAT_COMPAT)
 		printf("PC-AT");
 	printf("}\n");
-	madt_apicp = (struct MADT_APIC *)madtp->body;
-	while (((uintptr_t)madt_apicp) - ((uintptr_t)sdp) < sdp->len) {
-		printf("\n");
-		acpi_print_apic(madt_apicp);
-		madt_apicp = (struct MADT_APIC *) ((char *)madt_apicp +
-		    madt_apicp->len);
-	}
+	acpi_walk_subtables(sdp, (madt + 1), acpi_print_madt);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_hpet(struct ACPIsdt *sdp)
+acpi_handle_hpet(ACPI_TABLE_HEADER *sdp)
 {
-	struct HPETbody *hpetp;
+	ACPI_TABLE_HPET *hpet;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	hpetp = (struct HPETbody *) sdp->body;
-	printf("\tHPET Number=%d\n", hpetp->hpet_number);
+	hpet = (ACPI_TABLE_HPET *)sdp;
+	printf("\tHPET Number=%d\n", hpet->Sequence);
 	printf("\tADDR=");
-	acpi_print_gas(&hpetp->genaddr);
-	printf("\tHW Rev=0x%x\n", hpetp->block_hwrev);
-	printf("\tComparitors=%d\n", hpetp->block_comparitors);
-	printf("\tCounter Size=%d\n", hpetp->block_counter_size);
+	acpi_print_gas(&hpet->Address);
+	printf("\tHW Rev=0x%x\n", hpet->Id & ACPI_HPET_ID_HARDWARE_REV_ID);
+	printf("\tComparators=%d\n", (hpet->Id & ACPI_HPET_ID_COMPARATORS) >>
+	    8);
+	printf("\tCounter Size=%d\n", hpet->Id & ACPI_HPET_ID_COUNT_SIZE_CAP ?
+	    1 : 0);
 	printf("\tLegacy IRQ routing capable={");
-	if (hpetp->block_legacy_capable)
+	if (hpet->Id & ACPI_HPET_ID_LEGACY_CAPABLE)
 		printf("TRUE}\n");
 	else
 		printf("FALSE}\n");
-	printf("\tPCI Vendor ID=0x%04x\n", hpetp->block_pcivendor);
-	printf("\tMinimal Tick=%d\n", hpetp->clock_tick);
+	printf("\tPCI Vendor ID=0x%04x\n", hpet->Id >> 16);
+	printf("\tMinimal Tick=%d\n", hpet->MinimumTick);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_ecdt(struct ACPIsdt *sdp)
+acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp)
 {
-	struct ECDTbody *ecdt;
+	ACPI_TABLE_ECDT *ecdt;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	ecdt = (struct ECDTbody *) sdp->body;
+	ecdt = (ACPI_TABLE_ECDT *)sdp;
 	printf("\tEC_CONTROL=");
-	acpi_print_gas(&ecdt->ec_control);
+	acpi_print_gas(&ecdt->Control);
 	printf("\n\tEC_DATA=");
-	acpi_print_gas(&ecdt->ec_data);
-	printf("\n\tUID=%#x, ", ecdt->uid);
-	printf("GPE_BIT=%#x\n", ecdt->gpe_bit);
-	printf("\tEC_ID=%s\n", ecdt->ec_id);
+	acpi_print_gas(&ecdt->Data);
+	printf("\n\tUID=%#x, ", ecdt->Uid);
+	printf("GPE_BIT=%#x\n", ecdt->Gpe);
+	printf("\tEC_ID=%s\n", ecdt->Id);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_handle_mcfg(struct ACPIsdt *sdp)
+acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp)
 {
-	struct MCFGbody *mcfg;
-	u_int i, e;
+	ACPI_TABLE_MCFG *mcfg;
+	ACPI_MCFG_ALLOCATION *alloc;
+	u_int i, entries;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	mcfg = (struct MCFGbody *) sdp->body;
-
-	e = (sdp->len - ((caddr_t)&mcfg->s[0] - (caddr_t)sdp)) /
-	    sizeof(*mcfg->s);
-	for (i = 0; i < e; i++, mcfg++) {
+	mcfg = (ACPI_TABLE_MCFG *)sdp;
+	entries = (sdp->Length - sizeof(ACPI_TABLE_MCFG)) /
+	    sizeof(ACPI_MCFG_ALLOCATION);
+	alloc = (ACPI_MCFG_ALLOCATION *)(mcfg + 1);
+	for (i = 0; i < entries; i++, alloc++) {
 		printf("\n");
-		printf("\tBase Address=0x%016jx\n", mcfg->s[i].baseaddr);
-		printf("\tSegment Group=0x%04x\n", mcfg->s[i].seg_grp);
-		printf("\tStart Bus=%d\n", mcfg->s[i].start);
-		printf("\tEnd Bus=%d\n", mcfg->s[i].end);
+		printf("\tBase Address=0x%016jx\n", alloc->Address);
+		printf("\tSegment Group=0x%04x\n", alloc->PciSegment);
+		printf("\tStart Bus=%d\n", alloc->StartBusNumber);
+		printf("\tEnd Bus=%d\n", alloc->EndBusNumber);
 	}
 	printf(END_COMMENT);
 }
@@ -421,108 +478,103 @@ acpi_print_srat_cpu(uint32_t apic_id, ui
 }
 
 static void
-acpi_print_srat_memory(struct SRAT_memory *mp)
+acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp)
 {
 
 	printf("\tFlags={");
-	if (mp->flags & ACPI_SRAT_MEM_ENABLED)
+	if (mp->Flags & ACPI_SRAT_MEM_ENABLED)
 		printf("ENABLED");
 	else
 		printf("DISABLED");
-	if (mp->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)
+	if (mp->Flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)
 		printf(",HOT_PLUGGABLE");
-	if (mp->flags & ACPI_SRAT_MEM_NON_VOLATILE)
+	if (mp->Flags & ACPI_SRAT_MEM_NON_VOLATILE)
 		printf(",NON_VOLATILE");
 	printf("}\n");
-	printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->base_address);
-	printf("\tLength=0x%016jx\n", (uintmax_t)mp->length);
-	printf("\tProximity Domain=%d\n", mp->proximity_domain);
+	printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->BaseAddress);
+	printf("\tLength=0x%016jx\n", (uintmax_t)mp->Length);
+	printf("\tProximity Domain=%d\n", mp->ProximityDomain);
 }
 
-const char *srat_types[] = { "CPU", "Memory", "X2APIC" };
+const char *srat_types[] = { "CPU", "Memory" };
 
 static void
-acpi_print_srat(struct SRATentry *srat)
+acpi_print_srat(ACPI_SUBTABLE_HEADER *srat)
 {
+	ACPI_SRAT_CPU_AFFINITY *cpu;
 
-	if (srat->type < sizeof(srat_types) / sizeof(srat_types[0]))
-		printf("\tType=%s\n", srat_types[srat->type]);
+	if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0]))
+		printf("\tType=%s\n", srat_types[srat->Type]);
 	else
-		printf("\tType=%d (unknown)\n", srat->type);
-	switch (srat->type) {
+		printf("\tType=%d (unknown)\n", srat->Type);
+	switch (srat->Type) {
 	case ACPI_SRAT_TYPE_CPU_AFFINITY:
-		acpi_print_srat_cpu(srat->body.cpu.apic_id,
-		    srat->body.cpu.proximity_domain_hi[2] << 24 |
-		    srat->body.cpu.proximity_domain_hi[1] << 16 |
-		    srat->body.cpu.proximity_domain_hi[0] << 0 |
-		    srat->body.cpu.proximity_domain_lo, srat->body.cpu.flags);
+		cpu = (ACPI_SRAT_CPU_AFFINITY *)srat;
+		acpi_print_srat_cpu(cpu->ApicId,
+		    cpu->ProximityDomainHi[2] << 24 |
+		    cpu->ProximityDomainHi[1] << 16 |
+		    cpu->ProximityDomainHi[0] << 0 |
+		    cpu->ProximityDomainLo, cpu->Flags);
 		break;
 	case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
-		acpi_print_srat_memory(&srat->body.mem);
-		break;
-	case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
-		acpi_print_srat_cpu(srat->body.x2apic.apic_id,
-		    srat->body.x2apic.proximity_domain,
-		    srat->body.x2apic.flags);
+		acpi_print_srat_memory((ACPI_SRAT_MEM_AFFINITY *)srat);
 		break;
 	}
 }
 
 static void
-acpi_handle_srat(struct ACPIsdt *sdp)
+acpi_handle_srat(ACPI_TABLE_HEADER *sdp)
 {
-	struct SRATbody *sratp;
-	struct SRATentry *entry;
+	ACPI_TABLE_SRAT *srat;
 
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	sratp = (struct SRATbody *)sdp->body;
-	printf("\tTable Revision=%d\n", sratp->table_revision);
-	entry = sratp->body;
-	while (((uintptr_t)entry) - ((uintptr_t)sdp) < sdp->len) {
-		printf("\n");
-		acpi_print_srat(entry);
-		entry = (struct SRATentry *)((char *)entry + entry->len);
-	}
+	srat = (ACPI_TABLE_SRAT *)sdp;
+	printf("\tTable Revision=%d\n", srat->TableRevision);
+	acpi_walk_subtables(sdp, (srat + 1), acpi_print_srat);
 	printf(END_COMMENT);
 }
 
 static void
-acpi_print_sdt(struct ACPIsdt *sdp)
+acpi_print_sdt(ACPI_TABLE_HEADER *sdp)
 {
 	printf("  ");
-	acpi_print_string(sdp->signature, 4);
+	acpi_print_string(sdp->Signature, ACPI_NAME_SIZE);
 	printf(": Length=%d, Revision=%d, Checksum=%d,\n",
-	       sdp->len, sdp->rev, sdp->check);
+	       sdp->Length, sdp->Revision, sdp->Checksum);
 	printf("\tOEMID=");
-	acpi_print_string(sdp->oemid, 6);
+	acpi_print_string(sdp->OemId, ACPI_OEM_ID_SIZE);
 	printf(", OEM Table ID=");
-	acpi_print_string(sdp->oemtblid, 8);
-	printf(", OEM Revision=0x%x,\n", sdp->oemrev);
+	acpi_print_string(sdp->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
+	printf(", OEM Revision=0x%x,\n", sdp->OemRevision);
 	printf("\tCreator ID=");
-	acpi_print_string(sdp->creator, 4);
-	printf(", Creator Revision=0x%x\n", sdp->crerev);
+	acpi_print_string(sdp->AslCompilerId, ACPI_NAME_SIZE);
+	printf(", Creator Revision=0x%x\n", sdp->AslCompilerRevision);
 }
 
 static void
-acpi_print_rsdt(struct ACPIsdt *rsdp)
+acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
 {
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
 	int	i, entries;
 	u_long	addr;
 
+	rsdt = (ACPI_TABLE_RSDT *)rsdp;
+	xsdt = (ACPI_TABLE_XSDT *)rsdp;
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(rsdp);
-	entries = (rsdp->len - SIZEOF_SDT_HDR) / addr_size;
+	entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size;
 	printf("\tEntries={ ");
 	for (i = 0; i < entries; i++) {
 		if (i > 0)
 			printf(", ");
 		switch (addr_size) {
 		case 4:
-			addr = le32dec((char*)rsdp->body + i * addr_size);
+			addr = le32toh(rsdt->TableOffsetEntry[i]);
 			break;
 		case 8:
-			addr = le64dec((char*)rsdp->body + i * addr_size);
+			addr = le64toh(xsdt->TableOffsetEntry[i]);
 			break;
 		default:
 			addr = 0;
@@ -540,138 +592,151 @@ static const char *acpi_pm_profiles[] = 
 };
 
 static void
-acpi_print_fadt(struct ACPIsdt *sdp)
+acpi_print_fadt(ACPI_TABLE_HEADER *sdp)
 {
-	struct FADTbody *fadt;
+	ACPI_TABLE_FADT *fadt;
 	const char *pm;
 	char	    sep;
 
-	fadt = (struct FADTbody *)sdp->body;
+	fadt = (ACPI_TABLE_FADT *)sdp;
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(sdp);
-	printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->facs_ptr,
-	       fadt->dsdt_ptr);
-	printf("\tINT_MODEL=%s\n", fadt->int_model ? "APIC" : "PIC");
-	if (fadt->pm_profile >= sizeof(acpi_pm_profiles) / sizeof(char *))
+	printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->Facs,
+	       fadt->Dsdt);
+	printf("\tINT_MODEL=%s\n", fadt->Model ? "APIC" : "PIC");
+	if (fadt->PreferredProfile >= sizeof(acpi_pm_profiles) / sizeof(char *))
 		pm = "Reserved";
 	else
-		pm = acpi_pm_profiles[fadt->pm_profile];
-	printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->pm_profile);
-	printf("\tSCI_INT=%d\n", fadt->sci_int);
-	printf("\tSMI_CMD=0x%x, ", fadt->smi_cmd);
-	printf("ACPI_ENABLE=0x%x, ", fadt->acpi_enable);
-	printf("ACPI_DISABLE=0x%x, ", fadt->acpi_disable);
-	printf("S4BIOS_REQ=0x%x\n", fadt->s4biosreq);
-	printf("\tPSTATE_CNT=0x%x\n", fadt->pstate_cnt);
+		pm = acpi_pm_profiles[fadt->PreferredProfile];
+	printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->PreferredProfile);
+	printf("\tSCI_INT=%d\n", fadt->SciInterrupt);
+	printf("\tSMI_CMD=0x%x, ", fadt->SmiCommand);
+	printf("ACPI_ENABLE=0x%x, ", fadt->AcpiEnable);
+	printf("ACPI_DISABLE=0x%x, ", fadt->AcpiDisable);
+	printf("S4BIOS_REQ=0x%x\n", fadt->S4BiosRequest);
+	printf("\tPSTATE_CNT=0x%x\n", fadt->PstateControl);
 	printf("\tPM1a_EVT_BLK=0x%x-0x%x\n",
-	       fadt->pm1a_evt_blk,
-	       fadt->pm1a_evt_blk + fadt->pm1_evt_len - 1);
-	if (fadt->pm1b_evt_blk != 0)
+	       fadt->Pm1aEventBlock,
+	       fadt->Pm1aEventBlock + fadt->Pm1EventLength - 1);
+	if (fadt->Pm1bEventBlock != 0)
 		printf("\tPM1b_EVT_BLK=0x%x-0x%x\n",
-		       fadt->pm1b_evt_blk,
-		       fadt->pm1b_evt_blk + fadt->pm1_evt_len - 1);
+		       fadt->Pm1bEventBlock,
+		       fadt->Pm1bEventBlock + fadt->Pm1EventLength - 1);
 	printf("\tPM1a_CNT_BLK=0x%x-0x%x\n",
-	       fadt->pm1a_cnt_blk,
-	       fadt->pm1a_cnt_blk + fadt->pm1_cnt_len - 1);
-	if (fadt->pm1b_cnt_blk != 0)
+	       fadt->Pm1aControlBlock,
+	       fadt->Pm1aControlBlock + fadt->Pm1ControlLength - 1);
+	if (fadt->Pm1bControlBlock != 0)
 		printf("\tPM1b_CNT_BLK=0x%x-0x%x\n",
-		       fadt->pm1b_cnt_blk,
-		       fadt->pm1b_cnt_blk + fadt->pm1_cnt_len - 1);
-	if (fadt->pm2_cnt_blk != 0)
+		       fadt->Pm1bControlBlock,
+		       fadt->Pm1bControlBlock + fadt->Pm1ControlLength - 1);
+	if (fadt->Pm2ControlBlock != 0)
 		printf("\tPM2_CNT_BLK=0x%x-0x%x\n",
-		       fadt->pm2_cnt_blk,
-		       fadt->pm2_cnt_blk + fadt->pm2_cnt_len - 1);
+		       fadt->Pm2ControlBlock,
+		       fadt->Pm2ControlBlock + fadt->Pm2ControlLength - 1);
 	printf("\tPM_TMR_BLK=0x%x-0x%x\n",
-	       fadt->pm_tmr_blk,
-	       fadt->pm_tmr_blk + fadt->pm_tmr_len - 1);
-	if (fadt->gpe0_blk != 0)
+	       fadt->PmTimerBlock,
+	       fadt->PmTimerBlock + fadt->PmTimerLength - 1);
+	if (fadt->Gpe0Block != 0)
 		printf("\tGPE0_BLK=0x%x-0x%x\n",
-		       fadt->gpe0_blk,
-		       fadt->gpe0_blk + fadt->gpe0_len - 1);
-	if (fadt->gpe1_blk != 0)
+		       fadt->Gpe0Block,
+		       fadt->Gpe0Block + fadt->Gpe0BlockLength - 1);
+	if (fadt->Gpe1Block != 0)
 		printf("\tGPE1_BLK=0x%x-0x%x, GPE1_BASE=%d\n",
-		       fadt->gpe1_blk,
-		       fadt->gpe1_blk + fadt->gpe1_len - 1,
-		       fadt->gpe1_base);
-	if (fadt->cst_cnt != 0)
-		printf("\tCST_CNT=0x%x\n", fadt->cst_cnt);
+		       fadt->Gpe1Block,
+		       fadt->Gpe1Block + fadt->Gpe1BlockLength - 1,
+		       fadt->Gpe1Base);
+	if (fadt->CstControl != 0)
+		printf("\tCST_CNT=0x%x\n", fadt->CstControl);
 	printf("\tP_LVL2_LAT=%d us, P_LVL3_LAT=%d us\n",
-	       fadt->p_lvl2_lat, fadt->p_lvl3_lat);
+	       fadt->C2Latency, fadt->C3Latency);
 	printf("\tFLUSH_SIZE=%d, FLUSH_STRIDE=%d\n",
-	       fadt->flush_size, fadt->flush_stride);
+	       fadt->FlushSize, fadt->FlushStride);
 	printf("\tDUTY_OFFSET=%d, DUTY_WIDTH=%d\n",
-	       fadt->duty_off, fadt->duty_width);
+	       fadt->DutyOffset, fadt->DutyWidth);
 	printf("\tDAY_ALRM=%d, MON_ALRM=%d, CENTURY=%d\n",
-	       fadt->day_alrm, fadt->mon_alrm, fadt->century);
+	       fadt->DayAlarm, fadt->MonthAlarm, fadt->Century);
 
 #define PRINTFLAG(var, flag) do {			\
-	if ((var) & FADT_FLAG_## flag) {		\
+	if ((var) & BAF_## flag) {			\
 		printf("%c%s", sep, #flag); sep = ',';	\
 	}						\
 } while (0)
 
 	printf("\tIAPC_BOOT_ARCH=");
 	sep = '{';
-	PRINTFLAG(fadt->iapc_boot_arch, LEGACY_DEV);
-	PRINTFLAG(fadt->iapc_boot_arch, 8042);
-	if (fadt->iapc_boot_arch != 0)
+	PRINTFLAG(fadt->BootFlags, LEGACY_DEVICES);
+	PRINTFLAG(fadt->BootFlags, 8042_KEYBOARD_CONTROLLER);
+	if (fadt->BootFlags != 0)
 		printf("}");
 	printf("\n");
 
+#undef PRINTFLAG
+#define PRINTFLAG(var, flag) do {			\
+	if ((var) & ACPI_FADT_## flag) {		\
+		printf("%c%s", sep, #flag); sep = ',';	\
+	}						\
+} while (0)
+
 	printf("\tFlags=");
 	sep = '{';
-	PRINTFLAG(fadt->flags, WBINVD);
-	PRINTFLAG(fadt->flags, WBINVD_FLUSH);
-	PRINTFLAG(fadt->flags, PROC_C1);
-	PRINTFLAG(fadt->flags, P_LVL2_UP);
-	PRINTFLAG(fadt->flags, PWR_BUTTON);
-	PRINTFLAG(fadt->flags, SLP_BUTTON);
-	PRINTFLAG(fadt->flags, FIX_RTC);
-	PRINTFLAG(fadt->flags, RTC_S4);
-	PRINTFLAG(fadt->flags, TMR_VAL_EXT);
-	PRINTFLAG(fadt->flags, DCK_CAP);
-	PRINTFLAG(fadt->flags, RESET_REG);
-	PRINTFLAG(fadt->flags, SEALED_CASE);
-	PRINTFLAG(fadt->flags, HEADLESS);
-	PRINTFLAG(fadt->flags, CPU_SW_SLP);
-	if (fadt->flags != 0)
+	PRINTFLAG(fadt->Flags, WBINVD);
+	PRINTFLAG(fadt->Flags, WBINVD_FLUSH);
+	PRINTFLAG(fadt->Flags, C1_SUPPORTED);
+	PRINTFLAG(fadt->Flags, C2_MP_SUPPORTED);
+	PRINTFLAG(fadt->Flags, POWER_BUTTON);
+	PRINTFLAG(fadt->Flags, SLEEP_BUTTON);
+	PRINTFLAG(fadt->Flags, FIXED_RTC);
+	PRINTFLAG(fadt->Flags, S4_RTC_WAKE);
+	PRINTFLAG(fadt->Flags, 32BIT_TIMER);
+	PRINTFLAG(fadt->Flags, DOCKING_SUPPORTED);
+	PRINTFLAG(fadt->Flags, RESET_REGISTER);
+	PRINTFLAG(fadt->Flags, SEALED_CASE);
+	PRINTFLAG(fadt->Flags, HEADLESS);
+	PRINTFLAG(fadt->Flags, SLEEP_TYPE);
+	PRINTFLAG(fadt->Flags, PCI_EXPRESS_WAKE);
+	PRINTFLAG(fadt->Flags, PLATFORM_CLOCK);
+	PRINTFLAG(fadt->Flags, S4_RTC_VALID);
+	PRINTFLAG(fadt->Flags, REMOTE_POWER_ON);
+	PRINTFLAG(fadt->Flags, APIC_CLUSTER);
+	PRINTFLAG(fadt->Flags, APIC_PHYSICAL);
+	if (fadt->Flags != 0)
 		printf("}\n");
 
 #undef PRINTFLAG
 
-	if (fadt->flags & FADT_FLAG_RESET_REG) {
+	if (fadt->Flags & ACPI_FADT_RESET_REGISTER) {
 		printf("\tRESET_REG=");
-		acpi_print_gas(&fadt->reset_reg);
-		printf(", RESET_VALUE=%#x\n", fadt->reset_value);
+		acpi_print_gas(&fadt->ResetRegister);
+		printf(", RESET_VALUE=%#x\n", fadt->ResetValue);
 	}
 	if (acpi_get_fadt_revision(fadt) > 1) {
-		printf("\tX_FACS=0x%08lx, ", (u_long)fadt->x_facs_ptr);
-		printf("X_DSDT=0x%08lx\n", (u_long)fadt->x_dsdt_ptr);
+		printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs);
+		printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt);
 		printf("\tX_PM1a_EVT_BLK=");
-		acpi_print_gas(&fadt->x_pm1a_evt_blk);
-		if (fadt->x_pm1b_evt_blk.address != 0) {
+		acpi_print_gas(&fadt->XPm1aEventBlock);
+		if (fadt->XPm1bEventBlock.Address != 0) {
 			printf("\n\tX_PM1b_EVT_BLK=");
-			acpi_print_gas(&fadt->x_pm1b_evt_blk);
+			acpi_print_gas(&fadt->XPm1bEventBlock);
 		}
 		printf("\n\tX_PM1a_CNT_BLK=");
-		acpi_print_gas(&fadt->x_pm1a_cnt_blk);
-		if (fadt->x_pm1b_cnt_blk.address != 0) {
+		acpi_print_gas(&fadt->XPm1aControlBlock);
+		if (fadt->XPm1bControlBlock.Address != 0) {
 			printf("\n\tX_PM1b_CNT_BLK=");
-			acpi_print_gas(&fadt->x_pm1b_cnt_blk);
+			acpi_print_gas(&fadt->XPm1bControlBlock);
 		}
-		if (fadt->x_pm1b_cnt_blk.address != 0) {
+		if (fadt->XPm2ControlBlock.Address != 0) {
 			printf("\n\tX_PM2_CNT_BLK=");
-			acpi_print_gas(&fadt->x_pm2_cnt_blk);
+			acpi_print_gas(&fadt->XPm2ControlBlock);
 		}
 		printf("\n\tX_PM_TMR_BLK=");
-		acpi_print_gas(&fadt->x_pm_tmr_blk);
-		if (fadt->x_gpe0_blk.address != 0) {
+		acpi_print_gas(&fadt->XPmTimerBlock);
+		if (fadt->XGpe0Block.Address != 0) {
 			printf("\n\tX_GPE0_BLK=");
-			acpi_print_gas(&fadt->x_gpe0_blk);
+			acpi_print_gas(&fadt->XGpe0Block);
 		}
-		if (fadt->x_gpe1_blk.address != 0) {
+		if (fadt->XGpe1Block.Address != 0) {
 			printf("\n\tX_GPE1_BLK=");
-			acpi_print_gas(&fadt->x_gpe1_blk);
+			acpi_print_gas(&fadt->XGpe1Block);
 		}
 		printf("\n");
 	}
@@ -680,38 +745,38 @@ acpi_print_fadt(struct ACPIsdt *sdp)
 }
 
 static void
-acpi_print_facs(struct FACSbody *facs)
+acpi_print_facs(ACPI_TABLE_FACS *facs)
 {
 	printf(BEGIN_COMMENT);
-	printf("  FACS:\tLength=%u, ", facs->len);
-	printf("HwSig=0x%08x, ", facs->hw_sig);
-	printf("Firm_Wake_Vec=0x%08x\n", facs->firm_wake_vec);
+	printf("  FACS:\tLength=%u, ", facs->Length);
+	printf("HwSig=0x%08x, ", facs->HardwareSignature);
+	printf("Firm_Wake_Vec=0x%08x\n", facs->FirmwareWakingVector);
 
 	printf("\tGlobal_Lock=");
-	if (facs->global_lock != 0) {
-		if (facs->global_lock & FACS_FLAG_LOCK_PENDING)
+	if (facs->GlobalLock != 0) {
+		if (facs->GlobalLock & ACPI_GLOCK_PENDING)
 			printf("PENDING,");
-		if (facs->global_lock & FACS_FLAG_LOCK_OWNED)
+		if (facs->GlobalLock & ACPI_GLOCK_OWNED)
 			printf("OWNED");
 	}
 	printf("\n");
 
 	printf("\tFlags=");
-	if (facs->flags & FACS_FLAG_S4BIOS_F)
+	if (facs->Flags & ACPI_FACS_S4_BIOS_PRESENT)
 		printf("S4BIOS");
 	printf("\n");
 
-	if (facs->x_firm_wake_vec != 0) {
+	if (facs->XFirmwareWakingVector != 0) {
 		printf("\tX_Firm_Wake_Vec=%08lx\n",
-		       (u_long)facs->x_firm_wake_vec);
+		       (u_long)facs->XFirmwareWakingVector);
 	}
-	printf("\tVersion=%u\n", facs->version);
+	printf("\tVersion=%u\n", facs->Version);
 
 	printf(END_COMMENT);
 }
 
 static void
-acpi_print_dsdt(struct ACPIsdt *dsdp)
+acpi_print_dsdt(ACPI_TABLE_HEADER *dsdp)
 {
 	printf(BEGIN_COMMENT);
 	acpi_print_sdt(dsdp);
@@ -721,8 +786,8 @@ acpi_print_dsdt(struct ACPIsdt *dsdp)
 int
 acpi_checksum(void *p, size_t length)

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

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 14:53:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F41671065676;
	Thu, 29 Oct 2009 14:53:45 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E373E8FC0A;
	Thu, 29 Oct 2009 14:53: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 n9TErjrp099931;
	Thu, 29 Oct 2009 14:53:45 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TErjJu099928;
	Thu, 29 Oct 2009 14:53:45 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910291453.n9TErjJu099928@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 29 Oct 2009 14:53: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: r198593 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 14:53:46 -0000

Author: emaste
Date: Thu Oct 29 14:53:45 2009
New Revision: 198593
URL: http://svn.freebsd.org/changeset/base/198593

Log:
  Rename aac_fast_intr to aac_filter to reflect its current use.  Eliminate
  the fallback of using the filter as an interrupt handler, as it is no
  longer needed.
  
  Discussed with:	scottl, jhb

Modified:
  head/sys/dev/aac/aac.c
  head/sys/dev/aac/aacvar.h

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c	Thu Oct 29 14:52:32 2009	(r198592)
+++ head/sys/dev/aac/aac.c	Thu Oct 29 14:53:45 2009	(r198593)
@@ -909,8 +909,11 @@ aac_new_intr(void *arg)
 	mtx_unlock(&sc->aac_io_lock);
 }
 
+/*
+ * Interrupt filter for !NEW_COMM interface.
+ */
 int
-aac_fast_intr(void *arg)
+aac_filter(void *arg)
 {
 	struct aac_softc *sc;
 	u_int16_t reason;
@@ -2032,18 +2035,11 @@ aac_setup_intr(struct aac_softc *sc)
 		}
 	} else {
 		if (bus_setup_intr(sc->aac_dev, sc->aac_irq,
-				   INTR_TYPE_BIO, aac_fast_intr, NULL,
+				   INTR_TYPE_BIO, aac_filter, NULL,
 				   sc, &sc->aac_intr)) {
 			device_printf(sc->aac_dev,
-				      "can't set up FAST interrupt\n");
-			if (bus_setup_intr(sc->aac_dev, sc->aac_irq,
-					   INTR_MPSAFE|INTR_TYPE_BIO,
-					   NULL, (driver_intr_t *)aac_fast_intr,
-					   sc, &sc->aac_intr)) {
-				device_printf(sc->aac_dev,
-					     "can't set up MPSAFE interrupt\n");
-				return (EINVAL);
-			}
+				      "can't set up interrupt filter\n");
+			return (EINVAL);
 		}
 	}
 	return (0);

Modified: head/sys/dev/aac/aacvar.h
==============================================================================
--- head/sys/dev/aac/aacvar.h	Thu Oct 29 14:52:32 2009	(r198592)
+++ head/sys/dev/aac/aacvar.h	Thu Oct 29 14:53:45 2009	(r198593)
@@ -448,7 +448,7 @@ extern int		aac_shutdown(device_t dev);
 extern int		aac_suspend(device_t dev); 
 extern int		aac_resume(device_t dev);
 extern void		aac_new_intr(void *arg);
-extern int		aac_fast_intr(void *arg);
+extern int		aac_filter(void *arg);
 extern void		aac_submit_bio(struct bio *bp);
 extern void		aac_biodone(struct bio *bp);
 extern void		aac_startio(struct aac_softc *sc);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:09:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 76E5D106568B;
	Thu, 29 Oct 2009 15:09:55 +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 2E52E8FC16;
	Thu, 29 Oct 2009 15:09: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 n9TF9toQ000456;
	Thu, 29 Oct 2009 15:09:55 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TF9s7L000450;
	Thu, 29 Oct 2009 15:09:54 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291509.n9TF9s7L000450@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:09:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198594 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:09:55 -0000

Author: jhb
Date: Thu Oct 29 15:09:54 2009
New Revision: 198594
URL: http://svn.freebsd.org/changeset/base/198594

Log:
  MFC 196615:
  Extend the device pager to support different memory attributes on different
  pages in an object.
  - Add a new variant of d_mmap() currently called d_mmap2() which accepts
    an additional in/out parameter that is the memory attribute to use for
    the requested page.
  - A driver either uses d_mmap() or d_mmap2() for all requests but not both.
    The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
    that the driver provides a d_mmap2() handler instead of d_mmap().  This
    is done to make the change ABI compatible with existing drivers and
    MFC'able to 7 and 8.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_conf.c
  stable/8/sys/sys/conf.h
  stable/8/sys/sys/types.h
  stable/8/sys/vm/device_pager.c
  stable/8/sys/vm/vm.h

Modified: stable/8/sys/kern/kern_conf.c
==============================================================================
--- stable/8/sys/kern/kern_conf.c	Thu Oct 29 14:53:45 2009	(r198593)
+++ stable/8/sys/kern/kern_conf.c	Thu Oct 29 15:09:54 2009	(r198594)
@@ -302,7 +302,7 @@ static struct cdevsw dead_cdevsw = {
 #define no_read		(d_read_t *)enodev
 #define no_write	(d_write_t *)enodev
 #define no_ioctl	(d_ioctl_t *)enodev
-#define no_mmap		(d_mmap_t *)enodev
+#define no_mmap		(d_mmap2_t *)enodev
 #define no_kqfilter	(d_kqfilter_t *)enodev
 #define no_mmap_single	(d_mmap_single_t *)enodev
 
@@ -469,7 +469,8 @@ giant_kqfilter(struct cdev *dev, struct 
 }
 
 static int
-giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
+giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot,
+    vm_memattr_t *memattr)
 {
 	struct cdevsw *dsw;
 	int retval;
@@ -478,7 +479,11 @@ giant_mmap(struct cdev *dev, vm_offset_t
 	if (dsw == NULL)
 		return (ENXIO);
 	mtx_lock(&Giant);
-	retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
+	if (dsw->d_gianttrick->d_flags & D_MMAP2)
+		retval = dsw->d_gianttrick->d_mmap2(dev, offset, paddr, nprot,
+		    memattr);
+	else
+		retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
 	mtx_unlock(&Giant);
 	dev_relthread(dev);
 	return (retval);
@@ -614,6 +619,7 @@ prep_cdevsw(struct cdevsw *devsw)
 		if (devsw->d_gianttrick == NULL) {
 			memcpy(dsw2, devsw, sizeof *dsw2);
 			devsw->d_gianttrick = dsw2;
+			devsw->d_flags |= D_MMAP2;
 			dsw2 = NULL;
 		}
 	}
@@ -634,7 +640,7 @@ prep_cdevsw(struct cdevsw *devsw)
 	FIXUP(d_write,		no_write,	giant_write);
 	FIXUP(d_ioctl,		no_ioctl,	giant_ioctl);
 	FIXUP(d_poll,		no_poll,	giant_poll);
-	FIXUP(d_mmap,		no_mmap,	giant_mmap);
+	FIXUP(d_mmap2,		no_mmap,	giant_mmap);
 	FIXUP(d_strategy,	no_strategy,	giant_strategy);
 	FIXUP(d_kqfilter,	no_kqfilter,	giant_kqfilter);
 	FIXUP(d_mmap_single,	no_mmap_single,	giant_mmap_single);

Modified: stable/8/sys/sys/conf.h
==============================================================================
--- stable/8/sys/sys/conf.h	Thu Oct 29 14:53:45 2009	(r198593)
+++ stable/8/sys/sys/conf.h	Thu Oct 29 15:09:54 2009	(r198594)
@@ -137,6 +137,8 @@ typedef int d_poll_t(struct cdev *dev, i
 typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn);
 typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
    		     int nprot);
+typedef int d_mmap2_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
+		     int nprot, vm_memattr_t *memattr);
 typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset,
     vm_size_t size, struct vm_object **object, int nprot);
 typedef void d_purge_t(struct cdev *dev);
@@ -170,6 +172,7 @@ typedef int dumper_t(
 #define D_PSEUDO	0x00200000	/* make_dev() can return NULL */
 #define D_NEEDGIANT	0x00400000	/* driver want Giant */
 #define	D_NEEDMINOR	0x00800000	/* driver uses clone_create() */
+#define	D_MMAP2		0x01000000	/* driver uses d_mmap2() */
 
 /*
  * Version numbers.
@@ -198,7 +201,10 @@ struct cdevsw {
 	d_write_t		*d_write;
 	d_ioctl_t		*d_ioctl;
 	d_poll_t		*d_poll;
-	d_mmap_t		*d_mmap;
+	union {
+		d_mmap_t		*old;
+		d_mmap2_t		*new;
+	} __d_mmap;
 	d_strategy_t		*d_strategy;
 	dumper_t		*d_dump;
 	d_kqfilter_t		*d_kqfilter;
@@ -218,6 +224,8 @@ struct cdevsw {
 		SLIST_ENTRY(cdevsw)	postfree_list;
 	} __d_giant;
 };
+#define	d_mmap			__d_mmap.old
+#define	d_mmap2			__d_mmap.new
 #define	d_gianttrick		__d_giant.gianttrick
 #define	d_postfree_list		__d_giant.postfree_list
 

Modified: stable/8/sys/sys/types.h
==============================================================================
--- stable/8/sys/sys/types.h	Thu Oct 29 14:53:45 2009	(r198593)
+++ stable/8/sys/sys/types.h	Thu Oct 29 15:09:54 2009	(r198594)
@@ -299,6 +299,7 @@ typedef	__uint32_t	intrmask_t;	/* Interr
 
 typedef	__uintfptr_t	uintfptr_t;
 typedef	__uint64_t	uoff_t;
+typedef	char		vm_memattr_t;	/* memory attribute codes */
 typedef	struct vm_page	*vm_page_t;
 
 #define offsetof(type, field) __offsetof(type, field)

Modified: stable/8/sys/vm/device_pager.c
==============================================================================
--- stable/8/sys/vm/device_pager.c	Thu Oct 29 14:53:45 2009	(r198593)
+++ stable/8/sys/vm/device_pager.c	Thu Oct 29 15:09:54 2009	(r198594)
@@ -93,6 +93,17 @@ dev_pager_init()
 	    UMA_ZONE_NOFREE|UMA_ZONE_VM); 
 }
 
+static __inline int
+dev_mmap(struct cdevsw *csw, struct cdev *dev, vm_offset_t offset,
+    vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
+{
+
+	if (csw->d_flags & D_MMAP2)
+		return (csw->d_mmap2(dev, offset, paddr, nprot, memattr));
+	else
+		return (csw->d_mmap(dev, offset, paddr, nprot));
+}
+
 /*
  * MPSAFE
  */
@@ -106,6 +117,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	unsigned int npages;
 	vm_paddr_t paddr;
 	vm_offset_t off;
+	vm_memattr_t dummy;
 	struct cdevsw *csw;
 
 	/*
@@ -133,7 +145,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	 */
 	npages = OFF_TO_IDX(size);
 	for (off = foff; npages--; off += PAGE_SIZE)
-		if ((*csw->d_mmap)(dev, off, &paddr, (int)prot) != 0) {
+		if (dev_mmap(csw, dev, off, &paddr, (int)prot, &dummy) != 0) {
 			dev_relthread(dev);
 			return (NULL);
 		}
@@ -214,7 +226,6 @@ dev_pager_getpages(object, m, count, req
 	vm_memattr_t memattr;
 	struct cdev *dev;
 	int i, ret;
-	int prot;
 	struct cdevsw *csw;
 	struct thread *td;
 	struct file *fpop;
@@ -228,12 +239,11 @@ dev_pager_getpages(object, m, count, req
 	csw = dev_refthread(dev);
 	if (csw == NULL)
 		panic("dev_pager_getpage: no cdevsw");
-	prot = PROT_READ;	/* XXX should pass in? */
-
 	td = curthread;
 	fpop = td->td_fpop;
 	td->td_fpop = NULL;
-	ret = (*csw->d_mmap)(dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, prot);
+	ret = dev_mmap(csw, dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr,
+	    PROT_READ, &memattr);
 	KASSERT(ret == 0, ("dev_pager_getpage: map function returns error"));
 	td->td_fpop = fpop;
 	dev_relthread(dev);

Modified: stable/8/sys/vm/vm.h
==============================================================================
--- stable/8/sys/vm/vm.h	Thu Oct 29 14:53:45 2009	(r198593)
+++ stable/8/sys/vm/vm.h	Thu Oct 29 15:09:54 2009	(r198594)
@@ -63,12 +63,6 @@
 
 #include 
 
-/*
- * The exact set of memory attributes is machine dependent.  However, every
- * machine is required to define VM_MEMATTR_DEFAULT.
- */
-typedef	char vm_memattr_t;	/* memory attribute codes */
-
 typedef char vm_inherit_t;	/* inheritance codes */
 
 #define	VM_INHERIT_SHARE	((vm_inherit_t) 0)
@@ -115,6 +109,12 @@ typedef struct vm_object *vm_object_t;
 typedef int boolean_t;
 
 /*
+ * The exact set of memory attributes is machine dependent.  However, every
+ * machine is required to define VM_MEMATTR_DEFAULT.
+ */
+typedef	char vm_memattr_t;	/* memory attribute codes */
+
+/*
  * This is defined in  for the kernel so that vnode_if.h
  * doesn't have to include .
  */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:10:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 17D1210656A5;
	Thu, 29 Oct 2009 15:10:39 +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 059D78FC2E;
	Thu, 29 Oct 2009 15:10: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 n9TFAcWM000518;
	Thu, 29 Oct 2009 15:10:38 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFAcNw000512;
	Thu, 29 Oct 2009 15:10:38 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291510.n9TFAcNw000512@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:10:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198595 - in stable/7/sys: . contrib/pf kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:10:39 -0000

Author: jhb
Date: Thu Oct 29 15:10:38 2009
New Revision: 198595
URL: http://svn.freebsd.org/changeset/base/198595

Log:
  MFC 196615:
  Extend the device pager to support different memory attributes on different
  pages in an object.
  - Add a new variant of d_mmap() currently called d_mmap2() which accepts
    an additional in/out parameter that is the memory attribute to use for
    the requested page.
  - A driver either uses d_mmap() or d_mmap2() for all requests but not both.
    The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
    that the driver provides a d_mmap2() handler instead of d_mmap().  This
    is done to make the change ABI compatible with existing drivers and
    MFC'able to 7 and 8.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/kern/kern_conf.c
  stable/7/sys/sys/conf.h
  stable/7/sys/sys/types.h
  stable/7/sys/vm/device_pager.c
  stable/7/sys/vm/vm.h

Modified: stable/7/sys/kern/kern_conf.c
==============================================================================
--- stable/7/sys/kern/kern_conf.c	Thu Oct 29 15:09:54 2009	(r198594)
+++ stable/7/sys/kern/kern_conf.c	Thu Oct 29 15:10:38 2009	(r198595)
@@ -303,7 +303,7 @@ static struct cdevsw dead_cdevsw = {
 #define no_read		(d_read_t *)enodev
 #define no_write	(d_write_t *)enodev
 #define no_ioctl	(d_ioctl_t *)enodev
-#define no_mmap		(d_mmap_t *)enodev
+#define no_mmap		(d_mmap2_t *)enodev
 #define no_kqfilter	(d_kqfilter_t *)enodev
 #define no_mmap_single	(d_mmap_single_t *)enodev
 
@@ -470,7 +470,8 @@ giant_kqfilter(struct cdev *dev, struct 
 }
 
 static int
-giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
+giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot,
+    vm_memattr_t *memattr)
 {
 	struct cdevsw *dsw;
 	int retval;
@@ -479,7 +480,11 @@ giant_mmap(struct cdev *dev, vm_offset_t
 	if (dsw == NULL)
 		return (ENXIO);
 	mtx_lock(&Giant);
-	retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
+	if (dsw->d_gianttrick->d_flags & D_MMAP2)
+		retval = dsw->d_gianttrick->d_mmap2(dev, offset, paddr, nprot,
+		    memattr);
+	else
+		retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
 	mtx_unlock(&Giant);
 	dev_relthread(dev);
 	return (retval);
@@ -669,6 +674,7 @@ prep_cdevsw(struct cdevsw *devsw)
 		if (devsw->d_gianttrick == NULL) {
 			memcpy(dsw2, devsw, sizeof *dsw2);
 			devsw->d_gianttrick = dsw2;
+			devsw->d_flags |= D_MMAP2;
 			dsw2 = NULL;
 		}
 	}
@@ -689,7 +695,7 @@ prep_cdevsw(struct cdevsw *devsw)
 	FIXUP(d_write,		no_write,	giant_write);
 	FIXUP(d_ioctl,		no_ioctl,	giant_ioctl);
 	FIXUP(d_poll,		no_poll,	giant_poll);
-	FIXUP(d_mmap,		no_mmap,	giant_mmap);
+	FIXUP(d_mmap2,		no_mmap,	giant_mmap);
 	FIXUP(d_strategy,	no_strategy,	giant_strategy);
 	FIXUP(d_kqfilter,	no_kqfilter,	giant_kqfilter);
 	FIXUP(d_mmap_single,	no_mmap_single,	giant_mmap_single);

Modified: stable/7/sys/sys/conf.h
==============================================================================
--- stable/7/sys/sys/conf.h	Thu Oct 29 15:09:54 2009	(r198594)
+++ stable/7/sys/sys/conf.h	Thu Oct 29 15:10:38 2009	(r198595)
@@ -140,6 +140,8 @@ typedef int d_poll_t(struct cdev *dev, i
 typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn);
 typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
    		     int nprot);
+typedef int d_mmap2_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
+		     int nprot, vm_memattr_t *memattr);
 typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset,
     vm_size_t size, struct vm_object **object, int nprot);
 typedef void d_purge_t(struct cdev *dev);
@@ -172,6 +174,7 @@ typedef int dumper_t(
 #define D_MMAP_ANON	0x00100000	/* special treatment in vm_mmap.c */
 #define D_PSEUDO	0x00200000	/* make_dev() can return NULL */
 #define D_NEEDGIANT	0x00400000	/* driver want Giant */
+#define	D_MMAP2		0x01000000	/* driver uses d_mmap2() */
 
 /*
  * Version numbers.
@@ -200,7 +203,10 @@ struct cdevsw {
 	d_write_t		*d_write;
 	d_ioctl_t		*d_ioctl;
 	d_poll_t		*d_poll;
-	d_mmap_t		*d_mmap;
+	union {
+		d_mmap_t		*old;
+		d_mmap2_t		*new;
+	} __d_mmap;
 	d_strategy_t		*d_strategy;
 	dumper_t		*d_dump;
 	d_kqfilter_t		*d_kqfilter;
@@ -220,6 +226,8 @@ struct cdevsw {
 		SLIST_ENTRY(cdevsw)	postfree_list;
 	} __d_giant;
 };
+#define	d_mmap			__d_mmap.old
+#define	d_mmap2			__d_mmap.new
 #define	d_gianttrick		__d_giant.gianttrick
 #define	d_postfree_list		__d_giant.postfree_list
 

Modified: stable/7/sys/sys/types.h
==============================================================================
--- stable/7/sys/sys/types.h	Thu Oct 29 15:09:54 2009	(r198594)
+++ stable/7/sys/sys/types.h	Thu Oct 29 15:10:38 2009	(r198595)
@@ -299,6 +299,7 @@ typedef	__uint32_t	intrmask_t;	/* Interr
 
 typedef	__uintfptr_t	uintfptr_t;
 typedef	__uint64_t	uoff_t;
+typedef	char		vm_memattr_t;	/* memory attribute codes */
 typedef	struct vm_page	*vm_page_t;
 
 #define offsetof(type, field) __offsetof(type, field)

Modified: stable/7/sys/vm/device_pager.c
==============================================================================
--- stable/7/sys/vm/device_pager.c	Thu Oct 29 15:09:54 2009	(r198594)
+++ stable/7/sys/vm/device_pager.c	Thu Oct 29 15:10:38 2009	(r198595)
@@ -93,6 +93,17 @@ dev_pager_init()
 	    UMA_ZONE_NOFREE|UMA_ZONE_VM); 
 }
 
+static __inline int
+dev_mmap(struct cdevsw *csw, struct cdev *dev, vm_offset_t offset,
+    vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
+{
+
+	if (csw->d_flags & D_MMAP2)
+		return (csw->d_mmap2(dev, offset, paddr, nprot, memattr));
+	else
+		return (csw->d_mmap(dev, offset, paddr, nprot));
+}
+
 /*
  * MPSAFE
  */
@@ -105,6 +116,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	unsigned int npages;
 	vm_paddr_t paddr;
 	vm_offset_t off;
+	vm_memattr_t dummy;
 	struct cdevsw *csw;
 
 	/*
@@ -132,7 +144,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	 */
 	npages = OFF_TO_IDX(size);
 	for (off = foff; npages--; off += PAGE_SIZE)
-		if ((*csw->d_mmap)(dev, off, &paddr, (int)prot) != 0) {
+		if (dev_mmap(csw, dev, off, &paddr, (int)prot, &dummy) != 0) {
 			dev_relthread(dev);
 			return (NULL);
 		}
@@ -213,7 +225,6 @@ dev_pager_getpages(object, m, count, req
 	vm_memattr_t memattr;
 	struct cdev *dev;
 	int i, ret;
-	int prot;
 	struct cdevsw *csw;
 	struct thread *td;
 	struct file *fpop;
@@ -227,12 +238,11 @@ dev_pager_getpages(object, m, count, req
 	csw = dev_refthread(dev);
 	if (csw == NULL)
 		panic("dev_pager_getpage: no cdevsw");
-	prot = PROT_READ;	/* XXX should pass in? */
-
 	td = curthread;
 	fpop = td->td_fpop;
 	td->td_fpop = NULL;
-	ret = (*csw->d_mmap)(dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, prot);
+	ret = dev_mmap(csw, dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr,
+	    PROT_READ, &memattr);
 	KASSERT(ret == 0, ("dev_pager_getpage: map function returns error"));
 	td->td_fpop = fpop;
 	dev_relthread(dev);

Modified: stable/7/sys/vm/vm.h
==============================================================================
--- stable/7/sys/vm/vm.h	Thu Oct 29 15:09:54 2009	(r198594)
+++ stable/7/sys/vm/vm.h	Thu Oct 29 15:10:38 2009	(r198595)
@@ -63,12 +63,6 @@
 
 #include 
 
-/*
- * The exact set of memory attributes is machine dependent.  However, every
- * machine is required to define VM_MEMATTR_DEFAULT.
- */
-typedef	char vm_memattr_t;	/* memory attribute codes */
-
 typedef char vm_inherit_t;	/* inheritance codes */
 
 #define	VM_INHERIT_SHARE	((vm_inherit_t) 0)
@@ -115,6 +109,12 @@ typedef struct vm_object *vm_object_t;
 typedef int boolean_t;
 
 /*
+ * The exact set of memory attributes is machine dependent.  However, every
+ * machine is required to define VM_MEMATTR_DEFAULT.
+ */
+typedef	char vm_memattr_t;	/* memory attribute codes */
+
+/*
  * This is defined in  for the kernel so that vnode_if.h
  * doesn't have to include .
  */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:13:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C212A106566B;
	Thu, 29 Oct 2009 15:13:36 +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 AFC6D8FC20;
	Thu, 29 Oct 2009 15:13: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 n9TFDalS000643;
	Thu, 29 Oct 2009 15:13:36 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFDai4000641;
	Thu, 29 Oct 2009 15:13:36 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291513.n9TFDai4000641@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:13:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198596 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/acpi_support dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:13:36 -0000

Author: jhb
Date: Thu Oct 29 15:13:36 2009
New Revision: 198596
URL: http://svn.freebsd.org/changeset/base/198596

Log:
  MFC 197460:
  Remove unnecessary locking from attach().  This fixes a LOR between the
  acpi_ibm lock and the sysctl lock.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpi_support/acpi_ibm.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/acpi_support/acpi_ibm.c
==============================================================================
--- stable/8/sys/dev/acpi_support/acpi_ibm.c	Thu Oct 29 15:10:38 2009	(r198595)
+++ stable/8/sys/dev/acpi_support/acpi_ibm.c	Thu Oct 29 15:13:36 2009	(r198596)
@@ -356,8 +356,6 @@ acpi_ibm_attach(device_t dev)
 	}
 	sc->ec_handle = acpi_get_handle(sc->ec_dev);
 
-	ACPI_SERIAL_BEGIN(ibm);
-
 	/* Get the sysctl tree */
 	sc->sysctl_ctx = device_get_sysctl_ctx(dev);
 	sc->sysctl_tree = device_get_sysctl_tree(dev);
@@ -404,8 +402,6 @@ acpi_ibm_attach(device_t dev)
 		    "Thermal zones");
 	}
 
-	ACPI_SERIAL_END(ibm);
-
 	/* Handle notifies */
 	AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY,
 	    acpi_ibm_notify, dev);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:13:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4C8091065694;
	Thu, 29 Oct 2009 15:13:51 +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 3B2438FC08;
	Thu, 29 Oct 2009 15:13: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 n9TFDpla000683;
	Thu, 29 Oct 2009 15:13:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFDpk8000681;
	Thu, 29 Oct 2009 15:13:51 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291513.n9TFDpk8000681@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:13:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198597 - in stable/7/sys: . contrib/pf dev/acpi_support
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:13:51 -0000

Author: jhb
Date: Thu Oct 29 15:13:50 2009
New Revision: 198597
URL: http://svn.freebsd.org/changeset/base/198597

Log:
  MFC 197460:
  Remove unnecessary locking from attach().  This fixes a LOR between the
  acpi_ibm lock and the sysctl lock.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpi_support/acpi_ibm.c

Modified: stable/7/sys/dev/acpi_support/acpi_ibm.c
==============================================================================
--- stable/7/sys/dev/acpi_support/acpi_ibm.c	Thu Oct 29 15:13:36 2009	(r198596)
+++ stable/7/sys/dev/acpi_support/acpi_ibm.c	Thu Oct 29 15:13:50 2009	(r198597)
@@ -356,8 +356,6 @@ acpi_ibm_attach(device_t dev)
 	}
 	sc->ec_handle = acpi_get_handle(sc->ec_dev);
 
-	ACPI_SERIAL_BEGIN(ibm);
-
 	/* Get the sysctl tree */
 	sc->sysctl_ctx = device_get_sysctl_ctx(dev);
 	sc->sysctl_tree = device_get_sysctl_tree(dev);
@@ -404,8 +402,6 @@ acpi_ibm_attach(device_t dev)
 		    "Thermal zones");
 	}
 
-	ACPI_SERIAL_END(ibm);
-
 	/* Handle notifies */
 	AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY,
 	    acpi_ibm_notify, dev);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:18:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5BC811065676;
	Thu, 29 Oct 2009 15:18:00 +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 3F4CB8FC14;
	Thu, 29 Oct 2009 15:18: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 n9TFI05P000849;
	Thu, 29 Oct 2009 15:18:00 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFI0DD000847;
	Thu, 29 Oct 2009 15:18:00 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291518.n9TFI0DD000847@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:18:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198598 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/cxgb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:18:00 -0000

Author: jhb
Date: Thu Oct 29 15:17:59 2009
New Revision: 198598
URL: http://svn.freebsd.org/changeset/base/198598

Log:
  MFC 196840:
  Fill the reverse RSS map with 0xff's so that the subsequent loop to
  calculate the values will work properly.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/cxgb/cxgb_main.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/8/sys/dev/cxgb/cxgb_main.c	Thu Oct 29 15:13:50 2009	(r198597)
+++ stable/8/sys/dev/cxgb/cxgb_main.c	Thu Oct 29 15:17:59 2009	(r198598)
@@ -1456,7 +1456,10 @@ setup_rss(adapter_t *adap)
 		rspq_map[i] = nq[0] ? i % nq[0] : 0;
 		rspq_map[i + RSS_TABLE_SIZE / 2] = nq[1] ? i % nq[1] + nq[0] : 0;
 	}
+
 	/* Calculate the reverse RSS map table */
+	for (i = 0; i < SGE_QSETS; ++i)
+		adap->rrss_map[i] = 0xff;
 	for (i = 0; i < RSS_TABLE_SIZE; ++i)
 		if (adap->rrss_map[rspq_map[i]] == 0xff)
 			adap->rrss_map[rspq_map[i]] = i;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:18:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B185010656A5;
	Thu, 29 Oct 2009 15:18:24 +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 A036A8FC0A;
	Thu, 29 Oct 2009 15:18: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 n9TFIOvm000897;
	Thu, 29 Oct 2009 15:18:24 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFIOD0000895;
	Thu, 29 Oct 2009 15:18:24 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291518.n9TFIOD0000895@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:18:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198599 - in stable/7/sys: . contrib/pf dev/cxgb
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:18:24 -0000

Author: jhb
Date: Thu Oct 29 15:18:24 2009
New Revision: 198599
URL: http://svn.freebsd.org/changeset/base/198599

Log:
  MFC 196840:
  Fill the reverse RSS map with 0xff's so that the subsequent loop to
  calculate the values will work properly.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/cxgb_main.c

Modified: stable/7/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- stable/7/sys/dev/cxgb/cxgb_main.c	Thu Oct 29 15:17:59 2009	(r198598)
+++ stable/7/sys/dev/cxgb/cxgb_main.c	Thu Oct 29 15:18:24 2009	(r198599)
@@ -1498,7 +1498,10 @@ setup_rss(adapter_t *adap)
 		rspq_map[i] = nq[0] ? i % nq[0] : 0;
 		rspq_map[i + RSS_TABLE_SIZE / 2] = nq[1] ? i % nq[1] + nq[0] : 0;
 	}
+
 	/* Calculate the reverse RSS map table */
+	for (i = 0; i < SGE_QSETS; ++i)
+		adap->rrss_map[i] = 0xff;
 	for (i = 0; i < RSS_TABLE_SIZE; ++i)
 		if (adap->rrss_map[rspq_map[i]] == 0xff)
 			adap->rrss_map[rspq_map[i]] = i;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:24:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23F1E106568F;
	Thu, 29 Oct 2009 15:24:58 +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 10DF38FC18;
	Thu, 29 Oct 2009 15:24: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 n9TFOvnl001105;
	Thu, 29 Oct 2009 15:24:57 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFOvB8001103;
	Thu, 29 Oct 2009 15:24:57 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291524.n9TFOvB8001103@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:24:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198600 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/acpica dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:24:58 -0000

Author: jhb
Date: Thu Oct 29 15:24:57 2009
New Revision: 198600
URL: http://svn.freebsd.org/changeset/base/198600

Log:
  MFC 197648:
  Split the 'video' ACPI lock up into two locks to resolve a LOR with the
  sysctl lock.  The 'video' lock now protects the 'bus' of video output
  devices attached to a graphics adapter.  It is used when iterating over
  the list of outputs, etc.  The 'video_output' lock is used to lock the
  output-specific data similar to a driver lock for the individual video
  outputs.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpica/acpi_video.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_video.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_video.c	Thu Oct 29 15:18:24 2009	(r198599)
+++ stable/8/sys/dev/acpica/acpi_video.c	Thu Oct 29 15:24:57 2009	(r198600)
@@ -170,7 +170,13 @@ static struct sysctl_oid	*acpi_video_sys
 static struct acpi_video_output_queue crt_units, tv_units,
     ext_units, lcd_units, other_units;
 
+/*
+ * The 'video' lock protects the hierarchy of video output devices
+ * (the video "bus").  The 'video_output' lock protects per-output
+ * data is equivalent to a softc lock for each video output.
+ */
 ACPI_SERIAL_DECL(video, "ACPI video");
+ACPI_SERIAL_DECL(video_output, "ACPI video output");
 MALLOC_DEFINE(M_ACPIVIDEO, "acpivideo", "ACPI video extension");
 
 static int
@@ -236,12 +242,14 @@ acpi_video_attach(device_t dev)
 	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
 	if (acpi_sc == NULL)
 		return (ENXIO);
+	ACPI_SERIAL_BEGIN(video);
 	if (acpi_video_sysctl_tree == NULL) {
 		acpi_video_sysctl_tree = SYSCTL_ADD_NODE(&acpi_video_sysctl_ctx,
 				    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
 				    OID_AUTO, "video", CTLFLAG_RD, 0,
 				    "video extension control");
 	}
+	ACPI_SERIAL_END(video);
 
 	sc->device = dev;
 	sc->handle = acpi_get_handle(dev);
@@ -317,6 +325,7 @@ acpi_video_notify_handler(ACPI_HANDLE ha
 		dss_p = 0;
 		lasthand = NULL;
 		ACPI_SERIAL_BEGIN(video);
+		ACPI_SERIAL_BEGIN(video_output);
 		STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
 			dss = vo_get_graphics_state(vo->handle);
 			dcs = vo_get_device_status(vo->handle);
@@ -332,6 +341,7 @@ acpi_video_notify_handler(ACPI_HANDLE ha
 		}
 		if (lasthand != NULL)
 			vo_set_device_state(lasthand, dss_p|DSS_COMMIT);
+		ACPI_SERIAL_END(video_output);
 		ACPI_SERIAL_END(video);
 		break;
 	case VID_NOTIFY_REPROBE:
@@ -368,12 +378,14 @@ acpi_video_power_profile(void *context)
 		return;
 
 	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
 		if (vo->vo_levels != NULL && vo->vo_brightness == -1)
 			vo_set_brightness(vo->handle,
 			    state == POWER_PROFILE_ECONOMY ?
 			    vo->vo_economy : vo->vo_fullpower);
 	}
+	ACPI_SERIAL_END(video_output);
 	ACPI_SERIAL_END(video);
 }
 
@@ -551,7 +563,7 @@ static void
 acpi_video_vo_bind(struct acpi_video_output *vo, ACPI_HANDLE handle)
 {
 
-	ACPI_SERIAL_ASSERT(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->vo_levels != NULL)
 		AcpiOsFree(vo->vo_levels);
 	vo->handle = handle;
@@ -566,6 +578,7 @@ acpi_video_vo_bind(struct acpi_video_out
 			/* XXX - see above. */
 			vo->vo_economy = vo->vo_levels[BCL_ECONOMY];
 	}
+	ACPI_SERIAL_END(video_output);
 }
 
 static void
@@ -606,7 +619,7 @@ acpi_video_vo_check_level(struct acpi_vi
 {
 	int i;
 
-	ACPI_SERIAL_ASSERT(video);
+	ACPI_SERIAL_ASSERT(video_output);
 	if (vo->vo_levels == NULL)
 		return (ENODEV);
 	for (i = 0; i < vo->vo_numlevels; i++)
@@ -625,7 +638,7 @@ acpi_video_vo_active_sysctl(SYSCTL_HANDL
 	vo = (struct acpi_video_output *)arg1;
 	if (vo->handle == NULL)
 		return (ENXIO);
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	state = (vo_get_device_status(vo->handle) & DCS_ACTIVE) ? 1 : 0;
 	err = sysctl_handle_int(oidp, &state, 0, req);
 	if (err != 0 || req->newptr == NULL)
@@ -633,7 +646,7 @@ acpi_video_vo_active_sysctl(SYSCTL_HANDL
 	vo_set_device_state(vo->handle,
 	    DSS_COMMIT | (state ? DSS_ACTIVE : DSS_INACTIVE));
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -645,7 +658,7 @@ acpi_video_vo_bright_sysctl(SYSCTL_HANDL
 	int level, preset, err;
 
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->handle == NULL) {
 		err = ENXIO;
 		goto out;
@@ -675,7 +688,7 @@ acpi_video_vo_bright_sysctl(SYSCTL_HANDL
 	vo_set_brightness(vo->handle, (level == -1) ? preset : level);
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -687,7 +700,7 @@ acpi_video_vo_presets_sysctl(SYSCTL_HAND
 
 	err = 0;
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->handle == NULL) {
 		err = ENXIO;
 		goto out;
@@ -718,7 +731,7 @@ acpi_video_vo_presets_sysctl(SYSCTL_HAND
 	*preset = level;
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -730,7 +743,7 @@ acpi_video_vo_levels_sysctl(SYSCTL_HANDL
 	int err;
 
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->vo_levels == NULL) {
 		err = ENODEV;
 		goto out;
@@ -743,7 +756,7 @@ acpi_video_vo_levels_sysctl(SYSCTL_HANDL
 	    vo->vo_numlevels * sizeof(*vo->vo_levels), req);
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -893,6 +906,7 @@ vo_set_brightness(ACPI_HANDLE handle, in
 {
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	status = acpi_SetInteger(handle, "_BCM", level);
 	if (ACPI_FAILURE(status))
 		printf("can't evaluate %s._BCM - %s\n",
@@ -905,6 +919,7 @@ vo_get_device_status(ACPI_HANDLE handle)
 	UINT32 dcs;
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	dcs = 0;
 	status = acpi_GetInteger(handle, "_DCS", &dcs);
 	if (ACPI_FAILURE(status))
@@ -934,6 +949,7 @@ vo_set_device_state(ACPI_HANDLE handle, 
 {
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	status = acpi_SetInteger(handle, "_DSS", state);
 	if (ACPI_FAILURE(status))
 		printf("can't evaluate %s._DSS - %s\n",

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:25:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4E94106568D;
	Thu, 29 Oct 2009 15:25:22 +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 A34F78FC14;
	Thu, 29 Oct 2009 15:25: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 n9TFPMv8001156;
	Thu, 29 Oct 2009 15:25:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFPMgY001154;
	Thu, 29 Oct 2009 15:25:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291525.n9TFPMgY001154@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:25:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198601 - in stable/7/sys: . contrib/pf dev/acpica
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:25:22 -0000

Author: jhb
Date: Thu Oct 29 15:25:22 2009
New Revision: 198601
URL: http://svn.freebsd.org/changeset/base/198601

Log:
  MFC 197648:
  Split the 'video' ACPI lock up into two locks to resolve a LOR with the
  sysctl lock.  The 'video' lock now protects the 'bus' of video output
  devices attached to a graphics adapter.  It is used when iterating over
  the list of outputs, etc.  The 'video_output' lock is used to lock the
  output-specific data similar to a driver lock for the individual video
  outputs.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpica/acpi_video.c

Modified: stable/7/sys/dev/acpica/acpi_video.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi_video.c	Thu Oct 29 15:24:57 2009	(r198600)
+++ stable/7/sys/dev/acpica/acpi_video.c	Thu Oct 29 15:25:22 2009	(r198601)
@@ -169,7 +169,13 @@ static struct sysctl_oid	*acpi_video_sys
 static struct acpi_video_output_queue crt_units, tv_units,
     ext_units, lcd_units, other_units;
 
+/*
+ * The 'video' lock protects the hierarchy of video output devices
+ * (the video "bus").  The 'video_output' lock protects per-output
+ * data is equivalent to a softc lock for each video output.
+ */
 ACPI_SERIAL_DECL(video, "ACPI video");
+ACPI_SERIAL_DECL(video_output, "ACPI video output");
 MALLOC_DEFINE(M_ACPIVIDEO, "acpivideo", "ACPI video extension");
 
 static int
@@ -235,12 +241,14 @@ acpi_video_attach(device_t dev)
 	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
 	if (acpi_sc == NULL)
 		return (ENXIO);
+	ACPI_SERIAL_BEGIN(video);
 	if (acpi_video_sysctl_tree == NULL) {
 		acpi_video_sysctl_tree = SYSCTL_ADD_NODE(&acpi_video_sysctl_ctx,
 				    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
 				    OID_AUTO, "video", CTLFLAG_RD, 0,
 				    "video extension control");
 	}
+	ACPI_SERIAL_END(video);
 
 	sc->device = dev;
 	sc->handle = acpi_get_handle(dev);
@@ -316,6 +324,7 @@ acpi_video_notify_handler(ACPI_HANDLE ha
 		dss_p = 0;
 		lasthand = NULL;
 		ACPI_SERIAL_BEGIN(video);
+		ACPI_SERIAL_BEGIN(video_output);
 		STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
 			dss = vo_get_graphics_state(vo->handle);
 			dcs = vo_get_device_status(vo->handle);
@@ -331,6 +340,7 @@ acpi_video_notify_handler(ACPI_HANDLE ha
 		}
 		if (lasthand != NULL)
 			vo_set_device_state(lasthand, dss_p|DSS_COMMIT);
+		ACPI_SERIAL_END(video_output);
 		ACPI_SERIAL_END(video);
 		break;
 	case VID_NOTIFY_REPROBE:
@@ -367,12 +377,14 @@ acpi_video_power_profile(void *context)
 		return;
 
 	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	STAILQ_FOREACH(vo, &sc->vid_outputs, vo_next) {
 		if (vo->vo_levels != NULL && vo->vo_brightness == -1)
 			vo_set_brightness(vo->handle,
 			    state == POWER_PROFILE_ECONOMY ?
 			    vo->vo_economy : vo->vo_fullpower);
 	}
+	ACPI_SERIAL_END(video_output);
 	ACPI_SERIAL_END(video);
 }
 
@@ -550,7 +562,7 @@ static void
 acpi_video_vo_bind(struct acpi_video_output *vo, ACPI_HANDLE handle)
 {
 
-	ACPI_SERIAL_ASSERT(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->vo_levels != NULL)
 		AcpiOsFree(vo->vo_levels);
 	vo->handle = handle;
@@ -565,6 +577,7 @@ acpi_video_vo_bind(struct acpi_video_out
 			/* XXX - see above. */
 			vo->vo_economy = vo->vo_levels[BCL_ECONOMY];
 	}
+	ACPI_SERIAL_END(video_output);
 }
 
 static void
@@ -605,7 +618,7 @@ acpi_video_vo_check_level(struct acpi_vi
 {
 	int i;
 
-	ACPI_SERIAL_ASSERT(video);
+	ACPI_SERIAL_ASSERT(video_output);
 	if (vo->vo_levels == NULL)
 		return (ENODEV);
 	for (i = 0; i < vo->vo_numlevels; i++)
@@ -624,7 +637,7 @@ acpi_video_vo_active_sysctl(SYSCTL_HANDL
 	vo = (struct acpi_video_output *)arg1;
 	if (vo->handle == NULL)
 		return (ENXIO);
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	state = (vo_get_device_status(vo->handle) & DCS_ACTIVE) ? 1 : 0;
 	err = sysctl_handle_int(oidp, &state, 0, req);
 	if (err != 0 || req->newptr == NULL)
@@ -632,7 +645,7 @@ acpi_video_vo_active_sysctl(SYSCTL_HANDL
 	vo_set_device_state(vo->handle,
 	    DSS_COMMIT | (state ? DSS_ACTIVE : DSS_INACTIVE));
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -644,7 +657,7 @@ acpi_video_vo_bright_sysctl(SYSCTL_HANDL
 	int level, preset, err;
 
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->handle == NULL) {
 		err = ENXIO;
 		goto out;
@@ -674,7 +687,7 @@ acpi_video_vo_bright_sysctl(SYSCTL_HANDL
 	vo_set_brightness(vo->handle, (level == -1) ? preset : level);
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -686,7 +699,7 @@ acpi_video_vo_presets_sysctl(SYSCTL_HAND
 
 	err = 0;
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->handle == NULL) {
 		err = ENXIO;
 		goto out;
@@ -717,7 +730,7 @@ acpi_video_vo_presets_sysctl(SYSCTL_HAND
 	*preset = level;
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -729,7 +742,7 @@ acpi_video_vo_levels_sysctl(SYSCTL_HANDL
 	int err;
 
 	vo = (struct acpi_video_output *)arg1;
-	ACPI_SERIAL_BEGIN(video);
+	ACPI_SERIAL_BEGIN(video_output);
 	if (vo->vo_levels == NULL) {
 		err = ENODEV;
 		goto out;
@@ -742,7 +755,7 @@ acpi_video_vo_levels_sysctl(SYSCTL_HANDL
 	    vo->vo_numlevels * sizeof(*vo->vo_levels), req);
 
 out:
-	ACPI_SERIAL_END(video);
+	ACPI_SERIAL_END(video_output);
 	return (err);
 }
 
@@ -892,6 +905,7 @@ vo_set_brightness(ACPI_HANDLE handle, in
 {
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	status = acpi_SetInteger(handle, "_BCM", level);
 	if (ACPI_FAILURE(status))
 		printf("can't evaluate %s._BCM - %s\n",
@@ -904,6 +918,7 @@ vo_get_device_status(ACPI_HANDLE handle)
 	UINT32 dcs;
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	dcs = 0;
 	status = acpi_GetInteger(handle, "_DCS", &dcs);
 	if (ACPI_FAILURE(status))
@@ -933,6 +948,7 @@ vo_set_device_state(ACPI_HANDLE handle, 
 {
 	ACPI_STATUS status;
 
+	ACPI_SERIAL_ASSERT(video_output);
 	status = acpi_SetInteger(handle, "_DSS", state);
 	if (ACPI_FAILURE(status))
 		printf("can't evaluate %s._DSS - %s\n",

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:28:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B1C021065670;
	Thu, 29 Oct 2009 15:28:05 +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 9F2828FC15;
	Thu, 29 Oct 2009 15: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 n9TFS5ar001264;
	Thu, 29 Oct 2009 15:28:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFS5et001262;
	Thu, 29 Oct 2009 15:28:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291528.n9TFS5et001262@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:28:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198602 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/acpica dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:28:05 -0000

Author: jhb
Date: Thu Oct 29 15:28:05 2009
New Revision: 198602
URL: http://svn.freebsd.org/changeset/base/198602

Log:
  MFC 197649:
  Do not hold the ACPI A/C adapter lock when changing the power profile.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpica/acpi_acad.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_acad.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi_acad.c	Thu Oct 29 15:25:22 2009	(r198601)
+++ stable/8/sys/dev/acpica/acpi_acad.c	Thu Oct 29 15:28:05 2009	(r198602)
@@ -109,13 +109,14 @@ acpi_acad_get_status(void *context)
     ACPI_SERIAL_BEGIN(acad);
     if (newstatus != -1 && sc->status != newstatus) {
 	sc->status = newstatus;
+	ACPI_SERIAL_END(acad);
 	power_profile_set_state(newstatus ? POWER_PROFILE_PERFORMANCE :
 	    POWER_PROFILE_ECONOMY);
 	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
 	    "%s Line\n", newstatus ? "On" : "Off");
 	acpi_UserNotify("ACAD", h, newstatus);
-    }
-    ACPI_SERIAL_END(acad);
+    } else
+	ACPI_SERIAL_END(acad);
 }
 
 static void

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:28:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E52E1065679;
	Thu, 29 Oct 2009 15:28:31 +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 0D30E8FC22;
	Thu, 29 Oct 2009 15:28: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 n9TFSUWc001309;
	Thu, 29 Oct 2009 15:28:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFSURl001307;
	Thu, 29 Oct 2009 15:28:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291528.n9TFSURl001307@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:28:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198603 - in stable/7/sys: . contrib/pf dev/acpica
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:28:31 -0000

Author: jhb
Date: Thu Oct 29 15:28:30 2009
New Revision: 198603
URL: http://svn.freebsd.org/changeset/base/198603

Log:
  MFC 197649:
  Do not hold the ACPI A/C adapter lock when changing the power profile.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpica/acpi_acad.c

Modified: stable/7/sys/dev/acpica/acpi_acad.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi_acad.c	Thu Oct 29 15:28:05 2009	(r198602)
+++ stable/7/sys/dev/acpica/acpi_acad.c	Thu Oct 29 15:28:30 2009	(r198603)
@@ -108,13 +108,14 @@ acpi_acad_get_status(void *context)
     ACPI_SERIAL_BEGIN(acad);
     if (newstatus != -1 && sc->status != newstatus) {
 	sc->status = newstatus;
+	ACPI_SERIAL_END(acad);
 	power_profile_set_state(newstatus ? POWER_PROFILE_PERFORMANCE :
 	    POWER_PROFILE_ECONOMY);
 	ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
 	    "%s Line\n", newstatus ? "On" : "Off");
 	acpi_UserNotify("ACAD", h, newstatus);
-    }
-    ACPI_SERIAL_END(acad);
+    } else
+	ACPI_SERIAL_END(acad);
 }
 
 static void

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:39:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27E3F1065676;
	Thu, 29 Oct 2009 15:39: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 1602C8FC21;
	Thu, 29 Oct 2009 15:39: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 n9TFdIq5001588;
	Thu, 29 Oct 2009 15:39:18 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFdICB001586;
	Thu, 29 Oct 2009 15:39:18 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291539.n9TFdICB001586@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:39:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198604 - stable/8/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:39:19 -0000

Author: jhb
Date: Thu Oct 29 15:39:18 2009
New Revision: 198604
URL: http://svn.freebsd.org/changeset/base/198604

Log:
  MFC 198085:
  Add a manual page for BUS_BIND_INTR() and bus_bind_intr().

Added:
  stable/8/share/man/man9/BUS_BIND_INTR.9
     - copied unchanged from r198085, head/share/man/man9/BUS_BIND_INTR.9
Modified:
  stable/8/share/man/man9/   (props changed)
  stable/8/share/man/man9/Makefile

Copied: stable/8/share/man/man9/BUS_BIND_INTR.9 (from r198085, head/share/man/man9/BUS_BIND_INTR.9)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/share/man/man9/BUS_BIND_INTR.9	Thu Oct 29 15:39:18 2009	(r198604, copy of r198085, head/share/man/man9/BUS_BIND_INTR.9)
@@ -0,0 +1,96 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin 
+.\" 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 October 14, 2009
+.Dt BUS_BIND_INTR 9
+.Os
+.Sh NAME
+.Nm BUS_BIND_INTR ,
+.Nm bus_bind_intr
+.Nd "bind an interrupt resource to a specific CPU"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_BIND_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "int cpu"
+.Fc
+.Ft int
+.Fn bus_bind_intr "device_t dev" "struct resource *irq" "int cpu"
+.Sh DESCRIPTION
+The
+.Fn BUS_BIND_INTR
+method allows an interrupt resource to be pinned to a specific CPU.
+The interrupt resource must have an interrupt handler attached via
+.Xr BUS_SETUP_INTR 9 .
+The
+.Fa cpu
+parameter corresponds to the ID of a valid CPU in the system.
+Binding an interrupt restricts the
+.Xr cpuset 2
+of any associated interrupt threads to only include the specified CPU.
+It may also direct the low-level interrupt handling of the interrupt to the
+specified CPU as well,
+but this behavior is platform-dependent.
+If the value
+.Dv NOCPU
+is used for
+.Fa cpu ,
+then the interrupt will be
+.Dq unbound
+which restores any associated interrupt threads back to the default cpuset.
+.Pp
+Non-sleepable locks such as mutexes should not be held across calls to these
+functions.
+.Pp
+The
+.Fn bus_bind_intr
+function is a simple wrapper around
+.Fn BUS_BIND_INTR .
+.Pp
+Note that currently there is no attempt made to arbitrate between
+multiple bind requests for the same interrupt from either the same
+device or multiple devices.
+There is also no arbitration between interrupt binding requests submitted
+by userland via
+.Xr cpuset 2
+and
+.Fn BUS_BIND_INTR .
+The most recent binding request is the one that will be in effect.
+.Sh SEE ALSO
+.Xr BUS_SETUP_INTR 9 ,
+.Xr cpuset 2 ,
+.Xr device 9
+.Sh HISTORY
+The
+.Fn BUS_BIND_INTR
+method and
+.Fn bus_bind_intr
+functions first appeared in
+.Fx 7.2 .

Modified: stable/8/share/man/man9/Makefile
==============================================================================
--- stable/8/share/man/man9/Makefile	Thu Oct 29 15:28:30 2009	(r198603)
+++ stable/8/share/man/man9/Makefile	Thu Oct 29 15:39:18 2009	(r198604)
@@ -23,6 +23,7 @@ MAN=	accept_filter.9 \
 	bus_activate_resource.9 \
 	BUS_ADD_CHILD.9 \
 	bus_alloc_resource.9 \
+	BUS_BIND_INTR.9 \
 	bus_child_present.9 \
 	BUS_CONFIG_INTR.9 \
 	bus_dma.9 \
@@ -402,6 +403,7 @@ MLINKS+=bpf.9 bpf_filter.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
+MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9
 MLINKS+=bus_dma.9 busdma.9 \
 	bus_dma.9 bus_dmamap_create.9 \
 	bus_dma.9 bus_dmamap_destroy.9 \

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:39:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70ED9106566C;
	Thu, 29 Oct 2009 15:39:30 +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 5F4318FC14;
	Thu, 29 Oct 2009 15:39: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 n9TFdUMC001628;
	Thu, 29 Oct 2009 15:39:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFdUBS001626;
	Thu, 29 Oct 2009 15:39:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291539.n9TFdUBS001626@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 15:39:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198605 - stable/7/share/man/man9
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:39:30 -0000

Author: jhb
Date: Thu Oct 29 15:39:30 2009
New Revision: 198605
URL: http://svn.freebsd.org/changeset/base/198605

Log:
  MFC 198085:
  Add a manual page for BUS_BIND_INTR() and bus_bind_intr().

Added:
  stable/7/share/man/man9/BUS_BIND_INTR.9
     - copied unchanged from r198085, head/share/man/man9/BUS_BIND_INTR.9
Modified:
  stable/7/share/man/man9/   (props changed)
  stable/7/share/man/man9/Makefile

Copied: stable/7/share/man/man9/BUS_BIND_INTR.9 (from r198085, head/share/man/man9/BUS_BIND_INTR.9)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/share/man/man9/BUS_BIND_INTR.9	Thu Oct 29 15:39:30 2009	(r198605, copy of r198085, head/share/man/man9/BUS_BIND_INTR.9)
@@ -0,0 +1,96 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin 
+.\" 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 October 14, 2009
+.Dt BUS_BIND_INTR 9
+.Os
+.Sh NAME
+.Nm BUS_BIND_INTR ,
+.Nm bus_bind_intr
+.Nd "bind an interrupt resource to a specific CPU"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft int
+.Fo BUS_BIND_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "int cpu"
+.Fc
+.Ft int
+.Fn bus_bind_intr "device_t dev" "struct resource *irq" "int cpu"
+.Sh DESCRIPTION
+The
+.Fn BUS_BIND_INTR
+method allows an interrupt resource to be pinned to a specific CPU.
+The interrupt resource must have an interrupt handler attached via
+.Xr BUS_SETUP_INTR 9 .
+The
+.Fa cpu
+parameter corresponds to the ID of a valid CPU in the system.
+Binding an interrupt restricts the
+.Xr cpuset 2
+of any associated interrupt threads to only include the specified CPU.
+It may also direct the low-level interrupt handling of the interrupt to the
+specified CPU as well,
+but this behavior is platform-dependent.
+If the value
+.Dv NOCPU
+is used for
+.Fa cpu ,
+then the interrupt will be
+.Dq unbound
+which restores any associated interrupt threads back to the default cpuset.
+.Pp
+Non-sleepable locks such as mutexes should not be held across calls to these
+functions.
+.Pp
+The
+.Fn bus_bind_intr
+function is a simple wrapper around
+.Fn BUS_BIND_INTR .
+.Pp
+Note that currently there is no attempt made to arbitrate between
+multiple bind requests for the same interrupt from either the same
+device or multiple devices.
+There is also no arbitration between interrupt binding requests submitted
+by userland via
+.Xr cpuset 2
+and
+.Fn BUS_BIND_INTR .
+The most recent binding request is the one that will be in effect.
+.Sh SEE ALSO
+.Xr BUS_SETUP_INTR 9 ,
+.Xr cpuset 2 ,
+.Xr device 9
+.Sh HISTORY
+The
+.Fn BUS_BIND_INTR
+method and
+.Fn bus_bind_intr
+functions first appeared in
+.Fx 7.2 .

Modified: stable/7/share/man/man9/Makefile
==============================================================================
--- stable/7/share/man/man9/Makefile	Thu Oct 29 15:39:18 2009	(r198604)
+++ stable/7/share/man/man9/Makefile	Thu Oct 29 15:39:30 2009	(r198605)
@@ -21,6 +21,7 @@ MAN=	accept_filter.9 \
 	bus_activate_resource.9 \
 	BUS_ADD_CHILD.9 \
 	bus_alloc_resource.9 \
+	BUS_BIND_INTR.9 \
 	bus_child_present.9 \
 	BUS_CONFIG_INTR.9 \
 	bus_dma.9 \
@@ -377,6 +378,7 @@ MLINKS+=atomic.9 atomic_add.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
+MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9
 MLINKS+=bus_dma.9 busdma.9 \
 	bus_dma.9 bus_dmamap_create.9 \
 	bus_dma.9 bus_dmamap_destroy.9 \

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:42:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 419CF106566C;
	Thu, 29 Oct 2009 15:42:51 +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 2D4328FC0C;
	Thu, 29 Oct 2009 15:42: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 n9TFgp6m001742;
	Thu, 29 Oct 2009 15:42:51 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFgpPV001739;
	Thu, 29 Oct 2009 15:42:51 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910291542.n9TFgpPV001739@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 15:42:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198606 - in releng/8.0: . bin/csh bin/sh
	cddl/compat/opensolaris cddl/contrib/opensolaris
	cddl/lib/libnvpair contrib/bind9 contrib/bzip2 contrib/cpio
	contrib/csup contrib/ee contrib/fi...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:42:51 -0000

Author: mav
Date: Thu Oct 29 15:42:50 2009
New Revision: 198606
URL: http://svn.freebsd.org/changeset/base/198606

Log:
  MFC rev. 198480, 198483:
  Document new modularised ATA kernel modules and options.
  
  PR:             kern/133162, amd64/139859
  Approved by:    re (kib)

Modified:
  releng/8.0/   (props changed)
  releng/8.0/ObsoleteFiles.inc   (props changed)
  releng/8.0/UPDATING   (contents, props changed)
  releng/8.0/bin/csh/   (props changed)
  releng/8.0/bin/sh/   (props changed)
  releng/8.0/cddl/compat/opensolaris/   (props changed)
  releng/8.0/cddl/contrib/opensolaris/   (props changed)
  releng/8.0/cddl/lib/libnvpair/   (props changed)
  releng/8.0/contrib/bind9/   (props changed)
  releng/8.0/contrib/bzip2/   (props changed)
  releng/8.0/contrib/cpio/   (props changed)
  releng/8.0/contrib/csup/   (props changed)
  releng/8.0/contrib/ee/   (props changed)
  releng/8.0/contrib/file/   (props changed)
  releng/8.0/contrib/gdb/   (props changed)
  releng/8.0/contrib/gdtoa/   (props changed)
  releng/8.0/contrib/less/   (props changed)
  releng/8.0/contrib/libpcap/   (props changed)
  releng/8.0/contrib/ncurses/   (props changed)
  releng/8.0/contrib/netcat/   (props changed)
  releng/8.0/contrib/ntp/   (props changed)
  releng/8.0/contrib/openbsm/   (props changed)
  releng/8.0/contrib/openpam/   (props changed)
  releng/8.0/contrib/pf/   (props changed)
  releng/8.0/contrib/sendmail/   (props changed)
  releng/8.0/contrib/tcpdump/   (props changed)
  releng/8.0/contrib/tcsh/   (props changed)
  releng/8.0/contrib/top/   (props changed)
  releng/8.0/contrib/top/install-sh   (props changed)
  releng/8.0/contrib/traceroute/   (props changed)
  releng/8.0/contrib/wpa/   (props changed)
  releng/8.0/crypto/openssh/   (props changed)
  releng/8.0/crypto/openssl/   (props changed)
  releng/8.0/etc/   (props changed)
  releng/8.0/gnu/usr.bin/patch/   (props changed)
  releng/8.0/include/   (props changed)
  releng/8.0/kerberos5/lib/libgssapi_krb5/   (props changed)
  releng/8.0/kerberos5/lib/libgssapi_spnego/   (props changed)
  releng/8.0/lib/libarchive/   (props changed)
  releng/8.0/lib/libc/   (props changed)
  releng/8.0/lib/libc/gen/   (props changed)
  releng/8.0/lib/libc/stdio/asprintf.c   (props changed)
  releng/8.0/lib/libc/stdtime/   (props changed)
  releng/8.0/lib/libc/string/ffsll.c   (props changed)
  releng/8.0/lib/libc/string/flsll.c   (props changed)
  releng/8.0/lib/libc/string/wcpcpy.c   (props changed)
  releng/8.0/lib/libc/string/wcpncpy.c   (props changed)
  releng/8.0/lib/libdevinfo/   (props changed)
  releng/8.0/lib/libdisk/   (props changed)
  releng/8.0/lib/libkvm/   (props changed)
  releng/8.0/lib/libthr/   (props changed)
  releng/8.0/lib/libusb/   (props changed)
  releng/8.0/lib/libusb/usb.h   (props changed)
  releng/8.0/lib/libutil/   (props changed)
  releng/8.0/libexec/rtld-elf/   (props changed)
  releng/8.0/release/   (props changed)
  releng/8.0/release/doc/   (props changed)
  releng/8.0/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  releng/8.0/sbin/   (props changed)
  releng/8.0/sbin/bsdlabel/   (props changed)
  releng/8.0/sbin/camcontrol/   (props changed)
  releng/8.0/sbin/dhclient/   (props changed)
  releng/8.0/sbin/geom/   (props changed)
  releng/8.0/sbin/ifconfig/   (props changed)
  releng/8.0/sbin/ipfw/   (props changed)
  releng/8.0/sbin/mksnap_ffs/   (props changed)
  releng/8.0/sbin/mount/   (props changed)
  releng/8.0/sbin/mount_nfs/   (props changed)
  releng/8.0/sbin/umount/   (props changed)
  releng/8.0/share/man/man4/   (props changed)
  releng/8.0/share/man/man5/   (props changed)
  releng/8.0/share/man/man7/   (props changed)
  releng/8.0/share/man/man9/   (props changed)
  releng/8.0/share/timedef/   (props changed)
  releng/8.0/share/zoneinfo/   (props changed)
  releng/8.0/sys/   (props changed)
  releng/8.0/sys/amd64/include/xen/   (props changed)
  releng/8.0/sys/cddl/contrib/opensolaris/   (props changed)
  releng/8.0/sys/conf/NOTES
  releng/8.0/sys/contrib/dev/acpica/   (props changed)
  releng/8.0/sys/contrib/pf/   (props changed)
  releng/8.0/sys/dev/xen/xenpci/   (props changed)
  releng/8.0/tools/regression/bin/sh/   (props changed)
  releng/8.0/tools/regression/lib/msun/test-conj.t   (props changed)
  releng/8.0/tools/regression/poll/   (props changed)
  releng/8.0/tools/regression/priv/   (props changed)
  releng/8.0/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  releng/8.0/tools/regression/usr.bin/pkill/pgrep-_s.t   (props changed)
  releng/8.0/tools/regression/usr.bin/pkill/pkill-_g.t   (props changed)
  releng/8.0/tools/tools/ath/common/dumpregs.h   (props changed)
  releng/8.0/tools/tools/ath/common/dumpregs_5210.c   (props changed)
  releng/8.0/tools/tools/ath/common/dumpregs_5211.c   (props changed)
  releng/8.0/tools/tools/ath/common/dumpregs_5212.c   (props changed)
  releng/8.0/tools/tools/ath/common/dumpregs_5416.c   (props changed)
  releng/8.0/tools/tools/termcap/termcap.pl   (props changed)
  releng/8.0/tools/tools/vimage/   (props changed)
  releng/8.0/usr.bin/calendar/calendars/calendar.freebsd   (props changed)
  releng/8.0/usr.bin/csup/   (props changed)
  releng/8.0/usr.bin/fstat/   (props changed)
  releng/8.0/usr.bin/look/   (props changed)
  releng/8.0/usr.bin/netstat/   (props changed)
  releng/8.0/usr.bin/procstat/   (props changed)
  releng/8.0/usr.bin/w/   (props changed)
  releng/8.0/usr.bin/whois/   (props changed)
  releng/8.0/usr.sbin/   (props changed)
  releng/8.0/usr.sbin/arp/   (props changed)
  releng/8.0/usr.sbin/dumpcis/cardinfo.h   (props changed)
  releng/8.0/usr.sbin/dumpcis/cis.h   (props changed)
  releng/8.0/usr.sbin/freebsd-update/   (props changed)
  releng/8.0/usr.sbin/iostat/   (props changed)
  releng/8.0/usr.sbin/jls/   (props changed)
  releng/8.0/usr.sbin/lpr/   (props changed)
  releng/8.0/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  releng/8.0/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  releng/8.0/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  releng/8.0/usr.sbin/makefs/getid.c   (props changed)
  releng/8.0/usr.sbin/mfiutil/mfiutil.8   (props changed)
  releng/8.0/usr.sbin/ndp/   (props changed)
  releng/8.0/usr.sbin/ntp/   (props changed)
  releng/8.0/usr.sbin/ppp/   (props changed)
  releng/8.0/usr.sbin/pstat/   (props changed)
  releng/8.0/usr.sbin/sysinstall/   (props changed)
  releng/8.0/usr.sbin/traceroute6/   (props changed)
  releng/8.0/usr.sbin/wpa/   (props changed)
  releng/8.0/usr.sbin/zic/   (props changed)

Modified: releng/8.0/UPDATING
==============================================================================
--- releng/8.0/UPDATING	Thu Oct 29 15:39:30 2009	(r198605)
+++ releng/8.0/UPDATING	Thu Oct 29 15:42:50 2009	(r198606)
@@ -566,6 +566,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.
 	userland (libpmc(3)) and the kernel module (hwpmc(4)) in
 	sync.
 
+20081009:
+	atapci kernel module now includes only generic PCI ATA
+	driver. AHCI driver moved to ataahci kernel module.
+	All vendor-specific code moved into separate kernel modules:
+	ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek,
+	atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron,
+	atamarvell, atamicron, atanational, atanetcell, atanvidia,
+	atapromise, ataserverworks, atasiliconimage, atasis, atavia
+
 20080820:
 	The TTY subsystem of the kernel has been replaced by a new
 	implementation, which provides better scalability and an

Modified: releng/8.0/sys/conf/NOTES
==============================================================================
--- releng/8.0/sys/conf/NOTES	Thu Oct 29 15:39:30 2009	(r198605)
+++ releng/8.0/sys/conf/NOTES	Thu Oct 29 15:42:50 2009	(r198606)
@@ -1657,6 +1657,10 @@ device		siis
 # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card
 # devices. You only need one "device ata" for it to find all
 # PCI and PC Card ATA/ATAPI devices on modern machines.
+# Alternatively, individual bus and chipset drivers may be chosen by using
+# the 'atacore' driver then selecting the drivers on a per vendor basis.
+# For example to build a system which only supports a VIA chipset,
+# omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
 device		ata
 device		atadisk		# ATA disk drives
 device		ataraid		# ATA RAID drives
@@ -1665,6 +1669,39 @@ device		atapifd		# ATAPI floppy drives
 device		atapist		# ATAPI tape drives
 device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
 				# needs CAM to be present (scbus & pass)
+
+# Modular ATA
+#device		atacore		# Core ATA functionality
+#device		atacard		# CARDBUS support
+#device		atabus		# PC98 cbus support
+#device		ataisa		# ISA bus support
+#device		atapci		# PCI bus support; only generic chipset support
+
+# PCI ATA chipsets
+#device		ataahci		# AHCI SATA
+#device		ataacard	# ACARD
+#device		ataacerlabs	# Acer Labs Inc. (ALI)
+#device		ataadaptec	# Adaptec
+#device		ataamd		# American Micro Devices (AMD)
+#device		ataati		# ATI
+#device		atacenatek	# Cenatek
+#device		atacypress	# Cypress
+#device		atacyrix	# Cyrix
+#device		atahighpoint	# HighPoint
+#device		ataintel	# Intel
+#device		ataite		# Integrated Technology Inc. (ITE)
+#device		atajmicron	# JMicron
+#device		atamarvell	# Marvell
+#device		atamicron	# Micron
+#device		atanational	# National
+#device		atanetcell	# NetCell
+#device		atanvidia	# nVidia
+#device		atapromise	# Promise
+#device		ataserverworks	# ServerWorks
+#device		atasiliconimage	# Silicon Image Inc. (SiI) (formerly CMD)
+#device		atasis		# Silicon Integrated Systems Corp.(SiS)
+#device		atavia		# VIA Technologies Inc.
+
 #
 # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add:
 hint.ata.0.at="isa"

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 15:59:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A4532106566B;
	Thu, 29 Oct 2009 15:59:28 +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 93C268FC14;
	Thu, 29 Oct 2009 15:59: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 n9TFxRBb002291;
	Thu, 29 Oct 2009 15:59:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TFxRXN002288;
	Thu, 29 Oct 2009 15:59:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910291559.n9TFxRXN002288@svn.freebsd.org>
From: Christian Brueffer 
Date: Thu, 29 Oct 2009 15:59: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: r198609 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 15:59:28 -0000

Author: brueffer
Date: Thu Oct 29 15:59:27 2009
New Revision: 198609
URL: http://svn.freebsd.org/changeset/base/198609

Log:
  Revert part of r198363, there is no "device cam", it is
  included in "device scbus".
  
  MFC after:	3 days

Modified:
  head/share/man/man4/atapicam.4
  head/share/man/man4/umass.4

Modified: head/share/man/man4/atapicam.4
==============================================================================
--- head/share/man/man4/atapicam.4	Thu Oct 29 15:55:58 2009	(r198608)
+++ head/share/man/man4/atapicam.4	Thu Oct 29 15:59:27 2009	(r198609)
@@ -39,7 +39,6 @@ place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
-.Cd "device cam"
 .Cd "device ata"
 .Cd "device atapicam"
 .Ed

Modified: head/share/man/man4/umass.4
==============================================================================
--- head/share/man/man4/umass.4	Thu Oct 29 15:55:58 2009	(r198608)
+++ head/share/man/man4/umass.4	Thu Oct 29 15:59:27 2009	(r198609)
@@ -39,7 +39,6 @@ place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
-.Cd "device cam"
 .Cd "device usb"
 .Cd "device umass"
 .Ed

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:00:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F90010656A4;
	Thu, 29 Oct 2009 16:00:28 +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 397C08FC1A;
	Thu, 29 Oct 2009 16:00: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 n9TG0SMB002406;
	Thu, 29 Oct 2009 16:00:28 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TG0Smj002397;
	Thu, 29 Oct 2009 16:00:28 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291600.n9TG0Smj002397@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 16:00:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198610 - in stable/8/sys: . amd64/acpica amd64/include
	amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica
	contrib/pf dev/acpica dev/xen/xenpci i386/acpica i386/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:00:28 -0000

Author: jhb
Date: Thu Oct 29 16:00:27 2009
New Revision: 198610
URL: http://svn.freebsd.org/changeset/base/198610

Log:
  MFC 197439:
  Extract the code to find and map the MADT ACPI table during early kernel
  startup and genericize it so it can be reused to map other tables as well:
  - Add a routine to walk a list of ACPI subtables such as those used in the
    APIC and SRAT tables in the MI acpi(4) driver.
  - Move the routines for mapping and unmapping an ACPI table as well as
    mapping the RSDT or XSDT and searching for a table with a given signature
    out into acpica_machdep.c for both amd64 and i386.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/acpica/acpi_machdep.c
  stable/8/sys/amd64/acpica/madt.c
  stable/8/sys/amd64/include/acpica_machdep.h
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/dev/acpica/acpivar.h
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/acpica/acpi_machdep.c
  stable/8/sys/i386/acpica/madt.c
  stable/8/sys/i386/include/acpica_machdep.h

Modified: stable/8/sys/amd64/acpica/acpi_machdep.c
==============================================================================
--- stable/8/sys/amd64/acpica/acpi_machdep.c	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/amd64/acpica/acpi_machdep.c	Thu Oct 29 16:00:27 2009	(r198610)
@@ -32,8 +32,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -100,6 +104,246 @@ acpi_cpu_c1()
 }
 
 /*
+ * Support for mapping ACPI tables during early boot.  Currently this
+ * uses the crashdump map to map each table.  However, the crashdump
+ * map is created in pmap_bootstrap() right after the direct map, so
+ * we should be able to just use pmap_mapbios() here instead.
+ *
+ * This makes the following assumptions about how we use this KVA:
+ * pages 0 and 1 are used to map in the header of each table found via
+ * the RSDT or XSDT and pages 2 to n are used to map in the RSDT or
+ * XSDT.  This has to use 2 pages for the table headers in case a
+ * header spans a page boundary.
+ *
+ * XXX: We don't ensure the table fits in the available address space
+ * in the crashdump map.
+ */
+
+/*
+ * Map some memory using the crashdump map.  'offset' is an offset in
+ * pages into the crashdump map to use for the start of the mapping.
+ */
+static void *
+table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+{
+	vm_offset_t va, off;
+	void *data;
+
+	off = pa & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	pa = pa & PG_FRAME;
+	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
+	    (offset * PAGE_SIZE);
+	data = (void *)(va + off);
+	length -= PAGE_SIZE;
+	while (length > 0) {
+		va += PAGE_SIZE;
+		pa += PAGE_SIZE;
+		length -= PAGE_SIZE;
+		pmap_kenter(va, pa);
+		invlpg(va);
+	}
+	return (data);
+}
+
+/* Unmap memory previously mapped with table_map(). */
+static void
+table_unmap(void *data, vm_offset_t length)
+{
+	vm_offset_t va, off;
+
+	va = (vm_offset_t)data;
+	off = va & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	va &= ~PAGE_MASK;
+	while (length > 0) {
+		pmap_kremove(va);
+		invlpg(va);
+		va += PAGE_SIZE;
+		length -= PAGE_SIZE;
+	}
+}
+
+/*
+ * Map a table at a given offset into the crashdump map.  It first
+ * maps the header to determine the table length and then maps the
+ * entire table.
+ */
+static void *
+map_table(vm_paddr_t pa, int offset, const char *sig)
+{
+	ACPI_TABLE_HEADER *header;
+	vm_offset_t length;
+	void *table;
+
+	header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+		return (NULL);
+	}
+	length = header->Length;
+	table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+	table = table_map(pa, offset, length);
+	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
+		if (bootverbose)
+			printf("ACPI: Failed checksum for table %s\n", sig);
+		table_unmap(table, length);
+		return (NULL);
+	}
+	return (table);
+}
+
+/*
+ * See if a given ACPI table is the requested table.  Returns the
+ * length of the able if it matches or zero on failure.
+ */
+static int
+probe_table(vm_paddr_t address, const char *sig)
+{
+	ACPI_TABLE_HEADER *table;
+
+	table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
+	if (table == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map table at 0x%jx\n",
+			    (uintmax_t)address);
+		return (0);
+	}
+	if (bootverbose)
+		printf("Table '%.4s' at 0x%jx\n", table->Signature,
+		    (uintmax_t)address);
+
+	if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+		return (0);
+	}
+	table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+	return (1);
+}
+
+/*
+ * Try to map a table at a given physical address previously returned
+ * by acpi_find_table().
+ */
+void *
+acpi_map_table(vm_paddr_t pa, const char *sig)
+{
+
+	return (map_table(pa, 0, sig));
+}
+
+/* Unmap a table previously mapped via acpi_map_table(). */
+void
+acpi_unmap_table(void *table)
+{
+	ACPI_TABLE_HEADER *header;
+
+	header = (ACPI_TABLE_HEADER *)table;
+	table_unmap(table, header->Length);
+}
+
+/*
+ * Return the physical address of the requested table or zero if one
+ * is not found.
+ */
+vm_paddr_t
+acpi_find_table(const char *sig)
+{
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
+	ACPI_TABLE_HEADER *table;
+	vm_paddr_t addr;
+	int i, count;
+
+	if (resource_disabled("acpi", 0))
+		return (0);
+
+	/*
+	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
+	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
+	 * pmap_mapbios() to map the RSDP.
+	 */
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+		return (0);
+	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
+	if (rsdp == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map RSDP\n");
+		return (0);
+	}
+
+	/*
+	 * For ACPI >= 2.0, use the XSDT if it is available.
+	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 2
+	 * in the crashdump area.  Pages 0 and 1 are used to map in the
+	 * headers of candidate ACPI tables.
+	 */
+	addr = 0;
+	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
+		/*
+		 * AcpiOsGetRootPointer only verifies the checksum for
+		 * the version 1.0 portion of the RSDP.  Version 2.0 has
+		 * an additional checksum that we verify first.
+		 */
+		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
+			if (bootverbose)
+				printf("ACPI: RSDP failed extended checksum\n");
+			return (0);
+		}
+		xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+		if (xsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map XSDT\n");
+			return (0);
+		}
+		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT64);
+		for (i = 0; i < count; i++)
+			if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
+				addr = xsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(xsdt);
+	} else {
+		rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
+		if (rsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map RSDT\n");
+			return (0);
+		}
+		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT32);
+		for (i = 0; i < count; i++)
+			if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
+				addr = rsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(rsdt);
+	}
+	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
+	if (addr == 0) {
+		if (bootverbose)
+			printf("ACPI: No %s table found\n", sig);
+		return (0);
+	}
+	if (bootverbose)
+		printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
+
+	/*
+	 * Verify that we can map the full table and that its checksum is
+	 * correct, etc.
+	 */
+	table = map_table(addr, 0, sig);
+	if (table == NULL)
+		return (0);
+	acpi_unmap_table(table);
+
+	return (addr);
+}
+
+/*
  * ACPI nexus(4) driver.
  */
 static int

Modified: stable/8/sys/amd64/acpica/madt.c
==============================================================================
--- stable/8/sys/amd64/acpica/madt.c	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/amd64/acpica/madt.c	Thu Oct 29 16:00:27 2009	(r198610)
@@ -36,27 +36,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-
 #include 
-#include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
-typedef	void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
-
 /* These two arrays are indexed by APIC IDs. */
 struct ioapic_info {
 	void *io_apic;
@@ -79,8 +71,6 @@ static enum intr_polarity interrupt_pola
 static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
 static int	madt_find_cpu(u_int acpi_id, u_int *apic_id);
 static int	madt_find_interrupt(int intr, void **apic, u_int *pin);
-static void	*madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
-static void	*madt_map_table(vm_paddr_t pa, int offset, const char *sig);
 static void	madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
 static void	madt_parse_interrupt_override(
 		    ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@@ -92,13 +82,10 @@ static int	madt_probe(void);
 static int	madt_probe_cpus(void);
 static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
 		    void *arg __unused);
-static int	madt_probe_table(vm_paddr_t address);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
 static int	madt_setup_io(void);
-static void	madt_unmap(void *data, vm_offset_t length);
-static void	madt_unmap_table(void *table);
-static void	madt_walk_table(madt_entry_handler *handler, void *arg);
+static void	madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
 	"MADT",
@@ -109,224 +96,30 @@ static struct apic_enumerator madt_enume
 };
 
 /*
- * Code to abuse the crashdump map to map in the tables for the early
- * probe.  We cheat and make the following assumptions about how we
- * use this KVA: pages 0 and 1 are used to map in the header of each
- * table found via the RSDT or XSDT and pages 2 to n are used to map
- * in the RSDT or XSDT.  We have to use 2 pages for the table headers
- * in case a header spans a page boundary.  The offset is in pages;
- * the length is in bytes.
- */
-static void *
-madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
-{
-	vm_offset_t va, off;
-	void *data;
-
-	off = pa & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	pa = pa & PG_FRAME;
-	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
-	    (offset * PAGE_SIZE);
-	data = (void *)(va + off);
-	length -= PAGE_SIZE;
-	while (length > 0) {
-		va += PAGE_SIZE;
-		pa += PAGE_SIZE;
-		length -= PAGE_SIZE;
-		pmap_kenter(va, pa);
-		invlpg(va);
-	}
-	return (data);
-}
-
-static void
-madt_unmap(void *data, vm_offset_t length)
-{
-	vm_offset_t va, off;
-
-	va = (vm_offset_t)data;
-	off = va & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	va &= ~PAGE_MASK;
-	while (length > 0) {
-		pmap_kremove(va);
-		invlpg(va);
-		va += PAGE_SIZE;
-		length -= PAGE_SIZE;
-	}
-}
-
-static void *
-madt_map_table(vm_paddr_t pa, int offset, const char *sig)
-{
-	ACPI_TABLE_HEADER *header;
-	vm_offset_t length;
-	void *table;
-
-	header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
-	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
-		madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-		return (NULL);
-	}
-	length = header->Length;
-	madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-	table = madt_map(pa, offset, length);
-	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
-		if (bootverbose)
-			printf("MADT: Failed checksum for table %s\n", sig);
-		madt_unmap(table, length);
-		return (NULL);
-	}
-	return (table);
-}
-
-static void
-madt_unmap_table(void *table)
-{
-	ACPI_TABLE_HEADER *header;
-
-	header = (ACPI_TABLE_HEADER *)table;
-	madt_unmap(table, header->Length);
-}
-
-/*
  * Look for an ACPI Multiple APIC Description Table ("APIC")
  */
 static int
 madt_probe(void)
 {
-	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
-	ACPI_TABLE_RSDP *rsdp;
-	ACPI_TABLE_RSDT *rsdt;
-	ACPI_TABLE_XSDT *xsdt;
-	int i, count;
-
-	if (resource_disabled("acpi", 0))
-		return (ENXIO);
 
-	/*
-	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
-	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
-	 * pmap_mapbios() to map the RSDP.
-	 */
-	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
-		return (ENXIO);
-	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
-	if (rsdp == NULL) {
-		if (bootverbose)
-			printf("MADT: Failed to map RSDP\n");
+	madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+	if (madt_physaddr == 0)
 		return (ENXIO);
-	}
-
-	/*
-	 * For ACPI >= 2.0, use the XSDT if it is available.
-	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 1
-	 * in the crashdump area.  Page 0 is used to map in the
-	 * headers of candidate ACPI tables.
-	 */
-	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
-		/*
-		 * AcpiOsGetRootPointer only verifies the checksum for
-		 * the version 1.0 portion of the RSDP.  Version 2.0 has
-		 * an additional checksum that we verify first.
-		 */
-		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
-			if (bootverbose)
-				printf("MADT: RSDP failed extended checksum\n");
-			return (ENXIO);
-		}
-		xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 2,
-		    ACPI_SIG_XSDT);
-		if (xsdt == NULL) {
-			if (bootverbose)
-				printf("MADT: Failed to map XSDT\n");
-			return (ENXIO);
-		}
-		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
-		    sizeof(UINT64);
-		for (i = 0; i < count; i++)
-			if (madt_probe_table(xsdt->TableOffsetEntry[i]))
-				break;
-		madt_unmap_table(xsdt);
-	} else {
-		rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 2,
-		    ACPI_SIG_RSDT);
-		if (rsdt == NULL) {
-			if (bootverbose)
-				printf("MADT: Failed to map RSDT\n");
-			return (ENXIO);
-		}
-		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
-		    sizeof(UINT32);
-		for (i = 0; i < count; i++)
-			if (madt_probe_table(rsdt->TableOffsetEntry[i]))
-				break;
-		madt_unmap_table(rsdt);
-	}
-	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
-	if (madt_physaddr == 0) {
-		if (bootverbose)
-			printf("MADT: No MADT table found\n");
-		return (ENXIO);
-	}
-	if (bootverbose)
-		printf("MADT: Found table at 0x%jx\n",
-		    (uintmax_t)madt_physaddr);
-
-	/*
-	 * Verify that we can map the full table and that its checksum is
-	 * correct, etc.
-	 */
-	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
-	if (madt == NULL)
-		return (ENXIO);
-	madt_unmap_table(madt);
-	madt = NULL;
-
 	return (0);
 }
 
 /*
- * See if a given ACPI table is the MADT.
- */
-static int
-madt_probe_table(vm_paddr_t address)
-{
-	ACPI_TABLE_HEADER *table;
-
-	table = madt_map(address, 0, sizeof(ACPI_TABLE_HEADER));
-	if (table == NULL) {
-		if (bootverbose)
-			printf("MADT: Failed to map table at 0x%jx\n",
-			    (uintmax_t)address);
-		return (0);
-	}
-	if (bootverbose)
-		printf("Table '%.4s' at 0x%jx\n", table->Signature,
-		    (uintmax_t)address);
-
-	if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) {
-		madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
-		return (0);
-	}
-	madt_physaddr = address;
-	madt_length = table->Length;
-	madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
-	return (1);
-}
-
-/*
  * Run through the MP table enumerating CPUs.
  */
 static int
 madt_probe_cpus(void)
 {
 
-	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
+	madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+	madt_length = madt->Header.Length;
 	KASSERT(madt != NULL, ("Unable to re-map MADT"));
 	madt_walk_table(madt_probe_cpus_handler, NULL);
-	madt_unmap_table(madt);
+	acpi_unmap_table(madt);
 	madt = NULL;
 	return (0);
 }
@@ -417,17 +210,11 @@ SYSINIT(madt_register, SI_SUB_TUNABLES -
  * Call the handler routine for each entry in the MADT table.
  */
 static void
-madt_walk_table(madt_entry_handler *handler, void *arg)
+madt_walk_table(acpi_subtable_handler *handler, void *arg)
 {
-	ACPI_SUBTABLE_HEADER *entry;
-	u_char *p, *end;
 
-	end = (u_char *)(madt) + madt->Header.Length;
-	for (p = (u_char *)(madt + 1); p < end; ) {
-		entry = (ACPI_SUBTABLE_HEADER *)p;
-		handler(entry, arg);
-		p += entry->Length;
-	}
+	acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
+	    handler, arg);
 }
 
 static void

Modified: stable/8/sys/amd64/include/acpica_machdep.h
==============================================================================
--- stable/8/sys/amd64/include/acpica_machdep.h	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/amd64/include/acpica_machdep.h	Thu Oct 29 16:00:27 2009	(r198610)
@@ -77,5 +77,8 @@ extern int	acpi_release_global_lock(uint
 
 void	acpi_SetDefaultIntrModel(int model);
 void	acpi_cpu_c1(void);
+void	*acpi_map_table(vm_paddr_t pa, const char *sig);
+void	acpi_unmap_table(void *table);
+vm_paddr_t acpi_find_table(const char *sig);
 
 #endif /* __ACPICA_MACHDEP_H__ */

Modified: stable/8/sys/dev/acpica/acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi.c	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/dev/acpica/acpi.c	Thu Oct 29 16:00:27 2009	(r198610)
@@ -2290,6 +2290,28 @@ acpi_SetIntrModel(int model)
 }
 
 /*
+ * Walk subtables of a table and call a callback routine for each
+ * subtable.  The caller should provide the first subtable and a
+ * pointer to the end of the table.  This can be used to walk tables
+ * such as MADT and SRAT that use subtable entries.
+ */
+void
+acpi_walk_subtables(void *first, void *end, acpi_subtable_handler *handler,
+    void *arg)
+{
+    ACPI_SUBTABLE_HEADER *entry;
+
+    for (entry = first; (void *)entry < end; ) {
+	/* Avoid an infinite loop if we hit a bogus entry. */
+	if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER))
+	    return;
+
+	handler(entry, arg);
+	entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length);
+    }
+}
+
+/*
  * DEPRECATED.  This interface has serious deficiencies and will be
  * removed.
  *

Modified: stable/8/sys/dev/acpica/acpivar.h
==============================================================================
--- stable/8/sys/dev/acpica/acpivar.h	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/dev/acpica/acpivar.h	Thu Oct 29 16:00:27 2009	(r198610)
@@ -307,6 +307,9 @@ void		acpi_EnterDebugger(void);
 	ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \
 	    ACPI_STA_BATT_PRESENT)
 
+/* Callback function type for walking subtables within a table. */
+typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *);
+
 BOOLEAN		acpi_DeviceIsPresent(device_t dev);
 BOOLEAN		acpi_BatteryIsPresent(device_t dev);
 ACPI_STATUS	acpi_GetHandleInScope(ACPI_HANDLE parent, char *path,
@@ -340,6 +343,8 @@ void		acpi_UserNotify(const char *subsys
 int		acpi_bus_alloc_gas(device_t dev, int *type, int *rid,
 		    ACPI_GENERIC_ADDRESS *gas, struct resource **res,
 		    u_int flags);
+void		acpi_walk_subtables(void *first, void *end,
+		    acpi_subtable_handler *handler, void *arg);
 
 struct acpi_parse_resource_set {
     void	(*set_init)(device_t dev, void *arg, void **context);

Modified: stable/8/sys/i386/acpica/acpi_machdep.c
==============================================================================
--- stable/8/sys/i386/acpica/acpi_machdep.c	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/i386/acpica/acpi_machdep.c	Thu Oct 29 16:00:27 2009	(r198610)
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -555,6 +557,244 @@ acpi_cpu_c1()
 }
 
 /*
+ * Support for mapping ACPI tables during early boot.  This abuses the
+ * crashdump map because the kernel cannot allocate KVA in
+ * pmap_mapbios() when this is used.  This makes the following
+ * assumptions about how we use this KVA: pages 0 and 1 are used to
+ * map in the header of each table found via the RSDT or XSDT and
+ * pages 2 to n are used to map in the RSDT or XSDT.  This has to use
+ * 2 pages for the table headers in case a header spans a page
+ * boundary.
+ *
+ * XXX: We don't ensure the table fits in the available address space
+ * in the crashdump map.
+ */
+
+/*
+ * Map some memory using the crashdump map.  'offset' is an offset in
+ * pages into the crashdump map to use for the start of the mapping.
+ */
+static void *
+table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+{
+	vm_offset_t va, off;
+	void *data;
+
+	off = pa & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	pa = pa & PG_FRAME;
+	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
+	    (offset * PAGE_SIZE);
+	data = (void *)(va + off);
+	length -= PAGE_SIZE;
+	while (length > 0) {
+		va += PAGE_SIZE;
+		pa += PAGE_SIZE;
+		length -= PAGE_SIZE;
+		pmap_kenter(va, pa);
+		invlpg(va);
+	}
+	return (data);
+}
+
+/* Unmap memory previously mapped with table_map(). */
+static void
+table_unmap(void *data, vm_offset_t length)
+{
+	vm_offset_t va, off;
+
+	va = (vm_offset_t)data;
+	off = va & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	va &= ~PAGE_MASK;
+	while (length > 0) {
+		pmap_kremove(va);
+		invlpg(va);
+		va += PAGE_SIZE;
+		length -= PAGE_SIZE;
+	}
+}
+
+/*
+ * Map a table at a given offset into the crashdump map.  It first
+ * maps the header to determine the table length and then maps the
+ * entire table.
+ */
+static void *
+map_table(vm_paddr_t pa, int offset, const char *sig)
+{
+	ACPI_TABLE_HEADER *header;
+	vm_offset_t length;
+	void *table;
+
+	header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+		return (NULL);
+	}
+	length = header->Length;
+	table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+	table = table_map(pa, offset, length);
+	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
+		if (bootverbose)
+			printf("ACPI: Failed checksum for table %s\n", sig);
+		table_unmap(table, length);
+		return (NULL);
+	}
+	return (table);
+}
+
+/*
+ * See if a given ACPI table is the requested table.  Returns the
+ * length of the able if it matches or zero on failure.
+ */
+static int
+probe_table(vm_paddr_t address, const char *sig)
+{
+	ACPI_TABLE_HEADER *table;
+
+	table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
+	if (table == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map table at 0x%jx\n",
+			    (uintmax_t)address);
+		return (0);
+	}
+	if (bootverbose)
+		printf("Table '%.4s' at 0x%jx\n", table->Signature,
+		    (uintmax_t)address);
+
+	if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+		return (0);
+	}
+	table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+	return (1);
+}
+
+/*
+ * Try to map a table at a given physical address previously returned
+ * by acpi_find_table().
+ */
+void *
+acpi_map_table(vm_paddr_t pa, const char *sig)
+{
+
+	return (map_table(pa, 0, sig));
+}
+
+/* Unmap a table previously mapped via acpi_map_table(). */
+void
+acpi_unmap_table(void *table)
+{
+	ACPI_TABLE_HEADER *header;
+
+	header = (ACPI_TABLE_HEADER *)table;
+	table_unmap(table, header->Length);
+}
+
+/*
+ * Return the physical address of the requested table or zero if one
+ * is not found.
+ */
+vm_paddr_t
+acpi_find_table(const char *sig)
+{
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
+	ACPI_TABLE_HEADER *table;
+	vm_paddr_t addr;
+	int i, count;
+
+	if (resource_disabled("acpi", 0))
+		return (0);
+
+	/*
+	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
+	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
+	 * pmap_mapbios() to map the RSDP.
+	 */
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+		return (0);
+	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
+	if (rsdp == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map RSDP\n");
+		return (0);
+	}
+
+	/*
+	 * For ACPI >= 2.0, use the XSDT if it is available.
+	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 2
+	 * in the crashdump area.  Pages 0 and 1 are used to map in the
+	 * headers of candidate ACPI tables.
+	 */
+	addr = 0;
+	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
+		/*
+		 * AcpiOsGetRootPointer only verifies the checksum for
+		 * the version 1.0 portion of the RSDP.  Version 2.0 has
+		 * an additional checksum that we verify first.
+		 */
+		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
+			if (bootverbose)
+				printf("ACPI: RSDP failed extended checksum\n");
+			return (0);
+		}
+		xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+		if (xsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map XSDT\n");
+			return (0);
+		}
+		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT64);
+		for (i = 0; i < count; i++)
+			if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
+				addr = xsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(xsdt);
+	} else {
+		rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
+		if (rsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map RSDT\n");
+			return (0);
+		}
+		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT32);
+		for (i = 0; i < count; i++)
+			if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
+				addr = rsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(rsdt);
+	}
+	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
+	if (addr == 0) {
+		if (bootverbose)
+			printf("ACPI: No %s table found\n", sig);
+		return (0);
+	}
+	if (bootverbose)
+		printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
+
+	/*
+	 * Verify that we can map the full table and that its checksum is
+	 * correct, etc.
+	 */
+	table = map_table(addr, 0, sig);
+	if (table == NULL)
+		return (0);
+	acpi_unmap_table(table);
+
+	return (addr);
+}
+
+/*
  * ACPI nexus(4) driver.
  */
 static int

Modified: stable/8/sys/i386/acpica/madt.c
==============================================================================
--- stable/8/sys/i386/acpica/madt.c	Thu Oct 29 15:59:27 2009	(r198609)
+++ stable/8/sys/i386/acpica/madt.c	Thu Oct 29 16:00:27 2009	(r198610)
@@ -36,27 +36,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-
 #include 
-#include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
-typedef	void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
-
 /* These two arrays are indexed by APIC IDs. */
 struct ioapic_info {
 	void *io_apic;
@@ -79,8 +71,6 @@ static enum intr_polarity interrupt_pola
 static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
 static int	madt_find_cpu(u_int acpi_id, u_int *apic_id);
 static int	madt_find_interrupt(int intr, void **apic, u_int *pin);
-static void	*madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
-static void	*madt_map_table(vm_paddr_t pa, int offset, const char *sig);
 static void	madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
 static void	madt_parse_interrupt_override(
 		    ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@@ -92,13 +82,10 @@ static int	madt_probe(void);
 static int	madt_probe_cpus(void);
 static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
 		    void *arg __unused);
-static int	madt_probe_table(vm_paddr_t address);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
 static int	madt_setup_io(void);
-static void	madt_unmap(void *data, vm_offset_t length);
-static void	madt_unmap_table(void *table);
-static void	madt_walk_table(madt_entry_handler *handler, void *arg);
+static void	madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
 	"MADT",
@@ -108,87 +95,6 @@ static struct apic_enumerator madt_enume
 	madt_setup_io
 };
 
-/*
- * Code to abuse the crashdump map to map in the tables for the early
- * probe.  We cheat and make the following assumptions about how we
- * use this KVA: pages 0 and 1 are used to map in the header of each
- * table found via the RSDT or XSDT and pages 2 to n are used to map
- * in the RSDT or XSDT.  We have to use 2 pages for the table headers
- * in case a header spans a page boundary.  The offset is in pages;
- * the length is in bytes.
- */
-static void *
-madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
-{
-	vm_offset_t va, off;
-	void *data;
-
-	off = pa & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	pa = pa & PG_FRAME;
-	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
-	    (offset * PAGE_SIZE);
-	data = (void *)(va + off);
-	length -= PAGE_SIZE;
-	while (length > 0) {
-		va += PAGE_SIZE;
-		pa += PAGE_SIZE;
-		length -= PAGE_SIZE;
-		pmap_kenter(va, pa);
-		invlpg(va);
-	}
-	return (data);
-}
-
-static void
-madt_unmap(void *data, vm_offset_t length)
-{
-	vm_offset_t va, off;
-
-	va = (vm_offset_t)data;
-	off = va & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	va &= ~PAGE_MASK;
-	while (length > 0) {
-		pmap_kremove(va);
-		invlpg(va);
-		va += PAGE_SIZE;
-		length -= PAGE_SIZE;
-	}
-}
-
-static void *
-madt_map_table(vm_paddr_t pa, int offset, const char *sig)
-{
-	ACPI_TABLE_HEADER *header;
-	vm_offset_t length;
-	void *table;
-

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

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:19:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D3E01065695;
	Thu, 29 Oct 2009 16:19:58 +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 89B968FC12;
	Thu, 29 Oct 2009 16:19: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 n9TGJwxG002884;
	Thu, 29 Oct 2009 16:19:58 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGJwZ4002878;
	Thu, 29 Oct 2009 16:19:58 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291619.n9TGJwZ4002878@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 16:19:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198611 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf
	dev/xen/xenpci fs/procfs modules/procfs
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:19:58 -0000

Author: kib
Date: Thu Oct 29 16:19:58 2009
New Revision: 198611
URL: http://svn.freebsd.org/changeset/base/198611

Log:
  MFC r197428:
  Add per-process osrel node to the procfs, to allow read and set p_osrel
  value for the process.

Added:
  stable/8/sys/fs/procfs/procfs_osrel.c
     - copied unchanged from r197428, head/sys/fs/procfs/procfs_osrel.c
Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/files
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/procfs/procfs.c
  stable/8/sys/fs/procfs/procfs.h
  stable/8/sys/modules/procfs/Makefile

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Thu Oct 29 16:00:27 2009	(r198610)
+++ stable/8/sys/conf/files	Thu Oct 29 16:19:58 2009	(r198611)
@@ -1787,6 +1787,7 @@ fs/procfs/procfs_ioctl.c	optional procfs
 fs/procfs/procfs_map.c		optional procfs
 fs/procfs/procfs_mem.c		optional procfs
 fs/procfs/procfs_note.c		optional procfs
+fs/procfs/procfs_osrel.c	optional procfs
 fs/procfs/procfs_regs.c		optional procfs
 fs/procfs/procfs_rlimit.c	optional procfs
 fs/procfs/procfs_status.c	optional procfs

Modified: stable/8/sys/fs/procfs/procfs.c
==============================================================================
--- stable/8/sys/fs/procfs/procfs.c	Thu Oct 29 16:00:27 2009	(r198610)
+++ stable/8/sys/fs/procfs/procfs.c	Thu Oct 29 16:19:58 2009	(r198611)
@@ -108,7 +108,8 @@ procfs_attr(PFS_ATTR_ARGS)
 	else if (strcmp(pn->pn_name, "mem") == 0 ||
 	    strcmp(pn->pn_name, "regs") == 0 ||
 	    strcmp(pn->pn_name, "dbregs") == 0 ||
-	    strcmp(pn->pn_name, "fpregs") == 0)
+	    strcmp(pn->pn_name, "fpregs") == 0 ||
+	    strcmp(pn->pn_name, "osrel") == 0)
 		vap->va_mode = 0600;
 
 	if (p != NULL) {
@@ -186,6 +187,8 @@ procfs_init(PFS_INIT_ARGS)
 	    NULL, NULL, NULL, PFS_RD);
 	pfs_create_file(dir, "status", procfs_doprocstatus,
 	    NULL, NULL, NULL, PFS_RD);
+	pfs_create_file(dir, "osrel", procfs_doosrel,
+	    procfs_attr, procfs_candebug, NULL, PFS_RDWR);
 
 	pfs_create_link(dir, "file", procfs_doprocfile,
 	    NULL, procfs_notsystem, NULL, 0);

Modified: stable/8/sys/fs/procfs/procfs.h
==============================================================================
--- stable/8/sys/fs/procfs/procfs.h	Thu Oct 29 16:00:27 2009	(r198610)
+++ stable/8/sys/fs/procfs/procfs.h	Thu Oct 29 16:19:58 2009	(r198611)
@@ -39,6 +39,7 @@
 #ifdef _KERNEL
 
 int	 procfs_docurproc(PFS_FILL_ARGS);
+int	 procfs_doosrel(PFS_FILL_ARGS);
 int	 procfs_doproccmdline(PFS_FILL_ARGS);
 int	 procfs_doprocctl(PFS_FILL_ARGS);
 int	 procfs_doprocdbregs(PFS_FILL_ARGS);

Copied: stable/8/sys/fs/procfs/procfs_osrel.c (from r197428, head/sys/fs/procfs/procfs_osrel.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/fs/procfs/procfs_osrel.c	Thu Oct 29 16:19:58 2009	(r198611, copy of r197428, head/sys/fs/procfs/procfs_osrel.c)
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 2009 Konstantin Belousov
+ * 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.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 
+#include 
+
+int
+procfs_doosrel(PFS_FILL_ARGS)
+{
+	const char *pp;
+	int ov, osrel, i;
+
+	if (uio == NULL)
+		return (EOPNOTSUPP);
+	if (uio->uio_rw == UIO_READ) {
+		sbuf_printf(sb, "%d\n", p->p_osrel);
+	} else {
+		sbuf_trim(sb);
+		sbuf_finish(sb);
+		pp = sbuf_data(sb);
+		osrel = 0;
+		i = sbuf_len(sb);
+		while (i--) {
+			if (*pp < '0' || *pp > '9')
+				return (EINVAL);
+			ov = osrel * 10 + *pp++ - '0';
+			if (ov < osrel)
+				return (EINVAL);
+			osrel = ov;
+		}
+		p->p_osrel = osrel;
+	}
+	return (0);
+}

Modified: stable/8/sys/modules/procfs/Makefile
==============================================================================
--- stable/8/sys/modules/procfs/Makefile	Thu Oct 29 16:00:27 2009	(r198610)
+++ stable/8/sys/modules/procfs/Makefile	Thu Oct 29 16:19:58 2009	(r198611)
@@ -13,6 +13,7 @@ SRCS+=		procfs_ioctl.c
 SRCS+=		procfs_map.c
 SRCS+=		procfs_mem.c
 SRCS+=		procfs_note.c
+SRCS+=		procfs_osrel.c
 SRCS+=		procfs_regs.c
 SRCS+=		procfs_rlimit.c
 SRCS+=		procfs_status.c

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:21:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5372C106568D;
	Thu, 29 Oct 2009 16:21:53 +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 42A218FC18;
	Thu, 29 Oct 2009 16:21: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 n9TGLrs2002986;
	Thu, 29 Oct 2009 16:21:53 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGLrcw002984;
	Thu, 29 Oct 2009 16:21:53 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291621.n9TGLrcw002984@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 16:21:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198612 - stable/8/share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:21:53 -0000

Author: kib
Date: Thu Oct 29 16:21:52 2009
New Revision: 198612
URL: http://svn.freebsd.org/changeset/base/198612

Log:
  MFC r197429:
  Document osrel node for procfs.

Modified:
  stable/8/share/man/man5/   (props changed)
  stable/8/share/man/man5/procfs.5

Modified: stable/8/share/man/man5/procfs.5
==============================================================================
--- stable/8/share/man/man5/procfs.5	Thu Oct 29 16:19:58 2009	(r198611)
+++ stable/8/share/man/man5/procfs.5	Thu Oct 29 16:21:52 2009	(r198612)
@@ -2,7 +2,7 @@
 .\" Written by Garrett Wollman
 .\" This file is in the public domain.
 .\"
-.Dd July 9, 2009
+.Dd September 22, 2009
 .Dt PROCFS 5
 .Os
 .Sh NAME
@@ -117,6 +117,12 @@ Not implemented.
 .It Pa notepg
 Used for sending signal to the process group.
 Not implemented.
+.It Pa osrel
+Allows read and write of the kernel osrel value assigned to the process.
+It affects the compatibility shims that are turned on and off
+depending on the value.
+Initial process value is read from the ABI note tag in the executed ELF image,
+and is zero if the tag not supported by binary format or was not found.
 .It Pa regs
 Allows read and write access to the process' register set.
 This file contains a binary data structure
@@ -237,6 +243,8 @@ the complete virtual address space of th
 used for signaling the process
 .It Pa /proc/curproc/notepg
 used for signaling the process group
+.It Pa /proc/curproc/osrel
+the process osrel value
 .It Pa /proc/curproc/regs
 the process register set
 .It Pa /proc/curproc/rlimit

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:24:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC04D106566B;
	Thu, 29 Oct 2009 16:24:39 +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 9925D8FC0A;
	Thu, 29 Oct 2009 16:24: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 n9TGOdoc003099;
	Thu, 29 Oct 2009 16:24:39 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGOd40003096;
	Thu, 29 Oct 2009 16:24:39 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291624.n9TGOd40003096@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 16:24:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198613 - in stable/8/sys: . amd64/amd64
	amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica
	contrib/pf dev/xen/xenpci i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:24:39 -0000

Author: kib
Date: Thu Oct 29 16:24:39 2009
New Revision: 198613
URL: http://svn.freebsd.org/changeset/base/198613

Log:
  MFC r197389:
  Do panic regardeless of execution mode at the moment of T_RESERVED trap.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/trap.c
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/trap.c

Modified: stable/8/sys/amd64/amd64/trap.c
==============================================================================
--- stable/8/sys/amd64/amd64/trap.c	Thu Oct 29 16:21:52 2009	(r198612)
+++ stable/8/sys/amd64/amd64/trap.c	Thu Oct 29 16:24:39 2009	(r198613)
@@ -253,6 +253,11 @@ trap(struct trapframe *frame)
 	}
 #endif
 
+	if (type == T_RESERVED) {
+		trap_fatal(frame, 0);
+		goto out;
+	}
+
 #ifdef	HWPMC_HOOKS
 	/*
 	 * CPU PMCs interrupt using an NMI.  If the PMC module is

Modified: stable/8/sys/i386/i386/trap.c
==============================================================================
--- stable/8/sys/i386/i386/trap.c	Thu Oct 29 16:21:52 2009	(r198612)
+++ stable/8/sys/i386/i386/trap.c	Thu Oct 29 16:24:39 2009	(r198613)
@@ -225,6 +225,11 @@ trap(struct trapframe *frame)
 	}
 #endif
 
+	if (type == T_RESERVED) {
+		trap_fatal(frame, 0);
+		goto out;
+	}
+
 #ifdef	HWPMC_HOOKS
 	/*
 	 * CPU PMCs interrupt using an NMI so we check for that first.

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:28:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5E466106568D;
	Thu, 29 Oct 2009 16:28:21 +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 4BEEB8FC17;
	Thu, 29 Oct 2009 16:28:21 +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 n9TGSL2N003229;
	Thu, 29 Oct 2009 16:28:21 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGSL4e003227;
	Thu, 29 Oct 2009 16:28:21 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910291628.n9TGSL4e003227@svn.freebsd.org>
From: Konstantin Belousov 
Date: Thu, 29 Oct 2009 16:28:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198614 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:28:21 -0000

Author: kib
Date: Thu Oct 29 16:28:21 2009
New Revision: 198614
URL: http://svn.freebsd.org/changeset/base/198614

Log:
  MFC r197930:
  Postpone dropping fp till both kq_global and kqueue mutexes are
  unlocked.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_event.c

Modified: stable/8/sys/kern/kern_event.c
==============================================================================
--- stable/8/sys/kern/kern_event.c	Thu Oct 29 16:24:39 2009	(r198613)
+++ stable/8/sys/kern/kern_event.c	Thu Oct 29 16:28:21 2009	(r198614)
@@ -909,13 +909,13 @@ findkn:
 
 	/* knote is in the process of changing, wait for it to stablize. */
 	if (kn != NULL && (kn->kn_status & KN_INFLUX) == KN_INFLUX) {
+		KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal);
+		kq->kq_state |= KQ_FLUXWAIT;
+		msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0);
 		if (fp != NULL) {
 			fdrop(fp, td);
 			fp = NULL;
 		}
-		KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal);
-		kq->kq_state |= KQ_FLUXWAIT;
-		msleep(kq, &kq->kq_lock, PSOCK | PDROP, "kqflxwt", 0);
 		goto findkn;
 	}
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:30:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7192E1065676;
	Thu, 29 Oct 2009 16:30:48 +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 608628FC20;
	Thu, 29 Oct 2009 16:30: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 n9TGUm2J003341;
	Thu, 29 Oct 2009 16:30:48 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGUmQ0003339;
	Thu, 29 Oct 2009 16:30:48 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910291630.n9TGUmQ0003339@svn.freebsd.org>
From: Christian Brueffer 
Date: Thu, 29 Oct 2009 16:30:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198615 - in stable/8/etc: . defaults
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:30:48 -0000

Author: brueffer
Date: Thu Oct 29 16:30:48 2009
New Revision: 198615
URL: http://svn.freebsd.org/changeset/base/198615

Log:
  MFC: r198314
  
  Add empty watchdogd_flags.

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/defaults/rc.conf

Modified: stable/8/etc/defaults/rc.conf
==============================================================================
--- stable/8/etc/defaults/rc.conf	Thu Oct 29 16:28:21 2009	(r198614)
+++ stable/8/etc/defaults/rc.conf	Thu Oct 29 16:30:48 2009	(r198615)
@@ -597,6 +597,7 @@ harvest_ethernet="YES"	# Entropy device 
 harvest_p_to_p="YES"	# Entropy device harvests point-to-point randomness
 dmesg_enable="YES"	# Save dmesg(8) to /var/run/dmesg.boot
 watchdogd_enable="NO"	# Start the software watchdog daemon
+watchdogd_flags=""	# Flags to watchdogd (if enabled)
 devfs_rulesets="/etc/defaults/devfs.rules /etc/devfs.rules" # Files containing
 							    # devfs(8) rules.
 devfs_system_ruleset=""	# The name (NOT number) of a ruleset to apply to /dev

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 16:39:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A268C106566B;
	Thu, 29 Oct 2009 16:39:27 +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 912348FC15;
	Thu, 29 Oct 2009 16:39: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 n9TGdRhw003616;
	Thu, 29 Oct 2009 16:39:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TGdRpV003614;
	Thu, 29 Oct 2009 16:39:27 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910291639.n9TGdRpV003614@svn.freebsd.org>
From: Christian Brueffer 
Date: Thu, 29 Oct 2009 16:39:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198616 - in stable/7/etc: . defaults
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 16:39:27 -0000

Author: brueffer
Date: Thu Oct 29 16:39:27 2009
New Revision: 198616
URL: http://svn.freebsd.org/changeset/base/198616

Log:
  MFC: r198314
  
  Add empty watchdogd_flags.

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/defaults/rc.conf
  stable/7/etc/termcap.small   (props changed)

Modified: stable/7/etc/defaults/rc.conf
==============================================================================
--- stable/7/etc/defaults/rc.conf	Thu Oct 29 16:30:48 2009	(r198615)
+++ stable/7/etc/defaults/rc.conf	Thu Oct 29 16:39:27 2009	(r198616)
@@ -592,6 +592,7 @@ harvest_ethernet="YES"	# Entropy device 
 harvest_p_to_p="YES"	# Entropy device harvests point-to-point randomness
 dmesg_enable="YES"	# Save dmesg(8) to /var/run/dmesg.boot
 watchdogd_enable="NO"	# Start the software watchdog daemon
+watchdogd_flags=""	# Flags to watchdogd (if enabled)
 devfs_rulesets="/etc/defaults/devfs.rules /etc/devfs.rules" # Files containing
 							    # devfs(8) rules.
 devfs_system_ruleset=""	# The name (NOT number) of a ruleset to apply to /dev

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 17:14:18 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D90F8106566B;
	Thu, 29 Oct 2009 17:14:18 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8DBA8FC1D;
	Thu, 29 Oct 2009 17:14: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 n9THEI2g004430;
	Thu, 29 Oct 2009 17:14:18 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9THEIS9004427;
	Thu, 29 Oct 2009 17:14:18 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910291714.n9THEIS9004427@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 29 Oct 2009 17:14: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: r198617 - head/sys/dev/aac
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 17:14:18 -0000

Author: emaste
Date: Thu Oct 29 17:14:18 2009
New Revision: 198617
URL: http://svn.freebsd.org/changeset/base/198617

Log:
  Rename aac_srb32 to aac_srb, to match Adaptec's vendor driver.

Modified:
  head/sys/dev/aac/aac_cam.c
  head/sys/dev/aac/aacreg.h

Modified: head/sys/dev/aac/aac_cam.c
==============================================================================
--- head/sys/dev/aac/aac_cam.c	Thu Oct 29 16:39:27 2009	(r198616)
+++ head/sys/dev/aac/aac_cam.c	Thu Oct 29 17:14:18 2009	(r198617)
@@ -211,7 +211,7 @@ aac_cam_action(struct cam_sim *sim, unio
 {
 	struct	aac_cam *camsc;
 	struct	aac_softc *sc;
-	struct	aac_srb32 *srb;
+	struct	aac_srb *srb;
 	struct	aac_fib *fib;
 	struct	aac_command *cm;
 
@@ -351,7 +351,7 @@ aac_cam_action(struct cam_sim *sim, unio
 	}
 
 	fib = cm->cm_fib;
-	srb = (struct aac_srb32 *)&fib->data[0];
+	srb = (struct aac_srb *)&fib->data[0];
 	cm->cm_datalen = 0;
 
 	switch (ccb->ccb_h.flags & CAM_DIR_MASK) {
@@ -459,7 +459,7 @@ aac_cam_action(struct cam_sim *sim, unio
 	    AAC_FIBSTATE_REXPECTED	|
 	    AAC_FIBSTATE_NORM;
 	fib->Header.Size = sizeof(struct aac_fib_header) +
-	    sizeof(struct aac_srb32);
+	    sizeof(struct aac_srb);
 
 	aac_enqueue_ready(cm);
 	aac_startio(cm->cm_sc);

Modified: head/sys/dev/aac/aacreg.h
==============================================================================
--- head/sys/dev/aac/aacreg.h	Thu Oct 29 16:39:27 2009	(r198616)
+++ head/sys/dev/aac/aacreg.h	Thu Oct 29 17:14:18 2009	(r198617)
@@ -1363,7 +1363,7 @@ struct aac_close_command {
 /*
  * SCSI Passthrough structures
  */
-struct aac_srb32 {
+struct aac_srb {
 	u_int32_t		function;
 	u_int32_t		bus;
 	u_int32_t		target;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 17:15:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7CC0E106566C;
	Thu, 29 Oct 2009 17:15:22 +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 6942D8FC0C;
	Thu, 29 Oct 2009 17: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 n9THFMB3004504;
	Thu, 29 Oct 2009 17:15:22 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9THFMIq004495;
	Thu, 29 Oct 2009 17:15:22 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291715.n9THFMIq004495@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 17:15:22 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198618 - in stable/7/sys: . amd64/acpica amd64/include
	contrib/pf dev/acpica i386/acpica i386/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 17:15:22 -0000

Author: jhb
Date: Thu Oct 29 17:15:22 2009
New Revision: 198618
URL: http://svn.freebsd.org/changeset/base/198618

Log:
  MFC 197439:
  Extract the code to find and map the MADT ACPI table during early kernel
  startup and genericize it so it can be reused to map other tables as well:
  - Add a routine to walk a list of ACPI subtables such as those used in the
    APIC and SRAT tables in the MI acpi(4) driver.
  - Move the routines for mapping and unmapping an ACPI table as well as
    mapping the RSDT or XSDT and searching for a table with a given signature
    out into acpica_machdep.c for both amd64 and i386.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/acpica/acpi_machdep.c
  stable/7/sys/amd64/acpica/madt.c
  stable/7/sys/amd64/include/acpica_machdep.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpica/acpi.c
  stable/7/sys/dev/acpica/acpivar.h
  stable/7/sys/i386/acpica/acpi_machdep.c
  stable/7/sys/i386/acpica/madt.c
  stable/7/sys/i386/include/acpica_machdep.h

Modified: stable/7/sys/amd64/acpica/acpi_machdep.c
==============================================================================
--- stable/7/sys/amd64/acpica/acpi_machdep.c	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/amd64/acpica/acpi_machdep.c	Thu Oct 29 17:15:22 2009	(r198618)
@@ -29,8 +29,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
 
 #include 
+#include 
+
 #include 
 
 static int intr_model = ACPI_INTR_PIC;
@@ -67,3 +71,243 @@ acpi_cpu_c1()
 {
 	__asm __volatile("sti; hlt");
 }
+
+/*
+ * Support for mapping ACPI tables during early boot.  Currently this
+ * uses the crashdump map to map each table.  However, the crashdump
+ * map is created in pmap_bootstrap() right after the direct map, so
+ * we should be able to just use pmap_mapbios() here instead.
+ *
+ * This makes the following assumptions about how we use this KVA:
+ * pages 0 and 1 are used to map in the header of each table found via
+ * the RSDT or XSDT and pages 2 to n are used to map in the RSDT or
+ * XSDT.  This has to use 2 pages for the table headers in case a
+ * header spans a page boundary.
+ *
+ * XXX: We don't ensure the table fits in the available address space
+ * in the crashdump map.
+ */
+
+/*
+ * Map some memory using the crashdump map.  'offset' is an offset in
+ * pages into the crashdump map to use for the start of the mapping.
+ */
+static void *
+table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+{
+	vm_offset_t va, off;
+	void *data;
+
+	off = pa & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	pa = pa & PG_FRAME;
+	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
+	    (offset * PAGE_SIZE);
+	data = (void *)(va + off);
+	length -= PAGE_SIZE;
+	while (length > 0) {
+		va += PAGE_SIZE;
+		pa += PAGE_SIZE;
+		length -= PAGE_SIZE;
+		pmap_kenter(va, pa);
+		invlpg(va);
+	}
+	return (data);
+}
+
+/* Unmap memory previously mapped with table_map(). */
+static void
+table_unmap(void *data, vm_offset_t length)
+{
+	vm_offset_t va, off;
+
+	va = (vm_offset_t)data;
+	off = va & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	va &= ~PAGE_MASK;
+	while (length > 0) {
+		pmap_kremove(va);
+		invlpg(va);
+		va += PAGE_SIZE;
+		length -= PAGE_SIZE;
+	}
+}
+
+/*
+ * Map a table at a given offset into the crashdump map.  It first
+ * maps the header to determine the table length and then maps the
+ * entire table.
+ */
+static void *
+map_table(vm_paddr_t pa, int offset, const char *sig)
+{
+	ACPI_TABLE_HEADER *header;
+	vm_offset_t length;
+	void *table;
+
+	header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+		return (NULL);
+	}
+	length = header->Length;
+	table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+	table = table_map(pa, offset, length);
+	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
+		if (bootverbose)
+			printf("ACPI: Failed checksum for table %s\n", sig);
+		table_unmap(table, length);
+		return (NULL);
+	}
+	return (table);
+}
+
+/*
+ * See if a given ACPI table is the requested table.  Returns the
+ * length of the able if it matches or zero on failure.
+ */
+static int
+probe_table(vm_paddr_t address, const char *sig)
+{
+	ACPI_TABLE_HEADER *table;
+
+	table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
+	if (table == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map table at 0x%jx\n",
+			    (uintmax_t)address);
+		return (0);
+	}
+	if (bootverbose)
+		printf("Table '%.4s' at 0x%jx\n", table->Signature,
+		    (uintmax_t)address);
+
+	if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+		return (0);
+	}
+	table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+	return (1);
+}
+
+/*
+ * Try to map a table at a given physical address previously returned
+ * by acpi_find_table().
+ */
+void *
+acpi_map_table(vm_paddr_t pa, const char *sig)
+{
+
+	return (map_table(pa, 0, sig));
+}
+
+/* Unmap a table previously mapped via acpi_map_table(). */
+void
+acpi_unmap_table(void *table)
+{
+	ACPI_TABLE_HEADER *header;
+
+	header = (ACPI_TABLE_HEADER *)table;
+	table_unmap(table, header->Length);
+}
+
+/*
+ * Return the physical address of the requested table or zero if one
+ * is not found.
+ */
+vm_paddr_t
+acpi_find_table(const char *sig)
+{
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
+	ACPI_TABLE_HEADER *table;
+	vm_paddr_t addr;
+	int i, count;
+
+	if (resource_disabled("acpi", 0))
+		return (0);
+
+	/*
+	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
+	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
+	 * pmap_mapbios() to map the RSDP.
+	 */
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+		return (0);
+	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
+	if (rsdp == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map RSDP\n");
+		return (0);
+	}
+
+	/*
+	 * For ACPI >= 2.0, use the XSDT if it is available.
+	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 2
+	 * in the crashdump area.  Pages 0 and 1 are used to map in the
+	 * headers of candidate ACPI tables.
+	 */
+	addr = 0;
+	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
+		/*
+		 * AcpiOsGetRootPointer only verifies the checksum for
+		 * the version 1.0 portion of the RSDP.  Version 2.0 has
+		 * an additional checksum that we verify first.
+		 */
+		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
+			if (bootverbose)
+				printf("ACPI: RSDP failed extended checksum\n");
+			return (0);
+		}
+		xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+		if (xsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map XSDT\n");
+			return (0);
+		}
+		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT64);
+		for (i = 0; i < count; i++)
+			if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
+				addr = xsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(xsdt);
+	} else {
+		rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
+		if (rsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map RSDT\n");
+			return (0);
+		}
+		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT32);
+		for (i = 0; i < count; i++)
+			if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
+				addr = rsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(rsdt);
+	}
+	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
+	if (addr == 0) {
+		if (bootverbose)
+			printf("ACPI: No %s table found\n", sig);
+		return (0);
+	}
+	if (bootverbose)
+		printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
+
+	/*
+	 * Verify that we can map the full table and that its checksum is
+	 * correct, etc.
+	 */
+	table = map_table(addr, 0, sig);
+	if (table == NULL)
+		return (0);
+	acpi_unmap_table(table);
+
+	return (addr);
+}

Modified: stable/7/sys/amd64/acpica/madt.c
==============================================================================
--- stable/7/sys/amd64/acpica/madt.c	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/amd64/acpica/madt.c	Thu Oct 29 17:15:22 2009	(r198618)
@@ -36,25 +36,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-
 #include 
-#include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
+
 #include 
 #include 
 
-typedef	void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
-
 /* These two arrays are indexed by APIC IDs. */
 struct ioapic_info {
 	void *io_apic;
@@ -77,8 +71,6 @@ static enum intr_polarity interrupt_pola
 static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
 static int	madt_find_cpu(u_int acpi_id, u_int *apic_id);
 static int	madt_find_interrupt(int intr, void **apic, u_int *pin);
-static void	*madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
-static void	*madt_map_table(vm_paddr_t pa, int offset, const char *sig);
 static void	madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
 static void	madt_parse_interrupt_override(
 		    ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@@ -90,13 +82,10 @@ static int	madt_probe(void);
 static int	madt_probe_cpus(void);
 static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
 		    void *arg __unused);
-static int	madt_probe_table(vm_paddr_t address);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
 static int	madt_setup_io(void);
-static void	madt_unmap(void *data, vm_offset_t length);
-static void	madt_unmap_table(void *table);
-static void	madt_walk_table(madt_entry_handler *handler, void *arg);
+static void	madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
 	"MADT",
@@ -107,224 +96,30 @@ static struct apic_enumerator madt_enume
 };
 
 /*
- * Code to abuse the crashdump map to map in the tables for the early
- * probe.  We cheat and make the following assumptions about how we
- * use this KVA: pages 0 and 1 are used to map in the header of each
- * table found via the RSDT or XSDT and pages 2 to n are used to map
- * in the RSDT or XSDT.  We have to use 2 pages for the table headers
- * in case a header spans a page boundary.  The offset is in pages;
- * the length is in bytes.
- */
-static void *
-madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
-{
-	vm_offset_t va, off;
-	void *data;
-
-	off = pa & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	pa = pa & PG_FRAME;
-	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
-	    (offset * PAGE_SIZE);
-	data = (void *)(va + off);
-	length -= PAGE_SIZE;
-	while (length > 0) {
-		va += PAGE_SIZE;
-		pa += PAGE_SIZE;
-		length -= PAGE_SIZE;
-		pmap_kenter(va, pa);
-		invlpg(va);
-	}
-	return (data);
-}
-
-static void
-madt_unmap(void *data, vm_offset_t length)
-{
-	vm_offset_t va, off;
-
-	va = (vm_offset_t)data;
-	off = va & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	va &= ~PAGE_MASK;
-	while (length > 0) {
-		pmap_kremove(va);
-		invlpg(va);
-		va += PAGE_SIZE;
-		length -= PAGE_SIZE;
-	}
-}
-
-static void *
-madt_map_table(vm_paddr_t pa, int offset, const char *sig)
-{
-	ACPI_TABLE_HEADER *header;
-	vm_offset_t length;
-	void *table;
-
-	header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
-	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
-		madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-		return (NULL);
-	}
-	length = header->Length;
-	madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-	table = madt_map(pa, offset, length);
-	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
-		if (bootverbose)
-			printf("MADT: Failed checksum for table %s\n", sig);
-		madt_unmap(table, length);
-		return (NULL);
-	}
-	return (table);
-}
-
-static void
-madt_unmap_table(void *table)
-{
-	ACPI_TABLE_HEADER *header;
-
-	header = (ACPI_TABLE_HEADER *)table;
-	madt_unmap(table, header->Length);
-}
-
-/*
  * Look for an ACPI Multiple APIC Description Table ("APIC")
  */
 static int
 madt_probe(void)
 {
-	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
-	ACPI_TABLE_RSDP *rsdp;
-	ACPI_TABLE_RSDT *rsdt;
-	ACPI_TABLE_XSDT *xsdt;
-	int i, count;
-
-	if (resource_disabled("acpi", 0))
-		return (ENXIO);
-
-	/*
-	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
-	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
-	 * pmap_mapbios() to map the RSDP.
-	 */
-	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
-		return (ENXIO);
-	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
-	if (rsdp == NULL) {
-		if (bootverbose)
-			printf("MADT: Failed to map RSDP\n");
-		return (ENXIO);
-	}
-
-	/*
-	 * For ACPI >= 2.0, use the XSDT if it is available.
-	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 1
-	 * in the crashdump area.  Page 0 is used to map in the
-	 * headers of candidate ACPI tables.
-	 */
-	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
-		/*
-		 * AcpiOsGetRootPointer only verifies the checksum for
-		 * the version 1.0 portion of the RSDP.  Version 2.0 has
-		 * an additional checksum that we verify first.
-		 */
-		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
-			if (bootverbose)
-				printf("MADT: RSDP failed extended checksum\n");
-			return (ENXIO);
-		}
-		xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 2,
-		    ACPI_SIG_XSDT);
-		if (xsdt == NULL) {
-			if (bootverbose)
-				printf("MADT: Failed to map XSDT\n");
-			return (ENXIO);
-		}
-		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
-		    sizeof(UINT64);
-		for (i = 0; i < count; i++)
-			if (madt_probe_table(xsdt->TableOffsetEntry[i]))
-				break;
-		madt_unmap_table(xsdt);
-	} else {
-		rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 2,
-		    ACPI_SIG_RSDT);
-		if (rsdt == NULL) {
-			if (bootverbose)
-				printf("MADT: Failed to map RSDT\n");
-			return (ENXIO);
-		}
-		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
-		    sizeof(UINT32);
-		for (i = 0; i < count; i++)
-			if (madt_probe_table(rsdt->TableOffsetEntry[i]))
-				break;
-		madt_unmap_table(rsdt);
-	}
-	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
-	if (madt_physaddr == 0) {
-		if (bootverbose)
-			printf("MADT: No MADT table found\n");
-		return (ENXIO);
-	}
-	if (bootverbose)
-		printf("MADT: Found table at 0x%jx\n",
-		    (uintmax_t)madt_physaddr);
 
-	/*
-	 * Verify that we can map the full table and that its checksum is
-	 * correct, etc.
-	 */
-	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
-	if (madt == NULL)
+	madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+	if (madt_physaddr == 0)
 		return (ENXIO);
-	madt_unmap_table(madt);
-	madt = NULL;
-
 	return (0);
 }
 
 /*
- * See if a given ACPI table is the MADT.
- */
-static int
-madt_probe_table(vm_paddr_t address)
-{
-	ACPI_TABLE_HEADER *table;
-
-	table = madt_map(address, 0, sizeof(ACPI_TABLE_HEADER));
-	if (table == NULL) {
-		if (bootverbose)
-			printf("MADT: Failed to map table at 0x%jx\n",
-			    (uintmax_t)address);
-		return (0);
-	}
-	if (bootverbose)
-		printf("Table '%.4s' at 0x%jx\n", table->Signature,
-		    (uintmax_t)address);
-
-	if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) {
-		madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
-		return (0);
-	}
-	madt_physaddr = address;
-	madt_length = table->Length;
-	madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
-	return (1);
-}
-
-/*
  * Run through the MP table enumerating CPUs.
  */
 static int
 madt_probe_cpus(void)
 {
 
-	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
+	madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+	madt_length = madt->Header.Length;
 	KASSERT(madt != NULL, ("Unable to re-map MADT"));
 	madt_walk_table(madt_probe_cpus_handler, NULL);
-	madt_unmap_table(madt);
+	acpi_unmap_table(madt);
 	madt = NULL;
 	return (0);
 }
@@ -415,17 +210,11 @@ SYSINIT(madt_register, SI_SUB_TUNABLES -
  * Call the handler routine for each entry in the MADT table.
  */
 static void
-madt_walk_table(madt_entry_handler *handler, void *arg)
+madt_walk_table(acpi_subtable_handler *handler, void *arg)
 {
-	ACPI_SUBTABLE_HEADER *entry;
-	u_char *p, *end;
 
-	end = (u_char *)(madt) + madt->Header.Length;
-	for (p = (u_char *)(madt + 1); p < end; ) {
-		entry = (ACPI_SUBTABLE_HEADER *)p;
-		handler(entry, arg);
-		p += entry->Length;
-	}
+	acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
+	    handler, arg);
 }
 
 static void

Modified: stable/7/sys/amd64/include/acpica_machdep.h
==============================================================================
--- stable/7/sys/amd64/include/acpica_machdep.h	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/amd64/include/acpica_machdep.h	Thu Oct 29 17:15:22 2009	(r198618)
@@ -77,5 +77,8 @@ extern int	acpi_release_global_lock(uint
 
 void	acpi_SetDefaultIntrModel(int model);
 void	acpi_cpu_c1(void);
+void	*acpi_map_table(vm_paddr_t pa, const char *sig);
+void	acpi_unmap_table(void *table);
+vm_paddr_t acpi_find_table(const char *sig);
 
 #endif /* __ACPICA_MACHDEP_H__ */

Modified: stable/7/sys/dev/acpica/acpi.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi.c	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/dev/acpica/acpi.c	Thu Oct 29 17:15:22 2009	(r198618)
@@ -2166,6 +2166,28 @@ acpi_SetIntrModel(int model)
 }
 
 /*
+ * Walk subtables of a table and call a callback routine for each
+ * subtable.  The caller should provide the first subtable and a
+ * pointer to the end of the table.  This can be used to walk tables
+ * such as MADT and SRAT that use subtable entries.
+ */
+void
+acpi_walk_subtables(void *first, void *end, acpi_subtable_handler *handler,
+    void *arg)
+{
+    ACPI_SUBTABLE_HEADER *entry;
+
+    for (entry = first; (void *)entry < end; ) {
+	/* Avoid an infinite loop if we hit a bogus entry. */
+	if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER))
+	    return;
+
+	handler(entry, arg);
+	entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length);
+    }
+}
+
+/*
  * DEPRECATED.  This interface has serious deficiencies and will be
  * removed.
  *

Modified: stable/7/sys/dev/acpica/acpivar.h
==============================================================================
--- stable/7/sys/dev/acpica/acpivar.h	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/dev/acpica/acpivar.h	Thu Oct 29 17:15:22 2009	(r198618)
@@ -307,6 +307,9 @@ void		acpi_EnterDebugger(void);
 	ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \
 	    ACPI_STA_BATT_PRESENT)
 
+/* Callback function type for walking subtables within a table. */
+typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *);
+
 BOOLEAN		acpi_DeviceIsPresent(device_t dev);
 BOOLEAN		acpi_BatteryIsPresent(device_t dev);
 ACPI_STATUS	acpi_GetHandleInScope(ACPI_HANDLE parent, char *path,
@@ -339,6 +342,8 @@ void		acpi_UserNotify(const char *subsys
 int		acpi_bus_alloc_gas(device_t dev, int *type, int *rid,
 		    ACPI_GENERIC_ADDRESS *gas, struct resource **res,
 		    u_int flags);
+void		acpi_walk_subtables(void *first, void *end,
+		    acpi_subtable_handler *handler, void *arg);
 
 struct acpi_parse_resource_set {
     void	(*set_init)(device_t dev, void *arg, void **context);

Modified: stable/7/sys/i386/acpica/acpi_machdep.c
==============================================================================
--- stable/7/sys/i386/acpica/acpi_machdep.c	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/i386/acpica/acpi_machdep.c	Thu Oct 29 17:15:22 2009	(r198618)
@@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+
 #include 
 #include 
 
@@ -549,3 +551,241 @@ acpi_cpu_c1()
 {
 	__asm __volatile("sti; hlt");
 }
+
+/*
+ * Support for mapping ACPI tables during early boot.  This abuses the
+ * crashdump map because the kernel cannot allocate KVA in
+ * pmap_mapbios() when this is used.  This makes the following
+ * assumptions about how we use this KVA: pages 0 and 1 are used to
+ * map in the header of each table found via the RSDT or XSDT and
+ * pages 2 to n are used to map in the RSDT or XSDT.  This has to use
+ * 2 pages for the table headers in case a header spans a page
+ * boundary.
+ *
+ * XXX: We don't ensure the table fits in the available address space
+ * in the crashdump map.
+ */
+
+/*
+ * Map some memory using the crashdump map.  'offset' is an offset in
+ * pages into the crashdump map to use for the start of the mapping.
+ */
+static void *
+table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+{
+	vm_offset_t va, off;
+	void *data;
+
+	off = pa & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	pa = pa & PG_FRAME;
+	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
+	    (offset * PAGE_SIZE);
+	data = (void *)(va + off);
+	length -= PAGE_SIZE;
+	while (length > 0) {
+		va += PAGE_SIZE;
+		pa += PAGE_SIZE;
+		length -= PAGE_SIZE;
+		pmap_kenter(va, pa);
+		invlpg(va);
+	}
+	return (data);
+}
+
+/* Unmap memory previously mapped with table_map(). */
+static void
+table_unmap(void *data, vm_offset_t length)
+{
+	vm_offset_t va, off;
+
+	va = (vm_offset_t)data;
+	off = va & PAGE_MASK;
+	length = roundup(length + off, PAGE_SIZE);
+	va &= ~PAGE_MASK;
+	while (length > 0) {
+		pmap_kremove(va);
+		invlpg(va);
+		va += PAGE_SIZE;
+		length -= PAGE_SIZE;
+	}
+}
+
+/*
+ * Map a table at a given offset into the crashdump map.  It first
+ * maps the header to determine the table length and then maps the
+ * entire table.
+ */
+static void *
+map_table(vm_paddr_t pa, int offset, const char *sig)
+{
+	ACPI_TABLE_HEADER *header;
+	vm_offset_t length;
+	void *table;
+
+	header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+		return (NULL);
+	}
+	length = header->Length;
+	table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+	table = table_map(pa, offset, length);
+	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
+		if (bootverbose)
+			printf("ACPI: Failed checksum for table %s\n", sig);
+		table_unmap(table, length);
+		return (NULL);
+	}
+	return (table);
+}
+
+/*
+ * See if a given ACPI table is the requested table.  Returns the
+ * length of the able if it matches or zero on failure.
+ */
+static int
+probe_table(vm_paddr_t address, const char *sig)
+{
+	ACPI_TABLE_HEADER *table;
+
+	table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
+	if (table == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map table at 0x%jx\n",
+			    (uintmax_t)address);
+		return (0);
+	}
+	if (bootverbose)
+		printf("Table '%.4s' at 0x%jx\n", table->Signature,
+		    (uintmax_t)address);
+
+	if (strncmp(table->Signature, sig, ACPI_NAME_SIZE) != 0) {
+		table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+		return (0);
+	}
+	table_unmap(table, sizeof(ACPI_TABLE_HEADER));
+	return (1);
+}
+
+/*
+ * Try to map a table at a given physical address previously returned
+ * by acpi_find_table().
+ */
+void *
+acpi_map_table(vm_paddr_t pa, const char *sig)
+{
+
+	return (map_table(pa, 0, sig));
+}
+
+/* Unmap a table previously mapped via acpi_map_table(). */
+void
+acpi_unmap_table(void *table)
+{
+	ACPI_TABLE_HEADER *header;
+
+	header = (ACPI_TABLE_HEADER *)table;
+	table_unmap(table, header->Length);
+}
+
+/*
+ * Return the physical address of the requested table or zero if one
+ * is not found.
+ */
+vm_paddr_t
+acpi_find_table(const char *sig)
+{
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
+	ACPI_TABLE_HEADER *table;
+	vm_paddr_t addr;
+	int i, count;
+
+	if (resource_disabled("acpi", 0))
+		return (0);
+
+	/*
+	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
+	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
+	 * pmap_mapbios() to map the RSDP.
+	 */
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
+		return (0);
+	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
+	if (rsdp == NULL) {
+		if (bootverbose)
+			printf("ACPI: Failed to map RSDP\n");
+		return (0);
+	}
+
+	/*
+	 * For ACPI >= 2.0, use the XSDT if it is available.
+	 * Otherwise, use the RSDT.  We map the XSDT or RSDT at page 2
+	 * in the crashdump area.  Pages 0 and 1 are used to map in the
+	 * headers of candidate ACPI tables.
+	 */
+	addr = 0;
+	if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) {
+		/*
+		 * AcpiOsGetRootPointer only verifies the checksum for
+		 * the version 1.0 portion of the RSDP.  Version 2.0 has
+		 * an additional checksum that we verify first.
+		 */
+		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
+			if (bootverbose)
+				printf("ACPI: RSDP failed extended checksum\n");
+			return (0);
+		}
+		xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+		if (xsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map XSDT\n");
+			return (0);
+		}
+		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT64);
+		for (i = 0; i < count; i++)
+			if (probe_table(xsdt->TableOffsetEntry[i], sig)) {
+				addr = xsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(xsdt);
+	} else {
+		rsdt = map_table(rsdp->RsdtPhysicalAddress, 2, ACPI_SIG_RSDT);
+		if (rsdt == NULL) {
+			if (bootverbose)
+				printf("ACPI: Failed to map RSDT\n");
+			return (0);
+		}
+		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
+		    sizeof(UINT32);
+		for (i = 0; i < count; i++)
+			if (probe_table(rsdt->TableOffsetEntry[i], sig)) {
+				addr = rsdt->TableOffsetEntry[i];
+				break;
+			}
+		acpi_unmap_table(rsdt);
+	}
+	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
+	if (addr == 0) {
+		if (bootverbose)
+			printf("ACPI: No %s table found\n", sig);
+		return (0);
+	}
+	if (bootverbose)
+		printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
+
+	/*
+	 * Verify that we can map the full table and that its checksum is
+	 * correct, etc.
+	 */
+	table = map_table(addr, 0, sig);
+	if (table == NULL)
+		return (0);
+	acpi_unmap_table(table);
+
+	return (addr);
+}

Modified: stable/7/sys/i386/acpica/madt.c
==============================================================================
--- stable/7/sys/i386/acpica/madt.c	Thu Oct 29 17:14:18 2009	(r198617)
+++ stable/7/sys/i386/acpica/madt.c	Thu Oct 29 17:15:22 2009	(r198618)
@@ -36,25 +36,19 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-
 #include 
-#include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
+
 #include 
 #include 
 
-typedef	void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
-
 /* These two arrays are indexed by APIC IDs. */
 struct ioapic_info {
 	void *io_apic;
@@ -77,8 +71,6 @@ static enum intr_polarity interrupt_pola
 static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
 static int	madt_find_cpu(u_int acpi_id, u_int *apic_id);
 static int	madt_find_interrupt(int intr, void **apic, u_int *pin);
-static void	*madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
-static void	*madt_map_table(vm_paddr_t pa, int offset, const char *sig);
 static void	madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
 static void	madt_parse_interrupt_override(
 		    ACPI_MADT_INTERRUPT_OVERRIDE *intr);
@@ -90,13 +82,10 @@ static int	madt_probe(void);
 static int	madt_probe_cpus(void);
 static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
 		    void *arg __unused);
-static int	madt_probe_table(vm_paddr_t address);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
 static int	madt_setup_io(void);
-static void	madt_unmap(void *data, vm_offset_t length);
-static void	madt_unmap_table(void *table);
-static void	madt_walk_table(madt_entry_handler *handler, void *arg);
+static void	madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
 	"MADT",
@@ -106,87 +95,6 @@ static struct apic_enumerator madt_enume
 	madt_setup_io
 };
 
-/*
- * Code to abuse the crashdump map to map in the tables for the early
- * probe.  We cheat and make the following assumptions about how we
- * use this KVA: pages 0 and 1 are used to map in the header of each
- * table found via the RSDT or XSDT and pages 2 to n are used to map
- * in the RSDT or XSDT.  We have to use 2 pages for the table headers
- * in case a header spans a page boundary.  The offset is in pages;
- * the length is in bytes.
- */
-static void *
-madt_map(vm_paddr_t pa, int offset, vm_offset_t length)
-{
-	vm_offset_t va, off;
-	void *data;
-
-	off = pa & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	pa = pa & PG_FRAME;
-	va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
-	    (offset * PAGE_SIZE);
-	data = (void *)(va + off);
-	length -= PAGE_SIZE;
-	while (length > 0) {
-		va += PAGE_SIZE;
-		pa += PAGE_SIZE;
-		length -= PAGE_SIZE;
-		pmap_kenter(va, pa);
-		invlpg(va);
-	}
-	return (data);
-}
-
-static void
-madt_unmap(void *data, vm_offset_t length)
-{
-	vm_offset_t va, off;
-
-	va = (vm_offset_t)data;
-	off = va & PAGE_MASK;
-	length = roundup(length + off, PAGE_SIZE);
-	va &= ~PAGE_MASK;
-	while (length > 0) {
-		pmap_kremove(va);
-		invlpg(va);
-		va += PAGE_SIZE;
-		length -= PAGE_SIZE;
-	}
-}
-
-static void *
-madt_map_table(vm_paddr_t pa, int offset, const char *sig)
-{
-	ACPI_TABLE_HEADER *header;
-	vm_offset_t length;
-	void *table;
-
-	header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
-	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
-		madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-		return (NULL);
-	}
-	length = header->Length;
-	madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
-	table = madt_map(pa, offset, length);

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

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 17:21:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDC8A106566B;
	Thu, 29 Oct 2009 17:21:41 +0000 (UTC)
	(envelope-from emaste@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD9F48FC18;
	Thu, 29 Oct 2009 17:21: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 n9THLfNm004664;
	Thu, 29 Oct 2009 17:21:41 GMT (envelope-from emaste@svn.freebsd.org)
Received: (from emaste@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9THLf6W004662;
	Thu, 29 Oct 2009 17:21:41 GMT (envelope-from emaste@svn.freebsd.org)
Message-Id: <200910291721.n9THLf6W004662@svn.freebsd.org>
From: Ed Maste 
Date: Thu, 29 Oct 2009 17:21: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: r198619 - head/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 17:21:41 -0000

Author: emaste
Date: Thu Oct 29 17:21:41 2009
New Revision: 198619
URL: http://svn.freebsd.org/changeset/base/198619

Log:
  Add additional featuresState.fBits entries to simplify compiling and
  testing Adaptec's vendor driver.
  
  Submitted by:	Adaptec, driver 17517

Modified:
  head/sys/sys/aac_ioctl.h

Modified: head/sys/sys/aac_ioctl.h
==============================================================================
--- head/sys/sys/aac_ioctl.h	Thu Oct 29 17:15:22 2009	(r198618)
+++ head/sys/sys/aac_ioctl.h	Thu Oct 29 17:21:41 2009	(r198619)
@@ -192,7 +192,10 @@ struct aac_query_disk {
 typedef union {
 	struct {
 		u_int32_t largeLBA  : 1;	/* disk support greater 2TB */
-		u_int32_t fReserved : 31;
+		u_int32_t IoctlBuf  : 1;	/* ARCIOCTL call support */
+		u_int32_t AIFSupport: 1;	/* AIF support */
+		u_int32_t JBODSupport:1;	/* fw + driver support JBOD */
+		u_int32_t fReserved : 28;
 	} fBits;
 	u_int32_t fValue;
 } featuresState;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 17:34:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 246F61065679;
	Thu, 29 Oct 2009 17:34: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 13F218FC0C;
	Thu, 29 Oct 2009 17:34: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 n9THY27E004989;
	Thu, 29 Oct 2009 17:34:02 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9THY2VT004987;
	Thu, 29 Oct 2009 17:34:02 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291734.n9THY2VT004987@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 17:34: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: r198620 - head/usr.bin/vmstat
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 17:34:03 -0000

Author: jhb
Date: Thu Oct 29 17:34:02 2009
New Revision: 198620
URL: http://svn.freebsd.org/changeset/base/198620

Log:
  When fetching sum stats (vmstat -s) from a crash dump, fetch per-CPU counts
  and sum them to form the total counts.
  
  PR:		bin/135893
  Submitted by:	Mikolaj Golub  to my trociny of gmail
  MFC after:	1 week

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

Modified: head/usr.bin/vmstat/vmstat.c
==============================================================================
--- head/usr.bin/vmstat/vmstat.c	Thu Oct 29 17:21:41 2009	(r198619)
+++ head/usr.bin/vmstat/vmstat.c	Thu Oct 29 17:34:02 2009	(r198620)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -418,10 +419,90 @@ getuptime(void)
 }
 
 static void
+fill_pcpu(struct pcpu ***pcpup, int* maxcpup)
+{
+	struct pcpu **pcpu;
+	
+	int maxcpu, size, i;
+
+	*pcpup = NULL;
+	
+	if (kd == NULL)
+		return;
+
+	maxcpu = kvm_getmaxcpu(kd);
+	if (maxcpu < 0)
+		errx(1, "kvm_getmaxcpu: %s", kvm_geterr(kd));
+
+	pcpu = calloc(maxcpu, sizeof(struct pcpu *));
+	if (pcpu == NULL)
+		err(1, "calloc");
+
+	for (i = 0; i < maxcpu; i++) {
+		pcpu[i] = kvm_getpcpu(kd, i);
+		if (pcpu[i] == (struct pcpu *)-1)
+			errx(1, "kvm_getpcpu: %s", kvm_geterr(kd));
+	}
+
+	*maxcpup = maxcpu;
+	*pcpup = pcpu;
+}
+
+static void
+free_pcpu(struct pcpu **pcpu, int maxcpu)
+{
+	int i;
+
+	for (i = 0; i < maxcpu; i++)
+		free(pcpu[i]);
+	free(pcpu);
+}
+
+static void
 fill_vmmeter(struct vmmeter *vmmp)
 {
+	struct pcpu **pcpu;
+	int maxcpu, i;
+
 	if (kd != NULL) {
 		kread(X_SUM, vmmp, sizeof(*vmmp));
+		fill_pcpu(&pcpu, &maxcpu);
+		for (i = 0; i < maxcpu; i++) {
+			if (pcpu[i] == NULL)
+				continue;
+#define ADD_FROM_PCPU(i, name) \
+			vmmp->name += pcpu[i]->pc_cnt.name
+			ADD_FROM_PCPU(i, v_swtch);
+			ADD_FROM_PCPU(i, v_trap);
+			ADD_FROM_PCPU(i, v_syscall);
+			ADD_FROM_PCPU(i, v_intr);
+			ADD_FROM_PCPU(i, v_soft);
+			ADD_FROM_PCPU(i, v_vm_faults);
+			ADD_FROM_PCPU(i, v_cow_faults);
+			ADD_FROM_PCPU(i, v_cow_optim);
+			ADD_FROM_PCPU(i, v_zfod);
+			ADD_FROM_PCPU(i, v_ozfod);
+			ADD_FROM_PCPU(i, v_swapin);
+			ADD_FROM_PCPU(i, v_swapout);
+			ADD_FROM_PCPU(i, v_swappgsin);
+			ADD_FROM_PCPU(i, v_swappgsout);
+			ADD_FROM_PCPU(i, v_vnodein);
+			ADD_FROM_PCPU(i, v_vnodeout);
+			ADD_FROM_PCPU(i, v_vnodepgsin);
+			ADD_FROM_PCPU(i, v_vnodepgsout);
+			ADD_FROM_PCPU(i, v_intrans);
+			ADD_FROM_PCPU(i, v_tfree);
+			ADD_FROM_PCPU(i, v_forks);
+			ADD_FROM_PCPU(i, v_vforks);
+			ADD_FROM_PCPU(i, v_rforks);
+			ADD_FROM_PCPU(i, v_kthreads);
+			ADD_FROM_PCPU(i, v_forkpages);
+			ADD_FROM_PCPU(i, v_vforkpages);
+			ADD_FROM_PCPU(i, v_rforkpages);
+			ADD_FROM_PCPU(i, v_kthreadpages);
+#undef ADD_FROM_PCPU
+		}
+		free_pcpu(pcpu, maxcpu);
 	} else {
 		size_t size = sizeof(unsigned int);
 #define GET_VM_STATS(cat, name) \

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 17:40:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1D78106566C;
	Thu, 29 Oct 2009 17:40:33 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B69538FC1A;
	Thu, 29 Oct 2009 17:40: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 n9THeX54005158;
	Thu, 29 Oct 2009 17:40:33 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9THeXTs005156;
	Thu, 29 Oct 2009 17:40:33 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200910291740.n9THeXTs005156@svn.freebsd.org>
From: Michael Tuexen 
Date: Thu, 29 Oct 2009 17:40: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: r198621 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 17:40:34 -0000

Author: tuexen
Date: Thu Oct 29 17:40:33 2009
New Revision: 198621
URL: http://svn.freebsd.org/changeset/base/198621

Log:
  Improve round robin stream scheduler and cleanup some code.
  
  Approved by: rrs (mentor)
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Thu Oct 29 17:34:02 2009	(r198620)
+++ head/sys/netinet/sctp_output.c	Thu Oct 29 17:40:33 2009	(r198621)
@@ -5605,13 +5605,10 @@ sctp_insert_on_wheel(struct sctp_tcb *st
 	if (holds_lock == 0) {
 		SCTP_TCB_SEND_LOCK(stcb);
 	}
-	if ((strq->next_spoke.tqe_next) ||
-	    (strq->next_spoke.tqe_prev)) {
-		/* already on wheel */
-		goto outof_here;
+	if ((strq->next_spoke.tqe_next == NULL) &&
+	    (strq->next_spoke.tqe_prev == NULL)) {
+		TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke);
 	}
-	TAILQ_INSERT_TAIL(&asoc->out_wheel, strq, next_spoke);
-outof_here:
 	if (holds_lock == 0) {
 		SCTP_TCB_SEND_UNLOCK(stcb);
 	}
@@ -5624,19 +5621,26 @@ sctp_remove_from_wheel(struct sctp_tcb *
     int holds_lock)
 {
 	/* take off and then setup so we know it is not on the wheel */
-	if (holds_lock == 0)
+	if (holds_lock == 0) {
 		SCTP_TCB_SEND_LOCK(stcb);
-	if (TAILQ_FIRST(&strq->outqueue)) {
-		/* more was added */
-		if (holds_lock == 0)
-			SCTP_TCB_SEND_UNLOCK(stcb);
-		return;
 	}
-	TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
-	strq->next_spoke.tqe_next = NULL;
-	strq->next_spoke.tqe_prev = NULL;
-	if (holds_lock == 0)
+	if (TAILQ_EMPTY(&strq->outqueue)) {
+		if (asoc->last_out_stream == strq) {
+			asoc->last_out_stream = TAILQ_PREV(asoc->last_out_stream, sctpwheel_listhead, next_spoke);
+			if (asoc->last_out_stream == NULL) {
+				asoc->last_out_stream = TAILQ_LAST(&asoc->out_wheel, sctpwheel_listhead);
+			}
+			if (asoc->last_out_stream == strq) {
+				asoc->last_out_stream = NULL;
+			}
+		}
+		TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
+		strq->next_spoke.tqe_next = NULL;
+		strq->next_spoke.tqe_prev = NULL;
+	}
+	if (holds_lock == 0) {
 		SCTP_TCB_SEND_UNLOCK(stcb);
+	}
 }
 
 static void
@@ -7185,7 +7189,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb
     struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now)
 {
 	struct sctp_association *asoc;
-	struct sctp_stream_out *strq, *strqn, *strqt;
+	struct sctp_stream_out *strq, *strqn;
 	int goal_mtu, moved_how_much, total_moved = 0, bail = 0;
 	int locked, giveup;
 	struct sctp_stream_queue_pending *sp;
@@ -7261,11 +7265,10 @@ sctp_fill_outqueue(struct sctp_tcb *stcb
 				break;
 		} else {
 			asoc->locked_on_sending = NULL;
-			strqt = sctp_select_a_stream(stcb, asoc);
-			if (TAILQ_FIRST(&strq->outqueue) == NULL) {
+			if (TAILQ_EMPTY(&strq->outqueue)) {
 				if (strq == strqn) {
 					/* Must move start to next one */
-					strqn = TAILQ_NEXT(asoc->last_out_stream, next_spoke);
+					strqn = TAILQ_NEXT(strq, next_spoke);
 					if (strqn == NULL) {
 						strqn = TAILQ_FIRST(&asoc->out_wheel);
 						if (strqn == NULL) {
@@ -7278,7 +7281,7 @@ sctp_fill_outqueue(struct sctp_tcb *stcb
 			if ((giveup) || bail) {
 				break;
 			}
-			strq = strqt;
+			strq = sctp_select_a_stream(stcb, asoc);
 			if (strq == NULL) {
 				break;
 			}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 18:03:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 913B31065670;
	Thu, 29 Oct 2009 18:03:16 +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 7FB9B8FC0C;
	Thu, 29 Oct 2009 18:03: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 n9TI3GXe005659;
	Thu, 29 Oct 2009 18:03:16 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TI3GXQ005657;
	Thu, 29 Oct 2009 18:03:16 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910291803.n9TI3GXQ005657@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 29 Oct 2009 18:03: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: r198622 - head/sys/dev/acpi_support
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 18:03:16 -0000

Author: jhb
Date: Thu Oct 29 18:03:16 2009
New Revision: 198622
URL: http://svn.freebsd.org/changeset/base/198622

Log:
  - Numerous whitespace and style fixes.
  - More descriptive error messages when failing to parse components during
    attach.

Modified:
  head/sys/dev/acpi_support/acpi_aiboost.c

Modified: head/sys/dev/acpi_support/acpi_aiboost.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_aiboost.c	Thu Oct 29 17:40:33 2009	(r198621)
+++ head/sys/dev/acpi_support/acpi_aiboost.c	Thu Oct 29 18:03:16 2009	(r198622)
@@ -41,23 +41,25 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#define _COMPONENT	ACPI_OEM
+#define	_COMPONENT	ACPI_OEM
 ACPI_MODULE_NAME("AIBOOST")
 
-#define DESCSTRLEN 32
-struct acpi_aiboost_element{
+#define	DESCSTRLEN	32
+
+struct acpi_aiboost_element {
 	uint32_t id;
-	char desc[DESCSTRLEN];
+	char	desc[DESCSTRLEN];
 };
+
 ACPI_SERIAL_DECL(aiboost, "ACPI AIBOOST");
-/**/
-struct acpi_aiboost_component{
-	unsigned int num;
-	struct acpi_aiboost_element elem[1];
+
+struct acpi_aiboost_component {
+	u_int	num;
+	struct acpi_aiboost_element elem[0];
 };
 
 struct acpi_aiboost_softc {
-	int pid;
+	int	pid;
 	struct acpi_aiboost_component *temp;
 	struct acpi_aiboost_component *volt;
 	struct acpi_aiboost_component *fan;
@@ -65,7 +67,7 @@ struct acpi_aiboost_softc {
 
 static int	acpi_aiboost_probe(device_t dev);
 static int	acpi_aiboost_attach(device_t dev);
-static int 	acpi_aiboost_detach(device_t dev);
+static int	acpi_aiboost_detach(device_t dev);
 
 static device_method_t acpi_aiboost_methods[] = {
 	/* Device interface */
@@ -85,46 +87,56 @@ static driver_t	acpi_aiboost_driver = {
 static devclass_t acpi_aiboost_devclass;
 
 DRIVER_MODULE(acpi_aiboost, acpi, acpi_aiboost_driver, acpi_aiboost_devclass,
-	      0, 0);
+    0, 0);
 MODULE_DEPEND(acpi_aiboost, acpi, 1, 1, 1);
+
 static char    *abs_id[] = {"ATK0110", NULL};
 
-/*VSIF, RVLT, SVLT,  TSIF, RTMP, STMP FSIF, RFAN, SFAN */
+/* VSIF, RVLT, SVLT, TSIF, RTMP, STMP, FSIF, RFAN, SFAN */
 
-static ACPI_STATUS acpi_aiboost_getcomponent(device_t dev, char *name, struct  acpi_aiboost_component **comp)
+static ACPI_STATUS
+acpi_aiboost_getcomponent(device_t dev, char *name,
+    struct acpi_aiboost_component **comp)
 {
-	ACPI_BUFFER		buf, buf2;
-	ACPI_OBJECT            *o,*elem,*subobj;
+	ACPI_BUFFER buf, buf2;
+	ACPI_OBJECT *elem, *o, *subobj;
 	ACPI_STATUS status;
-	struct acpi_aiboost_component *c = NULL;
-
+	struct acpi_aiboost_component *c;
 	int i;
 
+	c = NULL;
 	buf.Pointer = NULL;
 	buf.Length = ACPI_ALLOCATE_BUFFER;
 	buf2.Pointer = NULL;
-
 	status = AcpiEvaluateObject(acpi_get_handle(dev), name, NULL, &buf);
-	
-	if(ACPI_FAILURE(status))
-		return status;
-	
+
+	if (ACPI_FAILURE(status))
+		return (status);
+
 	o = buf.Pointer;
-	if(o->Type != ACPI_TYPE_PACKAGE)
+	if (o->Type != ACPI_TYPE_PACKAGE) {
+		device_printf(dev, "%s is not a package\n", name);
 		goto error;
-	
+	}
+
 	elem = o->Package.Elements;
-	if(elem->Type != ACPI_TYPE_INTEGER)
+	if (elem->Type != ACPI_TYPE_INTEGER) {
+		device_printf(dev, "First item in %s is not a count\n", name);
 		goto error;
+	}
 
-	c = malloc(sizeof(struct acpi_aiboost_component)
-		   + sizeof(struct acpi_aiboost_element)
-		   * (elem->Integer.Value -1),
-		   M_DEVBUF, M_ZERO|M_WAITOK);
+	if (elem->Integer.Value != o->Package.Count - 1) {
+		device_printf(dev, "Device count mismatch in %s\n", name);
+		goto error;
+	}
+
+	c = malloc(sizeof(struct acpi_aiboost_component) +
+	    sizeof(struct acpi_aiboost_element) * elem->Integer.Value, M_DEVBUF,
+	    M_WAITOK | M_ZERO);
 	*comp = c;
 	c->num = elem->Integer.Value;
-	
-	for(i = 1 ; i < o->Package.Count; i++){
+
+	for (i = 1; i < o->Package.Count; i++) {
 		elem = &o->Package.Elements[i];
 		if (elem->Type == ACPI_TYPE_ANY) {
 			buf2.Pointer = NULL;
@@ -132,196 +144,195 @@ static ACPI_STATUS acpi_aiboost_getcompo
 
 			status = AcpiEvaluateObject(elem->Reference.Handle,
 			    NULL, NULL, &buf2);
-			if (ACPI_FAILURE(status)){
-				printf("FETCH OBJECT\n");
+			if (ACPI_FAILURE(status)) {
+				device_printf(dev,
+				    "Failed to fetch object for %s\n", name);
 				goto error;
 			}
 			subobj = buf2.Pointer;
 		} else if (elem->Type == ACPI_TYPE_PACKAGE)
 			subobj = elem;
 		else {
-			printf("NO PACKAGE\n");
+			device_printf(dev,
+			    "Subitem %d was not a package for %s\n", i, name);
 			goto error;
 		}
-		if(ACPI_FAILURE(acpi_PkgInt32(subobj,0, &c->elem[i -1].id))){
-			printf("ID FAILED\n");
+		status = acpi_PkgInt32(subobj, 0, &c->elem[i - 1].id);
+		if (ACPI_FAILURE(status)) {
+			device_printf(dev,
+			    "Failed to fetch ID for subobject %d in %s\n", i,
+			    name);
 			goto error;
 		}
-		status = acpi_PkgStr(subobj, 1, c->elem[i - 1].desc, 
-				     sizeof(c->elem[i - 1].desc));
-		if(ACPI_FAILURE(status)){
-			if(status == E2BIG){
+		status = acpi_PkgStr(subobj, 1, c->elem[i - 1].desc,
+		    sizeof(c->elem[i - 1].desc));
+		if (ACPI_FAILURE(status)){
+			if (status == E2BIG) {
 				c->elem[i - 1].desc[DESCSTRLEN-1] = 0;
-			}else{
-				printf("DESC FAILED %d\n", i-1);
+			} else {
+				device_printf(dev,
+		    "Failed to fetch description for subobject %d in %s\n",
+				    i, name);
 				goto error;
 			}
 		}
-		
+
 		if (buf2.Pointer) {
 			AcpiOsFree(buf2.Pointer);
 			buf2.Pointer = NULL;
 		}
 	}
 
-	if(buf.Pointer)
+	if (buf.Pointer)
 		AcpiOsFree(buf.Pointer);
 
-	return 0;
+	return (0);
 
- error:
-	printf("BAD DATA\n");
-	if(buf.Pointer)
+error:
+	if (buf.Pointer)
 		AcpiOsFree(buf.Pointer);
-	if(buf2.Pointer)
+	if (buf2.Pointer)
 		AcpiOsFree(buf2.Pointer);
-	if(c)
+	if (c)
 		free(c, M_DEVBUF);
-	return AE_BAD_DATA;
+	return (AE_BAD_DATA);
 }
 
-static int 
+static int
 acpi_aiboost_get_value(ACPI_HANDLE handle, char *path, UINT32 number)
 {
 	ACPI_OBJECT arg1, *ret;
 	ACPI_OBJECT_LIST args;
 	ACPI_BUFFER buf;
-	buf.Length = ACPI_ALLOCATE_BUFFER;
-	buf.Pointer = 0;
 	int val;
 
 	arg1.Type = ACPI_TYPE_INTEGER;
 	arg1.Integer.Value = number;
 	args.Count = 1;
 	args.Pointer = &arg1;
-
-	if(ACPI_FAILURE(AcpiEvaluateObject(handle, path, &args, &buf))){
-		return -1;
-	}
+	buf.Length = ACPI_ALLOCATE_BUFFER;
+	buf.Pointer = NULL;
+	if (ACPI_FAILURE(AcpiEvaluateObject(handle, path, &args, &buf)))
+		return (-1);
 
 	ret = buf.Pointer;
-	val = (ret->Type == ACPI_TYPE_INTEGER)? ret->Integer.Value : -1;
+	if (ret->Type == ACPI_TYPE_INTEGER)
+		val = ret->Integer.Value;
+	else
+		val = -1;
 
 	AcpiOsFree(buf.Pointer);
-	return val;
+	return (val);
 }
 
 
-static int acpi_aiboost_temp_sysctl(SYSCTL_HANDLER_ARGS)
+static int
+acpi_aiboost_temp_sysctl(SYSCTL_HANDLER_ARGS)
 {
-	device_t dev = arg1;
-	int function = oidp->oid_arg2;
-	int error = 0, val;
+	device_t dev;
+	int error, val;
+
+	dev = arg1;
 	ACPI_SERIAL_BEGIN(aiboost);
-	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RTMP",function );
-	error = sysctl_handle_int(oidp, &val, 0 , req);
+	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RTMP", arg2);
+	error = sysctl_handle_int(oidp, &val, 0, req);
 	ACPI_SERIAL_END(aiboost);
-	
-	return 0;
+	return (error);
 }
 
-static int acpi_aiboost_volt_sysctl(SYSCTL_HANDLER_ARGS)
+static int
+acpi_aiboost_volt_sysctl(SYSCTL_HANDLER_ARGS)
 {
-	device_t dev = arg1;
-	int function = oidp->oid_arg2;
-	int error = 0, val;
+	device_t dev;
+	int error, val;
+
+	dev = arg1;
 	ACPI_SERIAL_BEGIN(aiboost);
-	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RVLT", function);
-	error = sysctl_handle_int(oidp, &val, 0 , req);
+	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RVLT", arg2);
+	error = sysctl_handle_int(oidp, &val, 0, req);
 	ACPI_SERIAL_END(aiboost);
-	
-	return 0;
+	return (error);
 }
 
-static int acpi_aiboost_fan_sysctl(SYSCTL_HANDLER_ARGS)
+static int
+acpi_aiboost_fan_sysctl(SYSCTL_HANDLER_ARGS)
 {
-	device_t dev = arg1;
-	int function = oidp->oid_arg2;
-	int error = 0, val;
+	device_t dev;
+	int error, val;
+
+	dev = arg1;
 	ACPI_SERIAL_BEGIN(aiboost);
-	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RFAN", function);
-	error = sysctl_handle_int(oidp, &val, 0 , req);
+	val = acpi_aiboost_get_value(acpi_get_handle(dev), "RFAN", arg2);
+	error = sysctl_handle_int(oidp, &val, 0, req);
 	ACPI_SERIAL_END(aiboost);
-	
-	return 0;
+	return (error);
 }
 
 static int
 acpi_aiboost_probe(device_t dev)
 {
-	int		ret = ENXIO;
 
-	if (ACPI_ID_PROBE(device_get_parent(dev), dev, abs_id)) {
-		device_set_desc(dev, "ASUStek AIBOOSTER");
-		ret = 0;
-	}
-	return (ret);
+	if (ACPI_ID_PROBE(device_get_parent(dev), dev, abs_id) == NULL)
+		return (ENXIO);
+
+	device_set_desc(dev, "ASUStek AIBOOSTER");
+	return (0);
 }
 
 static int
 acpi_aiboost_attach(device_t dev)
 {
 	struct acpi_aiboost_softc *sc;
-	char nambuf[]="tempXXX";
+	char nambuf[16];
 	int i;
 
 	sc = device_get_softc(dev);
-	if(ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "TSIF", &sc->temp)))
+	if (ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "TSIF", &sc->temp)))
 		goto error;
-	for(i= 0; i < sc->temp->num; i++){
-		sprintf(nambuf,"temp%d", i);
+	for (i = 0; i < sc->temp->num; i++) {
+		snprintf(nambuf, sizeof(nambuf), "temp%d", i);
 		SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-				SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-				OID_AUTO, nambuf,
-				CTLTYPE_INT|CTLFLAG_RD, dev, 
-				sc->temp->elem[i].id,
-				acpi_aiboost_temp_sysctl,
-				"I", sc->temp->elem[i].desc);
+		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+		    nambuf, CTLTYPE_INT | CTLFLAG_RD, dev, sc->temp->elem[i].id,
+		    acpi_aiboost_temp_sysctl, "I", sc->temp->elem[i].desc);
 	}
-	if(ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "VSIF", &sc->volt)))
-		goto error;
 
-	for(i= 0; i < sc->volt->num; i++){
-		sprintf(nambuf,"volt%d", i);
+	if (ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "VSIF", &sc->volt)))
+		goto error;
+	for (i = 0; i < sc->volt->num; i++) {
+		snprintf(nambuf, sizeof(nambuf), "volt%d", i);
 		SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-				SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-				OID_AUTO, nambuf,
-				CTLTYPE_INT|CTLFLAG_RD, dev, 
-				sc->volt->elem[i].id,
-				acpi_aiboost_volt_sysctl,
-				"I", sc->volt->elem[i].desc);
+		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+		    nambuf, CTLTYPE_INT | CTLFLAG_RD, dev, sc->volt->elem[i].id,
+		    acpi_aiboost_volt_sysctl, "I", sc->volt->elem[i].desc);
 	}
 
-	if(ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "FSIF", &sc->fan)))
+	if (ACPI_FAILURE(acpi_aiboost_getcomponent(dev, "FSIF", &sc->fan)))
 		goto error;
-
-	for(i= 0; i < sc->fan->num; i++){
-		sprintf(nambuf,"fan%d", i);
+	for (i = 0; i < sc->fan->num; i++) {
+		snprintf(nambuf, sizeof(nambuf), "fan%d", i);
 		SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-				SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-				OID_AUTO, nambuf,
-				CTLTYPE_INT|CTLFLAG_RD, dev, 
-				sc->fan->elem[i].id,
-				acpi_aiboost_fan_sysctl,
-				"I", sc->fan->elem[i].desc);
+		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+		    nambuf, CTLTYPE_INT | CTLFLAG_RD, dev, sc->fan->elem[i].id,
+		    acpi_aiboost_fan_sysctl, "I", sc->fan->elem[i].desc);
 	}
 
-	
 	return (0);
  error:
-	return EINVAL;
+	return (EINVAL);
 }
 
-static int 
+static int
 acpi_aiboost_detach(device_t dev)
 {
-	struct acpi_aiboost_softc *sc = device_get_softc(dev);
+	struct acpi_aiboost_softc *sc;
 
-	if(sc->temp)
+	sc = device_get_softc(dev);
+	if (sc->temp)
 		free(sc->temp, M_DEVBUF);
-	if(sc->volt)
+	if (sc->volt)
 		free(sc->volt, M_DEVBUF);
-	if(sc->fan)
+	if (sc->fan)
 		free(sc->fan, M_DEVBUF);
 	return (0);
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 18:32:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6745D106568D;
	Thu, 29 Oct 2009 18:32:40 +0000 (UTC)
	(envelope-from peterjeremy@acm.org)
Received: from mail16.syd.optusnet.com.au (mail16.syd.optusnet.com.au
	[211.29.132.197])
	by mx1.freebsd.org (Postfix) with ESMTP id EBB738FC12;
	Thu, 29 Oct 2009 18:32:39 +0000 (UTC)
Received: from server.vk2pj.dyndns.org
	(c122-106-233-13.belrs3.nsw.optusnet.com.au [122.106.233.13])
	by mail16.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n9TIWa1g026063
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Oct 2009 05:32:37 +1100
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n9TIWaGp009499;
	Fri, 30 Oct 2009 05:32:36 +1100 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n9TIWabX009498;
	Fri, 30 Oct 2009 05:32:36 +1100 (EST) (envelope-from peter)
Date: Fri, 30 Oct 2009 05:32:36 +1100
From: Peter Jeremy 
To: Alexander Motin 
Message-ID: <20091029183236.GA9461@server.vk2pj.dyndns.org>
References: <200910261035.n9QAZHGR084488@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="gKMricLos+KVdGMg"
Content-Disposition: inline
In-Reply-To: <200910261035.n9QAZHGR084488@svn.freebsd.org>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
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: r198483 - head/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 18:32:40 -0000


--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2009-Oct-26 10:35:17 +0000, Alexander Motin  wrote:
>Log:
>  Document new modularised ATA kernel options.

IMO, these either need a bit more documentation because there are
non-intuitive interdependencies, or some of the dependencies need to
be pruned.  Eg a kernel with:

device          atadisk         # ATA disk drives
device          atapicd         # ATAPI CDROM drives
options         ATA_STATIC_ID   # Static device numbering
device          atacore         # Core ATA functionality
device          atapci          # PCI bus support; only generic chipset sup=
port
device          ataahci         # AHCI SATA
device          ataati          # ATI

blows up whilst linking with:
linking kernel.debug
ata-ati.o(.text+0xe5): In function `ata_ati_probe':
/tank/src9/sys/dev/ata/chipsets/ata-ati.c:110: undefined reference to `ata_=
sii_chipinit'
*** Error code 1

--=20
Peter Jeremy

--gKMricLos+KVdGMg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iEYEARECAAYFAkrp38QACgkQ/opHv/APuIfIBQCdE4I/QWhBkD1xh4SVnd/xrZ7H
NTMAnREoJLdyKFDVKrSPI46jA3FJNA6m
=itnk
-----END PGP SIGNATURE-----

--gKMricLos+KVdGMg--

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 19:42:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7630F1065676;
	Thu, 29 Oct 2009 19:42:28 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153])
	by mx1.freebsd.org (Postfix) with ESMTP id AC0948FC0C;
	Thu, 29 Oct 2009 19:42:27 +0000 (UTC)
Received: by fg-out-1718.google.com with SMTP id 16so2258575fgg.13
	for ; Thu, 29 Oct 2009 12:42:26 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:x-enigmail-version:content-type:content-transfer-encoding;
	bh=VsNiksbKJdEnQRS9zEWgAAqubDk91IWg7NWASgcB9Mg=;
	b=P3EvduuiTbTtr6+xbaaWB3yMdxVlJrHS87bvLlVJubmyxZfRQpgapLdeqbA+b0nrgi
	mSJhbO+NET3znr010OTCSBs7TupaA+Kn6YqWSh94cssU3Gm9GajEmT1BapSlM02e6Uiu
	oAXl8wUTfX1i+gbO39vS97Cd4PSE8QnsnvEC4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	b=Ysk0j/DBX9ox/nL78nqnWyoYQ8ihsYx1wfeORvMaqmHnU77Jj4O5F1UQArI2BN4059
	/J5iB5cbaCcg3ap4sa1wmCwRtjTUvu6mUjLR6fJFxpn6Xs48QCY16MZyXu6mPidKqYRM
	UANcr8UWNaLxtCC7CTVHdbzXUhkjrN6T3Gsus=
Received: by 10.103.126.27 with SMTP id d27mr213550mun.56.1256845346571;
	Thu, 29 Oct 2009 12:42:26 -0700 (PDT)
Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226])
	by mx.google.com with ESMTPS id t10sm1586935muh.13.2009.10.29.12.42.24
	(version=SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 12:42:25 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4AE9F01E.7010309@FreeBSD.org>
Date: Thu, 29 Oct 2009 21:42:22 +0200
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.23 (X11/20090901)
MIME-Version: 1.0
To: Peter Jeremy 
References: <200910261035.n9QAZHGR084488@svn.freebsd.org>
	<20091029183236.GA9461@server.vk2pj.dyndns.org>
In-Reply-To: <20091029183236.GA9461@server.vk2pj.dyndns.org>
X-Enigmail-Version: 0.96.0
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r198483 - head/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 19:42:28 -0000

Peter Jeremy wrote:
> On 2009-Oct-26 10:35:17 +0000, Alexander Motin  wrote:
>> Log:
>>  Document new modularised ATA kernel options.
> 
> IMO, these either need a bit more documentation because there are
> non-intuitive interdependencies, or some of the dependencies need to
> be pruned.

I'll check dependencies. It is the right way.

-- 
Alexander Motin

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 20:53:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 10266106566B;
	Thu, 29 Oct 2009 20:53:27 +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 F3BEB8FC08;
	Thu, 29 Oct 2009 20:53: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 n9TKrQJN009241;
	Thu, 29 Oct 2009 20:53:26 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TKrQtC009239;
	Thu, 29 Oct 2009 20:53:26 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910292053.n9TKrQtC009239@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 29 Oct 2009 20:53: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: r198623 - head/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 20:53:27 -0000

Author: mav
Date: Thu Oct 29 20:53:26 2009
New Revision: 198623
URL: http://svn.freebsd.org/changeset/base/198623

Log:
  Add missing ATA kernel options dependencies.
  
  MFC after:	3 days

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Oct 29 18:03:16 2009	(r198622)
+++ head/sys/conf/files	Thu Oct 29 20:53:26 2009	(r198623)
@@ -520,14 +520,14 @@ dev/ata/chipsets/ata-highpoint.c	optiona
 dev/ata/chipsets/ata-intel.c	optional ata pci | ataintel
 dev/ata/chipsets/ata-ite.c	optional ata pci | ataite
 dev/ata/chipsets/ata-jmicron.c	optional ata pci | atajmicron
-dev/ata/chipsets/ata-marvell.c	optional ata pci | atamarvell
+dev/ata/chipsets/ata-marvell.c	optional ata pci | atamarvell | ataadaptec
 dev/ata/chipsets/ata-micron.c	optional ata pci | atamicron
 dev/ata/chipsets/ata-national.c	optional ata pci | atanational
 dev/ata/chipsets/ata-netcell.c	optional ata pci | atanetcell
 dev/ata/chipsets/ata-nvidia.c	optional ata pci | atanvidia
 dev/ata/chipsets/ata-promise.c	optional ata pci | atapromise
 dev/ata/chipsets/ata-serverworks.c	optional ata pci | ataserverworks
-dev/ata/chipsets/ata-siliconimage.c	optional ata pci | atasiliconimage
+dev/ata/chipsets/ata-siliconimage.c	optional ata pci | atasiliconimage | ataati
 dev/ata/chipsets/ata-sis.c	optional ata pci | atasis
 dev/ata/chipsets/ata-via.c	optional ata pci | atavia
 dev/ata/ata-disk.c		optional atadisk

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 21:13:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 96AFA106566B;
	Thu, 29 Oct 2009 21:13:57 +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 8504C8FC2E;
	Thu, 29 Oct 2009 21:13: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 n9TLDvwu009723;
	Thu, 29 Oct 2009 21:13:57 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TLDvJ1009721;
	Thu, 29 Oct 2009 21:13:57 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200910292113.n9TLDvJ1009721@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 29 Oct 2009 21:13:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198624 - stable/8/bin/sh
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 21:13:57 -0000

Author: jilles
Date: Thu Oct 29 21:13:57 2009
New Revision: 198624
URL: http://svn.freebsd.org/changeset/base/198624

Log:
  MFC r197371: Mention that NUL characters are not allowed in sh(1) input.
  
  I do not consider this a bug because POSIX permits it and argument strings
  and environment variables cannot contain '\0' anyway.
  
  PR:		bin/25542

Modified:
  stable/8/bin/sh/   (props changed)
  stable/8/bin/sh/sh.1

Modified: stable/8/bin/sh/sh.1
==============================================================================
--- stable/8/bin/sh/sh.1	Thu Oct 29 20:53:26 2009	(r198623)
+++ stable/8/bin/sh/sh.1	Thu Oct 29 21:13:57 2009	(r198624)
@@ -375,6 +375,10 @@ introduces a comment if used at the begi
 The word starting with
 .Ql #
 and the rest of the line are ignored.
+.Pp
+.Tn ASCII
+.Dv NUL
+characters (character code 0) are not allowed in shell input.
 .Ss Quoting
 Quoting is used to remove the special meaning of certain characters
 or words to the shell, such as operators, whitespace, keywords,

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 21:25:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 718DC106568D;
	Thu, 29 Oct 2009 21:25:16 +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 5FFB08FC16;
	Thu, 29 Oct 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 n9TLPGBh010441;
	Thu, 29 Oct 2009 21:25:16 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TLPGGY010439;
	Thu, 29 Oct 2009 21:25:16 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200910292125.n9TLPGGY010439@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 29 Oct 2009 21:25:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198628 - stable/8/usr.bin/find
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 21:25:16 -0000

Author: jilles
Date: Thu Oct 29 21:25:16 2009
New Revision: 198628
URL: http://svn.freebsd.org/changeset/base/198628

Log:
  MFC r197363: Update find(1) man page for -L/-delete interaction.
  
  It is a bit unfortunate that the example to delete broken symlinks now uses
  rm(1), but allowing this with -delete would require fixing fts(3) to not
  imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).
  
  PR:		bin/90687

Modified:
  stable/8/usr.bin/find/   (props changed)
  stable/8/usr.bin/find/find.1

Modified: stable/8/usr.bin/find/find.1
==============================================================================
--- stable/8/usr.bin/find/find.1	Thu Oct 29 21:23:44 2009	(r198627)
+++ stable/8/usr.bin/find/find.1	Thu Oct 29 21:25:16 2009	(r198628)
@@ -312,6 +312,7 @@ character in its pathname relative to
 .Dq Pa \&.
 for security reasons.
 Depth-first traversal processing is implied by this option.
+Following symlinks is incompatible with this option.
 .It Ic -depth
 Always true;
 same as the
@@ -920,7 +921,7 @@ recent than the current time minus one m
 Use the
 .Xr echo 1
 command to print out a list of all the files.
-.It Li "find -L /usr/ports/packages -type l -delete"
+.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +"
 Delete all broken symbolic links in
 .Pa /usr/ports/packages .
 .It Li "find /usr/src -name CVS -prune -o -depth +6 -print"

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:08:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 822901065670;
	Thu, 29 Oct 2009 23:08:13 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr
	[150.140.141.169])
	by mx1.freebsd.org (Postfix) with ESMTP id E09958FC19;
	Thu, 29 Oct 2009 23:08:12 +0000 (UTC)
Received: from mail.ceid.upatras.gr (unknown [10.1.0.143])
	by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 02009EB4760;
	Fri, 30 Oct 2009 01:08:11 +0200 (EET)
Received: from localhost (europa.ceid.upatras.gr [127.0.0.1])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id B25B3451BC;
	Fri, 30 Oct 2009 01:08:11 +0200 (EET)
X-Virus-Scanned: amavisd-new at ceid.upatras.gr
Received: from mail.ceid.upatras.gr ([127.0.0.1])
	by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id DQBWbQ-d6syL; Fri, 30 Oct 2009 01:08:11 +0200 (EET)
Received: from kobe.laptop (ppp-94-64-196-111.home.otenet.gr [94.64.196.111])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id 5F92B451B2;
	Fri, 30 Oct 2009 01:08:11 +0200 (EET)
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9TN8AgA003267
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Oct 2009 01:08:10 +0200 (EET)
	(envelope-from keramida@freebsd.org)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.3/8.14.3/Submit) id n9TN89r2003266;
	Fri, 30 Oct 2009 01:08:09 +0200 (EET)
	(envelope-from keramida@freebsd.org)
From: Giorgos Keramidas 
To: Konstantin Belousov 
References: <200910291434.n9TEYOVJ099388@svn.freebsd.org>
Date: Fri, 30 Oct 2009 01:08:08 +0200
In-Reply-To: <200910291434.n9TEYOVJ099388@svn.freebsd.org> (Konstantin
	Belousov's message of "Thu, 29 Oct 2009 14:34:24 +0000 (UTC)")
Message-ID: <871vklbxyf.fsf@kobe.laptop>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r198590 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:08:13 -0000

On Thu, 29 Oct 2009 14:34:24 +0000 (UTC), Konstantin Belousov  wrote:
> Author: kib
> Date: Thu Oct 29 14:34:24 2009
> New Revision: 198590
> URL: http://svn.freebsd.org/changeset/base/198590
>
> Log:
>   Trapsignal() calls kern_sigprocmask() when delivering catched signal
>   with proc lock held.
>
>   Reported and tested by:	Mykola Dzham  freebsd at levsha org ua
>   MFC after:	1 month

Hi Konstantin,

Some of the recent kern_sig changes end up recursing on a non-recursive
mutex in kern_sigprocmask() -> reschedule_signals():

panic: _mtx_lock_sleep: recursed on non-recursive mutex sigacts @ /usr/src/sys/kern/kern_sig.c:2422
(kgdb) bt
#0  doadump () at pcpu.h:246
#1  0xc0680bee in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:416
#2  0xc0680ec2 in panic (fmt=Variable "fmt" is not available.
    ) at /usr/src/sys/kern/kern_shutdown.c:579
#3  0xc06716ea in _mtx_lock_sleep (m=0xc8154aa8, tid=3332925072, opts=0, file=0xc09bb332 "/usr/src/sys/kern/kern_sig.c", line=2422)
    at /usr/src/sys/kern/kern_mutex.c:341
#4  0xc0671907 in _mtx_lock_flags (m=0xc8154aa8, opts=0, file=0xc09bb332 "/usr/src/sys/kern/kern_sig.c", line=2422)
    at /usr/src/sys/kern/kern_mutex.c:203
#5  0xc0683434 in reschedule_signals (p=0xc71172a8, block={__bits = {0, 0, 0, 0}}) at /usr/src/sys/kern/kern_sig.c:2422
#6  0xc0683751 in kern_sigprocmask (td=0xc6a86690, how=1, set=0xe9005cd4, oset=0x0, flags=2) at /usr/src/sys/kern/kern_sig.c:1027
#7  0xc0684801 in postsig (sig=20) at /usr/src/sys/kern/kern_sig.c:2743
#8  0xc06be228 in ast (framep=0xe9005d38) at /usr/src/sys/kern/subr_trap.c:234
#9  0xc0920624 in doreti_ast () at /usr/src/sys/i386/i386/exception.s:365

I think the change that started causing this for MT applications was
change 197963 in /head that added this bit of code in kern_sig.c inside
kern_sigprocmask():

: @@ -1012,7 +1012,20 @@
:                          break;
:                  }
:          }
: -        PROC_UNLOCK(td->td_proc);
: +        /*
: +         * The new_block set contains signals that were not previosly
: +         * blocked, but are blocked now.
: +         *
: +         * In case we block any signal that was not previously blocked
: +         * for td, and process has the signal pending, try to schedule
: +         * signal delivery to some thread that does not block the signal,
: +         * possibly waking it up.
: +         */
: +        if (p->p_numthreads != 1)
: +                reschedule_signals(p, new_block);
: +
: +        PROC_UNLOCK(p);
:          return (error);

AFAICT, postsig() is called with proc->p_sigacts->ps_mtx locked, so when
we are recursing when reschedule_signals() tries to lock it once more.

Since we are holding the proc lock in kern_sigprocmask(), is it safe to
assert that we own ps_mtx, drop it and re-acquire it immediately after
calling reschedule_signals()?


From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:09:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0925D1065670;
	Thu, 29 Oct 2009 23:09:03 +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 E87348FC15;
	Thu, 29 Oct 2009 23:09: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 n9TN92U4013618;
	Thu, 29 Oct 2009 23:09:02 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TN92NC013616;
	Thu, 29 Oct 2009 23:09:02 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292309.n9TN92NC013616@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:09:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198630 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:09:03 -0000

Author: thompsa
Date: Thu Oct 29 23:09:02 2009
New Revision: 198630
URL: http://svn.freebsd.org/changeset/base/198630

Log:
  MFC r196488
  
   - allow disabling "root_mount_hold()" by setting a sysctl/tunable at boot
   - remove some redundant initial explore code

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/controller/usb_controller.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c	Thu Oct 29 21:30:21 2009	(r198629)
+++ stable/8/sys/dev/usb/controller/usb_controller.c	Thu Oct 29 23:09:02 2009	(r198630)
@@ -67,7 +67,6 @@ static device_attach_t usb_attach;
 static device_detach_t usb_detach;
 
 static void	usb_attach_sub(device_t, struct usb_bus *);
-static void	usb_post_init(void *);
 
 /* static variables */
 
@@ -84,8 +83,6 @@ TUNABLE_INT("hw.usb.no_boot_wait", &usb_
 SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0,
     "No device enumerate waiting at boot.");
 
-static uint8_t usb_post_init_called = 0;
-
 static devclass_t usb_devclass;
 
 static device_method_t usb_methods[] = {
@@ -142,12 +139,8 @@ usb_attach(device_t dev)
 		bus->bus_roothold = root_mount_hold(device_get_nameunit(dev));
 	}
 
-	if (usb_post_init_called) {
-		mtx_lock(&Giant);
-		usb_attach_sub(dev, bus);
-		mtx_unlock(&Giant);
-		usb_needs_explore(bus, 1);
-	}
+	usb_attach_sub(dev, bus);
+
 	return (0);			/* return success */
 }
 
@@ -226,22 +219,24 @@ usb_bus_explore(struct usb_proc_msg *pm)
 			/* avoid zero, hence that is memory default */
 			bus->driver_added_refcount = 1;
 		}
-		USB_BUS_UNLOCK(bus);
 
-		mtx_lock(&Giant);
+		/*
+		 * The following three lines of code are only here to
+		 * recover from DDB:
+		 */
+		usb_proc_rewakeup(&bus->control_xfer_proc);
+		usb_proc_rewakeup(&bus->giant_callback_proc);
+		usb_proc_rewakeup(&bus->non_giant_callback_proc);
+
+		USB_BUS_UNLOCK(bus);
 
 		/*
 		 * First update the USB power state!
 		 */
 		usb_bus_powerd(bus);
-		/*
-		 * Explore the Root USB HUB. This call can sleep,
-		 * exiting Giant, which is actually Giant.
-		 */
-		(udev->hub->explore) (udev);
-
-		mtx_unlock(&Giant);
 
+		 /* Explore the Root USB HUB. */
+		(udev->hub->explore) (udev);
 		USB_BUS_LOCK(bus);
 	}
 	if (bus->bus_roothold != NULL) {
@@ -269,10 +264,10 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	device_set_softc(dev, NULL);
 	USB_BUS_UNLOCK(bus);
 
-	mtx_lock(&Giant);
-
 	/* detach children first */
+	mtx_lock(&Giant);
 	bus_generic_detach(dev);
+	mtx_unlock(&Giant);
 
 	/*
 	 * Free USB Root device, but not any sub-devices, hence they
@@ -281,7 +276,6 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	usb_free_device(udev,
 	    USB_UNCFG_FLAG_FREE_EP0);
 
-	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 	/* clear bdev variable last */
 	bus->bdev = NULL;
@@ -297,6 +291,12 @@ usb_power_wdog(void *arg)
 	usb_callout_reset(&bus->power_wdog,
 	    4 * hz, usb_power_wdog, arg);
 
+	/*
+	 * The following line of code is only here to recover from
+	 * DDB:
+	 */
+	usb_proc_rewakeup(&bus->explore_proc);	/* recover from DDB */
+
 	USB_BUS_UNLOCK(bus);
 
 	usb_bus_power_update(bus);
@@ -350,7 +350,6 @@ usb_bus_attach(struct usb_proc_msg *pm)
 	}
 
 	USB_BUS_UNLOCK(bus);
-	mtx_lock(&Giant);		/* XXX not required by USB */
 
 	/* default power_mask value */
 	bus->hw_power_state =
@@ -383,7 +382,6 @@ usb_bus_attach(struct usb_proc_msg *pm)
 		err = USB_ERR_NOMEM;
 	}
 
-	mtx_unlock(&Giant);
 	USB_BUS_LOCK(bus);
 
 	if (err) {
@@ -401,17 +399,18 @@ usb_bus_attach(struct usb_proc_msg *pm)
 /*------------------------------------------------------------------------*
  *	usb_attach_sub
  *
- * This function creates a thread which runs the USB attach code. It
- * is factored out, hence it can be called at two different places in
- * time. During bootup this function is called from
- * "usb_post_init". During hot-plug it is called directly from the
- * "usb_attach()" method.
+ * This function creates a thread which runs the USB attach code.
  *------------------------------------------------------------------------*/
 static void
 usb_attach_sub(device_t dev, struct usb_bus *bus)
 {
 	const char *pname = device_get_nameunit(dev);
 
+	mtx_lock(&Giant);
+	if (usb_devclass_ptr == NULL)
+		usb_devclass_ptr = devclass_find("usbus");
+	mtx_unlock(&Giant);
+
 	/* Initialise USB process messages */
 	bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore;
 	bus->explore_msg[0].bus = bus;
@@ -454,55 +453,12 @@ usb_attach_sub(device_t dev, struct usb_
 			/* ignore */
 		}
 		USB_BUS_UNLOCK(bus);
-	}
-}
-
-/*------------------------------------------------------------------------*
- *	usb_post_init
- *
- * This function is called to attach all USB busses that were found
- * during bootup.
- *------------------------------------------------------------------------*/
-static void
-usb_post_init(void *arg)
-{
-	struct usb_bus *bus;
-	devclass_t dc;
-	device_t dev;
-	int max;
-	int n;
 
-	mtx_lock(&Giant);
-
-	usb_devclass_ptr = devclass_find("usbus");
-
-	dc = usb_devclass_ptr;
-	if (dc) {
-		max = devclass_get_maxunit(dc) + 1;
-		for (n = 0; n != max; n++) {
-			dev = devclass_get_device(dc, n);
-			if (dev && device_is_attached(dev)) {
-				bus = device_get_ivars(dev);
-				if (bus) {
-					mtx_lock(&Giant);
-					usb_attach_sub(dev, bus);
-					mtx_unlock(&Giant);
-				}
-			}
-		}
-	} else {
-		DPRINTFN(0, "no devclass\n");
+		/* Do initial explore */
+		usb_needs_explore(bus, 1);
 	}
-	usb_post_init_called = 1;
-
-	/* explore all USB busses in parallell */
-
-	usb_needs_explore_all();
-
-	mtx_unlock(&Giant);
 }
 
-SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL);
 SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL);
 
 /*------------------------------------------------------------------------*

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:09:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 75EE510656A7;
	Thu, 29 Oct 2009 23:09: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 484308FC23;
	Thu, 29 Oct 2009 23:09: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 n9TN9c1U013676;
	Thu, 29 Oct 2009 23:09:38 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TN9cCW013673;
	Thu, 29 Oct 2009 23:09:38 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292309.n9TN9cCW013673@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:09:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198631 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/misc dev/usb/storage dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:09:38 -0000

Author: thompsa
Date: Thu Oct 29 23:09:37 2009
New Revision: 198631
URL: http://svn.freebsd.org/changeset/base/198631

Log:
  MFC r196490
  
   - FIFO's are always opened separately in read and write direction even if the
     actual device is opened for read and write. Fix fflags check so that the UFM
     and URIO drivers work.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/misc/ufm.c
  stable/8/sys/dev/usb/storage/urio.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/misc/ufm.c
==============================================================================
--- stable/8/sys/dev/usb/misc/ufm.c	Thu Oct 29 23:09:02 2009	(r198630)
+++ stable/8/sys/dev/usb/misc/ufm.c	Thu Oct 29 23:09:37 2009	(r198631)
@@ -86,11 +86,9 @@ static device_attach_t ufm_attach;
 static device_detach_t ufm_detach;
 
 static usb_fifo_ioctl_t ufm_ioctl;
-static usb_fifo_open_t ufm_open;
 
 static struct usb_fifo_methods ufm_fifo_methods = {
 	.f_ioctl = &ufm_ioctl,
-	.f_open = &ufm_open,
 	.basename[0] = "ufm",
 };
 
@@ -179,15 +177,6 @@ ufm_detach(device_t dev)
 }
 
 static int
-ufm_open(struct usb_fifo *dev, int fflags)
-{
-	if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
-		return (EACCES);
-	}
-	return (0);
-}
-
-static int
 ufm_do_req(struct ufm_softc *sc, uint8_t request,
     uint16_t value, uint16_t index, uint8_t *retbuf)
 {
@@ -315,6 +304,10 @@ ufm_ioctl(struct usb_fifo *fifo, u_long 
 	struct ufm_softc *sc = usb_fifo_softc(fifo);
 	int error = 0;
 
+	if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
+		return (EACCES);
+	}
+
 	switch (cmd) {
 	case FM_SET_FREQ:
 		error = ufm_set_freq(sc, addr);

Modified: stable/8/sys/dev/usb/storage/urio.c
==============================================================================
--- stable/8/sys/dev/usb/storage/urio.c	Thu Oct 29 23:09:02 2009	(r198630)
+++ stable/8/sys/dev/usb/storage/urio.c	Thu Oct 29 23:09:37 2009	(r198631)
@@ -390,9 +390,6 @@ urio_open(struct usb_fifo *fifo, int ffl
 {
 	struct urio_softc *sc = usb_fifo_softc(fifo);
 
-	if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) {
-		return (EACCES);
-	}
 	if (fflags & FREAD) {
 		/* clear stall first */
 		mtx_lock(&sc->sc_mtx);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:10:12 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 076AD106566C;
	Thu, 29 Oct 2009 23:10:12 +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 E74358FC19;
	Thu, 29 Oct 2009 23:10: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 n9TNABeB013747;
	Thu, 29 Oct 2009 23:10:11 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNABh3013745;
	Thu, 29 Oct 2009 23:10:11 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292310.n9TNABh3013745@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:10:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198632 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:10:12 -0000

Author: thompsa
Date: Thu Oct 29 23:10:11 2009
New Revision: 198632
URL: http://svn.freebsd.org/changeset/base/198632

Log:
  MFC r196491
  
   We used force all of the GPIO pins low first and then
   enable the ones we want. This has been changed to better
   match the ADMtek's reference design to avoid setting the
   power-down configuration line of the PHY at the same time
   it is reset.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_aue.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_aue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_aue.c	Thu Oct 29 23:09:37 2009	(r198631)
+++ stable/8/sys/dev/usb/net/if_aue.c	Thu Oct 29 23:10:11 2009	(r198632)
@@ -484,7 +484,7 @@ aue_miibus_writereg(device_t dev, int ph
 	}
 
 	if (i == AUE_TIMEOUT)
-		device_printf(sc->sc_ue.ue_dev, "MII read timed out\n");
+		device_printf(sc->sc_ue.ue_dev, "MII write timed out\n");
 
 	if (!locked)
 		AUE_UNLOCK(sc);
@@ -603,11 +603,14 @@ aue_reset(struct aue_softc *sc)
 	 * to set the GPIO pins high so that the PHY(s) will
 	 * be enabled.
 	 *
-	 * Note: We force all of the GPIO pins low first, *then*
-	 * enable the ones we want.
+	 * NOTE: We used to force all of the GPIO pins low first and then
+	 * enable the ones we want. This has been changed to better
+	 * match the ADMtek's reference design to avoid setting the
+	 * power-down configuration line of the PHY at the same time
+	 * it is reset.
 	 */
-	aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_OUT0|AUE_GPIO_SEL0);
-	aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_OUT0|AUE_GPIO_SEL0|AUE_GPIO_SEL1);
+	aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_SEL0|AUE_GPIO_SEL1);
+	aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_SEL0|AUE_GPIO_SEL1|AUE_GPIO_OUT0);
 
 	if (sc->sc_flags & AUE_FLAG_LSYS) {
 		/* Grrr. LinkSys has to be different from everyone else. */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:10:42 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44237106568B;
	Thu, 29 Oct 2009 23:10:42 +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 2F94E8FC21;
	Thu, 29 Oct 2009 23:10: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 n9TNAgqn013806;
	Thu, 29 Oct 2009 23:10:42 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNAgT6013804;
	Thu, 29 Oct 2009 23:10:42 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292310.n9TNAgT6013804@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:10:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198633 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:10:42 -0000

Author: thompsa
Date: Thu Oct 29 23:10:41 2009
New Revision: 198633
URL: http://svn.freebsd.org/changeset/base/198633

Log:
  MFC r196492
  
   - fix CDC ethernet matching order so that the match flags get correct.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_cdce.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_cdce.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:10:11 2009	(r198632)
+++ stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:10:41 2009	(r198633)
@@ -197,9 +197,6 @@ static const struct usb_ether_methods cd
 };
 
 static const struct usb_device_id cdce_devs[] = {
-	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)},
-	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)},
-
 	{USB_VPI(USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632, CDCE_FLAG_NO_UNION)},
 	{USB_VPI(USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250, CDCE_FLAG_NO_UNION)},
 	{USB_VPI(USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX, CDCE_FLAG_NO_UNION)},
@@ -213,6 +210,9 @@ static const struct usb_device_id cdce_d
 	{USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)},
 	{USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)},
 	{USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)},
+
+	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)},
+	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)},
 };
 
 static int

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:11:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 471381065679;
	Thu, 29 Oct 2009 23:11:14 +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 329678FC21;
	Thu, 29 Oct 2009 23:11: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 n9TNBEK0013883;
	Thu, 29 Oct 2009 23:11:14 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNBEMd013880;
	Thu, 29 Oct 2009 23:11:14 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292311.n9TNBEMd013880@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:11:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198634 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:11:14 -0000

Author: thompsa
Date: Thu Oct 29 23:11:13 2009
New Revision: 198634
URL: http://svn.freebsd.org/changeset/base/198634

Log:
  MFC r196493
  
   - Fix false positive uipaq probe

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/uipaq.c
  stable/8/sys/dev/usb/usb.h
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uipaq.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uipaq.c	Thu Oct 29 23:10:41 2009	(r198633)
+++ stable/8/sys/dev/usb/serial/uipaq.c	Thu Oct 29 23:11:13 2009	(r198634)
@@ -1103,6 +1103,10 @@ uipaq_probe(device_t dev)
 	if (uaa->info.bIfaceIndex != UIPAQ_IFACE_INDEX) {
 		return (ENXIO);
 	}
+	if (uaa->info.bInterfaceClass == UICLASS_IAD) {
+		DPRINTF("IAD detected - not UIPAQ serial device\n");
+		return (ENXIO);
+	}
 	return (usbd_lookup_id_by_uaa(uipaq_devs, sizeof(uipaq_devs), uaa));
 }
 

Modified: stable/8/sys/dev/usb/usb.h
==============================================================================
--- stable/8/sys/dev/usb/usb.h	Thu Oct 29 23:10:41 2009	(r198633)
+++ stable/8/sys/dev/usb/usb.h	Thu Oct 29 23:11:13 2009	(r198634)
@@ -484,6 +484,8 @@ typedef struct usb_interface_assoc_descr
 #define	UISUBCLASS_RF			0x01
 #define	UIPROTO_BLUETOOTH		0x01
 
+#define	UICLASS_IAD		0xEF	/* Interface Association Descriptor */
+
 #define	UICLASS_APPL_SPEC	0xfe
 #define	UISUBCLASS_FIRMWARE_DOWNLOAD	1
 #define	UISUBCLASS_IRDA			2

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:11:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6395E106568D;
	Thu, 29 Oct 2009 23:11:48 +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 4F0128FC22;
	Thu, 29 Oct 2009 23:11: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 n9TNBmI8013940;
	Thu, 29 Oct 2009 23:11:48 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNBmEb013938;
	Thu, 29 Oct 2009 23:11:48 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292311.n9TNBmEb013938@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:11:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198635 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:11:48 -0000

Author: thompsa
Date: Thu Oct 29 23:11:48 2009
New Revision: 198635
URL: http://svn.freebsd.org/changeset/base/198635

Log:
  MFC r196494
  
   - fix uvisor support, mostly correct buffer sizes used.
   - correct device info flag for SONY Cli NR70V

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/uvisor.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uvisor.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uvisor.c	Thu Oct 29 23:11:13 2009	(r198634)
+++ stable/8/sys/dev/usb/serial/uvisor.c	Thu Oct 29 23:11:48 2009	(r198635)
@@ -95,7 +95,15 @@ SYSCTL_INT(_hw_usb_uvisor, OID_AUTO, deb
 
 #define	UVISOR_CONFIG_INDEX	0
 #define	UVISOR_IFACE_INDEX	0
-#define	UVISOR_BUFSIZE       1024	/* bytes */
+
+/*
+ * The following buffer sizes are hardcoded due to the way the Palm
+ * firmware works. It looks like the device is not short terminating
+ * the data transferred.
+ */
+#define	UVISORIBUFSIZE	       0	/* Use wMaxPacketSize */
+#define	UVISOROBUFSIZE	       32	/* bytes */
+#define	UVISOROFRAMES	       32	/* units */
 
 /* From the Linux driver */
 /*
@@ -208,7 +216,8 @@ static const struct usb_config uvisor_co
 		.type = UE_BULK,
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_OUT,
-		.bufsize = UVISOR_BUFSIZE,	/* bytes */
+		.bufsize = UVISOROBUFSIZE * UVISOROFRAMES,
+		.frames = UVISOROFRAMES,
 		.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
 		.callback = &uvisor_write_callback,
 	},
@@ -217,7 +226,7 @@ static const struct usb_config uvisor_co
 		.type = UE_BULK,
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
-		.bufsize = UVISOR_BUFSIZE,	/* bytes */
+		.bufsize = UVISORIBUFSIZE,
 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
 		.callback = &uvisor_read_callback,
 	},
@@ -270,7 +279,7 @@ static const struct usb_device_id uvisor
 	{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, UVISOR_FLAG_PALM4)},
+	{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)},
@@ -375,7 +384,6 @@ uvisor_init(struct uvisor_softc *sc, str
 	struct uvisor_connection_info coninfo;
 	struct uvisor_palm_connection_info pconinfo;
 	uint16_t actlen;
-	uWord wAvail;
 	uint8_t buffer[256];
 
 	if (sc->sc_flag & UVISOR_FLAG_VISOR) {
@@ -496,6 +504,9 @@ uvisor_init(struct uvisor_softc *sc, str
 			goto done;
 		}
 	}
+#if 0
+	uWord wAvail;
+
 	DPRINTF("getting available bytes\n");
 	req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
 	req.bRequest = UVISOR_REQUEST_BYTES_AVAILABLE;
@@ -507,6 +518,7 @@ uvisor_init(struct uvisor_softc *sc, str
 		goto done;
 	}
 	DPRINTF("avail=%d\n", UGETW(wAvail));
+#endif
 
 	DPRINTF("done\n");
 done:
@@ -579,19 +591,31 @@ uvisor_write_callback(struct usb_xfer *x
 	struct uvisor_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;
 	uint32_t actlen;
+	uint8_t x;
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_SETUP:
 	case USB_ST_TRANSFERRED:
 tr_setup:
-		pc = usbd_xfer_get_frame(xfer, 0);
-		if (ucom_get_data(&sc->sc_ucom, pc, 0,
-		    UVISOR_BUFSIZE, &actlen)) {
+		for (x = 0; x != UVISOROFRAMES; x++) {
+
+			usbd_xfer_set_frame_offset(xfer, 
+			    x * UVISOROBUFSIZE, x);
 
-			usbd_xfer_set_frame_len(xfer, 0, actlen);
+			pc = usbd_xfer_get_frame(xfer, x);
+			if (ucom_get_data(&sc->sc_ucom, pc, 0,
+			    UVISOROBUFSIZE, &actlen)) {
+				usbd_xfer_set_frame_len(xfer, x, actlen);
+			} else {
+				break;
+			}
+		}
+		/* check for data */
+		if (x != 0) {
+			usbd_xfer_set_frames(xfer, x);
 			usbd_transfer_submit(xfer);
 		}
-		return;
+		break;
 
 	default:			/* Error */
 		if (error != USB_ERR_CANCELLED) {
@@ -599,7 +623,7 @@ tr_setup:
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
 		}
-		return;
+		break;
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:12:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6AA2F1065695;
	Thu, 29 Oct 2009 23:12:30 +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 561158FC0C;
	Thu, 29 Oct 2009 23:12: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 n9TNCUF1014008;
	Thu, 29 Oct 2009 23:12:30 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNCUPY014005;
	Thu, 29 Oct 2009 23:12:30 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292312.n9TNCUPY014005@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:12:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198636 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/usb/storage dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:12:30 -0000

Author: thompsa
Date: Thu Oct 29 23:12:29 2009
New Revision: 198636
URL: http://svn.freebsd.org/changeset/base/198636

Log:
  MFC r196495
  
   Add mass storage quirks.
  
  PR:             usb/137138,usb/137226,usb/137789,usb/135372

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/usb/usbdevs
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:11:48 2009	(r198635)
+++ stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:12:29 2009	(r198636)
@@ -412,6 +412,10 @@ static const struct umass_devdescr umass
 		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
@@ -733,6 +737,10 @@ static const struct umass_devdescr umass
 		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
@@ -893,6 +901,10 @@ static const struct umass_devdescr umass
 		UMASS_PROTO_UFI | UMASS_PROTO_CBI,
 		NO_QUIRKS
 	},
+	{USB_VENDOR_TECLAST, USB_PRODUCT_TECLAST_TLC300, RID_WILDCARD,
+		UMASS_PROTO_DEFAULT,
+		NO_TEST_UNIT_READY | NO_SYNCHRONIZE_CACHE
+	},
 	{USB_VENDOR_TREK, USB_PRODUCT_TREK_MEMKEY, RID_WILDCARD,
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		NO_INQUIRY
@@ -965,6 +977,10 @@ static const struct umass_devdescr umass
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		NO_SYNCHRONIZE_CACHE
 	},
+	{USB_VENDOR_ASUS, USB_PRODUCT_ASUS_GMSC, RID_WILDCARD,
+		UMASS_PROTO_DEFAULT,
+		NO_SYNCHRONIZE_CACHE
+	},
 	{VID_EOT, PID_EOT, RID_EOT, 0, 0}
 };
 

Modified: stable/8/sys/dev/usb/usbdevs
==============================================================================
--- stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:11:48 2009	(r198635)
+++ stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:12:29 2009	(r198636)
@@ -360,6 +360,7 @@ vendor SMC		0x0707	Standard Microsystems
 vendor PUTERCOM		0x0708	Putercom
 vendor MCT		0x0711	MCT
 vendor IMATION		0x0718	Imation
+vendor TECLAST		0x071b	Teclast
 vendor SONYERICSSON	0x0731	Sony Ericsson
 vendor EICON		0x0734	Eicon Networks
 vendor SYNTECH		0x0745	Syntech Information
@@ -585,6 +586,7 @@ vendor NETGEAR3		0x1385	Netgear
 vendor BALTECH		0x13ad	Baltech
 vendor CISCOLINKSYS	0x13b1	Cisco-Linksys
 vendor SHARK		0x13d2	Shark
+vendor EMTEC		0x13fe	Emtec
 vendor NOVATEL		0x1410	Novatel Wireless
 vendor MERLIN		0x1416	Merlin
 vendor WISTRONNEWEB	0x1435	Wistron NeWeb
@@ -820,6 +822,7 @@ product AKS USBHASP		0x0001	USB-HASP 0.0
 /* Alcor Micro, Inc. products */
 product ALCOR2 KBD_HUB		0x2802	Kbd Hub
 
+product ALCOR SDCR_6335		0x6335	SD/MMC Card Reader
 product ALCOR TRANSCEND		0x6387	Transcend JetFlash Drive
 product ALCOR MA_KBD_HUB	0x9213	MacAlly Kbd Hub
 product ALCOR AU9814		0x9215	AU9814 Hub
@@ -861,6 +864,12 @@ product APC UPS			0x0002	Uninterruptible
 
 /* Apple Computer products */
 product APPLE EXT_KBD		0x020c	Apple Extended USB Keyboard
+product APPLE KBD_TP_ANSI	0x0223	Apple Internal Keyboard/Trackpad (Wellspring/ANSI)
+product APPLE KBD_TP_ISO	0x0224	Apple Internal Keyboard/Trackpad (Wellspring/ISO)
+product APPLE KBD_TP_JIS	0x0225	Apple Internal Keyboard/Trackpad (Wellspring/JIS)
+product APPLE KBD_TP_ANSI2	0x0230	Apple Internal Keyboard/Trackpad (Wellspring2/ANSI)
+product APPLE KBD_TP_ISO2	0x0231	Apple Internal Keyboard/Trackpad (Wellspring2/ISO)
+product APPLE KBD_TP_JIS2	0x0232	Apple Internal Keyboard/Trackpad (Wellspring2/JIS)
 product APPLE OPTMOUSE		0x0302	Optical mouse
 product APPLE MIGHTYMOUSE	0x0304	Mighty Mouse
 product APPLE EXT_KBD_HUB	0x1003	Hub in Apple Extended USB Keyboard
@@ -902,6 +911,7 @@ product ASUS RT2573_1		0x1723	RT2573
 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
 
 /* ATen products */
 product ATEN UC1284		0x2001	Parallel printer
@@ -1971,6 +1981,7 @@ product PHILIPS HUB		0x0201	hub
 product PHILIPS PCA646VC	0x0303	PCA646VC PC Camera
 product PHILIPS PCVC680K	0x0308	PCVC680K Vesta Pro PC Camera
 product PHILIPS DSS150		0x0471	DSS 150 Digital Speaker System
+product PHILIPS SPE3030CC	0x083a	USB 2.0 External Disk
 product PHILIPS SNU5600		0x1236	SNU5600
 product PHILIPS UM10016		0x1552	ISP 1581 Hi-Speed USB MPEG2 Encoder Reference Kit
 product PHILIPS DIVAUSB		0x1801	DIVA USB mp3 player
@@ -2345,6 +2356,9 @@ product SUN KBD_HUB		0x100e	Kbd Hub
 /* Super Top products */
 product	SUPERTOP IDE		0x6600	USB-IDE
 
+/* Teclast products */
+product TECLAST TLC300		0x3203	USB Media Player
+
 /* Supra products */
 product DIAMOND2 SUPRAEXPRESS56K 0x07da	Supra Express 56K modem
 product DIAMOND2 SUPRA2890	0x0b4a	SupraMax 2890 56K Modem

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:13:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 56979106568B;
	Thu, 29 Oct 2009 23:13:03 +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 425738FC20;
	Thu, 29 Oct 2009 23:13: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 n9TND3Ce014072;
	Thu, 29 Oct 2009 23:13:03 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TND3AE014070;
	Thu, 29 Oct 2009 23:13:03 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292313.n9TND3AE014070@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:13:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198637 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:13:03 -0000

Author: thompsa
Date: Thu Oct 29 23:13:02 2009
New Revision: 198637
URL: http://svn.freebsd.org/changeset/base/198637

Log:
  MFC r196496
  
   Add a reminder comment to optimize bus_dmamap_sync calls.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_busdma.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/8/sys/dev/usb/usb_busdma.c	Thu Oct 29 23:12:29 2009	(r198636)
+++ stable/8/sys/dev/usb/usb_busdma.c	Thu Oct 29 23:13:02 2009	(r198637)
@@ -679,6 +679,12 @@ usb_pc_cpu_invalidate(struct usb_page_ca
 		/* nothing has been loaded into this page cache! */
 		return;
 	}
+
+	/*
+	 * TODO: We currently do XXX_POSTREAD and XXX_PREREAD at the
+	 * same time, but in the future we should try to isolate the
+	 * different cases to optimise the code. --HPS
+	 */
 	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD);
 	bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD);
 }

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:13:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F45F106568F;
	Thu, 29 Oct 2009 23:13: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 7B2D58FC27;
	Thu, 29 Oct 2009 23:13: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 n9TNDag5014132;
	Thu, 29 Oct 2009 23:13:36 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNDaB0014130;
	Thu, 29 Oct 2009 23:13:36 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292313.n9TNDaB0014130@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:13:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198638 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/wlan dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:13:36 -0000

Author: thompsa
Date: Thu Oct 29 23:13:36 2009
New Revision: 198638
URL: http://svn.freebsd.org/changeset/base/198638

Log:
  MFC r196497
  
   Remove redundant locking.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/wlan/if_upgt.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/wlan/if_upgt.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_upgt.c	Thu Oct 29 23:13:02 2009	(r198637)
+++ stable/8/sys/dev/usb/wlan/if_upgt.c	Thu Oct 29 23:13:36 2009	(r198638)
@@ -465,7 +465,6 @@ upgt_ioctl(struct ifnet *ifp, u_long cmd
 
 	switch (cmd) {
 	case SIOCSIFFLAGS:
-		mtx_lock(&Giant);
 		if (ifp->if_flags & IFF_UP) {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
 				if ((ifp->if_flags ^ sc->sc_if_flags) &
@@ -482,7 +481,6 @@ upgt_ioctl(struct ifnet *ifp, u_long cmd
 		sc->sc_if_flags = ifp->if_flags;
 		if (startall)
 			ieee80211_start_all(ic);
-		mtx_unlock(&Giant);
 		break;
 	case SIOCGIFMEDIA:
 		error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:14:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4246310656A5;
	Thu, 29 Oct 2009 23:14:07 +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 2DD668FC2A;
	Thu, 29 Oct 2009 23:14: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 n9TNE7aQ014191;
	Thu, 29 Oct 2009 23:14:07 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNE7TL014189;
	Thu, 29 Oct 2009 23:14:07 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292314.n9TNE7TL014189@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:14:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198639 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/storage dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:14:07 -0000

Author: thompsa
Date: Thu Oct 29 23:14:06 2009
New Revision: 198639
URL: http://svn.freebsd.org/changeset/base/198639

Log:
  MFC r196826
  
   Make umass(4) pass device USB serial number to CAM, making it possible
   to e.g. retrieve it using camcontrol(8).

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:13:36 2009	(r198638)
+++ stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:14:06 2009	(r198639)
@@ -124,6 +124,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include "usbdevs.h"
 
 #include 
@@ -2979,6 +2980,28 @@ umass_cam_action(struct cam_sim *sim, un
 				if (sc->sc_transfer.cmd_data[0] == INQUIRY) {
 
 					/*
+					 * Umass devices don't generally report their serial numbers
+					 * in the usual SCSI way.  Emulate it here.
+					 */
+					if ((sc->sc_transfer.cmd_data[1] & SI_EVPD) &&
+					    sc->sc_transfer.cmd_data[2] == SVPD_UNIT_SERIAL_NUMBER &&
+					    sc->sc_udev != NULL &&
+					    sc->sc_udev->serial != NULL &&
+					    sc->sc_udev->serial[0] != '\0') {
+						struct scsi_vpd_unit_serial_number *vpd_serial;
+
+						vpd_serial = (struct scsi_vpd_unit_serial_number *)ccb->csio.data_ptr;
+						vpd_serial->length = strlen(sc->sc_udev->serial);
+						if (vpd_serial->length > sizeof(vpd_serial->serial_num))
+							vpd_serial->length = sizeof(vpd_serial->serial_num);
+						memcpy(vpd_serial->serial_num, sc->sc_udev->serial, vpd_serial->length);
+						ccb->csio.scsi_status = SCSI_STATUS_OK;
+						ccb->ccb_h.status = CAM_REQ_CMP;
+						xpt_done(ccb);
+						goto done;
+					}
+
+					/*
 					 * Handle EVPD inquiry for broken devices first
 					 * NO_INQUIRY also implies NO_INQUIRY_EVPD
 					 */
@@ -3194,6 +3217,29 @@ umass_cam_cb(struct umass_softc *sc, uni
 			maxsector = scsi_4btoul(rcap->addr) - 1;
 			scsi_ulto4b(maxsector, rcap->addr);
 		}
+		/*
+		 * We have to add SVPD_UNIT_SERIAL_NUMBER to the list
+		 * of pages supported by the device - otherwise, CAM
+		 * will never ask us for the serial number if the
+		 * device cannot handle that by itself.
+		 */
+		if (ccb->ccb_h.func_code == XPT_SCSI_IO &&
+		    sc->sc_transfer.cmd_data[0] == INQUIRY &&
+		    (sc->sc_transfer.cmd_data[1] & SI_EVPD) &&
+		    sc->sc_transfer.cmd_data[2] == SVPD_SUPPORTED_PAGE_LIST &&
+		    sc->sc_udev != NULL &&
+		    sc->sc_udev->serial != NULL &&
+		    sc->sc_udev->serial[0] != '\0') {
+			struct ccb_scsiio *csio;
+			struct scsi_vpd_supported_page_list *page_list;
+
+			csio = &ccb->csio;
+			page_list = (struct scsi_vpd_supported_page_list *)csio->data_ptr;
+			if (page_list->length + 1 < SVPD_SUPPORTED_PAGES_SIZE) {
+				page_list->list[page_list->length] = SVPD_UNIT_SERIAL_NUMBER;
+				page_list->length++;
+			}
+		}
 		xpt_done(ccb);
 		break;
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:14:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5B1D8106566B;
	Thu, 29 Oct 2009 23:14:40 +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 45DE98FC0C;
	Thu, 29 Oct 2009 23:14: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 n9TNEeOH014255;
	Thu, 29 Oct 2009 23:14:40 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNEenR014249;
	Thu, 29 Oct 2009 23:14:40 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292314.n9TNEenR014249@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:14:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198640 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:14:40 -0000

Author: thompsa
Date: Thu Oct 29 23:14:39 2009
New Revision: 198640
URL: http://svn.freebsd.org/changeset/base/198640

Log:
  MFC r197553
  
   - clean up USB detach logic. There seems to be some problems detaching multiple
     USB HUBs connected in series from the root.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/controller/usb_controller.c
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/usb/usb_device.h
  stable/8/sys/dev/usb/usb_hub.c
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/8/sys/dev/usb/controller/usb_controller.c	Thu Oct 29 23:14:06 2009	(r198639)
+++ stable/8/sys/dev/usb/controller/usb_controller.c	Thu Oct 29 23:14:39 2009	(r198640)
@@ -270,11 +270,9 @@ usb_bus_detach(struct usb_proc_msg *pm)
 	mtx_unlock(&Giant);
 
 	/*
-	 * Free USB Root device, but not any sub-devices, hence they
-	 * are freed by the caller of this function:
+	 * Free USB device and all subdevices, if any.
 	 */
-	usb_free_device(udev,
-	    USB_UNCFG_FLAG_FREE_EP0);
+	usb_free_device(udev, 0);
 
 	USB_BUS_LOCK(bus);
 	/* clear bdev variable last */

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:14:06 2009	(r198639)
+++ stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:14:39 2009	(r198640)
@@ -478,7 +478,7 @@ usbd_set_config_index(struct usb_device 
 		usbd_enum_lock(udev);
 	}
 
-	usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV);
+	usb_unconfigure(udev, 0);
 
 	if (index == USB_UNCONFIG_INDEX) {
 		/*
@@ -582,7 +582,7 @@ usbd_set_config_index(struct usb_device 
 done:
 	DPRINTF("error=%s\n", usbd_errstr(err));
 	if (err) {
-		usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV);
+		usb_unconfigure(udev, 0);
 	}
 	if (do_unlock)
 		usbd_enum_unlock(udev);
@@ -989,18 +989,13 @@ usb_detach_device_sub(struct usb_device 
 	device_t dev;
 	int err;
 
-	if (!(flag & USB_UNCFG_FLAG_FREE_SUBDEV)) {
-
-		*ppdev = NULL;
-
-	} else if (*ppdev) {
-
+	dev = *ppdev;
+	if (dev) {
 		/*
 		 * NOTE: It is important to clear "*ppdev" before deleting
 		 * the child due to some device methods being called late
 		 * during the delete process !
 		 */
-		dev = *ppdev;
 		*ppdev = NULL;
 
 		device_printf(dev, "at %s, port %d, addr %d "
@@ -1778,7 +1773,7 @@ repeat_set_config:
 		} else if (usb_test_huawei_autoinst_p(udev, &uaa) == 0) {
 			DPRINTFN(0, "Found Huawei auto-install disk!\n");
 			/* leave device unconfigured */
-			usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV);
+			usb_unconfigure(udev, 0);
 		}
 	} else {
 		err = 0;		/* set success */
@@ -1803,10 +1798,10 @@ repeat_set_config:
 #endif
 done:
 	if (err) {
-		/* free device  */
-		usb_free_device(udev,
-		    USB_UNCFG_FLAG_FREE_SUBDEV |
-		    USB_UNCFG_FLAG_FREE_EP0);
+		/*
+		 * Free USB device and all subdevices, if any.
+		 */
+		usb_free_device(udev, 0);
 		udev = NULL;
 	}
 	return (udev);
@@ -1926,9 +1921,10 @@ usb_cdev_cleanup(void* arg)
 /*------------------------------------------------------------------------*
  *	usb_free_device
  *
- * This function is NULL safe and will free an USB device.
+ * This function is NULL safe and will free an USB device and its
+ * children devices, if any.
  *
- * Flag values, see "USB_UNCFG_FLAG_XXX".
+ * Flag values: Reserved, set to zero.
  *------------------------------------------------------------------------*/
 void
 usb_free_device(struct usb_device *udev, uint8_t flag)
@@ -1982,7 +1978,7 @@ usb_free_device(struct usb_device *udev,
 	}
 
 	/* the following will get the device unconfigured in software */
-	usb_unconfigure(udev, flag);
+	usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_EP0);
 
 	/* unsetup any leftover default USB transfers */
 	usbd_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);

Modified: stable/8/sys/dev/usb/usb_device.h
==============================================================================
--- stable/8/sys/dev/usb/usb_device.h	Thu Oct 29 23:14:06 2009	(r198639)
+++ stable/8/sys/dev/usb/usb_device.h	Thu Oct 29 23:14:39 2009	(r198640)
@@ -41,7 +41,6 @@ struct usb_device;		/* linux compat */
 /* "usb_unconfigure()" flags */
 
 #define	USB_UNCFG_FLAG_NONE 0x00
-#define	USB_UNCFG_FLAG_FREE_SUBDEV 0x01		/* subdevices are freed */
 #define	USB_UNCFG_FLAG_FREE_EP0	0x02		/* endpoint zero is freed */
 
 struct usb_clear_stall_msg {

Modified: stable/8/sys/dev/usb/usb_hub.c
==============================================================================
--- stable/8/sys/dev/usb/usb_hub.c	Thu Oct 29 23:14:06 2009	(r198639)
+++ stable/8/sys/dev/usb/usb_hub.c	Thu Oct 29 23:14:39 2009	(r198640)
@@ -316,12 +316,13 @@ repeat:
 	if (err) {
 		goto error;
 	}
-	/* detach any existing devices */
+	/* check if there is a child */
 
-	if (child) {
-		usb_free_device(child,
-		    USB_UNCFG_FLAG_FREE_SUBDEV |
-		    USB_UNCFG_FLAG_FREE_EP0);
+	if (child != NULL) {
+		/*
+		 * Free USB device and all subdevices, if any.
+		 */
+		usb_free_device(child, 0);
 		child = NULL;
 	}
 	/* get fresh status */
@@ -438,10 +439,11 @@ repeat:
 	return (0);			/* success */
 
 error:
-	if (child) {
-		usb_free_device(child,
-		    USB_UNCFG_FLAG_FREE_SUBDEV |
-		    USB_UNCFG_FLAG_FREE_EP0);
+	if (child != NULL) {
+		/*
+		 * Free USB device and all subdevices, if any.
+		 */
+		usb_free_device(child, 0);
 		child = NULL;
 	}
 	if (err == 0) {
@@ -888,12 +890,14 @@ uhub_detach(device_t dev)
 	struct usb_device *child;
 	uint8_t x;
 
-	/* detach all children first */
-	bus_generic_detach(dev);
-
 	if (hub == NULL) {		/* must be partially working */
 		return (0);
 	}
+
+	/* Make sure interrupt transfer is gone. */
+	usbd_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
+
+	/* Detach all ports */
 	for (x = 0; x != hub->nports; x++) {
 
 		child = usb_bus_port_get_device(sc->sc_udev->bus, hub->ports + x);
@@ -901,16 +905,13 @@ uhub_detach(device_t dev)
 		if (child == NULL) {
 			continue;
 		}
+
 		/*
-		 * Subdevices are not freed, because the caller of
-		 * uhub_detach() will do that.
+		 * Free USB device and all subdevices, if any.
 		 */
-		usb_free_device(child,
-		    USB_UNCFG_FLAG_FREE_EP0);
+		usb_free_device(child, 0);
 	}
 
-	usbd_transfer_unsetup(sc->sc_xfer, UHUB_N_TRANSFER);
-
 	free(hub, M_USBDEV);
 	sc->sc_udev->hub = NULL;
 
@@ -984,10 +985,19 @@ static int
 uhub_child_location_string(device_t parent, device_t child,
     char *buf, size_t buflen)
 {
-	struct uhub_softc *sc = device_get_softc(parent);
-	struct usb_hub *hub = sc->sc_udev->hub;
+	struct uhub_softc *sc;
+	struct usb_hub *hub;
 	struct hub_result res;
 
+	if (!device_is_attached(parent)) {
+		if (buflen)
+			buf[0] = 0;
+		return (0);
+	}
+
+	sc = device_get_softc(parent);
+	hub = sc->sc_udev->hub;
+
 	mtx_lock(&Giant);
 	uhub_find_iface_index(hub, child, &res);
 	if (!res.udev) {
@@ -1009,11 +1019,20 @@ static int
 uhub_child_pnpinfo_string(device_t parent, device_t child,
     char *buf, size_t buflen)
 {
-	struct uhub_softc *sc = device_get_softc(parent);
-	struct usb_hub *hub = sc->sc_udev->hub;
+	struct uhub_softc *sc;
+	struct usb_hub *hub;
 	struct usb_interface *iface;
 	struct hub_result res;
 
+	if (!device_is_attached(parent)) {
+		if (buflen)
+			buf[0] = 0;
+		return (0);
+	}
+
+	sc = device_get_softc(parent);
+	hub = sc->sc_udev->hub;
+
 	mtx_lock(&Giant);
 	uhub_find_iface_index(hub, child, &res);
 	if (!res.udev) {

Modified: stable/8/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/8/sys/dev/usb/usb_transfer.c	Thu Oct 29 23:14:06 2009	(r198639)
+++ stable/8/sys/dev/usb/usb_transfer.c	Thu Oct 29 23:14:39 2009	(r198640)
@@ -2121,6 +2121,9 @@ usb_dma_delay_done_cb(void *arg)
 
 	DPRINTFN(3, "Completed %p\n", xfer);
 
+	/* only delay once */
+	xfer->flags_int.did_dma_delay = 1;
+
 	/* queue callback for execution, again */
 	usbd_transfer_done(xfer, 0);
 }
@@ -2488,9 +2491,6 @@ usbd_callback_wrapper_sub(struct usb_xfe
 
 		usb_timeout_t temp;
 
-		/* only delay once */
-		xfer->flags_int.did_dma_delay = 1;
-
 		/* we can not cancel this delay */
 		xfer->flags_int.can_cancel_immed = 0;
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:15:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 817B010656BC;
	Thu, 29 Oct 2009 23:15:27 +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 535508FC14;
	Thu, 29 Oct 2009 23:15: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 n9TNFR4H014330;
	Thu, 29 Oct 2009 23:15:27 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNFR0X014328;
	Thu, 29 Oct 2009 23:15:27 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292315.n9TNFR0X014328@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:15:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198641 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:15:27 -0000

Author: thompsa
Date: Thu Oct 29 23:15:26 2009
New Revision: 198641
URL: http://svn.freebsd.org/changeset/base/198641

Log:
  MFC r197554
  
   Import two PCI quirks from Linux
  
    - Add quirk for ATI SB600 and SB700 to free SMB controller
    - Correct schedule sleep time to 10us on the VIA ehci controller

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/controller/ehci_pci.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_pci.c	Thu Oct 29 23:14:39 2009	(r198640)
+++ stable/8/sys/dev/usb/controller/ehci_pci.c	Thu Oct 29 23:15:26 2009	(r198641)
@@ -240,6 +240,50 @@ ehci_pci_probe(device_t self)
 	}
 }
 
+static void
+ehci_pci_ati_quirk(device_t self, uint8_t is_sb700)
+{
+	device_t smbdev;
+	uint32_t val;
+
+	if (is_sb700) {
+		/* Lookup SMBUS PCI device */
+		smbdev = pci_find_device(PCI_EHCI_VENDORID_ATI, 0x4385);
+		if (smbdev == NULL)
+			return;
+		val = pci_get_revid(smbdev);
+		if (val != 0x3a && val != 0x3b)
+			return;
+	}
+
+	/*
+	 * Note: this bit is described as reserved in SB700
+	 * Register Reference Guide.
+	 */
+	val = pci_read_config(self, 0x53, 1);
+	if (!(val & 0x8)) {
+		val |= 0x8;
+		pci_write_config(self, 0x53, val, 1);
+		device_printf(self, "AMD SB600/700 quirk applied\n");
+	}
+}
+
+static void
+ehci_pci_via_quirk(device_t self)
+{
+	uint32_t val;
+
+	if ((pci_get_device(self) == 0x3104) && 
+	    ((pci_get_revid(self) & 0xf0) == 0x60)) {
+		/* Correct schedule sleep time to 10us */
+		val = pci_read_config(self, 0x4b, 1);
+		if (val & 0x20)
+			return;
+		pci_write_config(self, 0x4b, val, 1);
+		device_printf(self, "VIA-quirk applied\n");
+	}
+}
+
 static int
 ehci_pci_attach(device_t self)
 {
@@ -370,6 +414,32 @@ ehci_pci_attach(device_t self)
 		goto error;
 	}
 	ehci_pci_takecontroller(self);
+
+	/* Undocumented quirks taken from Linux */
+
+	switch (pci_get_vendor(self)) {
+	case PCI_EHCI_VENDORID_ATI:
+		/* SB600 and SB700 EHCI quirk */
+		switch (pci_get_device(self)) {
+		case 0x4386:
+			ehci_pci_ati_quirk(self, 0);
+			break;
+		case 0x4396:
+			ehci_pci_ati_quirk(self, 1);
+			break;
+		default:
+			break;
+		}
+		break;
+
+	case PCI_EHCI_VENDORID_VIA:
+		ehci_pci_via_quirk(self);
+		break;
+
+	default:
+		break;
+	}
+
 	err = ehci_init(sc);
 	if (!err) {
 		err = device_probe_and_attach(sc->sc_bus.bdev);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:16:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 16AE3106568B;
	Thu, 29 Oct 2009 23:16:01 +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 023738FC14;
	Thu, 29 Oct 2009 23:16: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 n9TNG0Zg014386;
	Thu, 29 Oct 2009 23:16:00 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNG06w014384;
	Thu, 29 Oct 2009 23:16:00 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292316.n9TNG06w014384@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:16:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198642 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:16:01 -0000

Author: thompsa
Date: Thu Oct 29 23:16:00 2009
New Revision: 198642
URL: http://svn.freebsd.org/changeset/base/198642

Log:
  MFC r197555
  
   Simplify logic around setting EHCI_QH_DTC and expand some htohc32(temp.sc, 0)
   statements to zero.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/controller/ehci.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Thu Oct 29 23:15:26 2009	(r198641)
+++ stable/8/sys/dev/usb/controller/ehci.c	Thu Oct 29 23:16:00 2009	(r198642)
@@ -1954,18 +1954,15 @@ ehci_setup_standard_chain(struct usb_xfe
 	    EHCI_QH_SET_MPL(xfer->max_packet_size));
 
 	if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_HIGH) {
-		qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) |
-		    EHCI_QH_DTC);
+		qh_endp |= EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH);
 		if (methods != &ehci_device_intr_methods)
 			qh_endp |= EHCI_QH_SET_NRL(8);
 	} else {
 
 		if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) {
-			qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL) |
-			    EHCI_QH_DTC);
+			qh_endp |= EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL);
 		} else {
-			qh_endp |= (EHCI_QH_SET_EPS(EHCI_QH_SPEED_LOW) |
-			    EHCI_QH_DTC);
+			qh_endp |= EHCI_QH_SET_EPS(EHCI_QH_SPEED_LOW);
 		}
 
 		if (methods == &ehci_device_ctrl_methods) {
@@ -1977,6 +1974,11 @@ ehci_setup_standard_chain(struct usb_xfe
 		}
 	}
 
+	if (temp.auto_data_toggle == 0) {
+		/* software computes the data toggle */
+		qh_endp |= EHCI_QH_DTC;
+	}
+
 	qh->qh_endp = htohc32(temp.sc, qh_endp);
 
 	qh_endphub =
@@ -1987,23 +1989,17 @@ ehci_setup_standard_chain(struct usb_xfe
 	    EHCI_QH_SET_PORT(xfer->xroot->udev->hs_port_no));
 
 	qh->qh_endphub = htohc32(temp.sc, qh_endphub);
-	qh->qh_curqtd = htohc32(temp.sc, 0);
+	qh->qh_curqtd = 0;
 
 	/* fill the overlay qTD */
-	qh->qh_qtd.qtd_status = htohc32(temp.sc, 0);
-
-	if (temp.auto_data_toggle) {
-
-		/* let the hardware compute the data toggle */
 
-		qh->qh_endp &= htohc32(temp.sc, ~EHCI_QH_DTC);
-
-		if (xfer->endpoint->toggle_next) {
-			/* DATA1 is next */
-			qh->qh_qtd.qtd_status |=
-			    htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
-		}
+	if (temp.auto_data_toggle && xfer->endpoint->toggle_next) {
+		/* DATA1 is next */
+		qh->qh_qtd.qtd_status = htohc32(temp.sc, EHCI_QTD_SET_TOGGLE(1));
+	} else {
+		qh->qh_qtd.qtd_status = 0;
 	}
+
 	td = xfer->td_transfer_first;
 
 	qh->qh_qtd.qtd_next = td->qtd_self;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:16:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E5C7610656CF;
	Thu, 29 Oct 2009 23:16:39 +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 D16F38FC22;
	Thu, 29 Oct 2009 23:16: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 n9TNGd4C014449;
	Thu, 29 Oct 2009 23:16:39 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNGd3X014447;
	Thu, 29 Oct 2009 23:16:39 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292316.n9TNGd3X014447@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:16:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198643 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:16:40 -0000

Author: thompsa
Date: Thu Oct 29 23:16:39 2009
New Revision: 198643
URL: http://svn.freebsd.org/changeset/base/198643

Log:
  MFC r197556
  
   Clear all interrupts rather than just SETUP packet.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/controller/atmegadci.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/atmegadci.c	Thu Oct 29 23:16:00 2009	(r198642)
+++ stable/8/sys/dev/usb/controller/atmegadci.c	Thu Oct 29 23:16:39 2009	(r198643)
@@ -301,8 +301,8 @@ atmegadci_setup_rx(struct atmegadci_td *
 		sc->sc_dv_addr = 0xFF;
 	}
 
-	/* clear SETUP packet interrupt */
-	ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, ~ATMEGA_UEINTX_RXSTPI);
+	/* Clear SETUP packet interrupt and all other previous interrupts */
+	ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, 0);
 	return (0);			/* complete */
 
 not_complete:

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:17:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 042D6106568D;
	Thu, 29 Oct 2009 23:17: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 E41418FC0A;
	Thu, 29 Oct 2009 23:17: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 n9TNHNel014517;
	Thu, 29 Oct 2009 23:17:23 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNHN76014515;
	Thu, 29 Oct 2009 23:17:23 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292317.n9TNHN76014515@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:17:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198644 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:17:24 -0000

Author: thompsa
Date: Thu Oct 29 23:17:23 2009
New Revision: 198644
URL: http://svn.freebsd.org/changeset/base/198644

Log:
  MFC r197558
  
   Fix NULL-pointer dereference in usb_endpoint_foreach().
  
  PR:		usb/138389

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:16:39 2009	(r198643)
+++ stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:17:23 2009	(r198644)
@@ -367,12 +367,14 @@ usb_init_endpoint(struct usb_device *ude
 struct usb_endpoint *
 usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep)
 {
-	struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
+	struct usb_endpoint *ep_end;
 
 	/* be NULL safe */
 	if (udev == NULL)
 		return (NULL);
 
+	ep_end = udev->endpoints + udev->endpoints_max;
+
 	/* get next endpoint */
 	if (ep == NULL)
 		ep = udev->endpoints;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:17:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B915E1065692;
	Thu, 29 Oct 2009 23:17:54 +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 A43C58FC0A;
	Thu, 29 Oct 2009 23:17: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 n9TNHsc5014575;
	Thu, 29 Oct 2009 23:17:54 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNHsNv014572;
	Thu, 29 Oct 2009 23:17:54 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292317.n9TNHsNv014572@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:17:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198645 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:17:54 -0000

Author: thompsa
Date: Thu Oct 29 23:17:54 2009
New Revision: 198645
URL: http://svn.freebsd.org/changeset/base/198645

Log:
  MFC r197559
  
   Add support for USB language selection.
  
  PR:		usb/138563

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_bus.h
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_bus.h
==============================================================================
--- stable/8/sys/dev/usb/usb_bus.h	Thu Oct 29 23:17:23 2009	(r198644)
+++ stable/8/sys/dev/usb/usb_bus.h	Thu Oct 29 23:17:54 2009	(r198645)
@@ -98,10 +98,14 @@ struct usb_bus {
 	uint8_t	devices_max;		/* maximum number of USB devices */
 	uint8_t	do_probe;		/* set if USB BUS should be re-probed */
 
+	/* 
+	 * The scratch area can only be used inside the explore thread
+	 * belonging to the give serial bus.
+	 */
 	union {
 		struct usb_hw_ep_scratch hw_ep_scratch[1];
 		struct usb_temp_setup temp_setup[1];
-		uint8_t	data[128];
+		uint8_t	data[255];
 	}	scratch[1];
 };
 

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:17:23 2009	(r198644)
+++ stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:17:54 2009	(r198645)
@@ -105,9 +105,23 @@ static void	usb_cdev_cleanup(void *);
 
 int	usb_template = 0;
 
+TUNABLE_INT("hw.usb.usb_template", &usb_template);
 SYSCTL_INT(_hw_usb, OID_AUTO, template, CTLFLAG_RW,
     &usb_template, 0, "Selected USB device side template");
 
+/* English is default language */
+
+static int usb_lang_id = 0x0009;
+static int usb_lang_mask = 0x00FF;
+
+TUNABLE_INT("hw.usb.usb_lang_id", &usb_lang_id);
+SYSCTL_INT(_hw_usb, OID_AUTO, usb_lang_id, CTLFLAG_RW,
+    &usb_lang_id, 0, "Preferred USB language ID");
+
+TUNABLE_INT("hw.usb.usb_lang_mask", &usb_lang_mask);
+SYSCTL_INT(_hw_usb, OID_AUTO, usb_lang_mask, CTLFLAG_RW,
+    &usb_lang_mask, 0, "Preferred USB language mask");
+
 static const char* statestr[USB_STATE_MAX] = {
 	[USB_STATE_DETACHED]	= "DETACHED",
 	[USB_STATE_ATTACHED]	= "ATTACHED",
@@ -1436,7 +1450,7 @@ usb_alloc_device(device_t parent_dev, st
 	struct usb_device *adev;
 	struct usb_device *hub;
 	uint8_t *scratch_ptr;
-	uint32_t scratch_size;
+	size_t scratch_size;
 	usb_error_t err;
 	uint8_t device_index;
 
@@ -1682,8 +1696,35 @@ usb_alloc_device(device_t parent_dev, st
 	if (err || (scratch_ptr[0] < 4)) {
 		udev->flags.no_strings = 1;
 	} else {
-		/* pick the first language as the default */
-		udev->langid = UGETW(scratch_ptr + 2);
+		uint16_t langid;
+		uint16_t pref;
+		uint16_t mask;
+		uint8_t x;
+
+		/* load preferred value and mask */
+		pref = usb_lang_id;
+		mask = usb_lang_mask;
+
+		/* align length correctly */
+		scratch_ptr[0] &= ~1;
+
+		/* fix compiler warning */
+		langid = 0;
+
+		/* search for preferred language */
+		for (x = 2; (x < scratch_ptr[0]); x += 2) {
+			langid = UGETW(scratch_ptr + x);
+			if ((langid & mask) == pref)
+				break;
+		}
+		if (x >= scratch_ptr[0]) {
+			/* pick the first language as the default */
+			DPRINTFN(1, "Using first language\n");
+			langid = UGETW(scratch_ptr + 2);
+		}
+
+		DPRINTFN(1, "Language selected: 0x%04x\n", langid);
+		udev->langid = langid;
 	}
 
 	/* assume 100mA bus powered for now. Changed when configured. */
@@ -2149,34 +2190,35 @@ usbd_set_device_strings(struct usb_devic
 #ifdef USB_VERBOSE
 	const struct usb_knowndev *kdp;
 #endif
-	char temp[64];
+	uint8_t *temp_ptr;
+	size_t temp_size;
 	uint16_t vendor_id;
 	uint16_t product_id;
 
+	temp_ptr = udev->bus->scratch[0].data;
+	temp_size = sizeof(udev->bus->scratch[0].data);
+
 	vendor_id = UGETW(udd->idVendor);
 	product_id = UGETW(udd->idProduct);
 
 	/* get serial number string */
-	bzero(temp, sizeof(temp));
-	usbd_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	usbd_req_get_string_any(udev, NULL, temp_ptr, temp_size,
 	    udev->ddesc.iSerialNumber);
-	udev->serial = strdup(temp, M_USB);
+	udev->serial = strdup(temp_ptr, M_USB);
 
 	/* get manufacturer string */
-	bzero(temp, sizeof(temp));
-	usbd_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	usbd_req_get_string_any(udev, NULL, temp_ptr, temp_size,
 	    udev->ddesc.iManufacturer);
-	usb_trim_spaces(temp);
-	if (temp[0] != '\0')
-		udev->manufacturer = strdup(temp, M_USB);
+	usb_trim_spaces(temp_ptr);
+	if (temp_ptr[0] != '\0')
+		udev->manufacturer = strdup(temp_ptr, M_USB);
 
 	/* get product string */
-	bzero(temp, sizeof(temp));
-	usbd_req_get_string_any(udev, NULL, temp, sizeof(temp),
+	usbd_req_get_string_any(udev, NULL, temp_ptr, temp_size,
 	    udev->ddesc.iProduct);
-	usb_trim_spaces(temp);
-	if (temp[0] != '\0')
-		udev->product = strdup(temp, M_USB);
+	usb_trim_spaces(temp_ptr);
+	if (temp_ptr[0] != '\0')
+		udev->product = strdup(temp_ptr, M_USB);
 
 #ifdef USB_VERBOSE
 	if (udev->manufacturer == NULL || udev->product == NULL) {
@@ -2202,12 +2244,12 @@ usbd_set_device_strings(struct usb_devic
 #endif
 	/* Provide default strings if none were found */
 	if (udev->manufacturer == NULL) {
-		snprintf(temp, sizeof(temp), "vendor 0x%04x", vendor_id);
-		udev->manufacturer = strdup(temp, M_USB);
+		snprintf(temp_ptr, temp_size, "vendor 0x%04x", vendor_id);
+		udev->manufacturer = strdup(temp_ptr, M_USB);
 	}
 	if (udev->product == NULL) {
-		snprintf(temp, sizeof(temp), "product 0x%04x", product_id);
-		udev->product = strdup(temp, M_USB);
+		snprintf(temp_ptr, temp_size, "product 0x%04x", product_id);
+		udev->product = strdup(temp_ptr, M_USB);
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:18:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 71D9D106568F;
	Thu, 29 Oct 2009 23:18:27 +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 5DB188FC08;
	Thu, 29 Oct 2009 23: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 n9TNIRqN014636;
	Thu, 29 Oct 2009 23:18:27 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNIRrX014634;
	Thu, 29 Oct 2009 23:18:27 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292318.n9TNIRrX014634@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:18:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198646 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:18:27 -0000

Author: thompsa
Date: Thu Oct 29 23:18:27 2009
New Revision: 198646
URL: http://svn.freebsd.org/changeset/base/198646

Log:
  MFC r197561
  
   Correct buffer sizes used so that they match. The old code could give the
   impression that a overflow situation existed but was not possible.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:17:54 2009	(r198645)
+++ stable/8/sys/dev/usb/usb_device.c	Thu Oct 29 23:18:27 2009	(r198646)
@@ -2355,6 +2355,7 @@ usb_notify_addq(const char *type, struct
 {
 	char *data = NULL;
 	struct malloc_type *mt;
+	const size_t buf_size = 512;
 
 	mtx_lock(&malloc_mtx);
 	mt = malloc_desc2type("bus");	/* XXX M_BUS */
@@ -2362,12 +2363,12 @@ usb_notify_addq(const char *type, struct
 	if (mt == NULL)
 		return;
 
-	data = malloc(512, mt, M_NOWAIT);
+	data = malloc(buf_size, mt, M_NOWAIT);
 	if (data == NULL)
 		return;
 
 	/* String it all together. */
-	snprintf(data, 1024,
+	snprintf(data, buf_size,
 	    "%s"
 	    "%s "
 	    "vendor=0x%04x "

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:18:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B02CF1065692;
	Thu, 29 Oct 2009 23:18:59 +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 9B6E98FC08;
	Thu, 29 Oct 2009 23:18: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 n9TNIxOk014694;
	Thu, 29 Oct 2009 23:18:59 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNIxVD014692;
	Thu, 29 Oct 2009 23:18:59 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292318.n9TNIxVD014692@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:18:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198647 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:18:59 -0000

Author: thompsa
Date: Thu Oct 29 23:18:59 2009
New Revision: 198647
URL: http://svn.freebsd.org/changeset/base/198647

Log:
  MFC r197562
  
   Add extra safety locking when clobbering xfer->flags_int.started in start and
   stop functions, because xfer->flags_int is also updated by the USB controller,
   under the controller lock.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/8/sys/dev/usb/usb_transfer.c	Thu Oct 29 23:18:27 2009	(r198646)
+++ stable/8/sys/dev/usb/usb_transfer.c	Thu Oct 29 23:18:59 2009	(r198647)
@@ -1332,7 +1332,9 @@ usbd_setup_ctrl_transfer(struct usb_xfer
 	/* check if there is a length mismatch */
 
 	if (len > xfer->flags_int.control_rem) {
-		DPRINTFN(0, "Length greater than remaining length!\n");
+		DPRINTFN(0, "Length (%d) greater than "
+		    "remaining length (%d)!\n", len,
+		    xfer->flags_int.control_rem);
 		goto error;
 	}
 	/* check if we are doing a short transfer */
@@ -1620,7 +1622,10 @@ usbd_transfer_start(struct usb_xfer *xfe
 	/* mark the USB transfer started */
 
 	if (!xfer->flags_int.started) {
+		/* lock the BUS lock to avoid races updating flags_int */
+		USB_BUS_LOCK(xfer->xroot->bus);
 		xfer->flags_int.started = 1;
+		USB_BUS_UNLOCK(xfer->xroot->bus);
 	}
 	/* check if the USB transfer callback is already transferring */
 
@@ -1655,14 +1660,21 @@ usbd_transfer_stop(struct usb_xfer *xfer
 	/* check if the USB transfer was ever opened */
 
 	if (!xfer->flags_int.open) {
-		/* nothing to do except clearing the "started" flag */
-		xfer->flags_int.started = 0;
+		if (xfer->flags_int.started) {
+			/* nothing to do except clearing the "started" flag */
+			/* lock the BUS lock to avoid races updating flags_int */
+			USB_BUS_LOCK(xfer->xroot->bus);
+			xfer->flags_int.started = 0;
+			USB_BUS_UNLOCK(xfer->xroot->bus);
+		}
 		return;
 	}
 	/* try to stop the current USB transfer */
 
 	USB_BUS_LOCK(xfer->xroot->bus);
-	xfer->error = USB_ERR_CANCELLED;/* override any previous error */
+	/* override any previous error */
+	xfer->error = USB_ERR_CANCELLED;
+
 	/*
 	 * Clear "open" and "started" when both private and USB lock
 	 * is locked so that we don't get a race updating "flags_int"
@@ -2121,9 +2133,6 @@ usb_dma_delay_done_cb(void *arg)
 
 	DPRINTFN(3, "Completed %p\n", xfer);
 
-	/* only delay once */
-	xfer->flags_int.did_dma_delay = 1;
-
 	/* queue callback for execution, again */
 	usbd_transfer_done(xfer, 0);
 }
@@ -2193,6 +2202,8 @@ usbd_transfer_done(struct usb_xfer *xfer
 	 */
 	if (!xfer->flags_int.transferring) {
 		DPRINTF("not transferring\n");
+		/* end of control transfer, if any */
+		xfer->flags_int.control_act = 0;
 		return;
 	}
 	/* only set transfer error if not already set */
@@ -2491,6 +2502,9 @@ usbd_callback_wrapper_sub(struct usb_xfe
 
 		usb_timeout_t temp;
 
+		/* only delay once */
+		xfer->flags_int.did_dma_delay = 1;
+
 		/* we can not cancel this delay */
 		xfer->flags_int.can_cancel_immed = 0;
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:19:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CFDC210656BF;
	Thu, 29 Oct 2009 23:19:41 +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 B9CB78FC12;
	Thu, 29 Oct 2009 23:19: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 n9TNJfem014760;
	Thu, 29 Oct 2009 23:19:41 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNJftq014755;
	Thu, 29 Oct 2009 23:19:41 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292319.n9TNJftq014755@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:19:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198648 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:19:42 -0000

Author: thompsa
Date: Thu Oct 29 23:19:41 2009
New Revision: 198648
URL: http://svn.freebsd.org/changeset/base/198648

Log:
  MFC r197563
  
   Add basic support for USB Network Control Model (NCM) v1.0 to if_cdce.c.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_cdce.c
  stable/8/sys/dev/usb/net/if_cdcereg.h
  stable/8/sys/dev/usb/usb.h
  stable/8/sys/dev/usb/usb_cdc.h
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_cdce.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:18:59 2009	(r198647)
+++ stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:19:41 2009	(r198648)
@@ -40,6 +40,11 @@
  * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf
  */
 
+/*
+ * USB Network Control Model (NCM)
+ * http://www.usb.org/developers/devclass_docs/NCM10.zip
+ */
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -89,6 +94,11 @@ static usb_callback_t cdce_bulk_read_cal
 static usb_callback_t cdce_intr_read_callback;
 static usb_callback_t cdce_intr_write_callback;
 
+#if CDCE_HAVE_NCM
+static usb_callback_t cdce_ncm_bulk_write_callback;
+static usb_callback_t cdce_ncm_bulk_read_callback;
+#endif
+
 static uether_fn_t cdce_attach_post;
 static uether_fn_t cdce_init;
 static uether_fn_t cdce_stop;
@@ -159,6 +169,61 @@ static const struct usb_config cdce_conf
 	},
 };
 
+#if CDCE_HAVE_NCM
+static const struct usb_config cdce_ncm_config[CDCE_N_TRANSFER] = {
+
+	[CDCE_BULK_RX] = {
+		.type = UE_BULK,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_RX,
+		.if_index = 0,
+		.frames = CDCE_NCM_RX_FRAMES_MAX,
+		.bufsize = (CDCE_NCM_RX_FRAMES_MAX * CDCE_NCM_RX_MAXLEN),
+		.flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,},
+		.callback = cdce_ncm_bulk_read_callback,
+		.timeout = 0,	/* no timeout */
+		.usb_mode = USB_MODE_DUAL,	/* both modes */
+	},
+
+	[CDCE_BULK_TX] = {
+		.type = UE_BULK,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_TX,
+		.if_index = 0,
+		.frames = CDCE_NCM_TX_FRAMES_MAX,
+		.bufsize = (CDCE_NCM_TX_FRAMES_MAX * CDCE_NCM_TX_MAXLEN),
+		.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
+		.callback = cdce_ncm_bulk_write_callback,
+		.timeout = 10000,	/* 10 seconds */
+		.usb_mode = USB_MODE_DUAL,	/* both modes */
+	},
+
+	[CDCE_INTR_RX] = {
+		.type = UE_INTERRUPT,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_RX,
+		.if_index = 1,
+		.bufsize = CDCE_IND_SIZE_MAX,
+		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,.no_pipe_ok = 1,},
+		.callback = cdce_intr_read_callback,
+		.timeout = 0,
+		.usb_mode = USB_MODE_HOST,
+	},
+
+	[CDCE_INTR_TX] = {
+		.type = UE_INTERRUPT,
+		.endpoint = UE_ADDR_ANY,
+		.direction = UE_DIR_TX,
+		.if_index = 1,
+		.bufsize = CDCE_IND_SIZE_MAX,
+		.flags = {.pipe_bof = 1,.force_short_xfer = 1,.no_pipe_ok = 1,},
+		.callback = cdce_intr_write_callback,
+		.timeout = 10000,	/* 10 seconds */
+		.usb_mode = USB_MODE_DEVICE,
+	},
+};
+#endif
+
 static device_method_t cdce_methods[] = {
 	/* USB interface */
 	DEVMETHOD(usb_handle_request, cdce_handle_request),
@@ -213,8 +278,151 @@ static const struct usb_device_id cdce_d
 
 	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)},
 	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)},
+	{USB_IF_CSI(UICLASS_CDC, UISUBCLASS_NETWORK_CONTROL_MODEL, 0)},
 };
 
+#if CDCE_HAVE_NCM
+/*------------------------------------------------------------------------*
+ *	cdce_ncm_init
+ *
+ * Return values:
+ * 0: Success
+ * Else: Failure
+ *------------------------------------------------------------------------*/
+static uint8_t
+cdce_ncm_init(struct cdce_softc *sc)
+{
+	struct usb_ncm_parameters temp;
+	struct usb_device_request req;
+	uDWord value;
+	int err;
+
+	req.bmRequestType = UT_READ_CLASS_INTERFACE;
+	req.bRequest = UCDC_NCM_GET_NTB_PARAMETERS;
+	USETW(req.wValue, 0);
+	req.wIndex[0] = sc->sc_ifaces_index[1];
+	req.wIndex[1] = 0;
+	USETW(req.wLength, sizeof(temp));
+
+	err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req,
+	    &temp, 0, NULL, 1000 /* ms */);
+	if (err)
+		return (1);
+
+	/* Read correct set of parameters according to device mode */
+
+	if (usbd_get_mode(sc->sc_ue.ue_udev) == USB_MODE_HOST) {
+		sc->sc_ncm.rx_max = UGETW(temp.dwNtbInMaxSize);
+		sc->sc_ncm.tx_max = UGETW(temp.dwNtbOutMaxSize);
+		sc->sc_ncm.tx_remainder = UGETW(temp.wNdpOutPayloadRemainder);
+		sc->sc_ncm.tx_modulus = UGETW(temp.wNdpOutDivisor);
+		sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpOutAlignment);
+	} else {
+		sc->sc_ncm.rx_max = UGETW(temp.dwNtbOutMaxSize);
+		sc->sc_ncm.tx_max = UGETW(temp.dwNtbInMaxSize);
+		sc->sc_ncm.tx_remainder = UGETW(temp.wNdpInPayloadRemainder);
+		sc->sc_ncm.tx_modulus = UGETW(temp.wNdpInDivisor);
+		sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpInAlignment);
+	}
+
+	/* Verify maximum receive length */
+
+	if (err || (sc->sc_ncm.rx_max < 32) || 
+	    (sc->sc_ncm.rx_max > CDCE_NCM_RX_MAXLEN)) {
+		DPRINTFN(1, "Using default maximum receive length\n");
+		sc->sc_ncm.rx_max = CDCE_NCM_RX_MAXLEN;
+	}
+
+	/* Verify maximum transmit length */
+
+	if (err || (sc->sc_ncm.tx_max < 32) ||
+	    (sc->sc_ncm.tx_max > CDCE_NCM_TX_MAXLEN)) {
+		DPRINTFN(1, "Using default maximum transmit length\n");
+		sc->sc_ncm.tx_max = CDCE_NCM_TX_MAXLEN;
+	}
+
+	/* 
+	 * Verify that the structure alignment is:
+	 * - power of two
+	 * - not greater than the maximum transmit length
+	 * - not less than four bytes
+	 */
+	if (err || (sc->sc_ncm.tx_struct_align < 4) ||
+	    (sc->sc_ncm.tx_struct_align != 
+	     ((-sc->sc_ncm.tx_struct_align) & sc->sc_ncm.tx_struct_align)) ||
+	    (sc->sc_ncm.tx_struct_align >= sc->sc_ncm.tx_max)) {
+		DPRINTFN(1, "Using default other alignment: 4 bytes\n");
+		sc->sc_ncm.tx_struct_align = 4;
+	}
+
+	/* 
+	 * Verify that the payload alignment is:
+	 * - power of two
+	 * - not greater than the maximum transmit length
+	 * - not less than four bytes
+	 */
+	if (err || (sc->sc_ncm.tx_modulus < 4) ||
+	    (sc->sc_ncm.tx_modulus !=
+	     ((-sc->sc_ncm.tx_modulus) & sc->sc_ncm.tx_modulus)) ||
+	    (sc->sc_ncm.tx_modulus >= sc->sc_ncm.tx_max)) {
+		DPRINTFN(1, "Using default transmit modulus: 4 bytes\n");
+		sc->sc_ncm.tx_modulus = 4;
+	}
+
+	/* Verify that the payload remainder */
+
+	if (err || (sc->sc_ncm.tx_remainder >= sc->sc_ncm.tx_modulus)) {
+		DPRINTFN(1, "Using default transmit remainder: 0 bytes\n");
+		sc->sc_ncm.tx_remainder = 0;
+	}
+
+	/* Additional configuration, will fail in device side mode, which is OK. */
+
+	req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
+	req.bRequest = UCDC_NCM_SET_NTB_INPUT_SIZE;
+	USETW(req.wValue, 0);
+	req.wIndex[0] = sc->sc_ifaces_index[1];
+	req.wIndex[1] = 0;
+	USETW(req.wLength, 4);
+	USETDW(value, sc->sc_ncm.rx_max);
+
+	err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req,
+	    &value, 0, NULL, 1000 /* ms */);
+	if (err) {
+		DPRINTFN(1, "Setting input size "
+		    "to %u failed.\n", sc->sc_ncm.rx_max);
+	}
+
+	req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
+	req.bRequest = UCDC_NCM_SET_CRC_MODE;
+	USETW(req.wValue, 0);	/* no CRC */
+	req.wIndex[0] = sc->sc_ifaces_index[1];
+	req.wIndex[1] = 0;
+	USETW(req.wLength, 0);
+
+	err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req,
+	    NULL, 0, NULL, 1000 /* ms */);
+	if (err) {
+		DPRINTFN(1, "Setting CRC mode to off failed.\n");
+	}
+
+	req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
+	req.bRequest = UCDC_NCM_SET_NTB_FORMAT;
+	USETW(req.wValue, 0);	/* NTB-16 */
+	req.wIndex[0] = sc->sc_ifaces_index[1];
+	req.wIndex[1] = 0;
+	USETW(req.wLength, 0);
+
+	err = usbd_do_request_flags(sc->sc_ue.ue_udev, NULL, &req,
+	    NULL, 0, NULL, 1000 /* ms */);
+	if (err) {
+		DPRINTFN(1, "Setting NTB format to 16-bit failed.\n");
+	}
+
+	return (0);		/* success */
+}
+#endif
+
 static int
 cdce_probe(device_t dev)
 {
@@ -240,31 +448,31 @@ cdce_attach(device_t dev)
 	const struct usb_cdc_union_descriptor *ud;
 	const struct usb_interface_descriptor *id;
 	const struct usb_cdc_ethernet_descriptor *ued;
+	const struct usb_config *pcfg;
 	int error;
 	uint8_t i;
+	uint8_t data_iface_no;
 	char eaddr_str[5 * ETHER_ADDR_LEN];	/* approx */
 
 	sc->sc_flags = USB_GET_DRIVER_INFO(uaa);
+	sc->sc_ue.ue_udev = uaa->device;
 
 	device_set_usb_desc(dev);
 
 	mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF);
 
-	if (sc->sc_flags & CDCE_FLAG_NO_UNION) {
-		sc->sc_ifaces_index[0] = uaa->info.bIfaceIndex;
-		sc->sc_ifaces_index[1] = uaa->info.bIfaceIndex;
-		sc->sc_data_iface_no = 0;	/* not used */
-		goto alloc_transfers;
-	}
 	ud = usbd_find_descriptor
 	    (uaa->device, NULL, uaa->info.bIfaceIndex,
 	    UDESC_CS_INTERFACE, 0 - 1, UDESCSUB_CDC_UNION, 0 - 1);
 
-	if ((ud == NULL) || (ud->bLength < sizeof(*ud))) {
-		device_printf(dev, "no union descriptor!\n");
-		goto detach;
+	if ((ud == NULL) || (ud->bLength < sizeof(*ud)) ||
+	    (sc->sc_flags & CDCE_FLAG_NO_UNION)) {
+		DPRINTFN(1, "No union descriptor!\n");
+		sc->sc_ifaces_index[0] = uaa->info.bIfaceIndex;
+		sc->sc_ifaces_index[1] = uaa->info.bIfaceIndex;
+		goto alloc_transfers;
 	}
-	sc->sc_data_iface_no = ud->bSlaveInterface[0];
+	data_iface_no = ud->bSlaveInterface[0];
 
 	for (i = 0;; i++) {
 
@@ -274,8 +482,7 @@ cdce_attach(device_t dev)
 
 			id = usbd_get_interface_descriptor(iface);
 
-			if (id && (id->bInterfaceNumber ==
-			    sc->sc_data_iface_no)) {
+			if (id && (id->bInterfaceNumber == data_iface_no)) {
 				sc->sc_ifaces_index[0] = i;
 				sc->sc_ifaces_index[1] = uaa->info.bIfaceIndex;
 				usbd_set_parent_iface(uaa->device, i, uaa->info.bIfaceIndex);
@@ -312,24 +519,30 @@ cdce_attach(device_t dev)
 
 alloc_transfers:
 
-	for (i = 0; i != 32; i++) {
+	pcfg = cdce_config;	/* Default Configuration */
 
-		error = usbd_set_alt_interface_index
-		    (uaa->device, sc->sc_ifaces_index[0], i);
+	for (i = 0; i != 32; i++) {
 
-		if (error) {
-			device_printf(dev, "no valid alternate "
-			    "setting found!\n");
-			goto detach;
-		}
-		error = usbd_transfer_setup
-		    (uaa->device, sc->sc_ifaces_index,
-		    sc->sc_xfer, cdce_config, CDCE_N_TRANSFER,
-		    sc, &sc->sc_mtx);
+		error = usbd_set_alt_interface_index(uaa->device,
+		    sc->sc_ifaces_index[0], i);
+		if (error)
+			break;
+#if CDCE_HAVE_NCM
+		if ((i == 0) && (cdce_ncm_init(sc) == 0))
+			pcfg = cdce_ncm_config;
+#endif
+		error = usbd_transfer_setup(uaa->device,
+		    sc->sc_ifaces_index, sc->sc_xfer,
+		    pcfg, CDCE_N_TRANSFER, sc, &sc->sc_mtx);
 
-		if (error == 0) {
+		if (error == 0)
 			break;
-		}
+	}
+
+	if (error || (i == 32)) {
+		device_printf(dev, "No valid alternate "
+		    "setting found!\n");
+		goto detach;
 	}
 
 	ued = usbd_find_descriptor
@@ -768,3 +981,328 @@ cdce_handle_request(device_t dev,
 {
 	return (ENXIO);			/* use builtin handler */
 }
+
+#if CDCE_HAVE_NCM
+static uint8_t
+cdce_ncm_fill_tx_frames(struct usb_xfer *xfer, uint8_t index)
+{
+	struct cdce_softc *sc = usbd_xfer_softc(xfer);
+	struct ifnet *ifp = uether_getifp(&sc->sc_ue);
+	struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, index);
+	struct mbuf *m;
+	uint32_t rem;
+	uint32_t offset;
+	uint32_t last_offset;
+	uint32_t n;
+
+	usbd_xfer_set_frame_offset(xfer, index * CDCE_NCM_TX_MAXLEN, index);
+
+	offset = sizeof(sc->sc_ncm.hdr) +
+	    sizeof(sc->sc_ncm.dpt) + sizeof(sc->sc_ncm.dp);
+
+	/* Store last valid offset before alignment */
+	last_offset = offset;
+
+	/* Align offset correctly */
+	offset = sc->sc_ncm.tx_remainder -
+	    ((0UL - offset) & (0UL - sc->sc_ncm.tx_modulus));
+
+	for (n = 0; n != CDCE_NCM_SUBFRAMES_MAX; n++) {
+
+		/* check if end of transmit buffer is reached */
+
+		if (offset >= sc->sc_ncm.tx_max)
+			break;
+
+		/* compute maximum buffer size */
+
+		rem = sc->sc_ncm.tx_max - offset;
+
+		IFQ_DRV_DEQUEUE(&(ifp->if_snd), m);
+
+		if (m == NULL)
+			break;
+
+		if (m->m_pkthdr.len > rem) {
+			if (n == 0) {
+				/* The frame won't fit in our buffer */
+				DPRINTFN(1, "Frame too big to be transmitted!\n");
+				m_freem(m);
+				ifp->if_oerrors++;
+				n--;
+				continue;
+			}
+			/* Wait till next buffer becomes ready */
+			IFQ_DRV_PREPEND(&(ifp->if_snd), m);
+			break;
+		}
+		usbd_m_copy_in(pc, offset, m, 0, m->m_pkthdr.len);
+
+		USETW(sc->sc_ncm.dp[n].wFrameLength, m->m_pkthdr.len);
+		USETW(sc->sc_ncm.dp[n].wFrameIndex, offset);
+
+		/* Update offset */
+		offset += m->m_pkthdr.len;
+
+		/* Store last valid offset before alignment */
+		last_offset = offset;
+
+		/* Align offset correctly */
+		offset = sc->sc_ncm.tx_remainder - 
+		    ((0UL - offset) & (0UL - sc->sc_ncm.tx_modulus));
+
+		/*
+		 * If there's a BPF listener, bounce a copy
+		 * of this frame to him:
+		 */
+		BPF_MTAP(ifp, m);
+
+		/* Free mbuf */
+
+		m_freem(m);
+
+		/* Pre-increment interface counter */
+
+		ifp->if_opackets++;
+	}
+
+	if (n == 0)
+		return (1);
+
+	rem = (sizeof(sc->sc_ncm.dpt) + (4 * n) + 4);
+
+	USETW(sc->sc_ncm.dpt.wLength, rem);
+
+	/* zero the rest of the data pointer entries */
+	for (; n != CDCE_NCM_SUBFRAMES_MAX; n++) {
+		USETW(sc->sc_ncm.dp[n].wFrameLength, 0);
+		USETW(sc->sc_ncm.dp[n].wFrameIndex, 0);
+	}
+
+	/* set frame length */
+	usbd_xfer_set_frame_len(xfer, index, last_offset);
+
+	/* Fill out 16-bit header */
+	sc->sc_ncm.hdr.dwSignature[0] = 'N';
+	sc->sc_ncm.hdr.dwSignature[1] = 'C';
+	sc->sc_ncm.hdr.dwSignature[2] = 'M';
+	sc->sc_ncm.hdr.dwSignature[3] = 'H';
+	USETW(sc->sc_ncm.hdr.wHeaderLength, sizeof(sc->sc_ncm.hdr));
+	USETW(sc->sc_ncm.hdr.wBlockLength, offset);
+	USETW(sc->sc_ncm.hdr.wSequence, sc->sc_ncm.tx_seq);
+	USETW(sc->sc_ncm.hdr.wDptIndex, sizeof(sc->sc_ncm.hdr));
+
+	sc->sc_ncm.tx_seq++;
+
+	/* Fill out 16-bit frame table header */
+	sc->sc_ncm.dpt.dwSignature[0] = 'N';
+	sc->sc_ncm.dpt.dwSignature[1] = 'C';
+	sc->sc_ncm.dpt.dwSignature[2] = 'M';
+	sc->sc_ncm.dpt.dwSignature[3] = 'x';
+	USETW(sc->sc_ncm.dpt.wNextNdpIndex, 0);		/* reserved */
+
+	usbd_copy_in(pc, 0, &(sc->sc_ncm.hdr), sizeof(sc->sc_ncm.hdr));
+	usbd_copy_in(pc, sizeof(sc->sc_ncm.hdr), &(sc->sc_ncm.dpt),
+	    sizeof(sc->sc_ncm.dpt));
+	usbd_copy_in(pc, sizeof(sc->sc_ncm.hdr) + sizeof(sc->sc_ncm.dpt),
+	    &(sc->sc_ncm.dp), sizeof(sc->sc_ncm.dp));
+	return (0);
+}
+
+static void
+cdce_ncm_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct cdce_softc *sc = usbd_xfer_softc(xfer);
+	struct ifnet *ifp = uether_getifp(&sc->sc_ue);
+	uint16_t x;
+	int actlen;
+	int aframes;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+
+		usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL);
+
+		DPRINTFN(10, "transfer complete: "
+		    "%u bytes in %u frames\n", actlen, aframes);
+
+	case USB_ST_SETUP:
+		for (x = 0; x != CDCE_NCM_TX_FRAMES_MAX; x++) {
+			if (cdce_ncm_fill_tx_frames(xfer, x))
+				break;
+		}
+
+		if (x != 0) {
+			usbd_xfer_set_frames(xfer, x);
+			usbd_transfer_submit(xfer);
+		}
+		break;
+
+	default:			/* Error */
+		DPRINTFN(10, "Transfer error: %s\n",
+		    usbd_errstr(error));
+
+		/* update error counter */
+		ifp->if_oerrors += 1;
+
+		if (error != USB_ERR_CANCELLED) {
+			/* try to clear stall first */
+			usbd_xfer_set_stall(xfer);
+			usbd_xfer_set_frames(xfer, 0);
+			usbd_transfer_submit(xfer);
+		}
+		break;
+	}
+}
+
+static void
+cdce_ncm_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct cdce_softc *sc = usbd_xfer_softc(xfer);
+	struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, 0);
+	struct ifnet *ifp = uether_getifp(&sc->sc_ue);
+	struct mbuf *m;
+	int sumdata;
+	int sumlen;
+	int actlen;
+	int aframes;
+	int temp;
+	int nframes;
+	int x;
+	int offset;
+
+	switch (USB_GET_STATE(xfer)) {
+	case USB_ST_TRANSFERRED:
+
+		usbd_xfer_status(xfer, &actlen, &sumlen, &aframes, NULL);
+
+		DPRINTFN(1, "received %u bytes in %u frames\n",
+		    actlen, aframes);
+
+		if (actlen < (sizeof(sc->sc_ncm.hdr) +
+		    sizeof(sc->sc_ncm.dpt))) {
+			DPRINTFN(1, "frame too short\n");
+			goto tr_stall;
+		}
+		usbd_copy_out(pc, 0, &(sc->sc_ncm.hdr),
+		    sizeof(sc->sc_ncm.hdr));
+
+		if ((sc->sc_ncm.hdr.dwSignature[0] != 'N') ||
+		    (sc->sc_ncm.hdr.dwSignature[1] != 'C') ||
+		    (sc->sc_ncm.hdr.dwSignature[2] != 'M') ||
+		    (sc->sc_ncm.hdr.dwSignature[3] != 'H')) {
+			DPRINTFN(1, "invalid HDR signature\n");
+			goto tr_stall;
+		}
+		temp = UGETW(sc->sc_ncm.hdr.wBlockLength);
+		if (temp > sumlen) {
+			DPRINTFN(1, "unsupported block length %u/%u\n",
+			    temp, sumlen);
+			goto tr_stall;
+		}
+		temp = UGETW(sc->sc_ncm.hdr.wDptIndex);
+		if ((temp + sizeof(sc->sc_ncm.dpt)) > actlen) {
+			DPRINTFN(1, "invalid DPT index\n");
+			goto tr_stall;
+		}
+		usbd_copy_out(pc, temp, &(sc->sc_ncm.dpt),
+		    sizeof(sc->sc_ncm.dpt));
+
+		if ((sc->sc_ncm.dpt.dwSignature[0] != 'N') ||
+		    (sc->sc_ncm.dpt.dwSignature[1] != 'C') ||
+		    (sc->sc_ncm.dpt.dwSignature[2] != 'M') ||
+		    (sc->sc_ncm.dpt.dwSignature[3] != 'x')) {
+			DPRINTFN(1, "invalid DPT signature\n");
+			goto tr_stall;
+		}
+		nframes = UGETW(sc->sc_ncm.dpt.wLength) / 4;
+
+		/* Subtract size of header and last zero padded entry */
+		if (nframes >= (2 + 1))
+			nframes -= (2 + 1);
+		else
+			nframes = 0;
+
+		DPRINTFN(1, "nframes = %u\n", nframes);
+
+		temp += sizeof(sc->sc_ncm.dpt);
+
+		if ((temp + (4 * nframes)) > actlen)
+			goto tr_stall;
+
+		if (nframes > CDCE_NCM_SUBFRAMES_MAX) {
+			DPRINTFN(1, "Truncating number of frames from %u to %u\n",
+			    nframes, CDCE_NCM_SUBFRAMES_MAX);
+			nframes = CDCE_NCM_SUBFRAMES_MAX;
+		}
+		usbd_copy_out(pc, temp, &(sc->sc_ncm.dp), (4 * nframes));
+
+		sumdata = 0;
+
+		for (x = 0; x != nframes; x++) {
+
+			offset = UGETW(sc->sc_ncm.dp[x].wFrameIndex);
+			temp = UGETW(sc->sc_ncm.dp[x].wFrameLength);
+			if ((offset + temp) > actlen) {
+				DPRINTFN(1, "invalid frame detected (ignored)\n");
+				m = NULL;
+
+			} else if (temp >= sizeof(struct ether_header)) {
+				/*
+				 * allocate a suitable memory buffer, if
+				 * possible
+				 */
+				if (temp > (MCLBYTES - ETHER_ALIGN)) {
+					m = NULL;
+					continue;
+				} if (temp > (MHLEN - ETHER_ALIGN)) {
+					m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+				} else {
+					m = m_gethdr(M_DONTWAIT, MT_DATA);
+				}
+			} else {
+				m = NULL;	/* dump it */
+			}
+
+			DPRINTFN(16, "frame %u, offset = %u, length = %u \n",
+			    x, offset, temp);
+
+			/* check if we have a buffer */
+			if (m) {
+				m_adj(m, ETHER_ALIGN);
+
+				usbd_copy_out(pc, offset, m->m_data, temp);
+
+				/* enqueue */
+				uether_rxmbuf(&sc->sc_ue, m, temp);
+
+				sumdata += temp;
+			} else {
+				ifp->if_ierrors++;
+			}
+		}
+
+		DPRINTFN(1, "Efficiency: %u/%u bytes\n", sumdata, actlen);
+
+	case USB_ST_SETUP:
+		usbd_xfer_set_frame_len(xfer, 0, sc->sc_ncm.rx_max);
+		usbd_xfer_set_frames(xfer, 1);
+		usbd_transfer_submit(xfer);
+		uether_rxflush(&sc->sc_ue);	/* must be last */
+		break;
+
+	default:			/* Error */
+		DPRINTFN(1, "error = %s\n",
+		    usbd_errstr(error));
+
+		if (error != USB_ERR_CANCELLED) {
+tr_stall:
+			/* try to clear stall first */
+			usbd_xfer_set_stall(xfer);
+			usbd_xfer_set_frames(xfer, 0);
+			usbd_transfer_submit(xfer);
+		}
+		break;
+	}
+}
+#endif

Modified: stable/8/sys/dev/usb/net/if_cdcereg.h
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdcereg.h	Thu Oct 29 23:18:59 2009	(r198647)
+++ stable/8/sys/dev/usb/net/if_cdcereg.h	Thu Oct 29 23:19:41 2009	(r198648)
@@ -38,6 +38,18 @@
 #define	CDCE_FRAMES_MAX	8		/* units */
 #define	CDCE_IND_SIZE_MAX 32            /* bytes */
 
+#define	CDCE_NCM_TX_MAXLEN 2048UL	/* bytes */
+#define	CDCE_NCM_TX_FRAMES_MAX 8	/* units */
+
+#define	CDCE_NCM_RX_MAXLEN (1UL << 14)	/* bytes */
+#define	CDCE_NCM_RX_FRAMES_MAX 1	/* units */
+
+#define	CDCE_NCM_SUBFRAMES_MAX 32	/* units */
+
+#ifndef CDCE_HAVE_NCM
+#define	CDCE_HAVE_NCM 1
+#endif
+
 enum {
 	CDCE_BULK_RX,
 	CDCE_BULK_TX,
@@ -46,9 +58,24 @@ enum {
 	CDCE_N_TRANSFER,
 };
 
+struct cdce_ncm {
+	struct usb_ncm16_hdr hdr;
+	struct usb_ncm16_dpt dpt;
+	struct usb_ncm16_dp dp[CDCE_NCM_SUBFRAMES_MAX];
+	uint32_t rx_max;
+	uint32_t tx_max;
+	uint16_t tx_remainder;
+	uint16_t tx_modulus;
+	uint16_t tx_struct_align;
+	uint16_t tx_seq;
+};
+
 struct cdce_softc {
 	struct usb_ether	sc_ue;
 	struct mtx		sc_mtx;
+#if CDCE_HAVE_NCM
+	struct cdce_ncm		sc_ncm;
+#endif
 	struct usb_xfer	*sc_xfer[CDCE_N_TRANSFER];
 	struct mbuf		*sc_rx_buf[CDCE_FRAMES_MAX];
 	struct mbuf		*sc_tx_buf[CDCE_FRAMES_MAX];
@@ -59,7 +86,6 @@ struct cdce_softc {
 #define	CDCE_FLAG_RX_DATA	0x0010
 
 	uint8_t sc_eaddr_str_index;
-	uint8_t	sc_data_iface_no;
 	uint8_t	sc_ifaces_index[2];
 };
 

Modified: stable/8/sys/dev/usb/usb.h
==============================================================================
--- stable/8/sys/dev/usb/usb.h	Thu Oct 29 23:18:59 2009	(r198647)
+++ stable/8/sys/dev/usb/usb.h	Thu Oct 29 23:19:41 2009	(r198648)
@@ -424,9 +424,9 @@ typedef struct usb_interface_assoc_descr
 #define	UISUBCLASS_MOBILE_DIRECT_LINE_MODEL 10
 #define	UISUBCLASS_OBEX 11
 #define	UISUBCLASS_ETHERNET_EMULATION_MODEL 12
+#define	UISUBCLASS_NETWORK_CONTROL_MODEL 13
 
 #define	UIPROTO_CDC_AT			1
-#define	UIPROTO_CDC_ETH_512X4 0x76	/* FreeBSD specific */
 
 #define	UICLASS_HID		0x03
 #define	UISUBCLASS_BOOT		1
@@ -461,7 +461,7 @@ typedef struct usb_interface_assoc_descr
 #define	UIPROTO_HSHUBMTT	1
 
 #define	UICLASS_CDC_DATA	0x0a
-#define	UISUBCLASS_DATA		0
+#define	UISUBCLASS_DATA		0x00
 #define	UIPROTO_DATA_ISDNBRI		0x30	/* Physical iface */
 #define	UIPROTO_DATA_HDLC		0x31	/* HDLC */
 #define	UIPROTO_DATA_TRANSPARENT	0x32	/* Transparent */
@@ -475,6 +475,7 @@ typedef struct usb_interface_assoc_descr
 #define	UIPROTO_DATA_HOST_BASED		0xfd	/* Host based driver */
 #define	UIPROTO_DATA_PUF		0xfe	/* see Prot. Unit Func. Desc. */
 #define	UIPROTO_DATA_VENDOR		0xff	/* Vendor specific */
+#define	UIPROTO_DATA_NCM		0x01	/* Network Control Model */
 
 #define	UICLASS_SMARTCARD	0x0b
 #define	UICLASS_FIRM_UPD	0x0c

Modified: stable/8/sys/dev/usb/usb_cdc.h
==============================================================================
--- stable/8/sys/dev/usb/usb_cdc.h	Thu Oct 29 23:18:59 2009	(r198647)
+++ stable/8/sys/dev/usb/usb_cdc.h	Thu Oct 29 23:19:41 2009	(r198648)
@@ -188,4 +188,107 @@ struct usb_cdc_notification {
 #define	UCDC_MDM_PARITY_ERR		0x20
 #define	UCDC_MDM_OVERRUN_ERR		0x40
 
+/*
+ * Network Control Model, NCM16 + NCM32, protocol definitions
+ */
+struct usb_ncm16_hdr {
+	uDWord	dwSignature;
+	uWord	wHeaderLength;
+	uWord	wSequence;
+	uWord	wBlockLength;
+	uWord	wDptIndex;
+} __packed;
+
+struct usb_ncm16_dp {
+	uWord	wFrameIndex;
+	uWord	wFrameLength;
+} __packed;
+
+struct usb_ncm16_dpt {
+	uDWord	dwSignature;
+	uWord	wLength;
+	uWord	wNextNdpIndex;
+	struct usb_ncm16_dp dp[0];
+} __packed;
+
+struct usb_ncm32_hdr {
+	uDWord	dwSignature;
+	uWord	wHeaderLength;
+	uWord	wSequence;
+	uDWord	dwBlockLength;
+	uDWord	dwDptIndex;
+} __packed;
+
+struct usb_ncm32_dp {
+	uDWord	dwFrameIndex;
+	uDWord	dwFrameLength;
+} __packed;
+
+struct usb_ncm32_dpt {
+	uDWord	dwSignature;
+	uWord	wLength;
+	uWord	wReserved6;
+	uDWord	dwNextNdpIndex;
+	uDWord	dwReserved12;
+	struct usb_ncm32_dp dp[0];
+} __packed;
+
+/* Communications interface class specific descriptors */
+
+#define	UCDC_NCM_FUNC_DESC_SUBTYPE	0x1A
+
+struct usb_ncm_func_descriptor {
+	uByte	bLength;
+	uByte	bDescriptorType;
+	uByte	bDescriptorSubtype;
+	uByte	bcdNcmVersion[2];
+	uByte	bmNetworkCapabilities;
+#define	UCDC_NCM_CAP_FILTER	0x01
+#define	UCDC_NCM_CAP_MAC_ADDR	0x02
+#define	UCDC_NCM_CAP_ENCAP	0x04
+#define	UCDC_NCM_CAP_MAX_DATA	0x08
+#define	UCDC_NCM_CAP_CRCMODE	0x10
+} __packed;
+
+/* Communications interface specific class request codes */
+
+#define	UCDC_NCM_SET_ETHERNET_MULTICAST_FILTERS			0x40
+#define	UCDC_NCM_SET_ETHERNET_POWER_MGMT_PATTERN_FILTER		0x41
+#define	UCDC_NCM_GET_ETHERNET_POWER_MGMT_PATTERN_FILTER		0x42
+#define	UCDC_NCM_SET_ETHERNET_PACKET_FILTER			0x43
+#define	UCDC_NCM_GET_ETHERNET_STATISTIC				0x44
+#define	UCDC_NCM_GET_NTB_PARAMETERS				0x80
+#define	UCDC_NCM_GET_NET_ADDRESS				0x81
+#define	UCDC_NCM_SET_NET_ADDRESS				0x82
+#define	UCDC_NCM_GET_NTB_FORMAT					0x83
+#define	UCDC_NCM_SET_NTB_FORMAT					0x84
+#define	UCDC_NCM_GET_NTB_INPUT_SIZE				0x85
+#define	UCDC_NCM_SET_NTB_INPUT_SIZE				0x86
+#define	UCDC_NCM_GET_MAX_DATAGRAM_SIZE				0x87
+#define	UCDC_NCM_SET_MAX_DATAGRAM_SIZE				0x88
+#define	UCDC_NCM_GET_CRC_MODE					0x89
+#define	UCDC_NCM_SET_CRC_MODE					0x8A
+
+struct usb_ncm_parameters {
+	uWord	wLength;
+	uWord	bmNtbFormatsSupported;
+#define	UCDC_NCM_FORMAT_NTB16	0x0001
+#define	UCDC_NCM_FORMAT_NTB32	0x0002
+	uDWord	dwNtbInMaxSize;
+	uWord	wNdpInDivisor;
+	uWord	wNdpInPayloadRemainder;
+	uWord	wNdpInAlignment;
+	uWord	wReserved14;
+	uDWord	dwNtbOutMaxSize;
+	uWord	wNdpOutDivisor;
+	uWord	wNdpOutPayloadRemainder;
+	uWord	wNdpOutAlignment;
+	uWord	wReserved26;
+} __packed;
+
+/* Communications interface specific class notification codes */
+#define	UCDC_NCM_NOTIF_NETWORK_CONNECTION	0x00
+#define	UCDC_NCM_NOTIF_RESPONSE_AVAILABLE	0x01
+#define	UCDC_NCM_NOTIF_CONNECTION_SPEED_CHANGE	0x2A
+
 #endif					/* _USB_CDC_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:20:15 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 91C1C106568F;
	Thu, 29 Oct 2009 23:20:15 +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 63E238FC14;
	Thu, 29 Oct 2009 23:20: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 n9TNKFnI014825;
	Thu, 29 Oct 2009 23:20:15 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNKF5A014823;
	Thu, 29 Oct 2009 23:20:15 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292320.n9TNKF5A014823@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:20:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198649 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:20:15 -0000

Author: thompsa
Date: Thu Oct 29 23:20:15 2009
New Revision: 198649
URL: http://svn.freebsd.org/changeset/base/198649

Log:
  MFC r197564
  
   Add new usbdev entries for Marvell, FTDI, Option and Western.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usbdevs
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usbdevs
==============================================================================
--- stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:19:41 2009	(r198648)
+++ stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:20:15 2009	(r198649)
@@ -659,6 +659,7 @@ vendor 3COM2		0x6891	3Com
 vendor INTEL		0x8086	Intel
 vendor SITECOM2		0x9016	Sitecom
 vendor MOSCHIP		0x9710	MosChip Semiconductor
+vendor MARVELL		0x9e88	Marvell Technology Group Ltd.
 vendor 3COM3		0xa727	3Com
 vendor HP2		0xf003	Hewlett Packard
 vendor USRP		0xfffe	GNU Radio USRP
@@ -1336,6 +1337,9 @@ product FTDI CFA_633		0xfc0b	Crystalfont
 product FTDI CFA_631		0xfc0c	Crystalfontz CFA-631 USB LCD
 product FTDI CFA_635		0xfc0d	Crystalfontz CFA-635 USB LCD
 product FTDI SEMC_DSS20		0xfc82	SEMC DSS-20 SyncStation
+/* Commerzielle und Technische Informationssysteme GmbH products */
+product FTDI CTI_USB_NANO_485	0xf60b	CTI USB-Nano 485
+product FTDI CTI_USB_MINI_485	0xf608	CTI USB-Mini 485
 
 /* Fuji photo products */
 product FUJIPHOTO MASS0100	0x0100	Mass Storage
@@ -1691,6 +1695,9 @@ product LUWEN EASYDISK		0x0005	EasyDisc
 /* Macally products */
 product MACALLY MOUSE1		0x0101	mouse
 
+/* Marvell Technology Group, Ltd. products */
+product MARVELL SHEEVAPLUG	0x9e8f	SheevaPlug serial interface
+
 /* MCT Corp. */
 product MCT HUB0100		0x0100	Hub
 product MCT DU_H3SP_USB232	0x0200	D-Link DU-H3SP USB BAY Hub
@@ -1940,6 +1947,8 @@ product OPTION GTICON322	0xd033	GlobeTro
 product OPTION GTMAX36		0x6701	GlobeTrotter Max 3.6 Modem
 product OPTION GTHSDPA		0x6971	GlobeTrotter HSDPA
 product OPTION GTMAXHSUPA	0x7001	GlobeTrotter HSUPA
+product OPTION GTMAXHSUPAE	0x6901	GlobeTrotter HSUPA PCIe
+product OPTION GTMAX380HSUPAE	0x7211	GlobeTrotter 380HSUPA PCIe
 
 /* OQO */
 product OQO WIFI01		0x0002	model 01 WiFi interface
@@ -2504,6 +2513,7 @@ product WESTERN COMBO		0x0200	Firewire U
 product WESTERN EXTHDD		0x0400	External HDD
 product WESTERN HUB		0x0500	USB HUB
 product WESTERN MYBOOK		0x0901	MyBook External HDD
+product WESTERN MYPASSWORD	0x0704	MyPassword External HDD
 
 /* Windbond Electronics */
 product WINBOND UH104		0x5518	4-port USB Hub

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:20:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F8191065754;
	Thu, 29 Oct 2009 23:20:48 +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 2AF5F8FC27;
	Thu, 29 Oct 2009 23:20: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 n9TNKlmY014881;
	Thu, 29 Oct 2009 23:20:47 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNKlGc014879;
	Thu, 29 Oct 2009 23:20:47 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292320.n9TNKlGc014879@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:20:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198650 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/storage dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:20:48 -0000

Author: thompsa
Date: Thu Oct 29 23:20:47 2009
New Revision: 198650
URL: http://svn.freebsd.org/changeset/base/198650

Log:
  MFC r197565
  
   - Remove SAMSUNG_YP_U2 now that it is in the cam layer
   - Add quirk from Tobias Grosser for Western Mypassword

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:20:15 2009	(r198649)
+++ stable/8/sys/dev/usb/storage/umass.c	Thu Oct 29 23:20:47 2009	(r198650)
@@ -750,10 +750,6 @@ static const struct umass_devdescr umass
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		IGNORE_RESIDUE | NO_START_STOP
 	},
-	{USB_VENDOR_SAMSUNG, USB_PRODUCT_SAMSUNG_YP_U2, RID_WILDCARD,
-		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
-		SHUTTLE_INIT | NO_GETMAXLUN
-	},
 	{USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, RID_WILDCARD,
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		NO_INQUIRY
@@ -950,6 +946,10 @@ static const struct umass_devdescr umass
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		NO_INQUIRY_EVPD
 	},
+	{USB_VENDOR_WESTERN, USB_PRODUCT_WESTERN_MYPASSWORD, RID_WILDCARD,
+		UMASS_PROTO_DEFAULT,
+		FORCE_SHORT_INQUIRY
+	},
 	{USB_VENDOR_WINMAXGROUP, USB_PRODUCT_WINMAXGROUP_FLASH64MC, RID_WILDCARD,
 		UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 		NO_INQUIRY

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:21:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5495610656A3;
	Thu, 29 Oct 2009 23:21:21 +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 400458FC16;
	Thu, 29 Oct 2009 23:21:21 +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 n9TNLLXs014943;
	Thu, 29 Oct 2009 23:21:21 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNLL0Z014941;
	Thu, 29 Oct 2009 23:21:21 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292321.n9TNLL0Z014941@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:21:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198651 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:21:21 -0000

Author: thompsa
Date: Thu Oct 29 23:21:20 2009
New Revision: 198651
URL: http://svn.freebsd.org/changeset/base/198651

Log:
  MFC r197566
  
   Increase the rx buffer size to 16384 bytes, this increases RX performance from
   50Mbps to 220Mbps on PLANEX GU-1000T.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_axe.c	Thu Oct 29 23:20:47 2009	(r198650)
+++ stable/8/sys/dev/usb/net/if_axe.c	Thu Oct 29 23:21:20 2009	(r198651)
@@ -205,10 +205,7 @@ static const struct usb_config axe_confi
 		.type = UE_BULK,
 		.endpoint = UE_ADDR_ANY,
 		.direction = UE_DIR_IN,
-#if (MCLBYTES < 2048)
-#error "(MCLBYTES < 2048)"
-#endif
-		.bufsize = MCLBYTES,
+		.bufsize = 16384,	/* bytes */
 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
 		.callback = axe_bulk_read_callback,
 		.timeout = 0,	/* no timeout */
@@ -777,7 +774,7 @@ axe_bulk_read_callback(struct usb_xfer *
 	struct ifnet *ifp = uether_getifp(ue);
 	struct axe_sframe_hdr hdr;
 	struct usb_page_cache *pc;
-	int err, pos, len, adjust;
+	int err, pos, len;
 	int actlen;
 
 	usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
@@ -785,50 +782,42 @@ axe_bulk_read_callback(struct usb_xfer *
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
 		pos = 0;
+		len = 0;
+		err = 0;
+
 		pc = usbd_xfer_get_frame(xfer, 0);
-		while (1) {
-			if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
-				if (actlen < sizeof(hdr)) {
+		if (sc->sc_flags & (AXE_FLAG_772 | AXE_FLAG_178)) {
+			while (pos < actlen) {
+				if ((pos + sizeof(hdr)) > actlen) {
 					/* too little data */
+					err = EINVAL;
 					break;
 				}
 				usbd_copy_out(pc, pos, &hdr, sizeof(hdr));
 
 				if ((hdr.len ^ hdr.ilen) != 0xFFFF) {
 					/* we lost sync */
+					err = EINVAL;
 					break;
 				}
-				actlen -= sizeof(hdr);
 				pos += sizeof(hdr);
 
 				len = le16toh(hdr.len);
-				if (len > actlen) {
+				if ((pos + len) > actlen) {
 					/* invalid length */
+					err = EINVAL;
 					break;
 				}
-				adjust = (len & 1);
-
-			} else {
-				len = actlen;
-				adjust = 0;
-			}
-			err = uether_rxbuf(ue, pc, pos, len);
-			if (err)
-				break;
-
-			pos += len;
-			actlen -= len;
+				err = uether_rxbuf(ue, pc, pos, len);
 
-			if (actlen <= adjust) {
-				/* we are finished */
-				goto tr_setup;
+				pos += len + (len % 2);
 			}
-			pos += adjust;
-			actlen -= adjust;
+		} else {
+			err = uether_rxbuf(ue, pc, 0, actlen);
 		}
 
-		/* count an error */
-		ifp->if_ierrors++;
+		if (err != 0)
+			ifp->if_ierrors++;
 
 		/* FALLTHROUGH */
 	case USB_ST_SETUP:
@@ -1011,7 +1000,15 @@ axe_init(struct usb_ether *ue)
 	/* Enable receiver, set RX mode */
 	rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
 	if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {
+#if 0
 		rxmode |= AXE_178_RXCMD_MFB_2048;	/* chip default */
+#else
+		/*
+		 * Default Rx buffer size is too small to get
+		 * maximum performance.
+		 */
+		rxmode |= AXE_178_RXCMD_MFB_16384;
+#endif
 	} else {
 		rxmode |= AXE_172_RXCMD_UNICAST;
 	}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:21:52 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8640B10656B0;
	Thu, 29 Oct 2009 23:21:52 +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 71B988FC1A;
	Thu, 29 Oct 2009 23:21: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 n9TNLqsN014999;
	Thu, 29 Oct 2009 23:21:52 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNLqBR014997;
	Thu, 29 Oct 2009 23:21:52 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292321.n9TNLqBR014997@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:21:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198652 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:21:52 -0000

Author: thompsa
Date: Thu Oct 29 23:21:52 2009
New Revision: 198652
URL: http://svn.freebsd.org/changeset/base/198652

Log:
  MFC r197567
  
   Allow setting of MAC address for AXE based ethernet adapters.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_axe.c	Thu Oct 29 23:21:20 2009	(r198651)
+++ stable/8/sys/dev/usb/net/if_axe.c	Thu Oct 29 23:21:52 2009	(r198652)
@@ -982,10 +982,11 @@ axe_init(struct usb_ether *ue)
 	/* Cancel pending I/O */
 	axe_stop(ue);
 
-#ifdef notdef
-	/* Set MAC address */
-	axe_mac(sc, IF_LLADDR(ifp), 1);
-#endif
+	/* Set MAC address. */
+	if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772))
+		axe_cmd(sc, AXE_178_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp));
+	else
+		axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp));
 
 	/* Set transmitter IPG values */
 	if (sc->sc_flags & (AXE_FLAG_178 | AXE_FLAG_772)) {

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:22:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BA8DD10656A6;
	Thu, 29 Oct 2009 23:22: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 A60898FC18;
	Thu, 29 Oct 2009 23:22: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 n9TNMNMF015091;
	Thu, 29 Oct 2009 23:22:23 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNMNsK015089;
	Thu, 29 Oct 2009 23:22:23 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292322.n9TNMNsK015089@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:22:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198653 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:22:23 -0000

Author: thompsa
Date: Thu Oct 29 23:22:23 2009
New Revision: 198653
URL: http://svn.freebsd.org/changeset/base/198653

Log:
  MFC r197568
  
   add more device IDs

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/u3g.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/u3g.c
==============================================================================
--- stable/8/sys/dev/usb/serial/u3g.c	Thu Oct 29 23:21:52 2009	(r198652)
+++ stable/8/sys/dev/usb/serial/u3g.c	Thu Oct 29 23:22:23 2009	(r198653)
@@ -180,6 +180,8 @@ static const struct usb_device_id u3g_de
 	U3G_DEV(OPTION, GTMAX36, 0),
 	U3G_DEV(OPTION, GTHSDPA, 0),
 	U3G_DEV(OPTION, GTMAXHSUPA, 0),
+	U3G_DEV(OPTION, GTMAXHSUPAE, 0),
+	U3G_DEV(OPTION, GTMAX380HSUPAE, 0),
 	U3G_DEV(OPTION, VODAFONEMC3G, 0),
 	/* OEM: Qualcomm, Inc. */
 	U3G_DEV(QUALCOMMINC, ZTE_STOR, U3GFL_SCSI_EJECT),
@@ -204,6 +206,7 @@ static const struct usb_device_id u3g_de
 	U3G_DEV(NOVATEL, X950D, 0),
 	U3G_DEV(NOVATEL, XU870, 0),
 	U3G_DEV(NOVATEL, ZEROCD, U3GFL_SCSI_EJECT),
+	U3G_DEV(NOVATEL, U760, U3GFL_SCSI_EJECT),
 	U3G_DEV(DELL, U740, 0),
 	/* OEM: Merlin */
 	U3G_DEV(MERLIN, V620, 0),

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:22:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B21591065694;
	Thu, 29 Oct 2009 23:22:54 +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 9DA8F8FC0C;
	Thu, 29 Oct 2009 23:22: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 n9TNMsd9015179;
	Thu, 29 Oct 2009 23:22:54 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNMsM1015177;
	Thu, 29 Oct 2009 23:22:54 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292322.n9TNMsM1015177@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:22:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198654 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/quirk dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:22:54 -0000

Author: thompsa
Date: Thu Oct 29 23:22:54 2009
New Revision: 198654
URL: http://svn.freebsd.org/changeset/base/198654

Log:
  MFC r197569
  
   Add a config number quirk for the ELSA_MODEM1

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/quirk/usb_quirk.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c
==============================================================================
--- stable/8/sys/dev/usb/quirk/usb_quirk.c	Thu Oct 29 23:22:23 2009	(r198653)
+++ stable/8/sys/dev/usb/quirk/usb_quirk.c	Thu Oct 29 23:22:54 2009	(r198654)
@@ -94,6 +94,7 @@ static struct usb_quirk_entry usb_quirks
 	{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_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)},
 
 	/*
 	 * XXX The following quirks should have a more specific revision

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:23:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BFD881065694;
	Thu, 29 Oct 2009 23:23:34 +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 AA0658FC16;
	Thu, 29 Oct 2009 23:23: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 n9TNNYdB015298;
	Thu, 29 Oct 2009 23:23:34 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNNYvk015280;
	Thu, 29 Oct 2009 23:23:34 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292323.n9TNNYvk015280@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:23:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198655 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:23:34 -0000

Author: thompsa
Date: Thu Oct 29 23:23:34 2009
New Revision: 198655
URL: http://svn.freebsd.org/changeset/base/198655

Log:
  MFC r197570
  
   Add experimental support for usb serial console and polled mode during DDB.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/uark.c
  stable/8/sys/dev/usb/serial/ubsa.c
  stable/8/sys/dev/usb/serial/ubser.c
  stable/8/sys/dev/usb/serial/uchcom.c
  stable/8/sys/dev/usb/serial/ucycom.c
  stable/8/sys/dev/usb/serial/ufoma.c
  stable/8/sys/dev/usb/serial/uftdi.c
  stable/8/sys/dev/usb/serial/ugensa.c
  stable/8/sys/dev/usb/serial/uipaq.c
  stable/8/sys/dev/usb/serial/umct.c
  stable/8/sys/dev/usb/serial/umodem.c
  stable/8/sys/dev/usb/serial/umoscom.c
  stable/8/sys/dev/usb/serial/uplcom.c
  stable/8/sys/dev/usb/serial/usb_serial.c
  stable/8/sys/dev/usb/serial/usb_serial.h
  stable/8/sys/dev/usb/serial/uslcom.c
  stable/8/sys/dev/usb/serial/uvscom.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uark.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uark.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uark.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -114,6 +114,7 @@ static void	uark_cfg_get_status(struct u
 		    uint8_t *);
 static void	uark_cfg_set_break(struct ucom_softc *, uint8_t);
 static void	uark_cfg_write(struct uark_softc *, uint16_t, uint16_t);
+static void	uark_poll(struct ucom_softc *ucom);
 
 static const struct usb_config
 	uark_xfer_config[UARK_N_TRANSFER] = {
@@ -146,6 +147,7 @@ static const struct ucom_callback uark_c
 	.ucom_stop_read = &uark_stop_read,
 	.ucom_start_write = &uark_start_write,
 	.ucom_stop_write = &uark_stop_write,
+	.ucom_poll = &uark_poll,
 };
 
 static device_method_t uark_methods[] = {
@@ -431,3 +433,10 @@ uark_cfg_write(struct uark_softc *sc, ui
 		    "(ignored)\n", usbd_errstr(err));
 	}
 }
+
+static void
+uark_poll(struct ucom_softc *ucom)
+{
+	struct uark_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UARK_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/ubsa.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ubsa.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/ubsa.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -194,6 +194,7 @@ static void	ubsa_start_write(struct ucom
 static void	ubsa_stop_write(struct ucom_softc *);
 static void	ubsa_cfg_get_status(struct ucom_softc *, uint8_t *,
 		    uint8_t *);
+static void	ubsa_poll(struct ucom_softc *ucom);
 
 static const struct usb_config ubsa_config[UBSA_N_TRANSFER] = {
 
@@ -236,6 +237,7 @@ static const struct ucom_callback ubsa_c
 	.ucom_stop_read = &ubsa_stop_read,
 	.ucom_start_write = &ubsa_start_write,
 	.ucom_stop_write = &ubsa_stop_write,
+	.ucom_poll = &ubsa_poll,
 };
 
 static const struct usb_device_id ubsa_devs[] = {
@@ -659,3 +661,11 @@ tr_setup:
 
 	}
 }
+
+static void
+ubsa_poll(struct ucom_softc *ucom)
+{
+	struct ubsa_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UBSA_N_TRANSFER);
+
+}

Modified: stable/8/sys/dev/usb/serial/ubser.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ubser.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/ubser.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -163,6 +163,7 @@ static void	ubser_start_read(struct ucom
 static void	ubser_stop_read(struct ucom_softc *);
 static void	ubser_start_write(struct ucom_softc *);
 static void	ubser_stop_write(struct ucom_softc *);
+static void	ubser_poll(struct ucom_softc *ucom);
 
 static const struct usb_config ubser_config[UBSER_N_TRANSFER] = {
 
@@ -193,6 +194,7 @@ static const struct ucom_callback ubser_
 	.ucom_stop_read = &ubser_stop_read,
 	.ucom_start_write = &ubser_start_write,
 	.ucom_stop_write = &ubser_stop_write,
+	.ucom_poll = &ubser_poll,
 };
 
 static device_method_t ubser_methods[] = {
@@ -535,3 +537,10 @@ ubser_stop_write(struct ucom_softc *ucom
 
 	usbd_transfer_stop(sc->sc_xfer[UBSER_BULK_DT_WR]);
 }
+
+static void
+ubser_poll(struct ucom_softc *ucom)
+{
+	struct ubser_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UBSER_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/uchcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uchcom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uchcom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -230,6 +230,7 @@ static void	uchcom_set_dte_rate(struct u
 static void	uchcom_set_line_control(struct uchcom_softc *, tcflag_t);
 static void	uchcom_clear_chip(struct uchcom_softc *);
 static void	uchcom_reset_chip(struct uchcom_softc *);
+static void	uchcom_poll(struct ucom_softc *ucom);
 
 static device_probe_t uchcom_probe;
 static device_attach_t uchcom_attach;
@@ -280,6 +281,7 @@ static struct ucom_callback uchcom_callb
 	.ucom_stop_read = &uchcom_stop_read,
 	.ucom_start_write = &uchcom_start_write,
 	.ucom_stop_write = &uchcom_stop_write,
+	.ucom_poll = &uchcom_poll,
 };
 
 /* ----------------------------------------------------------------------
@@ -888,6 +890,13 @@ tr_setup:
 	}
 }
 
+static void
+uchcom_poll(struct ucom_softc *ucom)
+{
+	struct uchcom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UCHCOM_N_TRANSFER);
+}
+
 static device_method_t uchcom_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe, uchcom_probe),

Modified: stable/8/sys/dev/usb/serial/ucycom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ucycom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/ucycom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -124,6 +124,7 @@ static void	ucycom_stop_write(struct uco
 static void	ucycom_cfg_write(struct ucycom_softc *, uint32_t, uint8_t);
 static int	ucycom_pre_param(struct ucom_softc *, struct termios *);
 static void	ucycom_cfg_param(struct ucom_softc *, struct termios *);
+static void	ucycom_poll(struct ucom_softc *ucom);
 
 static const struct usb_config ucycom_config[UCYCOM_N_TRANSFER] = {
 
@@ -154,6 +155,7 @@ static const struct ucom_callback ucycom
 	.ucom_stop_read = &ucycom_stop_read,
 	.ucom_start_write = &ucycom_start_write,
 	.ucom_stop_write = &ucycom_stop_write,
+	.ucom_poll = &ucycom_poll,
 };
 
 static device_method_t ucycom_methods[] = {
@@ -578,3 +580,10 @@ tr_setup:
 
 	}
 }
+
+static void
+ucycom_poll(struct ucom_softc *ucom)
+{
+	struct ucycom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UCYCOM_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/ufoma.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ufoma.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/ufoma.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -230,13 +230,13 @@ static void	ufoma_start_read(struct ucom
 static void	ufoma_stop_read(struct ucom_softc *);
 static void	ufoma_start_write(struct ucom_softc *);
 static void	ufoma_stop_write(struct ucom_softc *);
+static void	ufoma_poll(struct ucom_softc *ucom);
 
 /*sysctl stuff*/
 static int ufoma_sysctl_support(SYSCTL_HANDLER_ARGS);
 static int ufoma_sysctl_current(SYSCTL_HANDLER_ARGS);
 static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS);
 
-
 static const struct usb_config
 	ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = {
 
@@ -304,6 +304,7 @@ static const struct ucom_callback ufoma_
 	.ucom_stop_read = &ufoma_stop_read,
 	.ucom_start_write = &ufoma_start_write,
 	.ucom_stop_write = &ufoma_stop_write,
+	.ucom_poll = &ufoma_poll,
 };
 
 static device_method_t ufoma_methods[] = {
@@ -1241,3 +1242,11 @@ static int ufoma_sysctl_open(SYSCTL_HAND
 	
 	return EINVAL;
 }
+
+static void
+ufoma_poll(struct ucom_softc *ucom)
+{
+	struct ufoma_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_ctrl_xfer, UFOMA_CTRL_ENDPT_MAX);
+	usbd_transfer_poll(sc->sc_bulk_xfer, UFOMA_BULK_ENDPT_MAX);
+}

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uftdi.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uftdi.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -156,6 +156,7 @@ static void	uftdi_stop_read(struct ucom_
 static void	uftdi_start_write(struct ucom_softc *);
 static void	uftdi_stop_write(struct ucom_softc *);
 static uint8_t	uftdi_8u232am_getrate(uint32_t, uint16_t *);
+static void	uftdi_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uftdi_config[UFTDI_N_TRANSFER] = {
 
@@ -190,6 +191,7 @@ static const struct ucom_callback uftdi_
 	.ucom_stop_read = &uftdi_stop_read,
 	.ucom_start_write = &uftdi_start_write,
 	.ucom_stop_write = &uftdi_stop_write,
+	.ucom_poll = &uftdi_poll,
 };
 
 static device_method_t uftdi_methods[] = {
@@ -808,3 +810,10 @@ done:
 	*rate = result;
 	return (0);
 }
+
+static void
+uftdi_poll(struct ucom_softc *ucom)
+{
+	struct uftdi_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UFTDI_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/ugensa.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ugensa.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/ugensa.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -110,9 +110,9 @@ static void	ugensa_start_read(struct uco
 static void	ugensa_stop_read(struct ucom_softc *);
 static void	ugensa_start_write(struct ucom_softc *);
 static void	ugensa_stop_write(struct ucom_softc *);
+static void	ugensa_poll(struct ucom_softc *ucom);
 
-static const struct usb_config
-	ugensa_xfer_config[UGENSA_N_TRANSFER] = {
+static const struct usb_config ugensa_xfer_config[UGENSA_N_TRANSFER] = {
 
 	[UGENSA_BULK_DT_WR] = {
 		.type = UE_BULK,
@@ -138,6 +138,7 @@ static const struct ucom_callback ugensa
 	.ucom_stop_read = &ugensa_stop_read,
 	.ucom_start_write = &ugensa_start_write,
 	.ucom_stop_write = &ugensa_stop_write,
+	.ucom_poll = &ugensa_poll,
 };
 
 static device_method_t ugensa_methods[] = {
@@ -369,3 +370,12 @@ ugensa_stop_write(struct ucom_softc *uco
 
 	usbd_transfer_stop(ssc->sc_xfer[UGENSA_BULK_DT_WR]);
 }
+
+static void
+ugensa_poll(struct ucom_softc *ucom)
+{
+	struct ugensa_softc *sc = ucom->sc_parent;
+	struct ugensa_sub_softc *ssc = sc->sc_sub + ucom->sc_portno;
+
+	usbd_transfer_poll(ssc->sc_xfer, UGENSA_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/uipaq.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uipaq.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uipaq.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -122,6 +122,7 @@ static void	uipaq_stop_write(struct ucom
 static void	uipaq_cfg_set_dtr(struct ucom_softc *, uint8_t);
 static void	uipaq_cfg_set_rts(struct ucom_softc *, uint8_t);
 static void	uipaq_cfg_set_break(struct ucom_softc *, uint8_t);
+static void	uipaq_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER] = {
 
@@ -152,6 +153,7 @@ static const struct ucom_callback uipaq_
 	.ucom_stop_read = &uipaq_stop_read,
 	.ucom_start_write = &uipaq_start_write,
 	.ucom_stop_write = &uipaq_stop_write,
+	.ucom_poll = &uipaq_poll,
 };
 
 /*
@@ -1342,3 +1344,10 @@ tr_setup:
 		return;
 	}
 }
+
+static void
+uipaq_poll(struct ucom_softc *ucom)
+{
+	struct uipaq_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UIPAQ_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/umct.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umct.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/umct.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -142,6 +142,7 @@ static void	umct_start_read(struct ucom_
 static void	umct_stop_read(struct ucom_softc *);
 static void	umct_start_write(struct ucom_softc *);
 static void	umct_stop_write(struct ucom_softc *);
+static void	umct_poll(struct ucom_softc *ucom);
 
 static const struct usb_config umct_config[UMCT_N_TRANSFER] = {
 
@@ -186,6 +187,7 @@ static const struct ucom_callback umct_c
 	.ucom_stop_read = &umct_stop_read,
 	.ucom_start_write = &umct_start_write,
 	.ucom_stop_write = &umct_stop_write,
+	.ucom_poll = &umct_poll,
 };
 
 static const struct usb_device_id umct_devs[] = {
@@ -603,3 +605,10 @@ tr_setup:
 		return;
 	}
 }
+
+static void
+umct_poll(struct ucom_softc *ucom)
+{
+	struct umct_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UMCT_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/umodem.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umodem.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/umodem.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -196,6 +196,7 @@ static void	umodem_cfg_set_break(struct 
 static void	*umodem_get_desc(struct usb_attach_arg *, uint8_t, uint8_t);
 static usb_error_t umodem_set_comm_feature(struct usb_device *, uint8_t,
 		    uint16_t, uint16_t);
+static void	umodem_poll(struct ucom_softc *ucom);
 
 static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = {
 
@@ -242,6 +243,7 @@ static const struct ucom_callback umodem
 	.ucom_stop_read = &umodem_stop_read,
 	.ucom_start_write = &umodem_start_write,
 	.ucom_stop_write = &umodem_stop_write,
+	.ucom_poll = &umodem_poll,
 };
 
 static device_method_t umodem_methods[] = {
@@ -810,3 +812,10 @@ umodem_detach(device_t dev)
 
 	return (0);
 }
+
+static void
+umodem_poll(struct ucom_softc *ucom)
+{
+	struct umodem_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UMODEM_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/umoscom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umoscom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/umoscom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -210,6 +210,7 @@ static void	umoscom_start_read(struct uc
 static void	umoscom_stop_read(struct ucom_softc *);
 static void	umoscom_start_write(struct ucom_softc *);
 static void	umoscom_stop_write(struct ucom_softc *);
+static void	umoscom_poll(struct ucom_softc *ucom);
 
 static const struct usb_config umoscom_config_data[UMOSCOM_N_TRANSFER] = {
 
@@ -257,6 +258,7 @@ static const struct ucom_callback umosco
 	.ucom_stop_read = &umoscom_stop_read,
 	.ucom_start_write = &umoscom_start_write,
 	.ucom_stop_write = &umoscom_stop_write,
+	.ucom_poll = &umoscom_poll,
 };
 
 static device_method_t umoscom_methods[] = {
@@ -694,3 +696,10 @@ tr_setup:
 		return;
 	}
 }
+
+static void
+umoscom_poll(struct ucom_softc *ucom)
+{
+	struct umoscom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UMOSCOM_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/uplcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uplcom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uplcom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -186,6 +186,7 @@ static void	uplcom_start_write(struct uc
 static void	uplcom_stop_write(struct ucom_softc *);
 static void	uplcom_cfg_get_status(struct ucom_softc *, uint8_t *,
 		    uint8_t *);
+static void	uplcom_poll(struct ucom_softc *ucom);
 
 static device_probe_t uplcom_probe;
 static device_attach_t uplcom_attach;
@@ -239,6 +240,7 @@ static struct ucom_callback uplcom_callb
 	.ucom_stop_read = &uplcom_stop_read,
 	.ucom_start_write = &uplcom_start_write,
 	.ucom_stop_write = &uplcom_stop_write,
+	.ucom_poll = &uplcom_poll,
 };
 
 #define	USB_UPL(v,p,rl,rh,t)				\
@@ -862,3 +864,10 @@ tr_setup:
 		return;
 	}
 }
+
+static void
+uplcom_poll(struct ucom_softc *ucom)
+{
+	struct uplcom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UPLCOM_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/usb_serial.c
==============================================================================
--- stable/8/sys/dev/usb/serial/usb_serial.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/usb_serial.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -98,14 +100,40 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include "opt_gdb.h"
+
+SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom");
+
 #if USB_DEBUG
 static int ucom_debug = 0;
 
-SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom");
 SYSCTL_INT(_hw_usb_ucom, OID_AUTO, debug, CTLFLAG_RW,
     &ucom_debug, 0, "ucom debug level");
 #endif
 
+#define	UCOM_CONS_BUFSIZE 1024
+
+static uint8_t ucom_cons_rx_buf[UCOM_CONS_BUFSIZE];
+static uint8_t ucom_cons_tx_buf[UCOM_CONS_BUFSIZE];
+
+static unsigned int ucom_cons_rx_low = 0;
+static unsigned int ucom_cons_rx_high = 0;
+
+static unsigned int ucom_cons_tx_low = 0;
+static unsigned int ucom_cons_tx_high = 0;
+
+static int ucom_cons_unit = -1;
+static int ucom_cons_baud = 9600;
+static struct ucom_softc *ucom_cons_softc = NULL;
+
+TUNABLE_INT("hw.usb.ucom.cons_unit", &ucom_cons_unit);
+SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_unit, CTLFLAG_RW,
+    &ucom_cons_unit, 0, "console unit number");
+
+TUNABLE_INT("hw.usb.ucom.cons_baud", &ucom_cons_baud);
+SYSCTL_INT(_hw_usb_ucom, OID_AUTO, cons_baud, CTLFLAG_RW,
+    &ucom_cons_baud, 0, "console baud rate");
+
 static usb_proc_callback_t ucom_cfg_start_transfers;
 static usb_proc_callback_t ucom_cfg_open;
 static usb_proc_callback_t ucom_cfg_close;
@@ -121,6 +149,7 @@ static void	ucom_queue_command(struct uc
 		    usb_proc_callback_t *, struct termios *pt,
 		    struct usb_proc_msg *t0, struct usb_proc_msg *t1);
 static void	ucom_shutdown(struct ucom_softc *);
+static void	ucom_ring(struct ucom_softc *, uint8_t);
 static void	ucom_break(struct ucom_softc *, uint8_t);
 static void	ucom_dtr(struct ucom_softc *, uint8_t);
 static void	ucom_rts(struct ucom_softc *, uint8_t);
@@ -147,7 +176,7 @@ static struct ttydevsw ucom_class = {
 MODULE_DEPEND(ucom, usb, 1, 1, 1);
 MODULE_VERSION(ucom, 1);
 
-#define	UCOM_UNIT_MAX 0x1000		/* exclusive */
+#define	UCOM_UNIT_MAX 0x200		/* exclusive */
 #define	UCOM_SUB_UNIT_MAX 0x100		/* exclusive */
 
 static uint8_t ucom_bitmap[(UCOM_UNIT_MAX + 7) / 8];
@@ -346,6 +375,29 @@ ucom_attach_tty(struct ucom_softc *sc, u
 	DPRINTF("ttycreate: %s\n", buf);
 	cv_init(&sc->sc_cv, "ucom");
 
+	/* Check if this device should be a console */
+	if ((ucom_cons_softc == NULL) && 
+	    (sc->sc_unit == ucom_cons_unit)) {
+
+		struct termios t;
+
+		ucom_cons_softc = sc;
+
+		memset(&t, 0, sizeof(t));
+		t.c_ispeed = ucom_cons_baud;
+		t.c_ospeed = t.c_ispeed;
+		t.c_cflag = CS8;
+
+		mtx_lock(ucom_cons_softc->sc_mtx);
+		ucom_cons_rx_low = 0;
+		ucom_cons_rx_high = 0;
+		ucom_cons_tx_low = 0;
+		ucom_cons_tx_high = 0;
+		sc->sc_flag |= UCOM_FLAG_CONSOLE;
+		ucom_open(ucom_cons_softc->sc_tty);
+		ucom_param(ucom_cons_softc->sc_tty, &t);
+		mtx_unlock(ucom_cons_softc->sc_mtx);
+	}
 done:
 	return (error);
 }
@@ -357,12 +409,18 @@ ucom_detach_tty(struct ucom_softc *sc)
 
 	DPRINTF("sc = %p, tp = %p\n", sc, sc->sc_tty);
 
+	if (sc->sc_flag & UCOM_FLAG_CONSOLE) {
+		mtx_lock(ucom_cons_softc->sc_mtx);
+		ucom_close(ucom_cons_softc->sc_tty);
+		mtx_unlock(ucom_cons_softc->sc_mtx);
+		ucom_cons_softc = NULL;
+	}
+
 	/* the config thread has been stopped when we get here */
 
 	mtx_lock(sc->sc_mtx);
 	sc->sc_flag |= UCOM_FLAG_GONE;
-	sc->sc_flag &= ~(UCOM_FLAG_HL_READY |
-	    UCOM_FLAG_LL_READY);
+	sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_LL_READY);
 	mtx_unlock(sc->sc_mtx);
 	if (tp) {
 		tty_lock(tp);
@@ -588,6 +646,8 @@ ucom_open(struct tty *tp)
 
 	ucom_modem(tp, SER_DTR | SER_RTS, 0);
 
+	ucom_ring(sc, 0);
+
 	ucom_break(sc, 0);
 
 	ucom_status_change(sc);
@@ -653,6 +713,16 @@ ucom_ioctl(struct tty *tp, u_long cmd, c
 	DPRINTF("cmd = 0x%08lx\n", cmd);
 
 	switch (cmd) {
+#if 0
+	case TIOCSRING:
+		ucom_ring(sc, 1);
+		error = 0;
+		break;
+	case TIOCCRING:
+		ucom_ring(sc, 0);
+		error = 0;
+		break;
+#endif
 	case TIOCSBRK:
 		ucom_break(sc, 1);
 		error = 0;
@@ -751,6 +821,8 @@ ucom_cfg_line_state(struct usb_proc_msg 
 		mask |= UCOM_LS_RTS;
 	if (sc->sc_callback->ucom_cfg_set_break)
 		mask |= UCOM_LS_BREAK;
+	if (sc->sc_callback->ucom_cfg_set_ring)
+		mask |= UCOM_LS_RING;
 
 	/* compute the bits we are to program */
 	notch_bits = (sc->sc_pls_set & sc->sc_pls_clr) & mask;
@@ -773,6 +845,9 @@ ucom_cfg_line_state(struct usb_proc_msg 
 	if (notch_bits & UCOM_LS_BREAK)
 		sc->sc_callback->ucom_cfg_set_break(sc,
 		    (prev_value & UCOM_LS_BREAK) ? 1 : 0);
+	if (notch_bits & UCOM_LS_RING)
+		sc->sc_callback->ucom_cfg_set_ring(sc,
+		    (prev_value & UCOM_LS_RING) ? 1 : 0);
 
 	/* set last value */
 	if (any_bits & UCOM_LS_DTR)
@@ -784,6 +859,9 @@ ucom_cfg_line_state(struct usb_proc_msg 
 	if (any_bits & UCOM_LS_BREAK)
 		sc->sc_callback->ucom_cfg_set_break(sc,
 		    (last_value & UCOM_LS_BREAK) ? 1 : 0);
+	if (any_bits & UCOM_LS_RING)
+		sc->sc_callback->ucom_cfg_set_ring(sc,
+		    (last_value & UCOM_LS_RING) ? 1 : 0);
 }
 
 static void
@@ -811,6 +889,17 @@ ucom_line_state(struct ucom_softc *sc,
 }
 
 static void
+ucom_ring(struct ucom_softc *sc, uint8_t onoff)
+{
+	DPRINTF("onoff = %d\n", onoff);
+
+	if (onoff)
+		ucom_line_state(sc, UCOM_LS_RING, 0);
+	else
+		ucom_line_state(sc, 0, UCOM_LS_RING);
+}
+
+static void
 ucom_break(struct ucom_softc *sc, uint8_t onoff)
 {
 	DPRINTF("onoff = %d\n", onoff);
@@ -895,6 +984,9 @@ ucom_status_change(struct ucom_softc *sc
 {
 	mtx_assert(sc->sc_mtx, MA_OWNED);
 
+	if (sc->sc_flag & UCOM_FLAG_CONSOLE)
+		return;		/* not supported */
+
 	if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) {
 		return;
 	}
@@ -1033,6 +1125,38 @@ ucom_get_data(struct ucom_softc *sc, str
 
 	mtx_assert(sc->sc_mtx, MA_OWNED);
 
+	if (sc->sc_flag & UCOM_FLAG_CONSOLE) {
+		unsigned int temp;
+
+		/* get total TX length */
+
+		temp = ucom_cons_tx_high - ucom_cons_tx_low;
+		temp %= UCOM_CONS_BUFSIZE;
+
+		/* limit TX length */
+
+		if (temp > (UCOM_CONS_BUFSIZE - ucom_cons_tx_low))
+			temp = (UCOM_CONS_BUFSIZE - ucom_cons_tx_low);
+
+		if (temp > len)
+			temp = len;
+
+		/* copy in data */
+
+		usbd_copy_in(pc, offset, ucom_cons_tx_buf + ucom_cons_tx_low, temp);
+
+		/* update counters */
+
+		ucom_cons_tx_low += temp;
+		ucom_cons_tx_low %= UCOM_CONS_BUFSIZE;
+
+		/* store actual length */
+
+		*actlen = temp;
+
+		return (temp ? 1 : 0);
+	}
+
 	if (tty_gone(tp) ||
 	    !(sc->sc_flag & UCOM_FLAG_GP_DATA)) {
 		actlen[0] = 0;
@@ -1080,6 +1204,34 @@ ucom_put_data(struct ucom_softc *sc, str
 
 	mtx_assert(sc->sc_mtx, MA_OWNED);
 
+	if (sc->sc_flag & UCOM_FLAG_CONSOLE) {
+		unsigned int temp;
+
+		/* get maximum RX length */
+
+		temp = (UCOM_CONS_BUFSIZE - 1) - ucom_cons_rx_high + ucom_cons_rx_low;
+		temp %= UCOM_CONS_BUFSIZE;
+
+		/* limit RX length */
+
+		if (temp > (UCOM_CONS_BUFSIZE - ucom_cons_rx_high))
+			temp = (UCOM_CONS_BUFSIZE - ucom_cons_rx_high);
+
+		if (temp > len)
+			temp = len;
+
+		/* copy out data */
+
+		usbd_copy_out(pc, offset, ucom_cons_rx_buf + ucom_cons_rx_high, temp);
+
+		/* update counters */
+
+		ucom_cons_rx_high += temp;
+		ucom_cons_rx_high %= UCOM_CONS_BUFSIZE;
+
+		return;
+	}
+
 	if (tty_gone(tp))
 		return;			/* multiport device polling */
 
@@ -1136,3 +1288,138 @@ ucom_free(void *xsc)
 	cv_signal(&sc->sc_cv);
 	mtx_unlock(sc->sc_mtx);
 }
+
+static cn_probe_t ucom_cnprobe;
+static cn_init_t ucom_cninit;
+static cn_term_t ucom_cnterm;
+static cn_getc_t ucom_cngetc;
+static cn_putc_t ucom_cnputc;
+
+CONSOLE_DRIVER(ucom);
+
+static void
+ucom_cnprobe(struct consdev  *cp)
+{
+	cp->cn_pri = CN_NORMAL;
+}
+
+static void
+ucom_cninit(struct consdev  *cp)
+{
+}
+
+static void
+ucom_cnterm(struct consdev  *cp)
+{
+}
+
+static int
+ucom_cngetc(struct consdev *cd)
+{
+	struct ucom_softc *sc = ucom_cons_softc;
+	int c;
+
+	if (sc == NULL)
+		return (-1);
+
+	mtx_lock(sc->sc_mtx);
+
+	if (ucom_cons_rx_low != ucom_cons_rx_high) {
+		c = ucom_cons_rx_buf[ucom_cons_rx_low];
+		ucom_cons_rx_low ++;
+		ucom_cons_rx_low %= UCOM_CONS_BUFSIZE;
+	} else {
+		c = -1;
+	}
+
+	/* start USB transfers */
+	ucom_outwakeup(sc->sc_tty);
+
+	mtx_unlock(sc->sc_mtx);
+
+	/* poll if necessary */
+	if (kdb_active && sc->sc_callback->ucom_poll)
+		(sc->sc_callback->ucom_poll) (sc);
+
+	return (c);
+}
+
+static void
+ucom_cnputc(struct consdev *cd, int c)
+{
+	struct ucom_softc *sc = ucom_cons_softc;
+	unsigned int temp;
+
+	if (sc == NULL)
+		return;
+
+ repeat:
+
+	mtx_lock(sc->sc_mtx);
+
+	/* compute maximum TX length */
+
+	temp = (UCOM_CONS_BUFSIZE - 1) - ucom_cons_tx_high + ucom_cons_tx_low;
+	temp %= UCOM_CONS_BUFSIZE;
+
+	if (temp) {
+		ucom_cons_tx_buf[ucom_cons_tx_high] = c;
+		ucom_cons_tx_high ++;
+		ucom_cons_tx_high %= UCOM_CONS_BUFSIZE;
+	}
+
+	/* start USB transfers */
+	ucom_outwakeup(sc->sc_tty);
+
+	mtx_unlock(sc->sc_mtx);
+
+	/* poll if necessary */
+	if (kdb_active && sc->sc_callback->ucom_poll) {
+		(sc->sc_callback->ucom_poll) (sc);
+		/* simple flow control */
+		if (temp == 0)
+			goto repeat;
+	}
+}
+
+#if defined(GDB)
+
+#include 
+
+static gdb_probe_f ucom_gdbprobe;
+static gdb_init_f ucom_gdbinit;
+static gdb_term_f ucom_gdbterm;
+static gdb_getc_f ucom_gdbgetc;
+static gdb_putc_f ucom_gdbputc;
+
+GDB_DBGPORT(sio, ucom_gdbprobe, ucom_gdbinit, ucom_gdbterm, ucom_gdbgetc, ucom_gdbputc);
+
+static int
+ucom_gdbprobe(void)
+{
+	return ((ucom_cons_softc != NULL) ? 0 : -1);
+}
+
+static void
+ucom_gdbinit(void)
+{
+}
+
+static void
+ucom_gdbterm(void)
+{
+}
+
+static void
+ucom_gdbputc(int c)
+{
+        ucom_cnputc(NULL, c);
+}
+
+static int
+ucom_gdbgetc(void)
+{
+        return (ucom_cngetc(NULL));
+}
+
+#endif

Modified: stable/8/sys/dev/usb/serial/usb_serial.h
==============================================================================
--- stable/8/sys/dev/usb/serial/usb_serial.h	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/usb_serial.h	Thu Oct 29 23:23:34 2009	(r198655)
@@ -94,6 +94,7 @@ struct ucom_callback {
 	void    (*ucom_cfg_set_dtr) (struct ucom_softc *, uint8_t);
 	void    (*ucom_cfg_set_rts) (struct ucom_softc *, uint8_t);
 	void    (*ucom_cfg_set_break) (struct ucom_softc *, uint8_t);
+	void    (*ucom_cfg_set_ring) (struct ucom_softc *, uint8_t);
 	void    (*ucom_cfg_param) (struct ucom_softc *, struct termios *);
 	void    (*ucom_cfg_open) (struct ucom_softc *);
 	void    (*ucom_cfg_close) (struct ucom_softc *);
@@ -105,6 +106,7 @@ struct ucom_callback {
 	void    (*ucom_start_write) (struct ucom_softc *);
 	void    (*ucom_stop_write) (struct ucom_softc *);
 	void    (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit);
+	void    (*ucom_poll) (struct ucom_softc *);
 };
 
 /* Line status register */
@@ -162,13 +164,14 @@ struct ucom_softc {
 	uint32_t sc_unit;
 	uint32_t sc_local_unit;
 	uint16_t sc_portno;
-	uint8_t	sc_flag;
+	uint16_t sc_flag;
 #define	UCOM_FLAG_RTS_IFLOW	0x01	/* use RTS input flow control */
 #define	UCOM_FLAG_GONE		0x02	/* the device is gone */
 #define	UCOM_FLAG_ATTACHED	0x04	/* set if attached */
 #define	UCOM_FLAG_GP_DATA	0x08	/* set if get and put data is possible */
 #define	UCOM_FLAG_LL_READY	0x20	/* set if low layer is ready */
 #define	UCOM_FLAG_HL_READY	0x40	/* set if high layer is ready */
+#define	UCOM_FLAG_CONSOLE	0x80	/* set if device is a console */
 	uint8_t	sc_lsr;
 	uint8_t	sc_msr;
 	uint8_t	sc_mcr;
@@ -180,6 +183,7 @@ struct ucom_softc {
 #define	UCOM_LS_DTR	0x01
 #define	UCOM_LS_RTS	0x02
 #define	UCOM_LS_BREAK	0x04
+#define	UCOM_LS_RING	0x08
 };
 
 #define	ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \

Modified: stable/8/sys/dev/usb/serial/uslcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uslcom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uslcom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -135,6 +135,7 @@ static void uslcom_start_read(struct uco
 static void uslcom_stop_read(struct ucom_softc *);
 static void uslcom_start_write(struct ucom_softc *);
 static void uslcom_stop_write(struct ucom_softc *);
+static void uslcom_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uslcom_config[USLCOM_N_TRANSFER] = {
 
@@ -170,6 +171,7 @@ static struct ucom_callback uslcom_callb
 	.ucom_stop_read = &uslcom_stop_read,
 	.ucom_start_write = &uslcom_start_write,
 	.ucom_stop_write = &uslcom_stop_write,
+	.ucom_poll = &uslcom_poll,
 };
 
 static const struct usb_device_id uslcom_devs[] = {
@@ -562,3 +564,10 @@ uslcom_stop_write(struct ucom_softc *uco
 
 	usbd_transfer_stop(sc->sc_xfer[USLCOM_BULK_DT_WR]);
 }
+
+static void
+uslcom_poll(struct ucom_softc *ucom)
+{
+	struct uslcom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, USLCOM_N_TRANSFER);
+}

Modified: stable/8/sys/dev/usb/serial/uvscom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uvscom.c	Thu Oct 29 23:22:54 2009	(r198654)
+++ stable/8/sys/dev/usb/serial/uvscom.c	Thu Oct 29 23:23:34 2009	(r198655)
@@ -185,6 +185,7 @@ static void	uvscom_cfg_get_status(struct
 		    uint8_t *);
 static void	uvscom_cfg_write(struct uvscom_softc *, uint8_t, uint16_t);
 static uint16_t	uvscom_cfg_read_status(struct uvscom_softc *);
+static void	uvscom_poll(struct ucom_softc *ucom);
 
 static const struct usb_config uvscom_config[UVSCOM_N_TRANSFER] = {
 
@@ -230,6 +231,7 @@ static const struct ucom_callback uvscom
 	.ucom_stop_read = &uvscom_stop_read,
 	.ucom_start_write = &uvscom_start_write,
 	.ucom_stop_write = &uvscom_stop_write,
+	.ucom_poll = &uvscom_poll,
 };
 
 static const struct usb_device_id uvscom_devs[] = {
@@ -734,3 +736,10 @@ uvscom_cfg_read_status(struct uvscom_sof
 	}
 	return (data[0] | (data[1] << 8));
 }
+
+static void
+uvscom_poll(struct ucom_softc *ucom)
+{
+	struct uvscom_softc *sc = ucom->sc_parent;
+	usbd_transfer_poll(sc->sc_xfer, UVSCOM_N_TRANSFER);
+}

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:24:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B949C1065696;
	Thu, 29 Oct 2009 23:24:10 +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 A4B788FC1D;
	Thu, 29 Oct 2009 23:24: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 n9TNOAWD015400;
	Thu, 29 Oct 2009 23:24:10 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNOABg015398;
	Thu, 29 Oct 2009 23:24:10 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292324.n9TNOABg015398@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:24:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198656 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:24:10 -0000

Author: thompsa
Date: Thu Oct 29 23:24:10 2009
New Revision: 198656
URL: http://svn.freebsd.org/changeset/base/198656

Log:
  MFC r197572
  
   Add new FTDI IDs.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/uftdi.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uftdi.c	Thu Oct 29 23:23:34 2009	(r198655)
+++ stable/8/sys/dev/usb/serial/uftdi.c	Thu Oct 29 23:24:10 2009	(r198656)
@@ -243,10 +243,13 @@ static struct usb_device_id uftdi_devs[]
 	{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)},
 };
 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:24:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C567810656A3;
	Thu, 29 Oct 2009 23:24:41 +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 B0C918FC27;
	Thu, 29 Oct 2009 23:24: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 n9TNOfGk015488;
	Thu, 29 Oct 2009 23:24:41 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNOfKo015486;
	Thu, 29 Oct 2009 23:24:41 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292324.n9TNOfKo015486@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:24:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198657 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:24:42 -0000

Author: thompsa
Date: Thu Oct 29 23:24:41 2009
New Revision: 198657
URL: http://svn.freebsd.org/changeset/base/198657

Log:
  MFC r197573
  
   Add back endpoint swap detection that was disabled in an earlier driver
   conversion.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/umct.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/umct.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umct.c	Thu Oct 29 23:24:10 2009	(r198656)
+++ stable/8/sys/dev/usb/serial/umct.c	Thu Oct 29 23:24:41 2009	(r198657)
@@ -115,6 +115,7 @@ struct umct_softc {
 	uint8_t	sc_lcr;
 	uint8_t	sc_mcr;
 	uint8_t	sc_iface_no;
+	uint8_t sc_swap_cb;
 	uint8_t	sc_name[16];
 };
 
@@ -125,8 +126,10 @@ static device_attach_t umct_attach;
 static device_detach_t umct_detach;
 
 static usb_callback_t umct_intr_callback;
-static usb_callback_t umct_write_callback;
+static usb_callback_t umct_intr_callback_sub;
 static usb_callback_t umct_read_callback;
+static usb_callback_t umct_read_callback_sub;
+static usb_callback_t umct_write_callback;
 
 static void	umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
 		    uint16_t len, uint32_t value);
@@ -240,7 +243,7 @@ umct_attach(device_t dev)
 	struct usb_attach_arg *uaa = device_get_ivars(dev);
 	struct umct_softc *sc = device_get_softc(dev);
 	int32_t error;
-	//uint16_t maxp;
+	uint16_t maxp;
 	uint8_t iface_index;
 
 	sc->sc_udev = uaa->device;
@@ -263,13 +266,13 @@ umct_attach(device_t dev)
 		    "transfers failed!\n");
 		goto detach;
 	}
+
 	/*
 	 * The real bulk-in endpoint is also marked as an interrupt.
 	 * The only way to differentiate it from the real interrupt
 	 * endpoint is to look at the wMaxPacketSize field.
 	 */
-#ifdef XXX
-	maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->endpoint->edesc->wMaxPacketSize);
+	maxp = usbd_xfer_max_framelen(sc->sc_xfer[UMCT_BULK_DT_RD]);
 	if (maxp == 0x2) {
 
 		/* guessed wrong - switch around endpoints */
@@ -278,11 +281,9 @@ umct_attach(device_t dev)
 
 		sc->sc_xfer[UMCT_INTR_DT_RD] = sc->sc_xfer[UMCT_BULK_DT_RD];
 		sc->sc_xfer[UMCT_BULK_DT_RD] = temp;
-
-		sc->sc_xfer[UMCT_BULK_DT_RD]->callback = &umct_read_callback;
-		sc->sc_xfer[UMCT_INTR_DT_RD]->callback = &umct_intr_callback;
+		sc->sc_swap_cb = 1;
 	}
-#endif
+
 	sc->sc_obufsize = usbd_xfer_max_len(sc->sc_xfer[UMCT_BULK_DT_WR]);
 
 	if (uaa->info.idProduct == USB_PRODUCT_MCT_SITECOM_USB232) {
@@ -342,7 +343,7 @@ umct_cfg_do_request(struct umct_softc *s
 }
 
 static void
-umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_intr_callback_sub(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;
@@ -547,6 +548,28 @@ umct_stop_write(struct ucom_softc *ucom)
 }
 
 static void
+umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+	if (sc->sc_swap_cb)
+		umct_intr_callback_sub(xfer, error);
+	else
+		umct_read_callback_sub(xfer, error);
+}
+
+static void
+umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+	struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+	if (sc->sc_swap_cb)
+		umct_read_callback_sub(xfer, error);
+	else
+		umct_intr_callback_sub(xfer, error);
+}
+
+static void
 umct_write_callback(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
@@ -577,7 +600,7 @@ tr_setup:
 }
 
 static void
-umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_read_callback_sub(struct usb_xfer *xfer, usb_error_t error)
 {
 	struct umct_softc *sc = usbd_xfer_softc(xfer);
 	struct usb_page_cache *pc;

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:25:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38031106568D;
	Thu, 29 Oct 2009 23:25:14 +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 237138FC0A;
	Thu, 29 Oct 2009 23:25: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 n9TNPEBR015585;
	Thu, 29 Oct 2009 23:25:14 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNPEFH015583;
	Thu, 29 Oct 2009 23:25:14 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292325.n9TNPEFH015583@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:25:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198658 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/input dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:25:14 -0000

Author: thompsa
Date: Thu Oct 29 23:25:13 2009
New Revision: 198658
URL: http://svn.freebsd.org/changeset/base/198658

Log:
  MFC r197999 (hrs)
  
   Fix the 106/109 USB Japanese keyboard "underscore" issue.
   Sun Type 6 USB keyboard support added in rev 1.46 conflicted with
   some scan codes used in Japanese keyboards because the scan code
   conversion routine was ambiguous for the overlapped codes.
  
  PR:		ports/134005

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/input/ukbd.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/8/sys/dev/usb/input/ukbd.c	Thu Oct 29 23:24:41 2009	(r198657)
+++ stable/8/sys/dev/usb/input/ukbd.c	Thu Oct 29 23:25:13 2009	(r198658)
@@ -247,8 +247,8 @@ static const uint8_t ukbd_trtab[256] = {
 	NN, NN, NN, NN, NN, NN, NN, NN,	/* 68 - 6F */
 	NN, NN, NN, NN, 115, 108, 111, 113,	/* 70 - 77 */
 	109, 110, 112, 118, 114, 116, 117, 119,	/* 78 - 7F */
-	121, 120, NN, NN, NN, NN, NN, 115,	/* 80 - 87 */
-	112, 125, 121, 123, NN, NN, NN, NN,	/* 88 - 8F */
+	121, 120, NN, NN, NN, NN, NN, 123,	/* 80 - 87 */
+	124, 125, 126, 127, 128, NN, NN, NN,	/* 88 - 8F */
 	NN, NN, NN, NN, NN, NN, NN, NN,	/* 90 - 97 */
 	NN, NN, NN, NN, NN, NN, NN, NN,	/* 98 - 9F */
 	NN, NN, NN, NN, NN, NN, NN, NN,	/* A0 - A7 */
@@ -1636,20 +1636,59 @@ static int
 ukbd_key2scan(struct ukbd_softc *sc, int code, int shift, int up)
 {
 	static const int scan[] = {
-		0x1c, 0x1d, 0x35,
-		0x37 | SCAN_PREFIX_SHIFT,	/* PrintScreen */
-		0x38, 0x47, 0x48, 0x49, 0x4b, 0x4d, 0x4f,
-		0x50, 0x51, 0x52, 0x53,
-		0x46,			/* XXX Pause/Break */
-		0x5b, 0x5c, 0x5d,
+		/* 89 */
+		0x11c,	/* Enter */
+		/* 90-99 */
+		0x11d,	/* Ctrl-R */
+		0x135,	/* Divide */
+		0x137 | SCAN_PREFIX_SHIFT,	/* PrintScreen */
+		0x138,	/* Alt-R */
+		0x147,	/* Home */
+		0x148,	/* Up */
+		0x149,	/* PageUp */
+		0x14b,	/* Left */
+		0x14d,	/* Right */
+		0x14f,	/* End */
+		/* 100-109 */
+		0x150,	/* Down */
+		0x151,	/* PageDown */
+		0x152,	/* Insert */
+		0x153,	/* Delete */
+		0x146,	/* XXX Pause/Break */
+		0x15b,	/* Win_L(Super_L) */
+		0x15c,	/* Win_R(Super_R) */
+		0x15d,	/* Application(Menu) */
+
 		/* SUN TYPE 6 USB KEYBOARD */
-		0x68, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
-		0x64, 0x65, 0x66, 0x67, 0x25, 0x1f, 0x1e,
-		0x20,
+		0x168,	/* Sun Type 6 Help */
+		0x15e,	/* Sun Type 6 Stop */
+		/* 110 - 119 */
+		0x15f,	/* Sun Type 6 Again */
+		0x160,	/* Sun Type 6 Props */
+		0x161,	/* Sun Type 6 Undo */
+		0x162,	/* Sun Type 6 Front */
+		0x163,	/* Sun Type 6 Copy */
+		0x164,	/* Sun Type 6 Open */
+		0x165,	/* Sun Type 6 Paste */
+		0x166,	/* Sun Type 6 Find */
+		0x167,	/* Sun Type 6 Cut */
+		0x125,	/* Sun Type 6 Mute */
+		/* 120 - 128 */
+		0x11f,	/* Sun Type 6 VolumeDown */
+		0x11e,	/* Sun Type 6 VolumeUp */
+		0x120,	/* Sun Type 6 PowerDown */
+
+		/* Japanese 106/109 keyboard */
+		0x73,	/* Keyboard Intl' 1 (backslash / underscore) */
+		0x70,	/* Keyboard Intl' 2 (Katakana / Hiragana) */
+		0x7d,	/* Keyboard Intl' 3 (Yen sign) (Not using in jp106/109) */
+		0x79,	/* Keyboard Intl' 4 (Henkan) */
+		0x7b,	/* Keyboard Intl' 5 (Muhenkan) */
+		0x5c,	/* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */
 	};
 
 	if ((code >= 89) && (code < (89 + (sizeof(scan) / sizeof(scan[0]))))) {
-		code = scan[code - 89] | SCAN_PREFIX_E0;
+		code = scan[code - 89];
 	}
 	/* Pause/Break */
 	if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R)))) {

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:25:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C711106568B;
	Thu, 29 Oct 2009 23:25: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 468038FC1D;
	Thu, 29 Oct 2009 23:25: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 n9TNPrTm015695;
	Thu, 29 Oct 2009 23:25:53 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNPrGq015678;
	Thu, 29 Oct 2009 23:25:53 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292325.n9TNPrGq015678@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:25:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198659 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/pci dev/usb/controller dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:25:53 -0000

Author: thompsa
Date: Thu Oct 29 23:25:52 2009
New Revision: 198659
URL: http://svn.freebsd.org/changeset/base/198659

Log:
  MFC r198151
  
   Workaround buggy BIOS code in USB regard. By doing the BIOS to OS handover for
   all host controllers at the same time, we avoid problems where the BIOS will
   actually write to the USB registers of all the USB host controllers every time
   we handover one of them, and consequently reset the OS programmed values.

Added:
  stable/8/sys/dev/usb/controller/ehcireg.h
     - copied unchanged from r198151, head/sys/dev/usb/controller/ehcireg.h
  stable/8/sys/dev/usb/controller/ohcireg.h
     - copied unchanged from r198151, head/sys/dev/usb/controller/ohcireg.h
  stable/8/sys/dev/usb/controller/uhcireg.h
     - copied unchanged from r198151, head/sys/dev/usb/controller/uhcireg.h
Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/pci/pci.c
  stable/8/sys/dev/usb/controller/ehci.c
  stable/8/sys/dev/usb/controller/ehci.h
  stable/8/sys/dev/usb/controller/ehci_ixp4xx.c
  stable/8/sys/dev/usb/controller/ehci_mbus.c
  stable/8/sys/dev/usb/controller/ehci_pci.c
  stable/8/sys/dev/usb/controller/ohci.c
  stable/8/sys/dev/usb/controller/ohci.h
  stable/8/sys/dev/usb/controller/ohci_atmelarm.c
  stable/8/sys/dev/usb/controller/ohci_pci.c
  stable/8/sys/dev/usb/controller/uhci.c
  stable/8/sys/dev/usb/controller/uhci.h
  stable/8/sys/dev/usb/controller/uhci_pci.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/pci/pci.c
==============================================================================
--- stable/8/sys/dev/pci/pci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/pci/pci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -62,6 +62,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include "pcib_if.h"
 #include "pci_if.h"
 
@@ -270,6 +274,13 @@ TUNABLE_INT("hw.pci.honor_msi_blacklist"
 SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD,
     &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI");
 
+static int pci_usb_takeover = 1;
+TUNABLE_INT("hw.pci.usb_early_takeover", &pci_usb_takeover);
+SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RD | CTLFLAG_TUN,
+    &pci_usb_takeover, 1, "Enable early takeover of USB controllers.\n\
+Disable this if you depend on BIOS emulation of USB devices, that is\n\
+you use USB devices (like keyboard or mouse) but do not load USB drivers");
+
 /* Find a device_t by bus/slot/function in domain 0 */
 
 device_t
@@ -2569,6 +2580,106 @@ pci_assign_interrupt(device_t bus, devic
 	resource_list_add(&dinfo->resources, SYS_RES_IRQ, 0, irq, irq, 1);
 }
 
+/* Perform early OHCI takeover from SMM. */
+static void
+ohci_early_takeover(device_t self)
+{
+	struct resource *res;
+	uint32_t ctl;
+	int rid;
+	int i;
+
+	rid = PCIR_BAR(0);
+	res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+	if (res == NULL)
+		return;
+
+	ctl = bus_read_4(res, OHCI_CONTROL);
+	if (ctl & OHCI_IR) {
+		if (bootverbose)
+			printf("ohci early: "
+			    "SMM active, request owner change\n");
+		bus_write_4(res, OHCI_COMMAND_STATUS, OHCI_OCR);
+		for (i = 0; (i < 100) && (ctl & OHCI_IR); i++) {
+			DELAY(1000);
+			ctl = bus_read_4(res, OHCI_CONTROL);
+		}
+		if (ctl & OHCI_IR) {
+			if (bootverbose)
+				printf("ohci early: "
+				    "SMM does not respond, resetting\n");
+			bus_write_4(res, OHCI_CONTROL, OHCI_HCFS_RESET);
+		}
+	}
+
+	bus_release_resource(self, SYS_RES_MEMORY, rid, res);
+}
+
+/* Perform early UHCI takeover from SMM. */
+static void
+uhci_early_takeover(device_t self)
+{
+	/*
+	 * Set the PIRQD enable bit and switch off all the others. We don't
+	 * want legacy support to interfere with us XXX Does this also mean
+	 * that the BIOS won't touch the keyboard anymore if it is connected
+	 * to the ports of the root hub?
+	 */
+	pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2);
+}
+
+/* Perform early EHCI takeover from SMM. */
+static void
+ehci_early_takeover(device_t self)
+{
+	struct resource *res;
+	uint32_t cparams;
+	uint32_t eec;
+	uint8_t eecp;
+	uint8_t bios_sem;
+	int rid;
+	int i;
+
+	rid = PCIR_BAR(0);
+	res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+	if (res == NULL)
+		return;
+
+	cparams = bus_read_4(res, EHCI_HCCPARAMS);
+
+	/* Synchronise with the BIOS if it owns the controller. */
+	for (eecp = EHCI_HCC_EECP(cparams); eecp != 0;
+	    eecp = EHCI_EECP_NEXT(eec)) {
+		eec = pci_read_config(self, eecp, 4);
+		if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) {
+			continue;
+		}
+		bios_sem = pci_read_config(self, eecp +
+		    EHCI_LEGSUP_BIOS_SEM, 1);
+		if (bios_sem == 0) {
+			continue;
+		}
+		if (bootverbose)
+			printf("ehci early: "
+			    "SMM active, request owner change\n");
+
+		pci_write_config(self, eecp + EHCI_LEGSUP_OS_SEM, 1, 1);
+
+		for (i = 0; (i < 100) && (bios_sem != 0); i++) {
+			DELAY(1000);
+			bios_sem = pci_read_config(self, eecp +
+			    EHCI_LEGSUP_BIOS_SEM, 1);
+		}
+
+		if (bios_sem != 0) {
+			if (bootverbose)
+				printf("ehci early: "
+				    "SMM does not respond\n");
+		}
+	}
+	bus_release_resource(self, SYS_RES_MEMORY, rid, res);
+}
+
 void
 pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask)
 {
@@ -2612,6 +2723,16 @@ pci_add_resources(device_t bus, device_t
 		pci_assign_interrupt(bus, dev, 0);
 #endif
 	}
+
+	if (pci_usb_takeover && pci_get_class(dev) == PCIC_SERIALBUS &&
+	    pci_get_subclass(dev) == PCIS_SERIALBUS_USB) {
+		if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_EHCI)
+			ehci_early_takeover(dev);
+		else if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_OHCI)
+			ohci_early_takeover(dev);
+		else if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_UHCI)
+			uhci_early_takeover(dev);
+	}
 }
 
 void

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ehci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	EHCI_BUS2SC(bus) \
    ((ehci_softc_t *)(((uint8_t *)(bus)) - \

Modified: stable/8/sys/dev/usb/controller/ehci.h
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.h	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ehci.h	Thu Oct 29 23:25:52 2009	(r198659)
@@ -40,139 +40,6 @@
 
 #define	EHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
 
-/* PCI config registers  */
-#define	PCI_CBMEM		0x10	/* configuration base MEM */
-#define	PCI_INTERFACE_EHCI	0x20
-#define	PCI_USBREV		0x60	/* RO USB protocol revision */
-#define	PCI_USB_REV_MASK	0xff
-#define	PCI_USB_REV_PRE_1_0	0x00
-#define	PCI_USB_REV_1_0		0x10
-#define	PCI_USB_REV_1_1		0x11
-#define	PCI_USB_REV_2_0		0x20
-#define	PCI_EHCI_FLADJ		0x61	/* RW Frame len adj, SOF=59488+6*fladj */
-#define	PCI_EHCI_PORTWAKECAP	0x62	/* RW Port wake caps (opt)  */
-
-/* EHCI Extended Capabilities */
-#define	EHCI_EC_LEGSUP		0x01
-#define	EHCI_EECP_NEXT(x)	(((x) >> 8) & 0xff)
-#define	EHCI_EECP_ID(x)		((x) & 0xff)
-
-/* Legacy support extended capability */
-#define	EHCI_LEGSUP_BIOS_SEM		0x02
-#define	EHCI_LEGSUP_OS_SEM		0x03
-#define	EHCI_LEGSUP_USBLEGCTLSTS	0x04
-
-/* EHCI capability registers */
-#define	EHCI_CAPLENGTH		0x00	/* RO Capability register length field */
-/* reserved			0x01 */
-#define	EHCI_HCIVERSION		0x02	/* RO Interface version number */
-#define	EHCI_HCSPARAMS		0x04	/* RO Structural parameters */
-#define	EHCI_HCS_DEBUGPORT(x)	(((x) >> 20) & 0xf)
-#define	EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000)
-#define	EHCI_HCS_N_CC(x)	(((x) >> 12) & 0xf)	/* # of companion ctlrs */
-#define	EHCI_HCS_N_PCC(x)	(((x) >> 8) & 0xf)	/* # of ports per comp. */
-#define	EHCI_HCS_PPC(x)		((x) & 0x10)	/* port power control */
-#define	EHCI_HCS_N_PORTS(x)	((x) & 0xf)	/* # of ports */
-#define	EHCI_HCCPARAMS		0x08	/* RO Capability parameters */
-#define	EHCI_HCC_EECP(x)	(((x) >> 8) & 0xff)	/* extended ports caps */
-#define	EHCI_HCC_IST(x)		(((x) >> 4) & 0xf)	/* isoc sched threshold */
-#define	EHCI_HCC_ASPC(x)	((x) & 0x4)	/* async sched park cap */
-#define	EHCI_HCC_PFLF(x)	((x) & 0x2)	/* prog frame list flag */
-#define	EHCI_HCC_64BIT(x)	((x) & 0x1)	/* 64 bit address cap */
-#define	EHCI_HCSP_PORTROUTE	0x0c	/* RO Companion port route description */
-
-/* EHCI operational registers.  Offset given by EHCI_CAPLENGTH register */
-#define	EHCI_USBCMD		0x00	/* RO, RW, WO Command register */
-#define	EHCI_CMD_ITC_M		0x00ff0000	/* RW interrupt threshold ctrl */
-#define	EHCI_CMD_ITC_1		0x00010000
-#define	EHCI_CMD_ITC_2		0x00020000
-#define	EHCI_CMD_ITC_4		0x00040000
-#define	EHCI_CMD_ITC_8		0x00080000
-#define	EHCI_CMD_ITC_16		0x00100000
-#define	EHCI_CMD_ITC_32		0x00200000
-#define	EHCI_CMD_ITC_64		0x00400000
-#define	EHCI_CMD_ASPME		0x00000800	/* RW/RO async park enable */
-#define	EHCI_CMD_ASPMC		0x00000300	/* RW/RO async park count */
-#define	EHCI_CMD_LHCR		0x00000080	/* RW light host ctrl reset */
-#define	EHCI_CMD_IAAD		0x00000040	/* RW intr on async adv door
-						 * bell */
-#define	EHCI_CMD_ASE		0x00000020	/* RW async sched enable */
-#define	EHCI_CMD_PSE		0x00000010	/* RW periodic sched enable */
-#define	EHCI_CMD_FLS_M		0x0000000c	/* RW/RO frame list size */
-#define	EHCI_CMD_FLS(x)		(((x) >> 2) & 3)	/* RW/RO frame list size */
-#define	EHCI_CMD_HCRESET	0x00000002	/* RW reset */
-#define	EHCI_CMD_RS		0x00000001	/* RW run/stop */
-#define	EHCI_USBSTS		0x04	/* RO, RW, RWC Status register */
-#define	EHCI_STS_ASS		0x00008000	/* RO async sched status */
-#define	EHCI_STS_PSS		0x00004000	/* RO periodic sched status */
-#define	EHCI_STS_REC		0x00002000	/* RO reclamation */
-#define	EHCI_STS_HCH		0x00001000	/* RO host controller halted */
-#define	EHCI_STS_IAA		0x00000020	/* RWC interrupt on async adv */
-#define	EHCI_STS_HSE		0x00000010	/* RWC host system error */
-#define	EHCI_STS_FLR		0x00000008	/* RWC frame list rollover */
-#define	EHCI_STS_PCD		0x00000004	/* RWC port change detect */
-#define	EHCI_STS_ERRINT		0x00000002	/* RWC error interrupt */
-#define	EHCI_STS_INT		0x00000001	/* RWC interrupt */
-#define	EHCI_STS_INTRS(x)	((x) & 0x3f)
-
-/*
- * NOTE: the doorbell interrupt is enabled, but the doorbell is never
- * used! SiS chipsets require this.
- */
-#define	EHCI_NORMAL_INTRS	(EHCI_STS_IAA | EHCI_STS_HSE |	\
-				EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT)
-
-#define	EHCI_USBINTR		0x08	/* RW Interrupt register */
-#define	EHCI_INTR_IAAE		0x00000020	/* interrupt on async advance
-						 * ena */
-#define	EHCI_INTR_HSEE		0x00000010	/* host system error ena */
-#define	EHCI_INTR_FLRE		0x00000008	/* frame list rollover ena */
-#define	EHCI_INTR_PCIE		0x00000004	/* port change ena */
-#define	EHCI_INTR_UEIE		0x00000002	/* USB error intr ena */
-#define	EHCI_INTR_UIE		0x00000001	/* USB intr ena */
-
-#define	EHCI_FRINDEX		0x0c	/* RW Frame Index register */
-
-#define	EHCI_CTRLDSSEGMENT	0x10	/* RW Control Data Structure Segment */
-
-#define	EHCI_PERIODICLISTBASE	0x14	/* RW Periodic List Base */
-#define	EHCI_ASYNCLISTADDR	0x18	/* RW Async List Base */
-
-#define	EHCI_CONFIGFLAG		0x40	/* RW Configure Flag register */
-#define	EHCI_CONF_CF		0x00000001	/* RW configure flag */
-
-#define	EHCI_PORTSC(n)		(0x40+(4*(n)))	/* RO, RW, RWC Port Status reg */
-#define	EHCI_PS_WKOC_E		0x00400000	/* RW wake on over current ena */
-#define	EHCI_PS_WKDSCNNT_E	0x00200000	/* RW wake on disconnect ena */
-#define	EHCI_PS_WKCNNT_E	0x00100000	/* RW wake on connect ena */
-#define	EHCI_PS_PTC		0x000f0000	/* RW port test control */
-#define	EHCI_PS_PIC		0x0000c000	/* RW port indicator control */
-#define	EHCI_PS_PO		0x00002000	/* RW port owner */
-#define	EHCI_PS_PP		0x00001000	/* RW,RO port power */
-#define	EHCI_PS_LS		0x00000c00	/* RO line status */
-#define	EHCI_PS_IS_LOWSPEED(x)	(((x) & EHCI_PS_LS) == 0x00000400)
-#define	EHCI_PS_PR		0x00000100	/* RW port reset */
-#define	EHCI_PS_SUSP		0x00000080	/* RW suspend */
-#define	EHCI_PS_FPR		0x00000040	/* RW force port resume */
-#define	EHCI_PS_OCC		0x00000020	/* RWC over current change */
-#define	EHCI_PS_OCA		0x00000010	/* RO over current active */
-#define	EHCI_PS_PEC		0x00000008	/* RWC port enable change */
-#define	EHCI_PS_PE		0x00000004	/* RW port enable */
-#define	EHCI_PS_CSC		0x00000002	/* RWC connect status change */
-#define	EHCI_PS_CS		0x00000001	/* RO connect status */
-#define	EHCI_PS_CLEAR		(EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC)
-
-#define	EHCI_USBMODE		0x68	/* RW USB Device mode register */
-#define	EHCI_UM_CM		0x00000003	/* R/WO Controller Mode */
-#define	EHCI_UM_CM_IDLE		0x0	/* Idle */
-#define	EHCI_UM_CM_HOST		0x3	/* Host Controller */
-#define	EHCI_UM_ES		0x00000004	/* R/WO Endian Select */
-#define	EHCI_UM_ES_LE		0x0	/* Little-endian byte alignment */
-#define	EHCI_UM_ES_BE		0x4	/* Big-endian byte alignment */
-#define	EHCI_UM_SDIS		0x00000010	/* R/WO Stream Disable Mode */
-
-#define	EHCI_PORT_RESET_COMPLETE	2	/* ms */
-
 /*
  * Alignment NOTE: structures must be aligned so that the hardware can index
  * without performing addition.

Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_mbus.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ehci_mbus.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: stable/8/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci_pci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ehci_pci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	PCI_EHCI_VENDORID_ACERLABS	0x10b9
 #define	PCI_EHCI_VENDORID_AMD		0x1022

Copied: stable/8/sys/dev/usb/controller/ehcireg.h (from r198151, head/sys/dev/usb/controller/ehcireg.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/dev/usb/controller/ehcireg.h	Thu Oct 29 23:25:52 2009	(r198659, copy of r198151, head/sys/dev/usb/controller/ehcireg.h)
@@ -0,0 +1,174 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net).
+ *
+ * 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.
+ * 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
+ * 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.
+ */
+
+#ifndef _EHCIREG_H_
+#define	_EHCIREG_H_
+
+/* PCI config registers  */
+#define	PCI_CBMEM		0x10	/* configuration base MEM */
+#define	PCI_INTERFACE_EHCI	0x20
+#define	PCI_USBREV		0x60	/* RO USB protocol revision */
+#define	PCI_USB_REV_MASK	0xff
+#define	PCI_USB_REV_PRE_1_0	0x00
+#define	PCI_USB_REV_1_0		0x10
+#define	PCI_USB_REV_1_1		0x11
+#define	PCI_USB_REV_2_0		0x20
+#define	PCI_EHCI_FLADJ		0x61	/* RW Frame len adj, SOF=59488+6*fladj */
+#define	PCI_EHCI_PORTWAKECAP	0x62	/* RW Port wake caps (opt)  */
+
+/* EHCI Extended Capabilities */
+#define	EHCI_EC_LEGSUP		0x01
+#define	EHCI_EECP_NEXT(x)	(((x) >> 8) & 0xff)
+#define	EHCI_EECP_ID(x)		((x) & 0xff)
+
+/* Legacy support extended capability */
+#define	EHCI_LEGSUP_BIOS_SEM		0x02
+#define	EHCI_LEGSUP_OS_SEM		0x03
+#define	EHCI_LEGSUP_USBLEGCTLSTS	0x04
+
+/* EHCI capability registers */
+#define	EHCI_CAPLENGTH		0x00	/* RO Capability register length field */
+/* reserved			0x01 */
+#define	EHCI_HCIVERSION		0x02	/* RO Interface version number */
+#define	EHCI_HCSPARAMS		0x04	/* RO Structural parameters */
+#define	EHCI_HCS_DEBUGPORT(x)	(((x) >> 20) & 0xf)
+#define	EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000)
+#define	EHCI_HCS_N_CC(x)	(((x) >> 12) & 0xf)	/* # of companion ctlrs */
+#define	EHCI_HCS_N_PCC(x)	(((x) >> 8) & 0xf)	/* # of ports per comp. */
+#define	EHCI_HCS_PPC(x)		((x) & 0x10)	/* port power control */
+#define	EHCI_HCS_N_PORTS(x)	((x) & 0xf)	/* # of ports */
+#define	EHCI_HCCPARAMS		0x08	/* RO Capability parameters */
+#define	EHCI_HCC_EECP(x)	(((x) >> 8) & 0xff)	/* extended ports caps */
+#define	EHCI_HCC_IST(x)		(((x) >> 4) & 0xf)	/* isoc sched threshold */
+#define	EHCI_HCC_ASPC(x)	((x) & 0x4)	/* async sched park cap */
+#define	EHCI_HCC_PFLF(x)	((x) & 0x2)	/* prog frame list flag */
+#define	EHCI_HCC_64BIT(x)	((x) & 0x1)	/* 64 bit address cap */
+#define	EHCI_HCSP_PORTROUTE	0x0c	/* RO Companion port route description */
+
+/* EHCI operational registers.  Offset given by EHCI_CAPLENGTH register */
+#define	EHCI_USBCMD		0x00	/* RO, RW, WO Command register */
+#define	EHCI_CMD_ITC_M		0x00ff0000	/* RW interrupt threshold ctrl */
+#define	EHCI_CMD_ITC_1		0x00010000
+#define	EHCI_CMD_ITC_2		0x00020000
+#define	EHCI_CMD_ITC_4		0x00040000
+#define	EHCI_CMD_ITC_8		0x00080000
+#define	EHCI_CMD_ITC_16		0x00100000
+#define	EHCI_CMD_ITC_32		0x00200000
+#define	EHCI_CMD_ITC_64		0x00400000
+#define	EHCI_CMD_ASPME		0x00000800	/* RW/RO async park enable */
+#define	EHCI_CMD_ASPMC		0x00000300	/* RW/RO async park count */
+#define	EHCI_CMD_LHCR		0x00000080	/* RW light host ctrl reset */
+#define	EHCI_CMD_IAAD		0x00000040	/* RW intr on async adv door
+						 * bell */
+#define	EHCI_CMD_ASE		0x00000020	/* RW async sched enable */
+#define	EHCI_CMD_PSE		0x00000010	/* RW periodic sched enable */
+#define	EHCI_CMD_FLS_M		0x0000000c	/* RW/RO frame list size */
+#define	EHCI_CMD_FLS(x)		(((x) >> 2) & 3)	/* RW/RO frame list size */
+#define	EHCI_CMD_HCRESET	0x00000002	/* RW reset */
+#define	EHCI_CMD_RS		0x00000001	/* RW run/stop */
+#define	EHCI_USBSTS		0x04	/* RO, RW, RWC Status register */
+#define	EHCI_STS_ASS		0x00008000	/* RO async sched status */
+#define	EHCI_STS_PSS		0x00004000	/* RO periodic sched status */
+#define	EHCI_STS_REC		0x00002000	/* RO reclamation */
+#define	EHCI_STS_HCH		0x00001000	/* RO host controller halted */
+#define	EHCI_STS_IAA		0x00000020	/* RWC interrupt on async adv */
+#define	EHCI_STS_HSE		0x00000010	/* RWC host system error */
+#define	EHCI_STS_FLR		0x00000008	/* RWC frame list rollover */
+#define	EHCI_STS_PCD		0x00000004	/* RWC port change detect */
+#define	EHCI_STS_ERRINT		0x00000002	/* RWC error interrupt */
+#define	EHCI_STS_INT		0x00000001	/* RWC interrupt */
+#define	EHCI_STS_INTRS(x)	((x) & 0x3f)
+
+/*
+ * NOTE: the doorbell interrupt is enabled, but the doorbell is never
+ * used! SiS chipsets require this.
+ */
+#define	EHCI_NORMAL_INTRS	(EHCI_STS_IAA | EHCI_STS_HSE |	\
+				EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT)
+
+#define	EHCI_USBINTR		0x08	/* RW Interrupt register */
+#define	EHCI_INTR_IAAE		0x00000020	/* interrupt on async advance
+						 * ena */
+#define	EHCI_INTR_HSEE		0x00000010	/* host system error ena */
+#define	EHCI_INTR_FLRE		0x00000008	/* frame list rollover ena */
+#define	EHCI_INTR_PCIE		0x00000004	/* port change ena */
+#define	EHCI_INTR_UEIE		0x00000002	/* USB error intr ena */
+#define	EHCI_INTR_UIE		0x00000001	/* USB intr ena */
+
+#define	EHCI_FRINDEX		0x0c	/* RW Frame Index register */
+
+#define	EHCI_CTRLDSSEGMENT	0x10	/* RW Control Data Structure Segment */
+
+#define	EHCI_PERIODICLISTBASE	0x14	/* RW Periodic List Base */
+#define	EHCI_ASYNCLISTADDR	0x18	/* RW Async List Base */
+
+#define	EHCI_CONFIGFLAG		0x40	/* RW Configure Flag register */
+#define	EHCI_CONF_CF		0x00000001	/* RW configure flag */
+
+#define	EHCI_PORTSC(n)		(0x40+(4*(n)))	/* RO, RW, RWC Port Status reg */
+#define	EHCI_PS_WKOC_E		0x00400000	/* RW wake on over current ena */
+#define	EHCI_PS_WKDSCNNT_E	0x00200000	/* RW wake on disconnect ena */
+#define	EHCI_PS_WKCNNT_E	0x00100000	/* RW wake on connect ena */
+#define	EHCI_PS_PTC		0x000f0000	/* RW port test control */
+#define	EHCI_PS_PIC		0x0000c000	/* RW port indicator control */
+#define	EHCI_PS_PO		0x00002000	/* RW port owner */
+#define	EHCI_PS_PP		0x00001000	/* RW,RO port power */
+#define	EHCI_PS_LS		0x00000c00	/* RO line status */
+#define	EHCI_PS_IS_LOWSPEED(x)	(((x) & EHCI_PS_LS) == 0x00000400)
+#define	EHCI_PS_PR		0x00000100	/* RW port reset */
+#define	EHCI_PS_SUSP		0x00000080	/* RW suspend */
+#define	EHCI_PS_FPR		0x00000040	/* RW force port resume */
+#define	EHCI_PS_OCC		0x00000020	/* RWC over current change */
+#define	EHCI_PS_OCA		0x00000010	/* RO over current active */
+#define	EHCI_PS_PEC		0x00000008	/* RWC port enable change */
+#define	EHCI_PS_PE		0x00000004	/* RW port enable */
+#define	EHCI_PS_CSC		0x00000002	/* RWC connect status change */
+#define	EHCI_PS_CS		0x00000001	/* RO connect status */
+#define	EHCI_PS_CLEAR		(EHCI_PS_OCC | EHCI_PS_PEC | EHCI_PS_CSC)
+
+#define	EHCI_USBMODE		0x68	/* RW USB Device mode register */
+#define	EHCI_UM_CM		0x00000003	/* R/WO Controller Mode */
+#define	EHCI_UM_CM_IDLE		0x0	/* Idle */
+#define	EHCI_UM_CM_HOST		0x3	/* Host Controller */
+#define	EHCI_UM_ES		0x00000004	/* R/WO Endian Select */
+#define	EHCI_UM_ES_LE		0x0	/* Little-endian byte alignment */
+#define	EHCI_UM_ES_BE		0x4	/* Big-endian byte alignment */
+#define	EHCI_UM_SDIS		0x00000010	/* R/WO Stream Disable Mode */
+
+#define	EHCI_PORT_RESET_COMPLETE	2	/* ms */
+
+#endif	/* _EHCIREG_H_ */

Modified: stable/8/sys/dev/usb/controller/ohci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ohci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	OHCI_BUS2SC(bus) \
    ((ohci_softc_t *)(((uint8_t *)(bus)) - \

Modified: stable/8/sys/dev/usb/controller/ohci.h
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci.h	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ohci.h	Thu Oct 29 23:25:52 2009	(r198659)
@@ -41,95 +41,6 @@
 
 #define	OHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
 
-/* PCI config registers  */
-#define	PCI_CBMEM		0x10	/* configuration base memory */
-#define	PCI_INTERFACE_OHCI	0x10
-
-/* OHCI registers */
-#define	OHCI_REVISION		0x00	/* OHCI revision */
-#define	OHCI_REV_LO(rev)	((rev) & 0xf)
-#define	OHCI_REV_HI(rev)	(((rev)>>4) & 0xf)
-#define	OHCI_REV_LEGACY(rev)	((rev) & 0x100)
-#define	OHCI_CONTROL		0x04
-#define	OHCI_CBSR_MASK		0x00000003	/* Control/Bulk Service Ratio */
-#define	OHCI_RATIO_1_1		0x00000000
-#define	OHCI_RATIO_1_2		0x00000001
-#define	OHCI_RATIO_1_3		0x00000002
-#define	OHCI_RATIO_1_4		0x00000003
-#define	OHCI_PLE		0x00000004	/* Periodic List Enable */
-#define	OHCI_IE			0x00000008	/* Isochronous Enable */
-#define	OHCI_CLE		0x00000010	/* Control List Enable */
-#define	OHCI_BLE		0x00000020	/* Bulk List Enable */
-#define	OHCI_HCFS_MASK		0x000000c0	/* HostControllerFunctionalStat
-						 * e */
-#define	OHCI_HCFS_RESET		0x00000000
-#define	OHCI_HCFS_RESUME	0x00000040
-#define	OHCI_HCFS_OPERATIONAL	0x00000080
-#define	OHCI_HCFS_SUSPEND	0x000000c0
-#define	OHCI_IR			0x00000100	/* Interrupt Routing */
-#define	OHCI_RWC		0x00000200	/* Remote Wakeup Connected */
-#define	OHCI_RWE		0x00000400	/* Remote Wakeup Enabled */
-#define	OHCI_COMMAND_STATUS	0x08
-#define	OHCI_HCR		0x00000001	/* Host Controller Reset */
-#define	OHCI_CLF		0x00000002	/* Control List Filled */
-#define	OHCI_BLF		0x00000004	/* Bulk List Filled */
-#define	OHCI_OCR		0x00000008	/* Ownership Change Request */
-#define	OHCI_SOC_MASK		0x00030000	/* Scheduling Overrun Count */
-#define	OHCI_INTERRUPT_STATUS	0x0c
-#define	OHCI_SO			0x00000001	/* Scheduling Overrun */
-#define	OHCI_WDH		0x00000002	/* Writeback Done Head */
-#define	OHCI_SF			0x00000004	/* Start of Frame */
-#define	OHCI_RD			0x00000008	/* Resume Detected */
-#define	OHCI_UE			0x00000010	/* Unrecoverable Error */
-#define	OHCI_FNO		0x00000020	/* Frame Number Overflow */
-#define	OHCI_RHSC		0x00000040	/* Root Hub Status Change */
-#define	OHCI_OC			0x40000000	/* Ownership Change */
-#define	OHCI_MIE		0x80000000	/* Master Interrupt Enable */
-#define	OHCI_INTERRUPT_ENABLE	0x10
-#define	OHCI_INTERRUPT_DISABLE	0x14
-#define	OHCI_HCCA		0x18
-#define	OHCI_PERIOD_CURRENT_ED	0x1c
-#define	OHCI_CONTROL_HEAD_ED	0x20
-#define	OHCI_CONTROL_CURRENT_ED	0x24
-#define	OHCI_BULK_HEAD_ED	0x28
-#define	OHCI_BULK_CURRENT_ED	0x2c
-#define	OHCI_DONE_HEAD		0x30
-#define	OHCI_FM_INTERVAL	0x34
-#define	OHCI_GET_IVAL(s)	((s) & 0x3fff)
-#define	OHCI_GET_FSMPS(s)	(((s) >> 16) & 0x7fff)
-#define	OHCI_FIT		0x80000000
-#define	OHCI_FM_REMAINING	0x38
-#define	OHCI_FM_NUMBER		0x3c
-#define	OHCI_PERIODIC_START	0x40
-#define	OHCI_LS_THRESHOLD	0x44
-#define	OHCI_RH_DESCRIPTOR_A	0x48
-#define	OHCI_GET_NDP(s)		((s) & 0xff)
-#define	OHCI_PSM		0x0100	/* Power Switching Mode */
-#define	OHCI_NPS		0x0200	/* No Power Switching */
-#define	OHCI_DT			0x0400	/* Device Type */
-#define	OHCI_OCPM		0x0800	/* Overcurrent Protection Mode */
-#define	OHCI_NOCP		0x1000	/* No Overcurrent Protection */
-#define	OHCI_GET_POTPGT(s)	((s) >> 24)
-#define	OHCI_RH_DESCRIPTOR_B	0x4c
-#define	OHCI_RH_STATUS		0x50
-#define	OHCI_LPS		0x00000001	/* Local Power Status */
-#define	OHCI_OCI		0x00000002	/* OverCurrent Indicator */
-#define	OHCI_DRWE		0x00008000	/* Device Remote Wakeup Enable */
-#define	OHCI_LPSC		0x00010000	/* Local Power Status Change */
-#define	OHCI_CCIC		0x00020000	/* OverCurrent Indicator
-						 * Change */
-#define	OHCI_CRWE		0x80000000	/* Clear Remote Wakeup Enable */
-#define	OHCI_RH_PORT_STATUS(n)	(0x50 + ((n)*4))	/* 1 based indexing */
-
-#define	OHCI_LES		(OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE)
-#define	OHCI_ALL_INTRS		(OHCI_SO | OHCI_WDH | OHCI_SF |		\
-				OHCI_RD | OHCI_UE | OHCI_FNO |		\
-				OHCI_RHSC | OHCI_OC)
-#define	OHCI_NORMAL_INTRS	(OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC)
-
-#define	OHCI_FSMPS(i)		(((i-210)*6/7) << 16)
-#define	OHCI_PERIODIC(i)	((i)*9/10)
-
 #define	OHCI_NO_INTRS		32
 #define	OHCI_HCCA_SIZE		256
 

Modified: stable/8/sys/dev/usb/controller/ohci_atmelarm.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci_atmelarm.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ohci_atmelarm.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 

Modified: stable/8/sys/dev/usb/controller/ohci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci_pci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/ohci_pci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	PCI_OHCI_VENDORID_ACERLABS	0x10b9
 #define	PCI_OHCI_VENDORID_AMD		0x1022

Copied: stable/8/sys/dev/usb/controller/ohcireg.h (from r198151, head/sys/dev/usb/controller/ohcireg.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/dev/usb/controller/ohcireg.h	Thu Oct 29 23:25:52 2009	(r198659, copy of r198151, head/sys/dev/usb/controller/ohcireg.h)
@@ -0,0 +1,131 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * 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.
+ * 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
+ * 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.
+ */
+
+#ifndef _OHCIREG_H_
+#define	_OHCIREG_H_
+
+/* PCI config registers  */
+#define	PCI_CBMEM		0x10	/* configuration base memory */
+#define	PCI_INTERFACE_OHCI	0x10
+
+/* OHCI registers */
+#define	OHCI_REVISION		0x00	/* OHCI revision */
+#define	OHCI_REV_LO(rev)	((rev) & 0xf)
+#define	OHCI_REV_HI(rev)	(((rev)>>4) & 0xf)
+#define	OHCI_REV_LEGACY(rev)	((rev) & 0x100)
+#define	OHCI_CONTROL		0x04
+#define	OHCI_CBSR_MASK		0x00000003	/* Control/Bulk Service Ratio */
+#define	OHCI_RATIO_1_1		0x00000000
+#define	OHCI_RATIO_1_2		0x00000001
+#define	OHCI_RATIO_1_3		0x00000002
+#define	OHCI_RATIO_1_4		0x00000003
+#define	OHCI_PLE		0x00000004	/* Periodic List Enable */
+#define	OHCI_IE			0x00000008	/* Isochronous Enable */
+#define	OHCI_CLE		0x00000010	/* Control List Enable */
+#define	OHCI_BLE		0x00000020	/* Bulk List Enable */
+#define	OHCI_HCFS_MASK		0x000000c0	/* HostControllerFunctionalStat
+						 * e */
+#define	OHCI_HCFS_RESET		0x00000000
+#define	OHCI_HCFS_RESUME	0x00000040
+#define	OHCI_HCFS_OPERATIONAL	0x00000080
+#define	OHCI_HCFS_SUSPEND	0x000000c0
+#define	OHCI_IR			0x00000100	/* Interrupt Routing */
+#define	OHCI_RWC		0x00000200	/* Remote Wakeup Connected */
+#define	OHCI_RWE		0x00000400	/* Remote Wakeup Enabled */
+#define	OHCI_COMMAND_STATUS	0x08
+#define	OHCI_HCR		0x00000001	/* Host Controller Reset */
+#define	OHCI_CLF		0x00000002	/* Control List Filled */
+#define	OHCI_BLF		0x00000004	/* Bulk List Filled */
+#define	OHCI_OCR		0x00000008	/* Ownership Change Request */
+#define	OHCI_SOC_MASK		0x00030000	/* Scheduling Overrun Count */
+#define	OHCI_INTERRUPT_STATUS	0x0c
+#define	OHCI_SO			0x00000001	/* Scheduling Overrun */
+#define	OHCI_WDH		0x00000002	/* Writeback Done Head */
+#define	OHCI_SF			0x00000004	/* Start of Frame */
+#define	OHCI_RD			0x00000008	/* Resume Detected */
+#define	OHCI_UE			0x00000010	/* Unrecoverable Error */
+#define	OHCI_FNO		0x00000020	/* Frame Number Overflow */
+#define	OHCI_RHSC		0x00000040	/* Root Hub Status Change */
+#define	OHCI_OC			0x40000000	/* Ownership Change */
+#define	OHCI_MIE		0x80000000	/* Master Interrupt Enable */
+#define	OHCI_INTERRUPT_ENABLE	0x10
+#define	OHCI_INTERRUPT_DISABLE	0x14
+#define	OHCI_HCCA		0x18
+#define	OHCI_PERIOD_CURRENT_ED	0x1c
+#define	OHCI_CONTROL_HEAD_ED	0x20
+#define	OHCI_CONTROL_CURRENT_ED	0x24
+#define	OHCI_BULK_HEAD_ED	0x28
+#define	OHCI_BULK_CURRENT_ED	0x2c
+#define	OHCI_DONE_HEAD		0x30
+#define	OHCI_FM_INTERVAL	0x34
+#define	OHCI_GET_IVAL(s)	((s) & 0x3fff)
+#define	OHCI_GET_FSMPS(s)	(((s) >> 16) & 0x7fff)
+#define	OHCI_FIT		0x80000000
+#define	OHCI_FM_REMAINING	0x38
+#define	OHCI_FM_NUMBER		0x3c
+#define	OHCI_PERIODIC_START	0x40
+#define	OHCI_LS_THRESHOLD	0x44
+#define	OHCI_RH_DESCRIPTOR_A	0x48
+#define	OHCI_GET_NDP(s)		((s) & 0xff)
+#define	OHCI_PSM		0x0100	/* Power Switching Mode */
+#define	OHCI_NPS		0x0200	/* No Power Switching */
+#define	OHCI_DT			0x0400	/* Device Type */
+#define	OHCI_OCPM		0x0800	/* Overcurrent Protection Mode */
+#define	OHCI_NOCP		0x1000	/* No Overcurrent Protection */
+#define	OHCI_GET_POTPGT(s)	((s) >> 24)
+#define	OHCI_RH_DESCRIPTOR_B	0x4c
+#define	OHCI_RH_STATUS		0x50
+#define	OHCI_LPS		0x00000001	/* Local Power Status */
+#define	OHCI_OCI		0x00000002	/* OverCurrent Indicator */
+#define	OHCI_DRWE		0x00008000	/* Device Remote Wakeup Enable */
+#define	OHCI_LPSC		0x00010000	/* Local Power Status Change */
+#define	OHCI_CCIC		0x00020000	/* OverCurrent Indicator
+						 * Change */
+#define	OHCI_CRWE		0x80000000	/* Clear Remote Wakeup Enable */
+#define	OHCI_RH_PORT_STATUS(n)	(0x50 + ((n)*4))	/* 1 based indexing */
+
+#define	OHCI_LES		(OHCI_PLE | OHCI_IE | OHCI_CLE | OHCI_BLE)
+#define	OHCI_ALL_INTRS		(OHCI_SO | OHCI_WDH | OHCI_SF |		\
+				OHCI_RD | OHCI_UE | OHCI_FNO |		\
+				OHCI_RHSC | OHCI_OC)
+#define	OHCI_NORMAL_INTRS	(OHCI_WDH | OHCI_RD | OHCI_UE | OHCI_RHSC)
+
+#define	OHCI_FSMPS(i)		(((i-210)*6/7) << 16)
+#define	OHCI_PERIODIC(i)	((i)*9/10)
+
+#endif	/* _OHCIREG_H_ */

Modified: stable/8/sys/dev/usb/controller/uhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/uhci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	alt_next next
 #define	UHCI_BUS2SC(bus) \

Modified: stable/8/sys/dev/usb/controller/uhci.h
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci.h	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/uhci.h	Thu Oct 29 23:25:52 2009	(r198659)
@@ -41,64 +41,6 @@
 
 #define	UHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
 
-/* PCI config registers  */
-#define	PCI_USBREV		0x60	/* USB protocol revision */
-#define	PCI_USB_REV_MASK		0xff
-#define	PCI_USB_REV_PRE_1_0	0x00
-#define	PCI_USB_REV_1_0		0x10
-#define	PCI_USB_REV_1_1		0x11
-#define	PCI_LEGSUP		0xc0	/* Legacy Support register */
-#define	PCI_LEGSUP_USBPIRQDEN	0x2000	/* USB PIRQ D Enable */
-#define	PCI_CBIO		0x20	/* configuration base IO */
-#define	PCI_INTERFACE_UHCI	0x00
-
-/* UHCI registers */
-#define	UHCI_CMD		0x00
-#define	UHCI_CMD_RS		0x0001
-#define	UHCI_CMD_HCRESET	0x0002
-#define	UHCI_CMD_GRESET		0x0004
-#define	UHCI_CMD_EGSM		0x0008
-#define	UHCI_CMD_FGR		0x0010
-#define	UHCI_CMD_SWDBG		0x0020
-#define	UHCI_CMD_CF		0x0040
-#define	UHCI_CMD_MAXP		0x0080
-#define	UHCI_STS		0x02
-#define	UHCI_STS_USBINT		0x0001
-#define	UHCI_STS_USBEI		0x0002
-#define	UHCI_STS_RD		0x0004
-#define	UHCI_STS_HSE		0x0008
-#define	UHCI_STS_HCPE		0x0010
-#define	UHCI_STS_HCH		0x0020
-#define	UHCI_STS_ALLINTRS	0x003f
-#define	UHCI_INTR		0x04
-#define	UHCI_INTR_TOCRCIE	0x0001
-#define	UHCI_INTR_RIE		0x0002
-#define	UHCI_INTR_IOCE		0x0004
-#define	UHCI_INTR_SPIE		0x0008
-#define	UHCI_FRNUM		0x06
-#define	UHCI_FRNUM_MASK		0x03ff
-#define	UHCI_FLBASEADDR		0x08
-#define	UHCI_SOF		0x0c
-#define	UHCI_SOF_MASK		0x7f
-#define	UHCI_PORTSC1      	0x010
-#define	UHCI_PORTSC2      	0x012
-#define	UHCI_PORTSC_CCS		0x0001
-#define	UHCI_PORTSC_CSC		0x0002
-#define	UHCI_PORTSC_PE		0x0004
-#define	UHCI_PORTSC_POEDC	0x0008
-#define	UHCI_PORTSC_LS		0x0030
-#define	UHCI_PORTSC_LS_SHIFT	4
-#define	UHCI_PORTSC_RD		0x0040
-#define	UHCI_PORTSC_LSDA	0x0100
-#define	UHCI_PORTSC_PR		0x0200
-#define	UHCI_PORTSC_OCI		0x0400
-#define	UHCI_PORTSC_OCIC	0x0800
-#define	UHCI_PORTSC_SUSP	0x1000
-
-#define	URWMASK(x)		((x) & (UHCI_PORTSC_SUSP |		\
-				UHCI_PORTSC_PR | UHCI_PORTSC_RD |	\
-				UHCI_PORTSC_PE))
-
 #define	UHCI_FRAMELIST_COUNT	1024	/* units */
 #define	UHCI_FRAMELIST_ALIGN	4096	/* bytes */
 
@@ -118,8 +60,6 @@ typedef uint32_t uhci_physaddr_t;
 #define	UHCI_PTR_QH		0x00000002
 #define	UHCI_PTR_VF		0x00000004
 
-#define	UHCI_QH_REMOVE_DELAY	5	/* us - QH remove delay */
-
 /*
  * The Queue Heads (QH) and Transfer Descriptors (TD) are accessed by
  * both the CPU and the USB-controller which run concurrently. Great

Modified: stable/8/sys/dev/usb/controller/uhci_pci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci_pci.c	Thu Oct 29 23:25:13 2009	(r198658)
+++ stable/8/sys/dev/usb/controller/uhci_pci.c	Thu Oct 29 23:25:52 2009	(r198659)
@@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #define	PCI_UHCI_VENDORID_INTEL		0x8086
 #define	PCI_UHCI_VENDORID_VIA		0x1106

Copied: stable/8/sys/dev/usb/controller/uhcireg.h (from r198151, head/sys/dev/usb/controller/uhcireg.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/sys/dev/usb/controller/uhcireg.h	Thu Oct 29 23:25:52 2009	(r198659, copy of r198151, head/sys/dev/usb/controller/uhcireg.h)
@@ -0,0 +1,100 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * 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.
+ * 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
+ * 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.
+ */
+
+#ifndef _UHCIREG_H_
+#define	_UHCIREG_H_
+
+/* PCI config registers  */
+#define	PCI_USBREV		0x60	/* USB protocol revision */
+#define	PCI_USB_REV_MASK		0xff
+#define	PCI_USB_REV_PRE_1_0	0x00
+#define	PCI_USB_REV_1_0		0x10
+#define	PCI_USB_REV_1_1		0x11
+#define	PCI_LEGSUP		0xc0	/* Legacy Support register */
+#define	PCI_LEGSUP_USBPIRQDEN	0x2000	/* USB PIRQ D Enable */
+#define	PCI_CBIO		0x20	/* configuration base IO */
+#define	PCI_INTERFACE_UHCI	0x00
+
+/* UHCI registers */
+#define	UHCI_CMD		0x00
+#define	UHCI_CMD_RS		0x0001
+#define	UHCI_CMD_HCRESET	0x0002
+#define	UHCI_CMD_GRESET		0x0004
+#define	UHCI_CMD_EGSM		0x0008
+#define	UHCI_CMD_FGR		0x0010
+#define	UHCI_CMD_SWDBG		0x0020
+#define	UHCI_CMD_CF		0x0040
+#define	UHCI_CMD_MAXP		0x0080
+#define	UHCI_STS		0x02
+#define	UHCI_STS_USBINT		0x0001
+#define	UHCI_STS_USBEI		0x0002
+#define	UHCI_STS_RD		0x0004
+#define	UHCI_STS_HSE		0x0008
+#define	UHCI_STS_HCPE		0x0010
+#define	UHCI_STS_HCH		0x0020
+#define	UHCI_STS_ALLINTRS	0x003f
+#define	UHCI_INTR		0x04
+#define	UHCI_INTR_TOCRCIE	0x0001
+#define	UHCI_INTR_RIE		0x0002
+#define	UHCI_INTR_IOCE		0x0004
+#define	UHCI_INTR_SPIE		0x0008
+#define	UHCI_FRNUM		0x06
+#define	UHCI_FRNUM_MASK		0x03ff
+#define	UHCI_FLBASEADDR		0x08
+#define	UHCI_SOF		0x0c
+#define	UHCI_SOF_MASK		0x7f
+#define	UHCI_PORTSC1      	0x010
+#define	UHCI_PORTSC2      	0x012
+#define	UHCI_PORTSC_CCS		0x0001
+#define	UHCI_PORTSC_CSC		0x0002
+#define	UHCI_PORTSC_PE		0x0004
+#define	UHCI_PORTSC_POEDC	0x0008
+#define	UHCI_PORTSC_LS		0x0030
+#define	UHCI_PORTSC_LS_SHIFT	4
+#define	UHCI_PORTSC_RD		0x0040
+#define	UHCI_PORTSC_LSDA	0x0100
+#define	UHCI_PORTSC_PR		0x0200
+#define	UHCI_PORTSC_OCI		0x0400
+#define	UHCI_PORTSC_OCIC	0x0800
+#define	UHCI_PORTSC_SUSP	0x1000
+
+#define	URWMASK(x)		((x) & (UHCI_PORTSC_SUSP |		\
+				UHCI_PORTSC_PR | UHCI_PORTSC_RD |	\
+				UHCI_PORTSC_PE))
+
+#endif	/* _UHCIREG_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:26:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 680E31065697;
	Thu, 29 Oct 2009 23:26:30 +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 521CE8FC2D;
	Thu, 29 Oct 2009 23:26: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 n9TNQUxm015800;
	Thu, 29 Oct 2009 23:26:30 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNQUl5015798;
	Thu, 29 Oct 2009 23:26:30 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292326.n9TNQUl5015798@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:26:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198660 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/input dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:26:30 -0000

Author: thompsa
Date: Thu Oct 29 23:26:29 2009
New Revision: 198660
URL: http://svn.freebsd.org/changeset/base/198660

Log:
  MFC r198152
  
   Only poll ukbd if KDB is active.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/input/ukbd.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/8/sys/dev/usb/input/ukbd.c	Thu Oct 29 23:25:52 2009	(r198659)
+++ stable/8/sys/dev/usb/input/ukbd.c	Thu Oct 29 23:26:29 2009	(r198660)
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -328,6 +329,9 @@ ukbd_do_poll(struct ukbd_softc *sc, uint
 {
 	DPRINTFN(2, "polling\n");
 
+	if (kdb_active == 0)
+		return;		/* Only poll if KDB is active */
+
 	while (sc->sc_inputs == 0) {
 
 		usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER);

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:27:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0673F10656A6;
	Thu, 29 Oct 2009 23:27:01 +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 BD08D8FC1A;
	Thu, 29 Oct 2009 23:27: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 n9TNR0fV015891;
	Thu, 29 Oct 2009 23:27:00 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNR0K4015889;
	Thu, 29 Oct 2009 23:27:00 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292327.n9TNR0K4015889@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:27:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198661 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:27:01 -0000

Author: thompsa
Date: Thu Oct 29 23:27:00 2009
New Revision: 198661
URL: http://svn.freebsd.org/changeset/base/198661

Log:
  MFC r198153
  
   Correct offset calcluation for the NCM implementation.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/net/if_cdce.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_cdce.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:26:29 2009	(r198660)
+++ stable/8/sys/dev/usb/net/if_cdce.c	Thu Oct 29 23:27:00 2009	(r198661)
@@ -1088,7 +1088,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer 
 	sc->sc_ncm.hdr.dwSignature[2] = 'M';
 	sc->sc_ncm.hdr.dwSignature[3] = 'H';
 	USETW(sc->sc_ncm.hdr.wHeaderLength, sizeof(sc->sc_ncm.hdr));
-	USETW(sc->sc_ncm.hdr.wBlockLength, offset);
+	USETW(sc->sc_ncm.hdr.wBlockLength, last_offset);
 	USETW(sc->sc_ncm.hdr.wSequence, sc->sc_ncm.tx_seq);
 	USETW(sc->sc_ncm.hdr.wDptIndex, sizeof(sc->sc_ncm.hdr));
 
@@ -1243,25 +1243,24 @@ cdce_ncm_bulk_read_callback(struct usb_x
 
 			offset = UGETW(sc->sc_ncm.dp[x].wFrameIndex);
 			temp = UGETW(sc->sc_ncm.dp[x].wFrameLength);
-			if ((offset + temp) > actlen) {
-				DPRINTFN(1, "invalid frame detected (ignored)\n");
-				m = NULL;
 
-			} else if (temp >= sizeof(struct ether_header)) {
-				/*
-				 * allocate a suitable memory buffer, if
-				 * possible
-				 */
-				if (temp > (MCLBYTES - ETHER_ALIGN)) {
-					m = NULL;
-					continue;
-				} if (temp > (MHLEN - ETHER_ALIGN)) {
-					m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-				} else {
-					m = m_gethdr(M_DONTWAIT, MT_DATA);
-				}
+			if ((offset == 0) ||
+			    (temp < sizeof(struct ether_header)) ||
+			    (temp > (MCLBYTES - ETHER_ALIGN))) {
+				DPRINTFN(1, "NULL frame detected at %d\n", x);
+				m = NULL;
+				/* silently ignore this frame */
+				continue;
+			} else if ((offset + temp) > actlen) {
+				DPRINTFN(1, "invalid frame "
+				    "detected at %d\n", x);
+				m = NULL;
+				/* silently ignore this frame */
+				continue;
+			} else if (temp > (MHLEN - ETHER_ALIGN)) {
+				m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 			} else {
-				m = NULL;	/* dump it */
+				m = m_gethdr(M_DONTWAIT, MT_DATA);
 			}
 
 			DPRINTFN(16, "frame %u, offset = %u, length = %u \n",

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:27:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E47D4106566C;
	Thu, 29 Oct 2009 23:27:40 +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 CECB88FC13;
	Thu, 29 Oct 2009 23:27: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 n9TNReHA016003;
	Thu, 29 Oct 2009 23:27:40 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNRe1e016000;
	Thu, 29 Oct 2009 23:27:40 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292327.n9TNRe1e016000@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:27:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198662 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/usb/serial dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:27:41 -0000

Author: thompsa
Date: Thu Oct 29 23:27:40 2009
New Revision: 198662
URL: http://svn.freebsd.org/changeset/base/198662

Log:
  MFC r198257
  
   Add support for newer WinChipHead CH341 chips, previously in the uch341 driver.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/serial/uchcom.c
  stable/8/sys/dev/usb/usbdevs
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/serial/uchcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uchcom.c	Thu Oct 29 23:27:00 2009	(r198661)
+++ stable/8/sys/dev/usb/serial/uchcom.c	Thu Oct 29 23:27:40 2009	(r198662)
@@ -66,7 +66,8 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * driver for WinChipHead CH341/340, the worst USB-serial chip in the world.
+ * Driver for WinChipHead CH341/340, the worst USB-serial chip in the
+ * world.
  */
 
 #include 
@@ -206,6 +207,7 @@ static const struct uchcom_divider_recor
 
 static const struct usb_device_id uchcom_devs[] = {
 	{USB_VPI(USB_VENDOR_WCH, USB_PRODUCT_WCH_CH341SER, 0)},
+	{USB_VPI(USB_VENDOR_WCH2, USB_PRODUCT_WCH2_CH341SER, 0)},
 };
 
 /* protypes */
@@ -213,6 +215,7 @@ static const struct usb_device_id uchcom
 static int	uchcom_pre_param(struct ucom_softc *, struct termios *);
 static void	uchcom_cfg_get_status(struct ucom_softc *, uint8_t *,
 		    uint8_t *);
+static void	uchcom_cfg_open(struct ucom_softc *ucom);
 static void	uchcom_cfg_param(struct ucom_softc *, struct termios *);
 static void	uchcom_cfg_set_break(struct ucom_softc *, uint8_t);
 static void	uchcom_cfg_set_dtr(struct ucom_softc *, uint8_t);
@@ -224,12 +227,9 @@ static void	uchcom_stop_write(struct uco
 static void	uchcom_update_version(struct uchcom_softc *);
 static void	uchcom_convert_status(struct uchcom_softc *, uint8_t);
 static void	uchcom_update_status(struct uchcom_softc *);
-static void	uchcom_set_dtrrts(struct uchcom_softc *);
+static void	uchcom_set_dtr_rts(struct uchcom_softc *);
 static int	uchcom_calc_divider_settings(struct uchcom_divider *, uint32_t);
-static void	uchcom_set_dte_rate(struct uchcom_softc *, uint32_t);
-static void	uchcom_set_line_control(struct uchcom_softc *, tcflag_t);
-static void	uchcom_clear_chip(struct uchcom_softc *);
-static void	uchcom_reset_chip(struct uchcom_softc *);
+static void	uchcom_set_baudrate(struct uchcom_softc *, uint32_t);
 static void	uchcom_poll(struct ucom_softc *ucom);
 
 static device_probe_t uchcom_probe;
@@ -275,6 +275,7 @@ static struct ucom_callback uchcom_callb
 	.ucom_cfg_set_dtr = &uchcom_cfg_set_dtr,
 	.ucom_cfg_set_rts = &uchcom_cfg_set_rts,
 	.ucom_cfg_set_break = &uchcom_cfg_set_break,
+	.ucom_cfg_open = &uchcom_cfg_open,
 	.ucom_cfg_param = &uchcom_cfg_param,
 	.ucom_pre_param = &uchcom_pre_param,
 	.ucom_start_read = &uchcom_start_read,
@@ -341,17 +342,6 @@ uchcom_attach(device_t dev)
 		    "error=%s\n", usbd_errstr(error));
 		goto detach;
 	}
-	/*
-	 * Do the initialization during attach so that the system does not
-	 * sleep during open:
-	 */
-	uchcom_update_version(sc);
-	uchcom_clear_chip(sc);
-	uchcom_reset_chip(sc);
-	uchcom_update_status(sc);
-
-	sc->sc_dtr = 1;
-	sc->sc_rts = 1;
 
 	/* clear stall at first run */
 	mtx_lock(&sc->sc_mtx);
@@ -458,8 +448,7 @@ uchcom_get_version(struct uchcom_softc *
 {
 	uint8_t buf[UCHCOM_INPUT_BUF_SIZE];
 
-	uchcom_ctrl_read(
-	    sc, UCHCOM_REQ_GET_VERSION, 0, 0, buf, sizeof(buf));
+	uchcom_ctrl_read(sc, UCHCOM_REQ_GET_VERSION, 0, 0, buf, sizeof(buf));
 
 	if (rver)
 		*rver = buf[0];
@@ -472,13 +461,13 @@ uchcom_get_status(struct uchcom_softc *s
 }
 
 static void
-uchcom_set_dtrrts_10(struct uchcom_softc *sc, uint8_t val)
+uchcom_set_dtr_rts_10(struct uchcom_softc *sc, uint8_t val)
 {
 	uchcom_write_reg(sc, UCHCOM_REG_STAT1, val, UCHCOM_REG_STAT1, val);
 }
 
 static void
-uchcom_set_dtrrts_20(struct uchcom_softc *sc, uint8_t val)
+uchcom_set_dtr_rts_20(struct uchcom_softc *sc, uint8_t val)
 {
 	uchcom_ctrl_write(sc, UCHCOM_REQ_SET_DTRRTS, val, 0);
 }
@@ -515,7 +504,7 @@ uchcom_update_status(struct uchcom_softc
 
 
 static void
-uchcom_set_dtrrts(struct uchcom_softc *sc)
+uchcom_set_dtr_rts(struct uchcom_softc *sc)
 {
 	uint8_t val = 0;
 
@@ -525,9 +514,9 @@ uchcom_set_dtrrts(struct uchcom_softc *s
 		val |= UCHCOM_RTS_MASK;
 
 	if (sc->sc_version < UCHCOM_VER_20)
-		uchcom_set_dtrrts_10(sc, ~val);
+		uchcom_set_dtr_rts_10(sc, ~val);
 	else
-		uchcom_set_dtrrts_20(sc, ~val);
+		uchcom_set_dtr_rts_20(sc, ~val);
 }
 
 static void
@@ -583,16 +572,16 @@ found:
 		dp->dv_div = (uint8_t)-div;
 	}
 
-	mod = UCHCOM_BPS_MOD_BASE / rate + UCHCOM_BPS_MOD_BASE_OFS;
-	mod = mod + mod / 2;
+	mod = (UCHCOM_BPS_MOD_BASE / rate) + UCHCOM_BPS_MOD_BASE_OFS;
+	mod = mod + (mod / 2);
 
-	dp->dv_mod = mod / 0x100;
+	dp->dv_mod = (mod + 0xFF) / 0x100;
 
 	return (0);
 }
 
 static void
-uchcom_set_dte_rate(struct uchcom_softc *sc, uint32_t rate)
+uchcom_set_baudrate(struct uchcom_softc *sc, uint32_t rate)
 {
 	struct uchcom_divider dv;
 
@@ -607,76 +596,6 @@ uchcom_set_dte_rate(struct uchcom_softc 
 	    UCHCOM_REG_BPS_PAD, 0);
 }
 
-static void
-uchcom_set_line_control(struct uchcom_softc *sc, tcflag_t cflag)
-{
-	uint8_t lcr1 = 0;
-	uint8_t lcr2 = 0;
-
-	uchcom_read_reg(sc, UCHCOM_REG_LCR1, &lcr1, UCHCOM_REG_LCR2, &lcr2);
-
-	lcr1 &= ~UCHCOM_LCR1_MASK;
-	lcr2 &= ~UCHCOM_LCR2_MASK;
-
-	/*
-	 * XXX: it is difficult to handle the line control appropriately:
-	 *   - CS8, !CSTOPB and any parity mode seems ok, but
-	 *   - the chip doesn't have the function to calculate parity
-	 *     in !CS8 mode.
-	 *   - it is unclear that the chip supports CS5,6 mode.
-	 *   - it is unclear how to handle stop bits.
-	 */
-
-	if (cflag & PARENB) {
-		lcr1 |= UCHCOM_LCR1_PARENB;
-		if (cflag & PARODD)
-			lcr2 |= UCHCOM_LCR2_PARODD;
-		else
-			lcr2 |= UCHCOM_LCR2_PAREVEN;
-	}
-	uchcom_write_reg(sc, UCHCOM_REG_LCR1, lcr1, UCHCOM_REG_LCR2, lcr2);
-}
-
-static void
-uchcom_clear_chip(struct uchcom_softc *sc)
-{
-	DPRINTF("\n");
-	uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0, 0);
-}
-
-static void
-uchcom_reset_chip(struct uchcom_softc *sc)
-{
-	uint16_t val;
-	uint16_t idx;
-	uint8_t lcr1;
-	uint8_t lcr2;
-	uint8_t pre;
-	uint8_t div;
-	uint8_t mod;
-
-	uchcom_read_reg(sc, UCHCOM_REG_LCR1, &lcr1, UCHCOM_REG_LCR2, &lcr2);
-	uchcom_read_reg(sc, UCHCOM_REG_BPS_PRE, &pre, UCHCOM_REG_BPS_DIV, &div);
-	uchcom_read_reg(sc, UCHCOM_REG_BPS_MOD, &mod, UCHCOM_REG_BPS_PAD, NULL);
-
-	val = 0;
-	idx = 0;
-	val |= (uint16_t)(lcr1 & 0xF0) << 8;
-	val |= 0x01;
-	val |= (uint16_t)(lcr2 & 0x0F) << 8;
-	val |= 0x02;
-	idx |= pre & 0x07;
-	val |= 0x04;
-	idx |= (uint16_t)div << 8;
-	val |= 0x08;
-	idx |= mod & 0xF8;
-	val |= 0x10;
-
-	DPRINTF("reset v=0x%04X, i=0x%04X\n", val, idx);
-
-	uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, val, idx);
-}
-
 /* ----------------------------------------------------------------------
  * methods for ucom
  */
@@ -699,7 +618,7 @@ uchcom_cfg_set_dtr(struct ucom_softc *uc
 	DPRINTF("onoff = %d\n", onoff);
 
 	sc->sc_dtr = onoff;
-	uchcom_set_dtrrts(sc);
+	uchcom_set_dtr_rts(sc);
 }
 
 static void
@@ -710,7 +629,18 @@ uchcom_cfg_set_rts(struct ucom_softc *uc
 	DPRINTF("onoff = %d\n", onoff);
 
 	sc->sc_rts = onoff;
-	uchcom_set_dtrrts(sc);
+	uchcom_set_dtr_rts(sc);
+}
+
+static void
+uchcom_cfg_open(struct ucom_softc *ucom)
+{
+	struct uchcom_softc *sc = ucom->sc_parent;
+
+	DPRINTF("\n");
+
+	uchcom_update_version(sc);
+	uchcom_update_status(sc);
 }
 
 static int
@@ -719,12 +649,10 @@ uchcom_pre_param(struct ucom_softc *ucom
 	struct uchcom_divider dv;
 
 	switch (t->c_cflag & CSIZE) {
-	case CS5:
-	case CS6:
-	case CS7:
-		return (EIO);
-	default:
+	case CS8:
 		break;
+	default:
+		return (EIO);
 	}
 
 	if (uchcom_calc_divider_settings(&dv, t->c_ospeed)) {
@@ -738,8 +666,16 @@ uchcom_cfg_param(struct ucom_softc *ucom
 {
 	struct uchcom_softc *sc = ucom->sc_parent;
 
-	uchcom_set_line_control(sc, t->c_cflag);
-	uchcom_set_dte_rate(sc, t->c_ospeed);
+	uchcom_get_version(sc, 0);
+	uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0, 0);
+	uchcom_set_baudrate(sc, t->c_ospeed);
+	uchcom_read_reg(sc, 0x18, 0, 0x25, 0);
+	uchcom_write_reg(sc, 0x18, 0x50, 0x25, 0x00);
+	uchcom_update_status(sc);
+	uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, 0x501f, 0xd90a);
+	uchcom_set_baudrate(sc, t->c_ospeed);
+	uchcom_set_dtr_rts(sc);
+	uchcom_update_status(sc);
 }
 
 static void
@@ -840,14 +776,14 @@ uchcom_write_callback(struct usb_xfer *x
 tr_setup:
 		pc = usbd_xfer_get_frame(xfer, 0);
 		if (ucom_get_data(&sc->sc_ucom, pc, 0,
-		    UCHCOM_BULK_BUF_SIZE, &actlen)) {
+		    usbd_xfer_max_len(xfer), &actlen)) {
 
 			DPRINTF("actlen = %d\n", actlen);
 
 			usbd_xfer_set_frame_len(xfer, 0, actlen);
 			usbd_transfer_submit(xfer);
 		}
-		return;
+		break;
 
 	default:			/* Error */
 		if (error != USB_ERR_CANCELLED) {
@@ -855,8 +791,7 @@ tr_setup:
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
 		}
-		return;
-
+		break;
 	}
 }
 
@@ -871,14 +806,17 @@ uchcom_read_callback(struct usb_xfer *xf
 
 	switch (USB_GET_STATE(xfer)) {
 	case USB_ST_TRANSFERRED:
-		pc = usbd_xfer_get_frame(xfer, 0);
-		ucom_put_data(&sc->sc_ucom, pc, 0, actlen);
+
+		if (actlen > 0) {
+			pc = usbd_xfer_get_frame(xfer, 0);
+			ucom_put_data(&sc->sc_ucom, pc, 0, actlen);
+		}
 
 	case USB_ST_SETUP:
 tr_setup:
 		usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
 		usbd_transfer_submit(xfer);
-		return;
+		break;
 
 	default:			/* Error */
 		if (error != USB_ERR_CANCELLED) {
@@ -886,7 +824,7 @@ tr_setup:
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
 		}
-		return;
+		break;
 	}
 }
 

Modified: stable/8/sys/dev/usb/usbdevs
==============================================================================
--- stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:27:00 2009	(r198661)
+++ stable/8/sys/dev/usb/usbdevs	Thu Oct 29 23:27:40 2009	(r198662)
@@ -626,6 +626,7 @@ vendor AMIT		0x18c5	AMIT
 vendor QCOM		0x18e8	Qcom
 vendor LINKSYS3		0x1915	Linksys
 vendor QUALCOMMINC	0x19d2	Qualcomm, Incorporated
+vendor WCH2		0x1a86	QinHeng Electronics
 vendor STELERA		0x1a8d	Stelera Wireless
 vendor MPMAN		0x1cae	MpMan
 vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik
@@ -2506,8 +2507,11 @@ product WACOM GRAPHIRE		0x0010	Graphire
 product WACOM GRAPHIRE3_4X5	0x0013	Graphire 3 4x5
 product WACOM INTUOSA5		0x0021	Intuos A5
 product WACOM GD0912U		0x0022	Intuos 9x12 Graphics Tablet
-/* WCH products*/
+
+/* WCH products */
 product WCH CH341SER		0x5523	CH341/CH340 USB-Serial Bridge
+product WCH2 CH341SER		0x7523	CH341/CH340 USB-Serial Bridge
+
 /* Western Digital products */
 product WESTERN COMBO		0x0200	Firewire USB Combo
 product WESTERN EXTHDD		0x0400	External HDD

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:28:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C1FF1065692;
	Thu, 29 Oct 2009 23:28:21 +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 67C038FC15;
	Thu, 29 Oct 2009 23:28:21 +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 n9TNSLdx016112;
	Thu, 29 Oct 2009 23:28:21 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNSLxl016110;
	Thu, 29 Oct 2009 23:28:21 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292328.n9TNSLxl016110@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:28:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198663 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci modules/usb/ucom
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:28:21 -0000

Author: thompsa
Date: Thu Oct 29 23:28:21 2009
New Revision: 198663
URL: http://svn.freebsd.org/changeset/base/198663

Log:
  MFC r198258
  
   Add opt_gdb.h which is now needed by ucom.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/modules/usb/ucom/Makefile

Modified: stable/8/sys/modules/usb/ucom/Makefile
==============================================================================
--- stable/8/sys/modules/usb/ucom/Makefile	Thu Oct 29 23:27:40 2009	(r198662)
+++ stable/8/sys/modules/usb/ucom/Makefile	Thu Oct 29 23:28:21 2009	(r198663)
@@ -30,7 +30,7 @@ S=     ${.CURDIR}/../../..
 .PATH: $S/dev/usb/serial
 
 KMOD=	ucom
-SRCS=	opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h \
+SRCS=	opt_bus.h opt_usb.h opt_gdb.h device_if.h bus_if.h usb_if.h usbdevs.h \
 	usb_serial.c
 
 .include 

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:28:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C3E5410656A3;
	Thu, 29 Oct 2009 23:28:48 +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 AF34C8FC28;
	Thu, 29 Oct 2009 23:28: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 n9TNSmKC016203;
	Thu, 29 Oct 2009 23:28:48 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNSmOP016201;
	Thu, 29 Oct 2009 23:28:48 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200910292328.n9TNSmOP016201@svn.freebsd.org>
From: Andrew Thompson 
Date: Thu, 29 Oct 2009 23:28:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198664 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb/input dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:28:49 -0000

Author: thompsa
Date: Thu Oct 29 23:28:48 2009
New Revision: 198664
URL: http://svn.freebsd.org/changeset/base/198664

Log:
  MFC r198373
  
   Allow dumping the USB mouse reports via 'sysctl -b dev.ums.N.parseinfo',
   previously only available via bootverbose.
  
  PR:		usb/137191

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/input/ums.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/input/ums.c
==============================================================================
--- stable/8/sys/dev/usb/input/ums.c	Thu Oct 29 23:28:21 2009	(r198663)
+++ stable/8/sys/dev/usb/input/ums.c	Thu Oct 29 23:28:48 2009	(r198664)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -161,7 +162,9 @@ static usb_fifo_open_t ums_open;
 static usb_fifo_close_t ums_close;
 static usb_fifo_ioctl_t ums_ioctl;
 
-static void ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy, int32_t dz, int32_t dt, int32_t buttons);
+static void	ums_put_queue(struct ums_softc *, int32_t, int32_t,
+		    int32_t, int32_t, int32_t);
+static int	ums_sysctl_handler_parseinfo(SYSCTL_HANDLER_ARGS);
 
 static struct usb_fifo_methods ums_fifo_methods = {
 	.f_open = &ums_open,
@@ -643,6 +646,12 @@ ums_attach(device_t dev)
 	if (err) {
 		goto detach;
 	}
+	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+	    OID_AUTO, "parseinfo", CTLTYPE_STRING|CTLFLAG_RD,
+	    sc, 0, ums_sysctl_handler_parseinfo,
+	    "", "Dump UMS report parsing information");
+
 	return (0);
 
 detach:
@@ -916,6 +925,67 @@ done:
 	return (error);
 }
 
+static int
+ums_sysctl_handler_parseinfo(SYSCTL_HANDLER_ARGS)
+{
+	struct ums_softc *sc = arg1;
+	struct ums_info *info;
+	struct sbuf *sb;
+	int i, j, err;
+
+	sb = sbuf_new_auto();
+	for (i = 0; i < UMS_INFO_MAX; i++) {
+		info = &sc->sc_info[i];
+
+		/* Don't emit empty info */
+		if ((info->sc_flags &
+		    (UMS_FLAG_X_AXIS | UMS_FLAG_Y_AXIS | UMS_FLAG_Z_AXIS |
+		     UMS_FLAG_T_AXIS | UMS_FLAG_W_AXIS)) == 0 &&
+		    info->sc_buttons == 0)
+			continue;
+
+		sbuf_printf(sb, "i%d:", i + 1);
+		if (info->sc_flags & UMS_FLAG_X_AXIS)
+			sbuf_printf(sb, " X:r%d, p%d, s%d;",
+			    (int)info->sc_iid_x,
+			    (int)info->sc_loc_x.pos,
+			    (int)info->sc_loc_x.size);
+		if (info->sc_flags & UMS_FLAG_Y_AXIS)
+			sbuf_printf(sb, " Y:r%d, p%d, s%d;",
+			    (int)info->sc_iid_y,
+			    (int)info->sc_loc_y.pos,
+			    (int)info->sc_loc_y.size);
+		if (info->sc_flags & UMS_FLAG_Z_AXIS)
+			sbuf_printf(sb, " Z:r%d, p%d, s%d;",
+			    (int)info->sc_iid_z,
+			    (int)info->sc_loc_z.pos,
+			    (int)info->sc_loc_z.size);
+		if (info->sc_flags & UMS_FLAG_T_AXIS)
+			sbuf_printf(sb, " T:r%d, p%d, s%d;",
+			    (int)info->sc_iid_t,
+			    (int)info->sc_loc_t.pos,
+			    (int)info->sc_loc_t.size);
+		if (info->sc_flags & UMS_FLAG_W_AXIS)
+			sbuf_printf(sb, " W:r%d, p%d, s%d;",
+			    (int)info->sc_iid_w,
+			    (int)info->sc_loc_w.pos,
+			    (int)info->sc_loc_w.size);
+
+		for (j = 0; j < info->sc_buttons; j++) {
+			sbuf_printf(sb, " B%d:r%d, p%d, s%d;", j + 1,
+			    (int)info->sc_iid_btn[j],
+			    (int)info->sc_loc_btn[j].pos,
+			    (int)info->sc_loc_btn[j].size);
+		}
+		sbuf_printf(sb, "\n");
+	}
+	sbuf_finish(sb);
+	err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+	sbuf_delete(sb);
+
+	return (err);
+}
+
 static devclass_t ums_devclass;
 
 static device_method_t ums_methods[] = {

From owner-svn-src-all@FreeBSD.ORG  Thu Oct 29 23:50:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0F84C106566C;
	Thu, 29 Oct 2009 23:50: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 A5DEE8FC24;
	Thu, 29 Oct 2009 23:50:55 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n9TNbN75019601;
	Thu, 29 Oct 2009 17:37:23 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Thu, 29 Oct 2009 17:37:34 -0600 (MDT)
Message-Id: <20091029.173734.404970008.imp@bsdimp.com>
To: nwhitehorn@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <200910291327.n9TDREeJ097506@svn.freebsd.org>
References: <200910291327.n9TDREeJ097506@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.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
Subject: Re: svn commit: r198582 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 29 Oct 2009 23:50:56 -0000

In message: <200910291327.n9TDREeJ097506@svn.freebsd.org>
            Nathan Whitehorn  writes:
: +#if 0
: +#define	ATA_LEGACY_SUPPORT		/* Enable obsolete features that break
: +					 * some modern devices */
: +#endif

Shouldn't this just be a kernel option?

Warner

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 03:22:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C4A98106566B;
	Fri, 30 Oct 2009 03:22:45 +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 1F2968FC14;
	Fri, 30 Oct 2009 03:22:44 +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 n9U3MekK043978
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Oct 2009 05:22:40 +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
	n9U3Medt089964; Fri, 30 Oct 2009 05:22:40 +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 n9U3Mehc089963; 
	Fri, 30 Oct 2009 05:22:40 +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: Fri, 30 Oct 2009 05:22:40 +0200
From: Kostik Belousov 
To: Giorgos Keramidas 
Message-ID: <20091030032240.GD2147@deviant.kiev.zoral.com.ua>
References: <200910291434.n9TEYOVJ099388@svn.freebsd.org>
	<871vklbxyf.fsf@kobe.laptop>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="IMjqdzrDRly81ofr"
Content-Disposition: inline
In-Reply-To: <871vklbxyf.fsf@kobe.laptop>
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: r198590 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 03:22:46 -0000


--IMjqdzrDRly81ofr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Oct 30, 2009 at 01:08:08AM +0200, Giorgos Keramidas wrote:
> On Thu, 29 Oct 2009 14:34:24 +0000 (UTC), Konstantin Belousov  wrote:
> > Author: kib
> > Date: Thu Oct 29 14:34:24 2009
> > New Revision: 198590
> > URL: http://svn.freebsd.org/changeset/base/198590
> >
> > Log:
> >   Trapsignal() calls kern_sigprocmask() when delivering catched signal
> >   with proc lock held.
> >
> >   Reported and tested by:	Mykola Dzham  freebsd at levsha org ua
> >   MFC after:	1 month
>=20
> Hi Konstantin,
>=20
> Some of the recent kern_sig changes end up recursing on a non-recursive
> mutex in kern_sigprocmask() -> reschedule_signals():
>=20
> panic: _mtx_lock_sleep: recursed on non-recursive mutex sigacts @ /usr/sr=
c/sys/kern/kern_sig.c:2422
> (kgdb) bt
> #0  doadump () at pcpu.h:246
> #1  0xc0680bee in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c=
:416
> #2  0xc0680ec2 in panic (fmt=3DVariable "fmt" is not available.
>     ) at /usr/src/sys/kern/kern_shutdown.c:579
> #3  0xc06716ea in _mtx_lock_sleep (m=3D0xc8154aa8, tid=3D3332925072, opts=
=3D0, file=3D0xc09bb332 "/usr/src/sys/kern/kern_sig.c", line=3D2422)
>     at /usr/src/sys/kern/kern_mutex.c:341
> #4  0xc0671907 in _mtx_lock_flags (m=3D0xc8154aa8, opts=3D0, file=3D0xc09=
bb332 "/usr/src/sys/kern/kern_sig.c", line=3D2422)
>     at /usr/src/sys/kern/kern_mutex.c:203
> #5  0xc0683434 in reschedule_signals (p=3D0xc71172a8, block=3D{__bits =3D=
 {0, 0, 0, 0}}) at /usr/src/sys/kern/kern_sig.c:2422
> #6  0xc0683751 in kern_sigprocmask (td=3D0xc6a86690, how=3D1, set=3D0xe90=
05cd4, oset=3D0x0, flags=3D2) at /usr/src/sys/kern/kern_sig.c:1027
> #7  0xc0684801 in postsig (sig=3D20) at /usr/src/sys/kern/kern_sig.c:2743
> #8  0xc06be228 in ast (framep=3D0xe9005d38) at /usr/src/sys/kern/subr_tra=
p.c:234
> #9  0xc0920624 in doreti_ast () at /usr/src/sys/i386/i386/exception.s:365
>=20
> I think the change that started causing this for MT applications was
> change 197963 in /head that added this bit of code in kern_sig.c inside
> kern_sigprocmask():
>=20
> : @@ -1012,7 +1012,20 @@
> :                          break;
> :                  }
> :          }
> : -        PROC_UNLOCK(td->td_proc);
> : +        /*
> : +         * The new_block set contains signals that were not previosly
> : +         * blocked, but are blocked now.
> : +         *
> : +         * In case we block any signal that was not previously blocked
> : +         * for td, and process has the signal pending, try to schedule
> : +         * signal delivery to some thread that does not block the sign=
al,
> : +         * possibly waking it up.
> : +         */
> : +        if (p->p_numthreads !=3D 1)
> : +                reschedule_signals(p, new_block);
> : +
> : +        PROC_UNLOCK(p);
> :          return (error);
No, this was caused by the r198507 fragment of postsig(), as well as a
fragment from the trapsignal(), that added the call to kern_sigprocmask()
instead of direct manipulation of thread signal mask.

>=20
> AFAICT, postsig() is called with proc->p_sigacts->ps_mtx locked, so when
> we are recursing when reschedule_signals() tries to lock it once more.
Yes, the same statement holds for trapsignal().

>=20
> Since we are holding the proc lock in kern_sigprocmask(), is it safe to
> assert that we own ps_mtx, drop it and re-acquire it immediately after
> calling reschedule_signals()?

No. Most callers of kern_sigprocmask() do not hold curproc->ps_mtx.
Only postsig() and trapsig() call kern_sigprocmask() with ps_mtx locked,
so I have to special-case them.

Could you, please, test the following patch ? What application did
exposed the issue ?

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 7f5cfa3..e174df1 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -220,7 +220,7 @@ static int sigproptbl[NSIG] =3D {
         SA_KILL|SA_PROC,		/* SIGUSR2 */
 };
=20
-static void reschedule_signals(struct proc *p, sigset_t block);
+static void reschedule_signals(struct proc *p, sigset_t block, int flags);
=20
 static void
 sigqueue_start(void)
@@ -1024,7 +1024,7 @@ kern_sigprocmask(struct thread *td, int how, sigset_t=
 *set, sigset_t *oset,
 	 * possibly waking it up.
 	 */
 	if (p->p_numthreads !=3D 1)
-		reschedule_signals(p, new_block);
+		reschedule_signals(p, new_block, flags);
=20
 	if (!(flags & SIGPROCMASK_PROC_LOCKED))
 		PROC_UNLOCK(p);
@@ -1859,13 +1859,11 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
 #endif
 		(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)],=20
 				ksi, &td->td_sigmask);
-		SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
-		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
-			SIGEMPTYSET(mask);
+		mask =3D ps->ps_catchmask[_SIG_IDX(sig)];
+		if (!SIGISMEMBER(ps->ps_signodefer, sig))
 			SIGADDSET(mask, sig);
-			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
-			    SIGPROCMASK_PROC_LOCKED);
-		}
+		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
+		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
 		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
 			/*
 			 * See kern_sigaction() for origin of this code.
@@ -2401,7 +2399,7 @@ stopme:
 }
=20
 static void
-reschedule_signals(struct proc *p, sigset_t block)
+reschedule_signals(struct proc *p, sigset_t block, int flags)
 {
 	struct sigacts *ps;
 	struct thread *td;
@@ -2419,12 +2417,14 @@ reschedule_signals(struct proc *p, sigset_t block)
=20
 		td =3D sigtd(p, i, 0);
 		signotify(td);
-		mtx_lock(&ps->ps_mtx);
+		if (!(flags & SIGPROCMASK_PS_LOCKED))
+			mtx_lock(&ps->ps_mtx);
 		if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i))
 			tdsigwakeup(td, i, SIG_CATCH,
 			    (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR :
 			     ERESTART));
-		mtx_unlock(&ps->ps_mtx);
+		if (!(flags & SIGPROCMASK_PS_LOCKED))
+			mtx_unlock(&ps->ps_mtx);
 	}
 }
=20
@@ -2452,7 +2452,7 @@ tdsigcleanup(struct thread *td)
 	SIGFILLSET(unblocked);
 	SIGSETNAND(unblocked, td->td_sigmask);
 	SIGFILLSET(td->td_sigmask);
-	reschedule_signals(p, unblocked);
+	reschedule_signals(p, unblocked, 0);
=20
 }
=20
@@ -2734,15 +2734,11 @@ postsig(sig)
 		} else
 			returnmask =3D td->td_sigmask;
=20
-		kern_sigprocmask(td, SIG_BLOCK,
-		    &ps->ps_catchmask[_SIG_IDX(sig)], NULL,
-		    SIGPROCMASK_PROC_LOCKED);
-		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
-			SIGEMPTYSET(mask);
+		mask =3D ps->ps_catchmask[_SIG_IDX(sig)];
+		if (!SIGISMEMBER(ps->ps_signodefer, sig))
 			SIGADDSET(mask, sig);
-			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
-			    SIGPROCMASK_PROC_LOCKED);
-		}
+		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
+		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
=20
 		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
 			/*
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index b9a54f0..c27a128 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -319,6 +319,7 @@ extern int kern_logsigexit;	/* Sysctl variable kern.log=
sigexit */
 /* flags for kern_sigprocmask */
 #define	SIGPROCMASK_OLD		0x0001
 #define	SIGPROCMASK_PROC_LOCKED	0x0002
+#define	SIGPROCMASK_PS_LOCKED	0x0004
=20
 /*
  * Machine-independent functions:

--IMjqdzrDRly81ofr
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrqW/8ACgkQC3+MBN1Mb4ji0QCdHnCI7qNdkGRvk84c1/STUiGc
9VoAnRViQHhckK3jz0HmdWoBWbbtI2aE
=h/98
-----END PGP SIGNATURE-----

--IMjqdzrDRly81ofr--

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 04:12:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93F7C106568D;
	Fri, 30 Oct 2009 04:12:22 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr
	[150.140.141.169])
	by mx1.freebsd.org (Postfix) with ESMTP id E62068FC1C;
	Fri, 30 Oct 2009 04:12:21 +0000 (UTC)
Received: from mail.ceid.upatras.gr (unknown [10.1.0.143])
	by poseidon.ceid.upatras.gr (Postfix) with ESMTP id D36C1EB4721;
	Fri, 30 Oct 2009 06:12:20 +0200 (EET)
Received: from localhost (europa.ceid.upatras.gr [127.0.0.1])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id AB12D451B2;
	Fri, 30 Oct 2009 06:12:20 +0200 (EET)
X-Virus-Scanned: amavisd-new at ceid.upatras.gr
Received: from mail.ceid.upatras.gr ([127.0.0.1])
	by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id 7GzRfE5vEW2i; Fri, 30 Oct 2009 06:12:20 +0200 (EET)
Received: from kobe.laptop (ppp-94-64-196-111.home.otenet.gr [94.64.196.111])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id 4AC2A45152;
	Fri, 30 Oct 2009 06:12:20 +0200 (EET)
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9U4CJ55011875
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Oct 2009 06:12:19 +0200 (EET)
	(envelope-from keramida@freebsd.org)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.3/8.14.3/Submit) id n9U4CI50011874;
	Fri, 30 Oct 2009 06:12:18 +0200 (EET)
	(envelope-from keramida@freebsd.org)
From: Giorgos Keramidas 
To: Kostik Belousov 
References: <200910291434.n9TEYOVJ099388@svn.freebsd.org>
	<871vklbxyf.fsf@kobe.laptop>
	<20091030032240.GD2147@deviant.kiev.zoral.com.ua>
Date: Fri, 30 Oct 2009 06:12:11 +0200
In-Reply-To: <20091030032240.GD2147@deviant.kiev.zoral.com.ua> (Kostik
	Belousov's message of "Fri, 30 Oct 2009 05:22:40 +0200")
Message-ID: <87d445a5b8.fsf@kobe.laptop>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r198590 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 04:12:22 -0000

--=-=-=

> No, this was caused by the r198507 fragment of postsig(), as well as a
> fragment from the trapsignal(), that added the call to kern_sigprocmask()
> instead of direct manipulation of thread signal mask.
>
>> AFAICT, postsig() is called with proc->p_sigacts->ps_mtx locked, so when
>> we are recursing when reschedule_signals() tries to lock it once more.
>
> Yes, the same statement holds for trapsignal().
>
>> Since we are holding the proc lock in kern_sigprocmask(), is it safe to
>> assert that we own ps_mtx, drop it and re-acquire it immediately after
>> calling reschedule_signals()?
>
> No. Most callers of kern_sigprocmask() do not hold curproc->ps_mtx.
> Only postsig() and trapsig() call kern_sigprocmask() with ps_mtx locked,
> so I have to special-case them.
>
> Could you, please, test the following patch ? What application did
> exposed the issue ?

Logging out of GNOME consistently triggers this.  The thread that is
active in kgdb is gnome-session:

(kgdb) info threads
  ...
  138 Thread 100142 (PID=2314: gnome-session)  doadump () at pcpu.h:246
  137 Thread 100100 (PID=2314: gnome-session/initial thread)
        sched_switch (td=0xc6a86230, newtd=0xc6564230, flags=1538)
        at /usr/src/sys/kern/sched_ule.c:1864
  ...

I'll try the patch in a few hours and report back.  Thanks! :)

> diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
> index 7f5cfa3..e174df1 100644
> --- a/sys/kern/kern_sig.c
> +++ b/sys/kern/kern_sig.c
> @@ -220,7 +220,7 @@ static int sigproptbl[NSIG] = {
>          SA_KILL|SA_PROC,		/* SIGUSR2 */
>  };
>
> -static void reschedule_signals(struct proc *p, sigset_t block);
> +static void reschedule_signals(struct proc *p, sigset_t block, int flags);
>
>  static void
>  sigqueue_start(void)
> @@ -1024,7 +1024,7 @@ kern_sigprocmask(struct thread *td, int how, sigset_t *set, sigset_t *oset,
>  	 * possibly waking it up.
>  	 */
>  	if (p->p_numthreads != 1)
> -		reschedule_signals(p, new_block);
> +		reschedule_signals(p, new_block, flags);
>
>  	if (!(flags & SIGPROCMASK_PROC_LOCKED))
>  		PROC_UNLOCK(p);
> @@ -1859,13 +1859,11 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
>  #endif
>  		(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)],
>  				ksi, &td->td_sigmask);
> -		SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
> -		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
> -			SIGEMPTYSET(mask);
> +		mask = ps->ps_catchmask[_SIG_IDX(sig)];
> +		if (!SIGISMEMBER(ps->ps_signodefer, sig))
>  			SIGADDSET(mask, sig);
> -			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> -			    SIGPROCMASK_PROC_LOCKED);
> -		}
> +		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> +		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
>  		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
>  			/*
>  			 * See kern_sigaction() for origin of this code.
> @@ -2401,7 +2399,7 @@ stopme:
>  }
>
>  static void
> -reschedule_signals(struct proc *p, sigset_t block)
> +reschedule_signals(struct proc *p, sigset_t block, int flags)
>  {
>  	struct sigacts *ps;
>  	struct thread *td;
> @@ -2419,12 +2417,14 @@ reschedule_signals(struct proc *p, sigset_t block)
>
>  		td = sigtd(p, i, 0);
>  		signotify(td);
> -		mtx_lock(&ps->ps_mtx);
> +		if (!(flags & SIGPROCMASK_PS_LOCKED))
> +			mtx_lock(&ps->ps_mtx);
>  		if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i))
>  			tdsigwakeup(td, i, SIG_CATCH,
>  			    (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR :
>  			     ERESTART));
> -		mtx_unlock(&ps->ps_mtx);
> +		if (!(flags & SIGPROCMASK_PS_LOCKED))
> +			mtx_unlock(&ps->ps_mtx);
>  	}
>  }
>
> @@ -2452,7 +2452,7 @@ tdsigcleanup(struct thread *td)
>  	SIGFILLSET(unblocked);
>  	SIGSETNAND(unblocked, td->td_sigmask);
>  	SIGFILLSET(td->td_sigmask);
> -	reschedule_signals(p, unblocked);
> +	reschedule_signals(p, unblocked, 0);
>
>  }
>
> @@ -2734,15 +2734,11 @@ postsig(sig)
>  		} else
>  			returnmask = td->td_sigmask;
>
> -		kern_sigprocmask(td, SIG_BLOCK,
> -		    &ps->ps_catchmask[_SIG_IDX(sig)], NULL,
> -		    SIGPROCMASK_PROC_LOCKED);
> -		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
> -			SIGEMPTYSET(mask);
> +		mask = ps->ps_catchmask[_SIG_IDX(sig)];
> +		if (!SIGISMEMBER(ps->ps_signodefer, sig))
>  			SIGADDSET(mask, sig);
> -			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> -			    SIGPROCMASK_PROC_LOCKED);
> -		}
> +		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> +		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
>
>  		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
>  			/*
> diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
> index b9a54f0..c27a128 100644
> --- a/sys/sys/signalvar.h
> +++ b/sys/sys/signalvar.h
> @@ -319,6 +319,7 @@ extern int kern_logsigexit;	/* Sysctl variable kern.logsigexit */
>  /* flags for kern_sigprocmask */
>  #define	SIGPROCMASK_OLD		0x0001
>  #define	SIGPROCMASK_PROC_LOCKED	0x0002
> +#define	SIGPROCMASK_PS_LOCKED	0x0004
>
>  /*
>   * Machine-independent functions:

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkrqZ6IACgkQ1g+UGjGGA7Yt8ACfRNfjWFWhjV4Ntic7dAXOZh5D
7CgAn2r+bLuCSbWm/sOugWfUcZ4DzST2
=gTB4
-----END PGP SIGNATURE-----
--=-=-=--

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 07:48:18 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AD496106566B;
	Fri, 30 Oct 2009 07:48:18 +0000 (UTC)
	(envelope-from mavbsd@gmail.com)
Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com
	[209.85.218.213])
	by mx1.freebsd.org (Postfix) with ESMTP id AD5DC8FC0A;
	Fri, 30 Oct 2009 07:48:17 +0000 (UTC)
Received: by bwz5 with SMTP id 5so3252527bwz.3
	for ; Fri, 30 Oct 2009 00:48:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:message-id:date:from
	:user-agent:mime-version:to:cc:subject:references:in-reply-to
	:x-enigmail-version:content-type:content-transfer-encoding;
	bh=+x6PdL930LXubSAOvgZQ0kUiIBl3iY02OT826ytVlDs=;
	b=hscM9BF1oYbR56ywPkw4Eq+kuQuHIgExpZTJWGkQRSILUkNR/Uy7e+UBSwIXL0UxMi
	bNS+M3PO6Bo23scVbXFIBnMXWFnpX1aPROzdly7tnz5lWf432AznARwcQBP4SZe9C0xb
	ddR2ymnkutlpLxXSKnlUZNOUvNqPHYA4i8bn8=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:x-enigmail-version:content-type
	:content-transfer-encoding;
	b=qDiRCQSO3/h1ouD/vUh8IE7e++wloUiugPgxFeeOQ9BniCMunAA20W2OpUUvt9jCPJ
	UDLavHAZxnoPLO20ZwO4H2Q44jsSgsyHW/AjST8SBopa5wDVCexsNxcXoMgSdOTxWTmJ
	VPRVeO0teRWPcPjfjBIzvxmLM6mMZfJq0gZh0=
Received: by 10.103.50.29 with SMTP id c29mr473470muk.61.1256888896358;
	Fri, 30 Oct 2009 00:48:16 -0700 (PDT)
Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226])
	by mx.google.com with ESMTPS id 14sm2388575muo.15.2009.10.30.00.48.14
	(version=SSLv3 cipher=RC4-MD5); Fri, 30 Oct 2009 00:48:15 -0700 (PDT)
Sender: Alexander Motin 
Message-ID: <4AEA9A3C.3000406@FreeBSD.org>
Date: Fri, 30 Oct 2009 09:48:12 +0200
From: Alexander Motin 
User-Agent: Thunderbird 2.0.0.23 (X11/20090901)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200910291327.n9TDREeJ097506@svn.freebsd.org>
	<20091029.173734.404970008.imp@bsdimp.com>
In-Reply-To: <20091029.173734.404970008.imp@bsdimp.com>
X-Enigmail-Version: 0.96.0
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, nwhitehorn@freebsd.org
Subject: Re: svn commit: r198582 - head/sys/dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 07:48:18 -0000

M. Warner Losh wrote:
> In message: <200910291327.n9TDREeJ097506@svn.freebsd.org>
>             Nathan Whitehorn  writes:
> : +#if 0
> : +#define	ATA_LEGACY_SUPPORT		/* Enable obsolete features that break
> : +					 * some modern devices */
> : +#endif
> 
> Shouldn't this just be a kernel option?

We decided to make it an option after first real problem report. If
there will be none in a year, we can just remove this code.

-- 
Alexander Motin

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 09:41:19 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 002AA106568D;
	Fri, 30 Oct 2009 09:41:18 +0000 (UTC)
	(envelope-from keramida@freebsd.org)
Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr
	[150.140.141.169])
	by mx1.freebsd.org (Postfix) with ESMTP id 60F5A8FC1C;
	Fri, 30 Oct 2009 09:41:18 +0000 (UTC)
Received: from mail.ceid.upatras.gr (unknown [10.1.0.143])
	by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 66BC3EB4784;
	Fri, 30 Oct 2009 11:41:17 +0200 (EET)
Received: from localhost (europa.ceid.upatras.gr [127.0.0.1])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id 3308D45152;
	Fri, 30 Oct 2009 11:41:17 +0200 (EET)
X-Virus-Scanned: amavisd-new at ceid.upatras.gr
Received: from mail.ceid.upatras.gr ([127.0.0.1])
	by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new,
	port 10024)
	with ESMTP id BaVzj8bQg+DD; Fri, 30 Oct 2009 11:41:17 +0200 (EET)
Received: from kobe.laptop (ppp-94-64-196-111.home.otenet.gr [94.64.196.111])
	by mail.ceid.upatras.gr (Postfix) with ESMTP id B9BCC450C6;
	Fri, 30 Oct 2009 11:41:16 +0200 (EET)
Received: from kobe.laptop (kobe.laptop [127.0.0.1])
	by kobe.laptop (8.14.3/8.14.3) with ESMTP id n9U9fF7s004274
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Fri, 30 Oct 2009 11:41:15 +0200 (EET)
	(envelope-from keramida@freebsd.org)
Received: (from keramida@localhost)
	by kobe.laptop (8.14.3/8.14.3/Submit) id n9U9fE4n004273;
	Fri, 30 Oct 2009 11:41:14 +0200 (EET)
	(envelope-from keramida@freebsd.org)
From: Giorgos Keramidas 
To: Kostik Belousov 
References: <200910291434.n9TEYOVJ099388@svn.freebsd.org>
	<871vklbxyf.fsf@kobe.laptop>
	<20091030032240.GD2147@deviant.kiev.zoral.com.ua>
Date: Fri, 30 Oct 2009 11:41:06 +0200
In-Reply-To: <20091030032240.GD2147@deviant.kiev.zoral.com.ua> (Kostik
	Belousov's message of "Fri, 30 Oct 2009 05:22:40 +0200")
Message-ID: <87r5slw765.fsf@kobe.laptop>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
	micalg=pgp-sha1; protocol="application/pgp-signature"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r198590 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 09:41:19 -0000

--=-=-=
Content-Transfer-Encoding: quoted-printable

The patch works fine so far.  I haven't seen any other panics of this
sort, for around 5 hours of running with a patched kernel.

On Fri, 30 Oct 2009 05:22:40 +0200, Kostik Belousov  w=
rote:
> Could you, please, test the following patch ? What application did
> exposed the issue ?
>
> diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
> index 7f5cfa3..e174df1 100644
> --- a/sys/kern/kern_sig.c
> +++ b/sys/kern/kern_sig.c
> @@ -220,7 +220,7 @@ static int sigproptbl[NSIG] =3D {
>          SA_KILL|SA_PROC,		/* SIGUSR2 */
>  };
>=20=20
> -static void reschedule_signals(struct proc *p, sigset_t block);
> +static void reschedule_signals(struct proc *p, sigset_t block, int flags=
);
>=20=20
>  static void
>  sigqueue_start(void)
> @@ -1024,7 +1024,7 @@ kern_sigprocmask(struct thread *td, int how, sigset=
_t *set, sigset_t *oset,
>  	 * possibly waking it up.
>  	 */
>  	if (p->p_numthreads !=3D 1)
> -		reschedule_signals(p, new_block);
> +		reschedule_signals(p, new_block, flags);
>=20=20
>  	if (!(flags & SIGPROCMASK_PROC_LOCKED))
>  		PROC_UNLOCK(p);
> @@ -1859,13 +1859,11 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
>  #endif
>  		(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)],=20
>  				ksi, &td->td_sigmask);
> -		SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
> -		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
> -			SIGEMPTYSET(mask);
> +		mask =3D ps->ps_catchmask[_SIG_IDX(sig)];
> +		if (!SIGISMEMBER(ps->ps_signodefer, sig))
>  			SIGADDSET(mask, sig);
> -			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> -			    SIGPROCMASK_PROC_LOCKED);
> -		}
> +		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> +		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
>  		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
>  			/*
>  			 * See kern_sigaction() for origin of this code.
> @@ -2401,7 +2399,7 @@ stopme:
>  }
>=20=20
>  static void
> -reschedule_signals(struct proc *p, sigset_t block)
> +reschedule_signals(struct proc *p, sigset_t block, int flags)
>  {
>  	struct sigacts *ps;
>  	struct thread *td;
> @@ -2419,12 +2417,14 @@ reschedule_signals(struct proc *p, sigset_t block)
>=20=20
>  		td =3D sigtd(p, i, 0);
>  		signotify(td);
> -		mtx_lock(&ps->ps_mtx);
> +		if (!(flags & SIGPROCMASK_PS_LOCKED))
> +			mtx_lock(&ps->ps_mtx);
>  		if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i))
>  			tdsigwakeup(td, i, SIG_CATCH,
>  			    (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR :
>  			     ERESTART));
> -		mtx_unlock(&ps->ps_mtx);
> +		if (!(flags & SIGPROCMASK_PS_LOCKED))
> +			mtx_unlock(&ps->ps_mtx);
>  	}
>  }
>=20=20
> @@ -2452,7 +2452,7 @@ tdsigcleanup(struct thread *td)
>  	SIGFILLSET(unblocked);
>  	SIGSETNAND(unblocked, td->td_sigmask);
>  	SIGFILLSET(td->td_sigmask);
> -	reschedule_signals(p, unblocked);
> +	reschedule_signals(p, unblocked, 0);
>=20=20
>  }
>=20=20
> @@ -2734,15 +2734,11 @@ postsig(sig)
>  		} else
>  			returnmask =3D td->td_sigmask;
>=20=20
> -		kern_sigprocmask(td, SIG_BLOCK,
> -		    &ps->ps_catchmask[_SIG_IDX(sig)], NULL,
> -		    SIGPROCMASK_PROC_LOCKED);
> -		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
> -			SIGEMPTYSET(mask);
> +		mask =3D ps->ps_catchmask[_SIG_IDX(sig)];
> +		if (!SIGISMEMBER(ps->ps_signodefer, sig))
>  			SIGADDSET(mask, sig);
> -			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> -			    SIGPROCMASK_PROC_LOCKED);
> -		}
> +		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
> +		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
>=20=20
>  		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
>  			/*
> diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
> index b9a54f0..c27a128 100644
> --- a/sys/sys/signalvar.h
> +++ b/sys/sys/signalvar.h
> @@ -319,6 +319,7 @@ extern int kern_logsigexit;	/* Sysctl variable kern.l=
ogsigexit */
>  /* flags for kern_sigprocmask */
>  #define	SIGPROCMASK_OLD		0x0001
>  #define	SIGPROCMASK_PROC_LOCKED	0x0002
> +#define	SIGPROCMASK_PS_LOCKED	0x0004
>=20=20
>  /*
>   * Machine-independent functions:

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkrqtLoACgkQ1g+UGjGGA7bPZgCfWSOKfFZN7HmFICqWCJVUqzIv
yR4AoIyr62tfa0EnGmWeRmHlrVCKRwhJ
=TDFr
-----END PGP SIGNATURE-----
--=-=-=--

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 10:10:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EF4B8106566B;
	Fri, 30 Oct 2009 10:10:39 +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 DCFDA8FC1F;
	Fri, 30 Oct 2009 10:10: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 n9UAAdUM037870;
	Fri, 30 Oct 2009 10:10:39 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UAAdnm037867;
	Fri, 30 Oct 2009 10:10:39 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200910301010.n9UAAdnm037867@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 30 Oct 2009 10:10: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: r198670 - in head/sys: kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 10:10:40 -0000

Author: kib
Date: Fri Oct 30 10:10:39 2009
New Revision: 198670
URL: http://svn.freebsd.org/changeset/base/198670

Log:
  Trapsignal() and postsig() call kern_sigprocmask() with both process
  lock and curproc->p_sigacts->ps_mtx. Reschedule_signals may need to have
  ps_mtx locked to decide and wakeup a thread, causing recursion on the
  mutex.
  
  Inform kern_sigprocmask() and reschedule_signals() about lock state
  of the ps_mtx by new flag SIGPROCMASK_PS_LOCKED to avoid recursion.
  
  Reported and tested by:	keramida
  MFC after:	1 month

Modified:
  head/sys/kern/kern_sig.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Fri Oct 30 08:53:11 2009	(r198669)
+++ head/sys/kern/kern_sig.c	Fri Oct 30 10:10:39 2009	(r198670)
@@ -220,7 +220,7 @@ static int sigproptbl[NSIG] = {
         SA_KILL|SA_PROC,		/* SIGUSR2 */
 };
 
-static void reschedule_signals(struct proc *p, sigset_t block);
+static void reschedule_signals(struct proc *p, sigset_t block, int flags);
 
 static void
 sigqueue_start(void)
@@ -1024,7 +1024,7 @@ kern_sigprocmask(struct thread *td, int 
 	 * possibly waking it up.
 	 */
 	if (p->p_numthreads != 1)
-		reschedule_signals(p, new_block);
+		reschedule_signals(p, new_block, flags);
 
 	if (!(flags & SIGPROCMASK_PROC_LOCKED))
 		PROC_UNLOCK(p);
@@ -1859,13 +1859,11 @@ trapsignal(struct thread *td, ksiginfo_t
 #endif
 		(*p->p_sysent->sv_sendsig)(ps->ps_sigact[_SIG_IDX(sig)], 
 				ksi, &td->td_sigmask);
-		SIGSETOR(td->td_sigmask, ps->ps_catchmask[_SIG_IDX(sig)]);
-		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
-			SIGEMPTYSET(mask);
+		mask = ps->ps_catchmask[_SIG_IDX(sig)];
+		if (!SIGISMEMBER(ps->ps_signodefer, sig))
 			SIGADDSET(mask, sig);
-			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
-			    SIGPROCMASK_PROC_LOCKED);
-		}
+		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
+		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
 		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
 			/*
 			 * See kern_sigaction() for origin of this code.
@@ -2401,7 +2399,7 @@ stopme:
 }
 
 static void
-reschedule_signals(struct proc *p, sigset_t block)
+reschedule_signals(struct proc *p, sigset_t block, int flags)
 {
 	struct sigacts *ps;
 	struct thread *td;
@@ -2419,12 +2417,14 @@ reschedule_signals(struct proc *p, sigse
 
 		td = sigtd(p, i, 0);
 		signotify(td);
-		mtx_lock(&ps->ps_mtx);
+		if (!(flags & SIGPROCMASK_PS_LOCKED))
+			mtx_lock(&ps->ps_mtx);
 		if (p->p_flag & P_TRACED || SIGISMEMBER(ps->ps_sigcatch, i))
 			tdsigwakeup(td, i, SIG_CATCH,
 			    (SIGISMEMBER(ps->ps_sigintr, i) ? EINTR :
 			     ERESTART));
-		mtx_unlock(&ps->ps_mtx);
+		if (!(flags & SIGPROCMASK_PS_LOCKED))
+			mtx_unlock(&ps->ps_mtx);
 	}
 }
 
@@ -2452,7 +2452,7 @@ tdsigcleanup(struct thread *td)
 	SIGFILLSET(unblocked);
 	SIGSETNAND(unblocked, td->td_sigmask);
 	SIGFILLSET(td->td_sigmask);
-	reschedule_signals(p, unblocked);
+	reschedule_signals(p, unblocked, 0);
 
 }
 
@@ -2734,15 +2734,11 @@ postsig(sig)
 		} else
 			returnmask = td->td_sigmask;
 
-		kern_sigprocmask(td, SIG_BLOCK,
-		    &ps->ps_catchmask[_SIG_IDX(sig)], NULL,
-		    SIGPROCMASK_PROC_LOCKED);
-		if (!SIGISMEMBER(ps->ps_signodefer, sig)) {
-			SIGEMPTYSET(mask);
+		mask = ps->ps_catchmask[_SIG_IDX(sig)];
+		if (!SIGISMEMBER(ps->ps_signodefer, sig))
 			SIGADDSET(mask, sig);
-			kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
-			    SIGPROCMASK_PROC_LOCKED);
-		}
+		kern_sigprocmask(td, SIG_BLOCK, &mask, NULL,
+		    SIGPROCMASK_PROC_LOCKED | SIGPROCMASK_PS_LOCKED);
 
 		if (SIGISMEMBER(ps->ps_sigreset, sig)) {
 			/*

Modified: head/sys/sys/signalvar.h
==============================================================================
--- head/sys/sys/signalvar.h	Fri Oct 30 08:53:11 2009	(r198669)
+++ head/sys/sys/signalvar.h	Fri Oct 30 10:10:39 2009	(r198670)
@@ -319,6 +319,7 @@ extern int kern_logsigexit;	/* Sysctl va
 /* flags for kern_sigprocmask */
 #define	SIGPROCMASK_OLD		0x0001
 #define	SIGPROCMASK_PROC_LOCKED	0x0002
+#define	SIGPROCMASK_PS_LOCKED	0x0004
 
 /*
  * Machine-independent functions:

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 11:13:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 04A9F106566B;
	Fri, 30 Oct 2009 11:13:01 +0000 (UTC)
	(envelope-from cperciva@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CCBAF8FC25;
	Fri, 30 Oct 2009 11:13: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 n9UBD0o5041924;
	Fri, 30 Oct 2009 11:13:00 GMT
	(envelope-from cperciva@svn.freebsd.org)
Received: (from cperciva@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UBD0ET041921;
	Fri, 30 Oct 2009 11:13:00 GMT
	(envelope-from cperciva@svn.freebsd.org)
Message-Id: <200910301113.n9UBD0ET041921@svn.freebsd.org>
From: Colin Percival 
Date: Fri, 30 Oct 2009 11:13: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: r198671 - in head/usr.bin/bsdiff: bsdiff bspatch
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 11:13:01 -0000

Author: cperciva
Date: Fri Oct 30 11:13:00 2009
New Revision: 198671
URL: http://svn.freebsd.org/changeset/base/198671

Log:
  Add notes pointing out that bsdiff does not store file hashes and
  bspatch thus does not verify file hashes, and that consequently it
  is recommended that users store hashes separately and verify files
  before and after running bspatch.
  
  Requested by:	BugMagnet
  MFC after:	1 week

Modified:
  head/usr.bin/bsdiff/bsdiff/bsdiff.1
  head/usr.bin/bsdiff/bspatch/bspatch.1

Modified: head/usr.bin/bsdiff/bsdiff/bsdiff.1
==============================================================================
--- head/usr.bin/bsdiff/bsdiff/bsdiff.1	Fri Oct 30 10:10:39 2009	(r198670)
+++ head/usr.bin/bsdiff/bsdiff/bsdiff.1	Fri Oct 30 11:13:00 2009	(r198671)
@@ -65,5 +65,24 @@ an absolute minimum working set size of 
 .Ar oldfile .
 .Sh SEE ALSO
 .Xr bspatch 1
+.Sh BUGS
+The
+.Nm
+utility does not store the hashes of
+.Ar oldfile
+or 
+.Ar newfile
+in
+.Ar patchfile .
+As a result, it is possible to apply a patch to the wrong file; this
+will usually produce garbage.
+It is recommended that users of
+.Nm
+store the hashes of
+.Ar oldfile
+and
+.Ar newfile
+and compare against them before and after applying
+.Ar patchfile .
 .Sh AUTHORS
 .An Colin Percival Aq cperciva@FreeBSD.org

Modified: head/usr.bin/bsdiff/bspatch/bspatch.1
==============================================================================
--- head/usr.bin/bsdiff/bspatch/bspatch.1	Fri Oct 30 10:10:39 2009	(r198670)
+++ head/usr.bin/bsdiff/bspatch/bspatch.1	Fri Oct 30 11:13:00 2009	(r198671)
@@ -61,5 +61,26 @@ but can tolerate a very small working se
 of performance.
 .Sh SEE ALSO
 .Xr bsdiff 1
+.Sh BUGS
+The
+.Nm
+utility does not verify that
+.Ar oldfile
+is the correct source file for
+.Ar patchfile .
+Attempting to apply a patch to the wrong file will usually produce
+garbage; consequently it is strongly recommended that users of
+.Nm
+verify that
+.Ar oldfile
+matches the source file from which
+.Ar patchfile
+was built, by comparing cryptographic hashes, for example.
+Users may also wish to verify after running
+.Nm
+that
+.Ar newfile
+matches the target file from which
+.Ar was built.
 .Sh AUTHORS
 .An Colin Percival Aq cperciva@FreeBSD.org

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 12:57:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9570C106566C;
	Fri, 30 Oct 2009 12:57:28 +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 824978FC12;
	Fri, 30 Oct 2009 12:57: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 n9UCvSBA044861;
	Fri, 30 Oct 2009 12:57:28 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UCvSXv044855;
	Fri, 30 Oct 2009 12:57:28 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910301257.n9UCvSXv044855@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Oct 2009 12:57:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198672 - stable/8/lib/libradius
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 12:57:28 -0000

Author: mav
Date: Fri Oct 30 12:57:28 2009
New Revision: 198672
URL: http://svn.freebsd.org/changeset/base/198672

Log:
  MFC rev. 197086:
  Add simple embedded RADIUS server support to libradius, by extending existing
  API, keeping backward compatibility.
  
  First consumer for this functionality is going to become forthcoming MPD-5.4,
  supporting CoA and DR of RFC 3576: Dynamic Authorization Extensions to RADIUS.

Modified:
  stable/8/lib/libradius/   (props changed)
  stable/8/lib/libradius/libradius.3
  stable/8/lib/libradius/radlib.c
  stable/8/lib/libradius/radlib.h
  stable/8/lib/libradius/radlib_private.h

Modified: stable/8/lib/libradius/libradius.3
==============================================================================
--- stable/8/lib/libradius/libradius.3	Fri Oct 30 11:13:00 2009	(r198671)
+++ stable/8/lib/libradius/libradius.3	Fri Oct 30 12:57:28 2009	(r198672)
@@ -1,4 +1,5 @@
 .\" Copyright 1998 Juniper Networks, Inc.
+.\" Copyright 2009 Alexander Motin .
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2004
+.Dd August 5, 2009
 .Dt LIBRADIUS 3
 .Os
 .Sh NAME
 .Nm libradius
-.Nd RADIUS client library
+.Nd RADIUS client/server library
 .Sh SYNOPSIS
 .In radlib.h
 .Ft "struct rad_handle *"
@@ -46,6 +47,8 @@
 .Fn rad_continue_send_request "struct rad_handle *h" "int selected" "int *fd" "struct timeval *tv"
 .Ft int
 .Fn rad_create_request "struct rad_handle *h" "int code"
+.Ft int
+.Fn rad_create_response "struct rad_handle *h" "int code"
 .Ft "struct in_addr"
 .Fn rad_cvt_addr "const void *data"
 .Ft u_int32_t
@@ -79,7 +82,13 @@
 .Ft ssize_t
 .Fn rad_request_authenticator "struct rad_handle *h" "char *buf" "size_t len"
 .Ft int
+.Fn rad_receive_request "struct rad_handle *h"
+.Ft int
 .Fn rad_send_request "struct rad_handle *h"
+.Ft int
+.Fn rad_send_response "struct rad_handle *h"
+.Ft "struct rad_handle *"
+.Fn rad_server_open "int fd"
 .Ft "const char *"
 .Fn rad_server_secret "struct rad_handle *h"
 .Ft u_char *
@@ -91,16 +100,17 @@
 .Sh DESCRIPTION
 The
 .Nm
-library implements the client side of the Remote Authentication Dial
-In User Service (RADIUS).
+library implements the Remote Authentication Dial In User Service (RADIUS).
 RADIUS, defined in RFCs 2865 and 2866,
 allows clients to perform authentication and accounting by means of
 network requests to remote servers.
 .Ss Initialization
 To use the library, an application must first call
 .Fn rad_auth_open
-or
+,
 .Fn rad_acct_open
+or
+.Fn rad_server_open
 to obtain a
 .Vt "struct rad_handle *" ,
 which provides the context for subsequent operations.
@@ -108,8 +118,10 @@ The former function is used for RADIUS a
 latter is used for RADIUS accounting.
 Calls to
 .Fn rad_auth_open
-and
+,
 .Fn rad_acct_open
+and
+.Fn rad_server_open
 always succeed unless insufficient virtual memory is available.
 If
 the necessary memory cannot be allocated, the functions return
@@ -451,6 +463,25 @@ subsequent library calls using the same 
 .Ss Cleanup
 To free the resources used by the RADIUS library, call
 .Fn rad_close .
+.Ss Server operation
+Server mode operates much alike to client mode, except packet send and receieve
+steps are swapped. To operate as server you should obtain server context with
+.Fn rad_server_open
+function, passing opened and bound UDP socket file descriptor as argument.
+You should define allowed clients and their secrets using
+.Fn rad_add_server
+function. port, timeout and max_tries arguments are ignored in server mode.
+You should call
+.Fn rad_receive_request
+function to receive request from client. If you do not want to block on socket
+read, you are free to use any poll(), select() or non-blocking sockets for
+the socket.
+Received request can be parsed with same parsing functions as for client.
+To respond to the request you should call
+.Fn rad_create_response
+and fill response content with same packet writing functions as for client.
+When packet is ready, it should be sent with
+.Fn rad_send_response
 .Sh RETURN VALUES
 The following functions return a non-negative value on success.
 If
@@ -466,6 +497,8 @@ which can be retrieved using
 .It
 .Fn rad_create_request
 .It
+.Fn rad_create_response
+.It
 .Fn rad_get_attr
 .It
 .Fn rad_put_addr
@@ -483,6 +516,8 @@ which can be retrieved using
 .Fn rad_continue_send_request
 .It
 .Fn rad_send_request
+.It
+.Fn rad_send_response
 .El
 .Pp
 The following functions return a
@@ -499,6 +534,8 @@ without recording an error message.
 .It
 .Fn rad_auth_open
 .It
+.Fn rad_server_open
+.It
 .Fn rad_cvt_string
 .El
 .Pp
@@ -553,3 +590,5 @@ subsequently added the ability to perfor
 accounting.
 Later additions and changes by
 .An Michael Bretterklieber .
+Server mode support was added by
+.An Alexander Motin .

Modified: stable/8/lib/libradius/radlib.c
==============================================================================
--- stable/8/lib/libradius/radlib.c	Fri Oct 30 11:13:00 2009	(r198671)
+++ stable/8/lib/libradius/radlib.c	Fri Oct 30 12:57:28 2009	(r198672)
@@ -103,7 +103,7 @@ insert_scrambled_password(struct rad_han
 	srvp = &h->servers[srv];
 	padded_len = h->pass_len == 0 ? 16 : (h->pass_len+15) & ~0xf;
 
-	memcpy(md5, &h->request[POS_AUTH], LEN_AUTH);
+	memcpy(md5, &h->out[POS_AUTH], LEN_AUTH);
 	for (pos = 0;  pos < padded_len;  pos += 16) {
 		int i;
 
@@ -120,49 +120,55 @@ insert_scrambled_password(struct rad_han
 		 * in calculating the scrambler for next time.
 		 */
 		for (i = 0;  i < 16;  i++)
-			h->request[h->pass_pos + pos + i] =
+			h->out[h->pass_pos + pos + i] =
 			    md5[i] ^= h->pass[pos + i];
 	}
 }
 
 static void
-insert_request_authenticator(struct rad_handle *h, int srv)
+insert_request_authenticator(struct rad_handle *h, int resp)
 {
 	MD5_CTX ctx;
 	const struct rad_server *srvp;
 
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	/* Create the request authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, memset(&h->request[POS_AUTH], 0, LEN_AUTH), LEN_AUTH);
-	MD5Update(&ctx, &h->request[POS_ATTRS], h->req_len - POS_ATTRS);
+	MD5Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+	if (resp)
+	    MD5Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+	else
+	    MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->out[POS_ATTRS], h->out_len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
-	MD5Final(&h->request[POS_AUTH], &ctx);
+	MD5Final(&h->out[POS_AUTH], &ctx);
 }
 
 static void
-insert_message_authenticator(struct rad_handle *h, int srv)
+insert_message_authenticator(struct rad_handle *h, int resp)
 {
 #ifdef WITH_SSL
 	u_char md[EVP_MAX_MD_SIZE];
 	u_int md_len;
 	const struct rad_server *srvp;
 	HMAC_CTX ctx;
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	if (h->authentic_pos != 0) {
 		HMAC_CTX_init(&ctx);
 		HMAC_Init(&ctx, srvp->secret, strlen(srvp->secret), EVP_md5());
-		HMAC_Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-		HMAC_Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-		HMAC_Update(&ctx, &h->request[POS_ATTRS],
-		    h->req_len - POS_ATTRS);
+		HMAC_Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+		if (resp)
+		    HMAC_Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+		else
+		    HMAC_Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+		HMAC_Update(&ctx, &h->out[POS_ATTRS],
+		    h->out_len - POS_ATTRS);
 		HMAC_Final(&ctx, md, &md_len);
 		HMAC_CTX_cleanup(&ctx);
 		HMAC_cleanup(&ctx);
-		memcpy(&h->request[h->authentic_pos + 2], md, md_len);
+		memcpy(&h->out[h->authentic_pos + 2], md, md_len);
 	}
 #endif
 }
@@ -195,20 +201,20 @@ is_valid_response(struct rad_handle *h, 
 		return 0;
 
 	/* Check the message length */
-	if (h->resp_len < POS_ATTRS)
+	if (h->in_len < POS_ATTRS)
 		return 0;
-	len = h->response[POS_LENGTH] << 8 | h->response[POS_LENGTH+1];
-	if (len > h->resp_len)
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
 		return 0;
 
 	/* Check the response authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->response[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-	MD5Update(&ctx, &h->response[POS_ATTRS], len - POS_ATTRS);
+	MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+	MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
 	MD5Final(md5, &ctx);
-	if (memcmp(&h->response[POS_AUTH], md5, sizeof md5) != 0)
+	if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
 		return 0;
 
 #ifdef WITH_SSL
@@ -216,42 +222,111 @@ is_valid_response(struct rad_handle *h, 
 	 * For non accounting responses check the message authenticator,
 	 * if any.
 	 */
-	if (h->response[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
+	if (h->in[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
 
-		memcpy(resp, h->response, MSGSIZE);
+		memcpy(resp, h->in, MSGSIZE);
 		pos = POS_ATTRS;
 
 		/* Search and verify the Message-Authenticator */
 		while (pos < len - 2) {
 
-			if (h->response[pos] == RAD_MESSAGE_AUTHENTIC) {
+			if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
 				/* zero fill the Message-Authenticator */
 				memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
 
 				HMAC_CTX_init(&hctx);
 				HMAC_Init(&hctx, srvp->secret,
 				    strlen(srvp->secret), EVP_md5());
-				HMAC_Update(&hctx, &h->response[POS_CODE],
+				HMAC_Update(&hctx, &h->in[POS_CODE],
 				    POS_AUTH - POS_CODE);
-				HMAC_Update(&hctx, &h->request[POS_AUTH],
+				HMAC_Update(&hctx, &h->out[POS_AUTH],
 				    LEN_AUTH);
 				HMAC_Update(&hctx, &resp[POS_ATTRS],
-				    h->resp_len - POS_ATTRS);
+				    h->in_len - POS_ATTRS);
 				HMAC_Final(&hctx, md, &md_len);
 				HMAC_CTX_cleanup(&hctx);
 				HMAC_cleanup(&hctx);
-				if (memcmp(md, &h->response[pos + 2],
+				if (memcmp(md, &h->in[pos + 2],
 				    MD5_DIGEST_LENGTH) != 0)
 					return 0;
 				break;
 			}
-			pos += h->response[pos + 1];
+			pos += h->in[pos + 1];
 		}
 	}
 #endif
 	return 1;
 }
 
+/*
+ * Return true if the current request is valid for the specified server.
+ */
+static int
+is_valid_request(struct rad_handle *h)
+{
+	MD5_CTX ctx;
+	unsigned char md5[MD5_DIGEST_LENGTH];
+	const struct rad_server *srvp;
+	int len;
+#ifdef WITH_SSL
+	HMAC_CTX hctx;
+	u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE];
+	u_int md_len;
+	int pos;
+#endif
+
+	srvp = &h->servers[h->srv];
+
+	/* Check the message length */
+	if (h->in_len < POS_ATTRS)
+		return (0);
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
+		return (0);
+
+	if (h->in[POS_CODE] != RAD_ACCESS_REQUEST) {
+		uint32_t zeroes[4] = { 0, 0, 0, 0 };
+		/* Check the request authenticator */
+		MD5Init(&ctx);
+		MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+		MD5Update(&ctx, zeroes, LEN_AUTH);
+		MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
+		MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
+		MD5Final(md5, &ctx);
+		if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
+			return (0);
+	}
+
+#ifdef WITH_SSL
+	/* Search and verify the Message-Authenticator */
+	pos = POS_ATTRS;
+	while (pos < len - 2) {
+		if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
+			memcpy(resp, h->in, MSGSIZE);
+			/* zero fill the Request-Authenticator */
+			if (h->in[POS_CODE] != RAD_ACCESS_REQUEST)
+				memset(&resp[POS_AUTH], 0, LEN_AUTH);
+			/* zero fill the Message-Authenticator */
+			memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
+
+			HMAC_CTX_init(&hctx);
+			HMAC_Init(&hctx, srvp->secret,
+			    strlen(srvp->secret), EVP_md5());
+			HMAC_Update(&hctx, resp, h->in_len);
+			HMAC_Final(&hctx, md, &md_len);
+			HMAC_CTX_cleanup(&hctx);
+			HMAC_cleanup(&hctx);
+			if (memcmp(md, &h->in[pos + 2],
+			    MD5_DIGEST_LENGTH) != 0)
+				return (0);
+			break;
+		}
+		pos += h->in[pos + 1];
+	}
+#endif
+	return (1);
+}
+
 static int
 put_password_attr(struct rad_handle *h, int type, const void *value, size_t len)
 {
@@ -273,7 +348,7 @@ put_password_attr(struct rad_handle *h, 
 	 */
 	clear_password(h);
 	put_raw_attr(h, type, h->pass, padded_len);
-	h->pass_pos = h->req_len - padded_len;
+	h->pass_pos = h->out_len - padded_len;
 
 	/* Save the cleartext password, padded as necessary */
 	memcpy(h->pass, value, len);
@@ -289,14 +364,14 @@ put_raw_attr(struct rad_handle *h, int t
 		generr(h, "Attribute too long");
 		return -1;
 	}
-	if (h->req_len + 2 + len > MSGSIZE) {
+	if (h->out_len + 2 + len > MSGSIZE) {
 		generr(h, "Maximum message length exceeded");
 		return -1;
 	}
-	h->request[h->req_len++] = type;
-	h->request[h->req_len++] = len + 2;
-	memcpy(&h->request[h->req_len], value, len);
-	h->req_len += len;
+	h->out[h->out_len++] = type;
+	h->out[h->out_len++] = len + 2;
+	memcpy(&h->out[h->out_len], value, len);
+	h->out_len += len;
 	return 0;
 }
 
@@ -523,22 +598,26 @@ rad_continue_send_request(struct rad_han
 {
 	int n;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	if (selected) {
 		struct sockaddr_in from;
 		socklen_t fromlen;
 
 		fromlen = sizeof from;
-		h->resp_len = recvfrom(h->fd, h->response,
+		h->in_len = recvfrom(h->fd, h->in,
 		    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
-		if (h->resp_len == -1) {
+		if (h->in_len == -1) {
 			generr(h, "recvfrom: %s", strerror(errno));
 			return -1;
 		}
 		if (is_valid_response(h, h->srv, &from)) {
-			h->resp_len = h->response[POS_LENGTH] << 8 |
-			    h->response[POS_LENGTH+1];
-			h->resp_pos = POS_ATTRS;
-			return h->response[POS_CODE];
+			h->in_len = h->in[POS_LENGTH] << 8 |
+			    h->in[POS_LENGTH+1];
+			h->in_pos = POS_ATTRS;
+			return h->in[POS_CODE];
 		}
 	}
 
@@ -556,21 +635,22 @@ rad_continue_send_request(struct rad_han
 		if (++h->srv >= h->num_servers)
 			h->srv = 0;
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST)
-		/* Insert the request authenticator into the request */
-		insert_request_authenticator(h, h->srv);
-	else
+	if (h->out[POS_CODE] == RAD_ACCESS_REQUEST) {
 		/* Insert the scrambled password into the request */
 		if (h->pass_pos != 0)
 			insert_scrambled_password(h, h->srv);
-
-	insert_message_authenticator(h, h->srv);
+	}
+	insert_message_authenticator(h, 0);
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
+		/* Insert the request authenticator into the request */
+		insert_request_authenticator(h, h->srv);
+	}
 
 	/* Send the request */
-	n = sendto(h->fd, h->request, h->req_len, 0,
+	n = sendto(h->fd, h->out, h->out_len, 0,
 	    (const struct sockaddr *)&h->servers[h->srv].addr,
 	    sizeof h->servers[h->srv].addr);
-	if (n != h->req_len) {
+	if (n != h->out_len) {
 		if (n == -1)
 			generr(h, "sendto: %s", strerror(errno));
 		else
@@ -588,22 +668,117 @@ rad_continue_send_request(struct rad_han
 }
 
 int
+rad_receive_request(struct rad_handle *h)
+{
+	struct sockaddr_in from;
+	socklen_t fromlen;
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->srv = -1;
+	fromlen = sizeof(from);
+	h->in_len = recvfrom(h->fd, h->in,
+	    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
+	if (h->in_len == -1) {
+		generr(h, "recvfrom: %s", strerror(errno));
+		return (-1);
+	}
+	for (n = 0; n < h->num_servers; n++) {
+		if (h->servers[n].addr.sin_addr.s_addr == from.sin_addr.s_addr) {
+			h->servers[n].addr.sin_port = from.sin_port;
+			h->srv = n;
+			break;
+		}
+	}
+	if (h->srv == -1)
+		return (-2);
+	if (is_valid_request(h)) {
+		h->in_len = h->in[POS_LENGTH] << 8 |
+		    h->in[POS_LENGTH+1];
+		h->in_pos = POS_ATTRS;
+		return (h->in[POS_CODE]);
+	}
+	return (-3);
+}
+
+int
+rad_send_response(struct rad_handle *h)
+{
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	/* Fill in the length field in the message */
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
+
+	insert_message_authenticator(h,
+	    (h->in[POS_CODE] == RAD_ACCESS_REQUEST) ? 1 : 0);
+	insert_request_authenticator(h, 1);
+
+	/* Send the request */
+	n = sendto(h->fd, h->out, h->out_len, 0,
+	    (const struct sockaddr *)&h->servers[h->srv].addr,
+	    sizeof h->servers[h->srv].addr);
+	if (n != h->out_len) {
+		if (n == -1)
+			generr(h, "sendto: %s", strerror(errno));
+		else
+			generr(h, "sendto: short write");
+		return -1;
+	}
+
+	return 0;
+}
+
+int
 rad_create_request(struct rad_handle *h, int code)
 {
 	int i;
 
-	h->request[POS_CODE] = code;
-	h->request[POS_IDENT] = ++h->ident;
-	/* Create a random authenticator */
-	for (i = 0;  i < LEN_AUTH;  i += 2) {
-		long r;
-		r = random();
-		h->request[POS_AUTH+i] = (u_char)r;
-		h->request[POS_AUTH+i+1] = (u_char)(r >> 8);
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = ++h->ident;
+	if (code == RAD_ACCESS_REQUEST) {
+		/* Create a random authenticator */
+		for (i = 0;  i < LEN_AUTH;  i += 2) {
+			long r;
+			r = random();
+			h->out[POS_AUTH+i] = (u_char)r;
+			h->out[POS_AUTH+i+1] = (u_char)(r >> 8);
+		}
+	} else
+		memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
+	clear_password(h);
+	h->authentic_pos = 0;
+	h->out_created = 1;
+	return 0;
+}
+
+int
+rad_create_response(struct rad_handle *h, int code)
+{
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
 	}
-	h->req_len = POS_ATTRS;
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = h->in[POS_IDENT];
+	memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
 	clear_password(h);
-	h->request_created = 1;
+	h->authentic_pos = 0;
+	h->out_created = 1;
 	return 0;
 }
 
@@ -647,20 +822,20 @@ rad_get_attr(struct rad_handle *h, const
 {
 	int type;
 
-	if (h->resp_pos >= h->resp_len)
+	if (h->in_pos >= h->in_len)
 		return 0;
-	if (h->resp_pos + 2 > h->resp_len) {
+	if (h->in_pos + 2 > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	type = h->response[h->resp_pos++];
-	*len = h->response[h->resp_pos++] - 2;
-	if (h->resp_pos + (int)*len > h->resp_len) {
+	type = h->in[h->in_pos++];
+	*len = h->in[h->in_pos++] - 2;
+	if (h->in_pos + (int)*len > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	*value = &h->response[h->resp_pos];
-	h->resp_pos += *len;
+	*value = &h->in[h->in_pos];
+	h->in_pos += *len;
 	return type;
 }
 
@@ -672,6 +847,10 @@ rad_init_send_request(struct rad_handle 
 {
 	int srv;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	/* Make sure we have a socket to use */
 	if (h->fd == -1) {
 		struct sockaddr_in sin;
@@ -694,7 +873,7 @@ rad_init_send_request(struct rad_handle 
 		}
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
 		/* Make sure no password given */
 		if (h->pass_pos || h->chap_pass) {
 			generr(h, "User or Chap Password"
@@ -718,8 +897,8 @@ rad_init_send_request(struct rad_handle 
 	}
 
 	/* Fill in the length field in the message */
-	h->request[POS_LENGTH] = h->req_len >> 8;
-	h->request[POS_LENGTH+1] = h->req_len;
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
 
 	/*
 	 * Count the total number of tries we will make, and zero the
@@ -763,7 +942,7 @@ rad_auth_open(void)
 		h->chap_pass = 0;
 		h->authentic_pos = 0;
 		h->type = RADIUS_AUTH;
-		h->request_created = 0;
+		h->out_created = 0;
 		h->eap_msg = 0;
 	}
 	return h;
@@ -781,6 +960,19 @@ rad_acct_open(void)
 }
 
 struct rad_handle *
+rad_server_open(int fd)
+{
+	struct rad_handle *h;
+
+	h = rad_open();
+	if (h != NULL) {
+	        h->type = RADIUS_SERVER;
+	        h->fd = fd;
+	}
+	return h;
+}
+
+struct rad_handle *
 rad_open(void)
 {
     return rad_auth_open();
@@ -797,13 +989,13 @@ rad_put_attr(struct rad_handle *h, int t
 {
 	int result;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		if (type == RAD_EAP_MESSAGE) {
 			generr(h, "EAP-Message attribute is not valid"
 			    " in accounting requests");
@@ -858,14 +1050,14 @@ rad_put_message_authentic(struct rad_han
 #ifdef WITH_SSL
 	u_char md_zero[MD5_DIGEST_LENGTH];
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		generr(h, "Message-Authenticator is not valid"
 		    " in accounting requests");
 		return -1;
 	}
 
 	if (h->authentic_pos == 0) {
-		h->authentic_pos = h->req_len;
+		h->authentic_pos = h->out_len;
 		memset(md_zero, 0, sizeof(md_zero));
 		return (put_raw_attr(h, RAD_MESSAGE_AUTHENTIC, md_zero,
 		    sizeof(md_zero)));
@@ -1041,7 +1233,7 @@ rad_put_vendor_attr(struct rad_handle *h
 	struct vendor_attribute *attr;
 	int res;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
@@ -1088,7 +1280,7 @@ rad_request_authenticator(struct rad_han
 {
 	if (len < LEN_AUTH)
 		return (-1);
-	memcpy(buf, h->request + POS_AUTH, LEN_AUTH);
+	memcpy(buf, h->out + POS_AUTH, LEN_AUTH);
 	if (len > LEN_AUTH)
 		buf[LEN_AUTH] = '\0';
 	return (LEN_AUTH);

Modified: stable/8/lib/libradius/radlib.h
==============================================================================
--- stable/8/lib/libradius/radlib.h	Fri Oct 30 11:13:00 2009	(r198671)
+++ stable/8/lib/libradius/radlib.h	Fri Oct 30 12:57:28 2009	(r198672)
@@ -42,6 +42,12 @@
 #define RAD_ACCOUNTING_REQUEST		4
 #define RAD_ACCOUNTING_RESPONSE		5
 #define RAD_ACCESS_CHALLENGE		11
+#define RAD_DISCONNECT_REQUEST		40
+#define RAD_DISCONNECT_ACK		41
+#define RAD_DISCONNECT_NAK		42
+#define RAD_COA_REQUEST			43
+#define RAD_COA_ACK			44
+#define RAD_COA_NAK			45
 
 /* Attribute types and values */
 #define RAD_USER_NAME			1	/* String */
@@ -179,6 +185,8 @@
 #define	RAD_ACCT_MULTI_SESSION_ID	50	/* String */
 #define	RAD_ACCT_LINK_COUNT		51	/* Integer */
 
+#define	RAD_ERROR_CAUSE			101	/* Integer */
+
 struct rad_handle;
 struct timeval;
 
@@ -192,6 +200,7 @@ int			 rad_config(struct rad_handle *, c
 int			 rad_continue_send_request(struct rad_handle *, int,
 			    int *, struct timeval *);
 int			 rad_create_request(struct rad_handle *, int);
+int			 rad_create_response(struct rad_handle *, int);
 struct in_addr		 rad_cvt_addr(const void *);
 u_int32_t		 rad_cvt_int(const void *);
 char			*rad_cvt_string(const void *, size_t);
@@ -209,7 +218,10 @@ int			 rad_put_string(struct rad_handle 
 int			 rad_put_message_authentic(struct rad_handle *);
 ssize_t			 rad_request_authenticator(struct rad_handle *, char *,
 			    size_t);
+int			 rad_receive_request(struct rad_handle *);
 int			 rad_send_request(struct rad_handle *);
+int			 rad_send_response(struct rad_handle *);
+struct rad_handle	*rad_server_open(int fd);
 const char		*rad_server_secret(struct rad_handle *);
 const char		*rad_strerror(struct rad_handle *);
 u_char			*rad_demangle(struct rad_handle *, const void *,

Modified: stable/8/lib/libradius/radlib_private.h
==============================================================================
--- stable/8/lib/libradius/radlib_private.h	Fri Oct 30 11:13:00 2009	(r198671)
+++ stable/8/lib/libradius/radlib_private.h	Fri Oct 30 12:57:28 2009	(r198672)
@@ -38,6 +38,7 @@
 /* Handle types */
 #define RADIUS_AUTH		0   /* RADIUS authentication, default */
 #define RADIUS_ACCT		1   /* RADIUS accounting */
+#define RADIUS_SERVER		2   /* RADIUS server */
 
 /* Defaults */
 #define MAXTRIES		3
@@ -75,18 +76,18 @@ struct rad_handle {
 	int		 num_servers;	/* Number of valid server entries */
 	int		 ident;		/* Current identifier value */
 	char		 errmsg[ERRSIZE];	/* Most recent error message */
-	unsigned char	 request[MSGSIZE];	/* Request to send */
-	char	 	 request_created; /* rad_create_request() called? */
-	int		 req_len;	/* Length of request */
+	unsigned char	 out[MSGSIZE];	/* Request to send */
+	char		 out_created;	/* rad_create_request() called? */
+	int		 out_len;	/* Length of request */
 	char		 pass[PASSSIZE];	/* Cleartext password */
 	int		 pass_len;	/* Length of cleartext password */
 	int		 pass_pos;	/* Position of scrambled password */
-	char	 	 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
+	char		 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
 	int		 authentic_pos;	/* Position of message authenticator */
 	char		 eap_msg;	/* Are we an EAP Proxy? */
-	unsigned char	 response[MSGSIZE];	/* Response received */
-	int		 resp_len;	/* Length of response */
-	int		 resp_pos;	/* Current position scanning attrs */
+	unsigned char	 in[MSGSIZE];	/* Response received */
+	int		 in_len;	/* Length of response */
+	int		 in_pos;	/* Current position scanning attrs */
 	int		 total_tries;	/* How many requests we'll send */
 	int		 try;		/* How many requests we've sent */
 	int		 srv;		/* Server number we did last */

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 12:59:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 409B5106568B;
	Fri, 30 Oct 2009 12:59: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 2D8A28FC13;
	Fri, 30 Oct 2009 12: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 n9UCxNh4044975;
	Fri, 30 Oct 2009 12:59:23 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UCxNIs044970;
	Fri, 30 Oct 2009 12:59:23 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910301259.n9UCxNIs044970@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Oct 2009 12:59:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198673 - stable/7/lib/libradius
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 12:59:23 -0000

Author: mav
Date: Fri Oct 30 12:59:22 2009
New Revision: 198673
URL: http://svn.freebsd.org/changeset/base/198673

Log:
  MFC rev. 197086:
  Add simple embedded RADIUS server support to libradius, by extending existing
  API, keeping backward compatibility.
  
  First consumer for this functionality is going to become forthcoming MPD-5.4,
  supporting CoA and DR of RFC 3576: Dynamic Authorization Extensions to RADIUS.

Modified:
  stable/7/lib/libradius/   (props changed)
  stable/7/lib/libradius/libradius.3
  stable/7/lib/libradius/radlib.c
  stable/7/lib/libradius/radlib.h
  stable/7/lib/libradius/radlib_private.h

Modified: stable/7/lib/libradius/libradius.3
==============================================================================
--- stable/7/lib/libradius/libradius.3	Fri Oct 30 12:57:28 2009	(r198672)
+++ stable/7/lib/libradius/libradius.3	Fri Oct 30 12:59:22 2009	(r198673)
@@ -1,4 +1,5 @@
 .\" Copyright 1998 Juniper Networks, Inc.
+.\" Copyright 2009 Alexander Motin .
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,12 +25,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 27, 2004
+.Dd August 5, 2009
 .Dt LIBRADIUS 3
 .Os
 .Sh NAME
 .Nm libradius
-.Nd RADIUS client library
+.Nd RADIUS client/server library
 .Sh SYNOPSIS
 .In radlib.h
 .Ft "struct rad_handle *"
@@ -46,6 +47,8 @@
 .Fn rad_continue_send_request "struct rad_handle *h" "int selected" "int *fd" "struct timeval *tv"
 .Ft int
 .Fn rad_create_request "struct rad_handle *h" "int code"
+.Ft int
+.Fn rad_create_response "struct rad_handle *h" "int code"
 .Ft "struct in_addr"
 .Fn rad_cvt_addr "const void *data"
 .Ft u_int32_t
@@ -79,7 +82,13 @@
 .Ft ssize_t
 .Fn rad_request_authenticator "struct rad_handle *h" "char *buf" "size_t len"
 .Ft int
+.Fn rad_receive_request "struct rad_handle *h"
+.Ft int
 .Fn rad_send_request "struct rad_handle *h"
+.Ft int
+.Fn rad_send_response "struct rad_handle *h"
+.Ft "struct rad_handle *"
+.Fn rad_server_open "int fd"
 .Ft "const char *"
 .Fn rad_server_secret "struct rad_handle *h"
 .Ft u_char *
@@ -91,16 +100,17 @@
 .Sh DESCRIPTION
 The
 .Nm
-library implements the client side of the Remote Authentication Dial
-In User Service (RADIUS).
+library implements the Remote Authentication Dial In User Service (RADIUS).
 RADIUS, defined in RFCs 2865 and 2866,
 allows clients to perform authentication and accounting by means of
 network requests to remote servers.
 .Ss Initialization
 To use the library, an application must first call
 .Fn rad_auth_open
-or
+,
 .Fn rad_acct_open
+or
+.Fn rad_server_open
 to obtain a
 .Vt "struct rad_handle *" ,
 which provides the context for subsequent operations.
@@ -108,8 +118,10 @@ The former function is used for RADIUS a
 latter is used for RADIUS accounting.
 Calls to
 .Fn rad_auth_open
-and
+,
 .Fn rad_acct_open
+and
+.Fn rad_server_open
 always succeed unless insufficient virtual memory is available.
 If
 the necessary memory cannot be allocated, the functions return
@@ -451,6 +463,25 @@ subsequent library calls using the same 
 .Ss Cleanup
 To free the resources used by the RADIUS library, call
 .Fn rad_close .
+.Ss Server operation
+Server mode operates much alike to client mode, except packet send and receieve
+steps are swapped. To operate as server you should obtain server context with
+.Fn rad_server_open
+function, passing opened and bound UDP socket file descriptor as argument.
+You should define allowed clients and their secrets using
+.Fn rad_add_server
+function. port, timeout and max_tries arguments are ignored in server mode.
+You should call
+.Fn rad_receive_request
+function to receive request from client. If you do not want to block on socket
+read, you are free to use any poll(), select() or non-blocking sockets for
+the socket.
+Received request can be parsed with same parsing functions as for client.
+To respond to the request you should call
+.Fn rad_create_response
+and fill response content with same packet writing functions as for client.
+When packet is ready, it should be sent with
+.Fn rad_send_response
 .Sh RETURN VALUES
 The following functions return a non-negative value on success.
 If
@@ -466,6 +497,8 @@ which can be retrieved using
 .It
 .Fn rad_create_request
 .It
+.Fn rad_create_response
+.It
 .Fn rad_get_attr
 .It
 .Fn rad_put_addr
@@ -483,6 +516,8 @@ which can be retrieved using
 .Fn rad_continue_send_request
 .It
 .Fn rad_send_request
+.It
+.Fn rad_send_response
 .El
 .Pp
 The following functions return a
@@ -499,6 +534,8 @@ without recording an error message.
 .It
 .Fn rad_auth_open
 .It
+.Fn rad_server_open
+.It
 .Fn rad_cvt_string
 .El
 .Pp
@@ -553,3 +590,5 @@ subsequently added the ability to perfor
 accounting.
 Later additions and changes by
 .An Michael Bretterklieber .
+Server mode support was added by
+.An Alexander Motin .

Modified: stable/7/lib/libradius/radlib.c
==============================================================================
--- stable/7/lib/libradius/radlib.c	Fri Oct 30 12:57:28 2009	(r198672)
+++ stable/7/lib/libradius/radlib.c	Fri Oct 30 12:59:22 2009	(r198673)
@@ -103,7 +103,7 @@ insert_scrambled_password(struct rad_han
 	srvp = &h->servers[srv];
 	padded_len = h->pass_len == 0 ? 16 : (h->pass_len+15) & ~0xf;
 
-	memcpy(md5, &h->request[POS_AUTH], LEN_AUTH);
+	memcpy(md5, &h->out[POS_AUTH], LEN_AUTH);
 	for (pos = 0;  pos < padded_len;  pos += 16) {
 		int i;
 
@@ -120,49 +120,55 @@ insert_scrambled_password(struct rad_han
 		 * in calculating the scrambler for next time.
 		 */
 		for (i = 0;  i < 16;  i++)
-			h->request[h->pass_pos + pos + i] =
+			h->out[h->pass_pos + pos + i] =
 			    md5[i] ^= h->pass[pos + i];
 	}
 }
 
 static void
-insert_request_authenticator(struct rad_handle *h, int srv)
+insert_request_authenticator(struct rad_handle *h, int resp)
 {
 	MD5_CTX ctx;
 	const struct rad_server *srvp;
 
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	/* Create the request authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, memset(&h->request[POS_AUTH], 0, LEN_AUTH), LEN_AUTH);
-	MD5Update(&ctx, &h->request[POS_ATTRS], h->req_len - POS_ATTRS);
+	MD5Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+	if (resp)
+	    MD5Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+	else
+	    MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->out[POS_ATTRS], h->out_len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
-	MD5Final(&h->request[POS_AUTH], &ctx);
+	MD5Final(&h->out[POS_AUTH], &ctx);
 }
 
 static void
-insert_message_authenticator(struct rad_handle *h, int srv)
+insert_message_authenticator(struct rad_handle *h, int resp)
 {
 #ifdef WITH_SSL
 	u_char md[EVP_MAX_MD_SIZE];
 	u_int md_len;
 	const struct rad_server *srvp;
 	HMAC_CTX ctx;
-	srvp = &h->servers[srv];
+	srvp = &h->servers[h->srv];
 
 	if (h->authentic_pos != 0) {
 		HMAC_CTX_init(&ctx);
 		HMAC_Init(&ctx, srvp->secret, strlen(srvp->secret), EVP_md5());
-		HMAC_Update(&ctx, &h->request[POS_CODE], POS_AUTH - POS_CODE);
-		HMAC_Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-		HMAC_Update(&ctx, &h->request[POS_ATTRS],
-		    h->req_len - POS_ATTRS);
+		HMAC_Update(&ctx, &h->out[POS_CODE], POS_AUTH - POS_CODE);
+		if (resp)
+		    HMAC_Update(&ctx, &h->in[POS_AUTH], LEN_AUTH);
+		else
+		    HMAC_Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+		HMAC_Update(&ctx, &h->out[POS_ATTRS],
+		    h->out_len - POS_ATTRS);
 		HMAC_Final(&ctx, md, &md_len);
 		HMAC_CTX_cleanup(&ctx);
 		HMAC_cleanup(&ctx);
-		memcpy(&h->request[h->authentic_pos + 2], md, md_len);
+		memcpy(&h->out[h->authentic_pos + 2], md, md_len);
 	}
 #endif
 }
@@ -195,20 +201,20 @@ is_valid_response(struct rad_handle *h, 
 		return 0;
 
 	/* Check the message length */
-	if (h->resp_len < POS_ATTRS)
+	if (h->in_len < POS_ATTRS)
 		return 0;
-	len = h->response[POS_LENGTH] << 8 | h->response[POS_LENGTH+1];
-	if (len > h->resp_len)
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
 		return 0;
 
 	/* Check the response authenticator */
 	MD5Init(&ctx);
-	MD5Update(&ctx, &h->response[POS_CODE], POS_AUTH - POS_CODE);
-	MD5Update(&ctx, &h->request[POS_AUTH], LEN_AUTH);
-	MD5Update(&ctx, &h->response[POS_ATTRS], len - POS_ATTRS);
+	MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+	MD5Update(&ctx, &h->out[POS_AUTH], LEN_AUTH);
+	MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
 	MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
 	MD5Final(md5, &ctx);
-	if (memcmp(&h->response[POS_AUTH], md5, sizeof md5) != 0)
+	if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
 		return 0;
 
 #ifdef WITH_SSL
@@ -216,42 +222,111 @@ is_valid_response(struct rad_handle *h, 
 	 * For non accounting responses check the message authenticator,
 	 * if any.
 	 */
-	if (h->response[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
+	if (h->in[POS_CODE] != RAD_ACCOUNTING_RESPONSE) {
 
-		memcpy(resp, h->response, MSGSIZE);
+		memcpy(resp, h->in, MSGSIZE);
 		pos = POS_ATTRS;
 
 		/* Search and verify the Message-Authenticator */
 		while (pos < len - 2) {
 
-			if (h->response[pos] == RAD_MESSAGE_AUTHENTIC) {
+			if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
 				/* zero fill the Message-Authenticator */
 				memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
 
 				HMAC_CTX_init(&hctx);
 				HMAC_Init(&hctx, srvp->secret,
 				    strlen(srvp->secret), EVP_md5());
-				HMAC_Update(&hctx, &h->response[POS_CODE],
+				HMAC_Update(&hctx, &h->in[POS_CODE],
 				    POS_AUTH - POS_CODE);
-				HMAC_Update(&hctx, &h->request[POS_AUTH],
+				HMAC_Update(&hctx, &h->out[POS_AUTH],
 				    LEN_AUTH);
 				HMAC_Update(&hctx, &resp[POS_ATTRS],
-				    h->resp_len - POS_ATTRS);
+				    h->in_len - POS_ATTRS);
 				HMAC_Final(&hctx, md, &md_len);
 				HMAC_CTX_cleanup(&hctx);
 				HMAC_cleanup(&hctx);
-				if (memcmp(md, &h->response[pos + 2],
+				if (memcmp(md, &h->in[pos + 2],
 				    MD5_DIGEST_LENGTH) != 0)
 					return 0;
 				break;
 			}
-			pos += h->response[pos + 1];
+			pos += h->in[pos + 1];
 		}
 	}
 #endif
 	return 1;
 }
 
+/*
+ * Return true if the current request is valid for the specified server.
+ */
+static int
+is_valid_request(struct rad_handle *h)
+{
+	MD5_CTX ctx;
+	unsigned char md5[MD5_DIGEST_LENGTH];
+	const struct rad_server *srvp;
+	int len;
+#ifdef WITH_SSL
+	HMAC_CTX hctx;
+	u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE];
+	u_int md_len;
+	int pos;
+#endif
+
+	srvp = &h->servers[h->srv];
+
+	/* Check the message length */
+	if (h->in_len < POS_ATTRS)
+		return (0);
+	len = h->in[POS_LENGTH] << 8 | h->in[POS_LENGTH+1];
+	if (len > h->in_len)
+		return (0);
+
+	if (h->in[POS_CODE] != RAD_ACCESS_REQUEST) {
+		uint32_t zeroes[4] = { 0, 0, 0, 0 };
+		/* Check the request authenticator */
+		MD5Init(&ctx);
+		MD5Update(&ctx, &h->in[POS_CODE], POS_AUTH - POS_CODE);
+		MD5Update(&ctx, zeroes, LEN_AUTH);
+		MD5Update(&ctx, &h->in[POS_ATTRS], len - POS_ATTRS);
+		MD5Update(&ctx, srvp->secret, strlen(srvp->secret));
+		MD5Final(md5, &ctx);
+		if (memcmp(&h->in[POS_AUTH], md5, sizeof md5) != 0)
+			return (0);
+	}
+
+#ifdef WITH_SSL
+	/* Search and verify the Message-Authenticator */
+	pos = POS_ATTRS;
+	while (pos < len - 2) {
+		if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
+			memcpy(resp, h->in, MSGSIZE);
+			/* zero fill the Request-Authenticator */
+			if (h->in[POS_CODE] != RAD_ACCESS_REQUEST)
+				memset(&resp[POS_AUTH], 0, LEN_AUTH);
+			/* zero fill the Message-Authenticator */
+			memset(&resp[pos + 2], 0, MD5_DIGEST_LENGTH);
+
+			HMAC_CTX_init(&hctx);
+			HMAC_Init(&hctx, srvp->secret,
+			    strlen(srvp->secret), EVP_md5());
+			HMAC_Update(&hctx, resp, h->in_len);
+			HMAC_Final(&hctx, md, &md_len);
+			HMAC_CTX_cleanup(&hctx);
+			HMAC_cleanup(&hctx);
+			if (memcmp(md, &h->in[pos + 2],
+			    MD5_DIGEST_LENGTH) != 0)
+				return (0);
+			break;
+		}
+		pos += h->in[pos + 1];
+	}
+#endif
+	return (1);
+}
+
 static int
 put_password_attr(struct rad_handle *h, int type, const void *value, size_t len)
 {
@@ -273,7 +348,7 @@ put_password_attr(struct rad_handle *h, 
 	 */
 	clear_password(h);
 	put_raw_attr(h, type, h->pass, padded_len);
-	h->pass_pos = h->req_len - padded_len;
+	h->pass_pos = h->out_len - padded_len;
 
 	/* Save the cleartext password, padded as necessary */
 	memcpy(h->pass, value, len);
@@ -289,14 +364,14 @@ put_raw_attr(struct rad_handle *h, int t
 		generr(h, "Attribute too long");
 		return -1;
 	}
-	if (h->req_len + 2 + len > MSGSIZE) {
+	if (h->out_len + 2 + len > MSGSIZE) {
 		generr(h, "Maximum message length exceeded");
 		return -1;
 	}
-	h->request[h->req_len++] = type;
-	h->request[h->req_len++] = len + 2;
-	memcpy(&h->request[h->req_len], value, len);
-	h->req_len += len;
+	h->out[h->out_len++] = type;
+	h->out[h->out_len++] = len + 2;
+	memcpy(&h->out[h->out_len], value, len);
+	h->out_len += len;
 	return 0;
 }
 
@@ -523,22 +598,26 @@ rad_continue_send_request(struct rad_han
 {
 	int n;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	if (selected) {
 		struct sockaddr_in from;
 		socklen_t fromlen;
 
 		fromlen = sizeof from;
-		h->resp_len = recvfrom(h->fd, h->response,
+		h->in_len = recvfrom(h->fd, h->in,
 		    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
-		if (h->resp_len == -1) {
+		if (h->in_len == -1) {
 			generr(h, "recvfrom: %s", strerror(errno));
 			return -1;
 		}
 		if (is_valid_response(h, h->srv, &from)) {
-			h->resp_len = h->response[POS_LENGTH] << 8 |
-			    h->response[POS_LENGTH+1];
-			h->resp_pos = POS_ATTRS;
-			return h->response[POS_CODE];
+			h->in_len = h->in[POS_LENGTH] << 8 |
+			    h->in[POS_LENGTH+1];
+			h->in_pos = POS_ATTRS;
+			return h->in[POS_CODE];
 		}
 	}
 
@@ -556,21 +635,22 @@ rad_continue_send_request(struct rad_han
 		if (++h->srv >= h->num_servers)
 			h->srv = 0;
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST)
-		/* Insert the request authenticator into the request */
-		insert_request_authenticator(h, h->srv);
-	else
+	if (h->out[POS_CODE] == RAD_ACCESS_REQUEST) {
 		/* Insert the scrambled password into the request */
 		if (h->pass_pos != 0)
 			insert_scrambled_password(h, h->srv);
-
-	insert_message_authenticator(h, h->srv);
+	}
+	insert_message_authenticator(h, 0);
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
+		/* Insert the request authenticator into the request */
+		insert_request_authenticator(h, h->srv);
+	}
 
 	/* Send the request */
-	n = sendto(h->fd, h->request, h->req_len, 0,
+	n = sendto(h->fd, h->out, h->out_len, 0,
 	    (const struct sockaddr *)&h->servers[h->srv].addr,
 	    sizeof h->servers[h->srv].addr);
-	if (n != h->req_len) {
+	if (n != h->out_len) {
 		if (n == -1)
 			generr(h, "sendto: %s", strerror(errno));
 		else
@@ -588,22 +668,117 @@ rad_continue_send_request(struct rad_han
 }
 
 int
+rad_receive_request(struct rad_handle *h)
+{
+	struct sockaddr_in from;
+	socklen_t fromlen;
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->srv = -1;
+	fromlen = sizeof(from);
+	h->in_len = recvfrom(h->fd, h->in,
+	    MSGSIZE, MSG_WAITALL, (struct sockaddr *)&from, &fromlen);
+	if (h->in_len == -1) {
+		generr(h, "recvfrom: %s", strerror(errno));
+		return (-1);
+	}
+	for (n = 0; n < h->num_servers; n++) {
+		if (h->servers[n].addr.sin_addr.s_addr == from.sin_addr.s_addr) {
+			h->servers[n].addr.sin_port = from.sin_port;
+			h->srv = n;
+			break;
+		}
+	}
+	if (h->srv == -1)
+		return (-2);
+	if (is_valid_request(h)) {
+		h->in_len = h->in[POS_LENGTH] << 8 |
+		    h->in[POS_LENGTH+1];
+		h->in_pos = POS_ATTRS;
+		return (h->in[POS_CODE]);
+	}
+	return (-3);
+}
+
+int
+rad_send_response(struct rad_handle *h)
+{
+	int n;
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	/* Fill in the length field in the message */
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
+
+	insert_message_authenticator(h,
+	    (h->in[POS_CODE] == RAD_ACCESS_REQUEST) ? 1 : 0);
+	insert_request_authenticator(h, 1);
+
+	/* Send the request */
+	n = sendto(h->fd, h->out, h->out_len, 0,
+	    (const struct sockaddr *)&h->servers[h->srv].addr,
+	    sizeof h->servers[h->srv].addr);
+	if (n != h->out_len) {
+		if (n == -1)
+			generr(h, "sendto: %s", strerror(errno));
+		else
+			generr(h, "sendto: short write");
+		return -1;
+	}
+
+	return 0;
+}
+
+int
 rad_create_request(struct rad_handle *h, int code)
 {
 	int i;
 
-	h->request[POS_CODE] = code;
-	h->request[POS_IDENT] = ++h->ident;
-	/* Create a random authenticator */
-	for (i = 0;  i < LEN_AUTH;  i += 2) {
-		long r;
-		r = random();
-		h->request[POS_AUTH+i] = (u_char)r;
-		h->request[POS_AUTH+i+1] = (u_char)(r >> 8);
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = ++h->ident;
+	if (code == RAD_ACCESS_REQUEST) {
+		/* Create a random authenticator */
+		for (i = 0;  i < LEN_AUTH;  i += 2) {
+			long r;
+			r = random();
+			h->out[POS_AUTH+i] = (u_char)r;
+			h->out[POS_AUTH+i+1] = (u_char)(r >> 8);
+		}
+	} else
+		memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
+	clear_password(h);
+	h->authentic_pos = 0;
+	h->out_created = 1;
+	return 0;
+}
+
+int
+rad_create_response(struct rad_handle *h, int code)
+{
+
+	if (h->type != RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
 	}
-	h->req_len = POS_ATTRS;
+	h->out[POS_CODE] = code;
+	h->out[POS_IDENT] = h->in[POS_IDENT];
+	memset(&h->out[POS_AUTH], 0, LEN_AUTH);
+	h->out_len = POS_ATTRS;
 	clear_password(h);
-	h->request_created = 1;
+	h->authentic_pos = 0;
+	h->out_created = 1;
 	return 0;
 }
 
@@ -647,20 +822,20 @@ rad_get_attr(struct rad_handle *h, const
 {
 	int type;
 
-	if (h->resp_pos >= h->resp_len)
+	if (h->in_pos >= h->in_len)
 		return 0;
-	if (h->resp_pos + 2 > h->resp_len) {
+	if (h->in_pos + 2 > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	type = h->response[h->resp_pos++];
-	*len = h->response[h->resp_pos++] - 2;
-	if (h->resp_pos + (int)*len > h->resp_len) {
+	type = h->in[h->in_pos++];
+	*len = h->in[h->in_pos++] - 2;
+	if (h->in_pos + (int)*len > h->in_len) {
 		generr(h, "Malformed attribute in response");
 		return -1;
 	}
-	*value = &h->response[h->resp_pos];
-	h->resp_pos += *len;
+	*value = &h->in[h->in_pos];
+	h->in_pos += *len;
 	return type;
 }
 
@@ -672,6 +847,10 @@ rad_init_send_request(struct rad_handle 
 {
 	int srv;
 
+	if (h->type == RADIUS_SERVER) {
+		generr(h, "denied function call");
+		return (-1);
+	}
 	/* Make sure we have a socket to use */
 	if (h->fd == -1) {
 		struct sockaddr_in sin;
@@ -694,7 +873,7 @@ rad_init_send_request(struct rad_handle 
 		}
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] != RAD_ACCESS_REQUEST) {
 		/* Make sure no password given */
 		if (h->pass_pos || h->chap_pass) {
 			generr(h, "User or Chap Password"
@@ -718,8 +897,8 @@ rad_init_send_request(struct rad_handle 
 	}
 
 	/* Fill in the length field in the message */
-	h->request[POS_LENGTH] = h->req_len >> 8;
-	h->request[POS_LENGTH+1] = h->req_len;
+	h->out[POS_LENGTH] = h->out_len >> 8;
+	h->out[POS_LENGTH+1] = h->out_len;
 
 	/*
 	 * Count the total number of tries we will make, and zero the
@@ -763,7 +942,7 @@ rad_auth_open(void)
 		h->chap_pass = 0;
 		h->authentic_pos = 0;
 		h->type = RADIUS_AUTH;
-		h->request_created = 0;
+		h->out_created = 0;
 		h->eap_msg = 0;
 	}
 	return h;
@@ -781,6 +960,19 @@ rad_acct_open(void)
 }
 
 struct rad_handle *
+rad_server_open(int fd)
+{
+	struct rad_handle *h;
+
+	h = rad_open();
+	if (h != NULL) {
+	        h->type = RADIUS_SERVER;
+	        h->fd = fd;
+	}
+	return h;
+}
+
+struct rad_handle *
 rad_open(void)
 {
     return rad_auth_open();
@@ -797,13 +989,13 @@ rad_put_attr(struct rad_handle *h, int t
 {
 	int result;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
 	}
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		if (type == RAD_EAP_MESSAGE) {
 			generr(h, "EAP-Message attribute is not valid"
 			    " in accounting requests");
@@ -858,14 +1050,14 @@ rad_put_message_authentic(struct rad_han
 #ifdef WITH_SSL
 	u_char md_zero[MD5_DIGEST_LENGTH];
 
-	if (h->request[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
+	if (h->out[POS_CODE] == RAD_ACCOUNTING_REQUEST) {
 		generr(h, "Message-Authenticator is not valid"
 		    " in accounting requests");
 		return -1;
 	}
 
 	if (h->authentic_pos == 0) {
-		h->authentic_pos = h->req_len;
+		h->authentic_pos = h->out_len;
 		memset(md_zero, 0, sizeof(md_zero));
 		return (put_raw_attr(h, RAD_MESSAGE_AUTHENTIC, md_zero,
 		    sizeof(md_zero)));
@@ -1041,7 +1233,7 @@ rad_put_vendor_attr(struct rad_handle *h
 	struct vendor_attribute *attr;
 	int res;
 
-	if (!h->request_created) {
+	if (!h->out_created) {
 		generr(h, "Please call rad_create_request()"
 		    " before putting attributes");
 		return -1;
@@ -1088,7 +1280,7 @@ rad_request_authenticator(struct rad_han
 {
 	if (len < LEN_AUTH)
 		return (-1);
-	memcpy(buf, h->request + POS_AUTH, LEN_AUTH);
+	memcpy(buf, h->out + POS_AUTH, LEN_AUTH);
 	if (len > LEN_AUTH)
 		buf[LEN_AUTH] = '\0';
 	return (LEN_AUTH);

Modified: stable/7/lib/libradius/radlib.h
==============================================================================
--- stable/7/lib/libradius/radlib.h	Fri Oct 30 12:57:28 2009	(r198672)
+++ stable/7/lib/libradius/radlib.h	Fri Oct 30 12:59:22 2009	(r198673)
@@ -42,6 +42,12 @@
 #define RAD_ACCOUNTING_REQUEST		4
 #define RAD_ACCOUNTING_RESPONSE		5
 #define RAD_ACCESS_CHALLENGE		11
+#define RAD_DISCONNECT_REQUEST		40
+#define RAD_DISCONNECT_ACK		41
+#define RAD_DISCONNECT_NAK		42
+#define RAD_COA_REQUEST			43
+#define RAD_COA_ACK			44
+#define RAD_COA_NAK			45
 
 /* Attribute types and values */
 #define RAD_USER_NAME			1	/* String */
@@ -179,6 +185,8 @@
 #define	RAD_ACCT_MULTI_SESSION_ID	50	/* String */
 #define	RAD_ACCT_LINK_COUNT		51	/* Integer */
 
+#define	RAD_ERROR_CAUSE			101	/* Integer */
+
 struct rad_handle;
 struct timeval;
 
@@ -192,6 +200,7 @@ int			 rad_config(struct rad_handle *, c
 int			 rad_continue_send_request(struct rad_handle *, int,
 			    int *, struct timeval *);
 int			 rad_create_request(struct rad_handle *, int);
+int			 rad_create_response(struct rad_handle *, int);
 struct in_addr		 rad_cvt_addr(const void *);
 u_int32_t		 rad_cvt_int(const void *);
 char			*rad_cvt_string(const void *, size_t);
@@ -209,7 +218,10 @@ int			 rad_put_string(struct rad_handle 
 int			 rad_put_message_authentic(struct rad_handle *);
 ssize_t			 rad_request_authenticator(struct rad_handle *, char *,
 			    size_t);
+int			 rad_receive_request(struct rad_handle *);
 int			 rad_send_request(struct rad_handle *);
+int			 rad_send_response(struct rad_handle *);
+struct rad_handle	*rad_server_open(int fd);
 const char		*rad_server_secret(struct rad_handle *);
 const char		*rad_strerror(struct rad_handle *);
 u_char			*rad_demangle(struct rad_handle *, const void *,

Modified: stable/7/lib/libradius/radlib_private.h
==============================================================================
--- stable/7/lib/libradius/radlib_private.h	Fri Oct 30 12:57:28 2009	(r198672)
+++ stable/7/lib/libradius/radlib_private.h	Fri Oct 30 12:59:22 2009	(r198673)
@@ -38,6 +38,7 @@
 /* Handle types */
 #define RADIUS_AUTH		0   /* RADIUS authentication, default */
 #define RADIUS_ACCT		1   /* RADIUS accounting */
+#define RADIUS_SERVER		2   /* RADIUS server */
 
 /* Defaults */
 #define MAXTRIES		3
@@ -75,18 +76,18 @@ struct rad_handle {
 	int		 num_servers;	/* Number of valid server entries */
 	int		 ident;		/* Current identifier value */
 	char		 errmsg[ERRSIZE];	/* Most recent error message */
-	unsigned char	 request[MSGSIZE];	/* Request to send */
-	char	 	 request_created; /* rad_create_request() called? */
-	int		 req_len;	/* Length of request */
+	unsigned char	 out[MSGSIZE];	/* Request to send */
+	char		 out_created;	/* rad_create_request() called? */
+	int		 out_len;	/* Length of request */
 	char		 pass[PASSSIZE];	/* Cleartext password */
 	int		 pass_len;	/* Length of cleartext password */
 	int		 pass_pos;	/* Position of scrambled password */
-	char	 	 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
+	char		 chap_pass;	/* Have we got a CHAP_PASSWORD ? */
 	int		 authentic_pos;	/* Position of message authenticator */
 	char		 eap_msg;	/* Are we an EAP Proxy? */
-	unsigned char	 response[MSGSIZE];	/* Response received */
-	int		 resp_len;	/* Length of response */
-	int		 resp_pos;	/* Current position scanning attrs */
+	unsigned char	 in[MSGSIZE];	/* Response received */
+	int		 in_len;	/* Length of response */
+	int		 in_pos;	/* Current position scanning attrs */
 	int		 total_tries;	/* How many requests we'll send */
 	int		 try;		/* How many requests we've sent */
 	int		 srv;		/* Server number we did last */

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 13:02:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB3CF106566C;
	Fri, 30 Oct 2009 13:02:08 +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 C9CFC8FC1E;
	Fri, 30 Oct 2009 13:02: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 n9UD28gS045122;
	Fri, 30 Oct 2009 13:02:08 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UD28nq045120;
	Fri, 30 Oct 2009 13:02:08 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910301302.n9UD28nq045120@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Oct 2009 13:02:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198674 - stable/8/lib/libradius
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 13:02:09 -0000

Author: mav
Date: Fri Oct 30 13:02:08 2009
New Revision: 198674
URL: http://svn.freebsd.org/changeset/base/198674

Log:
  MFC rev. 197621:
  Fix bug, when RADIUS client gave up after single sendto() error, do not
  trying backup servers.
  
  PR:		kern/103764, misc/139214

Modified:
  stable/8/lib/libradius/   (props changed)
  stable/8/lib/libradius/radlib.c

Modified: stable/8/lib/libradius/radlib.c
==============================================================================
--- stable/8/lib/libradius/radlib.c	Fri Oct 30 12:59:22 2009	(r198673)
+++ stable/8/lib/libradius/radlib.c	Fri Oct 30 13:02:08 2009	(r198674)
@@ -650,17 +650,12 @@ rad_continue_send_request(struct rad_han
 	n = sendto(h->fd, h->out, h->out_len, 0,
 	    (const struct sockaddr *)&h->servers[h->srv].addr,
 	    sizeof h->servers[h->srv].addr);
-	if (n != h->out_len) {
-		if (n == -1)
-			generr(h, "sendto: %s", strerror(errno));
-		else
-			generr(h, "sendto: short write");
-		return -1;
-	}
-
+	if (n != h->out_len)
+		tv->tv_sec = 1; /* Do not wait full timeout if send failed. */
+	else
+		tv->tv_sec = h->servers[h->srv].timeout;
 	h->try++;
 	h->servers[h->srv].num_tries++;
-	tv->tv_sec = h->servers[h->srv].timeout;
 	tv->tv_usec = 0;
 	*fd = h->fd;
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 13:03:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2ED971065670;
	Fri, 30 Oct 2009 13:03:09 +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 1D9088FC0C;
	Fri, 30 Oct 2009 13:03: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 n9UD39Lm045196;
	Fri, 30 Oct 2009 13:03:09 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UD3880045194;
	Fri, 30 Oct 2009 13:03:08 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910301303.n9UD3880045194@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Oct 2009 13:03:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198675 - stable/7/lib/libradius
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 13:03:09 -0000

Author: mav
Date: Fri Oct 30 13:03:08 2009
New Revision: 198675
URL: http://svn.freebsd.org/changeset/base/198675

Log:
  MFC rev. 197621:
  Fix bug, when RADIUS client gave up after single sendto() error, do not
  trying backup servers.
  
  PR:             kern/103764, misc/139214

Modified:
  stable/7/lib/libradius/   (props changed)
  stable/7/lib/libradius/radlib.c

Modified: stable/7/lib/libradius/radlib.c
==============================================================================
--- stable/7/lib/libradius/radlib.c	Fri Oct 30 13:02:08 2009	(r198674)
+++ stable/7/lib/libradius/radlib.c	Fri Oct 30 13:03:08 2009	(r198675)
@@ -650,17 +650,12 @@ rad_continue_send_request(struct rad_han
 	n = sendto(h->fd, h->out, h->out_len, 0,
 	    (const struct sockaddr *)&h->servers[h->srv].addr,
 	    sizeof h->servers[h->srv].addr);
-	if (n != h->out_len) {
-		if (n == -1)
-			generr(h, "sendto: %s", strerror(errno));
-		else
-			generr(h, "sendto: short write");
-		return -1;
-	}
-
+	if (n != h->out_len)
+		tv->tv_sec = 1; /* Do not wait full timeout if send failed. */
+	else
+		tv->tv_sec = h->servers[h->srv].timeout;
 	h->try++;
 	h->servers[h->srv].num_tries++;
-	tv->tv_sec = h->servers[h->srv].timeout;
 	tv->tv_usec = 0;
 	*fd = h->fd;
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 15:45:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B885E1065676;
	Fri, 30 Oct 2009 15:45:00 +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 A52438FC1F;
	Fri, 30 Oct 2009 15:45: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 n9UFj09i049530;
	Fri, 30 Oct 2009 15:45:00 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UFj0GM049528;
	Fri, 30 Oct 2009 15:45:00 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301545.n9UFj0GM049528@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 15:45:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198676 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci geom/part
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 15:45:00 -0000

Author: rnoland
Date: Fri Oct 30 15:45:00 2009
New Revision: 198676
URL: http://svn.freebsd.org/changeset/base/198676

Log:
  MFC r198097
  
  Set the active flag in the PMBR when we install bootcode on a GPT
  partitioned disk.  Some BIOS require this to be set before they will
  boot the device.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/part/g_part_gpt.c

Modified: stable/8/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/8/sys/geom/part/g_part_gpt.c	Fri Oct 30 13:03:08 2009	(r198675)
+++ stable/8/sys/geom/part/g_part_gpt.c	Fri Oct 30 15:45:00 2009	(r198676)
@@ -382,6 +382,9 @@ g_part_gpt_bootcode(struct g_part_table 
 	codesz = MIN(codesz, gpp->gpp_codesize);
 	if (codesz > 0)
 		bcopy(gpp->gpp_codeptr, table->mbr, codesz);
+
+	/* Mark the PMBR active since some BIOS require it */
+	table->mbr[DOSPARTOFF] = 0x80;		/* status */
 	return (0);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 15:45:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACE6F106568B;
	Fri, 30 Oct 2009 15:45:40 +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 9B4A48FC21;
	Fri, 30 Oct 2009 15:45: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 n9UFjeVl049585;
	Fri, 30 Oct 2009 15:45:40 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UFjeXD049583;
	Fri, 30 Oct 2009 15:45:40 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301545.n9UFjeXD049583@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 15:45:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198677 - in stable/7/sys: . contrib/pf geom/part
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 15:45:40 -0000

Author: rnoland
Date: Fri Oct 30 15:45:40 2009
New Revision: 198677
URL: http://svn.freebsd.org/changeset/base/198677

Log:
  MFC r198097
  
  Set the active flag in the PMBR when we install bootcode on a GPT
  partitioned disk.  Some BIOS require this to be set before they will
  boot the device.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/geom/part/g_part_gpt.c

Modified: stable/7/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/7/sys/geom/part/g_part_gpt.c	Fri Oct 30 15:45:00 2009	(r198676)
+++ stable/7/sys/geom/part/g_part_gpt.c	Fri Oct 30 15:45:40 2009	(r198677)
@@ -376,6 +376,9 @@ g_part_gpt_bootcode(struct g_part_table 
 	codesz = MIN(codesz, gpp->gpp_codesize);
 	if (codesz > 0)
 		bcopy(gpp->gpp_codeptr, table->mbr, codesz);
+
+	/* Mark the PMBR active since some BIOS require it */
+	table->mbr[DOSPARTOFF] = 0x80;		/* status */
 	return (0);
 }
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:00:34 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C1654106568B;
	Fri, 30 Oct 2009 16:00:34 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AFFB78FC66;
	Fri, 30 Oct 2009 16:00: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 n9UG0YuE050061;
	Fri, 30 Oct 2009 16:00:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UG0Ype050059;
	Fri, 30 Oct 2009 16:00:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910301600.n9UG0Ype050059@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Fri, 30 Oct 2009 16:00: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: r198678 - head/sys/powerpc/powerpc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:00:34 -0000

Author: nwhitehorn
Date: Fri Oct 30 16:00:34 2009
New Revision: 198678
URL: http://svn.freebsd.org/changeset/base/198678

Log:
  Make procstat -k work on PowerPC by avoiding mistakenly using signed
  compares with a low address (0x1000) and a high address
  (the KVA kernel stack).

Modified:
  head/sys/powerpc/powerpc/stack_machdep.c

Modified: head/sys/powerpc/powerpc/stack_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/stack_machdep.c	Fri Oct 30 15:45:40 2009	(r198677)
+++ head/sys/powerpc/powerpc/stack_machdep.c	Fri Oct 30 16:00:34 2009	(r198678)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 static void
-stack_capture(struct stack *st, register_t frame)
+stack_capture(struct stack *st, vm_offset_t frame)
 {
 	vm_offset_t callpc;
 
@@ -76,7 +76,7 @@ stack_capture(struct stack *st, register
 void
 stack_save_td(struct stack *st, struct thread *td)
 {
-	register_t frame;
+	vm_offset_t frame;
 
 	if (TD_IS_SWAPPED(td))
 		panic("stack_save_td: swapped");

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:06:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 803A5106568B;
	Fri, 30 Oct 2009 16:06:32 +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 6D12B8FC0A;
	Fri, 30 Oct 2009 16:06: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 n9UG6WTU050260;
	Fri, 30 Oct 2009 16:06:32 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UG6Wvm050258;
	Fri, 30 Oct 2009 16:06:32 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301606.n9UG6Wvm050258@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:06:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198679 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/drm dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:06:32 -0000

Author: rnoland
Date: Fri Oct 30 16:06:32 2009
New Revision: 198679
URL: http://svn.freebsd.org/changeset/base/198679

Log:
  MFC r196464
  
  Clean up the locking in drm_alloc_resource()

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drm_bufs.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/drm/drm_bufs.c
==============================================================================
--- stable/8/sys/dev/drm/drm_bufs.c	Fri Oct 30 16:00:34 2009	(r198678)
+++ stable/8/sys/dev/drm/drm_bufs.c	Fri Oct 30 16:06:32 2009	(r198679)
@@ -45,27 +45,35 @@ __FBSDID("$FreeBSD$");
  */
 static int drm_alloc_resource(struct drm_device *dev, int resource)
 {
+	struct resource *res;
+	int rid;
+
+	DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
 	if (resource >= DRM_MAX_PCI_RESOURCE) {
 		DRM_ERROR("Resource %d too large\n", resource);
 		return 1;
 	}
 
-	DRM_UNLOCK();
 	if (dev->pcir[resource] != NULL) {
-		DRM_LOCK();
 		return 0;
 	}
 
-	dev->pcirid[resource] = PCIR_BAR(resource);
-	dev->pcir[resource] = bus_alloc_resource_any(dev->device,
-	    SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE);
+	DRM_UNLOCK();
+	rid = PCIR_BAR(resource);
+	res = bus_alloc_resource_any(dev->device, SYS_RES_MEMORY, &rid,
+	    RF_SHAREABLE);
 	DRM_LOCK();
-
-	if (dev->pcir[resource] == NULL) {
+	if (res == NULL) {
 		DRM_ERROR("Couldn't find resource 0x%x\n", resource);
 		return 1;
 	}
 
+	if (dev->pcir[resource] == NULL) {
+		dev->pcirid[resource] = rid;
+		dev->pcir[resource] = res;
+	}
+
 	return 0;
 }
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:07:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F178106566C;
	Fri, 30 Oct 2009 16:07:07 +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 0D5948FC0C;
	Fri, 30 Oct 2009 16:07: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 n9UG76QA050312;
	Fri, 30 Oct 2009 16:07:06 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UG76fT050310;
	Fri, 30 Oct 2009 16:07:06 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301607.n9UG76fT050310@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:07:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198680 - in stable/7/sys: . contrib/pf dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:07:07 -0000

Author: rnoland
Date: Fri Oct 30 16:07:06 2009
New Revision: 198680
URL: http://svn.freebsd.org/changeset/base/198680

Log:
  MFC r196464
  
  Clean up the locking in drm_alloc_resource()

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/drm/drm_bufs.c

Modified: stable/7/sys/dev/drm/drm_bufs.c
==============================================================================
--- stable/7/sys/dev/drm/drm_bufs.c	Fri Oct 30 16:06:32 2009	(r198679)
+++ stable/7/sys/dev/drm/drm_bufs.c	Fri Oct 30 16:07:06 2009	(r198680)
@@ -45,27 +45,35 @@ __FBSDID("$FreeBSD$");
  */
 static int drm_alloc_resource(struct drm_device *dev, int resource)
 {
+	struct resource *res;
+	int rid;
+
+	DRM_SPINLOCK_ASSERT(&dev->dev_lock);
+
 	if (resource >= DRM_MAX_PCI_RESOURCE) {
 		DRM_ERROR("Resource %d too large\n", resource);
 		return 1;
 	}
 
-	DRM_UNLOCK();
 	if (dev->pcir[resource] != NULL) {
-		DRM_LOCK();
 		return 0;
 	}
 
-	dev->pcirid[resource] = PCIR_BAR(resource);
-	dev->pcir[resource] = bus_alloc_resource_any(dev->device,
-	    SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE);
+	DRM_UNLOCK();
+	rid = PCIR_BAR(resource);
+	res = bus_alloc_resource_any(dev->device, SYS_RES_MEMORY, &rid,
+	    RF_SHAREABLE);
 	DRM_LOCK();
-
-	if (dev->pcir[resource] == NULL) {
+	if (res == NULL) {
 		DRM_ERROR("Couldn't find resource 0x%x\n", resource);
 		return 1;
 	}
 
+	if (dev->pcir[resource] == NULL) {
+		dev->pcirid[resource] = rid;
+		dev->pcir[resource] = res;
+	}
+
 	return 0;
 }
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:12:29 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 648E3106568B;
	Fri, 30 Oct 2009 16:12:29 +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 5101C8FC15;
	Fri, 30 Oct 2009 16:12: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 n9UGCT4L050564;
	Fri, 30 Oct 2009 16:12:29 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGCTAS050559;
	Fri, 30 Oct 2009 16:12:29 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301612.n9UGCTAS050559@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:12:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198681 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/drm dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:12:29 -0000

Author: rnoland
Date: Fri Oct 30 16:12:28 2009
New Revision: 198681
URL: http://svn.freebsd.org/changeset/base/198681

Log:
  MFC r196465
  
  Clean up the handling of device minors

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drmP.h
  stable/8/sys/dev/drm/drm_drv.c
  stable/8/sys/dev/drm/drm_fops.c
  stable/8/sys/dev/drm/drm_sysctl.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/drm/drmP.h
==============================================================================
--- stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:12:28 2009	(r198681)
@@ -416,7 +416,6 @@ struct drm_file {
 	struct drm_device *dev;
 	int		  authenticated;
 	int		  master;
-	int		  minor;
 	pid_t		  pid;
 	uid_t		  uid;
 	drm_magic_t	  magic;

Modified: stable/8/sys/dev/drm/drm_drv.c
==============================================================================
--- stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -53,9 +53,6 @@ static void drm_unload(struct drm_device
 static drm_pci_id_list_t *drm_find_description(int vendor, int device,
     drm_pci_id_list_t *idlist);
 
-#define DRIVER_SOFTC(unit) \
-	((struct drm_device *)devclass_get_softc(drm_devclass, unit))
-
 MODULE_VERSION(drm, 1);
 MODULE_DEPEND(drm, agp, 1, 1, 1);
 MODULE_DEPEND(drm, pci, 1, 1, 1);
@@ -210,11 +207,12 @@ int drm_attach(device_t kdev, drm_pci_id
 	dev->device = kdev;
 #endif
 	dev->devnode = make_dev(&drm_cdevsw,
-			unit,
+			0,
 			DRM_DEV_UID,
 			DRM_DEV_GID,
 			DRM_DEV_MODE,
 			"dri/card%d", unit);
+	dev->devnode->si_drv1 = dev;
 
 #if __FreeBSD_version >= 700053
 	dev->pci_domain = pci_get_domain(dev->device);
@@ -606,7 +604,7 @@ int drm_open(struct cdev *kdev, int flag
 	struct drm_device *dev = NULL;
 	int retcode = 0;
 
-	dev = DRIVER_SOFTC(dev2unit(kdev));
+	dev = kdev->si_drv1;
 
 	DRM_DEBUG("open_count = %d\n", dev->open_count);
 

Modified: stable/8/sys/dev/drm/drm_fops.c
==============================================================================
--- stable/8/sys/dev/drm/drm_fops.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_fops.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, i
 		    struct drm_device *dev)
 {
 	struct drm_file *priv;
-	int m = dev2unit(kdev);
 	int retcode;
 
 	if (flags & O_EXCL)
 		return EBUSY; /* No exclusive opens */
 	dev->flags = flags;
 
-	DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m);
+	DRM_DEBUG("pid = %d, device = %s\n", DRM_CURRENTPID, devtoname(kdev));
 
 	priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO);
 	if (priv == NULL) {
@@ -68,7 +67,6 @@ int drm_open_helper(struct cdev *kdev, i
 	priv->dev		= dev;
 	priv->uid		= p->td_ucred->cr_svuid;
 	priv->pid		= p->td_proc->p_pid;
-	priv->minor		= m;
 	priv->ioctl_count 	= 0;
 
 	/* for compatibility root is always authenticated */

Modified: stable/8/sys/dev/drm/drm_sysctl.c
==============================================================================
--- stable/8/sys/dev/drm/drm_sysctl.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_sysctl.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_H
 
 	DRM_UNLOCK();
 
-	DRM_SYSCTL_PRINT("\na dev	pid    uid	magic	  ioctls\n");
+	DRM_SYSCTL_PRINT(
+	    "\na dev            pid   uid      magic     ioctls\n");
 	for (i = 0; i < privcount; i++) {
 		priv = &tempprivs[i];
-		DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n",
+		DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n",
 			       priv->authenticated ? 'y' : 'n',
-			       priv->minor,
+			       devtoname(priv->dev->devnode),
 			       priv->pid,
 			       priv->uid,
 			       priv->magic,

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:14:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F11671065696;
	Fri, 30 Oct 2009 16:14:17 +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 DDF918FC1A;
	Fri, 30 Oct 2009 16:14: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 n9UGEH8d050665;
	Fri, 30 Oct 2009 16:14:17 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGEHZL050662;
	Fri, 30 Oct 2009 16:14:17 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301614.n9UGEHZL050662@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:14:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198682 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/drm dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:14:18 -0000

Author: rnoland
Date: Fri Oct 30 16:14:17 2009
New Revision: 198682
URL: http://svn.freebsd.org/changeset/base/198682

Log:
  MFC r196466
  
  Add a read only sysctl tracking the hw.drm.msi tunable.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drmP.h
  stable/8/sys/dev/drm/drm_drv.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/drm/drmP.h
==============================================================================
--- stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:12:28 2009	(r198681)
+++ stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:14:17 2009	(r198682)
@@ -148,6 +148,8 @@ MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
 MALLOC_DECLARE(DRM_MEM_SGLISTS);
 MALLOC_DECLARE(DRM_MEM_DRAWABLE);
 
+SYSCTL_DECL(_hw_drm);
+
 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
 
 				/* Internal types and structures */

Modified: stable/8/sys/dev/drm/drm_drv.c
==============================================================================
--- stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:12:28 2009	(r198681)
+++ stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:14:17 2009	(r198682)
@@ -133,6 +133,9 @@ static struct cdevsw drm_cdevsw = {
 
 static int drm_msi = 1;	/* Enable by default. */
 TUNABLE_INT("hw.drm.msi", &drm_msi);
+SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device");
+SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1,
+    "Enable MSI interrupts for drm devices");
 
 static struct drm_msi_blacklist_entry drm_msi_blacklist[] = {
 	{0x8086, 0x2772}, /* Intel i945G	*/ \

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:21:10 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 89F07106566C;
	Fri, 30 Oct 2009 16:21:09 +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 77C508FC12;
	Fri, 30 Oct 2009 16: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 n9UGL95L050862;
	Fri, 30 Oct 2009 16:21:09 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGL9lx050859;
	Fri, 30 Oct 2009 16:21:09 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301621.n9UGL9lx050859@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:21:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198683 - in stable/7/sys: . contrib/pf dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:21:10 -0000

Author: rnoland
Date: Fri Oct 30 16:21:09 2009
New Revision: 198683
URL: http://svn.freebsd.org/changeset/base/198683

Log:
  MFC r196466
  
  Add a read only sysctl tracking the hw.drm.msi tunable.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/drm/drmP.h
  stable/7/sys/dev/drm/drm_drv.c

Modified: stable/7/sys/dev/drm/drmP.h
==============================================================================
--- stable/7/sys/dev/drm/drmP.h	Fri Oct 30 16:14:17 2009	(r198682)
+++ stable/7/sys/dev/drm/drmP.h	Fri Oct 30 16:21:09 2009	(r198683)
@@ -148,6 +148,8 @@ MALLOC_DECLARE(DRM_MEM_CTXBITMAP);
 MALLOC_DECLARE(DRM_MEM_SGLISTS);
 MALLOC_DECLARE(DRM_MEM_DRAWABLE);
 
+SYSCTL_DECL(_hw_drm);
+
 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
 
 				/* Internal types and structures */

Modified: stable/7/sys/dev/drm/drm_drv.c
==============================================================================
--- stable/7/sys/dev/drm/drm_drv.c	Fri Oct 30 16:14:17 2009	(r198682)
+++ stable/7/sys/dev/drm/drm_drv.c	Fri Oct 30 16:21:09 2009	(r198683)
@@ -136,6 +136,9 @@ static struct cdevsw drm_cdevsw = {
 
 static int drm_msi = 1;	/* Enable by default. */
 TUNABLE_INT("hw.drm.msi", &drm_msi);
+SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device");
+SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1,
+    "Enable MSI interrupts for drm devices");
 
 static struct drm_msi_blacklist_entry drm_msi_blacklist[] = {
 	{0x8086, 0x2772}, /* Intel i945G	*/ \

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:23:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 757D31065670;
	Fri, 30 Oct 2009 16:23:57 +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 6488B8FC16;
	Fri, 30 Oct 2009 16:23: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 n9UGNvMR050977;
	Fri, 30 Oct 2009 16:23:57 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGNvuI050975;
	Fri, 30 Oct 2009 16:23:57 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910301623.n9UGNvuI050975@svn.freebsd.org>
From: Christian Brueffer 
Date: Fri, 30 Oct 2009 16:23: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: r198684 - head/sys/dev/aic7xxx
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:23:57 -0000

Author: brueffer
Date: Fri Oct 30 16:23:56 2009
New Revision: 198684
URL: http://svn.freebsd.org/changeset/base/198684

Log:
  Add support for Adaptec 39320LPE adapters.
  
  PR:		124202
  Submitted by:	Andre Albsmeier 
  Reviewed by:	gibbs
  MFC after:	1 week

Modified:
  head/sys/dev/aic7xxx/aic79xx_pci.c

Modified: head/sys/dev/aic7xxx/aic79xx_pci.c
==============================================================================
--- head/sys/dev/aic7xxx/aic79xx_pci.c	Fri Oct 30 16:21:09 2009	(r198683)
+++ head/sys/dev/aic7xxx/aic79xx_pci.c	Fri Oct 30 16:23:56 2009	(r198684)
@@ -89,6 +89,7 @@ ahd_compose_id(u_int device, u_int vendo
 #define ID_AHA_39320D_B			0x801C900500419005ull
 #define ID_AHA_39320D_HP		0x8011900500AC0E11ull
 #define ID_AHA_39320D_B_HP		0x801C900500AC0E11ull
+#define ID_AHA_39320LPE 		0x8017900500459005ull
 #define ID_AIC7902_PCI_REV_A4		0x3
 #define ID_AIC7902_PCI_REV_B0		0x10
 #define SUBID_HP			0x0E11
@@ -204,6 +205,12 @@ struct ahd_pci_identity ahd_pci_ident_ta
 		"Adaptec (HP OEM) 39320D Ultra320 SCSI adapter",
 		ahd_aic7902_setup
 	},
+	{
+		ID_AHA_39320LPE,
+		ID_ALL_MASK,
+		"Adaptec 39320LPE Ultra320 SCSI adapter",
+		ahd_aic7902_setup
+	},
 	/* Generic chip probes for devices we don't know 'exactly' */
 	{
 		ID_AIC7901 & ID_9005_GENERIC_MASK,

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:32:35 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93E6E106568D;
	Fri, 30 Oct 2009 16:32:35 +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 7EE568FC16;
	Fri, 30 Oct 2009 16: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 n9UGWZPP051233;
	Fri, 30 Oct 2009 16:32:35 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGWZ1h051221;
	Fri, 30 Oct 2009 16:32:35 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301632.n9UGWZ1h051221@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:32:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198685 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf
	dev/drm dev/xen/xenpci modules/drm/radeon
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:32:35 -0000

Author: rnoland
Date: Fri Oct 30 16:32:35 2009
New Revision: 198685
URL: http://svn.freebsd.org/changeset/base/198685

Log:
  MFC r196470-196471,197154-197155,197603-197606
  
  Sync radeon drm support
  
  This adds kernel support for r6/7xx 3D.

Added:
  stable/8/sys/dev/drm/r600_blit.c
     - copied, changed from r196470, head/sys/dev/drm/r600_blit.c
  stable/8/sys/dev/drm/radeon_cs.c
     - copied, changed from r196470, head/sys/dev/drm/radeon_cs.c
Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/files
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drm_pciids.h
  stable/8/sys/dev/drm/r600_cp.c
  stable/8/sys/dev/drm/radeon_cp.c
  stable/8/sys/dev/drm/radeon_drm.h
  stable/8/sys/dev/drm/radeon_drv.h
  stable/8/sys/dev/drm/radeon_irq.c
  stable/8/sys/dev/drm/radeon_state.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/modules/drm/radeon/Makefile

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/conf/files	Fri Oct 30 16:32:35 2009	(r198685)
@@ -845,8 +845,10 @@ dev/drm/r128_irq.c		optional r128drm
 dev/drm/r128_state.c		optional r128drm \
 	compile-with "${NORMAL_C} -finline-limit=13500"
 dev/drm/r300_cmdbuf.c		optional radeondrm
+dev/drm/r600_blit.c		optional radeondrm
 dev/drm/r600_cp.c		optional radeondrm
 dev/drm/radeon_cp.c		optional radeondrm
+dev/drm/radeon_cs.c		optional radeondrm
 dev/drm/radeon_drv.c		optional radeondrm
 dev/drm/radeon_irq.c		optional radeondrm
 dev/drm/radeon_mem.c		optional radeondrm

Modified: stable/8/sys/dev/drm/drm_pciids.h
==============================================================================
--- stable/8/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:32:35 2009	(r198685)
@@ -338,6 +338,7 @@
 	{0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
 	{0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \
 	{0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
+	{0x1002, 0x9443, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4850 X2"}, \
 	{0x1002, 0x944C, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
 	{0x1002, 0x9450, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9270"}, \
 	{0x1002, 0x9452, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9250"}, \

Copied and modified: stable/8/sys/dev/drm/r600_blit.c (from r196470, head/sys/dev/drm/r600_blit.c)
==============================================================================
--- head/sys/dev/drm/r600_blit.c	Sun Aug 23 14:55:57 2009	(r196470, copy source)
+++ stable/8/sys/dev/drm/r600_blit.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -1734,6 +1734,8 @@ r600_blit_copy(struct drm_device *dev,
 
 			if (!src_x && !dst_x) {
 				h = (cur_size / max_bytes);
+				if (h > 8192)
+					h = 8192;
 				if (h == 0)
 					h = 1;
 				else
@@ -1805,8 +1807,8 @@ r600_blit_copy(struct drm_device *dev,
 			vb += 12;
 			dev_priv->blit_vb->used += 12 * 4;
 
-			src_gpu_addr += cur_size;
-			dst_gpu_addr += cur_size;
+			src_gpu_addr += cur_size * h;
+			dst_gpu_addr += cur_size * h;
 			size_bytes -= cur_size * h;
 		}
 	} else {
@@ -1822,6 +1824,8 @@ r600_blit_copy(struct drm_device *dev,
 
 			if (!src_x && !dst_x) {
 				h = (cur_size / max_bytes);
+				if (h > 8192)
+					h = 8192;
 				if (h == 0)
 					h = 1;
 				else
@@ -1872,7 +1876,7 @@ r600_blit_copy(struct drm_device *dev,
 
 			/* dst */
 			set_render_target(dev_priv, COLOR_8_8_8_8,
-					  dst_x + cur_size, h,
+					  (dst_x + cur_size) / 4, h,
 					  dst_gpu_addr);
 
 			/* scissors */
@@ -1894,8 +1898,8 @@ r600_blit_copy(struct drm_device *dev,
 			vb += 12;
 			dev_priv->blit_vb->used += 12 * 4;
 
-			src_gpu_addr += cur_size;
-			dst_gpu_addr += cur_size;
+			src_gpu_addr += cur_size * h;
+			dst_gpu_addr += cur_size * h;
 			size_bytes -= cur_size * h;
 		}
 	}

Modified: stable/8/sys/dev/drm/r600_cp.c
==============================================================================
--- stable/8/sys/dev/drm/r600_cp.c	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/r600_cp.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -1843,6 +1843,7 @@ int r600_do_init_cp(struct drm_device *d
 	 */
 	dev_priv->vblank_crtc = DRM_RADEON_VBLANK_CRTC1;
 
+	dev_priv->do_boxes = 0;
 	dev_priv->cp_mode = init->cp_mode;
 
 	/* We don't support anything other than bus-mastering ring mode,
@@ -2100,6 +2101,8 @@ int r600_do_init_cp(struct drm_device *d
 	r600_do_engine_reset(dev);
 	r600_test_writeback(dev_priv);
 
+	r600_cs_init(dev);
+
 	return 0;
 }
 
@@ -2232,3 +2235,135 @@ int r600_cp_dispatch_indirect(struct drm
 
 	return 0;
 }
+
+void r600_cp_dispatch_swap(struct drm_device * dev)
+{
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
+	int nbox = sarea_priv->nbox;
+	struct drm_clip_rect *pbox = sarea_priv->boxes;
+	int i, cpp, src_pitch, dst_pitch;
+	uint64_t src, dst;
+	RING_LOCALS;
+	DRM_DEBUG("\n");
+
+	if (dev_priv->color_fmt == RADEON_COLOR_FORMAT_ARGB8888)
+		cpp = 4;
+	else
+		cpp = 2;
+
+	if (dev_priv->sarea_priv->pfCurrentPage == 0) {
+		src_pitch = dev_priv->back_pitch;
+		dst_pitch = dev_priv->front_pitch;
+		src = dev_priv->back_offset + dev_priv->fb_location;
+		dst = dev_priv->front_offset + dev_priv->fb_location;
+	} else {
+		src_pitch = dev_priv->front_pitch;
+		dst_pitch = dev_priv->back_pitch;
+		src = dev_priv->front_offset + dev_priv->fb_location;
+		dst = dev_priv->back_offset + dev_priv->fb_location;
+	}
+
+	if (r600_prepare_blit_copy(dev)) {
+		DRM_ERROR("unable to allocate vertex buffer for swap buffer\n");
+		return;
+	}
+	for (i = 0; i < nbox; i++) {
+		int x = pbox[i].x1;
+		int y = pbox[i].y1;
+		int w = pbox[i].x2 - x;
+		int h = pbox[i].y2 - y;
+
+		DRM_DEBUG("%d,%d-%d,%d\n", x, y, w, h);
+
+		r600_blit_swap(dev,
+			       src, dst,
+			       x, y, x, y, w, h,
+			       src_pitch, dst_pitch, cpp);
+	}
+	r600_done_blit_copy(dev);
+
+	/* Increment the frame counter.  The client-side 3D driver must
+	 * throttle the framerate by waiting for this value before
+	 * performing the swapbuffer ioctl.
+	 */
+	dev_priv->sarea_priv->last_frame++;
+
+	BEGIN_RING(3);
+	R600_FRAME_AGE(dev_priv->sarea_priv->last_frame);
+	ADVANCE_RING();
+}
+
+int r600_cp_dispatch_texture(struct drm_device * dev,
+			     struct drm_file *file_priv,
+			     drm_radeon_texture_t * tex,
+			     drm_radeon_tex_image_t * image)
+{
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	struct drm_buf *buf;
+	u32 *buffer;
+	const u8 __user *data;
+	int size, pass_size;
+	u64 src_offset, dst_offset;
+
+	if (!radeon_check_offset(dev_priv, tex->offset)) {
+		DRM_ERROR("Invalid destination offset\n");
+		return -EINVAL;
+	}
+
+	/* this might fail for zero-sized uploads - are those illegal? */
+	if (!radeon_check_offset(dev_priv, tex->offset + tex->height * tex->pitch - 1)) {
+		DRM_ERROR("Invalid final destination offset\n");
+		return -EINVAL;
+	}
+
+	size = tex->height * tex->pitch;
+
+	if (size == 0)
+		return 0;
+
+	dst_offset = tex->offset;
+
+	r600_prepare_blit_copy(dev);
+	do {
+		data = (const u8 __user *)image->data;
+		pass_size = size;
+
+		buf = radeon_freelist_get(dev);
+		if (!buf) {
+			DRM_DEBUG("EAGAIN\n");
+			if (DRM_COPY_TO_USER(tex->image, image, sizeof(*image)))
+				return -EFAULT;
+			return -EAGAIN;
+		}
+
+		if (pass_size > buf->total)
+			pass_size = buf->total;
+
+		/* Dispatch the indirect buffer.
+		 */
+		buffer =
+		    (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset);
+
+		if (DRM_COPY_FROM_USER(buffer, data, pass_size)) {
+			DRM_ERROR("EFAULT on pad, %d bytes\n", pass_size);
+			return -EFAULT;
+		}
+
+		buf->file_priv = file_priv;
+		buf->used = pass_size;
+		src_offset = dev_priv->gart_buffers_offset + buf->offset;
+
+		r600_blit_copy(dev, src_offset, dst_offset, pass_size);
+
+		radeon_cp_discard_buffer(dev, buf);
+
+		/* Update the input parameters for next time */
+		image->data = (const u8 __user *)image->data + pass_size;
+		dst_offset += pass_size;
+		size -= pass_size;
+	} while (size > 0);
+	r600_done_blit_copy(dev);
+
+	return 0;
+}

Modified: stable/8/sys/dev/drm/radeon_cp.c
==============================================================================
--- stable/8/sys/dev/drm/radeon_cp.c	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/radeon_cp.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -408,6 +408,15 @@ static void radeon_init_pipes(drm_radeon
 {
 	uint32_t gb_tile_config, gb_pipe_sel = 0;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) {
+		uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2);
+		if ((z_pipe_sel & 3) == 3)
+			dev_priv->num_z_pipes = 2;
+		else
+			dev_priv->num_z_pipes = 1;
+	} else
+		dev_priv->num_z_pipes = 1;
+
 	/* RS4xx/RS6xx/R4xx/R5xx */
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) {
 		gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT);
@@ -2060,6 +2069,8 @@ int radeon_driver_load(struct drm_device
 	else
 		dev_priv->flags |= RADEON_IS_PCI;
 
+	mtx_init(&dev_priv->cs.cs_mutex, "cs_mtx", NULL, MTX_DEF);
+
 	ret = drm_addmap(dev, drm_get_resource_start(dev, 2),
 			 drm_get_resource_len(dev, 2), _DRM_REGISTERS,
 			 _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);
@@ -2112,6 +2123,8 @@ int radeon_driver_unload(struct drm_devi
 
 	drm_rmmap(dev, dev_priv->mmio);
 
+	mtx_destroy(&dev_priv->cs.cs_mutex);
+
 	drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
 
 	dev->dev_private = NULL;
@@ -2126,9 +2139,9 @@ void radeon_commit_ring(drm_radeon_priva
 
 	/* check if the ring is padded out to 16-dword alignment */
 
-	tail_aligned = dev_priv->ring.tail & 0xf;
+	tail_aligned = dev_priv->ring.tail & (RADEON_RING_ALIGN - 1);
 	if (tail_aligned) {
-		int num_p2 = 16 - tail_aligned;
+		int num_p2 = RADEON_RING_ALIGN - tail_aligned;
 
 		ring = dev_priv->ring.start;
 		/* pad with some CP_PACKET2 */

Copied and modified: stable/8/sys/dev/drm/radeon_cs.c (from r196470, head/sys/dev/drm/radeon_cs.c)
==============================================================================
--- head/sys/dev/drm/radeon_cs.c	Sun Aug 23 14:55:57 2009	(r196470, copy source)
+++ stable/8/sys/dev/drm/radeon_cs.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -403,8 +403,8 @@ static inline int r600_cs_packet3(struct
 			DRM_ERROR("bad DRAW_INDEX\n");
 			break;
 		}
-		ib_chunk->kdata[offset_dw + 1] = (offset & 0xffffffff);
-		ib_chunk->kdata[offset_dw + 2] = (upper_32_bits(offset) & 0xff);
+		ib_chunk->kdata[offset_dw + 1] += (offset & 0xffffffff);
+		ib_chunk->kdata[offset_dw + 2] += (upper_32_bits(offset) & 0xff);
 		break;
 	case R600_IT_DRAW_INDEX_AUTO:
 		//DRM_INFO("R600_IT_DRAW_INDEX_AUTO\n");
@@ -433,8 +433,8 @@ static inline int r600_cs_packet3(struct
 				DRM_ERROR("bad WAIT_REG_MEM\n");
 				break;
 			}
-			ib_chunk->kdata[offset_dw + 2] = (offset & 0xffffffff);
-			ib_chunk->kdata[offset_dw + 3] = (upper_32_bits(offset) & 0xff);
+			ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
+			ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		}
 		if (ret)
 			DRM_ERROR("bad WAIT_REG_MEM\n");
@@ -469,7 +469,7 @@ static inline int r600_cs_packet3(struct
 				break;
 			}
 			ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
-			ib_chunk->kdata[offset_dw + 3] |= (upper_32_bits(offset) & 0xff);
+			ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		}
 		if (ret)
 			DRM_ERROR("bad EVENT_WRITE\n");
@@ -488,7 +488,7 @@ static inline int r600_cs_packet3(struct
 			break;
 		}
 		ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
-		ib_chunk->kdata[offset_dw + 3] |= (upper_32_bits(offset) & 0xff);
+		ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		break;
 	case R600_IT_SET_CONFIG_REG:
 		//DRM_INFO("R600_IT_SET_CONFIG_REG\n");
@@ -628,7 +628,7 @@ static inline int r600_cs_packet3(struct
 					if (ret)
 						break;
 					ib_chunk->kdata[offset_dw + (i * 7) + 0 + 2] += (offset & 0xffffffff);
-					ib_chunk->kdata[offset_dw + (i * 7) + 2 + 2] |= (upper_32_bits(offset) & 0xff);
+					ib_chunk->kdata[offset_dw + (i * 7) + 2 + 2] += (upper_32_bits(offset) & 0xff);
 					break;
 				}
 				if (ret)

Modified: stable/8/sys/dev/drm/radeon_drm.h
==============================================================================
--- stable/8/sys/dev/drm/radeon_drm.h	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/radeon_drm.h	Fri Oct 30 16:32:35 2009	(r198685)
@@ -497,6 +497,8 @@ typedef struct {
 #define DRM_RADEON_SURF_ALLOC 0x1a
 #define DRM_RADEON_SURF_FREE  0x1b
 
+#define DRM_RADEON_CS         0x26
+
 #define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
 #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_START)
 #define DRM_IOCTL_RADEON_CP_STOP    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
@@ -524,6 +526,7 @@ typedef struct {
 #define DRM_IOCTL_RADEON_SETPARAM   DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
 #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
 #define DRM_IOCTL_RADEON_SURF_FREE  DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
+#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
 
 typedef struct drm_radeon_init {
 	enum {
@@ -685,6 +688,8 @@ typedef struct drm_radeon_indirect {
 #define RADEON_PARAM_VBLANK_CRTC           13   /* VBLANK CRTC */
 #define RADEON_PARAM_FB_LOCATION           14   /* FB location */
 #define RADEON_PARAM_NUM_GB_PIPES          15   /* num GB pipes */
+#define RADEON_PARAM_DEVICE_ID             16
+#define RADEON_PARAM_NUM_Z_PIPES           17   /* num Z pipes */
 
 typedef struct drm_radeon_getparam {
 	int param;
@@ -755,4 +760,23 @@ typedef struct drm_radeon_surface_free {
 #define	DRM_RADEON_VBLANK_CRTC1		1
 #define	DRM_RADEON_VBLANK_CRTC2		2
 
+/* New interface which obsolete all previous interface.
+ */
+#define RADEON_CHUNK_ID_RELOCS 0x01
+#define RADEON_CHUNK_ID_IB     0x02
+#define RADEON_CHUNK_ID_OLD 0xff
+
+struct drm_radeon_cs_chunk {
+	uint32_t chunk_id;
+	uint32_t length_dw;
+	uint64_t chunk_data;
+};
+
+struct drm_radeon_cs {
+	uint32_t        num_chunks;
+	uint32_t        cs_id;
+	uint64_t        chunks; /* this points to uint64_t * which point to
+				   cs chunks */
+};
+
 #endif

Modified: stable/8/sys/dev/drm/radeon_drv.h
==============================================================================
--- stable/8/sys/dev/drm/radeon_drv.h	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/radeon_drv.h	Fri Oct 30 16:32:35 2009	(r198685)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 
 #define DRIVER_NAME		"radeon"
 #define DRIVER_DESC		"ATI Radeon"
-#define DRIVER_DATE		"20080528"
+#define DRIVER_DATE		"20080613"
 
 /* Interface history:
  *
@@ -102,9 +102,11 @@ __FBSDID("$FreeBSD$");
  * 1.27- Add support for IGP GART
  * 1.28- Add support for VBL on CRTC2
  * 1.29- R500 3D cmd buffer support
+ * 1.30- Add support for occlusion queries
+ * 1.31- Add support for num Z pipes from GET_PARAM
  */
 #define DRIVER_MAJOR		1
-#define DRIVER_MINOR		29
+#define DRIVER_MINOR		31
 #define DRIVER_PATCHLEVEL	0
 
 /*
@@ -141,15 +143,15 @@ enum radeon_family {
 	CHIP_R600,
 	CHIP_RV610,
 	CHIP_RV630,
+	CHIP_RV670,
 	CHIP_RV620,
 	CHIP_RV635,
-	CHIP_RV670,
 	CHIP_RS780,
 	CHIP_RS880,
 	CHIP_RV770,
-	CHIP_RV740,
 	CHIP_RV730,
 	CHIP_RV710,
+	CHIP_RV740,
 	CHIP_LAST,
 };
 
@@ -236,6 +238,46 @@ struct radeon_virt_surface {
 #define PCIGART_FILE_PRIV	((void *) -1L)
 };
 
+struct drm_radeon_kernel_chunk {
+	uint32_t chunk_id;
+	uint32_t length_dw;
+	uint32_t __user *chunk_data;
+	uint32_t *kdata;
+};
+
+struct drm_radeon_cs_parser {
+	struct drm_device *dev;
+	struct drm_file *file_priv;
+	uint32_t num_chunks;
+	struct drm_radeon_kernel_chunk *chunks;
+	int ib_index;
+	int reloc_index;
+	uint32_t card_offset;
+	void *ib;
+};
+
+/* command submission struct */
+struct drm_radeon_cs_priv {
+	struct mtx cs_mutex;
+	uint32_t id_wcnt;
+	uint32_t id_scnt;
+	uint32_t id_last_wcnt;
+	uint32_t id_last_scnt;
+
+	int (*parse)(struct drm_radeon_cs_parser *parser);
+	void (*id_emit)(struct drm_radeon_cs_parser *parser, uint32_t *id);
+	uint32_t (*id_last_get)(struct drm_device *dev);
+	/* this ib handling callback are for hidding memory manager drm
+	 * from memory manager less drm, free have to emit ib discard
+	 * sequence into the ring */
+	int (*ib_get)(struct drm_radeon_cs_parser *parser);
+	uint32_t (*ib_get_ptr)(struct drm_device *dev, void *ib);
+	void (*ib_free)(struct drm_radeon_cs_parser *parser, int error);
+	/* do a relocation either MM or non-MM */
+	int (*relocate)(struct drm_radeon_cs_parser *parser,
+			uint32_t *reloc, uint64_t *offset);
+};
+
 #define RADEON_FLUSH_EMITED	(1 << 0)
 #define RADEON_PURGE_EMITED	(1 << 1)
 
@@ -328,6 +370,7 @@ typedef struct drm_radeon_private {
 	unsigned long fb_aper_offset;
 
 	int num_gb_pipes;
+	int num_z_pipes;
 	int track_flush;
 	drm_local_map_t *mmio;
 
@@ -349,6 +392,12 @@ typedef struct drm_radeon_private {
 	int r700_sc_prim_fifo_size;
 	int r700_sc_hiz_tile_fifo_size;
 	int r700_sc_earlyz_tile_fifo_fize;
+	/* r6xx/r7xx drm blit vertex buffer */
+	struct drm_buf *blit_vb;
+
+	/* CS */
+	struct drm_radeon_cs_priv cs;
+	struct drm_buf *cs_buf;
 
 } drm_radeon_private_t;
 
@@ -379,10 +428,10 @@ extern void radeon_set_ring_head(drm_rad
 static __inline__ int radeon_check_offset(drm_radeon_private_t *dev_priv,
 					  u64 off)
 {
-	u32 fb_start = dev_priv->fb_location;
-	u32 fb_end = fb_start + dev_priv->fb_size - 1;
-	u32 gart_start = dev_priv->gart_vm_start;
-	u32 gart_end = gart_start + dev_priv->gart_size - 1;
+	u64 fb_start = dev_priv->fb_location;
+	u64 fb_end = fb_start + dev_priv->fb_size - 1;
+	u64 gart_start = dev_priv->gart_vm_start;
+	u64 gart_end = gart_start + dev_priv->gart_size - 1;
 
 	return ((off >= fb_start && off <= fb_end) ||
 		(off >= gart_start && off <= gart_end));
@@ -476,6 +525,33 @@ extern int r600_cp_dispatch_indirect(str
 				     struct drm_buf *buf, int start, int end);
 extern int r600_page_table_init(struct drm_device *dev);
 extern void r600_page_table_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info);
+extern void r600_cp_dispatch_swap(struct drm_device * dev);
+extern int r600_cp_dispatch_texture(struct drm_device * dev,
+				    struct drm_file *file_priv,
+				    drm_radeon_texture_t * tex,
+				    drm_radeon_tex_image_t * image);
+
+/* r600_blit.c */
+extern int
+r600_prepare_blit_copy(struct drm_device *dev);
+extern void
+r600_done_blit_copy(struct drm_device *dev);
+extern void
+r600_blit_copy(struct drm_device *dev,
+	       uint64_t src_gpu_addr, uint64_t dst_gpu_addr,
+	       int size_bytes);
+extern void
+r600_blit_swap(struct drm_device *dev,
+	       uint64_t src_gpu_addr, uint64_t dst_gpu_addr,
+	       int sx, int sy, int dx, int dy,
+	       int w, int h, int src_pitch, int dst_pitch, int cpp);
+
+/* radeon_state.c */
+extern void radeon_cp_discard_buffer(struct drm_device * dev, struct drm_buf * buf);
+
+/* radeon_cs.c */
+extern int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *fpriv);
+extern int r600_cs_init(struct drm_device *dev);
 
 /* Flags for stats.boxes
  */
@@ -685,6 +761,7 @@ extern void r600_page_table_cleanup(stru
 
 /* pipe config regs */
 #define R400_GB_PIPE_SELECT             0x402c
+#define RV530_GB_PIPE_SELECT2           0x4124
 #define R500_DYN_SCLK_PWMEM_PIPE        0x000d /* PLL */
 #define R300_GB_TILE_CONFIG             0x4018
 #       define R300_ENABLE_TILING       (1 << 0)
@@ -1827,26 +1904,38 @@ do {									\
  */
 
 #define RADEON_WAIT_UNTIL_2D_IDLE() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_2D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_3D_IDLE() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_3D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_IDLE() do {					\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_2D_IDLECLEAN |				\
 		   RADEON_WAIT_3D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( RADEON_WAIT_CRTC_PFLIP );				\
 } while (0)
 
@@ -1961,14 +2050,17 @@ do {								\
 
 #define RING_LOCALS	int write, _nr, _align_nr; unsigned int mask; u32 *ring;
 
+#define RADEON_RING_ALIGN 16
+
 #define BEGIN_RING( n ) do {						\
 	if ( RADEON_VERBOSE ) {						\
 		DRM_INFO( "BEGIN_RING( %d )\n", (n));			\
 	}								\
-	_align_nr = (n + 0xf) & ~0xf;					\
-	if (dev_priv->ring.space <= (_align_nr * sizeof(u32))) {	\
-                COMMIT_RING();						\
-		radeon_wait_ring( dev_priv, _align_nr * sizeof(u32));	\
+	_align_nr = RADEON_RING_ALIGN - ((dev_priv->ring.tail + n) & (RADEON_RING_ALIGN - 1)); \
+	_align_nr += n;							\
+	if ( dev_priv->ring.space <= (_align_nr) * sizeof(u32) ) {	\
+		COMMIT_RING();						\
+		radeon_wait_ring( dev_priv, (_align_nr) * sizeof(u32) ); \
 	}								\
 	_nr = n; dev_priv->ring.space -= (n) * sizeof(u32);		\
 	ring = dev_priv->ring.start;					\

Modified: stable/8/sys/dev/drm/radeon_irq.c
==============================================================================
--- stable/8/sys/dev/drm/radeon_irq.c	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/radeon_irq.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -194,6 +194,9 @@ irqreturn_t radeon_driver_irq_handler(DR
 	u32 r500_disp_int;
 	u32 tmp;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return IRQ_NONE;
+
 	/* Only consider the bits we're interested in - others could be used
 	 * outside the DRM
 	 */
@@ -323,6 +326,9 @@ int radeon_irq_emit(struct drm_device *d
 	drm_radeon_irq_emit_t *emit = data;
 	int result;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return -EINVAL;
+
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 
 	if (!dev_priv) {
@@ -363,6 +369,9 @@ void radeon_driver_irq_preinstall(struct
 	    (drm_radeon_private_t *) dev->dev_private;
 	u32 dummy;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return;
+
 	/* Disable *all* interrupts */
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
 		RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
@@ -380,6 +389,9 @@ int radeon_driver_irq_postinstall(struct
 	atomic_set(&dev_priv->swi_emitted, 0);
 	DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return 0;
+
 	radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
 
 	return 0;
@@ -394,6 +406,9 @@ void radeon_driver_irq_uninstall(struct 
 
 	dev_priv->irq_enabled = 0;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return;
+
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
 		RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
 	/* Disable *all* interrupts */

Modified: stable/8/sys/dev/drm/radeon_state.c
==============================================================================
--- stable/8/sys/dev/drm/radeon_state.c	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/dev/drm/radeon_state.c	Fri Oct 30 16:32:35 2009	(r198685)
@@ -1541,7 +1541,7 @@ static void radeon_cp_dispatch_vertex(st
 	} while (i < nbox);
 }
 
-static void radeon_cp_discard_buffer(struct drm_device *dev, struct drm_buf *buf)
+void radeon_cp_discard_buffer(struct drm_device *dev, struct drm_buf *buf)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
@@ -2202,7 +2202,10 @@ static int radeon_cp_swap(struct drm_dev
 	if (sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS)
 		sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS;
 
-	radeon_cp_dispatch_swap(dev);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		r600_cp_dispatch_swap(dev);
+	else
+		radeon_cp_dispatch_swap(dev);
 	sarea_priv->ctx_owner = 0;
 
 	COMMIT_RING();
@@ -2399,7 +2402,10 @@ static int radeon_cp_texture(struct drm_
 	RING_SPACE_TEST_WITH_RETURN(dev_priv);
 	VB_AGE_TEST_WITH_RETURN(dev_priv);
 
-	ret = radeon_cp_dispatch_texture(dev, file_priv, tex, &image);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		ret = r600_cp_dispatch_texture(dev, file_priv, tex, &image);
+	else
+		ret = radeon_cp_dispatch_texture(dev, file_priv, tex, &image);
 
 	return ret;
 }
@@ -3018,7 +3024,10 @@ static int radeon_cp_getparam(struct drm
 		value = GET_SCRATCH(dev_priv, 2);
 		break;
 	case RADEON_PARAM_IRQ_NR:
-		value = dev->irq;
+		if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+			value = 0;
+		else
+			value = dev->irq;
 		break;
 	case RADEON_PARAM_GART_BASE:
 		value = dev_priv->gart_vm_start;
@@ -3072,6 +3081,9 @@ static int radeon_cp_getparam(struct drm
 	case RADEON_PARAM_NUM_GB_PIPES:
 		value = dev_priv->num_gb_pipes;
 		break;
+	case RADEON_PARAM_NUM_Z_PIPES:
+		value = dev_priv->num_z_pipes;
+		break;
 	default:
 		DRM_DEBUG("Invalid parameter %d\n", param->param);
 		return -EINVAL;
@@ -3156,6 +3168,14 @@ void radeon_driver_preclose(struct drm_d
 void radeon_driver_lastclose(struct drm_device *dev)
 {
 	radeon_surfaces_release(PCIGART_FILE_PRIV, dev->dev_private);
+	if (dev->dev_private) {
+		drm_radeon_private_t *dev_priv = dev->dev_private;
+
+		if (dev_priv->sarea_priv &&
+		    dev_priv->sarea_priv->pfCurrentPage != 0)
+			radeon_cp_dispatch_flip(dev);
+	}
+
 	radeon_do_release(dev);
 }
 
@@ -3216,7 +3236,8 @@ struct drm_ioctl_desc radeon_ioctls[] = 
 	DRM_IOCTL_DEF(DRM_RADEON_IRQ_WAIT, radeon_irq_wait, DRM_AUTH),
 	DRM_IOCTL_DEF(DRM_RADEON_SETPARAM, radeon_cp_setparam, DRM_AUTH),
 	DRM_IOCTL_DEF(DRM_RADEON_SURF_ALLOC, radeon_surface_alloc, DRM_AUTH),
-	DRM_IOCTL_DEF(DRM_RADEON_SURF_FREE, radeon_surface_free, DRM_AUTH)
+	DRM_IOCTL_DEF(DRM_RADEON_SURF_FREE, radeon_surface_free, DRM_AUTH),
+	DRM_IOCTL_DEF(DRM_RADEON_CS, radeon_cs_ioctl, DRM_AUTH)
 };
 
 int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls);

Modified: stable/8/sys/modules/drm/radeon/Makefile
==============================================================================
--- stable/8/sys/modules/drm/radeon/Makefile	Fri Oct 30 16:23:56 2009	(r198684)
+++ stable/8/sys/modules/drm/radeon/Makefile	Fri Oct 30 16:32:35 2009	(r198685)
@@ -2,8 +2,8 @@
 
 .PATH:	${.CURDIR}/../../../dev/drm
 KMOD	= radeon
-SRCS	= r300_cmdbuf.c r600_cp.c radeon_cp.c radeon_drv.c radeon_irq.c \
-	radeon_mem.c radeon_state.c
+SRCS	= r300_cmdbuf.c r600_blit.c r600_cp.c radeon_cp.c radeon_cs.c \
+	radeon_drv.c radeon_irq.c radeon_mem.c radeon_state.c
 SRCS	+=device_if.h bus_if.h pci_if.h opt_drm.h
 
 .include 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:35:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 153781065679;
	Fri, 30 Oct 2009 16:35:48 +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 017328FC15;
	Fri, 30 Oct 2009 16:35: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 n9UGZlGm051380;
	Fri, 30 Oct 2009 16:35:47 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGZlB7051367;
	Fri, 30 Oct 2009 16:35:47 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301635.n9UGZlB7051367@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:35:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198686 - in stable/7/sys: . conf contrib/pf dev/drm
	modules/drm/radeon
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:35:48 -0000

Author: rnoland
Date: Fri Oct 30 16:35:47 2009
New Revision: 198686
URL: http://svn.freebsd.org/changeset/base/198686

Log:
  MFC r196470-196471,197154-197155,197603-197606
  
  Sync radeon drm support
  
  This adds kernel support for r6/7xx 3D.

Added:
  stable/7/sys/dev/drm/r600_blit.c
     - copied, changed from r196470, head/sys/dev/drm/r600_blit.c
  stable/7/sys/dev/drm/radeon_cs.c
     - copied, changed from r196470, head/sys/dev/drm/radeon_cs.c
Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/files
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/drm/drm_pciids.h
  stable/7/sys/dev/drm/r600_cp.c
  stable/7/sys/dev/drm/radeon_cp.c
  stable/7/sys/dev/drm/radeon_drm.h
  stable/7/sys/dev/drm/radeon_drv.h
  stable/7/sys/dev/drm/radeon_irq.c
  stable/7/sys/dev/drm/radeon_state.c
  stable/7/sys/modules/drm/radeon/Makefile

Modified: stable/7/sys/conf/files
==============================================================================
--- stable/7/sys/conf/files	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/conf/files	Fri Oct 30 16:35:47 2009	(r198686)
@@ -757,8 +757,10 @@ dev/drm/r128_irq.c		optional r128drm
 dev/drm/r128_state.c		optional r128drm \
 	compile-with "${NORMAL_C} -finline-limit=13500"
 dev/drm/r300_cmdbuf.c		optional radeondrm
+dev/drm/r600_blit.c		optional radeondrm
 dev/drm/r600_cp.c		optional radeondrm
 dev/drm/radeon_cp.c		optional radeondrm
+dev/drm/radeon_cs.c		optional radeondrm
 dev/drm/radeon_drv.c		optional radeondrm
 dev/drm/radeon_irq.c		optional radeondrm
 dev/drm/radeon_mem.c		optional radeondrm

Modified: stable/7/sys/dev/drm/drm_pciids.h
==============================================================================
--- stable/7/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:35:47 2009	(r198686)
@@ -338,6 +338,7 @@
 	{0x1002, 0x9440, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
 	{0x1002, 0x9441, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4870 X2"}, \
 	{0x1002, 0x9442, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
+	{0x1002, 0x9443, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4850 X2"}, \
 	{0x1002, 0x944C, CHIP_RV770|RADEON_NEW_MEMMAP, "ATI Radeon 4800 Series"}, \
 	{0x1002, 0x9450, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9270"}, \
 	{0x1002, 0x9452, CHIP_RV770|RADEON_NEW_MEMMAP, "AMD FireStream 9250"}, \

Copied and modified: stable/7/sys/dev/drm/r600_blit.c (from r196470, head/sys/dev/drm/r600_blit.c)
==============================================================================
--- head/sys/dev/drm/r600_blit.c	Sun Aug 23 14:55:57 2009	(r196470, copy source)
+++ stable/7/sys/dev/drm/r600_blit.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -1734,6 +1734,8 @@ r600_blit_copy(struct drm_device *dev,
 
 			if (!src_x && !dst_x) {
 				h = (cur_size / max_bytes);
+				if (h > 8192)
+					h = 8192;
 				if (h == 0)
 					h = 1;
 				else
@@ -1805,8 +1807,8 @@ r600_blit_copy(struct drm_device *dev,
 			vb += 12;
 			dev_priv->blit_vb->used += 12 * 4;
 
-			src_gpu_addr += cur_size;
-			dst_gpu_addr += cur_size;
+			src_gpu_addr += cur_size * h;
+			dst_gpu_addr += cur_size * h;
 			size_bytes -= cur_size * h;
 		}
 	} else {
@@ -1822,6 +1824,8 @@ r600_blit_copy(struct drm_device *dev,
 
 			if (!src_x && !dst_x) {
 				h = (cur_size / max_bytes);
+				if (h > 8192)
+					h = 8192;
 				if (h == 0)
 					h = 1;
 				else
@@ -1872,7 +1876,7 @@ r600_blit_copy(struct drm_device *dev,
 
 			/* dst */
 			set_render_target(dev_priv, COLOR_8_8_8_8,
-					  dst_x + cur_size, h,
+					  (dst_x + cur_size) / 4, h,
 					  dst_gpu_addr);
 
 			/* scissors */
@@ -1894,8 +1898,8 @@ r600_blit_copy(struct drm_device *dev,
 			vb += 12;
 			dev_priv->blit_vb->used += 12 * 4;
 
-			src_gpu_addr += cur_size;
-			dst_gpu_addr += cur_size;
+			src_gpu_addr += cur_size * h;
+			dst_gpu_addr += cur_size * h;
 			size_bytes -= cur_size * h;
 		}
 	}

Modified: stable/7/sys/dev/drm/r600_cp.c
==============================================================================
--- stable/7/sys/dev/drm/r600_cp.c	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/r600_cp.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -1843,6 +1843,7 @@ int r600_do_init_cp(struct drm_device *d
 	 */
 	dev_priv->vblank_crtc = DRM_RADEON_VBLANK_CRTC1;
 
+	dev_priv->do_boxes = 0;
 	dev_priv->cp_mode = init->cp_mode;
 
 	/* We don't support anything other than bus-mastering ring mode,
@@ -2100,6 +2101,8 @@ int r600_do_init_cp(struct drm_device *d
 	r600_do_engine_reset(dev);
 	r600_test_writeback(dev_priv);
 
+	r600_cs_init(dev);
+
 	return 0;
 }
 
@@ -2232,3 +2235,135 @@ int r600_cp_dispatch_indirect(struct drm
 
 	return 0;
 }
+
+void r600_cp_dispatch_swap(struct drm_device * dev)
+{
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
+	int nbox = sarea_priv->nbox;
+	struct drm_clip_rect *pbox = sarea_priv->boxes;
+	int i, cpp, src_pitch, dst_pitch;
+	uint64_t src, dst;
+	RING_LOCALS;
+	DRM_DEBUG("\n");
+
+	if (dev_priv->color_fmt == RADEON_COLOR_FORMAT_ARGB8888)
+		cpp = 4;
+	else
+		cpp = 2;
+
+	if (dev_priv->sarea_priv->pfCurrentPage == 0) {
+		src_pitch = dev_priv->back_pitch;
+		dst_pitch = dev_priv->front_pitch;
+		src = dev_priv->back_offset + dev_priv->fb_location;
+		dst = dev_priv->front_offset + dev_priv->fb_location;
+	} else {
+		src_pitch = dev_priv->front_pitch;
+		dst_pitch = dev_priv->back_pitch;
+		src = dev_priv->front_offset + dev_priv->fb_location;
+		dst = dev_priv->back_offset + dev_priv->fb_location;
+	}
+
+	if (r600_prepare_blit_copy(dev)) {
+		DRM_ERROR("unable to allocate vertex buffer for swap buffer\n");
+		return;
+	}
+	for (i = 0; i < nbox; i++) {
+		int x = pbox[i].x1;
+		int y = pbox[i].y1;
+		int w = pbox[i].x2 - x;
+		int h = pbox[i].y2 - y;
+
+		DRM_DEBUG("%d,%d-%d,%d\n", x, y, w, h);
+
+		r600_blit_swap(dev,
+			       src, dst,
+			       x, y, x, y, w, h,
+			       src_pitch, dst_pitch, cpp);
+	}
+	r600_done_blit_copy(dev);
+
+	/* Increment the frame counter.  The client-side 3D driver must
+	 * throttle the framerate by waiting for this value before
+	 * performing the swapbuffer ioctl.
+	 */
+	dev_priv->sarea_priv->last_frame++;
+
+	BEGIN_RING(3);
+	R600_FRAME_AGE(dev_priv->sarea_priv->last_frame);
+	ADVANCE_RING();
+}
+
+int r600_cp_dispatch_texture(struct drm_device * dev,
+			     struct drm_file *file_priv,
+			     drm_radeon_texture_t * tex,
+			     drm_radeon_tex_image_t * image)
+{
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	struct drm_buf *buf;
+	u32 *buffer;
+	const u8 __user *data;
+	int size, pass_size;
+	u64 src_offset, dst_offset;
+
+	if (!radeon_check_offset(dev_priv, tex->offset)) {
+		DRM_ERROR("Invalid destination offset\n");
+		return -EINVAL;
+	}
+
+	/* this might fail for zero-sized uploads - are those illegal? */
+	if (!radeon_check_offset(dev_priv, tex->offset + tex->height * tex->pitch - 1)) {
+		DRM_ERROR("Invalid final destination offset\n");
+		return -EINVAL;
+	}
+
+	size = tex->height * tex->pitch;
+
+	if (size == 0)
+		return 0;
+
+	dst_offset = tex->offset;
+
+	r600_prepare_blit_copy(dev);
+	do {
+		data = (const u8 __user *)image->data;
+		pass_size = size;
+
+		buf = radeon_freelist_get(dev);
+		if (!buf) {
+			DRM_DEBUG("EAGAIN\n");
+			if (DRM_COPY_TO_USER(tex->image, image, sizeof(*image)))
+				return -EFAULT;
+			return -EAGAIN;
+		}
+
+		if (pass_size > buf->total)
+			pass_size = buf->total;
+
+		/* Dispatch the indirect buffer.
+		 */
+		buffer =
+		    (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset);
+
+		if (DRM_COPY_FROM_USER(buffer, data, pass_size)) {
+			DRM_ERROR("EFAULT on pad, %d bytes\n", pass_size);
+			return -EFAULT;
+		}
+
+		buf->file_priv = file_priv;
+		buf->used = pass_size;
+		src_offset = dev_priv->gart_buffers_offset + buf->offset;
+
+		r600_blit_copy(dev, src_offset, dst_offset, pass_size);
+
+		radeon_cp_discard_buffer(dev, buf);
+
+		/* Update the input parameters for next time */
+		image->data = (const u8 __user *)image->data + pass_size;
+		dst_offset += pass_size;
+		size -= pass_size;
+	} while (size > 0);
+	r600_done_blit_copy(dev);
+
+	return 0;
+}

Modified: stable/7/sys/dev/drm/radeon_cp.c
==============================================================================
--- stable/7/sys/dev/drm/radeon_cp.c	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/radeon_cp.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -408,6 +408,15 @@ static void radeon_init_pipes(drm_radeon
 {
 	uint32_t gb_tile_config, gb_pipe_sel = 0;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) {
+		uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2);
+		if ((z_pipe_sel & 3) == 3)
+			dev_priv->num_z_pipes = 2;
+		else
+			dev_priv->num_z_pipes = 1;
+	} else
+		dev_priv->num_z_pipes = 1;
+
 	/* RS4xx/RS6xx/R4xx/R5xx */
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) {
 		gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT);
@@ -2060,6 +2069,8 @@ int radeon_driver_load(struct drm_device
 	else
 		dev_priv->flags |= RADEON_IS_PCI;
 
+	mtx_init(&dev_priv->cs.cs_mutex, "cs_mtx", NULL, MTX_DEF);
+
 	ret = drm_addmap(dev, drm_get_resource_start(dev, 2),
 			 drm_get_resource_len(dev, 2), _DRM_REGISTERS,
 			 _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio);
@@ -2112,6 +2123,8 @@ int radeon_driver_unload(struct drm_devi
 
 	drm_rmmap(dev, dev_priv->mmio);
 
+	mtx_destroy(&dev_priv->cs.cs_mutex);
+
 	drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
 
 	dev->dev_private = NULL;
@@ -2126,9 +2139,9 @@ void radeon_commit_ring(drm_radeon_priva
 
 	/* check if the ring is padded out to 16-dword alignment */
 
-	tail_aligned = dev_priv->ring.tail & 0xf;
+	tail_aligned = dev_priv->ring.tail & (RADEON_RING_ALIGN - 1);
 	if (tail_aligned) {
-		int num_p2 = 16 - tail_aligned;
+		int num_p2 = RADEON_RING_ALIGN - tail_aligned;
 
 		ring = dev_priv->ring.start;
 		/* pad with some CP_PACKET2 */

Copied and modified: stable/7/sys/dev/drm/radeon_cs.c (from r196470, head/sys/dev/drm/radeon_cs.c)
==============================================================================
--- head/sys/dev/drm/radeon_cs.c	Sun Aug 23 14:55:57 2009	(r196470, copy source)
+++ stable/7/sys/dev/drm/radeon_cs.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -403,8 +403,8 @@ static inline int r600_cs_packet3(struct
 			DRM_ERROR("bad DRAW_INDEX\n");
 			break;
 		}
-		ib_chunk->kdata[offset_dw + 1] = (offset & 0xffffffff);
-		ib_chunk->kdata[offset_dw + 2] = (upper_32_bits(offset) & 0xff);
+		ib_chunk->kdata[offset_dw + 1] += (offset & 0xffffffff);
+		ib_chunk->kdata[offset_dw + 2] += (upper_32_bits(offset) & 0xff);
 		break;
 	case R600_IT_DRAW_INDEX_AUTO:
 		//DRM_INFO("R600_IT_DRAW_INDEX_AUTO\n");
@@ -433,8 +433,8 @@ static inline int r600_cs_packet3(struct
 				DRM_ERROR("bad WAIT_REG_MEM\n");
 				break;
 			}
-			ib_chunk->kdata[offset_dw + 2] = (offset & 0xffffffff);
-			ib_chunk->kdata[offset_dw + 3] = (upper_32_bits(offset) & 0xff);
+			ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
+			ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		}
 		if (ret)
 			DRM_ERROR("bad WAIT_REG_MEM\n");
@@ -469,7 +469,7 @@ static inline int r600_cs_packet3(struct
 				break;
 			}
 			ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
-			ib_chunk->kdata[offset_dw + 3] |= (upper_32_bits(offset) & 0xff);
+			ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		}
 		if (ret)
 			DRM_ERROR("bad EVENT_WRITE\n");
@@ -488,7 +488,7 @@ static inline int r600_cs_packet3(struct
 			break;
 		}
 		ib_chunk->kdata[offset_dw + 2] += (offset & 0xffffffff);
-		ib_chunk->kdata[offset_dw + 3] |= (upper_32_bits(offset) & 0xff);
+		ib_chunk->kdata[offset_dw + 3] += (upper_32_bits(offset) & 0xff);
 		break;
 	case R600_IT_SET_CONFIG_REG:
 		//DRM_INFO("R600_IT_SET_CONFIG_REG\n");
@@ -628,7 +628,7 @@ static inline int r600_cs_packet3(struct
 					if (ret)
 						break;
 					ib_chunk->kdata[offset_dw + (i * 7) + 0 + 2] += (offset & 0xffffffff);
-					ib_chunk->kdata[offset_dw + (i * 7) + 2 + 2] |= (upper_32_bits(offset) & 0xff);
+					ib_chunk->kdata[offset_dw + (i * 7) + 2 + 2] += (upper_32_bits(offset) & 0xff);
 					break;
 				}
 				if (ret)

Modified: stable/7/sys/dev/drm/radeon_drm.h
==============================================================================
--- stable/7/sys/dev/drm/radeon_drm.h	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/radeon_drm.h	Fri Oct 30 16:35:47 2009	(r198686)
@@ -497,6 +497,8 @@ typedef struct {
 #define DRM_RADEON_SURF_ALLOC 0x1a
 #define DRM_RADEON_SURF_FREE  0x1b
 
+#define DRM_RADEON_CS         0x26
+
 #define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
 #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_START)
 #define DRM_IOCTL_RADEON_CP_STOP    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
@@ -524,6 +526,7 @@ typedef struct {
 #define DRM_IOCTL_RADEON_SETPARAM   DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
 #define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
 #define DRM_IOCTL_RADEON_SURF_FREE  DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
+#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
 
 typedef struct drm_radeon_init {
 	enum {
@@ -685,6 +688,8 @@ typedef struct drm_radeon_indirect {
 #define RADEON_PARAM_VBLANK_CRTC           13   /* VBLANK CRTC */
 #define RADEON_PARAM_FB_LOCATION           14   /* FB location */
 #define RADEON_PARAM_NUM_GB_PIPES          15   /* num GB pipes */
+#define RADEON_PARAM_DEVICE_ID             16
+#define RADEON_PARAM_NUM_Z_PIPES           17   /* num Z pipes */
 
 typedef struct drm_radeon_getparam {
 	int param;
@@ -755,4 +760,23 @@ typedef struct drm_radeon_surface_free {
 #define	DRM_RADEON_VBLANK_CRTC1		1
 #define	DRM_RADEON_VBLANK_CRTC2		2
 
+/* New interface which obsolete all previous interface.
+ */
+#define RADEON_CHUNK_ID_RELOCS 0x01
+#define RADEON_CHUNK_ID_IB     0x02
+#define RADEON_CHUNK_ID_OLD 0xff
+
+struct drm_radeon_cs_chunk {
+	uint32_t chunk_id;
+	uint32_t length_dw;
+	uint64_t chunk_data;
+};
+
+struct drm_radeon_cs {
+	uint32_t        num_chunks;
+	uint32_t        cs_id;
+	uint64_t        chunks; /* this points to uint64_t * which point to
+				   cs chunks */
+};
+
 #endif

Modified: stable/7/sys/dev/drm/radeon_drv.h
==============================================================================
--- stable/7/sys/dev/drm/radeon_drv.h	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/radeon_drv.h	Fri Oct 30 16:35:47 2009	(r198686)
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
 
 #define DRIVER_NAME		"radeon"
 #define DRIVER_DESC		"ATI Radeon"
-#define DRIVER_DATE		"20080528"
+#define DRIVER_DATE		"20080613"
 
 /* Interface history:
  *
@@ -102,9 +102,11 @@ __FBSDID("$FreeBSD$");
  * 1.27- Add support for IGP GART
  * 1.28- Add support for VBL on CRTC2
  * 1.29- R500 3D cmd buffer support
+ * 1.30- Add support for occlusion queries
+ * 1.31- Add support for num Z pipes from GET_PARAM
  */
 #define DRIVER_MAJOR		1
-#define DRIVER_MINOR		29
+#define DRIVER_MINOR		31
 #define DRIVER_PATCHLEVEL	0
 
 /*
@@ -141,15 +143,15 @@ enum radeon_family {
 	CHIP_R600,
 	CHIP_RV610,
 	CHIP_RV630,
+	CHIP_RV670,
 	CHIP_RV620,
 	CHIP_RV635,
-	CHIP_RV670,
 	CHIP_RS780,
 	CHIP_RS880,
 	CHIP_RV770,
-	CHIP_RV740,
 	CHIP_RV730,
 	CHIP_RV710,
+	CHIP_RV740,
 	CHIP_LAST,
 };
 
@@ -236,6 +238,46 @@ struct radeon_virt_surface {
 #define PCIGART_FILE_PRIV	((void *) -1L)
 };
 
+struct drm_radeon_kernel_chunk {
+	uint32_t chunk_id;
+	uint32_t length_dw;
+	uint32_t __user *chunk_data;
+	uint32_t *kdata;
+};
+
+struct drm_radeon_cs_parser {
+	struct drm_device *dev;
+	struct drm_file *file_priv;
+	uint32_t num_chunks;
+	struct drm_radeon_kernel_chunk *chunks;
+	int ib_index;
+	int reloc_index;
+	uint32_t card_offset;
+	void *ib;
+};
+
+/* command submission struct */
+struct drm_radeon_cs_priv {
+	struct mtx cs_mutex;
+	uint32_t id_wcnt;
+	uint32_t id_scnt;
+	uint32_t id_last_wcnt;
+	uint32_t id_last_scnt;
+
+	int (*parse)(struct drm_radeon_cs_parser *parser);
+	void (*id_emit)(struct drm_radeon_cs_parser *parser, uint32_t *id);
+	uint32_t (*id_last_get)(struct drm_device *dev);
+	/* this ib handling callback are for hidding memory manager drm
+	 * from memory manager less drm, free have to emit ib discard
+	 * sequence into the ring */
+	int (*ib_get)(struct drm_radeon_cs_parser *parser);
+	uint32_t (*ib_get_ptr)(struct drm_device *dev, void *ib);
+	void (*ib_free)(struct drm_radeon_cs_parser *parser, int error);
+	/* do a relocation either MM or non-MM */
+	int (*relocate)(struct drm_radeon_cs_parser *parser,
+			uint32_t *reloc, uint64_t *offset);
+};
+
 #define RADEON_FLUSH_EMITED	(1 << 0)
 #define RADEON_PURGE_EMITED	(1 << 1)
 
@@ -328,6 +370,7 @@ typedef struct drm_radeon_private {
 	unsigned long fb_aper_offset;
 
 	int num_gb_pipes;
+	int num_z_pipes;
 	int track_flush;
 	drm_local_map_t *mmio;
 
@@ -349,6 +392,12 @@ typedef struct drm_radeon_private {
 	int r700_sc_prim_fifo_size;
 	int r700_sc_hiz_tile_fifo_size;
 	int r700_sc_earlyz_tile_fifo_fize;
+	/* r6xx/r7xx drm blit vertex buffer */
+	struct drm_buf *blit_vb;
+
+	/* CS */
+	struct drm_radeon_cs_priv cs;
+	struct drm_buf *cs_buf;
 
 } drm_radeon_private_t;
 
@@ -379,10 +428,10 @@ extern void radeon_set_ring_head(drm_rad
 static __inline__ int radeon_check_offset(drm_radeon_private_t *dev_priv,
 					  u64 off)
 {
-	u32 fb_start = dev_priv->fb_location;
-	u32 fb_end = fb_start + dev_priv->fb_size - 1;
-	u32 gart_start = dev_priv->gart_vm_start;
-	u32 gart_end = gart_start + dev_priv->gart_size - 1;
+	u64 fb_start = dev_priv->fb_location;
+	u64 fb_end = fb_start + dev_priv->fb_size - 1;
+	u64 gart_start = dev_priv->gart_vm_start;
+	u64 gart_end = gart_start + dev_priv->gart_size - 1;
 
 	return ((off >= fb_start && off <= fb_end) ||
 		(off >= gart_start && off <= gart_end));
@@ -476,6 +525,33 @@ extern int r600_cp_dispatch_indirect(str
 				     struct drm_buf *buf, int start, int end);
 extern int r600_page_table_init(struct drm_device *dev);
 extern void r600_page_table_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info);
+extern void r600_cp_dispatch_swap(struct drm_device * dev);
+extern int r600_cp_dispatch_texture(struct drm_device * dev,
+				    struct drm_file *file_priv,
+				    drm_radeon_texture_t * tex,
+				    drm_radeon_tex_image_t * image);
+
+/* r600_blit.c */
+extern int
+r600_prepare_blit_copy(struct drm_device *dev);
+extern void
+r600_done_blit_copy(struct drm_device *dev);
+extern void
+r600_blit_copy(struct drm_device *dev,
+	       uint64_t src_gpu_addr, uint64_t dst_gpu_addr,
+	       int size_bytes);
+extern void
+r600_blit_swap(struct drm_device *dev,
+	       uint64_t src_gpu_addr, uint64_t dst_gpu_addr,
+	       int sx, int sy, int dx, int dy,
+	       int w, int h, int src_pitch, int dst_pitch, int cpp);
+
+/* radeon_state.c */
+extern void radeon_cp_discard_buffer(struct drm_device * dev, struct drm_buf * buf);
+
+/* radeon_cs.c */
+extern int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *fpriv);
+extern int r600_cs_init(struct drm_device *dev);
 
 /* Flags for stats.boxes
  */
@@ -685,6 +761,7 @@ extern void r600_page_table_cleanup(stru
 
 /* pipe config regs */
 #define R400_GB_PIPE_SELECT             0x402c
+#define RV530_GB_PIPE_SELECT2           0x4124
 #define R500_DYN_SCLK_PWMEM_PIPE        0x000d /* PLL */
 #define R300_GB_TILE_CONFIG             0x4018
 #       define R300_ENABLE_TILING       (1 << 0)
@@ -1827,26 +1904,38 @@ do {									\
  */
 
 #define RADEON_WAIT_UNTIL_2D_IDLE() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_2D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_3D_IDLE() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_3D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_IDLE() do {					\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( (RADEON_WAIT_2D_IDLECLEAN |				\
 		   RADEON_WAIT_3D_IDLECLEAN |				\
 		   RADEON_WAIT_HOST_IDLECLEAN) );			\
 } while (0)
 
 #define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do {				\
-	OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );			\
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)        \
+		OUT_RING( CP_PACKET0( R600_WAIT_UNTIL, 0 ) );           \
+	else                                                            \
+		OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) );         \
 	OUT_RING( RADEON_WAIT_CRTC_PFLIP );				\
 } while (0)
 
@@ -1961,14 +2050,17 @@ do {								\
 
 #define RING_LOCALS	int write, _nr, _align_nr; unsigned int mask; u32 *ring;
 
+#define RADEON_RING_ALIGN 16
+
 #define BEGIN_RING( n ) do {						\
 	if ( RADEON_VERBOSE ) {						\
 		DRM_INFO( "BEGIN_RING( %d )\n", (n));			\
 	}								\
-	_align_nr = (n + 0xf) & ~0xf;					\
-	if (dev_priv->ring.space <= (_align_nr * sizeof(u32))) {	\
-                COMMIT_RING();						\
-		radeon_wait_ring( dev_priv, _align_nr * sizeof(u32));	\
+	_align_nr = RADEON_RING_ALIGN - ((dev_priv->ring.tail + n) & (RADEON_RING_ALIGN - 1)); \
+	_align_nr += n;							\
+	if ( dev_priv->ring.space <= (_align_nr) * sizeof(u32) ) {	\
+		COMMIT_RING();						\
+		radeon_wait_ring( dev_priv, (_align_nr) * sizeof(u32) ); \
 	}								\
 	_nr = n; dev_priv->ring.space -= (n) * sizeof(u32);		\
 	ring = dev_priv->ring.start;					\

Modified: stable/7/sys/dev/drm/radeon_irq.c
==============================================================================
--- stable/7/sys/dev/drm/radeon_irq.c	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/radeon_irq.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -194,6 +194,9 @@ irqreturn_t radeon_driver_irq_handler(DR
 	u32 r500_disp_int;
 	u32 tmp;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return IRQ_NONE;
+
 	/* Only consider the bits we're interested in - others could be used
 	 * outside the DRM
 	 */
@@ -323,6 +326,9 @@ int radeon_irq_emit(struct drm_device *d
 	drm_radeon_irq_emit_t *emit = data;
 	int result;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return -EINVAL;
+
 	LOCK_TEST_WITH_RETURN(dev, file_priv);
 
 	if (!dev_priv) {
@@ -363,6 +369,9 @@ void radeon_driver_irq_preinstall(struct
 	    (drm_radeon_private_t *) dev->dev_private;
 	u32 dummy;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return;
+
 	/* Disable *all* interrupts */
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
 		RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
@@ -380,6 +389,9 @@ int radeon_driver_irq_postinstall(struct
 	atomic_set(&dev_priv->swi_emitted, 0);
 	DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return 0;
+
 	radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
 
 	return 0;
@@ -394,6 +406,9 @@ void radeon_driver_irq_uninstall(struct 
 
 	dev_priv->irq_enabled = 0;
 
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		return;
+
 	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
 		RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
 	/* Disable *all* interrupts */

Modified: stable/7/sys/dev/drm/radeon_state.c
==============================================================================
--- stable/7/sys/dev/drm/radeon_state.c	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/dev/drm/radeon_state.c	Fri Oct 30 16:35:47 2009	(r198686)
@@ -1541,7 +1541,7 @@ static void radeon_cp_dispatch_vertex(st
 	} while (i < nbox);
 }
 
-static void radeon_cp_discard_buffer(struct drm_device *dev, struct drm_buf *buf)
+void radeon_cp_discard_buffer(struct drm_device *dev, struct drm_buf *buf)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	drm_radeon_buf_priv_t *buf_priv = buf->dev_private;
@@ -2202,7 +2202,10 @@ static int radeon_cp_swap(struct drm_dev
 	if (sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS)
 		sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS;
 
-	radeon_cp_dispatch_swap(dev);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		r600_cp_dispatch_swap(dev);
+	else
+		radeon_cp_dispatch_swap(dev);
 	sarea_priv->ctx_owner = 0;
 
 	COMMIT_RING();
@@ -2399,7 +2402,10 @@ static int radeon_cp_texture(struct drm_
 	RING_SPACE_TEST_WITH_RETURN(dev_priv);
 	VB_AGE_TEST_WITH_RETURN(dev_priv);
 
-	ret = radeon_cp_dispatch_texture(dev, file_priv, tex, &image);
+	if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+		ret = r600_cp_dispatch_texture(dev, file_priv, tex, &image);
+	else
+		ret = radeon_cp_dispatch_texture(dev, file_priv, tex, &image);
 
 	return ret;
 }
@@ -3018,7 +3024,10 @@ static int radeon_cp_getparam(struct drm
 		value = GET_SCRATCH(dev_priv, 2);
 		break;
 	case RADEON_PARAM_IRQ_NR:
-		value = dev->irq;
+		if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+			value = 0;
+		else
+			value = dev->irq;
 		break;
 	case RADEON_PARAM_GART_BASE:
 		value = dev_priv->gart_vm_start;
@@ -3072,6 +3081,9 @@ static int radeon_cp_getparam(struct drm
 	case RADEON_PARAM_NUM_GB_PIPES:
 		value = dev_priv->num_gb_pipes;
 		break;
+	case RADEON_PARAM_NUM_Z_PIPES:
+		value = dev_priv->num_z_pipes;
+		break;
 	default:
 		DRM_DEBUG("Invalid parameter %d\n", param->param);
 		return -EINVAL;
@@ -3156,6 +3168,14 @@ void radeon_driver_preclose(struct drm_d
 void radeon_driver_lastclose(struct drm_device *dev)
 {
 	radeon_surfaces_release(PCIGART_FILE_PRIV, dev->dev_private);
+	if (dev->dev_private) {
+		drm_radeon_private_t *dev_priv = dev->dev_private;
+
+		if (dev_priv->sarea_priv &&
+		    dev_priv->sarea_priv->pfCurrentPage != 0)
+			radeon_cp_dispatch_flip(dev);
+	}
+
 	radeon_do_release(dev);
 }
 
@@ -3216,7 +3236,8 @@ struct drm_ioctl_desc radeon_ioctls[] = 
 	DRM_IOCTL_DEF(DRM_RADEON_IRQ_WAIT, radeon_irq_wait, DRM_AUTH),
 	DRM_IOCTL_DEF(DRM_RADEON_SETPARAM, radeon_cp_setparam, DRM_AUTH),
 	DRM_IOCTL_DEF(DRM_RADEON_SURF_ALLOC, radeon_surface_alloc, DRM_AUTH),
-	DRM_IOCTL_DEF(DRM_RADEON_SURF_FREE, radeon_surface_free, DRM_AUTH)
+	DRM_IOCTL_DEF(DRM_RADEON_SURF_FREE, radeon_surface_free, DRM_AUTH),
+	DRM_IOCTL_DEF(DRM_RADEON_CS, radeon_cs_ioctl, DRM_AUTH)
 };
 
 int radeon_max_ioctl = DRM_ARRAY_SIZE(radeon_ioctls);

Modified: stable/7/sys/modules/drm/radeon/Makefile
==============================================================================
--- stable/7/sys/modules/drm/radeon/Makefile	Fri Oct 30 16:32:35 2009	(r198685)
+++ stable/7/sys/modules/drm/radeon/Makefile	Fri Oct 30 16:35:47 2009	(r198686)
@@ -2,8 +2,8 @@
 
 .PATH:	${.CURDIR}/../../../dev/drm
 KMOD	= radeon
-SRCS	= r300_cmdbuf.c r600_cp.c radeon_cp.c radeon_drv.c radeon_irq.c \
-	radeon_mem.c radeon_state.c
+SRCS	= r300_cmdbuf.c r600_blit.c r600_cp.c radeon_cp.c radeon_cs.c \
+	radeon_drv.c radeon_irq.c radeon_mem.c radeon_state.c
 SRCS	+=device_if.h bus_if.h pci_if.h opt_drm.h
 
 .include 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:37:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E73C9106568B;
	Fri, 30 Oct 2009 16:37:58 +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 BAC898FC13;
	Fri, 30 Oct 2009 16:37: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 n9UGbwqF051483;
	Fri, 30 Oct 2009 16:37:58 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGbwgG051480;
	Fri, 30 Oct 2009 16:37:58 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301637.n9UGbwgG051480@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:37:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198687 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/drm dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:37:59 -0000

Author: rnoland
Date: Fri Oct 30 16:37:58 2009
New Revision: 198687
URL: http://svn.freebsd.org/changeset/base/198687

Log:
  MFC r197951
  
  Add support for Intel G41 chipset

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drm_pciids.h
  stable/8/sys/dev/drm/i915_drv.h
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/drm/drm_pciids.h
==============================================================================
--- stable/8/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:35:47 2009	(r198686)
+++ stable/8/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:37:58 2009	(r198687)
@@ -552,6 +552,7 @@
 	{0x8086, 0x2E02, CHIP_I9XX|CHIP_I965, "Intel Integrated Graphics Device"}, \
 	{0x8086, 0x2E12, CHIP_I9XX|CHIP_I965, "Intel Q45/Q43"}, \
 	{0x8086, 0x2E22, CHIP_I9XX|CHIP_I965, "Intel G45/G43"}, \
+	{0x8086, 0x2E32, CHIP_I9XX|CHIP_I965, "Intel G41"}, \
 	{0, 0, 0, NULL}
 
 #define imagine_PCI_IDS \

Modified: stable/8/sys/dev/drm/i915_drv.h
==============================================================================
--- stable/8/sys/dev/drm/i915_drv.h	Fri Oct 30 16:35:47 2009	(r198686)
+++ stable/8/sys/dev/drm/i915_drv.h	Fri Oct 30 16:37:58 2009	(r198687)
@@ -644,7 +644,8 @@ extern int i915_wait_ring(struct drm_dev
 		       (dev)->pci_device == 0x2A42 || \
 		       (dev)->pci_device == 0x2E02 || \
 		       (dev)->pci_device == 0x2E12 || \
-		       (dev)->pci_device == 0x2E22)
+		       (dev)->pci_device == 0x2E22 || \
+		       (dev)->pci_device == 0x2E32)
 
 #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
 
@@ -653,6 +654,7 @@ extern int i915_wait_ring(struct drm_dev
 #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
 		     (dev)->pci_device == 0x2E12 || \
 		     (dev)->pci_device == 0x2E22 || \
+		     (dev)->pci_device == 0x2E32 || \
 		     IS_GM45(dev))
 
 #define IS_G33(dev)    ((dev)->pci_device == 0x29C2 ||	\

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:38:53 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 985F8106566B;
	Fri, 30 Oct 2009 16:38:53 +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 8672C8FC08;
	Fri, 30 Oct 2009 16:38: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 n9UGcrB6051539;
	Fri, 30 Oct 2009 16:38:53 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGcrt5051536;
	Fri, 30 Oct 2009 16:38:53 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301638.n9UGcrt5051536@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:38:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198688 - in stable/7/sys: . contrib/pf dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:38:53 -0000

Author: rnoland
Date: Fri Oct 30 16:38:53 2009
New Revision: 198688
URL: http://svn.freebsd.org/changeset/base/198688

Log:
  MFC r197951
  
  Add support for Intel G41 chipset

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/drm/drm_pciids.h
  stable/7/sys/dev/drm/i915_drv.h

Modified: stable/7/sys/dev/drm/drm_pciids.h
==============================================================================
--- stable/7/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:37:58 2009	(r198687)
+++ stable/7/sys/dev/drm/drm_pciids.h	Fri Oct 30 16:38:53 2009	(r198688)
@@ -552,6 +552,7 @@
 	{0x8086, 0x2E02, CHIP_I9XX|CHIP_I965, "Intel Integrated Graphics Device"}, \
 	{0x8086, 0x2E12, CHIP_I9XX|CHIP_I965, "Intel Q45/Q43"}, \
 	{0x8086, 0x2E22, CHIP_I9XX|CHIP_I965, "Intel G45/G43"}, \
+	{0x8086, 0x2E32, CHIP_I9XX|CHIP_I965, "Intel G41"}, \
 	{0, 0, 0, NULL}
 
 #define imagine_PCI_IDS \

Modified: stable/7/sys/dev/drm/i915_drv.h
==============================================================================
--- stable/7/sys/dev/drm/i915_drv.h	Fri Oct 30 16:37:58 2009	(r198687)
+++ stable/7/sys/dev/drm/i915_drv.h	Fri Oct 30 16:38:53 2009	(r198688)
@@ -644,7 +644,8 @@ extern int i915_wait_ring(struct drm_dev
 		       (dev)->pci_device == 0x2A42 || \
 		       (dev)->pci_device == 0x2E02 || \
 		       (dev)->pci_device == 0x2E12 || \
-		       (dev)->pci_device == 0x2E22)
+		       (dev)->pci_device == 0x2E22 || \
+		       (dev)->pci_device == 0x2E32)
 
 #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
 
@@ -653,6 +654,7 @@ extern int i915_wait_ring(struct drm_dev
 #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
 		     (dev)->pci_device == 0x2E12 || \
 		     (dev)->pci_device == 0x2E22 || \
+		     (dev)->pci_device == 0x2E32 || \
 		     IS_GM45(dev))
 
 #define IS_G33(dev)    ((dev)->pci_device == 0x29C2 ||	\

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:43:28 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9445C1065676;
	Fri, 30 Oct 2009 16:43:28 +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 811BB8FC22;
	Fri, 30 Oct 2009 16:43: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 n9UGhSiB051734;
	Fri, 30 Oct 2009 16:43:28 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGhShf051732;
	Fri, 30 Oct 2009 16:43:28 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301643.n9UGhShf051732@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:43:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198689 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/agp dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:43:28 -0000

Author: rnoland
Date: Fri Oct 30 16:43:28 2009
New Revision: 198689
URL: http://svn.freebsd.org/changeset/base/198689

Log:
  MFC r197950
  
  Add pci id's for Intel G41 chipset

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/agp/agp_i810.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/agp/agp_i810.c
==============================================================================
--- stable/8/sys/dev/agp/agp_i810.c	Fri Oct 30 16:38:53 2009	(r198688)
+++ stable/8/sys/dev/agp/agp_i810.c	Fri Oct 30 16:43:28 2009	(r198689)
@@ -175,6 +175,8 @@ static const struct agp_i810_match {
 	    "Intel Q45 SVGA controller"},
 	{0x2E228086, CHIP_G4X, 0x00020000,
 	    "Intel G45 SVGA controller"},
+	{0x2E328086, CHIP_G4X, 0x00020000,
+	    "Intel G41 SVGA controller"},
 	{0, 0, 0, NULL}
 };
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:49:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EAE7510656A5;
	Fri, 30 Oct 2009 16:49:38 +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 D89B78FC1A;
	Fri, 30 Oct 2009 16:49: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 n9UGnctI051940;
	Fri, 30 Oct 2009 16:49:38 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGncVP051938;
	Fri, 30 Oct 2009 16:49:38 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301649.n9UGncVP051938@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:49:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198690 - in stable/7/sys: . contrib/pf pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:49:39 -0000

Author: rnoland
Date: Fri Oct 30 16:49:38 2009
New Revision: 198690
URL: http://svn.freebsd.org/changeset/base/198690

Log:
  MFC r197950 (record only)
  
  Add pci id's for Intel G41 chipset

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/pci/agp_i810.c

Modified: stable/7/sys/pci/agp_i810.c
==============================================================================
--- stable/7/sys/pci/agp_i810.c	Fri Oct 30 16:43:28 2009	(r198689)
+++ stable/7/sys/pci/agp_i810.c	Fri Oct 30 16:49:38 2009	(r198690)
@@ -175,6 +175,8 @@ static const struct agp_i810_match {
 	    "Intel Q45 SVGA controller"},
 	{0x2E228086, CHIP_G4X, 0x00020000,
 	    "Intel G45 SVGA controller"},
+	{0x2E328086, CHIP_G4X, 0x00020000,
+	    "Intel G41 SVGA controller"},
 	{0, 0, 0, NULL}
 };
 

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:55:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38B5D106566C;
	Fri, 30 Oct 2009 16:55:32 +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 27B9C8FC0C;
	Fri, 30 Oct 2009 16:55: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 n9UGtWp5052122;
	Fri, 30 Oct 2009 16:55:32 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGtWSL052120;
	Fri, 30 Oct 2009 16:55:32 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301655.n9UGtWSL052120@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:55: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: r198691 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:55:32 -0000

Author: rnoland
Date: Fri Oct 30 16:55:31 2009
New Revision: 198691
URL: http://svn.freebsd.org/changeset/base/198691

Log:
  Fix blitter support for RS880 chips
  
  MFC after:	3 days

Modified:
  head/sys/dev/drm/r600_blit.c

Modified: head/sys/dev/drm/r600_blit.c
==============================================================================
--- head/sys/dev/drm/r600_blit.c	Fri Oct 30 16:49:38 2009	(r198690)
+++ head/sys/dev/drm/r600_blit.c	Fri Oct 30 16:55:31 2009	(r198691)
@@ -1367,7 +1367,7 @@ set_vtx_resource(drm_radeon_private_t *d
 	if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) ||
-	    /*((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||*/
+	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV710))
 		cp_set_surface_sync(dev_priv,
 				    R600_TC_ACTION_ENA, 48, gpu_addr);
@@ -1509,7 +1509,7 @@ set_default_state(drm_radeon_private_t *
 	case CHIP_RV610:
 	case CHIP_RV620:
 	case CHIP_RS780:
-	/*case CHIP_RS880:*/
+	case CHIP_RS880:
 	default:
 		num_ps_gprs = 84;
 		num_vs_gprs = 36;
@@ -1591,7 +1591,7 @@ set_default_state(drm_radeon_private_t *
 	if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV610) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV620) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS780) ||
-	    /*((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||*/
+	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS880) ||
 	    ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV710))
 		sq_config = 0;
 	else

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 16:59:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A957F106568B;
	Fri, 30 Oct 2009 16:59:58 +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 9871D8FC08;
	Fri, 30 Oct 2009 16:59: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 n9UGxwoF052264;
	Fri, 30 Oct 2009 16:59:58 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UGxw2E052262;
	Fri, 30 Oct 2009 16:59:58 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301659.n9UGxw2E052262@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 16:59: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: r198692 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 16:59:58 -0000

Author: rnoland
Date: Fri Oct 30 16:59:58 2009
New Revision: 198692
URL: http://svn.freebsd.org/changeset/base/198692

Log:
  Use system specified memory barriers rather than rolling our own.

Modified:
  head/sys/dev/drm/drmP.h

Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h	Fri Oct 30 16:55:31 2009	(r198691)
+++ head/sys/dev/drm/drmP.h	Fri Oct 30 16:59:58 2009	(r198692)
@@ -223,23 +223,9 @@ typedef u_int8_t u8;
  * DRM_WRITEMEMORYBARRIER() prevents reordering of writes.
  * DRM_MEMORYBARRIER() prevents reordering of reads and writes.
  */
-#if defined(__i386__)
-#define DRM_READMEMORYBARRIER()		__asm __volatile( \
-					"lock; addl $0,0(%%esp)" : : : "memory");
-#define DRM_WRITEMEMORYBARRIER()	__asm __volatile("" : : : "memory");
-#define DRM_MEMORYBARRIER()		__asm __volatile( \
-					"lock; addl $0,0(%%esp)" : : : "memory");
-#elif defined(__alpha__)
-#define DRM_READMEMORYBARRIER()		alpha_mb();
-#define DRM_WRITEMEMORYBARRIER()	alpha_wmb();
-#define DRM_MEMORYBARRIER()		alpha_mb();
-#elif defined(__amd64__)
-#define DRM_READMEMORYBARRIER()		__asm __volatile( \
-					"lock; addl $0,0(%%rsp)" : : : "memory");
-#define DRM_WRITEMEMORYBARRIER()	__asm __volatile("" : : : "memory");
-#define DRM_MEMORYBARRIER()		__asm __volatile( \
-					"lock; addl $0,0(%%rsp)" : : : "memory");
-#endif
+#define DRM_READMEMORYBARRIER()		rmb()
+#define DRM_WRITEMEMORYBARRIER()	wmb()
+#define DRM_MEMORYBARRIER()		mb()
 
 #define DRM_READ8(map, offset)						\
 	*(volatile u_int8_t *)(((vm_offset_t)(map)->handle) +		\

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 17:28:36 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6C977106566C;
	Fri, 30 Oct 2009 17:28:36 +0000 (UTC)
	(envelope-from rafan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5A6C68FC0C;
	Fri, 30 Oct 2009 17:28: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 n9UHSaIL052958;
	Fri, 30 Oct 2009 17:28:36 GMT (envelope-from rafan@svn.freebsd.org)
Received: (from rafan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UHSaw7052956;
	Fri, 30 Oct 2009 17:28:36 GMT (envelope-from rafan@svn.freebsd.org)
Message-Id: <200910301728.n9UHSaw7052956@svn.freebsd.org>
From: Rong-En Fan 
Date: Fri, 30 Oct 2009 17:28:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198693 - in stable/8/contrib/ncurses: . ncurses/base
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 17:28:36 -0000

Author: rafan
Date: Fri Oct 30 17:28:35 2009
New Revision: 198693
URL: http://svn.freebsd.org/changeset/base/198693

Log:
  MFC r198490
  
   Pull upstream patch to fix ee(1) crash when received SIGWINCH:
  
     modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
     SIGWINCH, and discard that value, to avoid confusing application
     (patch by Eygene Ryabinkin, FreeBSD bin/136223).
  
  PR:		136223
  Submitted by:	Eygene Ryabinkin
  Obtained from:	ncurses-5.7-20091024 snapshot

Modified:
  stable/8/contrib/ncurses/   (props changed)
  stable/8/contrib/ncurses/ncurses/base/lib_getch.c

Modified: stable/8/contrib/ncurses/ncurses/base/lib_getch.c
==============================================================================
--- stable/8/contrib/ncurses/ncurses/base/lib_getch.c	Fri Oct 30 16:59:58 2009	(r198692)
+++ stable/8/contrib/ncurses/ncurses/base/lib_getch.c	Fri Oct 30 17:28:35 2009	(r198693)
@@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
 	    /* resizeterm can push KEY_RESIZE */
 	    if (cooked_key_in_fifo()) {
 		*result = fifo_pull(sp);
+		/*
+		 * Get the ERR from queue -- it is from WINCH,
+		 * so we should take it out, the "error" is handled.
+		 */
+		if (fifo_peek(sp) == -1)
+		    fifo_pull(sp);
 		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
 	    }
 	}

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 18:02:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 507F0106566B;
	Fri, 30 Oct 2009 18:02:11 +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 3F29E8FC13;
	Fri, 30 Oct 2009 18:02: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 n9UI2BnD053661;
	Fri, 30 Oct 2009 18:02:11 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UI2B0B053659;
	Fri, 30 Oct 2009 18:02:11 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301802.n9UI2B0B053659@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 18:02: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: r198694 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 18:02:11 -0000

Author: rnoland
Date: Fri Oct 30 18:02:10 2009
New Revision: 198694
URL: http://svn.freebsd.org/changeset/base/198694

Log:
  Some general cleanup of scatter/gather memory allocation
  
   - We don't need to check malloc return values with M_WAITOK
   - remove variables that we don't really need
   - cleanup the error paths by just calling drm_sg_cleanup()
   - fix drm_sg_cleanup() to be safe to call at any time
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/drm_scatter.c

Modified: head/sys/dev/drm/drm_scatter.c
==============================================================================
--- head/sys/dev/drm/drm_scatter.c	Fri Oct 30 17:28:35 2009	(r198693)
+++ head/sys/dev/drm/drm_scatter.c	Fri Oct 30 18:02:10 2009	(r198694)
@@ -47,35 +47,20 @@ drm_sg_alloc(struct drm_device *dev, str
 {
 	struct drm_sg_mem *entry;
 	struct drm_dma_handle *dmah;
-	unsigned long pages;
 	int ret;
 
 	if (dev->sg)
 		return EINVAL;
 
 	entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO);
-	if (!entry)
-		return ENOMEM;
-
-	pages = round_page(request->size) / PAGE_SIZE;
-	DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages);
-
-	entry->pages = pages;
-
-	entry->busaddr = malloc(pages * sizeof(*entry->busaddr), DRM_MEM_PAGES,
-	    M_WAITOK | M_ZERO);
-	if (!entry->busaddr) {
-		free(entry, DRM_MEM_SGLISTS);
-		return ENOMEM;
-	}
+	entry->pages = round_page(request->size) / PAGE_SIZE;
+	DRM_DEBUG("sg size=%ld pages=%d\n", request->size, entry->pages);
 
+	entry->busaddr = malloc(entry->pages * sizeof(*entry->busaddr),
+	    DRM_MEM_PAGES, M_WAITOK | M_ZERO);
 	dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA,
-	    M_ZERO | M_NOWAIT);
-	if (dmah == NULL) {
-		free(entry->busaddr, DRM_MEM_PAGES);
-		free(entry, DRM_MEM_SGLISTS);
-		return ENOMEM;
-	}
+	    M_WAITOK | M_ZERO);
+	entry->dmah = dmah;
 
 	ret = bus_dma_tag_create(NULL, PAGE_SIZE, 0, /* tag, align, boundary */
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
@@ -85,41 +70,27 @@ drm_sg_alloc(struct drm_device *dev, str
 	    NULL, NULL, /* lockfunc, lockfuncargs */
 	    &dmah->tag);
 	if (ret != 0) {
-		free(dmah, DRM_MEM_DMA);
-		free(entry->busaddr, DRM_MEM_PAGES);
-		free(entry, DRM_MEM_SGLISTS);
+		drm_sg_cleanup(entry);
 		return ENOMEM;
 	}
 
 	ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr,
 	    BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_NOCACHE, &dmah->map);
 	if (ret != 0) {
-		bus_dma_tag_destroy(dmah->tag);
-		free(dmah, DRM_MEM_DMA);
-		free(entry->busaddr, DRM_MEM_PAGES);
-		free(entry, DRM_MEM_SGLISTS);
+		drm_sg_cleanup(entry);
 		return ENOMEM;
 	}
 
+	entry->handle = (unsigned long)dmah->vaddr;
+	entry->virtual = dmah->vaddr;
+
 	ret = bus_dmamap_load(dmah->tag, dmah->map, dmah->vaddr,
 	    request->size, drm_sg_alloc_cb, entry, BUS_DMA_NOWAIT);
 	if (ret != 0) {
-		bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
-		bus_dma_tag_destroy(dmah->tag);
-		free(dmah, DRM_MEM_DMA);
-		free(entry->busaddr, DRM_MEM_PAGES);
-		free(entry, DRM_MEM_SGLISTS);
+		drm_sg_cleanup(entry);
 		return ENOMEM;
 	}
 
-	entry->dmah = dmah;
-	entry->handle = (unsigned long)dmah->vaddr;
-	
-	DRM_DEBUG("sg alloc handle  = %08lx\n", entry->handle);
-
-	entry->virtual = (void *)entry->handle;
-	request->handle = entry->handle;
-
 	DRM_LOCK();
 	if (dev->sg) {
 		DRM_UNLOCK();
@@ -129,6 +100,11 @@ drm_sg_alloc(struct drm_device *dev, str
 	dev->sg = entry;
 	DRM_UNLOCK();
 
+	DRM_DEBUG("handle=%08lx, kva=%p, contents=%08lx\n", entry->handle,
+	    entry->virtual, *(unsigned long *)entry->virtual);
+
+	request->handle = entry->handle;
+
 	return 0;
 }
 
@@ -143,6 +119,8 @@ drm_sg_alloc_cb(void *arg, bus_dma_segme
 
 	for(i = 0 ; i < nsegs ; i++) {
 		entry->busaddr[i] = segs[i].ds_addr;
+		DRM_DEBUG("segment %d @ 0x%016lx\n", i,
+		    (unsigned long)segs[i].ds_addr);
 	}
 }
 
@@ -162,9 +140,12 @@ drm_sg_cleanup(struct drm_sg_mem *entry)
 {
 	struct drm_dma_handle *dmah = entry->dmah;
 
-	bus_dmamap_unload(dmah->tag, dmah->map);
-	bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
-	bus_dma_tag_destroy(dmah->tag);
+	if (dmah->map != NULL)
+		bus_dmamap_unload(dmah->tag, dmah->map);
+	if (dmah->vaddr != NULL)
+		bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map);
+	if (dmah->tag != NULL)
+		bus_dma_tag_destroy(dmah->tag);
 	free(dmah, DRM_MEM_DMA);
 	free(entry->busaddr, DRM_MEM_PAGES);
 	free(entry, DRM_MEM_SGLISTS);

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 18:07:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 06B5B106568B;
	Fri, 30 Oct 2009 18:07:23 +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 D0C148FC08;
	Fri, 30 Oct 2009 18:07: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 n9UI7MBL053780;
	Fri, 30 Oct 2009 18:07:22 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UI7MQd053778;
	Fri, 30 Oct 2009 18:07:22 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301807.n9UI7MQd053778@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 18:07: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: r198695 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 18:07:23 -0000

Author: rnoland
Date: Fri Oct 30 18:07:22 2009
New Revision: 198695
URL: http://svn.freebsd.org/changeset/base/198695

Log:
  A bit of cleanup work on radeon_freelist_get()
  
    * Fix the main loop to search all buffers before sleeping.
    * Remove dead code
  
  MFC after:	3 days

Modified:
  head/sys/dev/drm/radeon_cp.c

Modified: head/sys/dev/drm/radeon_cp.c
==============================================================================
--- head/sys/dev/drm/radeon_cp.c	Fri Oct 30 18:02:10 2009	(r198694)
+++ head/sys/dev/drm/radeon_cp.c	Fri Oct 30 18:07:22 2009	(r198695)
@@ -1860,8 +1860,8 @@ struct drm_buf *radeon_freelist_get(stru
 	for (t = 0; t < dev_priv->usec_timeout; t++) {
 		u32 done_age = GET_SCRATCH(dev_priv, 1);
 		DRM_DEBUG("done_age = %d\n", done_age);
-		for (i = start; i < dma->buf_count; i++) {
-			buf = dma->buflist[i];
+		for (i = 0; i < dma->buf_count; i++) {
+			buf = dma->buflist[start];
 			buf_priv = buf->dev_private;
 			if (buf->file_priv == NULL || (buf->pending &&
 						       buf_priv->age <=
@@ -1870,7 +1870,8 @@ struct drm_buf *radeon_freelist_get(stru
 				buf->pending = 0;
 				return buf;
 			}
-			start = 0;
+			if (++start >= dma->buf_count)
+				start = 0;
 		}
 
 		if (t) {
@@ -1879,47 +1880,9 @@ struct drm_buf *radeon_freelist_get(stru
 		}
 	}
 
-	DRM_DEBUG("returning NULL!\n");
 	return NULL;
 }
 
-#if 0
-struct drm_buf *radeon_freelist_get(struct drm_device * dev)
-{
-	struct drm_device_dma *dma = dev->dma;
-	drm_radeon_private_t *dev_priv = dev->dev_private;
-	drm_radeon_buf_priv_t *buf_priv;
-	struct drm_buf *buf;
-	int i, t;
-	int start;
-	u32 done_age;
-
-	done_age = radeon_read_ring_rptr(dev_priv, RADEON_SCRATCHOFF(1));
-	if (++dev_priv->last_buf >= dma->buf_count)
-		dev_priv->last_buf = 0;
-
-	start = dev_priv->last_buf;
-	dev_priv->stats.freelist_loops++;
-
-	for (t = 0; t < 2; t++) {
-		for (i = start; i < dma->buf_count; i++) {
-			buf = dma->buflist[i];
-			buf_priv = buf->dev_private;
-			if (buf->file_priv == 0 || (buf->pending &&
-						    buf_priv->age <=
-						    done_age)) {
-				dev_priv->stats.requested_bufs++;
-				buf->pending = 0;
-				return buf;
-			}
-		}
-		start = 0;
-	}
-
-	return NULL;
-}
-#endif
-
 void radeon_freelist_reset(struct drm_device * dev)
 {
 	struct drm_device_dma *dma = dev->dma;

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 18:08:46 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7B78E1065694;
	Fri, 30 Oct 2009 18:08:46 +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 6A7A38FC1D;
	Fri, 30 Oct 2009 18:08: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 n9UI8ks4053840;
	Fri, 30 Oct 2009 18:08:46 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UI8kkn053838;
	Fri, 30 Oct 2009 18:08:46 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301808.n9UI8kkn053838@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 18:08: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: r198696 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 18:08:46 -0000

Author: rnoland
Date: Fri Oct 30 18:08:46 2009
New Revision: 198696
URL: http://svn.freebsd.org/changeset/base/198696

Log:
  Cleanup in r600_blit
  
   - Don't bother to assign vb until we know we have enough space
   - Add variables for sx2, sy2, dx2, dy2 so that these aren't
     calculated over and over, also reduce chance of errors.
   - Use switch to assign color/format
  
  MFC after:	3 days

Modified:
  head/sys/dev/drm/r600_blit.c

Modified: head/sys/dev/drm/r600_blit.c
==============================================================================
--- head/sys/dev/drm/r600_blit.c	Fri Oct 30 18:07:22 2009	(r198695)
+++ head/sys/dev/drm/r600_blit.c	Fri Oct 30 18:08:46 2009	(r198696)
@@ -1719,7 +1719,10 @@ r600_blit_copy(struct drm_device *dev,
 	u32 *vb;
 
 	vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
-		      dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
+	    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
+	DRM_DEBUG("src=0x%016llx, dst=0x%016llx, size=%d\n",
+	    (unsigned long long)src_gpu_addr,
+	    (unsigned long long)dst_gpu_addr, size_bytes);
 
 	if ((size_bytes & 3) || (src_gpu_addr & 3) || (dst_gpu_addr & 3)) {
 		max_bytes = 8192;
@@ -1757,7 +1760,7 @@ r600_blit_copy(struct drm_device *dev,
 					return;
 				set_shaders(dev);
 				vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
-					      dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
+				    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 			}
 
 			vb[0] = i2f(dst_x);
@@ -1847,7 +1850,7 @@ r600_blit_copy(struct drm_device *dev,
 					return;
 				set_shaders(dev);
 				vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
-					      dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
+				    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 			}
 
 			vb[0] = i2f(dst_x / 4);
@@ -1913,12 +1916,10 @@ r600_blit_swap(struct drm_device *dev,
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	int cb_format, tex_format;
+	int sx2, sy2, dx2, dy2;
 	u64 vb_addr;
 	u32 *vb;
 
-	vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
-		      dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
-
 	if ((dev_priv->blit_vb->used + 48) > dev_priv->blit_vb->total) {
 		dev_priv->blit_vb->used = 0;
 		radeon_cp_discard_buffer(dev, dev_priv->blit_vb);
@@ -1926,20 +1927,14 @@ r600_blit_swap(struct drm_device *dev,
 		if (!dev_priv->blit_vb)
 			return;
 		set_shaders(dev);
-		vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
-			      dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 	}
+	vb = (u32 *) ((char *)dev->agp_buffer_map->handle +
+	    dev_priv->blit_vb->offset + dev_priv->blit_vb->used);
 
-	if (cpp == 4) {
-		cb_format = COLOR_8_8_8_8;
-		tex_format = FMT_8_8_8_8;
-	} else if (cpp == 2) {
-		cb_format = COLOR_5_6_5;
-		tex_format = FMT_5_6_5;
-	} else {
-		cb_format = COLOR_8;
-		tex_format = FMT_8;
-	}
+	sx2 = sx + w;
+	sy2 = sy + h;
+	dx2 = dx + w;
+	dy2 = dy + h;
 
 	vb[0] = i2f(dx);
 	vb[1] = i2f(dy);
@@ -1947,31 +1942,46 @@ r600_blit_swap(struct drm_device *dev,
 	vb[3] = i2f(sy);
 
 	vb[4] = i2f(dx);
-	vb[5] = i2f(dy + h);
+	vb[5] = i2f(dy2);
 	vb[6] = i2f(sx);
-	vb[7] = i2f(sy + h);
+	vb[7] = i2f(sy2);
+
+	vb[8] = i2f(dx2);
+	vb[9] = i2f(dy2);
+	vb[10] = i2f(sx2);
+	vb[11] = i2f(sy2);
 
-	vb[8] = i2f(dx + w);
-	vb[9] = i2f(dy + h);
-	vb[10] = i2f(sx + w);
-	vb[11] = i2f(sy + h);
+	switch(cpp) {
+	case 4:
+		cb_format = COLOR_8_8_8_8;
+		tex_format = FMT_8_8_8_8;
+		break;
+	case 2:
+		cb_format = COLOR_5_6_5;
+		tex_format = FMT_5_6_5;
+		break;
+	default:
+		cb_format = COLOR_8;
+		tex_format = FMT_8;
+		break;
+	}
 
 	/* src */
 	set_tex_resource(dev_priv, tex_format,
 			 src_pitch / cpp,
-			 sy + h, src_pitch / cpp,
+			 sy2, src_pitch / cpp,
 			 src_gpu_addr);
 
 	cp_set_surface_sync(dev_priv,
-			    R600_TC_ACTION_ENA, (src_pitch * (sy + h)), src_gpu_addr);
+			    R600_TC_ACTION_ENA, src_pitch * sy2, src_gpu_addr);
 
 	/* dst */
 	set_render_target(dev_priv, cb_format,
-			  dst_pitch / cpp, dy + h,
+			  dst_pitch / cpp, dy2,
 			  dst_gpu_addr);
 
 	/* scissors */
-	set_scissors(dev_priv, dx, dy, dx + w, dy + h);
+	set_scissors(dev_priv, dx, dy, dx2, dy2);
 
 	/* Vertex buffer setup */
 	vb_addr = dev_priv->gart_buffers_offset +
@@ -1984,7 +1994,7 @@ r600_blit_swap(struct drm_device *dev,
 
 	cp_set_surface_sync(dev_priv,
 			    R600_CB_ACTION_ENA | R600_CB0_DEST_BASE_ENA,
-			    dst_pitch * (dy + h), dst_gpu_addr);
+			    dst_pitch * dy2, dst_gpu_addr);
 
 	dev_priv->blit_vb->used += 12 * 4;
 }

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 18:30:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0C9CA106566B;
	Fri, 30 Oct 2009 18:30:14 +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 EFDBD8FC19;
	Fri, 30 Oct 2009 18:30: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 n9UIUDFJ054355;
	Fri, 30 Oct 2009 18:30:13 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UIUDFJ054353;
	Fri, 30 Oct 2009 18:30:13 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200910301830.n9UIUDFJ054353@svn.freebsd.org>
From: Robert Noland 
Date: Fri, 30 Oct 2009 18:30: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: r198697 - head/sys/dev/drm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 18:30:14 -0000

Author: rnoland
Date: Fri Oct 30 18:30:13 2009
New Revision: 198697
URL: http://svn.freebsd.org/changeset/base/198697

Log:
  Fix botched git -> svn merge.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/drm/drm_scatter.c

Modified: head/sys/dev/drm/drm_scatter.c
==============================================================================
--- head/sys/dev/drm/drm_scatter.c	Fri Oct 30 18:08:46 2009	(r198696)
+++ head/sys/dev/drm/drm_scatter.c	Fri Oct 30 18:30:13 2009	(r198697)
@@ -65,7 +65,7 @@ drm_sg_alloc(struct drm_device *dev, str
 	ret = bus_dma_tag_create(NULL, PAGE_SIZE, 0, /* tag, align, boundary */
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, /* lowaddr, highaddr */
 	    NULL, NULL, /* filtfunc, filtfuncargs */
-	    request->size, pages, /* maxsize, nsegs */
+	    request->size, entry->pages, /* maxsize, nsegs */
 	    PAGE_SIZE, 0, /* maxsegsize, flags */
 	    NULL, NULL, /* lockfunc, lockfuncargs */
 	    &dmah->tag);

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 19:25:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0DAB21065676;
	Fri, 30 Oct 2009 19:25:14 +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 D68DA8FC22;
	Fri, 30 Oct 2009 19:25: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 n9UJPDsk055527;
	Fri, 30 Oct 2009 19:25:13 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UJPDhm055523;
	Fri, 30 Oct 2009 19:25:13 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200910301925.n9UJPDhm055523@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 30 Oct 2009 19:25:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198698 - in stable/7/sys: . conf contrib/pf
	pc98/include pc98/pc98
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 19:25:14 -0000

Author: jhb
Date: Fri Oct 30 19:25:13 2009
New Revision: 198698
URL: http://svn.freebsd.org/changeset/base/198698

Log:
  MFC 192106: Port mca(4) to pc98.
  
  Pointy hat to:	jhb

Added:
  stable/7/sys/pc98/include/mca.h
     - copied unchanged from r192106, head/sys/pc98/include/mca.h
Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/files.pc98
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/pc98/pc98/machdep.c

Modified: stable/7/sys/conf/files.pc98
==============================================================================
--- stable/7/sys/conf/files.pc98	Fri Oct 30 18:30:13 2009	(r198697)
+++ stable/7/sys/conf/files.pc98	Fri Oct 30 19:25:13 2009	(r198698)
@@ -157,6 +157,7 @@ i386/i386/k6_mem.c		optional mem
 i386/i386/legacy.c		standard
 i386/i386/local_apic.c		optional apic
 i386/i386/locore.s		standard	no-obj
+i386/i386/mca.c			standard
 i386/i386/mem.c			optional mem
 i386/i386/minidump_machdep.c	standard
 i386/i386/mp_clock.c		optional smp

Copied: stable/7/sys/pc98/include/mca.h (from r192106, head/sys/pc98/include/mca.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/sys/pc98/include/mca.h	Fri Oct 30 19:25:13 2009	(r198698, copy of r192106, head/sys/pc98/include/mca.h)
@@ -0,0 +1,6 @@
+/*-
+ * This file is in the public domain.
+ */
+/* $FreeBSD$ */
+
+#include 

Modified: stable/7/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/7/sys/pc98/pc98/machdep.c	Fri Oct 30 18:30:13 2009	(r198697)
+++ stable/7/sys/pc98/pc98/machdep.c	Fri Oct 30 19:25:13 2009	(r198698)
@@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -257,6 +258,8 @@ cpu_startup(dummy)
 	vm_pager_bufferinit();
 
 	cpu_setregs();
+
+	mca_init();
 }
 
 /*

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 19:59:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15E3010656AA;
	Fri, 30 Oct 2009 19:59:51 +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 01AC88FC2B;
	Fri, 30 Oct 2009 19:59: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 n9UJxodv056194;
	Fri, 30 Oct 2009 19:59:50 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UJxocG056188;
	Fri, 30 Oct 2009 19:59:50 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <200910301959.n9UJxocG056188@svn.freebsd.org>
From: Rui Paulo 
Date: Fri, 30 Oct 2009 19:59:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198699 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net80211
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 19:59:51 -0000

Author: rpaulo
Date: Fri Oct 30 19:59:50 2009
New Revision: 198699
URL: http://svn.freebsd.org/changeset/base/198699

Log:
  MFC r198230, r198242, r198260, r198346, r198369, r198384:
  
      More mesh fixes to comply with latest draft.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net80211/ieee80211_hwmp.c
  stable/8/sys/net80211/ieee80211_mesh.c
  stable/8/sys/net80211/ieee80211_mesh.h
  stable/8/sys/net80211/ieee80211_output.c
  stable/8/sys/net80211/ieee80211_proto.h

Modified: stable/8/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_hwmp.c	Fri Oct 30 19:25:13 2009	(r198698)
+++ stable/8/sys/net80211/ieee80211_hwmp.c	Fri Oct 30 19:59:50 2009	(r198699)
@@ -148,7 +148,7 @@ typedef uint32_t ieee80211_hwmp_seq;
 struct ieee80211_hwmp_route {
 	ieee80211_hwmp_seq	hr_seq;		/* last HWMP seq seen from dst*/
 	ieee80211_hwmp_seq	hr_preqid;	/* last PREQ ID seen from dst */
-	ieee80211_hwmp_seq	hr_targetseq;	/* seq. no. on our latest PREQ*/
+	ieee80211_hwmp_seq	hr_origseq;	/* seq. no. on our latest PREQ*/
 	int			hr_preqretries;
 };
 struct ieee80211_hwmp_state {
@@ -548,7 +548,7 @@ hwmp_add_meshperr(uint8_t *frm, const st
 	*frm++ = perr->perr_ttl;
 	*frm++ = perr->perr_ndests;
 	for (i = 0; i < perr->perr_ndests; i++) {
-		*frm += perr->perr_dests[i].dest_flags;
+		*frm++ = perr->perr_dests[i].dest_flags;
 		IEEE80211_ADDR_COPY(frm, perr->perr_dests[i].dest_addr);
 		frm += 6;
 		ADDWORD(frm, perr->perr_dests[i].dest_seq);
@@ -653,6 +653,7 @@ hwmp_rootmode_rann_cb(void *arg)
 	IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss,
 	    "%s", "send broadcast RANN");
 
+	rann.rann_flags = 0;
 	if (ms->ms_flags & IEEE80211_MESHFLAGS_PORTAL)
 		rann.rann_flags |= IEEE80211_MESHRANN_FLAGS_PR;
 	rann.rann_hopcount = 0;
@@ -733,12 +734,12 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 		prep.prep_flags = 0;
 		prep.prep_hopcount = 0;
 		prep.prep_ttl = ms->ms_ttl;
-		IEEE80211_ADDR_COPY(prep.prep_targetaddr, preq->preq_origaddr);
-		prep.prep_targetseq = preq->preq_origseq;
+		IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr);
+		prep.prep_targetseq = ++hs->hs_seq;
 		prep.prep_lifetime = preq->preq_lifetime;
 		prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
-		IEEE80211_ADDR_COPY(prep.prep_origaddr, vap->iv_myaddr);
-		prep.prep_origseq = ++hs->hs_seq;
+		IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr);
+		prep.prep_origseq = preq->preq_origseq;
 		hwmp_send_prep(ni, vap->iv_myaddr, wh->i_addr2, &prep);
 		/*
 		 * Build the reverse path, if we don't have it already.
@@ -784,13 +785,13 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 			prep.prep_flags = 0;
 			prep.prep_hopcount = 0;
 			prep.prep_ttl = ms->ms_ttl;
-			IEEE80211_ADDR_COPY(prep.prep_origaddr, vap->iv_myaddr);
+			IEEE80211_ADDR_COPY(prep.prep_origaddr, rootmac);
 			prep.prep_origseq = preq->preq_origseq;
-			prep.prep_targetseq = ++hs->hs_seq;
 			prep.prep_lifetime = preq->preq_lifetime;
 			prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
-			IEEE80211_ADDR_COPY(prep.prep_targetaddr, rootmac);
-			prep.prep_targetseq = PREQ_TSEQ(0);
+			IEEE80211_ADDR_COPY(prep.prep_targetaddr,
+			    vap->iv_myaddr);
+			prep.prep_targetseq = ++hs->hs_seq;
 			hwmp_send_prep(vap->iv_bss, vap->iv_myaddr,
 			    broadcastaddr, &prep);
 		}
@@ -848,13 +849,13 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 				prep.prep_hopcount = rt->rt_nhops + 1;
 				prep.prep_ttl = ms->ms_ttl;
 				IEEE80211_ADDR_COPY(&prep.prep_targetaddr,
-				    preq->preq_origaddr);
+				    PREQ_TADDR(0));
 				prep.prep_targetseq = hrorig->hr_seq;
 				prep.prep_lifetime = preq->preq_lifetime;
 				prep.prep_metric = rt->rt_metric +
 				    ms->ms_pmetric->mpm_metric(ni);
 				IEEE80211_ADDR_COPY(&prep.prep_origaddr,
-				    PREQ_TADDR(0));
+				    preq->preq_origaddr);
 				prep.prep_origseq = hrorig->hr_seq;
 				hwmp_send_prep(ni, vap->iv_myaddr,
 				    broadcastaddr, &prep);
@@ -951,19 +952,19 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 		return;
 
 	IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-	    "received PREP from %s", ether_sprintf(prep->prep_origaddr));
+	    "received PREP from %s", ether_sprintf(prep->prep_targetaddr));
 
-	rt = ieee80211_mesh_rt_find(vap, prep->prep_origaddr);
+	rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr);
 	if (rt == NULL) {
 		/*
 		 * If we have no entry this could be a reply to a root PREQ.
 		 */
 		if (hs->hs_rootmode != IEEE80211_HWMP_ROOTMODE_DISABLED) {
-			rt = ieee80211_mesh_rt_add(vap, prep->prep_origaddr);
+			rt = ieee80211_mesh_rt_add(vap, prep->prep_targetaddr);
 			if (rt == NULL) {
 				IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP,
 				    ni, "unable to add PREP path to %s",
-				    ether_sprintf(prep->prep_origaddr));
+				    ether_sprintf(prep->prep_targetaddr));
 				vap->iv_stats.is_mesh_rtaddfailed++;
 				return;
 			}
@@ -974,7 +975,7 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 			rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID;
 			IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 			    "add root path to %s nhops %d metric %d (PREP)",
-			    ether_sprintf(prep->prep_origaddr),
+			    ether_sprintf(prep->prep_targetaddr),
 			    rt->rt_nhops, rt->rt_metric);
 			return;
 		} 
@@ -984,30 +985,30 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 	 * Sequence number validation.
 	 */
 	hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
-	if (HWMP_SEQ_LEQ(prep->prep_origseq, hr->hr_seq)) {
+	if (HWMP_SEQ_LEQ(prep->prep_targetseq, hr->hr_seq)) {
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 		    "discard PREP from %s, old seq no %u <= %u",
-		    ether_sprintf(prep->prep_origaddr),
-		    prep->prep_origseq, hr->hr_seq);
+		    ether_sprintf(prep->prep_targetaddr),
+		    prep->prep_targetseq, hr->hr_seq);
 		return;
 	}
-	hr->hr_seq = prep->prep_origseq;
+	hr->hr_seq = prep->prep_targetseq;
 	/*
 	 * If it's NOT for us, propagate the PREP.
 	 */
-	if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, prep->prep_targetaddr) &&
+	if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, prep->prep_origaddr) &&
 	    prep->prep_ttl > 1 && prep->prep_hopcount < hs->hs_maxhops) {
 		struct ieee80211_meshprep_ie pprep; /* propagated PREP */
 
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 		    "propagate PREP from %s",
-		    ether_sprintf(prep->prep_origaddr));
+		    ether_sprintf(prep->prep_targetaddr));
 
 		memcpy(&pprep, prep, sizeof(pprep));
 		pprep.prep_hopcount += 1;
 		pprep.prep_ttl -= 1;
 		pprep.prep_metric += ms->ms_pmetric->mpm_metric(ni);
-		IEEE80211_ADDR_COPY(pprep.prep_origaddr, vap->iv_myaddr);
+		IEEE80211_ADDR_COPY(pprep.prep_targetaddr, vap->iv_myaddr);
 		hwmp_send_prep(ni, vap->iv_myaddr, broadcastaddr, &pprep);
 	}
 	hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
@@ -1015,9 +1016,9 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 		/* NB: never clobber a proxy entry */;
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 		    "discard PREP for %s, route is marked PROXY",
-		    ether_sprintf(prep->prep_origaddr));
+		    ether_sprintf(prep->prep_targetaddr));
 		vap->iv_stats.is_hwmp_proxy++;
-	} else if (prep->prep_targetseq == hr->hr_targetseq) {
+	} else if (prep->prep_origseq == hr->hr_origseq) {
 		/*
 		 * Check if we already have a path to this node.
 		 * If we do, check if this path reply contains a
@@ -1041,14 +1042,14 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 		} else {
 			IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 			    "ignore PREP for %s, hopcount %d:%d metric %d:%d",
-			    ether_sprintf(prep->prep_origaddr),
+			    ether_sprintf(prep->prep_targetaddr),
 			    rt->rt_nhops, prep->prep_hopcount,
 			    rt->rt_metric, prep->prep_metric);
 		}
 	} else {
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 		    "discard PREP for %s, wrong seqno %u != %u",
-		    ether_sprintf(prep->prep_origaddr), prep->prep_targetseq,
+		    ether_sprintf(prep->prep_targetaddr), prep->prep_origseq,
 		    hr->hr_seq);
 		vap->iv_stats.is_hwmp_wrongseq++;
 	} 
@@ -1114,6 +1115,7 @@ hwmp_peerdown(struct ieee80211_node *ni)
 	    "%s", "delete route entry");
 	perr.perr_ttl = ms->ms_ttl;
 	perr.perr_ndests = 1;
+	PERR_DFLAGS(0) = 0;
 	if (hr->hr_seq == 0)
 		PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_USN;
 	PERR_DFLAGS(0) |= IEEE80211_MESHPERR_DFLAGS_RC;
@@ -1223,7 +1225,8 @@ hwmp_recv_rann(struct ieee80211vap *vap,
 	struct ieee80211_meshrann_ie prann;
 
 	if (ni == vap->iv_bss ||
-	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
+	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED ||
+	    IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
 		return;
 
 	rt = ieee80211_mesh_rt_find(vap, rann->rann_addr);
@@ -1305,8 +1308,8 @@ hwmp_discover(struct ieee80211vap *vap,
 		hr = IEEE80211_MESH_ROUTE_PRIV(rt,
 		    struct ieee80211_hwmp_route);
 		if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) {
-			if (hr->hr_targetseq == 0)
-				hr->hr_targetseq = ++hs->hs_seq;
+			if (hr->hr_origseq == 0)
+				hr->hr_origseq = ++hs->hs_seq;
 			rt->rt_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
 			rt->rt_lifetime =
 			    ticks_to_msecs(ieee80211_hwmp_pathtimeout);
@@ -1324,7 +1327,7 @@ hwmp_discover(struct ieee80211vap *vap,
 			preq.preq_ttl = ms->ms_ttl;
 			preq.preq_id = ++hs->hs_preqid;
 			IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr);
-			preq.preq_origseq = hr->hr_targetseq;
+			preq.preq_origseq = hr->hr_origseq;
 			preq.preq_lifetime = rt->rt_lifetime;
 			preq.preq_metric = rt->rt_metric;
 			preq.preq_tcount = 1;

Modified: stable/8/sys/net80211/ieee80211_mesh.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_mesh.c	Fri Oct 30 19:25:13 2009	(r198698)
+++ stable/8/sys/net80211/ieee80211_mesh.c	Fri Oct 30 19:59:50 2009	(r198699)
@@ -388,8 +388,6 @@ mesh_select_proto_path(struct ieee80211v
 	for (i = 0; i < N(mesh_proto_paths); i++) {
 		if (strcasecmp(mesh_proto_paths[i].mpp_descr, name) == 0) {
 			ms->ms_ppath = &mesh_proto_paths[i];
-			if (vap->iv_state == IEEE80211_S_RUN)
-				vap->iv_newstate(vap, IEEE80211_S_INIT, 0);
 			return 0;
 		}
 	}
@@ -405,8 +403,6 @@ mesh_select_proto_metric(struct ieee8021
 	for (i = 0; i < N(mesh_proto_metrics); i++) {
 		if (strcasecmp(mesh_proto_metrics[i].mpm_descr, name) == 0) {
 			ms->ms_pmetric = &mesh_proto_metrics[i];
-			if (vap->iv_state == IEEE80211_S_RUN)
-				vap->iv_newstate(vap, IEEE80211_S_INIT, 0);
 			return 0;
 		}
 	}
@@ -739,10 +735,12 @@ mesh_linkchange(struct ieee80211_node *n
 	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) {
 		KASSERT(ms->ms_neighbors < 65535, ("neighbor count overflow"));
 		ms->ms_neighbors++;
+		ieee80211_beacon_notify(vap, IEEE80211_BEACON_MESHCONF);
 	} else if (ni->ni_mlstate == IEEE80211_NODE_MESH_ESTABLISHED &&
 	    state != IEEE80211_NODE_MESH_ESTABLISHED) {
 		KASSERT(ms->ms_neighbors > 0, ("neighbor count 0"));
 		ms->ms_neighbors--;
+		ieee80211_beacon_notify(vap, IEEE80211_BEACON_MESHCONF);
 	}
 	ni->ni_mlstate = state;
 	switch (state) {
@@ -2552,6 +2550,18 @@ ieee80211_mesh_init_neighbor(struct ieee
 	ieee80211_parse_meshid(ni, sp->meshid);
 }
 
+void
+ieee80211_mesh_update_beacon(struct ieee80211vap *vap,
+	struct ieee80211_beacon_offsets *bo)
+{
+	KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap"));
+
+	if (isset(bo->bo_flags, IEEE80211_BEACON_MESHCONF)) {
+		(void)ieee80211_add_meshconf(bo->bo_meshconf, vap);
+		clrbit(bo->bo_flags, IEEE80211_BEACON_MESHCONF);
+	}
+}
+
 static int
 mesh_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {

Modified: stable/8/sys/net80211/ieee80211_mesh.h
==============================================================================
--- stable/8/sys/net80211/ieee80211_mesh.h	Fri Oct 30 19:25:13 2009	(r198698)
+++ stable/8/sys/net80211/ieee80211_mesh.h	Fri Oct 30 19:59:50 2009	(r198699)
@@ -470,6 +470,8 @@ struct ieee80211_scanparams;
 void		ieee80211_mesh_init_neighbor(struct ieee80211_node *,
 		   const struct ieee80211_frame *,
 		   const struct ieee80211_scanparams *);
+void		ieee80211_mesh_update_beacon(struct ieee80211vap *,
+		    struct ieee80211_beacon_offsets *);
 
 /*
  * Return non-zero if proxy operation is enabled.

Modified: stable/8/sys/net80211/ieee80211_output.c
==============================================================================
--- stable/8/sys/net80211/ieee80211_output.c	Fri Oct 30 19:25:13 2009	(r198698)
+++ stable/8/sys/net80211/ieee80211_output.c	Fri Oct 30 19:59:50 2009	(r198699)
@@ -2658,6 +2658,7 @@ ieee80211_beacon_construct(struct mbuf *
 #ifdef IEEE80211_SUPPORT_MESH
 	if (vap->iv_opmode == IEEE80211_M_MBSS) {
 		frm = ieee80211_add_meshid(frm, vap);
+		bo->bo_meshconf = frm;
 		frm = ieee80211_add_meshconf(frm, vap);
 	}
 #endif
@@ -2763,13 +2764,7 @@ ieee80211_beacon_alloc(struct ieee80211_
 	*(uint16_t *)wh->i_dur = 0;
 	IEEE80211_ADDR_COPY(wh->i_addr1, ifp->if_broadcastaddr);
 	IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr);
-#ifdef IEEE80211_SUPPORT_MESH
-	if (vap->iv_opmode == IEEE80211_M_MBSS) {
-		static const uint8_t zerobssid[IEEE80211_ADDR_LEN];
-		IEEE80211_ADDR_COPY(wh->i_addr3, zerobssid);
-	} else
-#endif
-		IEEE80211_ADDR_COPY(wh->i_addr3, ni->ni_bssid);
+	IEEE80211_ADDR_COPY(wh->i_addr3, ni->ni_bssid);
 	*(uint16_t *)wh->i_seq = 0;
 
 	return m;
@@ -2874,6 +2869,11 @@ ieee80211_beacon_update(struct ieee80211
 		ieee80211_tdma_update_beacon(vap, bo);
 	}
 #endif
+#ifdef IEEE80211_SUPPORT_MESH
+	if (vap->iv_opmode == IEEE80211_M_MBSS)
+		ieee80211_mesh_update_beacon(vap, bo);
+#endif
+
 	if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
 	    vap->iv_opmode == IEEE80211_M_MBSS) {	/* NB: no IBSS support*/
 		struct ieee80211_tim_ie *tie =
@@ -2928,6 +2928,9 @@ ieee80211_beacon_update(struct ieee80211
 #ifdef IEEE80211_TDMA_SUPPORT
 				bo->bo_tdma += adjust;
 #endif
+#ifdef IEEE80211_MESH_SUPPORT
+				bo->bo_meshconf += adjust;
+#endif
 				bo->bo_appie += adjust;
 				bo->bo_wme += adjust;
 				bo->bo_csa += adjust;
@@ -2979,6 +2982,9 @@ ieee80211_beacon_update(struct ieee80211
 #ifdef IEEE80211_TDMA_SUPPORT
 				bo->bo_tdma += sizeof(*csa);
 #endif
+#ifdef IEEE80211_MESH_SUPPORT
+				bo->bo_meshconf += sizeof(*csa);
+#endif
 				bo->bo_appie += sizeof(*csa);
 				bo->bo_csa_trailer_len += sizeof(*csa);
 				bo->bo_tim_trailer_len += sizeof(*csa);

Modified: stable/8/sys/net80211/ieee80211_proto.h
==============================================================================
--- stable/8/sys/net80211/ieee80211_proto.h	Fri Oct 30 19:25:13 2009	(r198698)
+++ stable/8/sys/net80211/ieee80211_proto.h	Fri Oct 30 19:59:50 2009	(r198699)
@@ -317,7 +317,8 @@ struct ieee80211_beacon_offsets {
 	uint16_t	bo_appie_len;	/* AppIE length in bytes */
 	uint16_t	bo_csa_trailer_len;;
 	uint8_t		*bo_csa;	/* start of CSA element */
-	uint8_t		*bo_spare[4];
+	uint8_t		*bo_meshconf;	/* start of MESHCONF element */
+	uint8_t		*bo_spare[3];
 };
 struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *,
 		struct ieee80211_beacon_offsets *);
@@ -345,6 +346,7 @@ enum {
 	IEEE80211_BEACON_CSA	= 7,	/* Channel Switch Announcement */
 	IEEE80211_BEACON_TDMA	= 9,	/* TDMA Info */
 	IEEE80211_BEACON_ATH	= 10,	/* ATH parameters */
+	IEEE80211_BEACON_MESHCONF = 11,	/* Mesh Configuration */
 };
 int	ieee80211_beacon_update(struct ieee80211_node *,
 		struct ieee80211_beacon_offsets *, struct mbuf *, int mcast);

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 20:28:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4E2BB106566B;
	Fri, 30 Oct 2009 20:28:50 +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 3C8E28FC0A;
	Fri, 30 Oct 2009 20:28: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 n9UKSnVX056828;
	Fri, 30 Oct 2009 20:28:49 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UKSnce056824;
	Fri, 30 Oct 2009 20:28:49 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910302028.n9UKSnce056824@svn.freebsd.org>
From: Alexander Motin 
Date: Fri, 30 Oct 2009 20:28: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: r198700 - in head/sys/dev/ata: . chipsets
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 20:28:50 -0000

Author: mav
Date: Fri Oct 30 20:28:49 2009
New Revision: 198700
URL: http://svn.freebsd.org/changeset/base/198700

Log:
  Add support for different request block format used by Gen-IIe Marvell SATA.
  This adds support for Marvell 6042/7042 chips and Adaptec 1430SA controller.

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

Modified: head/sys/dev/ata/ata-pci.h
==============================================================================
--- head/sys/dev/ata/ata-pci.h	Fri Oct 30 19:59:50 2009	(r198699)
+++ head/sys/dev/ata/ata-pci.h	Fri Oct 30 20:28:49 2009	(r198700)
@@ -97,6 +97,7 @@ struct ata_pci_controller {
 
 #define ATA_ADAPTEC_ID          0x9005
 #define ATA_ADAPTEC_1420        0x02419005
+#define ATA_ADAPTEC_1430        0x02439005
 
 #define ATA_ATI_ID              0x1002
 #define ATA_ATI_IXP200          0x43491002
@@ -216,7 +217,9 @@ struct ata_pci_controller {
 #define ATA_M88SX5080           0x508011ab
 #define ATA_M88SX5081           0x508111ab
 #define ATA_M88SX6041           0x604111ab
+#define ATA_M88SX6042           0x604211ab
 #define ATA_M88SX6081           0x608111ab
+#define ATA_M88SX7042           0x704211ab
 #define ATA_M88SX6101           0x610111ab
 #define ATA_M88SX6121           0x612111ab
 #define ATA_M88SX6145           0x614511ab

Modified: head/sys/dev/ata/chipsets/ata-adaptec.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-adaptec.c	Fri Oct 30 19:59:50 2009	(r198699)
+++ head/sys/dev/ata/chipsets/ata-adaptec.c	Fri Oct 30 20:28:49 2009	(r198700)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 
 /* misc defines */
 #define MV_60XX		60		//must match ata_marvell.c's definition
+#define MV_7042		72		//must match ata_marvell.c's definition
 
 
 /*
@@ -64,6 +65,7 @@ ata_adaptec_probe(device_t dev)
     struct ata_pci_controller *ctlr = device_get_softc(dev);
     static struct ata_chip_id ids[] =
     {{ ATA_ADAPTEC_1420, 0, 4, MV_60XX, ATA_SA300, "1420SA" },
+     { ATA_ADAPTEC_1430, 0, 4, MV_7042, ATA_SA300, "1430SA" },
      { 0, 0, 0, 0, 0, 0}};
 
     if (pci_get_vendor(dev) != ATA_ADAPTEC_ID)

Modified: head/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-marvell.c	Fri Oct 30 19:59:50 2009	(r198699)
+++ head/sys/dev/ata/chipsets/ata-marvell.c	Fri Oct 30 20:28:49 2009	(r198700)
@@ -67,6 +67,8 @@ static void ata_marvell_edma_dmainit(dev
 /* misc defines */
 #define MV_50XX		50
 #define MV_60XX		60
+#define MV_6042		62
+#define MV_7042		72
 #define MV_61XX		61
 
 
@@ -102,7 +104,9 @@ ata_marvell_probe(device_t dev)
      { ATA_M88SX5080, 0, 8, MV_50XX, ATA_SA150, "88SX5080" },
      { ATA_M88SX5081, 0, 8, MV_50XX, ATA_SA150, "88SX5081" },
      { ATA_M88SX6041, 0, 4, MV_60XX, ATA_SA300, "88SX6041" },
+     { ATA_M88SX6042, 0, 4, MV_6042, ATA_SA300, "88SX6042" },
      { ATA_M88SX6081, 0, 8, MV_60XX, ATA_SA300, "88SX6081" },
+     { ATA_M88SX7042, 0, 4, MV_7042, ATA_SA300, "88SX7042" },
      { ATA_M88SX6101, 0, 1, MV_61XX, ATA_UDMA6, "88SX6101" },
      { ATA_M88SX6121, 0, 1, MV_61XX, ATA_UDMA6, "88SX6121" },
      { ATA_M88SX6145, 0, 2, MV_61XX, ATA_UDMA6, "88SX6145" },
@@ -119,6 +123,8 @@ ata_marvell_probe(device_t dev)
     switch (ctlr->chip->cfg2) {
     case MV_50XX:
     case MV_60XX:
+    case MV_6042:
+    case MV_7042:
 	ctlr->chipinit = ata_marvell_edma_chipinit;
 	break;
     case MV_61XX:
@@ -251,6 +257,8 @@ ata_marvell_edma_ch_attach(device_t dev)
 	ch->r_io[ATA_SCONTROL].offset = 0x00108 + ATA_MV_HOST_BASE(ch);
 	break;
     case MV_60XX:
+    case MV_6042:
+    case MV_7042:
 	ch->r_io[ATA_SSTATUS].res = ctlr->r_res1;
 	ch->r_io[ATA_SSTATUS].offset =  0x02300 + ATA_MV_EDMA_BASE(ch);
 	ch->r_io[ATA_SERROR].res = ctlr->r_res1;
@@ -384,35 +392,61 @@ ata_marvell_edma_begin_transaction(struc
 	request->dma->sg_bus & 0xffffffff);
     le32enc(bytep + 1 * sizeof(u_int32_t),
 	(u_int64_t)request->dma->sg_bus >> 32);
-    le16enc(bytep + 4 * sizeof(u_int16_t),
-	(request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag << 1));
-
-    i = 10;
-    bytep[i++] = (request->u.ata.count >> 8) & 0xff;
-    bytep[i++] = 0x10 | ATA_COUNT;
-    bytep[i++] = request->u.ata.count & 0xff;
-    bytep[i++] = 0x10 | ATA_COUNT;
-
-    bytep[i++] = (request->u.ata.lba >> 24) & 0xff;
-    bytep[i++] = 0x10 | ATA_SECTOR;
-    bytep[i++] = request->u.ata.lba & 0xff;
-    bytep[i++] = 0x10 | ATA_SECTOR;
-
-    bytep[i++] = (request->u.ata.lba >> 32) & 0xff;
-    bytep[i++] = 0x10 | ATA_CYL_LSB;
-    bytep[i++] = (request->u.ata.lba >> 8) & 0xff;
-    bytep[i++] = 0x10 | ATA_CYL_LSB;
-
-    bytep[i++] = (request->u.ata.lba >> 40) & 0xff;
-    bytep[i++] = 0x10 | ATA_CYL_MSB;
-    bytep[i++] = (request->u.ata.lba >> 16) & 0xff;
-    bytep[i++] = 0x10 | ATA_CYL_MSB;
-
-    bytep[i++] = ATA_D_LBA | ATA_D_IBM | ((request->u.ata.lba >> 24) & 0xf);
-    bytep[i++] = 0x10 | ATA_DRIVE;
-
-    bytep[i++] = request->u.ata.command;
-    bytep[i++] = 0x90 | ATA_COMMAND;
+    if (ctlr->chip->cfg2 != MV_6042 && ctlr->chip->cfg2 != MV_7042) {
+	    le16enc(bytep + 4 * sizeof(u_int16_t),
+		(request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag << 1));
+
+	    i = 10;
+	    bytep[i++] = (request->u.ata.count >> 8) & 0xff;
+	    bytep[i++] = 0x10 | ATA_COUNT;
+	    bytep[i++] = request->u.ata.count & 0xff;
+	    bytep[i++] = 0x10 | ATA_COUNT;
+
+	    bytep[i++] = (request->u.ata.lba >> 24) & 0xff;
+	    bytep[i++] = 0x10 | ATA_SECTOR;
+	    bytep[i++] = request->u.ata.lba & 0xff;
+	    bytep[i++] = 0x10 | ATA_SECTOR;
+
+	    bytep[i++] = (request->u.ata.lba >> 32) & 0xff;
+	    bytep[i++] = 0x10 | ATA_CYL_LSB;
+	    bytep[i++] = (request->u.ata.lba >> 8) & 0xff;
+	    bytep[i++] = 0x10 | ATA_CYL_LSB;
+
+	    bytep[i++] = (request->u.ata.lba >> 40) & 0xff;
+	    bytep[i++] = 0x10 | ATA_CYL_MSB;
+	    bytep[i++] = (request->u.ata.lba >> 16) & 0xff;
+	    bytep[i++] = 0x10 | ATA_CYL_MSB;
+
+	    bytep[i++] = ATA_D_LBA | ATA_D_IBM | ((request->u.ata.lba >> 24) & 0xf);
+	    bytep[i++] = 0x10 | ATA_DRIVE;
+
+	    bytep[i++] = request->u.ata.command;
+	    bytep[i++] = 0x90 | ATA_COMMAND;
+    } else {
+	    le32enc(bytep + 2 * sizeof(u_int32_t),
+		(request->flags & ATA_R_READ ? 0x01 : 0x00) | (request->tag << 1));
+
+	    i = 16;
+	    bytep[i++] = 0;
+	    bytep[i++] = 0;
+	    bytep[i++] = request->u.ata.command;
+	    bytep[i++] = request->u.ata.feature & 0xff;
+
+	    bytep[i++] = request->u.ata.lba & 0xff;
+	    bytep[i++] = (request->u.ata.lba >> 8) & 0xff;
+	    bytep[i++] = (request->u.ata.lba >> 16) & 0xff;
+	    bytep[i++] = ATA_D_LBA | ATA_D_IBM | ((request->u.ata.lba >> 24) & 0x0f);
+
+	    bytep[i++] = (request->u.ata.lba >> 24) & 0xff;
+	    bytep[i++] = (request->u.ata.lba >> 32) & 0xff;
+	    bytep[i++] = (request->u.ata.lba >> 40) & 0xff;
+	    bytep[i++] = (request->u.ata.feature >> 8) & 0xff;
+
+	    bytep[i++] = request->u.ata.count & 0xff;
+	    bytep[i++] = (request->u.ata.count >> 8) & 0xff;
+	    bytep[i++] = 0;
+	    bytep[i++] = 0;
+    }
 
     bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
 	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -557,7 +591,8 @@ ata_marvell_edma_dmainit(device_t dev)
 	ch->dma.max_address = BUS_SPACE_MAXADDR;
 
     /* chip does not reliably do 64K DMA transfers */
-    ch->dma.max_iosize = 64 * DEV_BSIZE; 
+    if (ctlr->chip->cfg2 == MV_50XX || ctlr->chip->cfg2 == MV_60XX)
+	ch->dma.max_iosize = 64 * DEV_BSIZE; 
 }
 
 ATA_DECLARE_DRIVER(ata_marvell);

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 21:54:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15A5C1065670;
	Fri, 30 Oct 2009 21:54:54 +0000 (UTC)
	(envelope-from mckusick@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 04E2E8FC13;
	Fri, 30 Oct 2009 21:54: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 n9ULsrU2058508;
	Fri, 30 Oct 2009 21:54:53 GMT
	(envelope-from mckusick@svn.freebsd.org)
Received: (from mckusick@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9ULsrvF058506;
	Fri, 30 Oct 2009 21:54:53 GMT
	(envelope-from mckusick@svn.freebsd.org)
Message-Id: <200910302154.n9ULsrvF058506@svn.freebsd.org>
From: Kirk McKusick 
Date: Fri, 30 Oct 2009 21:54: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: r198702 - head/usr.bin/logger
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 21:54:54 -0000

Author: mckusick
Date: Fri Oct 30 21:54:53 2009
New Revision: 198702
URL: http://svn.freebsd.org/changeset/base/198702

Log:
  When reading input from a file or device (via -f option) set the
  input to be in non-buffering mode so that input lines are logged
  as they occur rather than being saved up until a buffer's worth of
  input has been logged.

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

Modified: head/usr.bin/logger/logger.c
==============================================================================
--- head/usr.bin/logger/logger.c	Fri Oct 30 21:00:58 2009	(r198701)
+++ head/usr.bin/logger/logger.c	Fri Oct 30 21:54:53 2009	(r198702)
@@ -114,6 +114,7 @@ main(int argc, char *argv[])
 		case 'f':		/* file to log */
 			if (freopen(optarg, "r", stdin) == NULL)
 				err(1, "%s", optarg);
+			setvbuf(stdin, 0, _IONBF, 0);
 			break;
 		case 'h':		/* hostname to deliver to */
 			host = optarg;

From owner-svn-src-all@FreeBSD.ORG  Fri Oct 30 23:33:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F3C2F1065670;
	Fri, 30 Oct 2009 23:33:06 +0000 (UTC) (envelope-from pjd@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E12928FC08;
	Fri, 30 Oct 2009 23:33: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 n9UNX6gh061976;
	Fri, 30 Oct 2009 23:33:06 GMT (envelope-from pjd@svn.freebsd.org)
Received: (from pjd@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9UNX6BX061974;
	Fri, 30 Oct 2009 23:33:06 GMT (envelope-from pjd@svn.freebsd.org)
Message-Id: <200910302333.n9UNX6BX061974@svn.freebsd.org>
From: Pawel Jakub Dawidek 
Date: Fri, 30 Oct 2009 23:33: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: r198703 - in head/sys/cddl: compat/opensolaris/sys
	contrib/opensolaris/uts/common/fs/zfs
	contrib/opensolaris/uts/common/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 30 Oct 2009 23:33:07 -0000

Author: pjd
Date: Fri Oct 30 23:33:06 2009
New Revision: 198703
URL: http://svn.freebsd.org/changeset/base/198703

Log:
  - zfs_zaccess() can handle VAPPEND too, so map V_APPEND to VAPPEND and call
    zfs_access() instead of vaccess() in this case as well.
  - If VADMIN is specified with another V* flag (unlikely) call both
    zfs_access() and vaccess() after spliting V* flags.
  
  This fixes "dirtying snapshot!" panic.
  
  PR:		kern/139806
  Reported by:	Carl Chave 
  In co-operation with:	jh
  MFC after:	3 days

Modified:
  head/sys/cddl/compat/opensolaris/sys/vnode.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h

Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/vnode.h	Fri Oct 30 21:54:53 2009	(r198702)
+++ head/sys/cddl/compat/opensolaris/sys/vnode.h	Fri Oct 30 23:33:06 2009	(r198703)
@@ -57,6 +57,8 @@ typedef	struct vop_vector	vnodeops_t;
 
 #define	v_count	v_usecount
 
+#define	V_APPEND	VAPPEND
+
 static __inline int
 vn_is_readonly(vnode_t *vp)
 {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Fri Oct 30 21:54:53 2009	(r198702)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	Fri Oct 30 23:33:06 2009	(r198703)
@@ -3989,21 +3989,33 @@ zfs_freebsd_access(ap)
 		struct thread *a_td;
 	} */ *ap;
 {
+	accmode_t accmode;
+	int error = 0;
 
 	/*
-	 * ZFS itself only knowns about VREAD, VWRITE and VEXEC, the rest
-	 * we have to handle by calling vaccess().
+	 * ZFS itself only knowns about VREAD, VWRITE, VEXEC and VAPPEND,
 	 */
-	if ((ap->a_accmode & ~(VREAD|VWRITE|VEXEC)) != 0) {
-		vnode_t *vp = ap->a_vp;
-		znode_t *zp = VTOZ(vp);
-		znode_phys_t *zphys = zp->z_phys;
+	accmode = ap->a_accmode & (VREAD|VWRITE|VEXEC|VAPPEND);
+	if (accmode != 0)
+		error = zfs_access(ap->a_vp, accmode, 0, ap->a_cred, NULL);
 
-		return (vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid,
-		    zphys->zp_gid, ap->a_accmode, ap->a_cred, NULL));
+	/*
+	 * VADMIN has to be handled by vaccess().
+	 */
+	if (error == 0) {
+		accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND);
+		if (accmode != 0) {
+			vnode_t *vp = ap->a_vp;
+			znode_t *zp = VTOZ(vp);
+			znode_phys_t *zphys = zp->z_phys;
+
+			error = vaccess(vp->v_type, zphys->zp_mode,
+			    zphys->zp_uid, zphys->zp_gid, accmode, ap->a_cred,
+			    NULL);
+		}
 	}
 
-	return (zfs_access(ap->a_vp, ap->a_accmode, 0, ap->a_cred, NULL));
+	return (error);
 }
 
 static int

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h	Fri Oct 30 21:54:53 2009	(r198702)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h	Fri Oct 30 23:33:06 2009	(r198703)
@@ -304,7 +304,6 @@ typedef struct xvattr {
  * VOP_ACCESS flags
  */
 #define	V_ACE_MASK	0x1	/* mask represents  NFSv4 ACE permissions */
-#define	V_APPEND	0x2	/* want to do append only check */
 
 /*
  * Flags for vnode operations.

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 06:35:40 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F186B106566B;
	Sat, 31 Oct 2009 06:35:40 +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 DD65E8FC16;
	Sat, 31 Oct 2009 06:35: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 n9V6Ze6g071323;
	Sat, 31 Oct 2009 06:35:40 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9V6ZewN071320;
	Sat, 31 Oct 2009 06:35:40 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200910310635.n9V6ZewN071320@svn.freebsd.org>
From: Edwin Groothuis 
Date: Sat, 31 Oct 2009 06:35:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198704 - in stable/8: include lib/libc lib/libc/gen
	lib/libc/locale lib/libc/stdio lib/libc/stdtime
	lib/libc/string usr.bin/locale
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 06:35:41 -0000

Author: edwin
Date: Sat Oct 31 06:35:40 2009
New Revision: 198704
URL: http://svn.freebsd.org/changeset/base/198704

Log:
  MFCs of r197764, r197765, r197766, r197847:
  
  Modified locale(1) to be able to show the altmon_X fields and the
  [cxX]_fmt's.  Also modify the "-k list" option to display only
  fields with a certain prefix.
  
  Add the comment "(FreeBSD only)" to the altmonth_x keywords

Modified:
  stable/8/include/   (props changed)
  stable/8/include/langinfo.h
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/gen/   (props changed)
  stable/8/lib/libc/locale/nl_langinfo.c
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/stdtime/localtime.c
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)
  stable/8/usr.bin/locale/   (props changed)
  stable/8/usr.bin/locale/locale.1
  stable/8/usr.bin/locale/locale.c

Modified: stable/8/include/langinfo.h
==============================================================================
--- stable/8/include/langinfo.h	Fri Oct 30 23:33:06 2009	(r198703)
+++ stable/8/include/langinfo.h	Sat Oct 31 06:35:40 2009	(r198704)
@@ -114,6 +114,20 @@ typedef	__nl_item	nl_item;
 #define	D_MD_ORDER	57	/* month/day order (local extension) */
 #endif
 
+/* standalone months forms for %OB */
+#define	ALTMON_1	58
+#define	ALTMON_2	59
+#define	ALTMON_3	60
+#define	ALTMON_4	61
+#define	ALTMON_5	62
+#define	ALTMON_6	63
+#define	ALTMON_7	64
+#define	ALTMON_8	65
+#define	ALTMON_9	66
+#define	ALTMON_10	67
+#define	ALTMON_11	68
+#define	ALTMON_12	69
+
 __BEGIN_DECLS
 char	*nl_langinfo(nl_item);
 __END_DECLS

Modified: stable/8/lib/libc/locale/nl_langinfo.c
==============================================================================
--- stable/8/lib/libc/locale/nl_langinfo.c	Fri Oct 30 23:33:06 2009	(r198703)
+++ stable/8/lib/libc/locale/nl_langinfo.c	Sat Oct 31 06:35:40 2009	(r198704)
@@ -93,6 +93,12 @@ nl_langinfo(nl_item item)
 	case ABMON_9: case ABMON_10: case ABMON_11: case ABMON_12:
 		ret = (char*) __get_current_time_locale()->mon[_REL(ABMON_1)];
 		break;
+	case ALTMON_1: case ALTMON_2: case ALTMON_3: case ALTMON_4:
+	case ALTMON_5: case ALTMON_6: case ALTMON_7: case ALTMON_8:
+	case ALTMON_9: case ALTMON_10: case ALTMON_11: case ALTMON_12:
+		ret = (char*)
+		    __get_current_time_locale()->alt_month[_REL(ALTMON_1)];
+		break;
 	case ERA:
 		/* XXX: need to be implemented  */
 		ret = "";

Modified: stable/8/lib/libc/stdtime/localtime.c
==============================================================================
--- stable/8/lib/libc/stdtime/localtime.c	Fri Oct 30 23:33:06 2009	(r198703)
+++ stable/8/lib/libc/stdtime/localtime.c	Sat Oct 31 06:35:40 2009	(r198704)
@@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$");
 #include "namespace.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "private.h"
@@ -1413,13 +1414,16 @@ 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 (_pthread_key_create(&localtime_key, free) < 0) {
+				if ((r = _pthread_key_create(&localtime_key,
+				    free)) != 0) {
 					_pthread_mutex_unlock(&localtime_mutex);
+					errno = r;
 					return(NULL);
 				}
 			}
@@ -1512,13 +1516,16 @@ const time_t * const	timep;
 	static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER;
 	static pthread_key_t gmtime_key = -1;
 	struct tm *p_tm;
+	int r;
 
 	if (__isthreaded != 0) {
 		if (gmtime_key < 0) {
 			_pthread_mutex_lock(&gmtime_mutex);
 			if (gmtime_key < 0) {
-				if (_pthread_key_create(&gmtime_key, free) < 0) {
+				if ((r = _pthread_key_create(&gmtime_key,
+				    free)) != 0) {
 					_pthread_mutex_unlock(&gmtime_mutex);
+					errno = r;
 					return(NULL);
 				}
 			}

Modified: stable/8/usr.bin/locale/locale.1
==============================================================================
--- stable/8/usr.bin/locale/locale.1	Fri Oct 30 23:33:06 2009	(r198703)
+++ stable/8/usr.bin/locale/locale.1	Sat Oct 31 06:35:40 2009	(r198704)
@@ -35,8 +35,12 @@
 .Nm
 .Op Fl a | m
 .Nm
-.Op Fl ck
-.Op Ar keyword ...
+.Fl k 
+.Ic list
+.Op Ar prefix
+.Nm
+.Op Fl ck 
+.Ar keyword ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -79,6 +83,8 @@ The special
 specific) keyword
 .Cm list
 can be used to retrieve the human readable list of all available keywords.
+If so,
+a prefix string can be defined to limit the amount of keywords returned.
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO

Modified: stable/8/usr.bin/locale/locale.c
==============================================================================
--- stable/8/usr.bin/locale/locale.c	Fri Oct 30 23:33:06 2009	(r198703)
+++ stable/8/usr.bin/locale/locale.c	Sat Oct 31 06:35:40 2009	(r198704)
@@ -55,7 +55,7 @@ const char *lookup_localecat(int);
 char	*kwval_lconv(int);
 int	kwval_lookup(char *, char **, int *, int *);
 void	showdetails(char *);
-void	showkeywordslist(void);
+void	showkeywordslist(char *substring);
 void	showlocale(void);
 void	usage(void);
 
@@ -190,6 +190,18 @@ struct _kwinfo {
 	{ "abmon_10",		1, LC_TIME,	ABMON_10, "" },
 	{ "abmon_11",		1, LC_TIME,	ABMON_11, "" },
 	{ "abmon_12",		1, LC_TIME,	ABMON_12, "" },
+	{ "altmon_1",		1, LC_TIME,	ALTMON_1, "(FreeBSD only)" },
+	{ "altmon_2",		1, LC_TIME,	ALTMON_2, "(FreeBSD only)" },
+	{ "altmon_3",		1, LC_TIME,	ALTMON_3, "(FreeBSD only)" },
+	{ "altmon_4",		1, LC_TIME,	ALTMON_4, "(FreeBSD only)" },
+	{ "altmon_5",		1, LC_TIME,	ALTMON_5, "(FreeBSD only)" },
+	{ "altmon_6",		1, LC_TIME,	ALTMON_6, "(FreeBSD only)" },
+	{ "altmon_7",		1, LC_TIME,	ALTMON_7, "(FreeBSD only)" },
+	{ "altmon_8",		1, LC_TIME,	ALTMON_8, "(FreeBSD only)" },
+	{ "altmon_9",		1, LC_TIME,	ALTMON_9, "(FreeBSD only)" },
+	{ "altmon_10",		1, LC_TIME,	ALTMON_10, "(FreeBSD only)" },
+	{ "altmon_11",		1, LC_TIME,	ALTMON_11, "(FreeBSD only)" },
+	{ "altmon_12",		1, LC_TIME,	ALTMON_12, "(FreeBSD only)" },
 	{ "era",		1, LC_TIME,	ERA, "(unavailable)" },
 	{ "era_d_fmt",		1, LC_TIME,	ERA_D_FMT, "(unavailable)" },
 	{ "era_d_t_fmt",	1, LC_TIME,	ERA_D_T_FMT, "(unavailable)" },
@@ -217,7 +229,7 @@ main(int argc, char *argv[])
 	int	ch;
 	int	tmp;
 
-	while ((ch = getopt(argc, argv, "ackm")) != -1) {
+	while ((ch = getopt(argc, argv, "ackms:")) != -1) {
 		switch (ch) {
 		case 'a':
 			all_locales = 1;
@@ -265,7 +277,7 @@ main(int argc, char *argv[])
 	if (prt_keywords && argc > 0)
 		while (tmp < argc)
 			if (strcasecmp(argv[tmp++], "list") == 0) {
-				showkeywordslist();
+				showkeywordslist(argv[tmp]);
 				exit(0);
 			}
 
@@ -290,7 +302,8 @@ void
 usage(void)
 {
 	printf("Usage: locale [ -a | -m ]\n"
-               "       locale [ -ck ] name ...\n");
+               "       locale -k list [prefix]\n"
+               "       locale [ -ck ] keyword ...\n");
 	exit(1);
 }
 
@@ -594,6 +607,7 @@ showdetails(char *kw)
 		 * invalid keyword specified.
 		 * XXX: any actions?
 		 */
+		fprintf(stderr, "Unknown keyword: `%s'\n", kw);
 		return;
 	}
 
@@ -639,16 +653,25 @@ lookup_localecat(int cat)
  * Show list of keywords
  */
 void
-showkeywordslist(void)
+showkeywordslist(char *substring)
 {
 	size_t	i;
 
 #define FMT "%-20s %-12s %-7s %-20s\n"
 
-	printf("List of available keywords\n\n");
+	if (substring == NULL)
+		printf("List of available keywords\n\n");
+	else
+		printf("List of available keywords starting with '%s'\n\n",
+		    substring);
 	printf(FMT, "Keyword", "Category", "Type", "Comment");
 	printf("-------------------- ------------ ------- --------------------\n");
 	for (i = 0; i < NKWINFO; i++) {
+		if (substring != NULL) {
+			if (strncmp(kwinfo[i].name, substring,
+			    strlen(substring)) != 0)
+				continue;
+		}
 		printf(FMT,
 			kwinfo[i].name,
 			lookup_localecat(kwinfo[i].catid),

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 09:03:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFE5D106568B;
	Sat, 31 Oct 2009 09:03:48 +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 A9B558FC1A;
	Sat, 31 Oct 2009 09:03: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 n9V93mUA076416;
	Sat, 31 Oct 2009 09:03:48 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9V93m6m076414;
	Sat, 31 Oct 2009 09:03:48 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910310903.n9V93m6m076414@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 09:03: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: r198705 - head/sys/cam
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 09:03:49 -0000

Author: mav
Date: Sat Oct 31 09:03:48 2009
New Revision: 198705
URL: http://svn.freebsd.org/changeset/base/198705

Log:
  MFp4:
  Ensure target/lun passed from user-level supported on this bus.
  Scanning unsupported IDs causes different issues from duplicate
  devices to system crash.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Sat Oct 31 06:35:40 2009	(r198704)
+++ head/sys/cam/cam_xpt.c	Sat Oct 31 09:03:48 2009	(r198705)
@@ -452,7 +452,34 @@ xptioctl(struct cdev *dev, u_long cmd, c
 			ccb = xpt_alloc_ccb();
 
 			CAM_SIM_LOCK(bus->sim);
-
+			/* Ensure passed in target/lun supported on this bus. */
+			if ((inccb->ccb_h.target_id != CAM_TARGET_WILDCARD) ||
+			    (inccb->ccb_h.target_lun != CAM_LUN_WILDCARD)) {
+				if (xpt_create_path(&ccb->ccb_h.path,
+					    xpt_periph,
+					    inccb->ccb_h.path_id,
+					    CAM_TARGET_WILDCARD,
+					    CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+					error = EINVAL;
+					CAM_SIM_UNLOCK(bus->sim);
+					xpt_free_ccb(ccb);
+					break;
+				}
+				xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path,
+				    inccb->ccb_h.pinfo.priority);
+				ccb->ccb_h.func_code = XPT_PATH_INQ;
+				xpt_action(ccb);
+				xpt_free_path(ccb->ccb_h.path);
+				if ((inccb->ccb_h.target_id != CAM_TARGET_WILDCARD &&
+				    inccb->ccb_h.target_id > ccb->cpi.max_target) ||
+				    (inccb->ccb_h.target_lun != CAM_LUN_WILDCARD &&
+				    inccb->ccb_h.target_lun > ccb->cpi.max_lun)) {
+					error = EINVAL;
+					CAM_SIM_UNLOCK(bus->sim);
+					xpt_free_ccb(ccb);
+					break;
+				}
+			}
 			/*
 			 * Create a path using the bus, target, and lun the
 			 * user passed in.

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 10:35:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E50D9106568B;
	Sat, 31 Oct 2009 10:35:41 +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 D50D18FC22;
	Sat, 31 Oct 2009 10:35: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 n9VAZfkc082934;
	Sat, 31 Oct 2009 10:35:41 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VAZfIb082932;
	Sat, 31 Oct 2009 10:35:41 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200910311035.n9VAZfIb082932@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 31 Oct 2009 10:35: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: r198706 - head/sys/sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 10:35:42 -0000

Author: ed
Date: Sat Oct 31 10:35:41 2009
New Revision: 198706
URL: http://svn.freebsd.org/changeset/base/198706

Log:
  Turn unused structure fields of cdevsw into spares.
  
  d_uid, d_gid and d_mode are unused, because permissions are stored in
  cdevpriv nowadays. d_kind doesn't seem to be used at all. We no longer
  keep a list of cdevsw's, so d_list is also unused.
  
  uid_t and gid_t are 32 bits, but mode_t is 16 bits, Because of alignment
  constraints of d_kind, we can safely turn it into three 32-bit integers.
  d_kind and d_list is equal in size to three pointers.
  
  Discussed with:	kib

Modified:
  head/sys/sys/conf.h

Modified: head/sys/sys/conf.h
==============================================================================
--- head/sys/sys/conf.h	Sat Oct 31 09:03:48 2009	(r198705)
+++ head/sys/sys/conf.h	Sat Oct 31 10:35:41 2009	(r198706)
@@ -210,15 +210,13 @@ struct cdevsw {
 	d_kqfilter_t		*d_kqfilter;
 	d_purge_t		*d_purge;
 	d_mmap_single_t		*d_mmap_single;
-	uid_t			d_uid;
-	gid_t			d_gid;
-	mode_t			d_mode;
-	const char		*d_kind;
+
+	int32_t			d_spare0[3];
+	void			*d_spare1[3];
 
 	/* These fields should not be messed with by drivers */
-	LIST_ENTRY(cdevsw)	d_list;
 	LIST_HEAD(, cdev)	d_devs;
-	int			d_spare3;
+	int			d_spare2;
 	union {
 		struct cdevsw		*gianttrick;
 		SLIST_ENTRY(cdevsw)	postfree_list;

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 10:38:30 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E85371065676;
	Sat, 31 Oct 2009 10:38:30 +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 BE4CF8FC19;
	Sat, 31 Oct 2009 10:38: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 n9VAcUaC083172;
	Sat, 31 Oct 2009 10:38:30 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VAcU3h083170;
	Sat, 31 Oct 2009 10:38:30 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200910311038.n9VAcU3h083170@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 31 Oct 2009 10:38: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: r198707 - head/sys/i386/bios
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 10:38:31 -0000

Author: ed
Date: Sat Oct 31 10:38:30 2009
New Revision: 198707
URL: http://svn.freebsd.org/changeset/base/198707

Log:
  Unobfuscate unit number handling in apm(4).
  
  There is no need to use the lower 4 bits of the unit number to store the
  device type number. Just use 0 and 1 to distinguish them. devfs also
  guarantees that there can never be an open call on a device that has a
  unit number different to 0 and 1, so there is no need to check for this
  in open().

Modified:
  head/sys/i386/bios/apm.c

Modified: head/sys/i386/bios/apm.c
==============================================================================
--- head/sys/i386/bios/apm.c	Sat Oct 31 10:35:41 2009	(r198706)
+++ head/sys/i386/bios/apm.c	Sat Oct 31 10:38:30 2009	(r198707)
@@ -79,9 +79,8 @@ int	apm_evindex;
 #define	SCFLAG_OCTL	0x0000002
 #define	SCFLAG_OPEN	(SCFLAG_ONORMAL|SCFLAG_OCTL)
 
-#define APMDEV(dev)	(dev2unit(dev)&0x0f)
 #define APMDEV_NORMAL	0
-#define APMDEV_CTL	8
+#define APMDEV_CTL	1
 
 #ifdef PC98
 extern int bios32_apm98(struct bios_regs *, u_int, u_short);
@@ -1249,8 +1248,10 @@ apm_attach(device_t dev)
 	sc->suspending = 0;
 	sc->running = 0;
 
-	make_dev(&apm_cdevsw, 0, 0, 5, 0664, "apm");
-	make_dev(&apm_cdevsw, 8, 0, 5, 0660, "apmctl");
+	make_dev(&apm_cdevsw, APMDEV_NORMAL,
+	    UID_ROOT, GID_OPERATOR, 0664, "apm");
+	make_dev(&apm_cdevsw, APMDEV_CTL,
+	    UID_ROOT, GID_OPERATOR, 0660, "apmctl");
 	return 0;
 }
 
@@ -1258,12 +1259,11 @@ static int
 apmopen(struct cdev *dev, int flag, int fmt, struct thread *td)
 {
 	struct apm_softc *sc = &apm_softc;
-	int ctl = APMDEV(dev);
 
 	if (sc == NULL || sc->initialized == 0)
 		return (ENXIO);
 
-	switch (ctl) {
+	switch (dev2unit(dev)) {
 	case APMDEV_CTL:
 		if (!(flag & FWRITE))
 			return EINVAL;
@@ -1275,9 +1275,6 @@ apmopen(struct cdev *dev, int flag, int 
 	case APMDEV_NORMAL:
 		sc->sc_flags |= SCFLAG_ONORMAL;
 		break;
-	default:
-		return ENXIO;
-		break;
 	}
 	return 0;
 }
@@ -1286,9 +1283,8 @@ static int
 apmclose(struct cdev *dev, int flag, int fmt, struct thread *td)
 {
 	struct apm_softc *sc = &apm_softc;
-	int ctl = APMDEV(dev);
 
-	switch (ctl) {
+	switch (dev2unit(dev)) {
 	case APMDEV_CTL:
 		apm_lastreq_rejected();
 		sc->sc_flags &= ~SCFLAG_OCTL;
@@ -1429,7 +1425,7 @@ apmioctl(struct cdev *dev, u_long cmd, c
 	}
 
 	/* for /dev/apmctl */
-	if (APMDEV(dev) == APMDEV_CTL) {
+	if (dev2unit(dev) == APMDEV_CTL) {
 		struct apm_event_info *evp;
 		int i;
 
@@ -1468,7 +1464,7 @@ apmwrite(struct cdev *dev, struct uio *u
 	int error;
 	u_char enabled;
 
-	if (APMDEV(dev) != APMDEV_CTL)
+	if (dev2unit(dev) != APMDEV_CTL)
 		return(ENODEV);
 	if (uio->uio_resid != sizeof(u_int))
 		return(E2BIG);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 10:43:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E526E106566C;
	Sat, 31 Oct 2009 10:43:38 +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 C2C7C8FC08;
	Sat, 31 Oct 2009 10: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 n9VAhcuK083574;
	Sat, 31 Oct 2009 10:43:38 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VAhc19083569;
	Sat, 31 Oct 2009 10:43:38 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910311043.n9VAhc19083569@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 10: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: r198708 - in head/sys/cam: . ata scsi
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 10:43:39 -0000

Author: mav
Date: Sat Oct 31 10:43:38 2009
New Revision: 198708
URL: http://svn.freebsd.org/changeset/base/198708

Log:
  MFp4:
  - Reduce code duplication in ATA XPT and PMP driver.
  - Move PIO size setting from ada driver to ATA XPT. It is XPT business
  to negotiate transfer details. ada driver is now stateless.
  - Report PIO size to SIM. It is required for correct PATA SIM operation.
  - Tune PMP scan timings. It workarounds some problems with SiI.
  - If reset hapens during PMP initialization - restart it.
  - Introduce early-initialized periph drivers, which are used during initial
  scan process. Use it for xpt, probe, aprobe and pmp. It gives pmp chance
  to finish scan before mountroot and numerate devices in right order.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam.h
  head/sys/cam/cam_ccb.h
  head/sys/cam/cam_periph.h
  head/sys/cam/cam_xpt.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cam/scsi/scsi_sg.c
  head/sys/cam/scsi/scsi_xpt.c

Modified: head/sys/cam/ata/ata_da.c
==============================================================================
--- head/sys/cam/ata/ata_da.c	Sat Oct 31 10:38:30 2009	(r198707)
+++ head/sys/cam/ata/ata_da.c	Sat Oct 31 10:43:38 2009	(r198708)
@@ -63,8 +63,7 @@ __FBSDID("$FreeBSD$");
 #define ATA_MAX_28BIT_LBA               268435455UL
 
 typedef enum {
-	ADA_STATE_NORMAL,
-	ADA_STATE_SET_MULTI
+	ADA_STATE_NORMAL
 } ada_state;
 
 typedef enum {
@@ -84,7 +83,6 @@ typedef enum {
 } ada_quirks;
 
 typedef enum {
-	ADA_CCB_SET_MULTI	= 0x01,
 	ADA_CCB_BUFFER_IO	= 0x03,
 	ADA_CCB_WAITING		= 0x04,
 	ADA_CCB_DUMP		= 0x05,
@@ -112,7 +110,6 @@ struct ada_softc {
 	ada_quirks quirks;
 	int	 ordered_tag_count;
 	int	 outstanding_cmds;
-	int	 secsperint;
 	struct	 disk_params params;
 	struct	 disk *disk;
 	union	 ccb saved_ccb;
@@ -550,22 +547,6 @@ adaasync(void *callback_arg, u_int32_t c
 				"due to status 0x%x\n", status);
 		break;
 	}
-	case AC_SENT_BDR:
-	case AC_BUS_RESET:
-	{
-		struct ada_softc *softc = (struct ada_softc *)periph->softc;
-
-		cam_periph_async(periph, code, path, arg);
-		if (softc->state != ADA_STATE_NORMAL)
-			break;
-		/*
-		 * Restore device configuration.
-		 */
-		softc->state = ADA_STATE_SET_MULTI;
-		cam_periph_acquire(periph);
-		xpt_schedule(periph, CAM_PRIORITY_DEV);
-		break;
-	}
 	default:
 		cam_periph_async(periph, code, path, arg);
 		break;
@@ -644,8 +625,7 @@ adaregister(struct cam_periph *periph, v
 	if (cgd->ident_data.satacapabilities & ATA_SUPPORT_NCQ &&
 	    cgd->ident_data.queue >= 31)
 		softc->flags |= ADA_FLAG_CAN_NCQ;
-	softc->secsperint = max(1, min(cgd->ident_data.sectors_intr, 16));
-	softc->state = ADA_STATE_SET_MULTI;
+	softc->state = ADA_STATE_NORMAL;
 
 	periph->softc = softc;
 
@@ -734,18 +714,10 @@ adaregister(struct cam_periph *periph, v
 	 * them and the only alternative would be to
 	 * not attach the device on failure.
 	 */
-	xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE,
+	xpt_register_async(AC_LOST_DEVICE,
 			   adaasync, periph, periph->path);
 
 	/*
-	 * Take an exclusive refcount on the periph while adastart is called
-	 * to finish the probe.  The reference will be dropped in adadone at
-	 * the end of probe.
-	 */
-	cam_periph_acquire(periph);
-	xpt_schedule(periph, /*priority*/5);
-
-	/*
 	 * Schedule a periodic event to occasionally send an
 	 * ordered tag to a device.
 	 */
@@ -901,21 +873,6 @@ adastart(struct cam_periph *periph, unio
 		}
 		break;
 	}
-	case ADA_STATE_SET_MULTI:
-	{
-		cam_fill_ataio(ataio,
-		    ada_retry_count,
-		    adadone,
-		    CAM_DIR_NONE,
-		    0,
-		    NULL,
-		    0,
-		    ada_default_timeout*1000);
-
-		ata_28bit_cmd(ataio, ATA_SET_MULTI, 0, 0, softc->secsperint);
-		start_ccb->ccb_h.ccb_state = ADA_CCB_SET_MULTI;
-		xpt_action(start_ccb);
-	}
 	}
 }
 
@@ -1003,35 +960,6 @@ adadone(struct cam_periph *periph, union
 		wakeup(&done_ccb->ccb_h.cbfcnp);
 		return;
 	}
-	case ADA_CCB_SET_MULTI:
-	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-		} else {
-			int	error;
-
-			error = adaerror(done_ccb, 0, 0);
-			if (error == ERESTART) {
-				/* A retry was scheduled, so just return. */
-				return;
-			}
-		}
-		softc->state = ADA_STATE_NORMAL;
-		/*
-		 * Since our peripheral may be invalidated by an error
-		 * above or an external event, we must release our CCB
-		 * before releasing the probe lock on the peripheral.
-		 * The peripheral will only go away once the last lock
-		 * is removed, and we need it around for the CCB release
-		 * operation.
-		 */
-		xpt_release_ccb(done_ccb);
-		if (bioq_first(&softc->bio_queue) != NULL) {
-			/* Have more work to do, so ensure we stay scheduled */
-			xpt_schedule(periph, CAM_PRIORITY_NORMAL);
-		}
-		cam_periph_release_locked(periph);
-		return;
-	}
 	case ADA_CCB_DUMP:
 		/* No-op.  We're polling */
 		return;

Modified: head/sys/cam/ata/ata_pmp.c
==============================================================================
--- head/sys/cam/ata/ata_pmp.c	Sat Oct 31 10:38:30 2009	(r198707)
+++ head/sys/cam/ata/ata_pmp.c	Sat Oct 31 10:43:38 2009	(r198708)
@@ -93,7 +93,9 @@ struct pmp_softc {
 	int			pm_step;
 	int			pm_try;
 	int			found;
+	int			reset;
 	int			frozen;
+	int			restart;
 	union			ccb saved_ccb;
 	struct task		sysctl_task;
 	struct sysctl_ctx_list	sysctl_ctx;
@@ -134,7 +136,8 @@ TUNABLE_INT("kern.cam.pmp.default_timeou
 static struct periph_driver pmpdriver =
 {
 	pmpinit, "pmp",
-	TAILQ_HEAD_INITIALIZER(pmpdriver.units), /* generation */ 0
+	TAILQ_HEAD_INITIALIZER(pmpdriver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(pmp, pmpdriver);
@@ -292,14 +295,21 @@ pmpasync(void *callback_arg, u_int32_t c
 	case AC_BUS_RESET:
 		softc = (struct pmp_softc *)periph->softc;
 		cam_periph_async(periph, code, path, arg);
-		if (softc->state != PMP_STATE_NORMAL)
+		if (code == AC_SCSI_AEN && softc->state != PMP_STATE_NORMAL &&
+		    softc->state != PMP_STATE_SCAN)
 			break;
-		pmpfreeze(periph, softc->found);
+		if (softc->state != PMP_STATE_SCAN)
+			pmpfreeze(periph, softc->found);
+		else
+			pmpfreeze(periph, softc->found & ~(1 << softc->pm_step));
 		if (code == AC_SENT_BDR || code == AC_BUS_RESET)
 			softc->found = 0; /* We have to reset everything. */
-		softc->state = PMP_STATE_PORTS;
-		cam_periph_acquire(periph);
-		xpt_schedule(periph, CAM_PRIORITY_DEV);
+		if (softc->state == PMP_STATE_NORMAL) {
+			softc->state = PMP_STATE_PORTS;
+			cam_periph_acquire(periph);
+			xpt_schedule(periph, CAM_PRIORITY_BUS);
+		} else
+			softc->restart = 1;
 		break;
 	default:
 		cam_periph_async(periph, code, path, arg);
@@ -395,7 +405,7 @@ pmpregister(struct cam_periph *periph, v
 	 * the end of probe.
 	 */
 	(void)cam_periph_acquire(periph);
-	xpt_schedule(periph, CAM_PRIORITY_DEV);
+	xpt_schedule(periph, CAM_PRIORITY_BUS);
 
 	return(CAM_REQ_CMP);
 }
@@ -408,6 +418,11 @@ pmpstart(struct cam_periph *periph, unio
 
 	softc = (struct pmp_softc *)periph->softc;
 	ataio = &start_ccb->ataio;
+	
+	if (softc->restart) {
+		softc->restart = 0;
+		softc->state = PMP_STATE_PORTS;
+	}
 
 	switch (softc->state) {
 	case PMP_STATE_PORTS:
@@ -469,6 +484,7 @@ printf("PM RESET %d%s\n", softc->pm_step
 		ata_pm_read_cmd(ataio, 0, softc->pm_step);
 		break;
 	case PMP_STATE_CLEAR:
+		softc->reset = 0;
 		cam_fill_ataio(ataio,
 		      pmp_retry_count,
 		      pmpdone,
@@ -492,7 +508,7 @@ pmpdone(struct cam_periph *periph, union
 	struct ccb_ataio *ataio;
 	union ccb *work_ccb;
 	struct cam_path *path, *dpath;
-	u_int32_t  priority;
+	u_int32_t  priority, res;
 
 	softc = (struct pmp_softc *)periph->softc;
 	ataio = &done_ccb->ataio;
@@ -502,193 +518,158 @@ pmpdone(struct cam_periph *periph, union
 	path = done_ccb->ccb_h.path;
 	priority = done_ccb->ccb_h.pinfo.priority;
 
-	switch (softc->state) {
-	case PMP_STATE_PORTS:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			softc->pm_ports = (done_ccb->ataio.res.lba_high << 24) +
-			    (done_ccb->ataio.res.lba_mid << 16) +
-			    (done_ccb->ataio.res.lba_low << 8) +
-			    done_ccb->ataio.res.sector_count;
-			/* This PM declares 6 ports, while only 5 of them are real.
-			 * Port 5 is enclosure management bridge port, which has implementation
-			 * problems, causing probe faults. Hide it for now. */
-			if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6)
-				softc->pm_ports = 5;
-			/* This PM declares 7 ports, while only 5 of them are real.
-			 * Port 5 is some fake "Config  Disk" with 640 sectors size,
-			 * port 6 is enclosure management bridge port.
-			 * Both fake ports has implementation problems, causing
-			 * probe faults. Hide them for now. */
-			if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7)
-				softc->pm_ports = 5;
-			printf("PM ports: %d\n", softc->pm_ports);
-			softc->state = PMP_STATE_CONFIG;
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
+	if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_periph_error(done_ccb, 0, 0,
+		    &softc->saved_ccb) == ERESTART) {
 			return;
 		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
+			cam_release_devq(done_ccb->ccb_h.path,
+			    /*relsim_flags*/0,
+			    /*reduction*/0,
+			    /*timeout*/0,
+			    /*getcount_only*/0);
+		}
+		goto done;
+	}
+
+	if (softc->restart) {
+		softc->restart = 0;
+		if (softc->state == PMP_STATE_SCAN) {
+			pmpfreeze(periph, 1 << softc->pm_step);
+			work_ccb = done_ccb;
+			done_ccb = (union ccb*)work_ccb->ccb_h.ppriv_ptr0;
+			/* Free the current request path- we're done with it. */
+		    	xpt_free_path(work_ccb->ccb_h.path);
+			xpt_free_ccb(work_ccb);
 		}
 		xpt_release_ccb(done_ccb);
-		break;
+		softc->state = PMP_STATE_PORTS;
+		xpt_schedule(periph, priority);
+		return;
+	}
+
+	switch (softc->state) {
+	case PMP_STATE_PORTS:
+		softc->pm_ports = (done_ccb->ataio.res.lba_high << 24) +
+		    (done_ccb->ataio.res.lba_mid << 16) +
+		    (done_ccb->ataio.res.lba_low << 8) +
+		    done_ccb->ataio.res.sector_count;
+		/* This PM declares 6 ports, while only 5 of them are real.
+		 * Port 5 is enclosure management bridge port, which has implementation
+		 * problems, causing probe faults. Hide it for now. */
+		if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6)
+			softc->pm_ports = 5;
+		/* This PM declares 7 ports, while only 5 of them are real.
+		 * Port 5 is some fake "Config  Disk" with 640 sectors size,
+		 * port 6 is enclosure management bridge port.
+		 * Both fake ports has implementation problems, causing
+		 * probe faults. Hide them for now. */
+		if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7)
+			softc->pm_ports = 5;
+		printf("PM ports: %d\n", softc->pm_ports);
+		softc->state = PMP_STATE_CONFIG;
+		xpt_release_ccb(done_ccb);
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_CONFIG:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			softc->pm_step = 0;
-			softc->state = PMP_STATE_RESET;
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
-		}
+		softc->pm_step = 0;
+		softc->state = PMP_STATE_RESET;
+		softc->reset |= ~softc->found;
 		xpt_release_ccb(done_ccb);
-		break;
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_RESET:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			softc->pm_step++;
-			if (softc->pm_step < softc->pm_ports) {
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			} else {
-				softc->pm_step = 0;
-				DELAY(5000);
-				printf("PM reset done\n");
-				softc->state = PMP_STATE_CONNECT;
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			}
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
+		softc->pm_step++;
+		if (softc->pm_step >= softc->pm_ports) {
+			softc->pm_step = 0;
+			cam_freeze_devq(periph->path);
+			cam_release_devq(periph->path,
+			    RELSIM_RELEASE_AFTER_TIMEOUT,
+			    /*reduction*/0,
+			    /*timeout*/5,
+			    /*getcount_only*/0);
+			printf("PM reset done\n");
+			softc->state = PMP_STATE_CONNECT;
 		}
 		xpt_release_ccb(done_ccb);
-		break;
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_CONNECT:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			softc->pm_step++;
-			if (softc->pm_step < softc->pm_ports) {
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			} else {
-				softc->pm_step = 0;
-				softc->pm_try = 0;
-				printf("PM connect done\n");
-				softc->state = PMP_STATE_CHECK;
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			}
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
+		softc->pm_step++;
+		if (softc->pm_step >= softc->pm_ports) {
+			softc->pm_step = 0;
+			softc->pm_try = 0;
+			cam_freeze_devq(periph->path);
+			cam_release_devq(periph->path,
+			    RELSIM_RELEASE_AFTER_TIMEOUT,
+			    /*reduction*/0,
+			    /*timeout*/10,
+			    /*getcount_only*/0);
+			printf("PM connect done\n");
+			softc->state = PMP_STATE_CHECK;
 		}
 		xpt_release_ccb(done_ccb);
-		break;
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_CHECK:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			int res = (done_ccb->ataio.res.lba_high << 24) +
-			    (done_ccb->ataio.res.lba_mid << 16) +
-			    (done_ccb->ataio.res.lba_low << 8) +
-			    done_ccb->ataio.res.sector_count;
-			if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
-				printf("PM status: %d - %08x\n", softc->pm_step, res);
-				softc->found |= (1 << softc->pm_step);
-				softc->pm_step++;
+		res = (done_ccb->ataio.res.lba_high << 24) +
+		    (done_ccb->ataio.res.lba_mid << 16) +
+		    (done_ccb->ataio.res.lba_low << 8) +
+		    done_ccb->ataio.res.sector_count;
+		if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
+			printf("PM status: %d - %08x\n", softc->pm_step, res);
+			softc->found |= (1 << softc->pm_step);
+			softc->pm_step++;
+		} else {
+			if (softc->pm_try < 10) {
+				cam_freeze_devq(periph->path);
+				cam_release_devq(periph->path,
+				    RELSIM_RELEASE_AFTER_TIMEOUT,
+				    /*reduction*/0,
+				    /*timeout*/10,
+				    /*getcount_only*/0);
+				softc->pm_try++;
 			} else {
-				if (softc->pm_try < 100) {
-					DELAY(10000);
-					softc->pm_try++;
-				} else {
-					printf("PM status: %d - %08x\n", softc->pm_step, res);
-					softc->found &= ~(1 << softc->pm_step);
-					if (xpt_create_path(&dpath, periph,
-					    done_ccb->ccb_h.path_id,
-					    softc->pm_step, 0) == CAM_REQ_CMP) {
-						xpt_async(AC_LOST_DEVICE, dpath, NULL);
-						xpt_free_path(dpath);
-					}
-					softc->pm_step++;
+				printf("PM status: %d - %08x\n", softc->pm_step, res);
+				softc->found &= ~(1 << softc->pm_step);
+				if (xpt_create_path(&dpath, periph,
+				    done_ccb->ccb_h.path_id,
+				    softc->pm_step, 0) == CAM_REQ_CMP) {
+					xpt_async(AC_LOST_DEVICE, dpath, NULL);
+					xpt_free_path(dpath);
 				}
+				softc->pm_step++;
 			}
-			if (softc->pm_step < softc->pm_ports) {
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			} else {
-				softc->pm_step = 0;
-				softc->state = PMP_STATE_CLEAR;
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
+		}
+		if (softc->pm_step >= softc->pm_ports) {
+			if (softc->reset & softc->found) {
+				cam_freeze_devq(periph->path);
+				cam_release_devq(periph->path,
+				    RELSIM_RELEASE_AFTER_TIMEOUT,
+				    /*reduction*/0,
+				    /*timeout*/1000,
+				    /*getcount_only*/0);
 			}
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
+			softc->state = PMP_STATE_CLEAR;
+			softc->pm_step = 0;
 		}
 		xpt_release_ccb(done_ccb);
-		break;
+		xpt_schedule(periph, priority);
+		return;
 	case PMP_STATE_CLEAR:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			softc->pm_step++;
-			if (softc->pm_step < softc->pm_ports) {
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			} else if (softc->found) {
-				softc->pm_step = 0;
-				softc->state = PMP_STATE_SCAN;
-				work_ccb = xpt_alloc_ccb_nowait();
-				if (work_ccb != NULL)
-					goto do_scan;
-				xpt_release_ccb(done_ccb);
-			}
-			break;
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
+		softc->pm_step++;
+		if (softc->pm_step < softc->pm_ports) {
+			xpt_release_ccb(done_ccb);
+			xpt_schedule(periph, priority);
 			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(done_ccb->ccb_h.path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
+		} else if (softc->found) {
+			softc->pm_step = 0;
+			softc->state = PMP_STATE_SCAN;
+			work_ccb = xpt_alloc_ccb_nowait();
+			if (work_ccb != NULL)
+				goto do_scan;
+			xpt_release_ccb(done_ccb);
 		}
-		xpt_release_ccb(done_ccb);
 		break;
 	case PMP_STATE_SCAN:
 		work_ccb = done_ccb;
@@ -703,7 +684,6 @@ do_scan:
 		}
 		if (softc->pm_step >= softc->pm_ports) {
 			xpt_free_ccb(work_ccb);
-			xpt_release_ccb(done_ccb);
 			break;
 		}
 		if (xpt_create_path(&dpath, periph,
@@ -712,7 +692,6 @@ do_scan:
 			printf("pmpdone: xpt_create_path failed"
 			    ", bus scan halted\n");
 			xpt_free_ccb(work_ccb);
-			xpt_release_ccb(done_ccb);
 			break;
 		}
 		xpt_setup_ccb(&work_ccb->ccb_h, dpath,
@@ -727,6 +706,8 @@ do_scan:
 	default:
 		break;
 	}
+done:
+	xpt_release_ccb(done_ccb);
 	softc->state = PMP_STATE_NORMAL;
 	pmprelease(periph, -1);
 	cam_periph_release_locked(periph);

Modified: head/sys/cam/ata/ata_xpt.c
==============================================================================
--- head/sys/cam/ata/ata_xpt.c	Sat Oct 31 10:38:30 2009	(r198707)
+++ head/sys/cam/ata/ata_xpt.c	Sat Oct 31 10:43:38 2009	(r198708)
@@ -83,7 +83,8 @@ static periph_init_t probe_periph_init;
 static struct periph_driver probe_driver =
 {
 	probe_periph_init, "aprobe",
-	TAILQ_HEAD_INITIALIZER(probe_driver.units)
+	TAILQ_HEAD_INITIALIZER(probe_driver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(aprobe, probe_driver);
@@ -92,6 +93,7 @@ typedef enum {
 	PROBE_RESET,
 	PROBE_IDENTIFY,
 	PROBE_SETMODE,
+	PROBE_SET_MULTI,
 	PROBE_INQUIRY,
 	PROBE_FULL_INQUIRY,
 	PROBE_PM_PID,
@@ -103,6 +105,7 @@ static char *probe_action_text[] = {
 	"PROBE_RESET",
 	"PROBE_IDENTIFY",
 	"PROBE_SETMODE",
+	"PROBE_SET_MULTI",
 	"PROBE_INQUIRY",
 	"PROBE_FULL_INQUIRY",
 	"PROBE_PM_PID",
@@ -282,12 +285,16 @@ probestart(struct cam_periph *periph, un
 	struct ccb_ataio *ataio;
 	struct ccb_scsiio *csio;
 	probe_softc *softc;
+	struct cam_path *path;
+	struct ata_params *ident_buf;
 
 	CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("probestart\n"));
 
 	softc = (probe_softc *)periph->softc;
+	path = start_ccb->ccb_h.path;
 	ataio = &start_ccb->ataio;
 	csio = &start_ccb->csio;
+	ident_buf = &periph->path->device->ident_data;
 
 	switch (softc->action) {
 	case PROBE_RESET:
@@ -302,10 +309,6 @@ probestart(struct cam_periph *periph, un
 		ata_reset_cmd(ataio);
 		break;
 	case PROBE_IDENTIFY:
-	{
-		struct ata_params *ident_buf =
-		    &periph->path->device->ident_data;
-
 		if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
 			/* Prepare check that it is the same device. */
 			MD5_CTX context;
@@ -335,12 +338,7 @@ probestart(struct cam_periph *periph, un
 		else
 			ata_28bit_cmd(ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0);
 		break;
-	}
 	case PROBE_SETMODE:
-	{
-		struct ata_params *ident_buf =
-		    &periph->path->device->ident_data;
-
 		cam_fill_ataio(ataio,
 		      1,
 		      probedone,
@@ -352,6 +350,37 @@ probestart(struct cam_periph *periph, un
 		ata_28bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0,
 		    ata_max_mode(ident_buf, ATA_UDMA6, ATA_UDMA6));
 		break;
+	case PROBE_SET_MULTI:
+	{
+		struct ccb_trans_settings cts;
+		u_int sectors;
+
+		sectors = max(1, min(ident_buf->sectors_intr & 0xff, 16));
+
+		/* Report bytecount to SIM. */
+		bzero(&cts, sizeof(cts));
+		xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL);
+		cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+		cts.type = CTS_TYPE_CURRENT_SETTINGS;
+		if (path->device->transport == XPORT_ATA) {
+			cts.xport_specific.ata.bytecount = sectors * 512;
+			cts.xport_specific.ata.valid = CTS_ATA_VALID_BYTECOUNT;
+		} else {
+			cts.xport_specific.sata.bytecount = sectors * 512;
+			cts.xport_specific.sata.valid = CTS_SATA_VALID_BYTECOUNT;
+		}
+		xpt_action((union ccb *)&cts);
+
+		cam_fill_ataio(ataio,
+		    1,
+		    probedone,
+		    CAM_DIR_NONE,
+		    0,
+		    NULL,
+		    0,
+		    30*1000);
+		ata_28bit_cmd(ataio, ATA_SET_MULTI, 0, 0, sectors);
+		break;
 	}
 	case PROBE_INQUIRY:
 	case PROBE_FULL_INQUIRY:
@@ -406,7 +435,7 @@ probestart(struct cam_periph *periph, un
 		ata_pm_read_cmd(ataio, 1, 15);
 		break;
 	case PROBE_INVALID:
-		CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO,
+		CAM_DEBUG(path, CAM_DEBUG_INFO,
 		    ("probestart: invalid action state\n"));
 	default:
 		break;
@@ -552,101 +581,119 @@ probedone(struct cam_periph *periph, uni
 	priority = done_ccb->ccb_h.pinfo.priority;
 	ident_buf = &path->device->ident_data;
 
-	switch (softc->action) {
-	case PROBE_RESET:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			int sign = (done_ccb->ataio.res.lba_high << 8) +
-			    done_ccb->ataio.res.lba_mid;
-			xpt_print(path, "SIGNATURE: %04x\n", sign);
-			if (sign == 0x0000 &&
-			    done_ccb->ccb_h.target_id != 15) {
-				path->device->protocol = PROTO_ATA;
-				PROBE_SET_ACTION(softc, PROBE_IDENTIFY);
-			} else if (sign == 0x9669 &&
-			    done_ccb->ccb_h.target_id == 15) {
-				struct ccb_trans_settings cts;
-
-				/* Report SIM that PM is present. */
-				bzero(&cts, sizeof(cts));
-				xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL);
-				cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
-				cts.type = CTS_TYPE_CURRENT_SETTINGS;
-				cts.xport_specific.sata.pm_present = 1;
-				cts.xport_specific.sata.valid = CTS_SATA_VALID_PM;
-				xpt_action((union ccb *)&cts);
-				path->device->protocol = PROTO_SATAPM;
-				PROBE_SET_ACTION(softc, PROBE_PM_PID);
-			} else if (sign == 0xeb14 &&
-			    done_ccb->ccb_h.target_id != 15) {
-				path->device->protocol = PROTO_SCSI;
-				PROBE_SET_ACTION(softc, PROBE_IDENTIFY);
-			} else {
-				if (done_ccb->ccb_h.target_id != 15) {
-					xpt_print(path,
-					    "Unexpected signature 0x%04x\n", sign);
-				}
-				goto device_fail;
-			}
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
+	if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+device_fail:	if (cam_periph_error(done_ccb, 0, 0,
+		    &softc->saved_ccb) == ERESTART) {
 			return;
 		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
 			/* Don't wedge the queue */
 			xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,
 					 /*run_queue*/TRUE);
 		}
-		goto device_fail;
-	case PROBE_IDENTIFY:
+		/* Old PIO2 devices may not support mode setting. */
+		if (softc->action == PROBE_SETMODE &&
+		    ata_max_pmode(ident_buf) <= ATA_PIO2 &&
+		    (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0)
+			goto noerror;
+		/*
+		 * If we get to this point, we got an error status back
+		 * from the inquiry and the error status doesn't require
+		 * automatically retrying the command.  Therefore, the
+		 * inquiry failed.  If we had inquiry information before
+		 * for this device, but this latest inquiry command failed,
+		 * the device has probably gone away.  If this device isn't
+		 * already marked unconfigured, notify the peripheral
+		 * drivers that this device is no more.
+		 */
+		if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
+			xpt_async(AC_LOST_DEVICE, path, NULL);
+		found = 0;
+		goto done;
+	}
+noerror:
+	switch (softc->action) {
+	case PROBE_RESET:
 	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			int16_t *ptr;
+		int sign = (done_ccb->ataio.res.lba_high << 8) +
+		    done_ccb->ataio.res.lba_mid;
+		xpt_print(path, "SIGNATURE: %04x\n", sign);
+		if (sign == 0x0000 &&
+		    done_ccb->ccb_h.target_id != 15) {
+			path->device->protocol = PROTO_ATA;
+			PROBE_SET_ACTION(softc, PROBE_IDENTIFY);
+		} else if (sign == 0x9669 &&
+		    done_ccb->ccb_h.target_id == 15) {
+			struct ccb_trans_settings cts;
 
-			for (ptr = (int16_t *)ident_buf;
-			     ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) {
-				*ptr = le16toh(*ptr);
-			}
-			if (strncmp(ident_buf->model, "FX", 2) &&
-			    strncmp(ident_buf->model, "NEC", 3) &&
-			    strncmp(ident_buf->model, "Pioneer", 7) &&
-			    strncmp(ident_buf->model, "SHARP", 5)) {
-				ata_bswap(ident_buf->model, sizeof(ident_buf->model));
-				ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
-				ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
-			}
-			ata_btrim(ident_buf->model, sizeof(ident_buf->model));
-			ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
-			ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
-			ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
-			ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
-			ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
-
-			if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
-				/* Check that it is the same device. */
-				MD5_CTX context;
-				u_int8_t digest[16];
-
-				MD5Init(&context);
-				MD5Update(&context,
-				    (unsigned char *)ident_buf->model,
-				    sizeof(ident_buf->model));
-				MD5Update(&context,
-				    (unsigned char *)ident_buf->revision,
-				    sizeof(ident_buf->revision));
-				MD5Update(&context,
-				    (unsigned char *)ident_buf->serial,
-				    sizeof(ident_buf->serial));
-				MD5Final(digest, &context);
-				if (bcmp(digest, softc->digest, sizeof(digest))) {
-					/* Device changed. */
-					xpt_async(AC_LOST_DEVICE, path, NULL);
-				}
-				xpt_release_ccb(done_ccb);
-				break;
+				/* Report SIM that PM is present. */
+			bzero(&cts, sizeof(cts));
+			xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL);
+			cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+			cts.type = CTS_TYPE_CURRENT_SETTINGS;
+			cts.xport_specific.sata.pm_present = 1;
+			cts.xport_specific.sata.valid = CTS_SATA_VALID_PM;
+			xpt_action((union ccb *)&cts);
+			path->device->protocol = PROTO_SATAPM;
+			PROBE_SET_ACTION(softc, PROBE_PM_PID);
+		} else if (sign == 0xeb14 &&
+		    done_ccb->ccb_h.target_id != 15) {
+			path->device->protocol = PROTO_SCSI;
+			PROBE_SET_ACTION(softc, PROBE_IDENTIFY);
+		} else {
+			if (done_ccb->ccb_h.target_id != 15) {
+				xpt_print(path,
+				    "Unexpected signature 0x%04x\n", sign);
 			}
+			goto device_fail;
+		}
+		xpt_release_ccb(done_ccb);
+		xpt_schedule(periph, priority);
+		return;
+	}
+	case PROBE_IDENTIFY:
+	{
+		int16_t *ptr;
+
+		for (ptr = (int16_t *)ident_buf;
+		     ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; ptr++) {
+			*ptr = le16toh(*ptr);
+		}
+		if (strncmp(ident_buf->model, "FX", 2) &&
+		    strncmp(ident_buf->model, "NEC", 3) &&
+		    strncmp(ident_buf->model, "Pioneer", 7) &&
+		    strncmp(ident_buf->model, "SHARP", 5)) {
+			ata_bswap(ident_buf->model, sizeof(ident_buf->model));
+			ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
+			ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
+		}
+		ata_btrim(ident_buf->model, sizeof(ident_buf->model));
+		ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
+		ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
+		ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
+		ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
+		ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
 
+		if ((periph->path->device->flags & CAM_DEV_UNCONFIGURED) == 0) {
+			/* Check that it is the same device. */
+			MD5_CTX context;
+			u_int8_t digest[16];
+
+			MD5Init(&context);
+			MD5Update(&context,
+			    (unsigned char *)ident_buf->model,
+			    sizeof(ident_buf->model));
+			MD5Update(&context,
+			    (unsigned char *)ident_buf->revision,
+			    sizeof(ident_buf->revision));
+			MD5Update(&context,
+			    (unsigned char *)ident_buf->serial,
+			    sizeof(ident_buf->serial));
+			MD5Final(digest, &context);
+			if (bcmp(digest, softc->digest, sizeof(digest))) {
+				/* Device changed. */
+				xpt_async(AC_LOST_DEVICE, path, NULL);
+			}
+		} else {
 			/* Clean up from previous instance of this device */
 			if (path->device->serial_num != NULL) {
 				free(path->device->serial_num, M_CAMXPT);
@@ -655,7 +702,7 @@ probedone(struct cam_periph *periph, uni
 			}
 			path->device->serial_num =
 				(u_int8_t *)malloc((sizeof(ident_buf->serial) + 1),
-						   M_CAMXPT, M_NOWAIT);
+					   M_CAMXPT, M_NOWAIT);
 			if (path->device->serial_num != NULL) {
 				bcopy(ident_buf->serial,
 				      path->device->serial_num,
@@ -667,188 +714,120 @@ probedone(struct cam_periph *periph, uni
 			}
 
 			path->device->flags |= CAM_DEV_IDENTIFY_DATA_VALID;
-			ata_device_transport(path);
-			PROBE_SET_ACTION(softc, PROBE_SETMODE);
-			xpt_release_ccb(done_ccb);
-			xpt_schedule(periph, priority);
-			return;
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-			/* Don't wedge the queue */
-			xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,
-					 /*run_queue*/TRUE);
 		}
-device_fail:
-		/*
-		 * If we get to this point, we got an error status back
-		 * from the inquiry and the error status doesn't require
-		 * automatically retrying the command.  Therefore, the
-		 * inquiry failed.  If we had inquiry information before
-		 * for this device, but this latest inquiry command failed,
-		 * the device has probably gone away.  If this device isn't
-		 * already marked unconfigured, notify the peripheral
-		 * drivers that this device is no more.
-		 */
-		if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0)
-			xpt_async(AC_LOST_DEVICE, path, NULL);
-		found = 0;
+		ata_device_transport(path);
+		PROBE_SET_ACTION(softc, PROBE_SETMODE);
 		xpt_release_ccb(done_ccb);
-		break;
+		xpt_schedule(periph, priority);
+		return;
 	}
 	case PROBE_SETMODE:
-	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-modedone:		if (path->device->protocol == PROTO_ATA) {
-				path->device->flags &= ~CAM_DEV_UNCONFIGURED;
-				done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
-				xpt_action(done_ccb);
-				xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path,
-				    done_ccb);
-				xpt_release_ccb(done_ccb);
-				break;
-			} else {
-				PROBE_SET_ACTION(softc, PROBE_INQUIRY);
-				xpt_release_ccb(done_ccb);
-				xpt_schedule(periph, priority);
-				return;
-			}
-		} else if (cam_periph_error(done_ccb, 0, 0,
-					    &softc->saved_ccb) == ERESTART) {
-			return;
-		} else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-			/* Don't wedge the queue */
-			xpt_release_devq(done_ccb->ccb_h.path, /*count*/1,
-					 /*run_queue*/TRUE);
+		if (path->device->protocol == PROTO_ATA) {
+			PROBE_SET_ACTION(softc, PROBE_SET_MULTI);
+		} else {
+			PROBE_SET_ACTION(softc, PROBE_INQUIRY);
 		}
-		/* Old PIO2 devices may not support mode setting. */
-		if (ata_max_pmode(ident_buf) <= ATA_PIO2 &&
-		    (ident_buf->capabilities1 & ATA_SUPPORT_IORDY) == 0)
-			goto modedone;
-		goto device_fail;
-	}
+		xpt_release_ccb(done_ccb);
+		xpt_schedule(periph, priority);
+		return;
+	case PROBE_SET_MULTI:
+		if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) {
+			path->device->flags &= ~CAM_DEV_UNCONFIGURED;
+			done_ccb->ccb_h.func_code = XPT_GDEV_TYPE;
+			xpt_action(done_ccb);
+			xpt_async(AC_FOUND_DEVICE, done_ccb->ccb_h.path,
+			    done_ccb);
+		}
+		break;
 	case PROBE_INQUIRY:
 	case PROBE_FULL_INQUIRY:
 	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
-			struct scsi_inquiry_data *inq_buf;
-			u_int8_t periph_qual;
+		struct scsi_inquiry_data *inq_buf;
+		u_int8_t periph_qual, len;
 
-			path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID;

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

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 10:47:47 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB2E0106568F;
	Sat, 31 Oct 2009 10:47:47 +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 DABEE8FC1B;
	Sat, 31 Oct 2009 10:47: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 n9VAllox083914;
	Sat, 31 Oct 2009 10:47:47 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VAllqg083912;
	Sat, 31 Oct 2009 10:47:47 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910311047.n9VAllqg083912@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 10:47: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: r198709 - head/sbin/camcontrol
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 10:47:48 -0000

Author: mav
Date: Sat Oct 31 10:47:47 2009
New Revision: 198709
URL: http://svn.freebsd.org/changeset/base/198709

Log:
  MFp4:
  Sync connection speed reporting with kernel.
  Report speed in identify command, same as done by inquiry.

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Sat Oct 31 10:43:38 2009	(r198708)
+++ head/sbin/camcontrol/camcontrol.c	Sat Oct 31 10:47:47 2009	(r198709)
@@ -186,7 +186,7 @@ static int scsidoinquiry(struct cam_devi
 			 char *combinedopt, int retry_count, int timeout);
 static int scsiinquiry(struct cam_device *device, int retry_count, int timeout);
 static int scsiserial(struct cam_device *device, int retry_count, int timeout);
-static int scsixferrate(struct cam_device *device);
+static int camxferrate(struct cam_device *device);
 #endif /* MINIMALISTIC */
 static int parse_btl(char *tstr, int *bus, int *target, int *lun,
 		     cam_argmask *arglst);
@@ -663,7 +663,7 @@ scsidoinquiry(struct cam_device *device,
 		return(error);
 
 	if (arglist & CAM_ARG_GET_XFERRATE)
-		error = scsixferrate(device);
+		error = camxferrate(device);
 
 	return(error);
 }
@@ -873,14 +873,18 @@ scsiserial(struct cam_device *device, in
 }
 
 static int
-scsixferrate(struct cam_device *device)
+camxferrate(struct cam_device *device)
 {
+	struct ccb_pathinq cpi;
 	u_int32_t freq = 0;
 	u_int32_t speed = 0;
 	union ccb *ccb;
 	u_int mb;
 	int retval = 0;
 
+	if ((retval = get_cpi(device, &cpi)) != 0)
+		return (1);
+
 	ccb = cam_getccb(device);
 
 	if (ccb == NULL) {
@@ -913,6 +917,8 @@ scsixferrate(struct cam_device *device)
 
 	}
 
+	speed = cpi.base_transfer_speed;
+	freq = 0;
 	if (ccb->cts.transport == XPORT_SPI) {
 		struct ccb_trans_settings_spi *spi =
 		    &ccb->cts.xport_specific.spi;
@@ -920,31 +926,44 @@ scsixferrate(struct cam_device *device)
 		if ((spi->valid & CTS_SPI_VALID_SYNC_RATE) != 0) {
 			freq = scsi_calc_syncsrate(spi->sync_period);
 			speed = freq;
-		} else {
-			struct ccb_pathinq cpi;
-
-			retval = get_cpi(device, &cpi);
-			if (retval == 0) {
-				speed = cpi.base_transfer_speed;
-				freq = 0;
-			}
 		}
-
-		fprintf(stdout, "%s%d: ", device->device_name,
-			device->dev_unit_num);
-
 		if ((spi->valid & CTS_SPI_VALID_BUS_WIDTH) != 0) {
 			speed *= (0x01 << spi->bus_width);
 		}
+	} else if (ccb->cts.transport == XPORT_FC) {
+		struct ccb_trans_settings_fc *fc =
+		    &ccb->cts.xport_specific.fc;
+
+		if (fc->valid & CTS_FC_VALID_SPEED)
+			speed = fc->bitrate;
+	} else if (ccb->cts.transport == XPORT_SAS) {
+		struct ccb_trans_settings_sas *sas =
+		    &ccb->cts.xport_specific.sas;
+
+		if (sas->valid & CTS_SAS_VALID_SPEED)
+			speed = sas->bitrate;
+	} else if (ccb->cts.transport == XPORT_SATA) {
+		struct ccb_trans_settings_sata *sata =
+		    &ccb->cts.xport_specific.sata;
+
+		if (sata->valid & CTS_SATA_VALID_SPEED)
+			speed = sata->bitrate;
+	}
+
+	mb = speed / 1000;
+	if (mb > 0) {
+		fprintf(stdout, "%s%d: %d.%03dMB/s transfers ",
+			device->device_name, device->dev_unit_num,
+			mb, speed % 1000);
+	} else {
+		fprintf(stdout, "%s%d: %dKB/s transfers ",
+			device->device_name, device->dev_unit_num,
+			speed);
+	}
 
-		mb = speed / 1000;
-
-		if (mb > 0) 
-			fprintf(stdout, "%d.%03dMB/s transfers ",
-				mb, speed % 1000);
-		else
-			fprintf(stdout, "%dKB/s transfers ",
-				speed);
+	if (ccb->cts.transport == XPORT_SPI) {
+		struct ccb_trans_settings_spi *spi =
+		    &ccb->cts.xport_specific.spi;
 
 		if (((spi->valid & CTS_SPI_VALID_SYNC_OFFSET) != 0)
 		 && (spi->sync_offset != 0))
@@ -964,25 +983,22 @@ scsixferrate(struct cam_device *device)
 		 && (spi->sync_offset != 0)) {
 			fprintf(stdout, ")");
 		}
-	} else {
-		struct ccb_pathinq cpi;
-
-		retval = get_cpi(device, &cpi);
-
-		if (retval != 0)
-			goto xferrate_bailout;
-
-		speed = cpi.base_transfer_speed;
-		freq = 0;
-
-		mb = speed / 1000;
-
-		if (mb > 0) 
-			fprintf(stdout, "%d.%03dMB/s transfers ",
-				mb, speed % 1000);
-		else
-			fprintf(stdout, "%dKB/s transfers ",
-				speed);
+	} else if (ccb->cts.transport == XPORT_ATA) {
+		struct ccb_trans_settings_ata *ata =
+		    &ccb->cts.xport_specific.ata;
+
+		if (ata->valid & CTS_ATA_VALID_BYTECOUNT) {
+			fprintf(stdout, "(PIO size %dbytes)",
+			    ata->bytecount);
+		}
+	} else if (ccb->cts.transport == XPORT_SATA) {
+		struct ccb_trans_settings_sata *sata =
+		    &ccb->cts.xport_specific.sata;
+
+		if (sata->valid & CTS_SATA_VALID_BYTECOUNT) {
+			fprintf(stdout, "(PIO size %dbytes)",
+			    sata->bytecount);
+		}
 	}
 
 	if (ccb->cts.protocol == PROTO_SCSI) {
@@ -1305,6 +1321,7 @@ ataidentify(struct cam_device *device, i
 	fprintf(stdout, "%s%d: ", device->device_name,
 		device->dev_unit_num);
 	ata_print_ident(ident_buf);
+	camxferrate(device);
 	atacapprint(ident_buf);
 
 	free(ident_buf);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 10:59:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31CB2106566B;
	Sat, 31 Oct 2009 10:59:54 +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 1F0398FC0A;
	Sat, 31 Oct 2009 10:59: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 n9VAxslX086155;
	Sat, 31 Oct 2009 10:59:54 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VAxsIR086153;
	Sat, 31 Oct 2009 10:59:54 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910311059.n9VAxsIR086153@svn.freebsd.org>
From: Christian Brueffer 
Date: Sat, 31 Oct 2009 10:59:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198710 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/aic7xxx/aicasm dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 10:59:54 -0000

Author: brueffer
Date: Sat Oct 31 10:59:53 2009
New Revision: 198710
URL: http://svn.freebsd.org/changeset/base/198710

Log:
  MFC: r198327
  
  Add a missing free() call.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/aic7xxx/aicasm/aicasm.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/aic7xxx/aicasm/aicasm.c
==============================================================================
--- stable/8/sys/dev/aic7xxx/aicasm/aicasm.c	Sat Oct 31 10:47:47 2009	(r198709)
+++ stable/8/sys/dev/aic7xxx/aicasm/aicasm.c	Sat Oct 31 10:59:53 2009	(r198710)
@@ -639,6 +639,8 @@ output_listing(char *ifilename)
 		}
 		instrptr++;
 	}
+	free(func_values);
+
 	/* Dump the remainder of the file */
 	while(fgets(buf, sizeof(buf), ifile) != NULL)
 		fprintf(listfile, "             %s", buf);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 11:08:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EDFA106568D;
	Sat, 31 Oct 2009 11:08:04 +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 7C29F8FC08;
	Sat, 31 Oct 2009 11:08: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 n9VB84DQ086775;
	Sat, 31 Oct 2009 11:08:04 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VB84JH086773;
	Sat, 31 Oct 2009 11:08:04 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910311108.n9VB84JH086773@svn.freebsd.org>
From: Christian Brueffer 
Date: Sat, 31 Oct 2009 11:08:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198711 - in stable/8/sys: . amd64/include/xen cam/scsi
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 11:08:04 -0000

Author: brueffer
Date: Sat Oct 31 11:08:04 2009
New Revision: 198711
URL: http://svn.freebsd.org/changeset/base/198711

Log:
  MFC: r198356
  
  Fix a memory leak in an error case.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/scsi/scsi_low.c
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/cam/scsi/scsi_low.c
==============================================================================
--- stable/8/sys/cam/scsi/scsi_low.c	Sat Oct 31 10:59:53 2009	(r198710)
+++ stable/8/sys/cam/scsi/scsi_low.c	Sat Oct 31 11:08:04 2009	(r198711)
@@ -638,7 +638,10 @@ scsi_low_attach_xs(slp)
 		return ENOMEM;
 	splp = SCSI_LOW_MALLOC(sizeof(*splp));
 	if (splp == NULL)
+	{
+		SCSI_LOW_FREE(sap);
 		return ENOMEM;
+	}
 
 	SCSI_LOW_BZERO(sap, sizeof(*sap));
 	SCSI_LOW_BZERO(splp, sizeof(*splp));

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 11:21:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EA4EC106566C;
	Sat, 31 Oct 2009 11:21:45 +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 D8A988FC13;
	Sat, 31 Oct 2009 11:21: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 n9VBLjg1087540;
	Sat, 31 Oct 2009 11:21:45 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VBLjho087538;
	Sat, 31 Oct 2009 11:21:45 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910311121.n9VBLjho087538@svn.freebsd.org>
From: Christian Brueffer 
Date: Sat, 31 Oct 2009 11:21:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198712 - in stable/7/sys: . contrib/pf
	dev/aic7xxx/aicasm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 11:21:46 -0000

Author: brueffer
Date: Sat Oct 31 11:21:45 2009
New Revision: 198712
URL: http://svn.freebsd.org/changeset/base/198712

Log:
  MFC: r198327
  
  Add a missing free() call.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/aic7xxx/aicasm/aicasm.c

Modified: stable/7/sys/dev/aic7xxx/aicasm/aicasm.c
==============================================================================
--- stable/7/sys/dev/aic7xxx/aicasm/aicasm.c	Sat Oct 31 11:08:04 2009	(r198711)
+++ stable/7/sys/dev/aic7xxx/aicasm/aicasm.c	Sat Oct 31 11:21:45 2009	(r198712)
@@ -641,6 +641,8 @@ output_listing(char *ifilename)
 		}
 		instrptr++;
 	}
+	free(func_values);
+
 	/* Dump the remainder of the file */
 	while(fgets(buf, sizeof(buf), ifile) != NULL)
 		fprintf(listfile, "             %s", buf);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 11:23:54 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77B6F1065670;
	Sat, 31 Oct 2009 11:23:54 +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 666478FC0C;
	Sat, 31 Oct 2009 11:23: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 n9VBNsoD087646;
	Sat, 31 Oct 2009 11:23:54 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VBNsRk087644;
	Sat, 31 Oct 2009 11:23:54 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910311123.n9VBNsRk087644@svn.freebsd.org>
From: Christian Brueffer 
Date: Sat, 31 Oct 2009 11:23:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198713 - in stable/7/sys: . cam/scsi contrib/pf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 11:23:54 -0000

Author: brueffer
Date: Sat Oct 31 11:23:54 2009
New Revision: 198713
URL: http://svn.freebsd.org/changeset/base/198713

Log:
  MFC: 198356
  
  Fix a memory leak in an error case.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/cam/scsi/scsi_low.c
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/cam/scsi/scsi_low.c
==============================================================================
--- stable/7/sys/cam/scsi/scsi_low.c	Sat Oct 31 11:21:45 2009	(r198712)
+++ stable/7/sys/cam/scsi/scsi_low.c	Sat Oct 31 11:23:54 2009	(r198713)
@@ -638,7 +638,10 @@ scsi_low_attach_xs(slp)
 		return ENOMEM;
 	splp = SCSI_LOW_MALLOC(sizeof(*splp));
 	if (splp == NULL)
+	{
+		SCSI_LOW_FREE(sap);
 		return ENOMEM;
+	}
 
 	SCSI_LOW_BZERO(sap, sizeof(*sap));
 	SCSI_LOW_BZERO(splp, sizeof(*splp));

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 11:39:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ECAA61065670
	for ; Sat, 31 Oct 2009 11:39:58 +0000 (UTC)
	(envelope-from chris@brueffer.de)
Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9])
	by mx1.freebsd.org (Postfix) with ESMTP id 7D1E68FC15
	for ; Sat, 31 Oct 2009 11:39:58 +0000 (UTC)
Received: from brueffer.de (host1.allnav.ch [212.55.212.50])
	by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis)
	id 0MfSpf-1Mpezx2gW3-00OUW0; Sat, 31 Oct 2009 12:27:15 +0100
Received: by brueffer.de (Postfix, from userid 1001)
	id 2B25917040; Sat, 31 Oct 2009 12:27:04 +0100 (CET)
Date: Sat, 31 Oct 2009 12:27:03 +0100
From: Christian Brueffer 
To: jhell 
Message-ID: <20091031112703.GA1426@serenity>
References: <200910281746.n9SHkqBq068138@svn.freebsd.org>
	
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="+QahgC5+KEYLbs62"
Content-Disposition: inline
In-Reply-To: 
X-Operating-System: FreeBSD 9.0-CURRENT
X-PGP-Key: http://people.FreeBSD.org/~brueffer/brueffer.key.asc
X-PGP-Fingerprint: A5C8 2099 19FF AACA F41B  B29B 6C76 178C A0ED 982D
User-Agent: Mutt/1.5.19 (2009-01-05)
X-Provags-ID: V01U2FsdGVkX1/4AIQyz1oRyXWUQ0ys0skg6SJmWCmGwwBgrff
	QzWcmwaJQVqEYn3hLKglG+gwS56I/YmB30u0gS72Mj/7Agh9+W
	tLpXEwn7SMrGjpeMd7kOSECVI9taqPD
Cc: svn-src-all@freebsd.org
Subject: Re: svn commit: r198553 - stable/7/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 11:39:59 -0000


--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Oct 28, 2009 at 09:20:00PM -0400, jhell wrote:
>=20
> On Wed, 28 Oct 2009 13:46, brueffer@ wrote:
> > Author: brueffer
> > Date: Wed Oct 28 17:46:52 2009
> > New Revision: 198553
> > URL: http://svn.freebsd.org/changeset/base/198553
> >
> > Log:
> >  MFC: r198363
> >
> >  List more dependencies for these drivers. While here, convert
> >  atapicam(4) to use our standard section 4 SYNOPSIS layout.
> >
> > Modified:
> >  stable/7/share/man/man4/   (props changed)
> >  stable/7/share/man/man4/atapicam.4
> >  stable/7/share/man/man4/umass.4
> >
> --------------------------------------------------------------
> >>> stage 1: configuring the kernel
> --------------------------------------------------------------
> cd /usr/src/sys/i386/conf;=20
> PATH=3D/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/u=
sr/bin:/usr/obj/usr/src/tmp/legacy/usr/games:/usr/obj/usr/src/tmp/usr/sbin:=
/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr=
/sbin:/usr/bin=20
> config  -d /usr/obj/usr/src/sys/SH4500  /usr/src/sys/i386/conf/SH4500
> config: Error: device "cam" is unknown
>=20
> cam is not a device or a option on stable/7 or before. Maybe stable/8 -> =
?=20
> or is this planned to be turned into a device ?.
>=20
> Already included without extra added options here on r198529M stable/7
>=20
> # kldstat -v |grep cam
>                  41 cam
> #
>=20

You`re right, I was fooled by the MODULE_DEPEND on cam. It`s already
included in device scbus, when built into the kernel.

Thanks for the notice!

- Christian

--=20
Christian Brueffer	chris@unixpages.org	brueffer@FreeBSD.org
GPG Key:	 http://people.freebsd.org/~brueffer/brueffer.key.asc
GPG Fingerprint: A5C8 2099 19FF AACA F41B  B29B 6C76 178C A0ED 982D

--+QahgC5+KEYLbs62
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkrsHwcACgkQbHYXjKDtmC2L/QCfQOLzTq8/UcZ/nGgRdS7PHflH
ZL4An2Zw96cZj0oWg6vMX0Z7i/ARR5Nz
=ohJm
-----END PGP SIGNATURE-----

--+QahgC5+KEYLbs62--

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 11:40:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCC351065670;
	Sat, 31 Oct 2009 11:40:55 +0000 (UTC)
	(envelope-from chris@brueffer.de)
Received: from moutng.kundenserver.de (moutng.kundenserver.de
	[212.227.126.177])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BA8D8FC1E;
	Sat, 31 Oct 2009 11:40:55 +0000 (UTC)
Received: from brueffer.de (host1.allnav.ch [212.55.212.50])
	by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis)
	id 0LfFcq-1MOXn92s80-00p0TW; Sat, 31 Oct 2009 12:28:19 +0100
Received: by brueffer.de (Postfix, from userid 1001)
	id BC7CE17040; Sat, 31 Oct 2009 12:28:09 +0100 (CET)
Date: Sat, 31 Oct 2009 12:28:09 +0100
From: Christian Brueffer 
To: src-committers@freebsd.org
Message-ID: <20091031112809.GB1426@serenity>
References: <200910291559.n9TFxRXN002288@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="TRYliJ5NKNqkz5bu"
Content-Disposition: inline
In-Reply-To: <200910291559.n9TFxRXN002288@svn.freebsd.org>
X-Operating-System: FreeBSD 9.0-CURRENT
X-PGP-Key: http://people.FreeBSD.org/~brueffer/brueffer.key.asc
X-PGP-Fingerprint: A5C8 2099 19FF AACA F41B  B29B 6C76 178C A0ED 982D
User-Agent: Mutt/1.5.19 (2009-01-05)
X-Provags-ID: V01U2FsdGVkX19qS9vtiOAObCXwYi/J5hYzA4EPRVYEz52BP/i
	dU3pOra6had624ixK0KXViXLr9WHNhIJstf6nyPXRWBrfoOYYB
	GRZVWBGnN4NsdvAukgFo5Uyhylkwc5f
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r198609 - head/share/man/man4
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 11:40:56 -0000


--TRYliJ5NKNqkz5bu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 29, 2009 at 03:59:27PM +0000, Christian Brueffer wrote:
> Author: brueffer
> Date: Thu Oct 29 15:59:27 2009
> New Revision: 198609
> URL: http://svn.freebsd.org/changeset/base/198609
>=20
> Log:
>   Revert part of r198363, there is no "device cam", it is
>   included in "device scbus".
>  =20
>   MFC after:	3 days
>=20
> Modified:
>   head/share/man/man4/atapicam.4
>   head/share/man/man4/umass.4
>=20

Noticed by:	jhell 

- Christian

--=20
Christian Brueffer	chris@unixpages.org	brueffer@FreeBSD.org
GPG Key:	 http://people.freebsd.org/~brueffer/brueffer.key.asc
GPG Fingerprint: A5C8 2099 19FF AACA F41B  B29B 6C76 178C A0ED 982D

--TRYliJ5NKNqkz5bu
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkrsH0kACgkQbHYXjKDtmC0FkACdHrA5xWCCTza2/VEb4xCiQPxO
IdcAnRXu1ANeh4oYnr3XpokBoZ5IGpi/
=WA6o
-----END PGP SIGNATURE-----

--TRYliJ5NKNqkz5bu--

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 12:22:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 423C1106568D;
	Sat, 31 Oct 2009 12:22:24 +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 319BB8FC32;
	Sat, 31 Oct 2009 12:22: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 n9VCMOpY089117;
	Sat, 31 Oct 2009 12:22:24 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VCMOGk089115;
	Sat, 31 Oct 2009 12:22:24 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200910311222.n9VCMOGk089115@svn.freebsd.org>
From: Christian Brueffer 
Date: Sat, 31 Oct 2009 12:22: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: r198714 - head/sbin/mknod
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 12:22:24 -0000

Author: brueffer
Date: Sat Oct 31 12:22:23 2009
New Revision: 198714
URL: http://svn.freebsd.org/changeset/base/198714

Log:
  The majors file was removed long ago, 0 should be used instead.
  
  PR:		139230
  Submitted by:	pluknet 
  MFC after:	1 week

Modified:
  head/sbin/mknod/mknod.8

Modified: head/sbin/mknod/mknod.8
==============================================================================
--- head/sbin/mknod/mknod.8	Sat Oct 31 11:23:54 2009	(r198713)
+++ head/sbin/mknod/mknod.8	Sat Oct 31 12:22:23 2009	(r198714)
@@ -28,7 +28,7 @@
 .\"     @(#)mknod.8	8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd December 15, 2004
+.Dd October 31, 2009
 .Dt MKNOD 8
 .Os
 .Sh NAME
@@ -74,9 +74,7 @@ and pseudo devices, and are type
 .It Ar major
 The major device number is an integer number which tells the kernel
 which device driver entry point to use.
-To learn what
-major device number to use for a particular device, check
-.Pa /usr/src/sys/conf/majors .
+This is a compatibility shim and should be left zero.
 .It Ar minor
 The minor device number tells the kernel which subunit
 the node corresponds to on the device; for example,

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 12:26:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D4B0106566B;
	Sat, 31 Oct 2009 12:26:41 +0000 (UTC)
	(envelope-from antoine@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AE358FC25;
	Sat, 31 Oct 2009 12:26: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 n9VCQfr7089243;
	Sat, 31 Oct 2009 12:26:41 GMT (envelope-from antoine@svn.freebsd.org)
Received: (from antoine@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VCQfVZ089241;
	Sat, 31 Oct 2009 12:26:41 GMT (envelope-from antoine@svn.freebsd.org)
Message-Id: <200910311226.n9VCQfVZ089241@svn.freebsd.org>
From: Antoine Brodin 
Date: Sat, 31 Oct 2009 12:26:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198715 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 12:26:41 -0000

Author: antoine
Date: Sat Oct 31 12:26:40 2009
New Revision: 198715
URL: http://svn.freebsd.org/changeset/base/198715

Log:
  MFC r196891 to stable/8:
    Change w_notrunning and w_stillcold from pointer to array so that sizeof
    returns what is expected.
  
    PR:		kern/138557
    Discussed with:	brucec@
    MFC after:	1 month

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/subr_witness.c

Modified: stable/8/sys/kern/subr_witness.c
==============================================================================
--- stable/8/sys/kern/subr_witness.c	Sat Oct 31 12:22:23 2009	(r198714)
+++ stable/8/sys/kern/subr_witness.c	Sat Oct 31 12:26:40 2009	(r198715)
@@ -469,8 +469,8 @@ static struct witness_lock_order_data *w
 static struct witness_lock_order_hash w_lohash;
 static int w_max_used_index = 0;
 static unsigned int w_generation = 0;
-static const char *w_notrunning = "Witness not running\n";
-static const char *w_stillcold = "Witness is still cold\n";
+static const char w_notrunning[] = "Witness not running\n";
+static const char w_stillcold[] = "Witness is still cold\n";
 
 
 static struct witness_order_list_entry order_lists[] = {

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 12:58:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C8B7F106566C;
	Sat, 31 Oct 2009 12:58:13 +0000 (UTC)
	(envelope-from rafan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B81928FC19;
	Sat, 31 Oct 2009 12:58: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 n9VCwDKG089957;
	Sat, 31 Oct 2009 12:58:13 GMT (envelope-from rafan@svn.freebsd.org)
Received: (from rafan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VCwDu7089955;
	Sat, 31 Oct 2009 12:58:13 GMT (envelope-from rafan@svn.freebsd.org)
Message-Id: <200910311258.n9VCwDu7089955@svn.freebsd.org>
From: Rong-En Fan 
Date: Sat, 31 Oct 2009 12:58:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-releng@freebsd.org
X-SVN-Group: releng
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198716 - in releng/8.0/contrib/ncurses: . ncurses/base
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 12:58:13 -0000

Author: rafan
Date: Sat Oct 31 12:58:13 2009
New Revision: 198716
URL: http://svn.freebsd.org/changeset/base/198716

Log:
  MFC r198490
  
   Pull upstream patch to fix ee(1) crash when received SIGWINCH:
  
     modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
     SIGWINCH, and discard that value, to avoid confusing application
     (patch by Eygene Ryabinkin, FreeBSD bin/136223).
  
  PR:		136223
  Submitted by:	Eygene Ryabinkin
  Obtained from:	ncurses-5.7-20091024 snapshot
  Approved by:	re (kib@)

Modified:
  releng/8.0/contrib/ncurses/   (props changed)
  releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c

Modified: releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c
==============================================================================
--- releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c	Sat Oct 31 12:26:40 2009	(r198715)
+++ releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c	Sat Oct 31 12:58:13 2009	(r198716)
@@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
 	    /* resizeterm can push KEY_RESIZE */
 	    if (cooked_key_in_fifo()) {
 		*result = fifo_pull(sp);
+		/*
+		 * Get the ERR from queue -- it is from WINCH,
+		 * so we should take it out, the "error" is handled.
+		 */
+		if (fifo_peek(sp) == -1)
+		    fifo_pull(sp);
 		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
 	    }
 	}

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 13:24:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B40F106566C;
	Sat, 31 Oct 2009 13:24:16 +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 ED5D78FC19;
	Sat, 31 Oct 2009 13:24: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 n9VDOEkq090633;
	Sat, 31 Oct 2009 13:24:14 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VDOEwB090618;
	Sat, 31 Oct 2009 13:24:14 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910311324.n9VDOEwB090618@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 13:24: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: r198717 - in head/sys: arm/mv dev/ata dev/ata/chipsets
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 13:24:16 -0000

Author: mav
Date: Sat Oct 31 13:24:14 2009
New Revision: 198717
URL: http://svn.freebsd.org/changeset/base/198717

Log:
  MFp4:
  - Remove most of direct relations between ATA(4) peripherial and controller
  levels. It makes logic more transparent and is a mandatory step to wrap
  ATA(4) controller level into ATA-native CAM SIM.
  - Tune AHCI and SATA2 SiI drivers memory allocation a bit to allow bigger
  I/O transaction sizes without additional cost.

Modified:
  head/sys/arm/mv/mv_sata.c
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-dma.c
  head/sys/dev/ata/ata-lowlevel.c
  head/sys/dev/ata/ata-pci.c
  head/sys/dev/ata/ata-queue.c
  head/sys/dev/ata/ata-sata.c
  head/sys/dev/ata/chipsets/ata-ahci.c
  head/sys/dev/ata/chipsets/ata-intel.c
  head/sys/dev/ata/chipsets/ata-marvell.c
  head/sys/dev/ata/chipsets/ata-promise.c
  head/sys/dev/ata/chipsets/ata-serverworks.c
  head/sys/dev/ata/chipsets/ata-siliconimage.c

Modified: head/sys/arm/mv/mv_sata.c
==============================================================================
--- head/sys/arm/mv/mv_sata.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/arm/mv/mv_sata.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -548,14 +548,16 @@ sata_channel_begin_transaction(struct at
 	uint32_t req_in;
 	int error, slot;
 
-	sc = device_get_softc(GRANDPARENT(request->dev));
+	sc = device_get_softc(device_get_parent(request->parent));
 	ch = device_get_softc(request->parent);
 
 	mtx_assert(&ch->state_mtx, MA_OWNED);
 
 	/* Only DMA R/W goes through the EDMA machine. */
 	if (request->u.ata.command != ATA_READ_DMA &&
-	    request->u.ata.command != ATA_WRITE_DMA) {
+	    request->u.ata.command != ATA_WRITE_DMA &&
+	    request->u.ata.command != ATA_READ_DMA48 &&
+	    request->u.ata.command != ATA_WRITE_DMA48) {
 
 		/* Disable EDMA before accessing legacy registers */
 		if (sata_edma_is_running(request->parent)) {
@@ -569,12 +571,9 @@ sata_channel_begin_transaction(struct at
 		return (ata_begin_transaction(request));
 	}
 
-	/* Check for 48 bit access and convert if needed */
-	ata_modify_if_48bit(request);
-
 	/* Prepare data for DMA */
 	if ((error = ch->dma.load(request, NULL, NULL))) {
-		device_printf(request->dev, "setting up DMA failed!\n");
+		device_printf(request->parent, "setting up DMA failed!\n");
 		request->result = error;
 		return ATA_OP_FINISHED;
 	}
@@ -633,7 +632,7 @@ sata_channel_end_transaction(struct ata_
 	uint32_t res_in, res_out, icr;
 	int slot;
 
-	sc = device_get_softc(GRANDPARENT(request->dev));
+	sc = device_get_softc(device_get_parent(request->parent));
 	ch = device_get_softc(request->parent);
 
 	mtx_assert(&ch->state_mtx, MA_OWNED);

Modified: head/sys/dev/ata/ata-all.c
==============================================================================
--- head/sys/dev/ata/ata-all.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-all.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -798,10 +798,10 @@ ata_default_registers(device_t dev)
 void
 ata_modify_if_48bit(struct ata_request *request)
 {
-    struct ata_channel *ch = device_get_softc(device_get_parent(request->dev));
+    struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_device *atadev = device_get_softc(request->dev);
 
-    atadev->flags &= ~ATA_D_48BIT_ACTIVE;
+    request->flags &= ~ATA_R_48BIT;
 
     if (((request->u.ata.lba + request->u.ata.count) >= ATA_MAX_28BIT_LBA ||
 	 request->u.ata.count > 256) &&
@@ -875,7 +875,7 @@ ata_modify_if_48bit(struct ata_request *
 	default:
 	    return;
 	}
-	atadev->flags |= ATA_D_48BIT_ACTIVE;
+	request->flags |= ATA_R_48BIT;
     }
     else if (atadev->param.support.command2 & ATA_SUPPORT_ADDRESS48) {
 
@@ -893,7 +893,7 @@ ata_modify_if_48bit(struct ata_request *
 	default:
 	    return;
 	}
-	atadev->flags |= ATA_D_48BIT_ACTIVE;
+	request->flags |= ATA_R_48BIT;
     }
 }
 

Modified: head/sys/dev/ata/ata-all.h
==============================================================================
--- head/sys/dev/ata/ata-all.h	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-all.h	Sat Oct 31 13:24:14 2009	(r198717)
@@ -255,7 +255,7 @@
 #define ATA_AHCI_CL_OFFSET              0
 #define ATA_AHCI_FB_OFFSET              (ATA_AHCI_CL_SIZE * 32)
 #define ATA_AHCI_CT_OFFSET              (ATA_AHCI_FB_OFFSET + 4096)
-#define ATA_AHCI_CT_SIZE                (1024 + 128)
+#define ATA_AHCI_CT_SIZE                (2176 + 128)
 
 struct ata_ahci_dma_prd {
     u_int64_t                   dba;
@@ -269,7 +269,7 @@ struct ata_ahci_cmd_tab {
     u_int8_t                    cfis[64];
     u_int8_t                    acmd[32];
     u_int8_t                    reserved[32];
-#define ATA_AHCI_DMA_ENTRIES            64
+#define ATA_AHCI_DMA_ENTRIES            129
     struct ata_ahci_dma_prd     prd_tab[ATA_AHCI_DMA_ENTRIES];
 } __packed;
 
@@ -364,6 +364,7 @@ struct ata_composite {
 struct ata_request {
     device_t                    dev;            /* device handle */
     device_t                    parent;         /* channel handle */
+    int				unit;		/* physical unit */
     union {
 	struct {
 	    u_int8_t            command;        /* command reg */
@@ -389,6 +390,7 @@ struct ata_request {
 #define         ATA_R_DMA               0x00000010
 #define         ATA_R_QUIET             0x00000020
 #define         ATA_R_TIMEOUT           0x00000040
+#define         ATA_R_48BIT             0x00000080
 
 #define         ATA_R_ORDERED           0x00000100
 #define         ATA_R_AT_HEAD           0x00000200
@@ -396,6 +398,9 @@ struct ata_request {
 #define         ATA_R_THREAD            0x00000800
 #define         ATA_R_DIRECT            0x00001000
 
+#define         ATA_R_ATAPI16           0x00010000
+#define         ATA_R_ATAPI_INTR        0x00020000
+
 #define         ATA_R_DEBUG             0x10000000
 #define         ATA_R_DANGER1           0x20000000
 #define         ATA_R_DANGER2           0x40000000
@@ -423,7 +428,7 @@ struct ata_request {
 #define ATA_DEBUG_RQ(request, string) \
     { \
     if (request->flags & ATA_R_DEBUG) \
-	device_printf(request->dev, "req=%p %s " string "\n", \
+	device_printf(request->parent, "req=%p %s " string "\n", \
 		      request, ata_cmd2str(request)); \
     }
 #else
@@ -449,7 +454,6 @@ struct ata_device {
 #define         ATA_D_USE_CHS           0x0001
 #define         ATA_D_MEDIA_CHANGED     0x0002
 #define         ATA_D_ENC_PRESENT       0x0004
-#define         ATA_D_48BIT_ACTIVE      0x0008
 };
 
 /* structure for holding DMA Physical Region Descriptors (PRD) entries */
@@ -483,7 +487,7 @@ struct ata_dma {
     u_int8_t                    *work;          /* workspace */
     bus_addr_t                  work_bus;       /* bus address of dmatab */
 
-#define ATA_DMA_SLOTS			32
+#define ATA_DMA_SLOTS			1
     int				dma_slots;	/* DMA slots allocated */
     struct ata_dmaslot		slot[ATA_DMA_SLOTS];
     u_int32_t                   alignment;      /* DMA SG list alignment */

Modified: head/sys/dev/ata/ata-dma.c
==============================================================================
--- head/sys/dev/ata/ata-dma.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-dma.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -78,7 +78,7 @@ ata_dmainit(device_t dev)
     ch->dma.segsize = 65536;
     ch->dma.max_iosize = 128 * DEV_BSIZE;
     ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT;
-    ch->dma.dma_slots = 6;
+    ch->dma.dma_slots = 1;
 
     if (bus_dma_tag_create(bus_get_dma_tag(dev), ch->dma.alignment, 0,
 			   ch->dma.max_address, BUS_SPACE_MAXADDR,
@@ -256,37 +256,36 @@ static int
 ata_dmaload(struct ata_request *request, void *addr, int *entries)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
     struct ata_dmasetprd_args dspa;
     int error;
 
     ATA_DEBUG_RQ(request, "dmaload");
 
     if (request->dma) {
-	device_printf(request->dev,
+	device_printf(request->parent,
 		      "FAILURE - already active DMA on this device\n");
 	return EIO;
     }
     if (!request->bytecount) {
-	device_printf(request->dev,
+	device_printf(request->parent,
 		      "FAILURE - zero length DMA transfer attempted\n");
 	return EIO;
     }
     if (request->bytecount & (ch->dma.alignment - 1)) {
-	device_printf(request->dev,
+	device_printf(request->parent,
 		      "FAILURE - odd-sized DMA transfer attempt %d %% %d\n",
 		      request->bytecount, ch->dma.alignment);
 	return EIO;
     }
     if (request->bytecount > ch->dma.max_iosize) {
-	device_printf(request->dev,
+	device_printf(request->parent,
 		      "FAILURE - oversized DMA transfer attempt %d > %d\n",
 		      request->bytecount, ch->dma.max_iosize);
 	return EIO;
     }
 
-    /* set our slot, unit for simplicity XXX SOS NCQ will change that */
-    request->dma = &ch->dma.slot[atadev->unit];
+    /* set our slot. XXX SOS NCQ will change that */
+    request->dma = &ch->dma.slot[0];
 
     if (addr)
 	dspa.dmatab = addr;
@@ -297,7 +296,7 @@ ata_dmaload(struct ata_request *request,
 				 request->data, request->bytecount,
 				 ch->dma.setprd, &dspa, BUS_DMA_NOWAIT)) ||
 				 (error = dspa.error)) {
-	device_printf(request->dev, "FAILURE - load data\n");
+	device_printf(request->parent, "FAILURE - load data\n");
 	goto error;
     }
 

Modified: head/sys/dev/ata/ata-lowlevel.c
==============================================================================
--- head/sys/dev/ata/ata-lowlevel.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-lowlevel.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
 
 /* prototypes */
 static int ata_generic_status(device_t dev);
-static int ata_wait(struct ata_channel *ch, struct ata_device *, u_int8_t);
+static int ata_wait(struct ata_channel *ch, int unit, u_int8_t);
 static void ata_pio_read(struct ata_request *, int);
 static void ata_pio_write(struct ata_request *, int);
 static void ata_tf_read(struct ata_request *);
@@ -77,7 +77,6 @@ int
 ata_begin_transaction(struct ata_request *request)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
     int dummy, error;
 
     ATA_DEBUG_RQ(request, "begin transaction");
@@ -88,9 +87,6 @@ ata_begin_transaction(struct ata_request
 	 (ATA_R_ATAPI | ATA_R_DMA | ATA_R_WRITE)))
 	request->flags &= ~ATA_R_DMA;
 
-    /* check for 48 bit access and convert if needed */
-    ata_modify_if_48bit(request);
-
     switch (request->flags & (ATA_R_ATAPI | ATA_R_DMA)) {
 
     /* ATA PIO data transfer and control commands */
@@ -101,7 +97,7 @@ ata_begin_transaction(struct ata_request
 
 	    /* issue command */
 	    if (ch->hw.command(request)) {
-		device_printf(request->dev, "error issuing %s command\n",
+		device_printf(request->parent, "error issuing %s command\n",
 			   ata_cmd2str(request));
 		request->result = EIO;
 		goto begin_finished;
@@ -122,8 +118,8 @@ ata_begin_transaction(struct ata_request
 
 	    /* if write command output the data */
 	    if (write) {
-		if (ata_wait(ch, atadev, (ATA_S_READY | ATA_S_DRQ)) < 0) {
-		    device_printf(request->dev,
+		if (ata_wait(ch, request->unit, (ATA_S_READY | ATA_S_DRQ)) < 0) {
+		    device_printf(request->parent,
 				  "timeout waiting for write DRQ\n");
 		    request->result = EIO;
 		    goto begin_finished;
@@ -137,14 +133,14 @@ ata_begin_transaction(struct ata_request
     case ATA_R_DMA:
 	/* check sanity, setup SG list and DMA engine */
 	if ((error = ch->dma.load(request, NULL, &dummy))) {
-	    device_printf(request->dev, "setting up DMA failed\n");
+	    device_printf(request->parent, "setting up DMA failed\n");
 	    request->result = error;
 	    goto begin_finished;
 	}
 
 	/* issue command */
 	if (ch->hw.command(request)) {
-	    device_printf(request->dev, "error issuing %s command\n",
+	    device_printf(request->parent, "error issuing %s command\n",
 		       ata_cmd2str(request));
 	    request->result = EIO;
 	    goto begin_finished;
@@ -152,7 +148,7 @@ ata_begin_transaction(struct ata_request
 
 	/* start DMA engine */
 	if (ch->dma.start && ch->dma.start(request)) {
-	    device_printf(request->dev, "error starting DMA\n");
+	    device_printf(request->parent, "error starting DMA\n");
 	    request->result = EIO;
 	    goto begin_finished;
 	}
@@ -162,7 +158,7 @@ ata_begin_transaction(struct ata_request
     case ATA_R_ATAPI:
 	/* is this just a POLL DSC command ? */
 	if (request->u.atapi.ccb[0] == ATAPI_POLL_DSC) {
-	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit));
+	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit));
 	    DELAY(10);
 	    if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DSC))
 		request->result = EBUSY;
@@ -171,7 +167,7 @@ ata_begin_transaction(struct ata_request
 
 	/* start ATAPI operation */
 	if (ch->hw.command(request)) {
-	    device_printf(request->dev, "error issuing ATA PACKET command\n");
+	    device_printf(request->parent, "error issuing ATA PACKET command\n");
 	    request->result = EIO;
 	    goto begin_finished;
 	}
@@ -181,7 +177,7 @@ ata_begin_transaction(struct ata_request
     case ATA_R_ATAPI|ATA_R_DMA:
 	/* is this just a POLL DSC command ? */
 	if (request->u.atapi.ccb[0] == ATAPI_POLL_DSC) {
-	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit));
+	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit));
 	    DELAY(10);
 	    if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DSC))
 		request->result = EBUSY;
@@ -190,14 +186,14 @@ ata_begin_transaction(struct ata_request
 
 	/* check sanity, setup SG list and DMA engine */
 	if ((error = ch->dma.load(request, NULL, &dummy))) {
-	    device_printf(request->dev, "setting up DMA failed\n");
+	    device_printf(request->parent, "setting up DMA failed\n");
 	    request->result = error;
 	    goto begin_finished;
 	}
 
 	/* start ATAPI operation */
 	if (ch->hw.command(request)) {
-	    device_printf(request->dev, "error issuing ATA PACKET command\n");
+	    device_printf(request->parent, "error issuing ATA PACKET command\n");
 	    request->result = EIO;
 	    goto begin_finished;
 	}
@@ -229,7 +225,6 @@ int
 ata_end_transaction(struct ata_request *request)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
     int length;
 
     ATA_DEBUG_RQ(request, "end transaction");
@@ -266,8 +261,8 @@ ata_end_transaction(struct ata_request *
 
 		if (request->u.ata.command != ATA_ATAPI_IDENTIFY)
 		    flags |= ATA_S_READY;
-		if (ata_wait(ch, atadev, flags) < 0) {
-		    device_printf(request->dev,
+		if (ata_wait(ch, request->unit, flags) < 0) {
+		    device_printf(request->parent,
 				  "timeout waiting for read DRQ\n");
 		    request->result = EIO;
 		    goto end_finished;
@@ -290,8 +285,8 @@ ata_end_transaction(struct ata_request *
 		if (request->flags & ATA_R_WRITE) {
 
 		    /* if we get an error here we are done with the HW */
-		    if (ata_wait(ch, atadev, (ATA_S_READY | ATA_S_DRQ)) < 0) {
-			device_printf(request->dev,
+		    if (ata_wait(ch, request->unit, (ATA_S_READY | ATA_S_DRQ)) < 0) {
+			device_printf(request->parent,
 				      "timeout waiting for write DRQ\n");
 			request->status = ATA_IDX_INB(ch, ATA_STATUS);
 			goto end_finished;
@@ -347,20 +342,19 @@ ata_end_transaction(struct ata_request *
 	    DELAY(10);
 
 	    if (!(request->status & ATA_S_DRQ)) {
-		device_printf(request->dev, "command interrupt without DRQ\n");
+		device_printf(request->parent, "command interrupt without DRQ\n");
 		request->status = ATA_S_ERROR;
 		goto end_finished;
 	    }
 	    ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (int16_t *)request->u.atapi.ccb,
-			       (atadev->param.config &
-				ATA_PROTO_MASK)== ATA_PROTO_ATAPI_12 ? 6 : 8);
+			       (request->flags & ATA_R_ATAPI16) ? 8 : 6);
 	    /* return wait for interrupt */
 	    goto end_continue;
 
 	case ATAPI_P_WRITE:
 	    if (request->flags & ATA_R_READ) {
 		request->status = ATA_S_ERROR;
-		device_printf(request->dev,
+		device_printf(request->parent,
 			      "%s trying to write on read buffer\n",
 			   ata_cmd2str(request));
 		goto end_finished;
@@ -378,7 +372,7 @@ ata_end_transaction(struct ata_request *
 	case ATAPI_P_READ:
 	    if (request->flags & ATA_R_WRITE) {
 		request->status = ATA_S_ERROR;
-		device_printf(request->dev,
+		device_printf(request->parent,
 			      "%s trying to read on write buffer\n",
 			   ata_cmd2str(request));
 		goto end_finished;
@@ -393,7 +387,7 @@ ata_end_transaction(struct ata_request *
 	    goto end_continue;
 
 	case ATAPI_P_DONEDRQ:
-	    device_printf(request->dev,
+	    device_printf(request->parent,
 			  "WARNING - %s DONEDRQ non conformant device\n",
 			  ata_cmd2str(request));
 	    if (request->flags & ATA_R_READ) {
@@ -415,7 +409,7 @@ ata_end_transaction(struct ata_request *
 	    goto end_finished;
 
 	default:
-	    device_printf(request->dev, "unknown transfer phase\n");
+	    device_printf(request->parent, "unknown transfer phase\n");
 	    request->status = ATA_S_ERROR;
 	}
 
@@ -603,7 +597,7 @@ ata_generic_status(device_t dev)
 }
 
 static int
-ata_wait(struct ata_channel *ch, struct ata_device *atadev, u_int8_t mask)
+ata_wait(struct ata_channel *ch, int unit, u_int8_t mask)
 {
     u_int8_t status;
     int timeout = 0;
@@ -616,7 +610,7 @@ ata_wait(struct ata_channel *ch, struct 
 
 	/* if drive fails status, reselect the drive and try again */
 	if (status == 0xff) {
-	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit));
+	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(unit));
 	    timeout += 1000;
 	    DELAY(1000);
 	    continue;
@@ -657,14 +651,13 @@ int
 ata_generic_command(struct ata_request *request)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
 
     /* select device */
-    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(atadev->unit));
+    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit));
 
     /* ready to issue command ? */
-    if (ata_wait(ch, atadev, 0) < 0) { 
-	device_printf(request->dev, "timeout waiting to issue command\n");
+    if (ata_wait(ch, request->unit, 0) < 0) { 
+	device_printf(request->parent, "timeout waiting to issue command\n");
 	return -1;
     }
 
@@ -673,6 +666,7 @@ ata_generic_command(struct ata_request *
 
     if (request->flags & ATA_R_ATAPI) {
 	int timeout = 5000;
+	int res;
 
 	/* issue packet command to controller */
 	if (request->flags & ATA_R_DMA) {
@@ -688,9 +682,16 @@ ata_generic_command(struct ata_request *
 	ATA_IDX_OUTB(ch, ATA_COMMAND, ATA_PACKET_CMD);
 
 	/* command interrupt device ? just return and wait for interrupt */
-	if ((atadev->param.config & ATA_DRQ_MASK) == ATA_DRQ_INTR)
+	if (request->flags & ATA_R_ATAPI_INTR)
 	    return 0;
 
+	/* command processed ? */
+	res = ata_wait(ch, request->unit, 0);
+	if (res != 0) {
+	    if (res < 0)
+		    device_printf(request->parent, "timeout waiting for PACKET command\n");
+	    return (-1);
+	}
 	/* wait for ready to write ATAPI command block */
 	while (timeout--) {
 	    int reason = ATA_IDX_INB(ch, ATA_IREASON);
@@ -702,7 +703,7 @@ ata_generic_command(struct ata_request *
 	    DELAY(20);
 	}
 	if (timeout <= 0) {
-	    device_printf(request->dev, "timeout waiting for ATAPI ready\n");
+	    device_printf(request->parent, "timeout waiting for ATAPI ready\n");
 	    request->result = EIO;
 	    return -1;
 	}
@@ -712,8 +713,7 @@ ata_generic_command(struct ata_request *
 		    
 	/* output command block */
 	ATA_IDX_OUTSW_STRM(ch, ATA_DATA, (int16_t *)request->u.atapi.ccb,
-			   (atadev->param.config & ATA_PROTO_MASK) ==
-			   ATA_PROTO_ATAPI_12 ? 6 : 8);
+			   (request->flags & ATA_R_ATAPI16) ? 8 : 6);
     }
     else {
 	ch->hw.tf_write(request);
@@ -728,9 +728,8 @@ static void
 ata_tf_read(struct ata_request *request)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_IDX_OUTB(ch, ATA_CONTROL, ATA_A_4BIT | ATA_A_HOB);
 	request->u.ata.count = (ATA_IDX_INB(ch, ATA_COUNT) << 8);
 	request->u.ata.lba =
@@ -760,7 +759,7 @@ ata_tf_write(struct ata_request *request
     struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_device *atadev = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature >> 8);
 	ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature);
 	ATA_IDX_OUTB(ch, ATA_COUNT, request->u.ata.count >> 8);
@@ -771,7 +770,7 @@ ata_tf_write(struct ata_request *request
 	ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8);
 	ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 40);
 	ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16);
-	ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(atadev->unit));
+	ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit));
     }
     else {
 	ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature);
@@ -793,7 +792,7 @@ ata_tf_write(struct ata_request *request
 			 (request->u.ata.lba / (sectors * heads)));
 	    ATA_IDX_OUTB(ch, ATA_CYL_MSB,
 			 (request->u.ata.lba / (sectors * heads)) >> 8);
-	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit) | 
+	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | 
 			 (((request->u.ata.lba% (sectors * heads)) /
 			   sectors) & 0xf));
 	}
@@ -802,7 +801,7 @@ ata_tf_write(struct ata_request *request
 	    ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8);
 	    ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16);
 	    ATA_IDX_OUTB(ch, ATA_DRIVE,
-			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(atadev->unit) |
+			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) |
 			 ((request->u.ata.lba >> 24) & 0x0f));
 	}
     }
@@ -825,7 +824,7 @@ ata_pio_read(struct ata_request *request
 			  size / sizeof(int32_t));
 
     if (request->transfersize < length) {
-	device_printf(request->dev, "WARNING - %s read data overrun %d>%d\n",
+	device_printf(request->parent, "WARNING - %s read data overrun %d>%d\n",
 		   ata_cmd2str(request), length, request->transfersize);
 	for (resid = request->transfersize; resid < length;
 	     resid += sizeof(int16_t))
@@ -850,7 +849,7 @@ ata_pio_write(struct ata_request *reques
 			   size / sizeof(int32_t));
 
     if (request->transfersize < length) {
-	device_printf(request->dev, "WARNING - %s write data underrun %d>%d\n",
+	device_printf(request->parent, "WARNING - %s write data underrun %d>%d\n",
 		   ata_cmd2str(request), length, request->transfersize);
 	for (resid = request->transfersize; resid < length;
 	     resid += sizeof(int16_t))

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-pci.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -477,7 +477,7 @@ ata_pci_dmareset(device_t dev)
     ch->dma.flags &= ~ATA_DMA_ACTIVE;
     ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR);
     if ((request = ch->running)) {
-	device_printf(request->dev, "DMA reset calling unload\n");
+	device_printf(dev, "DMA reset calling unload\n");
 	ch->dma.unload(request);
     }
 }

Modified: head/sys/dev/ata/ata-queue.c
==============================================================================
--- head/sys/dev/ata/ata-queue.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-queue.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -52,17 +52,25 @@ void
 ata_queue_request(struct ata_request *request)
 {
     struct ata_channel *ch;
+    struct ata_device *atadev = device_get_softc(request->dev);
 
     /* treat request as virgin (this might be an ATA_R_REQUEUE) */
     request->result = request->status = request->error = 0;
 
-    /* check that the device is still valid */
+    /* Prepare paramers required by low-level code. */
+    request->unit = atadev->unit;
     if (!(request->parent = device_get_parent(request->dev))) {
 	request->result = ENXIO;
 	if (request->callback)
 	    (request->callback)(request);
 	return;
     }
+    if ((atadev->param.config & ATA_PROTO_MASK) == ATA_PROTO_ATAPI_16)
+	request->flags |= ATA_R_ATAPI16;
+    if ((atadev->param.config & ATA_DRQ_MASK) == ATA_DRQ_INTR)
+	request->flags |= ATA_R_ATAPI_INTR;
+    if ((request->flags & ATA_R_ATAPI) == 0)
+	ata_modify_if_48bit(request);
     ch = device_get_softc(request->parent);
     callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED);
     if (!request->callback && !(request->flags & ATA_R_REQUEUE))

Modified: head/sys/dev/ata/ata-sata.c
==============================================================================
--- head/sys/dev/ata/ata-sata.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/ata-sata.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -246,11 +246,10 @@ ata_sata_setmode(device_t dev, int mode)
 int
 ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis)
 {
-    struct ata_device *atadev = device_get_softc(request->dev);
 
     if (request->flags & ATA_R_ATAPI) {
 	fis[0] = 0x27;  		/* host to device */
-	fis[1] = 0x80 | (atadev->unit & 0x0f);
+	fis[1] = 0x80 | (request->unit & 0x0f);
 	fis[2] = ATA_PACKET_CMD;
 	if (request->flags & (ATA_R_READ | ATA_R_WRITE))
 	    fis[3] = ATA_F_DMA;
@@ -263,16 +262,15 @@ ata_request2fis_h2d(struct ata_request *
 	return 20;
     }
     else {
-	ata_modify_if_48bit(request);
 	fis[0] = 0x27;			/* host to device */
-	fis[1] = 0x80 | (atadev->unit & 0x0f);
+	fis[1] = 0x80 | (request->unit & 0x0f);
 	fis[2] = request->u.ata.command;
 	fis[3] = request->u.ata.feature;
 	fis[4] = request->u.ata.lba;
 	fis[5] = request->u.ata.lba >> 8;
 	fis[6] = request->u.ata.lba >> 16;
 	fis[7] = ATA_D_LBA;
-	if (!(atadev->flags & ATA_D_48BIT_ACTIVE))
+	if (!(request->flags & ATA_R_48BIT))
 	    fis[7] |= (ATA_D_IBM | (request->u.ata.lba >> 24 & 0x0f));
 	fis[8] = request->u.ata.lba >> 24;
 	fis[9] = request->u.ata.lba >> 32; 
@@ -339,9 +337,6 @@ ata_pm_identify(device_t dev)
 		      pm_chipid, pm_revision, pm_ports);
     }
 
-    /* realloc space for needed DMA slots */
-    ch->dma.dma_slots = pm_ports;
-
     /* reset all ports and register if anything connected */
     for (port=0; port < pm_ports; port++) {
 	u_int32_t signature;

Modified: head/sys/dev/ata/chipsets/ata-ahci.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-ahci.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-ahci.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -385,23 +385,22 @@ ata_ahci_status(device_t dev)
 static int
 ata_ahci_begin_transaction(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
     struct ata_ahci_cmd_tab *ctp;
     struct ata_ahci_cmd_list *clp;
     int offset = ch->unit << 7;
-    int port = atadev->unit & 0x0f;
+    int port = request->unit & 0x0f;
     int entries = 0;
     int fis_size;
 	
     /* get a piece of the workspace for this request */
     ctp = (struct ata_ahci_cmd_tab *)
-	  (ch->dma.work + ATA_AHCI_CT_OFFSET + (ATA_AHCI_CT_SIZE*request->tag));
+	  (ch->dma.work + ATA_AHCI_CT_OFFSET);
 
     /* setup the FIS for this request */
     if (!(fis_size = ata_ahci_setup_fis(ctp, request))) {
-	device_printf(request->dev, "setting up SATA FIS failed\n");
+	device_printf(request->parent, "setting up SATA FIS failed\n");
 	request->result = EIO;
 	return ATA_OP_FINISHED;
     }
@@ -409,7 +408,7 @@ ata_ahci_begin_transaction(struct ata_re
     /* if request moves data setup and load SG list */
     if (request->flags & (ATA_R_READ | ATA_R_WRITE)) {
 	if (ch->dma.load(request, ctp->prd_tab, &entries)) {
-	    device_printf(request->dev, "setting up DMA failed\n");
+	    device_printf(request->parent, "setting up DMA failed\n");
 	    request->result = EIO;
 	    return ATA_OP_FINISHED;
 	}
@@ -417,7 +416,7 @@ ata_ahci_begin_transaction(struct ata_re
 
     /* setup the command list entry */
     clp = (struct ata_ahci_cmd_list *)
-	  (ch->dma.work + ATA_AHCI_CL_OFFSET + (ATA_AHCI_CL_SIZE*request->tag));
+	  (ch->dma.work + ATA_AHCI_CL_OFFSET);
 
     clp->prd_length = entries;
     clp->cmd_flags = (request->flags & ATA_R_WRITE ? ATA_AHCI_CMD_WRITE : 0) |
@@ -426,12 +425,7 @@ ata_ahci_begin_transaction(struct ata_re
 		     (fis_size / sizeof(u_int32_t)) |
     		     (port << 12);
     clp->bytecount = 0;
-    clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET +
-				  (ATA_AHCI_CT_SIZE * request->tag));
-
-    /* clear eventual ACTIVE bit */
-    ATA_IDX_OUTL(ch, ATA_SACTIVE,
-		 ATA_IDX_INL(ch, ATA_SACTIVE) & (1 << request->tag));
+    clp->cmd_table_phys = htole64(ch->dma.work_bus + ATA_AHCI_CT_OFFSET);
 
     /* set command type bit */
     if (request->flags & ATA_R_ATAPI)
@@ -444,7 +438,7 @@ ata_ahci_begin_transaction(struct ata_re
 		 ~ATA_AHCI_P_CMD_ATAPI);
 
     /* issue command to controller */
-    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, (1 << request->tag));
+    ATA_OUTL(ctlr->r_res2, ATA_AHCI_P_CI + offset, 1);
     
     if (!(request->flags & ATA_R_ATAPI)) {
 	/* device reset doesn't interrupt */
@@ -476,7 +470,7 @@ ata_ahci_begin_transaction(struct ata_re
 static int
 ata_ahci_end_transaction(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_ahci_cmd_list *clp;
     u_int32_t tf_data;
@@ -495,13 +489,12 @@ ata_ahci_end_transaction(struct ata_requ
 
     /* on control commands read back registers to the request struct */
     if (request->flags & ATA_R_CONTROL) {
-	struct ata_device *atadev = device_get_softc(request->dev);
 	u_int8_t *fis = ch->dma.work + ATA_AHCI_FB_OFFSET + 0x40;
 
 	request->u.ata.count = fis[12] | ((u_int16_t)fis[13] << 8);
 	request->u.ata.lba = fis[4] | ((u_int64_t)fis[5] << 8) |
 			     ((u_int64_t)fis[6] << 16);
-	if (atadev->flags & ATA_D_48BIT_ACTIVE)
+	if (request->flags & ATA_R_48BIT)
 	    request->u.ata.lba |= ((u_int64_t)fis[8] << 24) |
 				  ((u_int64_t)fis[9] << 32) |
 				  ((u_int64_t)fis[10] << 40);
@@ -511,7 +504,7 @@ ata_ahci_end_transaction(struct ata_requ
 
     /* record how much data we actually moved */
     clp = (struct ata_ahci_cmd_list *)
-	  (ch->dma.work + ATA_AHCI_CL_OFFSET + (ATA_AHCI_CL_SIZE*request->tag));
+	  (ch->dma.work + ATA_AHCI_CL_OFFSET);
     request->donecount = clp->bytecount;
 
     /* release SG list etc */

Modified: head/sys/dev/ata/chipsets/ata-intel.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-intel.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-intel.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -466,10 +466,10 @@ ata_intel_31244_status(device_t dev)
 static void
 ata_intel_31244_tf_write(struct ata_request *request)
 {
-    struct ata_channel *ch = device_get_softc(device_get_parent(request->dev));
+    struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_device *atadev = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature);
 	ATA_IDX_OUTW(ch, ATA_COUNT, request->u.ata.count);
 	ATA_IDX_OUTW(ch, ATA_SECTOR, ((request->u.ata.lba >> 16) & 0xff00) |
@@ -478,7 +478,7 @@ ata_intel_31244_tf_write(struct ata_requ
 				       ((request->u.ata.lba >> 8) & 0x00ff));
 	ATA_IDX_OUTW(ch, ATA_CYL_MSB, ((request->u.ata.lba >> 32) & 0xff00) | 
 				       ((request->u.ata.lba >> 16) & 0x00ff));
-	ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(atadev->unit));
+	ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit));
     }
     else {
 	ATA_IDX_OUTB(ch, ATA_FEATURE, request->u.ata.feature);
@@ -499,7 +499,7 @@ ata_intel_31244_tf_write(struct ata_requ
 			 (request->u.ata.lba / (sectors * heads)));
 	    ATA_IDX_OUTB(ch, ATA_CYL_MSB,
 			 (request->u.ata.lba / (sectors * heads)) >> 8);
-	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit) | 
+	    ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | 
 			 (((request->u.ata.lba% (sectors * heads)) /
 			   sectors) & 0xf));
 	}
@@ -508,7 +508,7 @@ ata_intel_31244_tf_write(struct ata_requ
 	    ATA_IDX_OUTB(ch, ATA_CYL_LSB, request->u.ata.lba >> 8);
 	    ATA_IDX_OUTB(ch, ATA_CYL_MSB, request->u.ata.lba >> 16);
 	    ATA_IDX_OUTB(ch, ATA_DRIVE,
-			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(atadev->unit) |
+			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) |
 			 ((request->u.ata.lba >> 24) & 0x0f));
 	}
     }

Modified: head/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-marvell.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-marvell.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -354,7 +354,7 @@ ata_marvell_edma_status(device_t dev)
 static int
 ata_marvell_edma_begin_transaction(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
     u_int32_t req_in;
     u_int8_t *bytep;
@@ -363,7 +363,9 @@ ata_marvell_edma_begin_transaction(struc
 
     /* only DMA R/W goes through the EMDA machine */
     if (request->u.ata.command != ATA_READ_DMA &&
-	request->u.ata.command != ATA_WRITE_DMA) {
+	request->u.ata.command != ATA_WRITE_DMA &&
+	request->u.ata.command != ATA_READ_DMA48 &&
+	request->u.ata.command != ATA_WRITE_DMA48) {
 
 	/* disable the EDMA machinery */
 	if (ATA_INL(ctlr->r_res1, 0x02028 + ATA_MV_EDMA_BASE(ch)) & 0x00000001)
@@ -371,12 +373,9 @@ ata_marvell_edma_begin_transaction(struc
 	return ata_begin_transaction(request);
     }
 
-    /* check for 48 bit access and convert if needed */
-    ata_modify_if_48bit(request);
-
     /* check sanity, setup SG list and DMA engine */
     if ((error = ch->dma.load(request, NULL, NULL))) {
-	device_printf(request->dev, "setting up DMA failed\n");
+	device_printf(request->parent, "setting up DMA failed\n");
 	request->result = error;
 	return ATA_OP_FINISHED;
     }
@@ -472,7 +471,7 @@ ata_marvell_edma_begin_transaction(struc
 static int
 ata_marvell_edma_end_transaction(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
     int offset = (ch->unit > 3 ? 0x30014 : 0x20014);
     u_int32_t icr = ATA_INL(ctlr->r_res1, offset);

Modified: head/sys/dev/ata/chipsets/ata-promise.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-promise.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-promise.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -387,11 +387,10 @@ ata_promise_status(device_t dev)
 static int
 ata_promise_dmastart(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev  = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_OUTB(ctlr->r_res1, 0x11,
 		 ATA_INB(ctlr->r_res1, 0x11) | (ch->unit ? 0x08 : 0x02));
 	ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20,
@@ -411,12 +410,11 @@ ata_promise_dmastart(struct ata_request 
 static int
 ata_promise_dmastop(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev  = device_get_softc(request->dev);
     int error;
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_OUTB(ctlr->r_res1, 0x11,
 		 ATA_INB(ctlr->r_res1, 0x11) & ~(ch->unit ? 0x08 : 0x02));
 	ATA_OUTL(ctlr->r_res1, ch->unit ? 0x24 : 0x20, 0);
@@ -682,9 +680,8 @@ ata_promise_mio_status(device_t dev)
 static int
 ata_promise_mio_command(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
 
     u_int32_t *wordp = (u_int32_t *)ch->dma.work;
 
@@ -693,7 +690,7 @@ ata_promise_mio_command(struct ata_reque
     if ((ctlr->chip->cfg2 == PR_SATA2) ||
         ((ctlr->chip->cfg2 == PR_CMBO2) && (ch->unit < 2))) {
 	/* set portmultiplier port */
-	ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), atadev->unit & 0x0f);
+	ATA_OUTB(ctlr->r_res2, 0x4e8 + (ch->unit << 8), request->unit & 0x0f);
     }
 
     /* XXX SOS add ATAPI commands support later */
@@ -1051,7 +1048,7 @@ ata_promise_sx4_intr(void *data)
 static int
 ata_promise_sx4_command(struct ata_request *request)
 {
-    device_t gparent = GRANDPARENT(request->dev);
+    device_t gparent = device_get_parent(request->parent);
     struct ata_pci_controller *ctlr = device_get_softc(gparent);
     struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_dma_prdentry *prd;
@@ -1158,15 +1155,14 @@ ata_promise_sx4_command(struct ata_reque
 static int
 ata_promise_apkt(u_int8_t *bytep, struct ata_request *request)
 { 
-    struct ata_device *atadev = device_get_softc(request->dev);
     int i = 12;
 
     bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_PDC_WAIT_NBUSY|ATA_DRIVE;
-    bytep[i++] = ATA_D_IBM | ATA_D_LBA | ATA_DEV(atadev->unit);
+    bytep[i++] = ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit);
     bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_CTL;
     bytep[i++] = ATA_A_4BIT;
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	bytep[i++] = ATA_PDC_2B | ATA_PDC_WRITE_REG | ATA_FEATURE;
 	bytep[i++] = request->u.ata.feature >> 8;
 	bytep[i++] = request->u.ata.feature;
@@ -1183,7 +1179,7 @@ ata_promise_apkt(u_int8_t *bytep, struct
 	bytep[i++] = request->u.ata.lba >> 40;
 	bytep[i++] = request->u.ata.lba >> 16;
 	bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_DRIVE;
-	bytep[i++] = ATA_D_LBA | ATA_DEV(atadev->unit);
+	bytep[i++] = ATA_D_LBA | ATA_DEV(request->unit);
     }
     else {
 	bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_FEATURE;
@@ -1197,8 +1193,7 @@ ata_promise_apkt(u_int8_t *bytep, struct
 	bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_CYL_MSB;
 	bytep[i++] = request->u.ata.lba >> 16;
 	bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_REG | ATA_DRIVE;
-	bytep[i++] = (atadev->flags & ATA_D_USE_CHS ? 0 : ATA_D_LBA) |
-		     ATA_D_IBM | ATA_DEV(atadev->unit) |
+	bytep[i++] = ATA_D_LBA | ATA_D_IBM | ATA_DEV(request->unit) |
 		     ((request->u.ata.lba >> 24)&0xf);
     }
     bytep[i++] = ATA_PDC_1B | ATA_PDC_WRITE_END | ATA_COMMAND;

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-serverworks.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -259,9 +259,8 @@ static void
 ata_serverworks_tf_read(struct ata_request *request)
 {
     struct ata_channel *ch = device_get_softc(request->parent);
-    struct ata_device *atadev = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	u_int16_t temp;
 
 	request->u.ata.count = ATA_IDX_INW(ch, ATA_COUNT);
@@ -290,7 +289,7 @@ ata_serverworks_tf_write(struct ata_requ
     struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_device *atadev = device_get_softc(request->dev);
 
-    if (atadev->flags & ATA_D_48BIT_ACTIVE) {
+    if (request->flags & ATA_R_48BIT) {
 	ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature);
 	ATA_IDX_OUTW(ch, ATA_COUNT, request->u.ata.count);
 	ATA_IDX_OUTW(ch, ATA_SECTOR, ((request->u.ata.lba >> 16) & 0xff00) |
@@ -299,7 +298,7 @@ ata_serverworks_tf_write(struct ata_requ
 				       ((request->u.ata.lba >> 8) & 0x00ff));
 	ATA_IDX_OUTW(ch, ATA_CYL_MSB, ((request->u.ata.lba >> 32) & 0xff00) | 
 				       ((request->u.ata.lba >> 16) & 0x00ff));
-	ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(atadev->unit));
+	ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_LBA | ATA_DEV(request->unit));
     }
     else {
 	ATA_IDX_OUTW(ch, ATA_FEATURE, request->u.ata.feature);
@@ -320,7 +319,7 @@ ata_serverworks_tf_write(struct ata_requ
 			 (request->u.ata.lba / (sectors * heads)));
 	    ATA_IDX_OUTW(ch, ATA_CYL_MSB,
 			 (request->u.ata.lba / (sectors * heads)) >> 8);
-	    ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(atadev->unit) | 
+	    ATA_IDX_OUTW(ch, ATA_DRIVE, ATA_D_IBM | ATA_DEV(request->unit) | 
 			 (((request->u.ata.lba% (sectors * heads)) /
 			   sectors) & 0xf));
 	}
@@ -329,7 +328,7 @@ ata_serverworks_tf_write(struct ata_requ
 	    ATA_IDX_OUTW(ch, ATA_CYL_LSB, request->u.ata.lba >> 8);
 	    ATA_IDX_OUTW(ch, ATA_CYL_MSB, request->u.ata.lba >> 16);
 	    ATA_IDX_OUTW(ch, ATA_DRIVE,
-			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(atadev->unit) |
+			 ATA_D_IBM | ATA_D_LBA | ATA_DEV(request->unit) |
 			 ((request->u.ata.lba >> 24) & 0x0f));
 	}
     }

Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-siliconimage.c	Sat Oct 31 12:58:13 2009	(r198716)
+++ head/sys/dev/ata/chipsets/ata-siliconimage.c	Sat Oct 31 13:24:14 2009	(r198717)
@@ -457,7 +457,7 @@ struct ata_siiprb_dma_prdentry {
     u_int32_t control;
 } __packed;
 
-#define ATA_SIIPRB_DMA_ENTRIES		125
+#define ATA_SIIPRB_DMA_ENTRIES		129
 struct ata_siiprb_ata_command {
     struct ata_siiprb_dma_prdentry prd[ATA_SIIPRB_DMA_ENTRIES];
 } __packed;
@@ -542,7 +542,7 @@ ata_siiprb_status(device_t dev)
 static int
 ata_siiprb_begin_transaction(struct ata_request *request)
 {
-    struct ata_pci_controller *ctlr=device_get_softc(GRANDPARENT(request->dev));
+    struct ata_pci_controller *ctlr=device_get_softc(device_get_parent(request->parent));
     struct ata_channel *ch = device_get_softc(request->parent);
     struct ata_siiprb_command *prb;
     struct ata_siiprb_dma_prdentry *prd;

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

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 14:19:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66BDB106568F;
	Sat, 31 Oct 2009 14:19:50 +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 562E88FC16;
	Sat, 31 Oct 2009 14:19: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 n9VEJoiD092016;
	Sat, 31 Oct 2009 14:19:50 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VEJoPp092014;
	Sat, 31 Oct 2009 14:19:50 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910311419.n9VEJoPp092014@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 14:19: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: r198718 - head/sys/dev/ata/chipsets
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 14:19:50 -0000

Author: mav
Date: Sat Oct 31 14:19:50 2009
New Revision: 198718
URL: http://svn.freebsd.org/changeset/base/198718

Log:
  Allow newly added controllers to use full I/O sizes.

Modified:
  head/sys/dev/ata/chipsets/ata-marvell.c

Modified: head/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-marvell.c	Sat Oct 31 13:24:14 2009	(r198717)
+++ head/sys/dev/ata/chipsets/ata-marvell.c	Sat Oct 31 14:19:50 2009	(r198718)
@@ -591,7 +591,9 @@ ata_marvell_edma_dmainit(device_t dev)
 
     /* chip does not reliably do 64K DMA transfers */
     if (ctlr->chip->cfg2 == MV_50XX || ctlr->chip->cfg2 == MV_60XX)
-	ch->dma.max_iosize = 64 * DEV_BSIZE; 
+	ch->dma.max_iosize = 64 * DEV_BSIZE;
+    else
+	ch->dma.max_iosize = (ATA_DMA_ENTRIES - 1) * PAGE_SIZE;
 }
 
 ATA_DECLARE_DRIVER(ata_marvell);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:06:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 636D2106566B;
	Sat, 31 Oct 2009 17:06:37 +0000 (UTC) (envelope-from se@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1CCA58FC16;
	Sat, 31 Oct 2009 17:06: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 n9VH6aAV096749;
	Sat, 31 Oct 2009 17:06:37 GMT (envelope-from se@svn.freebsd.org)
Received: (from se@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VH6abO096748;
	Sat, 31 Oct 2009 17:06:36 GMT (envelope-from se@svn.freebsd.org)
Message-Id: <200910311706.n9VH6abO096748@svn.freebsd.org>
From: Stefan Esser 
Date: Sat, 31 Oct 2009 17:06: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: r198719 - head/sys/dev/sym
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:06:37 -0000

Author: se
Date: Sat Oct 31 17:06:36 2009
New Revision: 198719
URL: http://svn.freebsd.org/changeset/base/198719

Log:
  While certain supported Symbios/LSI SCSI chips (532c896, 53c1000, 53c1010)
  do support 64bit addresses, the current SCRIPTS code supports only 32bit
  addresses causing data corruption for buffer addresses >4GB. This problem
  affects 64bit machines with more than 4GB RAM or amd64 with 4GB and
  memory hole remapping.
  Work-around this problem with a bus_dma tag that requests bounce-buffers
  for addresses >4GB. This causes some overhead, but given the maximum SCSI
  bus speed of 160MB/s compared, the effect should hardly be noticeable.
  The problem was reported by Mike Watters (mike at mwatters net) who also
  verified that this fix cures the problem.
  
  Since this change is a NOOP on systems with less than 4GB RAM and fixes
  data corruption (in RAM and on disk) on systems with more than 4GB, I hope
  that this change is accepted for 8.0.
  
  MFC after:	3 days (pending approval)

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Sat Oct 31 14:19:50 2009	(r198718)
+++ head/sys/dev/sym/sym_hipd.c	Sat Oct 31 17:06:36 2009	(r198719)
@@ -8582,7 +8582,7 @@ sym_pci_attach(device_t dev)
 	 *  Allocate a tag for the DMA of user data.
 	 */
 	if (bus_dma_tag_create(np->bus_dmat, 1, (1<<24),
-				BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
+				BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
 				NULL, NULL,
 				BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG,
 				(1<<24), 0, busdma_lock_mutex, &np->mtx,

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:28:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D3EA106568F;
	Sat, 31 Oct 2009 17:28:09 +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 3AE488FC0A;
	Sat, 31 Oct 2009 17:28: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 n9VHS8p5097275;
	Sat, 31 Oct 2009 17:28:08 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHS865097273;
	Sat, 31 Oct 2009 17:28:08 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200910311728.n9VHS865097273@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 31 Oct 2009 17:28:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198720 - in stable/7/sys: . contrib/pf dev/ata
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:28:09 -0000

Author: mav
Date: Sat Oct 31 17:28:08 2009
New Revision: 198720
URL: http://svn.freebsd.org/changeset/base/198720

Log:
  MFC rev. 196893:
  Remove constraint, requiring request data to fulfill controller's alignment
  requirements. It is busdma task, to manage proper alignment by loading
  data to bounce buffers.
  
  PR:		kern/120787, kern/127316

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ata/ata-dma.c

Modified: stable/7/sys/dev/ata/ata-dma.c
==============================================================================
--- stable/7/sys/dev/ata/ata-dma.c	Sat Oct 31 17:06:36 2009	(r198719)
+++ stable/7/sys/dev/ata/ata-dma.c	Sat Oct 31 17:28:08 2009	(r198720)
@@ -233,9 +233,9 @@ ata_dmaload(device_t dev, caddr_t data, 
 	device_printf(dev, "FAILURE - zero length DMA transfer attempted\n");
 	return EIO;
     }
-    if (((uintptr_t)data & (ch->dma->alignment - 1)) ||
-	(count & (ch->dma->alignment - 1))) {
-	device_printf(dev, "FAILURE - non aligned DMA transfer attempted\n");
+    if (count & (ch->dma->alignment - 1)) {
+	device_printf(dev, "FAILURE - odd-sized DMA transfer attempt %d %% %d\n",
+	    count, ch->dma->alignment);
 	return EIO;
     }
     if (count > ch->dma->max_iosize) {

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:39:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACBF61065676;
	Sat, 31 Oct 2009 17:39:56 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9BD418FC18;
	Sat, 31 Oct 2009 17:39: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 n9VHduJI097563;
	Sat, 31 Oct 2009 17:39:56 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHdu6T097561;
	Sat, 31 Oct 2009 17:39:56 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200910311739.n9VHdu6T097561@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Oct 2009 17:39: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: r198721 - head/sys/vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:39:56 -0000

Author: alc
Date: Sat Oct 31 17:39:56 2009
New Revision: 198721
URL: http://svn.freebsd.org/changeset/base/198721

Log:
  Correct an error in vm_fault_copy_entry() that has existed since the first
  version of this file.  When a process forks, any wired pages are immediately
  copied because copy-on-write is not supported for wired pages.  In other
  words, the child process is given its own private copy of each wired page
  from its parent's address space.  Unfortunately, to date, these copied pages
  have been mapped into the child's address space with the wrong permissions,
  typically VM_PROT_ALL.  This change corrects the permissions.
  
  Reviewed by:	kib

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Sat Oct 31 17:28:08 2009	(r198720)
+++ head/sys/vm/vm_fault.c	Sat Oct 31 17:39:56 2009	(r198721)
@@ -1179,7 +1179,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm
 		dst_object->uip = dst_entry->uip;
 		dst_entry->uip = NULL;
 	}
-	access = prot = dst_entry->max_protection;
+	access = prot = dst_entry->protection;
 	/*
 	 * If not an upgrade, then enter the mappings in the pmap as
 	 * read and/or execute accesses.  Otherwise, enter them as

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:46:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5C1A01065694;
	Sat, 31 Oct 2009 17:46:50 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AC728FC1D;
	Sat, 31 Oct 2009 17:46: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 n9VHko7j097775;
	Sat, 31 Oct 2009 17:46:50 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHkofi097773;
	Sat, 31 Oct 2009 17:46:50 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910311746.n9VHkofi097773@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 31 Oct 2009 17:46: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: r198722 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:46:50 -0000

Author: nwhitehorn
Date: Sat Oct 31 17:46:50 2009
New Revision: 198722
URL: http://svn.freebsd.org/changeset/base/198722

Log:
  Garbage collect set_user_sr(), which is declared static inline and
  never called.

Modified:
  head/sys/powerpc/aim/trap.c

Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c	Sat Oct 31 17:39:56 2009	(r198721)
+++ head/sys/powerpc/aim/trap.c	Sat Oct 31 17:46:50 2009	(r198722)
@@ -85,8 +85,6 @@ static int	fix_unaligned(struct thread *
 static int	handle_onfault(struct trapframe *frame);
 static void	syscall(struct trapframe *frame);
 
-static __inline void	setusr(u_int);
-
 int	setfault(faultbuf);		/* defined in locore.S */
 
 /* Why are these not defined in a header? */
@@ -558,13 +556,6 @@ trap_pfault(struct trapframe *frame, int
 	return (SIGSEGV);
 }
 
-static __inline void
-setusr(u_int content)
-{
-	__asm __volatile ("isync; mtsr %0,%1; isync"
-		      :: "n"(USER_SR), "r"(content));
-}
-
 int
 badaddr(void *addr, size_t size)
 {

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:55:48 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C64C4106566C;
	Sat, 31 Oct 2009 17:55:48 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B6BD8FC13;
	Sat, 31 Oct 2009 17:55: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 n9VHtmV1098020;
	Sat, 31 Oct 2009 17:55:48 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHtmcM098018;
	Sat, 31 Oct 2009 17:55:48 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910311755.n9VHtmcM098018@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 31 Oct 2009 17:55: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: r198723 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:55:48 -0000

Author: nwhitehorn
Date: Sat Oct 31 17:55:48 2009
New Revision: 198723
URL: http://svn.freebsd.org/changeset/base/198723

Log:
  Loop on blocked threads when using ULE scheduler, removing an
  XXX MP comment.

Modified:
  head/sys/powerpc/aim/swtch.S

Modified: head/sys/powerpc/aim/swtch.S
==============================================================================
--- head/sys/powerpc/aim/swtch.S	Sat Oct 31 17:46:50 2009	(r198722)
+++ head/sys/powerpc/aim/swtch.S	Sat Oct 31 17:55:48 2009	(r198723)
@@ -57,6 +57,7 @@
  */
 
 #include "assym.s"
+#include "opt_sched.h"
 
 #include 
 
@@ -81,25 +82,23 @@ ENTRY(cpu_throw)
  * Switch to a new thread saving the current state in the old thread.
  */
 ENTRY(cpu_switch)
-	stw	%r5,TD_LOCK(%r3)	/* ULE:	update old thread's lock */
-					/* XXX needs to change for MP */
-
-	lwz	%r5,TD_PCB(%r3)		/* Get the old thread's PCB ptr */
+	lwz	%r6,TD_PCB(%r3)		/* Get the old thread's PCB ptr */
 	mr	%r12,%r2	
-	stmw	%r12,PCB_CONTEXT(%r5)	/* Save the non-volatile GP regs.
+	stmw	%r12,PCB_CONTEXT(%r6)	/* Save the non-volatile GP regs.
 					   These can now be used for scratch */
 
 	mfcr	%r16			/* Save the condition register */
-	stw	%r16,PCB_CR(%r5)
+	stw	%r16,PCB_CR(%r6)
 	mflr	%r16			/* Save the link register */
-	stw	%r16,PCB_LR(%r5)
+	stw	%r16,PCB_LR(%r6)
 	mfsr	%r16,USER_SR		/* Save USER_SR for copyin/out */
 	isync
-	stw	%r16,PCB_AIM_USR(%r5)
-	stw	%r1,PCB_SP(%r5)		/* Save the stack pointer */
+	stw	%r16,PCB_AIM_USR(%r6)
+	stw	%r1,PCB_SP(%r6)		/* Save the stack pointer */
 
 	mr	%r14,%r3		/* Copy the old thread ptr... */
 	mr	%r15,%r4		/* and the new thread ptr in scratch */
+	mr	%r16,%r5		/* and the new lock */
 	
 	lwz	%r6,PCB_FLAGS(%r5)
 	/* Save FPU context if needed */
@@ -118,7 +117,20 @@ ENTRY(cpu_switch)
 	mr	%r3,%r14		/* restore old thread ptr */
 	bl	pmap_deactivate		/* Deactivate the current pmap */
 
+	stw	%r16,TD_LOCK(%r14)	/* ULE:	update old thread's lock */
+
 cpu_switchin:
+#if defined(SMP) && defined(SCHED_ULE)
+	/* Wait for the new thread to become unblocked */
+	sync
+	lis	%r6,blocked_lock@ha
+	addi	%r6,%r6,blocked_lock@l
+blocked_loop:
+	lwz	%r7,TD_LOCK(%r15)
+	cmpw	%r6,%r7 
+	beq	blocked_loop
+#endif
+
 	mfsprg	%r7,0			/* Get the pcpu pointer */
 	stw	%r15,PC_CURTHREAD(%r7)	/* Store new current thread */
 	lwz	%r17,TD_PCB(%r15)	/* Store new current PCB */

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 17:59:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31E171065670;
	Sat, 31 Oct 2009 17:59:25 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 205DE8FC0C;
	Sat, 31 Oct 2009 17:59: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 n9VHxPYb098124;
	Sat, 31 Oct 2009 17:59:25 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VHxP4U098122;
	Sat, 31 Oct 2009 17:59:25 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910311759.n9VHxP4U098122@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 31 Oct 2009 17:59: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: r198724 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 17:59:25 -0000

Author: nwhitehorn
Date: Sat Oct 31 17:59:24 2009
New Revision: 198724
URL: http://svn.freebsd.org/changeset/base/198724

Log:
  Fix a race in casuword() exposed by csup. casuword() non-atomically read
  the current value of its argument before atomically replacing it, which
  could occasionally return the wrong value on an SMP system. This resulted
  in user mutex operations hanging when using threaded applications.

Modified:
  head/sys/powerpc/aim/copyinout.c

Modified: head/sys/powerpc/aim/copyinout.c
==============================================================================
--- head/sys/powerpc/aim/copyinout.c	Sat Oct 31 17:55:48 2009	(r198723)
+++ head/sys/powerpc/aim/copyinout.c	Sat Oct 31 17:59:24 2009	(r198724)
@@ -347,8 +347,19 @@ casuword(volatile u_long *addr, u_long o
 		return (-1);
 	}
 
-	val = *p;
-	(void) atomic_cmpset_32((volatile uint32_t *)p, old, new);
+	__asm __volatile (
+		"1:\tlwarx %0, 0, %2\n\t"	/* load old value */
+		"cmplw %3, %0\n\t"		/* compare */
+		"bne 2f\n\t"			/* exit if not equal */
+		"stwcx. %4, 0, %2\n\t"      	/* attempt to store */
+		"bne- 1b\n\t"			/* spin if failed */
+		"b 3f\n\t"			/* we've succeeded */
+		"2:\n\t"
+		"stwcx. %0, 0, %2\n\t"       	/* clear reservation (74xx) */
+		"3:\n\t"
+		: "=&r" (val), "=m" (*p)
+		: "r" (p), "r" (old), "r" (new), "m" (*p)
+		: "cc", "memory");
 
 	td->td_pcb->pcb_onfault = NULL;
 

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 18:04:35 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B8DA10656AC;
	Sat, 31 Oct 2009 18:04:35 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A29B8FC20;
	Sat, 31 Oct 2009 18:04: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 n9VI4Y2V098369;
	Sat, 31 Oct 2009 18:04:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VI4Yqe098367;
	Sat, 31 Oct 2009 18:04:34 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910311804.n9VI4Yqe098367@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 31 Oct 2009 18:04: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: r198725 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 18:04:35 -0000

Author: nwhitehorn
Date: Sat Oct 31 18:04:34 2009
New Revision: 198725
URL: http://svn.freebsd.org/changeset/base/198725

Log:
  Remove an unnecessary sync that crept in the last commit.

Modified:
  head/sys/powerpc/aim/swtch.S

Modified: head/sys/powerpc/aim/swtch.S
==============================================================================
--- head/sys/powerpc/aim/swtch.S	Sat Oct 31 17:59:24 2009	(r198724)
+++ head/sys/powerpc/aim/swtch.S	Sat Oct 31 18:04:34 2009	(r198725)
@@ -122,7 +122,6 @@ ENTRY(cpu_switch)
 cpu_switchin:
 #if defined(SMP) && defined(SCHED_ULE)
 	/* Wait for the new thread to become unblocked */
-	sync
 	lis	%r6,blocked_lock@ha
 	addi	%r6,%r6,blocked_lock@l
 blocked_loop:

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 18:18:33 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E127106566B;
	Sat, 31 Oct 2009 18:18:33 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0AE558FC32;
	Sat, 31 Oct 2009 18:18: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 n9VIIWup098747;
	Sat, 31 Oct 2009 18:18:32 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VIIWrY098745;
	Sat, 31 Oct 2009 18:18:32 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200910311818.n9VIIWrY098745@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Oct 2009 18:18:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198726 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 18:18:33 -0000

Author: alc
Date: Sat Oct 31 18:18:32 2009
New Revision: 198726
URL: http://svn.freebsd.org/changeset/base/198726

Log:
  MFC r198472
    Eliminate an unnecessary check from vm_fault_prefault().

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/vm/vm_fault.c

Modified: stable/8/sys/vm/vm_fault.c
==============================================================================
--- stable/8/sys/vm/vm_fault.c	Sat Oct 31 18:04:34 2009	(r198725)
+++ stable/8/sys/vm/vm_fault.c	Sat Oct 31 18:18:32 2009	(r198726)
@@ -1011,8 +1011,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset
 		while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
 		    lobject->type == OBJT_DEFAULT &&
 		    (backing_object = lobject->backing_object) != NULL) {
-			if (lobject->backing_object_offset & PAGE_MASK)
-				break;
+			KASSERT((lobject->backing_object_offset & PAGE_MASK) ==
+			    0, ("vm_fault_prefault: unaligned object offset"));
 			pindex += lobject->backing_object_offset >> PAGE_SHIFT;
 			VM_OBJECT_LOCK(backing_object);
 			VM_OBJECT_UNLOCK(lobject);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 18:46:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2CDC106566C;
	Sat, 31 Oct 2009 18:46:55 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0D5E8FC1B;
	Sat, 31 Oct 2009 18:46: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 n9VIktq3099389;
	Sat, 31 Oct 2009 18:46:55 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VIktFP099387;
	Sat, 31 Oct 2009 18:46:55 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200910311846.n9VIktFP099387@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Oct 2009 18:46:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198727 - in stable/7/sys: . contrib/pf vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 18:46:55 -0000

Author: alc
Date: Sat Oct 31 18:46:55 2009
New Revision: 198727
URL: http://svn.freebsd.org/changeset/base/198727

Log:
  MFC r198472
    Eliminate an unnecessary check from vm_fault_prefault().

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/vm/vm_fault.c

Modified: stable/7/sys/vm/vm_fault.c
==============================================================================
--- stable/7/sys/vm/vm_fault.c	Sat Oct 31 18:18:32 2009	(r198726)
+++ stable/7/sys/vm/vm_fault.c	Sat Oct 31 18:46:55 2009	(r198727)
@@ -970,8 +970,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset
 		while ((m = vm_page_lookup(lobject, pindex)) == NULL &&
 		    lobject->type == OBJT_DEFAULT &&
 		    (backing_object = lobject->backing_object) != NULL) {
-			if (lobject->backing_object_offset & PAGE_MASK)
-				break;
+			KASSERT((lobject->backing_object_offset & PAGE_MASK) ==
+			    0, ("vm_fault_prefault: unaligned object offset"));
 			pindex += lobject->backing_object_offset >> PAGE_SHIFT;
 			VM_OBJECT_LOCK(backing_object);
 			VM_OBJECT_UNLOCK(lobject);

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 18:54:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46897106566C;
	Sat, 31 Oct 2009 18:54:27 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F0B748FC1C;
	Sat, 31 Oct 2009 18:54: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 n9VIsQ2G099601;
	Sat, 31 Oct 2009 18:54:26 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VIsQYQ099590;
	Sat, 31 Oct 2009 18:54:26 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200910311854.n9VIsQYQ099590@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Oct 2009 18:54:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198728 - in stable/8/sys: . amd64/include
	amd64/include/xen arm/include cddl/contrib/opensolaris
	contrib/dev/acpica contrib/pf dev/xen/xenpci i386/include
	ia64/include kern mips/includ...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 18:54:27 -0000

Author: alc
Date: Sat Oct 31 18:54:26 2009
New Revision: 198728
URL: http://svn.freebsd.org/changeset/base/198728

Log:
  MFC r197316
    Add a new sysctl for reporting all of the supported page sizes.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/param.h
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/arm/include/param.h
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/include/param.h
  stable/8/sys/ia64/include/param.h
  stable/8/sys/kern/kern_mib.c
  stable/8/sys/mips/include/param.h
  stable/8/sys/powerpc/include/param.h
  stable/8/sys/sparc64/include/param.h
  stable/8/sys/sun4v/include/param.h
  stable/8/sys/sys/systm.h

Modified: stable/8/sys/amd64/include/param.h
==============================================================================
--- stable/8/sys/amd64/include/param.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/amd64/include/param.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -118,6 +118,8 @@
 #define	NBPML4		(1ul<flags & SCTL_MASK32) {
+		/*
+		 * Recreate the "pagesizes" array with 32-bit elements.  Truncate
+		 * any page size greater than UINT32_MAX to zero.
+		 */
+		for (i = 0; i < MAXPAGESIZES; i++)
+			pagesizes32[i] = (uint32_t)pagesizes[i];
+
+		error = SYSCTL_OUT(req, pagesizes32, sizeof(pagesizes32));
+	} else
+#endif
+		error = SYSCTL_OUT(req, pagesizes, sizeof(pagesizes));
+	return (error);
+}
+SYSCTL_PROC(_hw, OID_AUTO, pagesizes, CTLTYPE_ULONG | CTLFLAG_RD,
+    NULL, 0, sysctl_hw_pagesizes, "LU", "Supported page sizes");
+
 static char	machine_arch[] = MACHINE_ARCH;
 SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD,
     machine_arch, 0, "System architecture");

Modified: stable/8/sys/mips/include/param.h
==============================================================================
--- stable/8/sys/mips/include/param.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/mips/include/param.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -115,6 +115,8 @@
 #define	SEGOFSET	(NBSEG-1)	/* byte offset into segment */
 #define	SEGSHIFT	22		/* LOG2(NBSEG) */
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 /* XXXimp: This has moved to vmparam.h */
 /* Also, this differs from the mips2 definition, but likely is better */
 /* since this means the kernel won't chew up TLBs when it is executing */

Modified: stable/8/sys/powerpc/include/param.h
==============================================================================
--- stable/8/sys/powerpc/include/param.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/powerpc/include/param.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -98,6 +98,8 @@
 #define	PAGE_MASK	(PAGE_SIZE - 1)
 #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define	KSTACK_PAGES		4		/* includes pcb */
 #endif

Modified: stable/8/sys/sparc64/include/param.h
==============================================================================
--- stable/8/sys/sparc64/include/param.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/sparc64/include/param.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -121,6 +121,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: stable/8/sys/sun4v/include/param.h
==============================================================================
--- stable/8/sys/sun4v/include/param.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/sun4v/include/param.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -116,6 +116,8 @@
 #define PAGE_SIZE_MAX	PAGE_SIZE_4M
 #define PAGE_MASK_MAX	PAGE_MASK_4M
 
+#define	MAXPAGESIZES	1		/* maximum number of supported page sizes */
+
 #ifndef KSTACK_PAGES
 #define KSTACK_PAGES		4	/* pages of kernel stack (with pcb) */
 #endif

Modified: stable/8/sys/sys/systm.h
==============================================================================
--- stable/8/sys/sys/systm.h	Sat Oct 31 18:46:55 2009	(r198727)
+++ stable/8/sys/sys/systm.h	Sat Oct 31 18:54:26 2009	(r198728)
@@ -54,6 +54,7 @@ extern int kstack_pages;	/* number of ke
 
 extern int nswap;		/* size of swap space */
 
+extern u_long pagesizes[];	/* supported page sizes */
 extern long physmem;		/* physical memory */
 extern long realmem;		/* 'real' memory */
 

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 18:54:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46CCB10656C0;
	Sat, 31 Oct 2009 18:54:45 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id DB1B98FC15;
	Sat, 31 Oct 2009 18:54:44 +0000 (UTC)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id F1EEE1CC4D; Sat, 31 Oct 2009 19:54:43 +0100 (CET)
Date: Sat, 31 Oct 2009 19:54:43 +0100
From: Ed Schouten 
To: Christian Brueffer 
Message-ID: <20091031185443.GE1293@hoeg.nl>
References: <200910311222.n9VCMOGk089115@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="Rm5rkB9L8kG9H2n8"
Content-Disposition: inline
In-Reply-To: <200910311222.n9VCMOGk089115@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: r198714 - head/sbin/mknod
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 18:54:45 -0000


--Rm5rkB9L8kG9H2n8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Christian,

* Christian Brueffer  wrote:
> The majors file was removed long ago, 0 should be used instead.

It's a bit more complex than that. Right now devices are automatically
numbered, using a 32-bits integer. The following macros are used to
obtain the minor and major numbers (see ):

| #define major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
| #define minor(x)	((int)((x)&0xffff00ff))		/* minor number */

This means that a device number above 255 may (or may not) have a
non-zero major number. Just run the following code:

| #include 
| #include 
| #include 
|=20
| int
| main(int argc, char *argv[])
| {
|=20
| 	while (posix_openpt(O_RDWR|O_NOCTTY) >=3D 0);
| 	sleep(30);
| 	return (0);
| }

On my system it even generates device nodes in /dev/pts with a major
number of 4. I wrote a manpage for these macros some time ago. See
makedev(3).

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--Rm5rkB9L8kG9H2n8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrsh/MACgkQ52SDGA2eCwVVuACfe4j8+CKF2Hb4Rxn3pEbz3Zpz
yYcAnjCOF15CDu9zQoIwL76KydvkWvU1
=A2LX
-----END PGP SIGNATURE-----

--Rm5rkB9L8kG9H2n8--

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 19:02:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 15FE3106566C;
	Sat, 31 Oct 2009 19:02:09 +0000 (UTC) (envelope-from alc@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 02A078FC1A;
	Sat, 31 Oct 2009 19: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 n9VJ28Qr099934;
	Sat, 31 Oct 2009 19:02:08 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VJ28Zh099931;
	Sat, 31 Oct 2009 19:02:08 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200910311902.n9VJ28Zh099931@svn.freebsd.org>
From: Alan Cox 
Date: Sat, 31 Oct 2009 19:02:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198729 - in stable/8/sys: . amd64/amd64
	amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica
	contrib/pf dev/xen/xenpci i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 19:02:09 -0000

Author: alc
Date: Sat Oct 31 19:02:08 2009
New Revision: 198729
URL: http://svn.freebsd.org/changeset/base/198729

Log:
  MFC r197317
    When superpages are enabled, add the 2 or 4MB page size to the array of
    supported page sizes.

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/pmap.c
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/pmap.c

Modified: stable/8/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/8/sys/amd64/amd64/pmap.c	Sat Oct 31 18:54:26 2009	(r198728)
+++ stable/8/sys/amd64/amd64/pmap.c	Sat Oct 31 19:02:08 2009	(r198729)
@@ -663,6 +663,11 @@ pmap_init(void)
 	 * Are large page mappings enabled?
 	 */
 	TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
+	if (pg_ps_enabled) {
+		KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0,
+		    ("pmap_init: can't assign to pagesizes[1]"));
+		pagesizes[1] = NBPDR;
+	}
 
 	/*
 	 * Calculate the size of the pv head table for superpages.

Modified: stable/8/sys/i386/i386/pmap.c
==============================================================================
--- stable/8/sys/i386/i386/pmap.c	Sat Oct 31 18:54:26 2009	(r198728)
+++ stable/8/sys/i386/i386/pmap.c	Sat Oct 31 19:02:08 2009	(r198729)
@@ -673,6 +673,11 @@ pmap_init(void)
 	 * Are large page mappings enabled?
 	 */
 	TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
+	if (pg_ps_enabled) {
+		KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0,
+		    ("pmap_init: can't assign to pagesizes[1]"));
+		pagesizes[1] = NBPDR;
+	}
 
 	/*
 	 * Calculate the size of the pv head table for superpages.

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 19:05:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BE1C6106566B;
	Sat, 31 Oct 2009 19:05:26 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 8308A8FC1B;
	Sat, 31 Oct 2009 19:05:26 +0000 (UTC)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id AF7E21CC4D; Sat, 31 Oct 2009 20:05:25 +0100 (CET)
Date: Sat, 31 Oct 2009 20:05:25 +0100
From: Ed Schouten 
To: Christian Brueffer 
Message-ID: <20091031190525.GF1293@hoeg.nl>
References: <200910311222.n9VCMOGk089115@svn.freebsd.org>
	<20091031185443.GE1293@hoeg.nl>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="YfqBrEkRVu0wMIYz"
Content-Disposition: inline
In-Reply-To: <20091031185443.GE1293@hoeg.nl>
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: r198714 - head/sbin/mknod
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 19:05:26 -0000


--YfqBrEkRVu0wMIYz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Ed Schouten  wrote:
> It's a bit more complex than that. Right now devices are automatically
> numbered, using a 32-bits integer. The following macros are used to
> obtain the minor and major numbers (see ):
>=20
> | #define major(x)	((int)(((u_int)(x) >> 8)&0xff))	/* major number */
> | #define minor(x)	((int)((x)&0xffff00ff))		/* minor number */
>=20
> This means that a device number above 255 may (or may not) have a
> non-zero major number. Just run the following code:

That said, I really couldn't care less if we eventually just nuked the
entire major/minor number distinction and let applications just print
the dev_t directly. This means `ls -l' would just print a single number.
POSIX doesn't standardize major/minor numbers anyway. Just the dev_t.

Unfortunately I do realize this probably breaks a lot of high profile
software.

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--YfqBrEkRVu0wMIYz
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkrsinUACgkQ52SDGA2eCwXmAgCfZ/lLmeSjmhVTHTnlJjk7N50C
CggAn0ciIHm47trl3f51TQHGIdX79PTF
=6kfo
-----END PGP SIGNATURE-----

--YfqBrEkRVu0wMIYz--

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 20:59:13 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B63B7106566B;
	Sat, 31 Oct 2009 20:59:13 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A5EE18FC13;
	Sat, 31 Oct 2009 20:59: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 n9VKxDxD002789;
	Sat, 31 Oct 2009 20:59:13 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VKxDjG002787;
	Sat, 31 Oct 2009 20:59:13 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200910312059.n9VKxDjG002787@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Sat, 31 Oct 2009 20:59: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: r198731 - head/sys/powerpc/aim
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 20:59:13 -0000

Author: nwhitehorn
Date: Sat Oct 31 20:59:13 2009
New Revision: 198731
URL: http://svn.freebsd.org/changeset/base/198731

Log:
  Unbreak cpu_switch(). The register allocator in my brain is clearly
  broken. Also, Altivec context switching worked before only by accident,
  but should work now by design.

Modified:
  head/sys/powerpc/aim/swtch.S

Modified: head/sys/powerpc/aim/swtch.S
==============================================================================
--- head/sys/powerpc/aim/swtch.S	Sat Oct 31 19:22:12 2009	(r198730)
+++ head/sys/powerpc/aim/swtch.S	Sat Oct 31 20:59:13 2009	(r198731)
@@ -99,17 +99,19 @@ ENTRY(cpu_switch)
 	mr	%r14,%r3		/* Copy the old thread ptr... */
 	mr	%r15,%r4		/* and the new thread ptr in scratch */
 	mr	%r16,%r5		/* and the new lock */
+	mr	%r17,%r6		/* and the PCB */
 	
-	lwz	%r6,PCB_FLAGS(%r5)
+	lwz	%r7,PCB_FLAGS(%r17)
 	/* Save FPU context if needed */
-	andi.	%r6, %r6, PCB_FPU
+	andi.	%r7, %r7, PCB_FPU
 	beq	.L1
 	bl	save_fpu
 
 .L1:
-	lwz	%r6,PCB_FLAGS(%r5)
+	mr	%r3,%r14		/* restore old thread ptr */
+	lwz	%r7,PCB_FLAGS(%r17)
 	/* Save Altivec context if needed */
-	andi.	%r6, %r6, PCB_VEC
+	andi.	%r7, %r7, PCB_VEC
 	beq	.L2
 	bl	save_vec
 	

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 21:22:18 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93BF71065670;
	Sat, 31 Oct 2009 21:22:18 +0000 (UTC)
	(envelope-from sson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7F5418FC15;
	Sat, 31 Oct 2009 21:22: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 n9VLMIB8003471;
	Sat, 31 Oct 2009 21:22:18 GMT (envelope-from sson@svn.freebsd.org)
Received: (from sson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VLMIPr003467;
	Sat, 31 Oct 2009 21:22:18 GMT (envelope-from sson@svn.freebsd.org)
Message-Id: <200910312122.n9VLMIPr003467@svn.freebsd.org>
From: Stacey Son 
Date: Sat, 31 Oct 2009 21:22:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r198732 - in stable/8: lib/libc lib/libc/gen
	lib/libc/stdio lib/libc/stdtime lib/libc/string lib/libc/sys
	sys sys/amd64/include/xen sys/cddl/contrib/opensolaris
	sys/contrib/dev/acpica s...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 21:22:18 -0000

Author: sson
Date: Sat Oct 31 21:22:18 2009
New Revision: 198732
URL: http://svn.freebsd.org/changeset/base/198732

Log:
  MFC 197240,197241,197242,197243,197293,197294,197407:
  
  Add EVFILT_USER filter and EV_DISPATCH/EV_RECEIPT flags to kevent(2).
  
  Approved by: rwatson (mentor)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/gen/   (props changed)
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)
  stable/8/lib/libc/sys/kqueue.2
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_event.c
  stable/8/sys/sys/event.h

Modified: stable/8/lib/libc/sys/kqueue.2
==============================================================================
--- stable/8/lib/libc/sys/kqueue.2	Sat Oct 31 20:59:13 2009	(r198731)
+++ stable/8/lib/libc/sys/kqueue.2	Sat Oct 31 21:22:18 2009	(r198732)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 6, 2007
+.Dd September 15, 2009
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -201,11 +201,25 @@ Disable the event so
 .Fn kevent
 will not return it.
 The filter itself is not disabled.
+.It EV_DISPATCH
+Disable the event source immediately after delivery of an event.
+See 
+.Dv EV_DISABLE
+above.
 .It EV_DELETE
 Removes the event from the kqueue.
 Events which are attached to
 file descriptors are automatically deleted on the last close of
 the descriptor.
+.It EV_RECEIPT
+This flag is useful for making bulk changes to a kqueue without draining
+any pending events.
+When passed as input, it forces
+.Dv EV_ERROR
+to always be returned.
+When a filter is successfully added the 
+.Va data
+field will be zero.
 .It EV_ONESHOT
 Causes the event to return only the first occurrence of the filter
 being triggered.
@@ -441,6 +455,44 @@ The link state is invalid.
 On return,
 .Va fflags
 contains the events which triggered the filter.
+.It Dv EVFILT_USER
+Establishes a user event identified by
+.Va ident
+which is not assosicated with any kernel mechanism but is triggered by
+user level code.
+The lower 24 bits of the 
+.Va fflags
+may be used for user defined flags and manipulated using the following:
+.Bl -tag -width XXNOTE_FFLAGSMASK 
+.It Dv NOTE_FFNOP
+Ignore the input
+.Va fflags .
+.It Dv NOTE_FFAND
+Bitwise AND
+.Va fflags .
+.It Dv NOTE_FFOR
+Bitwise OR
+.Va fflags .
+.It Dv NOTE_COPY
+Copy
+.Va fflags .
+.It Dv NOTE_FFCTRLMASK
+Control mask for
+.Va fflags .
+.It Dv NOTE_FFLAGSMASK
+User defined flag mask for
+.Va fflags .
+.El
+.Pp
+A user event is triggered for output with the following:
+.Bl -tag -width XXNOTE_FFLAGSMASK
+.It Dv NOTE_TRIGGER
+Cause the event to be triggered.
+.El
+.Pp
+On return,
+.Va fflags
+contains the users defined flags in the lower 24 bits.
 .El
 .Sh RETURN VALUES
 The

Modified: stable/8/sys/kern/kern_event.c
==============================================================================
--- stable/8/sys/kern/kern_event.c	Sat Oct 31 20:59:13 2009	(r198731)
+++ stable/8/sys/kern/kern_event.c	Sat Oct 31 21:22:18 2009	(r198732)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon 
  * Copyright 2004 John-Mark Gurney 
+ * Copyright (c) 2009 Apple, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -141,6 +142,11 @@ static void	filt_timerexpire(void *knx);
 static int	filt_timerattach(struct knote *kn);
 static void	filt_timerdetach(struct knote *kn);
 static int	filt_timer(struct knote *kn, long hint);
+static int	filt_userattach(struct knote *kn);
+static void	filt_userdetach(struct knote *kn);
+static int	filt_user(struct knote *kn, long hint);
+static void	filt_usertouch(struct knote *kn, struct kevent *kev,
+		    u_long type);
 
 static struct filterops file_filtops =
 	{ 1, filt_fileattach, NULL, NULL };
@@ -151,6 +157,12 @@ static struct filterops proc_filtops =
 	{ 0, filt_procattach, filt_procdetach, filt_proc };
 static struct filterops timer_filtops =
 	{ 0, filt_timerattach, filt_timerdetach, filt_timer };
+static struct filterops user_filtops = {
+	.f_attach = filt_userattach,
+	.f_detach = filt_userdetach,
+	.f_event = filt_user,
+	.f_touch = filt_usertouch,
+};
 
 static uma_zone_t	knote_zone;
 static int 		kq_ncallouts = 0;
@@ -255,6 +267,7 @@ static struct {
 	{ &file_filtops },			/* EVFILT_NETDEV */
 	{ &fs_filtops },			/* EVFILT_FS */
 	{ &null_filtops },			/* EVFILT_LIO */
+	{ &user_filtops },			/* EVFILT_USER */
 };
 
 /*
@@ -557,6 +570,94 @@ filt_timer(struct knote *kn, long hint)
 	return (kn->kn_data != 0);
 }
 
+static int
+filt_userattach(struct knote *kn)
+{
+
+	/* 
+	 * EVFILT_USER knotes are not attached to anything in the kernel.
+	 */ 
+	kn->kn_hook = NULL;
+	if (kn->kn_fflags & NOTE_TRIGGER)
+		kn->kn_hookid = 1;
+	else
+		kn->kn_hookid = 0;
+	return (0);
+}
+
+static void
+filt_userdetach(__unused struct knote *kn)
+{
+
+	/*
+	 * EVFILT_USER knotes are not attached to anything in the kernel.
+	 */
+}
+
+static int
+filt_user(struct knote *kn, __unused long hint)
+{
+
+	return (kn->kn_hookid);
+}
+
+static void
+filt_usertouch(struct knote *kn, struct kevent *kev, u_long type)
+{
+	u_int ffctrl;
+
+	switch (type) {
+	case EVENT_REGISTER:
+		if (kev->fflags & NOTE_TRIGGER)
+			kn->kn_hookid = 1;
+
+		ffctrl = kev->fflags & NOTE_FFCTRLMASK;
+		kev->fflags &= NOTE_FFLAGSMASK;
+		switch (ffctrl) {
+		case NOTE_FFNOP:
+			break;
+
+		case NOTE_FFAND:
+			kn->kn_sfflags &= kev->fflags;
+			break;
+
+		case NOTE_FFOR:
+			kn->kn_sfflags |= kev->fflags;
+			break;
+
+		case NOTE_FFCOPY:
+			kn->kn_sfflags = kev->fflags;
+			break;
+
+		default:
+			/* XXX Return error? */
+			break;
+		}
+		kn->kn_sdata = kev->data;
+		if (kev->flags & EV_CLEAR) {
+			kn->kn_hookid = 0;
+			kn->kn_data = 0;
+			kn->kn_fflags = 0;
+		}
+		break;
+
+        case EVENT_PROCESS:
+		*kev = kn->kn_kevent;
+		kev->fflags = kn->kn_sfflags;
+		kev->data = kn->kn_sdata;
+		if (kn->kn_flags & EV_CLEAR) {
+			kn->kn_hookid = 0;
+			kn->kn_data = 0;
+			kn->kn_fflags = 0;
+		}
+		break;
+
+	default:
+		panic("filt_usertouch() - invalid type (%ld)", type);
+		break;
+	}
+}
+
 int
 kqueue(struct thread *td, struct kqueue_args *uap)
 {
@@ -717,7 +818,7 @@ kern_kevent(struct thread *td, int fd, i
 				continue;
 			kevp->flags &= ~EV_SYSFLAGS;
 			error = kqueue_register(kq, kevp, td, 1);
-			if (error) {
+			if (error || (kevp->flags & EV_RECEIPT)) {
 				if (nevents != 0) {
 					kevp->flags = EV_ERROR;
 					kevp->data = error;
@@ -919,17 +1020,11 @@ findkn:
 		goto findkn;
 	}
 
-	if (kn == NULL && ((kev->flags & EV_ADD) == 0)) {
-		KQ_UNLOCK(kq);
-		error = ENOENT;
-		goto done;
-	}
-
 	/*
 	 * kn now contains the matching knote, or NULL if no match
 	 */
-	if (kev->flags & EV_ADD) {
-		if (kn == NULL) {
+	if (kn == NULL) {
+		if (kev->flags & EV_ADD) {
 			kn = tkn;
 			tkn = NULL;
 			if (kn == NULL) {
@@ -968,34 +1063,16 @@ findkn:
 				goto done;
 			}
 			KN_LIST_LOCK(kn);
+			goto done_ev_add;
 		} else {
-			/*
-			 * The user may change some filter values after the
-			 * initial EV_ADD, but doing so will not reset any
-			 * filter which has already been triggered.
-			 */
-			kn->kn_status |= KN_INFLUX;
+			/* No matching knote and the EV_ADD flag is not set. */
 			KQ_UNLOCK(kq);
-			KN_LIST_LOCK(kn);
-			kn->kn_sfflags = kev->fflags;
-			kn->kn_sdata = kev->data;
-			kn->kn_kevent.udata = kev->udata;
+			error = ENOENT;
+			goto done;
 		}
-
-		/*
-		 * We can get here with kn->kn_knlist == NULL.
-		 * This can happen when the initial attach event decides that
-		 * the event is "completed" already.  i.e. filt_procattach
-		 * is called on a zombie process.  It will call filt_proc
-		 * which will remove it from the list, and NULL kn_knlist.
-		 */
-		event = kn->kn_fop->f_event(kn, 0);
-		KQ_LOCK(kq);
-		if (event)
-			KNOTE_ACTIVATE(kn, 1);
-		kn->kn_status &= ~KN_INFLUX;
-		KN_LIST_UNLOCK(kn);
-	} else if (kev->flags & EV_DELETE) {
+	}
+	
+	if (kev->flags & EV_DELETE) {
 		kn->kn_status |= KN_INFLUX;
 		KQ_UNLOCK(kq);
 		if (!(kn->kn_status & KN_DETACHED))
@@ -1004,6 +1081,37 @@ findkn:
 		goto done;
 	}
 
+	/*
+	 * The user may change some filter values after the initial EV_ADD,
+	 * but doing so will not reset any filter which has already been
+	 * triggered.
+	 */
+	kn->kn_status |= KN_INFLUX;
+	KQ_UNLOCK(kq);
+	KN_LIST_LOCK(kn);
+	kn->kn_kevent.udata = kev->udata;
+	if (!fops->f_isfd && fops->f_touch != NULL) {
+		fops->f_touch(kn, kev, EVENT_REGISTER);
+	} else {
+		kn->kn_sfflags = kev->fflags;
+		kn->kn_sdata = kev->data;
+	}
+
+	/*
+	 * We can get here with kn->kn_knlist == NULL.  This can happen when
+	 * the initial attach event decides that the event is "completed" 
+	 * already.  i.e. filt_procattach is called on a zombie process.  It
+	 * will call filt_proc which will remove it from the list, and NULL
+	 * kn_knlist.
+	 */
+done_ev_add:
+	event = kn->kn_fop->f_event(kn, 0);
+	KQ_LOCK(kq);
+	if (event)
+		KNOTE_ACTIVATE(kn, 1);
+	kn->kn_status &= ~KN_INFLUX;
+	KN_LIST_UNLOCK(kn);
+
 	if ((kev->flags & EV_DISABLE) &&
 	    ((kn->kn_status & KN_DISABLED) == 0)) {
 		kn->kn_status |= KN_DISABLED;
@@ -1183,7 +1291,7 @@ kqueue_scan(struct kqueue *kq, int maxev
 	struct timeval atv, rtv, ttv;
 	struct knote *kn, *marker;
 	int count, timeout, nkev, error, influx;
-	int haskqglobal;
+	int haskqglobal, touch;
 
 	count = maxevents;
 	nkev = 0;
@@ -1315,12 +1423,25 @@ start:
 				influx = 1;
 				continue;
 			}
-			*kevp = kn->kn_kevent;
+			touch = (!kn->kn_fop->f_isfd &&
+			    kn->kn_fop->f_touch != NULL);
+			if (touch)
+				kn->kn_fop->f_touch(kn, kevp, EVENT_PROCESS);
+			else
+				*kevp = kn->kn_kevent;
 			KQ_LOCK(kq);
 			KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal);
-			if (kn->kn_flags & EV_CLEAR) {
-				kn->kn_data = 0;
-				kn->kn_fflags = 0;
+			if (kn->kn_flags & (EV_CLEAR |  EV_DISPATCH)) {
+				/* 
+				 * Manually clear knotes who weren't 
+				 * 'touch'ed.
+				 */
+				if (touch == 0 && kn->kn_flags & EV_CLEAR) {
+					kn->kn_data = 0;
+					kn->kn_fflags = 0;
+				}
+				if (kn->kn_flags & EV_DISPATCH)
+					kn->kn_status |= KN_DISABLED;
 				kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE);
 				kq->kq_count--;
 			} else

Modified: stable/8/sys/sys/event.h
==============================================================================
--- stable/8/sys/sys/event.h	Sat Oct 31 20:59:13 2009	(r198731)
+++ stable/8/sys/sys/event.h	Sat Oct 31 21:22:18 2009	(r198732)
@@ -41,7 +41,8 @@
 #define EVFILT_NETDEV		(-8)	/* network devices */
 #define EVFILT_FS		(-9)	/* filesystem events */
 #define EVFILT_LIO		(-10)	/* attached to lio requests */
-#define EVFILT_SYSCOUNT		10
+#define EVFILT_USER		(-11)	/* User events */
+#define EVFILT_SYSCOUNT		11
 
 #define EV_SET(kevp_, a, b, c, d, e, f) do {	\
 	struct kevent *kevp = (kevp_);		\
@@ -71,6 +72,8 @@ struct kevent {
 /* flags */
 #define EV_ONESHOT	0x0010		/* only report one occurrence */
 #define EV_CLEAR	0x0020		/* clear event state after reporting */
+#define EV_RECEIPT	0x0040		/* force EV_ERROR on success, data=0 */
+#define EV_DISPATCH	0x0080		/* disable event after reporting */
 
 #define EV_SYSFLAGS	0xF000		/* reserved by system */
 #define EV_FLAG1	0x2000		/* filter-specific flag */
@@ -79,6 +82,25 @@ struct kevent {
 #define EV_EOF		0x8000		/* EOF detected */
 #define EV_ERROR	0x4000		/* error, data contains errno */
 
+ /*
+  * data/hint flags/masks for EVFILT_USER, shared with userspace
+  *
+  * On input, the top two bits of fflags specifies how the lower twenty four
+  * bits should be applied to the stored value of fflags.
+  *
+  * On output, the top two bits will always be set to NOTE_FFNOP and the
+  * remaining twenty four bits will contain the stored fflags value.
+  */
+#define NOTE_FFNOP	0x00000000		/* ignore input fflags */
+#define NOTE_FFAND	0x40000000		/* AND fflags */
+#define NOTE_FFOR	0x80000000		/* OR fflags */
+#define NOTE_FFCOPY	0xc0000000		/* copy fflags */
+#define NOTE_FFCTRLMASK	0xc0000000		/* masks for operations */
+#define NOTE_FFLAGSMASK	0x00ffffff
+
+#define NOTE_TRIGGER	0x01000000		/* Cause the event to be
+						   triggered for output. */
+
 /*
  * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
  */
@@ -154,11 +176,22 @@ MALLOC_DECLARE(M_KQUEUE);
  */
 #define NOTE_SIGNAL	0x08000000
 
+/*
+ * Hint values for the optional f_touch event filter.  If f_touch is not set 
+ * to NULL and f_isfd is zero the f_touch filter will be called with the type
+ * argument set to EVENT_REGISTER during a kevent() system call.  It is also
+ * called under the same conditions with the type argument set to EVENT_PROCESS
+ * when the event has been triggered.
+ */
+#define EVENT_REGISTER	1
+#define EVENT_PROCESS	2
+
 struct filterops {
 	int	f_isfd;		/* true if ident == filedescriptor */
 	int	(*f_attach)(struct knote *kn);
 	void	(*f_detach)(struct knote *kn);
 	int	(*f_event)(struct knote *kn, long hint);
+	void	(*f_touch)(struct knote *kn, struct kevent *kev, u_long type);
 };
 
 /*
@@ -193,6 +226,7 @@ struct knote {
 	} kn_ptr;
 	struct			filterops *kn_fop;
 	void			*kn_hook;
+	int			kn_hookid;
 
 #define kn_id		kn_kevent.ident
 #define kn_filter	kn_kevent.filter

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 22:15:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A9118106566B;
	Sat, 31 Oct 2009 22:15:00 +0000 (UTC)
	(envelope-from peterjeremy@acm.org)
Received: from mail17.syd.optusnet.com.au (mail17.syd.optusnet.com.au
	[211.29.132.198])
	by mx1.freebsd.org (Postfix) with ESMTP id 1FCB68FC18;
	Sat, 31 Oct 2009 22:14:59 +0000 (UTC)
Received: from server.vk2pj.dyndns.org
	(c122-106-233-13.belrs3.nsw.optusnet.com.au [122.106.233.13])
	by mail17.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	n9VMEuvD016131
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sun, 1 Nov 2009 09:14:57 +1100
X-Bogosity: Ham, spamicity=0.000000
Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])
	by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id n9VMEtTJ059455;
	Sun, 1 Nov 2009 09:14:55 +1100 (EST)
	(envelope-from peter@server.vk2pj.dyndns.org)
Received: (from peter@localhost)
	by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id n9VMEtAe059454;
	Sun, 1 Nov 2009 09:14:55 +1100 (EST) (envelope-from peter)
Date: Sun, 1 Nov 2009 09:14:55 +1100
From: Peter Jeremy 
To: Alexander Motin 
Message-ID: <20091031221455.GA58662@server.vk2pj.dyndns.org>
References: <200910292053.n9TKrQtC009239@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="HlL+5n6rz5pIUxbD"
Content-Disposition: inline
In-Reply-To: <200910292053.n9TKrQtC009239@svn.freebsd.org>
X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc
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: r198623 - head/sys/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 22:15:00 -0000


--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2009-Oct-29 20:53:26 +0000, Alexander Motin  wrote:
>  Add missing ATA kernel options dependencies.

Thanks.

--=20
Peter Jeremy

--HlL+5n6rz5pIUxbD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iEYEARECAAYFAkrstt8ACgkQ/opHv/APuIc6fwCfU3cdm7XyLDFaWje2xDfT+Cmh
63oAoJ44a40f+S6RPmW/+AleKheA955r
=m/8a
-----END PGP SIGNATURE-----

--HlL+5n6rz5pIUxbD--

From owner-svn-src-all@FreeBSD.ORG  Sat Oct 31 22:27:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D0791065676;
	Sat, 31 Oct 2009 22:27:32 +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 6C51D8FC15;
	Sat, 31 Oct 2009 22:27: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 n9VMRWPA004981;
	Sat, 31 Oct 2009 22:27:32 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9VMRWB4004972;
	Sat, 31 Oct 2009 22:27:32 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200910312227.n9VMRWB4004972@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Sat, 31 Oct 2009 22:27: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: r198733 - in head/sys: conf ia64/ia64 ia64/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 31 Oct 2009 22:27:32 -0000

Author: marcel
Date: Sat Oct 31 22:27:31 2009
New Revision: 198733
URL: http://svn.freebsd.org/changeset/base/198733

Log:
  Reimplement the lazy FP context switching:
  o   Move all code into a single file for easier maintenance.
  o   Use a single global lock to avoid having to handle either
      multiple locks or race conditions.
  o   Make sure to disable the high FP registers after saving
      or dropping them.
  o   use msleep() to wait for the other CPU to save the high
      FP registers.
  
  This change fixes the high FP inconsistency panics.
  
  A single global lock typically serializes too much, which may
  be noticable when a lot of threads use the high FP registers,
  but in that case it's probably better to switch the high FP
  context synchronuously. Put differently: cpu_switch() should
  switch the high FP registers if the incoming and outgoing
  threads both use the high FP registers.

Added:
  head/sys/ia64/ia64/highfp.c   (contents, props changed)
Modified:
  head/sys/conf/files.ia64
  head/sys/ia64/ia64/interrupt.c
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/ia64/trap.c
  head/sys/ia64/ia64/vm_machdep.c
  head/sys/ia64/include/md_var.h
  head/sys/ia64/include/proc.h

Modified: head/sys/conf/files.ia64
==============================================================================
--- head/sys/conf/files.ia64	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/conf/files.ia64	Sat Oct 31 22:27:31 2009	(r198733)
@@ -84,6 +84,7 @@ ia64/ia64/elf_machdep.c		standard
 ia64/ia64/emulate.c		standard
 ia64/ia64/exception.S		standard
 ia64/ia64/gdb_machdep.c		optional	gdb
+ia64/ia64/highfp.c		standard
 ia64/ia64/in_cksum.c		optional	inet
 ia64/ia64/interrupt.c		standard
 ia64/ia64/locore.S		standard	no-obj

Added: head/sys/ia64/ia64/highfp.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/ia64/ia64/highfp.c	Sat Oct 31 22:27:31 2009	(r198733)
@@ -0,0 +1,181 @@
+/*-
+ * Copyright (c) 2009 Marcel Moolenaar
+ * 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 
+#include 
+
+#include 
+#include 
+#include 
+
+static struct mtx ia64_highfp_mtx;
+
+static void
+ia64_highfp_init(void *_)
+{
+	mtx_init(&ia64_highfp_mtx, "High FP lock", NULL, MTX_SPIN);
+}
+SYSINIT(ia64_highfp_init, SI_SUB_LOCK, SI_ORDER_ANY, ia64_highfp_init, NULL);
+
+#ifdef SMP
+static int
+ia64_highfp_ipi(struct pcpu *cpu)
+{
+	int error;
+
+	ipi_send(cpu, IPI_HIGH_FP);
+	error = msleep_spin(&cpu->pc_fpcurthread, &ia64_highfp_mtx,
+	    "High FP", 0);
+	return (error);
+}
+#endif
+
+int
+ia64_highfp_drop(struct thread *td)
+{
+	struct pcb *pcb;
+	struct pcpu *cpu;
+
+	pcb = td->td_pcb;
+
+	mtx_lock_spin(&ia64_highfp_mtx);
+	cpu = pcb->pcb_fpcpu;
+	if (cpu != NULL) {
+		KASSERT(cpu->pc_fpcurthread == td,
+		    ("cpu->pc_fpcurthread != td"));
+		td->td_frame->tf_special.psr |= IA64_PSR_DFH;
+		pcb->pcb_fpcpu = NULL;
+		cpu->pc_fpcurthread = NULL;
+	}
+	mtx_unlock_spin(&ia64_highfp_mtx);
+
+	return ((cpu != NULL) ? 1 : 0);
+}
+
+int
+ia64_highfp_enable(struct thread *td, struct trapframe *tf)
+{
+	struct pcb *pcb;
+	struct pcpu *cpu;
+	struct thread *td1;
+
+	pcb = td->td_pcb;
+
+	mtx_lock_spin(&ia64_highfp_mtx);
+	KASSERT((tf->tf_special.psr & IA64_PSR_DFH) != 0,
+	    ("(tf->tf_special.psr & IA64_PSR_DFH) == 0"));
+	cpu = pcb->pcb_fpcpu;
+#ifdef SMP
+	if (cpu != NULL && cpu != pcpup) {
+		KASSERT(cpu->pc_fpcurthread == td,
+		    ("cpu->pc_fpcurthread != td"));
+		ia64_highfp_ipi(cpu);
+	}
+#endif
+	td1 = PCPU_GET(fpcurthread);
+	if (td1 != NULL && td1 != td) {
+		KASSERT(td1->td_pcb->pcb_fpcpu == pcpup,
+		    ("td1->td_pcb->pcb_fpcpu != pcpup"));
+		save_high_fp(&td1->td_pcb->pcb_high_fp);
+		td1->td_frame->tf_special.psr |= IA64_PSR_DFH;
+		td1->td_pcb->pcb_fpcpu = NULL;
+		PCPU_SET(fpcurthread, NULL);
+		td1 = NULL;
+	}
+	if (td1 == NULL) {
+		KASSERT(pcb->pcb_fpcpu == NULL, ("pcb->pcb_fpcpu != NULL"));
+		KASSERT(PCPU_GET(fpcurthread) == NULL,
+		    ("PCPU_GET(fpcurthread) != NULL"));
+		restore_high_fp(&pcb->pcb_high_fp);
+		PCPU_SET(fpcurthread, td);
+		pcb->pcb_fpcpu = pcpup;
+		tf->tf_special.psr &= ~IA64_PSR_MFH;
+	}
+	tf->tf_special.psr &= ~IA64_PSR_DFH;
+	mtx_unlock_spin(&ia64_highfp_mtx);
+
+	return ((td1 != NULL) ? 1 : 0);
+}
+
+int
+ia64_highfp_save(struct thread *td)
+{
+	struct pcb *pcb;
+	struct pcpu *cpu;
+
+	pcb = td->td_pcb;
+
+	mtx_lock_spin(&ia64_highfp_mtx);
+	cpu = pcb->pcb_fpcpu;
+#ifdef SMP
+	if (cpu != NULL && cpu != pcpup) {
+		KASSERT(cpu->pc_fpcurthread == td,
+		    ("cpu->pc_fpcurthread != td"));
+		ia64_highfp_ipi(cpu);
+	} else
+#endif
+	if (cpu != NULL) {
+		KASSERT(cpu->pc_fpcurthread == td,
+		    ("cpu->pc_fpcurthread != td"));
+		save_high_fp(&pcb->pcb_high_fp);
+		td->td_frame->tf_special.psr |= IA64_PSR_DFH;
+		pcb->pcb_fpcpu = NULL;
+		cpu->pc_fpcurthread = NULL;
+	}
+	mtx_unlock_spin(&ia64_highfp_mtx);
+
+	return ((cpu != NULL) ? 1 : 0);
+}
+
+#ifdef SMP
+int
+ia64_highfp_save_ipi(void)
+{
+	struct thread *td;
+
+	mtx_lock_spin(&ia64_highfp_mtx);
+	td = PCPU_GET(fpcurthread);
+	if (td != NULL) {
+		KASSERT(td->td_pcb->pcb_fpcpu == pcpup,
+		    ("td->td_pcb->pcb_fpcpu != pcpup"));
+		save_high_fp(&td->td_pcb->pcb_high_fp);
+		td->td_frame->tf_special.psr |= IA64_PSR_DFH;
+		td->td_pcb->pcb_fpcpu = NULL;
+		PCPU_SET(fpcurthread, NULL);
+	}
+	mtx_unlock_spin(&ia64_highfp_mtx);
+	wakeup(&PCPU_GET(fpcurthread));
+
+	return ((td != NULL) ? 1 : 0);
+}
+#endif

Modified: head/sys/ia64/ia64/interrupt.c
==============================================================================
--- head/sys/ia64/ia64/interrupt.c	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/ia64/interrupt.c	Sat Oct 31 22:27:31 2009	(r198733)
@@ -216,14 +216,7 @@ interrupt(struct trapframe *tf)
 		asts[PCPU_GET(cpuid)]++;
 		CTR1(KTR_SMP, "IPI_AST, cpuid=%d", PCPU_GET(cpuid));
 	} else if (vector == ipi_vector[IPI_HIGH_FP]) {
-		struct thread *thr = PCPU_GET(fpcurthread);
-		if (thr != NULL) {
-			mtx_lock_spin(&thr->td_md.md_highfp_mtx);
-			save_high_fp(&thr->td_pcb->pcb_high_fp);
-			thr->td_pcb->pcb_fpcpu = NULL;
-			PCPU_SET(fpcurthread, NULL);
-			mtx_unlock_spin(&thr->td_md.md_highfp_mtx);
-		}
+		ia64_highfp_save_ipi();
 	} else if (vector == ipi_vector[IPI_RENDEZVOUS]) {
 		rdvs[PCPU_GET(cpuid)]++;
 		CTR1(KTR_SMP, "IPI_RENDEZVOUS, cpuid=%d", PCPU_GET(cpuid));

Modified: head/sys/ia64/ia64/machdep.c
==============================================================================
--- head/sys/ia64/ia64/machdep.c	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/ia64/machdep.c	Sat Oct 31 22:27:31 2009	(r198733)
@@ -1461,81 +1461,6 @@ set_fpregs(struct thread *td, struct fpr
 	return (0);
 }
 
-/*
- * High FP register functions.
- */
-
-int
-ia64_highfp_drop(struct thread *td)
-{
-	struct pcb *pcb;
-	struct pcpu *cpu;
-	struct thread *thr;
-
-	mtx_lock_spin(&td->td_md.md_highfp_mtx);
-	pcb = td->td_pcb;
-	cpu = pcb->pcb_fpcpu;
-	if (cpu == NULL) {
-		mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-		return (0);
-	}
-	pcb->pcb_fpcpu = NULL;
-	thr = cpu->pc_fpcurthread;
-	cpu->pc_fpcurthread = NULL;
-	mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-
-	/* Post-mortem sanity checking. */
-	KASSERT(thr == td, ("Inconsistent high FP state"));
-	return (1);
-}
-
-int
-ia64_highfp_save(struct thread *td)
-{
-	struct pcb *pcb;
-	struct pcpu *cpu;
-	struct thread *thr;
-
-	/* Don't save if the high FP registers weren't modified. */
-	if ((td->td_frame->tf_special.psr & IA64_PSR_MFH) == 0)
-		return (ia64_highfp_drop(td));
-
-	mtx_lock_spin(&td->td_md.md_highfp_mtx);
-	pcb = td->td_pcb;
-	cpu = pcb->pcb_fpcpu;
-	if (cpu == NULL) {
-		mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-		return (0);
-	}
-#ifdef SMP
-	if (td == curthread)
-		sched_pin();
-	if (cpu != pcpup) {
-		mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-		ipi_send(cpu, IPI_HIGH_FP);
-		if (td == curthread)
-			sched_unpin();
-		while (pcb->pcb_fpcpu == cpu)
-			DELAY(100);
-		return (1);
-	} else {
-		save_high_fp(&pcb->pcb_high_fp);
-		if (td == curthread)
-			sched_unpin();
-	}
-#else
-	save_high_fp(&pcb->pcb_high_fp);
-#endif
-	pcb->pcb_fpcpu = NULL;
-	thr = cpu->pc_fpcurthread;
-	cpu->pc_fpcurthread = NULL;
-	mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-
-	/* Post-mortem sanity cxhecking. */
-	KASSERT(thr == td, ("Inconsistent high FP state"));
-	return (1);
-}
-
 void
 ia64_sync_icache(vm_offset_t va, vm_offset_t sz)
 {

Modified: head/sys/ia64/ia64/trap.c
==============================================================================
--- head/sys/ia64/ia64/trap.c	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/ia64/trap.c	Sat Oct 31 22:27:31 2009	(r198733)
@@ -652,66 +652,10 @@ trap(int vector, struct trapframe *tf)
 		break;
 
 	case IA64_VEC_DISABLED_FP: {
-		struct pcpu *pcpu;
-		struct pcb *pcb;
-		struct thread *thr;
-
-		/* Always fatal in kernel. Should never happen. */
-		if (!user)
+		if (user)
+			ia64_highfp_enable(td, tf);
+		else
 			trap_panic(vector, tf);
-
-		sched_pin();
-		thr = PCPU_GET(fpcurthread);
-		if (thr == td) {
-			/*
-			 * Short-circuit handling the trap when this CPU
-			 * already holds the high FP registers for this
-			 * thread.  We really shouldn't get the trap in the
-			 * first place, but since it's only a performance
-			 * issue and not a correctness issue, we emit a
-			 * message for now, enable the high FP registers and
-			 * return.
-			 */
-			printf("XXX: bogusly disabled high FP regs\n");
-			tf->tf_special.psr &= ~IA64_PSR_DFH;
-			sched_unpin();
-			goto out;
-		} else if (thr != NULL) {
-			mtx_lock_spin(&thr->td_md.md_highfp_mtx);
-			pcb = thr->td_pcb;
-			save_high_fp(&pcb->pcb_high_fp);
-			pcb->pcb_fpcpu = NULL;
-			PCPU_SET(fpcurthread, NULL);
-			mtx_unlock_spin(&thr->td_md.md_highfp_mtx);
-			thr = NULL;
-		}
-
-		mtx_lock_spin(&td->td_md.md_highfp_mtx);
-		pcb = td->td_pcb;
-		pcpu = pcb->pcb_fpcpu;
-
-#ifdef SMP
-		if (pcpu != NULL) {
-			mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-			ipi_send(pcpu, IPI_HIGH_FP);
-			while (pcb->pcb_fpcpu == pcpu)
-				DELAY(100);
-			mtx_lock_spin(&td->td_md.md_highfp_mtx);
-			pcpu = pcb->pcb_fpcpu;
-			thr = PCPU_GET(fpcurthread);
-		}
-#endif
-
-		if (thr == NULL && pcpu == NULL) {
-			restore_high_fp(&pcb->pcb_high_fp);
-			PCPU_SET(fpcurthread, td);
-			pcb->pcb_fpcpu = pcpup;
-			tf->tf_special.psr &= ~IA64_PSR_MFH;
-			tf->tf_special.psr &= ~IA64_PSR_DFH;
-		}
-
-		mtx_unlock_spin(&td->td_md.md_highfp_mtx);
-		sched_unpin();
 		goto out;
 	}
 

Modified: head/sys/ia64/ia64/vm_machdep.c
==============================================================================
--- head/sys/ia64/ia64/vm_machdep.c	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/ia64/vm_machdep.c	Sat Oct 31 22:27:31 2009	(r198733)
@@ -120,14 +120,11 @@ cpu_thread_alloc(struct thread *td)
 	sp -= sizeof(struct trapframe);
 	td->td_frame = (struct trapframe *)sp;
 	td->td_frame->tf_length = sizeof(struct trapframe);
-	mtx_init(&td->td_md.md_highfp_mtx, "High FP lock", NULL, MTX_SPIN);
 }
 
 void
 cpu_thread_free(struct thread *td)
 {
-
-	mtx_destroy(&td->td_md.md_highfp_mtx);
 }
 
 void
@@ -148,6 +145,8 @@ cpu_set_upcall(struct thread *td, struct
 	struct pcb *pcb;
 	struct trapframe *tf;
 
+	ia64_highfp_save(td0);
+
 	tf = td->td_frame;
 	KASSERT(tf != NULL, ("foo"));
 	bcopy(td0->td_frame, tf, sizeof(*tf));

Modified: head/sys/ia64/include/md_var.h
==============================================================================
--- head/sys/ia64/include/md_var.h	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/include/md_var.h	Sat Oct 31 22:27:31 2009	(r198733)
@@ -86,7 +86,9 @@ int	ia64_emulate(struct trapframe *, str
 int	ia64_flush_dirty(struct thread *, struct _special *);
 uint64_t ia64_get_hcdp(void);
 int	ia64_highfp_drop(struct thread *);
+int	ia64_highfp_enable(struct thread *, struct trapframe *);
 int	ia64_highfp_save(struct thread *);
+int	ia64_highfp_save_ipi(void);
 struct ia64_init_return ia64_init(void);
 void	ia64_probe_sapics(void);
 void	ia64_sync_icache(vm_offset_t, vm_size_t);

Modified: head/sys/ia64/include/proc.h
==============================================================================
--- head/sys/ia64/include/proc.h	Sat Oct 31 21:22:18 2009	(r198732)
+++ head/sys/ia64/include/proc.h	Sat Oct 31 22:27:31 2009	(r198733)
@@ -30,7 +30,6 @@
 #define	_MACHINE_PROC_H_
 
 struct mdthread {
-	struct mtx md_highfp_mtx;
 	int	md_spinlock_count;	/* (k) */
 	int	md_saved_intr;		/* (k) */
 };