From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 29 03:53:18 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F39010656A5; Sun, 29 Aug 2010 03:53:18 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45C7D8FC1C; Sun, 29 Aug 2010 03:53: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 o7T3rIYE052010; Sun, 29 Aug 2010 03:53:18 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T3rIR5052008; Sun, 29 Aug 2010 03:53:18 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008290353.o7T3rIR5052008@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 29 Aug 2010 03:53: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: r211956 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2010 03:53:18 -0000 Author: ume Date: Sun Aug 29 03:53:17 2010 New Revision: 211956 URL: http://svn.freebsd.org/changeset/base/211956 Log: MFC r211340: Correct the return code from _dns_gethostby*() to correspond with h_errno. Modified: stable/8/lib/libc/net/gethostbydns.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/gethostbydns.c ============================================================================== --- stable/8/lib/libc/net/gethostbydns.c Sun Aug 29 02:51:17 2010 (r211955) +++ stable/8/lib/libc/net/gethostbydns.c Sun Aug 29 03:53:17 2010 (r211956) @@ -522,18 +522,26 @@ _dns_gethostbyname(void *rval, void *cb_ free(buf); dprintf("res_nsearch failed (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_NOTFOUND); } else if (n > sizeof(buf->buf)) { free(buf); dprintf("static buffer is too small (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_UNAVAIL); } error = gethostanswer(buf, n, name, type, &he, hed, statp); free(buf); if (error != 0) { *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { *errnop = errno; @@ -632,7 +640,15 @@ _dns_gethostbyaddr(void *rval, void *cb_ if (gethostanswer(buf, n, qbuf, T_PTR, &he, hed, statp) != 0) { free(buf); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); /* h_errno was set by gethostanswer() */ + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } free(buf); #ifdef SUNSECURITY From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 29 08:10:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDAA41065695; Sun, 29 Aug 2010 08:10: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 CE9468FC13; Sun, 29 Aug 2010 08:10: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 o7T8AYN3057192; Sun, 29 Aug 2010 08:10:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8AY2p057190; Sun, 29 Aug 2010 08:10:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008290810.o7T8AY2p057190@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 29 Aug 2010 08:10: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: r211959 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2010 08:10:35 -0000 Author: kib Date: Sun Aug 29 08:10:34 2010 New Revision: 211959 URL: http://svn.freebsd.org/changeset/base/211959 Log: MFC r211335: Add convenience defines for hidden and default/exported attributes. MFC r211741: Use preferred spelling for the __attribute__. MFC r211868: Use private namespace for visibility keyword. Modified: stable/8/sys/sys/cdefs.h Directory Properties: 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) Modified: stable/8/sys/sys/cdefs.h ============================================================================== --- stable/8/sys/sys/cdefs.h Sun Aug 29 05:39:21 2010 (r211958) +++ stable/8/sys/sys/cdefs.h Sun Aug 29 08:10:34 2010 (r211959) @@ -311,6 +311,14 @@ #define __predict_false(exp) (exp) #endif +#if __GNUC_PREREQ__(4, 2) +#define __hidden __attribute__((__visibility__("hidden"))) +#define __exported __attribute__((__visibility__("default"))) +#else +#define __hidden +#define __exported +#endif + /* * We define this here since , , and * require it. From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 29 08:15:58 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25FB41065696; Sun, 29 Aug 2010 08:15:58 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1683F8FC08; Sun, 29 Aug 2010 08: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 o7T8FvZx057423; Sun, 29 Aug 2010 08:15:57 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8FvCN057421; Sun, 29 Aug 2010 08:15:57 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201008290815.o7T8FvCN057421@svn.freebsd.org> From: David Xu Date: Sun, 29 Aug 2010 08:15: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: r211960 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2010 08:15:58 -0000 Author: davidxu Date: Sun Aug 29 08:15:57 2010 New Revision: 211960 URL: http://svn.freebsd.org/changeset/base/211960 Log: MFC r211833: Decrease rdlock count only when thread unlocked a reader lock. Modified: stable/8/lib/libthr/thread/thr_rtld.c Modified: stable/8/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/8/lib/libthr/thread/thr_rtld.c Sun Aug 29 08:10:34 2010 (r211959) +++ stable/8/lib/libthr/thread/thr_rtld.c Sun Aug 29 08:15:57 2010 (r211960) @@ -149,8 +149,8 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { - curthread->rdlock_count--; if ((state & URWLOCK_WRITE_OWNER) == 0) { + curthread->rdlock_count--; THR_CRITICAL_LEAVE(curthread); } else { _thr_signal_unblock(curthread); From owner-svn-src-stable-8@FreeBSD.ORG Sun Aug 29 08:19:08 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AE5B10656AB; Sun, 29 Aug 2010 08:19:08 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC2C8FC15; Sun, 29 Aug 2010 08:19: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 o7T8J8bO057521; Sun, 29 Aug 2010 08:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8J8Nx057520; Sun, 29 Aug 2010 08:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201008290819.o7T8J8Nx057520@svn.freebsd.org> From: David Xu Date: Sun, 29 Aug 2010 08:19: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: r211961 - stable/8/lib/libthr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2010 08:19:08 -0000 Author: davidxu Date: Sun Aug 29 08:19:07 2010 New Revision: 211961 URL: http://svn.freebsd.org/changeset/base/211961 Log: Record merge info for r211960. -This line, and those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. _M libthr Modified: Directory Properties: stable/8/lib/libthr/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 07:04:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC61E106564A; Mon, 30 Aug 2010 07:04:19 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB4538FC13; Mon, 30 Aug 2010 07:04: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 o7U74JJe086810; Mon, 30 Aug 2010 07:04:19 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U74JUD086808; Mon, 30 Aug 2010 07:04:19 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300704.o7U74JUD086808@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:04:19 +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: r211986 - stable/8/usr.sbin/mountd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 07:04:20 -0000 Author: maxim Date: Mon Aug 30 07:04:19 2010 New Revision: 211986 URL: http://svn.freebsd.org/changeset/base/211986 Log: MFC r209926: fix typo. Modified: stable/8/usr.sbin/mountd/exports.5 Directory Properties: stable/8/usr.sbin/mountd/ (props changed) Modified: stable/8/usr.sbin/mountd/exports.5 ============================================================================== --- stable/8/usr.sbin/mountd/exports.5 Mon Aug 30 06:50:33 2010 (r211985) +++ stable/8/usr.sbin/mountd/exports.5 Mon Aug 30 07:04:19 2010 (r211986) @@ -82,7 +82,7 @@ including regular files if the option is used on .Xr mountd 8 . The third form has the string ``V4:'' followed by a single absolute path -name, to sepcify the NFSv4 tree root. +name, to specify the NFSv4 tree root. The pathnames must not have any symbolic links in them and should not have any .Dq Pa \&. From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 07:06:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 667BF106570A; Mon, 30 Aug 2010 07:06:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 557E78FC1B; Mon, 30 Aug 2010 07:06: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 o7U76Ro3086907; Mon, 30 Aug 2010 07:06:27 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U76RfE086905; Mon, 30 Aug 2010 07:06:27 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300706.o7U76RfE086905@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:06: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: r211987 - stable/8/sbin/iscontrol X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 07:06:27 -0000 Author: maxim Date: Mon Aug 30 07:06:27 2010 New Revision: 211987 URL: http://svn.freebsd.org/changeset/base/211987 Log: MFC r209972: restore missed flag in the synopsis. Modified: stable/8/sbin/iscontrol/iscontrol.8 Directory Properties: stable/8/sbin/iscontrol/ (props changed) Modified: stable/8/sbin/iscontrol/iscontrol.8 ============================================================================== --- stable/8/sbin/iscontrol/iscontrol.8 Mon Aug 30 07:04:19 2010 (r211986) +++ stable/8/sbin/iscontrol/iscontrol.8 Mon Aug 30 07:06:27 2010 (r211987) @@ -34,7 +34,7 @@ .Nm .Op Fl vd .Oo -.Op Fl Ar file +.Op Fl c Ar file .Op Fl n Ar nickname .Oc .Op Fl t Ar target From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 07:09:41 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40F7A106566C; Mon, 30 Aug 2010 07:09:41 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF968FC1B; Mon, 30 Aug 2010 07:09: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 o7U79f0R087011; Mon, 30 Aug 2010 07:09:41 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U79fvF087009; Mon, 30 Aug 2010 07:09:41 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300709.o7U79fvF087009@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:09: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: r211988 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 07:09:41 -0000 Author: maxim Date: Mon Aug 30 07:09:40 2010 New Revision: 211988 URL: http://svn.freebsd.org/changeset/base/211988 Log: MFC r210000: correct path to include file. Modified: stable/8/share/man/man4/ath.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ath.4 ============================================================================== --- stable/8/share/man/man4/ath.4 Mon Aug 30 07:06:27 2010 (r211987) +++ stable/8/share/man/man4/ath.4 Mon Aug 30 07:09:40 2010 (r211988) @@ -207,7 +207,7 @@ ifconfig wlan0 create wlandev ath0 wlanm The Atheros Hardware Access Layer was unable to configure the hardware as requested. The status code is explained in the HAL include file -.Pa sys/contrib/dev/ath/ah.h . +.Pa sys/dev/ath/ath_hal/ah.h . .It "ath%d: failed to allocate descriptors: %d" The driver was unable to allocate contiguous memory for the transmit and receive descriptors. @@ -236,7 +236,7 @@ The driver will reset the hardware and c The Atheros Hardware Access Layer was unable to reset the hardware as requested. The status code is explained in the HAL include file -.Pa sys/contrib/dev/ath/ah.h . +.Pa sys/dev/ath/ath_hal/ah.h . This should not happen. .It "ath%d: unable to start recv logic" The driver was unable to restart frame reception. From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 07:11:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B6B310656A9; Mon, 30 Aug 2010 07:11:13 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A5168FC14; Mon, 30 Aug 2010 07:11: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 o7U7BDgu087114; Mon, 30 Aug 2010 07:11:13 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U7BDUU087112; Mon, 30 Aug 2010 07:11:13 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300711.o7U7BDUU087112@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:11:13 +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: r211989 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 07:11:13 -0000 Author: maxim Date: Mon Aug 30 07:11:13 2010 New Revision: 211989 URL: http://svn.freebsd.org/changeset/base/211989 Log: MFC r210181: fix typo. Modified: stable/8/share/man/man4/u3g.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/u3g.4 ============================================================================== --- stable/8/share/man/man4/u3g.4 Mon Aug 30 07:09:40 2010 (r211988) +++ stable/8/share/man/man4/u3g.4 Mon Aug 30 07:11:13 2010 (r211989) @@ -93,7 +93,7 @@ device will attach temporarily to a 3G d force it to switch to modem mode, The attach and detach of .Xr u3gstub -and any driver disk device present on the 3G device is is hidden, unless the +and any driver disk device present on the 3G device is hidden, unless the machine was booted in verbose mode (see .Xr boot 8 ) . To temporarily unhide the device, set From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 10:30:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6237A10656B3; Mon, 30 Aug 2010 10:30:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 509458FC16; Mon, 30 Aug 2010 10:30: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 o7UAUZxD091129; Mon, 30 Aug 2010 10:30:35 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UAUZ55091126; Mon, 30 Aug 2010 10:30:35 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008301030.o7UAUZ55091126@svn.freebsd.org> From: Attilio Rao Date: Mon, 30 Aug 2010 10:30: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: r211993 - stable/8/sys/cam X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 10:30:35 -0000 Author: attilio Date: Mon Aug 30 10:30:35 2010 New Revision: 211993 URL: http://svn.freebsd.org/changeset/base/211993 Log: MFC r208752, r209590: Protect periph drivers list and rearrange things to minimize the chance of stepping oneself during probing. Don't blindly decrement a periph probe count. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/cam/cam_periph.c stable/8/sys/cam/cam_xpt.c Directory Properties: 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) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Mon Aug 30 09:29:51 2010 (r211992) +++ stable/8/sys/cam/cam_periph.c Mon Aug 30 10:30:35 2010 (r211993) @@ -185,17 +185,6 @@ cam_periph_alloc(periph_ctor_t *periph_c init_level++; - xpt_lock_buses(); - for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { - if (strcmp((*p_drv)->driver_name, name) == 0) - break; - } - xpt_unlock_buses(); - if (*p_drv == NULL) { - printf("cam_periph_alloc: invalid periph name '%s'\n", name); - free(periph, M_CAMPERIPH); - return (CAM_REQ_INVALID); - } sim = xpt_path_sim(path); path_id = xpt_path_path_id(path); @@ -208,7 +197,6 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->periph_oninval = periph_oninvalidate; periph->type = type; periph->periph_name = name; - periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); periph->immediate_priority = CAM_PRIORITY_NONE; periph->refcount = 0; periph->sim = sim; @@ -216,26 +204,39 @@ cam_periph_alloc(periph_ctor_t *periph_c status = xpt_create_path(&path, periph, path_id, target_id, lun_id); if (status != CAM_REQ_CMP) goto failure; - periph->path = path; - init_level++; - - status = xpt_add_periph(periph); - - if (status != CAM_REQ_CMP) - goto failure; + xpt_lock_buses(); + for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { + if (strcmp((*p_drv)->driver_name, name) == 0) + break; + } + if (*p_drv == NULL) { + printf("cam_periph_alloc: invalid periph name '%s'\n", name); + xpt_free_path(periph->path); + free(periph, M_CAMPERIPH); + xpt_unlock_buses(); + return (CAM_REQ_INVALID); + } + periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); cur_periph = TAILQ_FIRST(&(*p_drv)->units); while (cur_periph != NULL && cur_periph->unit_number < periph->unit_number) cur_periph = TAILQ_NEXT(cur_periph, unit_links); - - if (cur_periph != NULL) + if (cur_periph != NULL) { + KASSERT(cur_periph->unit_number != periph->unit_number, ("duplicate units on periph list")); TAILQ_INSERT_BEFORE(cur_periph, periph, unit_links); - else { + } else { TAILQ_INSERT_TAIL(&(*p_drv)->units, periph, unit_links); (*p_drv)->generation++; } + xpt_unlock_buses(); + + init_level++; + + status = xpt_add_periph(periph); + if (status != CAM_REQ_CMP) + goto failure; init_level++; @@ -250,10 +251,12 @@ failure: /* Initialized successfully */ break; case 3: - TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: + xpt_lock_buses(); + TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); + xpt_unlock_buses(); xpt_free_path(periph->path); /* FALLTHROUGH */ case 1: @@ -288,6 +291,7 @@ cam_periph_find(struct cam_path *path, c TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) { if (xpt_path_comp(periph->path, path) == 0) { xpt_unlock_buses(); + mtx_assert(periph->sim->mtx, MA_OWNED); return(periph); } } @@ -322,8 +326,13 @@ cam_periph_release_locked(struct cam_per return; xpt_lock_buses(); - if ((--periph->refcount == 0) - && (periph->flags & CAM_PERIPH_INVALID)) { + if (periph->refcount != 0) { + periph->refcount--; + } else { + xpt_print(periph->path, "%s: release %p when refcount is zero\n ", __func__, periph); + } + if (periph->refcount == 0 + && (periph->flags & CAM_PERIPH_INVALID)) { camperiphfree(periph); } xpt_unlock_buses(); Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Mon Aug 30 09:29:51 2010 (r211992) +++ stable/8/sys/cam/cam_xpt.c Mon Aug 30 10:30:35 2010 (r211993) @@ -2110,6 +2110,7 @@ xptpdperiphtraverse(struct periph_driver retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { @@ -2117,9 +2118,12 @@ xptpdperiphtraverse(struct periph_driver next_periph = TAILQ_NEXT(periph, unit_links); retval = tr_func(periph, arg); - if (retval == 0) + if (retval == 0) { + xpt_unlock_buses(); return(retval); + } } + xpt_unlock_buses(); return(retval); } @@ -2295,7 +2299,6 @@ xpt_action_default(union ccb *start_ccb) CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action_default\n")); - switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 14:44:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E104106564A; Mon, 30 Aug 2010 14:44: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 F12ED8FC1D; Mon, 30 Aug 2010 14:44: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 o7UEiMOW097895; Mon, 30 Aug 2010 14:44:22 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UEiM46097893; Mon, 30 Aug 2010 14:44:22 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008301444.o7UEiM46097893@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 30 Aug 2010 14:44:22 +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: r212000 - stable/8/sbin/bsdlabel X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 14:44:23 -0000 Author: jh Date: Mon Aug 30 14:44:22 2010 New Revision: 212000 URL: http://svn.freebsd.org/changeset/base/212000 Log: MFC r211342: - Check that strtoul(3) succeeds to convert the entire string in a few places. - In getasciilabel(), set the disk type only when a valid type is given. PR: bin/86765 Modified: stable/8/sbin/bsdlabel/bsdlabel.c Directory Properties: stable/8/sbin/bsdlabel/ (props changed) Modified: stable/8/sbin/bsdlabel/bsdlabel.c ============================================================================== --- stable/8/sbin/bsdlabel/bsdlabel.c Mon Aug 30 14:26:02 2010 (r211999) +++ stable/8/sbin/bsdlabel/bsdlabel.c Mon Aug 30 14:44:22 2010 (r212000) @@ -749,7 +749,7 @@ word(char *cp) static int getasciilabel(FILE *f, struct disklabel *lp) { - char *cp; + char *cp, *endp; const char **cpp; u_int part; char *tp, line[BUFSIZ]; @@ -788,11 +788,15 @@ getasciilabel(FILE *f, struct disklabel } if (cpp < &dktypenames[DKMAXTYPES]) continue; - v = strtoul(tp, NULL, 10); + errno = 0; + v = strtoul(tp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = DKMAXTYPES; if (v >= DKMAXTYPES) fprintf(stderr, "line %d:%s %lu\n", lineno, "Warning, unknown disk type", v); - lp->d_type = v; + else + lp->d_type = v; continue; } if (!strcmp(cp, "flags")) { @@ -1017,7 +1021,7 @@ static int getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno) { struct partition *pp; - char *cp; + char *cp, *endp; const char **cpp; u_long v; @@ -1053,9 +1057,12 @@ getasciipartspec(char *tp, struct diskla if (*cpp != NULL) { pp->p_fstype = cpp - fstypenames; } else { - if (isdigit(*cp)) - v = strtoul(cp, NULL, 10); - else + if (isdigit(*cp)) { + errno = 0; + v = strtoul(cp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = FSMAXTYPES; + } else v = FSMAXTYPES; if (v >= FSMAXTYPES) { fprintf(stderr, From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 17:34:59 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBA0D1065670; Mon, 30 Aug 2010 17:34:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAE598FC17; Mon, 30 Aug 2010 17:34: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 o7UHYxqq002154; Mon, 30 Aug 2010 17:34:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UHYxlL002152; Mon, 30 Aug 2010 17:34:59 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008301734.o7UHYxlL002152@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 30 Aug 2010 17:34: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: r212003 - stable/8/sys/compat/x86bios X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 17:35:00 -0000 Author: jkim Date: Mon Aug 30 17:34:59 2010 New Revision: 212003 URL: http://svn.freebsd.org/changeset/base/212003 Log: MFC: r211823 Check opcode for short jump as well. Some option ROMs do short jumps (e.g., some NVIDIA video cards) and we were not able to do POST while resuming because we only honored long jump. Modified: stable/8/sys/compat/x86bios/x86bios.c Directory Properties: 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) Modified: stable/8/sys/compat/x86bios/x86bios.c ============================================================================== --- stable/8/sys/compat/x86bios/x86bios.c Mon Aug 30 16:30:18 2010 (r212002) +++ stable/8/sys/compat/x86bios/x86bios.c Mon Aug 30 17:34:59 2010 (r212003) @@ -446,7 +446,8 @@ x86bios_get_orm(uint32_t offset) /* Does the shadow ROM contain BIOS POST code for x86? */ p = x86bios_offset(offset); - if (p == NULL || p[0] != 0x55 || p[1] != 0xaa || p[3] != 0xe9) + if (p == NULL || p[0] != 0x55 || p[1] != 0xaa || + (p[3] != 0xe9 && p[3] != 0xeb)) return (NULL); return (p); From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 18:23:48 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF834106566B; Mon, 30 Aug 2010 18:23:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BECAA8FC0A; Mon, 30 Aug 2010 18:23: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 o7UINmZI003208; Mon, 30 Aug 2010 18:23:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UINmhw003206; Mon, 30 Aug 2010 18:23:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008301823.o7UINmhw003206@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 18:23: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: r212005 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 18:23:48 -0000 Author: delphij Date: Mon Aug 30 18:23:48 2010 New Revision: 212005 URL: http://svn.freebsd.org/changeset/base/212005 Log: MFC r210665: In rdmsr_safe, use zero extend (by doing a 32-bit movl over eax to itself) instead of a sign extend. Discussed with: stas Modified: stable/8/sys/amd64/amd64/support.S Directory Properties: 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) Modified: stable/8/sys/amd64/amd64/support.S ============================================================================== --- stable/8/sys/amd64/amd64/support.S Mon Aug 30 18:12:21 2010 (r212004) +++ stable/8/sys/amd64/amd64/support.S Mon Aug 30 18:23:48 2010 (r212005) @@ -729,7 +729,7 @@ ENTRY(rdmsr_safe) rdmsr /* Read MSR pointed by %ecx. Returns hi byte in edx, lo in %eax */ salq $32,%rdx /* sign-shift %rdx left */ - cltq /* sign-extend %eax -> %rax */ + movl %eax,%eax /* zero-extend %eax -> %rax */ orq %rdx,%rax movq %rax,(%rsi) xorq %rax,%rax From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 20:49:52 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41B481065674; Mon, 30 Aug 2010 20:49:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30C508FC1A; Mon, 30 Aug 2010 20:49: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 o7UKnqlR006474; Mon, 30 Aug 2010 20:49:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKnqEa006472; Mon, 30 Aug 2010 20:49:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302049.o7UKnqEa006472@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:49: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: r212011 - stable/8/sys/dev/alc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 20:49:52 -0000 Author: yongari Date: Mon Aug 30 20:49:51 2010 New Revision: 212011 URL: http://svn.freebsd.org/changeset/base/212011 Log: MFC r210904: Reduce Tx interrupt moderation timer from 50ms to 1ms. The default value resulted in poor performance for UDP packets. With this change, UDP bulk transfer performance is more than 940Mbps. While I'm here fix a wrong register definition. Modified: stable/8/sys/dev/alc/if_alcreg.h Directory Properties: 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) Modified: stable/8/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 20:39:06 2010 (r212010) +++ stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 20:49:51 2010 (r212011) @@ -106,8 +106,8 @@ #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 +#define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 -#define MASTER_TEST_MODE_MASK 0x000000C0 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -144,7 +144,7 @@ * alc(4) does not rely on Tx completion interrupts, so set it * somewhat large value to reduce Tx completion interrupts. */ -#define ALC_IM_TX_TIMER_DEFAULT 50000 /* 50ms */ +#define ALC_IM_TX_TIMER_DEFAULT 1000 /* 1ms */ #define ALC_GPHY_CFG 0x140C /* 16bits */ #define GPHY_CFG_EXT_RESET 0x0001 From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 20:56:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DFF91065675; Mon, 30 Aug 2010 20:56:12 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D62C8FC12; Mon, 30 Aug 2010 20:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKuCfY006699; Mon, 30 Aug 2010 20:56:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKuCfI006697; Mon, 30 Aug 2010 20:56:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302056.o7UKuCfI006697@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:56:12 +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: r212013 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 20:56:12 -0000 Author: yongari Date: Mon Aug 30 20:56:12 2010 New Revision: 212013 URL: http://svn.freebsd.org/changeset/base/212013 Log: MFC r210905: Reflect default Tx interrupt moderation timer value change(50ms -> 1ms). Modified: stable/8/share/man/man4/alc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/alc.4 ============================================================================== --- stable/8/share/man/man4/alc.4 Mon Aug 30 20:52:28 2010 (r212012) +++ stable/8/share/man/man4/alc.4 Mon Aug 30 20:56:12 2010 (r212013) @@ -133,7 +133,7 @@ Value 0 completely disables the interrup .It Va dev.alc.%d.int_tx_mod Maximum amount of time to delay transmit interrupt processing in units of 1us. -The accepted range is 0 to 130000, the default is 50000(50ms). +The accepted range is 0 to 130000, the default is 1000(1ms). Value 0 completely disables the interrupt moderation. .It Va dev.alc.%d.process_limit Maximum amount of Rx frames to be processed in the event loop before From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 20:59:14 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 436091065693; Mon, 30 Aug 2010 20:59:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 326EF8FC1D; Mon, 30 Aug 2010 20:59: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 o7UKxEj8006847; Mon, 30 Aug 2010 20:59:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKxEKo006844; Mon, 30 Aug 2010 20:59:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302059.o7UKxEKo006844@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:59: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: r212015 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 20:59:14 -0000 Author: yongari Date: Mon Aug 30 20:59:13 2010 New Revision: 212015 URL: http://svn.freebsd.org/changeset/base/212015 Log: MFC r211046: Marvell model number 0x06 is 88E1101 PHY. Modified: stable/8/sys/dev/mii/e1000phy.c stable/8/sys/dev/mii/miidevs Directory Properties: 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) Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Mon Aug 30 20:56:59 2010 (r212014) +++ stable/8/sys/dev/mii/e1000phy.c Mon Aug 30 20:59:13 2010 (r212015) @@ -103,7 +103,7 @@ static const struct mii_phydesc e1000phy MII_PHY_DESC(MARVELL, E1000_3), MII_PHY_DESC(MARVELL, E1000S), MII_PHY_DESC(MARVELL, E1000_5), - MII_PHY_DESC(MARVELL, E1000_6), + MII_PHY_DESC(MARVELL, E1101), MII_PHY_DESC(MARVELL, E3082), MII_PHY_DESC(MARVELL, E1112), MII_PHY_DESC(MARVELL, E1149), Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Aug 30 20:56:59 2010 (r212014) +++ stable/8/sys/dev/mii/miidevs Mon Aug 30 20:59:13 2010 (r212015) @@ -245,7 +245,7 @@ model MARVELL E1011 0x0002 Marvell 88E1 model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY model MARVELL E1000S 0x0004 Marvell 88E1000S Gigabit PHY model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY -model MARVELL E1000_6 0x0006 Marvell 88E1000 Gigabit PHY +model MARVELL E1101 0x0006 Marvell 88E1101 Gigabit PHY model MARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY model MARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY model MARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 21:07:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD93D106566C; Mon, 30 Aug 2010 21:07:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABC148FC0A; Mon, 30 Aug 2010 21:07: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 o7UL7Q4V007199; Mon, 30 Aug 2010 21:07:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UL7QHW007196; Mon, 30 Aug 2010 21:07:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302107.o7UL7QHW007196@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:07: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: r212017 - stable/8/sys/dev/alc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 21:07:26 -0000 Author: yongari Date: Mon Aug 30 21:07:26 2010 New Revision: 212017 URL: http://svn.freebsd.org/changeset/base/212017 Log: MFC r211047-211048,211051-211053,211285: r211047: Controller does not seem to support more than 1024 bytes DMA burst. Limit DMA burst size to be less than or equal to 1024 bytes. r211048: Do not touch CMB TX threshold register when CMB is not used. Note, alc(4) does not use CMB at all due to silicon bug. r211051: Always disable ASPM L0s and enable L1 before entering into WOL suspend state. Also disable master clock after PHY power down, this is supposed to save more power. The master clock should be enabled if WOL is active. r211052: Remove unnecessary assignment. r211053: Cache PCIY_PMG and PCIY_EXPRESS capability pointer to softc and use it instead of calling pci_find_extcap(). r211285: Make sure to disable RX MAC in alc_stop_mac(). Previously there was a logic error which it always enabled RX MAC. Modified: stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/alc/if_alcvar.h Directory Properties: 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) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:00:37 2010 (r212016) +++ stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:07:26 2010 (r212017) @@ -569,7 +569,7 @@ alc_attach(device_t dev) struct ifnet *ifp; char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; uint16_t burst; - int base, error, i, msic, msixc, pmc, state; + int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; error = 0; @@ -600,6 +600,7 @@ alc_attach(device_t dev) sc->alc_rcb = DMA_CFG_RCB_64; if (pci_find_extcap(dev, PCIY_EXPRESS, &base) == 0) { sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; burst = CSR_READ_2(sc, base + PCIR_EXPRESS_DEVICE_CTL); sc->alc_dma_rd_burst = (burst & PCIM_EXP_CTL_MAX_READ_REQUEST) >> 12; @@ -610,6 +611,10 @@ alc_attach(device_t dev) device_printf(dev, "TLP payload size : %u bytes.\n", alc_dma_burst[sc->alc_dma_wr_burst]); } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; /* Clear data link and flow-control protocol error. */ val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); @@ -739,8 +744,11 @@ alc_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4; ifp->if_hwassist = ALC_CSUM_FEATURES | CSUM_TSO; - if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + if (pci_find_extcap(dev, PCIY_PMG, &base) == 0) { ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST; + sc->alc_flags |= ALC_FLAG_PM; + sc->alc_pmcap = base; + } ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ @@ -1669,20 +1677,14 @@ static void alc_setwol(struct alc_softc *sc) { struct ifnet *ifp; - uint32_t cap, reg, pmcs; + uint32_t reg, pmcs; uint16_t pmstat; - int base, pmc; ALC_LOCK_ASSERT(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_EXPRESS, &base) == 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); - if ((cap & PCIM_LINK_CAP_ASPM) != 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CTL); - alc_disable_l0s_l1(sc); - } - } - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) != 0) { + alc_disable_l0s_l1(sc); + ifp = sc->alc_ifp; + if ((sc->alc_flags & ALC_FLAG_PM) == 0) { /* Disable WOL. */ CSR_WRITE_4(sc, ALC_WOL_CFG, 0); reg = CSR_READ_4(sc, ALC_PCIE_PHYMISC); @@ -1690,16 +1692,16 @@ alc_setwol(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, reg); /* Force PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); return; } - ifp = sc->alc_ifp; if ((ifp->if_capenable & IFCAP_WOL) != 0) { if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0) alc_setlinkspeed(sc); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~MASTER_CLK_SEL_DIS; - CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) & ~MASTER_CLK_SEL_DIS); } pmcs = 0; @@ -1721,13 +1723,17 @@ alc_setwol(struct alc_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) == 0) { /* WOL disabled, PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); } /* Request PME. */ - pmstat = pci_read_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, 2); + pmstat = pci_read_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, 2); pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); if ((ifp->if_capenable & IFCAP_WOL) != 0) pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + pci_write_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } static int @@ -1750,20 +1756,19 @@ alc_resume(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - int pmc; uint16_t pmstat; sc = device_get_softc(dev); ALC_LOCK(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) == 0) { + if ((sc->alc_flags & ALC_FLAG_PM) != 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, 2); if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) { pmstat &= ~PCIM_PSTAT_PMEENABLE; pci_write_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, pmstat, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } } /* Reset PHY. */ @@ -2986,10 +2991,10 @@ alc_init_locked(struct alc_softc *sc) */ CSR_WRITE_4(sc, ALC_INTR_RETRIG_TIMER, ALC_USECS(0)); /* Configure CMB. */ - CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); - if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) + if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) { + CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(5000)); - else + } else CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(0)); /* * Hardware can be configured to issue SMB interrupt based @@ -3226,7 +3231,7 @@ alc_stop_mac(struct alc_softc *sc) /* Disable Rx/Tx MAC. */ reg = CSR_READ_4(sc, ALC_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } for (i = ALC_TIMEOUT; i > 0; i--) { Modified: stable/8/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:00:37 2010 (r212016) +++ stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:07:26 2010 (r212017) @@ -211,11 +211,14 @@ struct alc_softc { uint32_t alc_dma_rd_burst; uint32_t alc_dma_wr_burst; uint32_t alc_rcb; + int alc_expcap; + int alc_pmcap; int alc_flags; #define ALC_FLAG_PCIE 0x0001 #define ALC_FLAG_PCIX 0x0002 #define ALC_FLAG_MSI 0x0004 #define ALC_FLAG_MSIX 0x0008 +#define ALC_FLAG_PM 0x0010 #define ALC_FLAG_FASTETHER 0x0020 #define ALC_FLAG_JUMBO 0x0040 #define ALC_FLAG_ASPM_MON 0x0080 From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 21:11:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B86A8106566C; Mon, 30 Aug 2010 21:11:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A78FE8FC1C; Mon, 30 Aug 2010 21:11: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 o7ULBjU3007454; Mon, 30 Aug 2010 21:11:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULBj38007451; Mon, 30 Aug 2010 21:11:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302111.o7ULBj38007451@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:11:45 +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: r212019 - stable/8/sys/dev/mii X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 21:11:45 -0000 Author: yongari Date: Mon Aug 30 21:11:45 2010 New Revision: 212019 URL: http://svn.freebsd.org/changeset/base/212019 Log: MFC r211103: Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet controller. Modified: stable/8/sys/dev/mii/atphy.c stable/8/sys/dev/mii/miidevs Directory Properties: 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) Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Mon Aug 30 21:09:37 2010 (r212018) +++ stable/8/sys/dev/mii/atphy.c Mon Aug 30 21:11:45 2010 (r212019) @@ -86,6 +86,7 @@ static int atphy_auto(struct mii_softc * static const struct mii_phydesc atphys[] = { MII_PHY_DESC(ATHEROS, F1), + MII_PHY_DESC(ATHEROS, F1_7), MII_PHY_DESC(ATHEROS, F2), MII_PHY_END }; Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Aug 30 21:09:37 2010 (r212018) +++ stable/8/sys/dev/mii/miidevs Mon Aug 30 21:11:45 2010 (r212019) @@ -128,6 +128,7 @@ model ASIX AX88X9X 0x0031 Ax88x9x inter /* Atheros Communications/Attansic PHYs. */ model ATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY model ATHEROS F2 0x0002 Atheros F2 10/100 PHY +model ATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY /* Broadcom Corp. PHYs. */ model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 21:15:40 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50DB910656A9; Mon, 30 Aug 2010 21:15:40 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E8888FC21; Mon, 30 Aug 2010 21:15: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 o7ULFesQ007677; Mon, 30 Aug 2010 21:15:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULFeCf007673; Mon, 30 Aug 2010 21:15:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302115.o7ULFeCf007673@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:15: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: r212021 - stable/8/sys/dev/alc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 21:15:40 -0000 Author: yongari Date: Mon Aug 30 21:15:40 2010 New Revision: 212021 URL: http://svn.freebsd.org/changeset/base/212021 Log: MFC r211105: Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet controller. These controllers are known as L1D(AR8151) and L2CB/B2(AR8152). This change adds supports for the following controllers. o AR8151 v1.0(L1D) gigabit ethernet controller o AR8151 v2.0(L1D) gigabit ethernet controller o AR8152 v1.1(L2CB) fast ethernet controller o AR8152 v2.0(L2CB2) fast ethernet controller These controllers have the same feature of AR8131/AR8132 and support improved power saving control. The user visible change at this moment is reduced jumbo frame size from 9KB to 6KB. Many thanks to Atheros for continuing to support FreeBSD. HW donated by: Atheros Communications, Inc. Modified: stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/alc/if_alcreg.h stable/8/sys/dev/alc/if_alcvar.h Directory Properties: 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) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:15:40 2010 (r212021) @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -/* Driver for Atheros AR8131/AR8132 PCIe Ethernet. */ +/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */ #include __FBSDID("$FreeBSD$"); @@ -98,18 +98,23 @@ TUNABLE_INT("hw.alc.msix_disable", &msix /* * Devices supported by this driver. */ -static struct alc_dev { - uint16_t alc_vendorid; - uint16_t alc_deviceid; - const char *alc_name; -} alc_devs[] = { - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, +static struct alc_ident alc_ident_table[] = { + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, 9 * 1024, "Atheros AR8131 PCIe Gigabit Ethernet" }, - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, - "Atheros AR8132 PCIe Fast Ethernet" } + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, 9 * 1024, + "Atheros AR8132 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151, 6 * 1024, + "Atheros AR8151 v1.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151_V2, 6 * 1024, + "Atheros AR8151 v2.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B, 6 * 1024, + "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, + "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *); +static void alc_aspm(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); static int alc_detach(device_t); @@ -118,6 +123,8 @@ static int alc_dma_alloc(struct alc_soft static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); static int alc_encap(struct alc_softc *, struct mbuf **); +static struct alc_ident * + alc_find_ident(device_t); #ifndef __NO_STRICT_ALIGNMENT static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); @@ -331,7 +338,7 @@ alc_miibus_statchg(device_t dev) reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } - alc_aspm(sc); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void @@ -375,23 +382,31 @@ alc_mediachange(struct ifnet *ifp) return (error); } -static int -alc_probe(device_t dev) +static struct alc_ident * +alc_find_ident(device_t dev) { - struct alc_dev *sp; - int i; + struct alc_ident *ident; uint16_t vendor, devid; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - sp = alc_devs; - for (i = 0; i < sizeof(alc_devs) / sizeof(alc_devs[0]); i++) { - if (vendor == sp->alc_vendorid && - devid == sp->alc_deviceid) { - device_set_desc(dev, sp->alc_name); - return (BUS_PROBE_DEFAULT); - } - sp++; + for (ident = alc_ident_table; ident->name != NULL; ident++) { + if (vendor == ident->vendorid && devid == ident->deviceid) + return (ident); + } + + return (NULL); +} + +static int +alc_probe(device_t dev) +{ + struct alc_ident *ident; + + ident = alc_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); } return (ENXIO); @@ -401,20 +416,53 @@ static void alc_get_macaddr(struct alc_softc *sc) { uint32_t ea[2], opt; - int i; + uint16_t val; + int eeprom, i; + eeprom = 0; opt = CSR_READ_4(sc, ALC_OPT_CFG); - if ((CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { + if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_OTP_SEL) != 0 && + (CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { /* * EEPROM found, let TWSI reload EEPROM configuration. * This will set ethernet address of controller. */ - if ((opt & OPT_CFG_CLK_ENB) == 0) { - opt |= OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + eeprom++; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) == 0) { + opt |= OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFF7F); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0008); + DELAY(20); + break; } + + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_WOL_CFG, 0); + CSR_READ_4(sc, ALC_WOL_CFG); + CSR_WRITE_4(sc, ALC_TWSI_CFG, CSR_READ_4(sc, ALC_TWSI_CFG) | TWSI_CFG_SW_LD_START); for (i = 100; i > 0; i--) { @@ -430,11 +478,36 @@ alc_get_macaddr(struct alc_softc *sc) if (bootverbose) device_printf(sc->alc_dev, "EEPROM not found!\n"); } - if ((opt & OPT_CFG_CLK_ENB) != 0) { - opt &= ~OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + if (eeprom != 0) { + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) != 0) { + opt &= ~OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0080); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFFF7); + DELAY(20); + break; + } } ea[0] = CSR_READ_4(sc, ALC_PAR0); @@ -479,6 +552,43 @@ alc_phy_reset(struct alc_softc *sc) CSR_READ_2(sc, ALC_GPHY_CFG); DELAY(10 * 1000); + /* DSP fixup, Vendor magic. */ + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x000A); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xDFFF); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x003B); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xFFF7); + DELAY(20 * 1000); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0x929D); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0xB6DD); + } + /* Load DSP codes, vendor magic. */ data = ANA_LOOP_SEL_10BT | ANA_EN_MASK_TB | ANA_EN_10BT_IDLE | ((1 << ANA_INTERVAL_SEL_TIMER_SHIFT) & ANA_INTERVAL_SEL_TIMER_MASK); @@ -528,36 +638,117 @@ static void alc_phy_down(struct alc_softc *sc) { - /* Force PHY down. */ - CSR_WRITE_2(sc, ALC_GPHY_CFG, - GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | - GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW); - DELAY(1000); + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + /* + * GPHY power down caused more problems on AR8151 v2.0. + * When driver is reloaded after GPHY power down, + * accesses to PHY/MAC registers hung the system. Only + * cold boot recovered from it. I'm not sure whether + * AR8151 v1.0 also requires this one though. I don't + * have AR8151 v1.0 controller in hand. + * The only option left is to isolate the PHY and + * initiates power down the PHY which in turn saves + * more power when driver is unloaded. + */ + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + MII_BMCR, BMCR_ISO | BMCR_PDOWN); + break; + default: + /* Force PHY down. */ + CSR_WRITE_2(sc, ALC_GPHY_CFG, + GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | + GPHY_CFG_PWDOWN_HW); + DELAY(1000); + break; + } } static void -alc_aspm(struct alc_softc *sc) +alc_aspm(struct alc_softc *sc, int media) { uint32_t pmcfg; + uint16_t linkcfg; ALC_LOCK_ASSERT(sc); pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == + (ALC_FLAG_APS | ALC_FLAG_PCIE)) + linkcfg = CSR_READ_2(sc, sc->alc_expcap + + PCIR_EXPRESS_LINK_CTL); + else + linkcfg = 0; pmcfg &= ~PM_CFG_SERDES_PD_EX_L1; - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB; - pmcfg |= PM_CFG_SERDES_L1_ENB; - pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_LCKDET_TIMER_MASK); pmcfg |= PM_CFG_MAC_ASPM_CHK; + pmcfg |= PM_CFG_SERDES_ENB | PM_CFG_RBER_ENB; + pmcfg &= ~(PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + /* Disable extended sync except AR8152 B v1.0 */ + linkcfg &= ~0x80; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) + linkcfg |= 0x80; + CSR_WRITE_2(sc, sc->alc_expcap + PCIR_EXPRESS_LINK_CTL, + linkcfg); + pmcfg &= ~(PM_CFG_EN_BUFS_RX_L0S | PM_CFG_SA_DLY_ENB | + PM_CFG_HOTRST); + pmcfg |= (PM_CFG_L1_ENTRY_TIMER_DEFAULT << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= (PM_CFG_PM_REQ_TIMER_DEFAULT << + PM_CFG_PM_REQ_TIMER_SHIFT); + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_PCIE_RECV; + } + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { - pmcfg |= PM_CFG_SERDES_PLL_L1_ENB; - pmcfg &= ~PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L0S) != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + if (sc->alc_ident->deviceid == + DEVICEID_ATHEROS_AR8152_B) + pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + pmcfg &= ~(PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB); + pmcfg |= PM_CFG_CLK_SWH_L1; + if (media == IFM_100_TX || media == IFM_1000_T) { + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + pmcfg |= (7 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + case DEVICEID_ATHEROS_AR8152_B2: + case DEVICEID_ATHEROS_AR8151_V2: + pmcfg |= (4 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + default: + pmcfg |= (15 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + } + } + } else { + pmcfg |= PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB; + pmcfg &= ~(PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + } } else { - pmcfg &= ~PM_CFG_SERDES_PLL_L1_ENB; + pmcfg &= ~(PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB); pmcfg |= PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; } CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } @@ -567,7 +758,7 @@ alc_attach(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; + char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; uint16_t burst; int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; @@ -580,6 +771,7 @@ alc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); /* Map the device. */ pci_enable_busmaster(dev); @@ -619,6 +811,20 @@ alc_attach(device_t dev) val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, + CSR_READ_4(sc, ALC_PCIE_PHYMISC) | + PCIE_PHYMISC_FORCE_RCV_DET); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) { + val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); + val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | + PCIE_PHYMISC2_SERDES_TH_MASK); + val |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT; + val |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT; + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); + } /* Disable ASPM L0S and L1. */ cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); if ((cap & PCIM_LINK_CAP_ASPM) != 0) { @@ -629,12 +835,19 @@ alc_attach(device_t dev) device_printf(dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; + if (state & 0x01) + sc->alc_flags |= ALC_FLAG_L0S; + if (state & 0x02) + sc->alc_flags |= ALC_FLAG_L1S; if (bootverbose) device_printf(sc->alc_dev, "ASPM %s %s\n", aspm_state[state], state == 0 ? "disabled" : "enabled"); - if (state != 0) - alc_disable_l0s_l1(sc); + alc_disable_l0s_l1(sc); + } else { + if (bootverbose) + device_printf(sc->alc_dev, + "no ASPM support\n"); } } @@ -651,12 +864,25 @@ alc_attach(device_t dev) * used in AR8132 can't establish gigabit link even if it * shows the same PHY model/revision number of AR8131. */ - if (pci_get_device(dev) == DEVICEID_ATHEROS_AR8132) - sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO; - else - sc->alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_AR8132: + sc->alc_flags |= ALC_FLAG_FASTETHER; + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + default: + break; + } + sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + /* - * It seems that AR8131/AR8132 has silicon bug for SMB. In + * It seems that AR813x/AR815x has silicon bug for SMB. In * addition, Atheros said that enabling SMB wouldn't improve * performance. However I think it's bad to access lots of * registers to extract MAC statistics. @@ -1369,7 +1595,7 @@ again: /* * Create Tx buffer parent tag. - * AR8131/AR8132 allows 64bit DMA addressing of Tx/Rx buffers + * AR813x/AR815x allows 64bit DMA addressing of Tx/Rx buffers * so it needs separate parent DMA tag as parent DMA address * space could be restricted to be within 32bit address space * by 4GB boundary crossing. @@ -1806,7 +2032,7 @@ alc_encap(struct alc_softc *sc, struct m poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* - * AR8131/AR8132 requires offset of TCP/UDP header in its + * AR813x/AR815x requires offset of TCP/UDP header in its * Tx descriptor to perform Tx checksum offloading. TSO * also requires TCP header offset and modification of * IP/TCP header. This kind of operation takes many CPU @@ -1826,12 +2052,14 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); + m = m_pullup(m, sizeof(struct ether_header) + + sizeof(struct ip)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + ip = (struct ip *)(mtod(m, char *) + + sizeof(struct ether_header)); poff = sizeof(struct ether_header) + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); @@ -1922,7 +2150,7 @@ alc_encap(struct alc_softc *sc, struct m cflags |= (poff << TD_TCPHDR_OFFSET_SHIFT) & TD_TCPHDR_OFFSET_MASK; /* - * AR8131/AR8132 requires the first buffer should + * AR813x/AR815x requires the first buffer should * only hold IP/TCP header data. Payload should * be handled in other descriptors. */ @@ -2103,14 +2331,16 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, error = 0; switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ALC_JUMBO_MTU || + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > (sc->alc_ident->max_framelen - + sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) || ((sc->alc_flags & ALC_FLAG_JUMBO) == 0 && ifr->ifr_mtu > ETHERMTU)) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ALC_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU && (ifp->if_capenable & IFCAP_TSO4) != 0) { ifp->if_capenable &= ~IFCAP_TSO4; @@ -2161,7 +2391,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((ifp->if_capenable & IFCAP_TSO4) != 0) { - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_TSO; @@ -2213,6 +2443,10 @@ alc_mac_config(struct alc_softc *sc) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg &= ~(MAC_CFG_FULL_DUPLEX | MAC_CFG_TX_FC | MAC_CFG_RX_FC | MAC_CFG_SPEED_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; /* Reprogram MAC with resolved speed/duplex. */ switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: @@ -2834,7 +3068,9 @@ alc_reset(struct alc_softc *sc) uint32_t reg; int i; - CSR_WRITE_4(sc, ALC_MASTER_CFG, MASTER_RESET); + reg = CSR_READ_4(sc, ALC_MASTER_CFG) & 0xFFFF; + reg |= MASTER_OOB_DIS_OFF | MASTER_RESET; + CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); for (i = ALC_RESET_TIMEOUT; i > 0; i--) { DELAY(10); if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_RESET) == 0) @@ -2965,6 +3201,18 @@ alc_init_locked(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_HI, ALC_ADDR_HI(paddr)); CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_LO, ALC_ADDR_LO(paddr)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + /* Reconfigure SRAM - Vendor magic. */ + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_LEN, 0x000002A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_LEN, 0x00000100); + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_ADDR, 0x029F0000); + CSR_WRITE_4(sc, ALC_SRAM_RD0_ADDR, 0x02BF02A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_ADDR, 0x03BF02C0); + CSR_WRITE_4(sc, ALC_SRAM_TD_ADDR, 0x03DF03C0); + CSR_WRITE_4(sc, ALC_TXF_WATER_MARK, 0x00000000); + CSR_WRITE_4(sc, ALC_RD_DMA_CFG, 0x00000000); + } + /* Tell hardware that we're ready to load DMA blocks. */ CSR_WRITE_4(sc, ALC_DMA_BLOCK, DMA_BLOCK_LOAD); @@ -2972,14 +3220,11 @@ alc_init_locked(struct alc_softc *sc) reg = ALC_USECS(sc->alc_int_rx_mod) << IM_TIMER_RX_SHIFT; reg |= ALC_USECS(sc->alc_int_tx_mod) << IM_TIMER_TX_SHIFT; CSR_WRITE_4(sc, ALC_IM_TIMER, reg); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~(MASTER_CHIP_REV_MASK | MASTER_CHIP_ID_MASK); /* * We don't want to automatic interrupt clear as task queue * for the interrupt should know interrupt status. */ - reg &= ~MASTER_INTR_RD_CLR; - reg &= ~(MASTER_IM_RX_TIMER_ENB | MASTER_IM_TX_TIMER_ENB); + reg = MASTER_SA_TIMER_ENB; if (ALC_USECS(sc->alc_int_rx_mod) != 0) reg |= MASTER_IM_RX_TIMER_ENB; if (ALC_USECS(sc->alc_int_tx_mod) != 0) @@ -3020,7 +3265,7 @@ alc_init_locked(struct alc_softc *sc) * Be conservative in what you do, be liberal in what you * accept from others - RFC 793. */ - CSR_WRITE_4(sc, ALC_FRAME_SIZE, ALC_JUMBO_FRAMELEN); + CSR_WRITE_4(sc, ALC_FRAME_SIZE, sc->alc_ident->max_framelen); /* Disable header split(?) */ CSR_WRITE_4(sc, ALC_HDS_CFG, 0); @@ -3047,11 +3292,14 @@ alc_init_locked(struct alc_softc *sc) * TSO/checksum offloading. */ CSR_WRITE_4(sc, ALC_TSO_OFFLOAD_THRESH, - (ALC_JUMBO_FRAMELEN >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & + (sc->alc_ident->max_framelen >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & TSO_OFFLOAD_THRESH_MASK); /* Configure TxQ. */ reg = (alc_dma_burst[sc->alc_dma_rd_burst] << TXQ_CFG_TX_FIFO_BURST_SHIFT) & TXQ_CFG_TX_FIFO_BURST_MASK; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg >>= 1; reg |= (TXQ_CFG_TD_BURST_DEFAULT << TXQ_CFG_TD_BURST_SHIFT) & TXQ_CFG_TD_BURST_MASK; CSR_WRITE_4(sc, ALC_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE); @@ -3068,14 +3316,23 @@ alc_init_locked(struct alc_softc *sc) * XON : 80% of Rx FIFO * XOFF : 30% of Rx FIFO */ - reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); - rxf_hi = (reg * 8) / 10; - rxf_lo = (reg * 3)/ 10; - CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, - ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & - RX_FIFO_PAUSE_THRESH_LO_MASK) | - ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & - RX_FIFO_PAUSE_THRESH_HI_MASK)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132) { + reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); + rxf_hi = (reg * 8) / 10; + rxf_lo = (reg * 3) / 10; + CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, + ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & + RX_FIFO_PAUSE_THRESH_LO_MASK) | + ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & + RX_FIFO_PAUSE_THRESH_HI_MASK)); + } + + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2) + CSR_WRITE_4(sc, ALC_SERDES_LOCK, + CSR_READ_4(sc, ALC_SERDES_LOCK) | SERDES_MAC_CLK_SLOWDOWN | + SERDES_PHY_CLK_SLOWDOWN); /* Disable RSS until I understand L1C/L2C's RSS logic. */ CSR_WRITE_4(sc, ALC_RSS_IDT_TABLE0, 0); @@ -3086,15 +3343,9 @@ alc_init_locked(struct alc_softc *sc) RXQ_CFG_RD_BURST_MASK; reg |= RXQ_CFG_RSS_MODE_DIS; if ((sc->alc_flags & ALC_FLAG_ASPM_MON) != 0) - reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M; + reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M; CSR_WRITE_4(sc, ALC_RXQ_CFG, reg); - /* Configure Rx DMAW request thresold. */ - CSR_WRITE_4(sc, ALC_RD_DMA_CFG, - ((RD_DMA_CFG_THRESH_DEFAULT << RD_DMA_CFG_THRESH_SHIFT) & - RD_DMA_CFG_THRESH_MASK) | - ((ALC_RD_DMA_CFG_USECS(0) << RD_DMA_CFG_TIMER_SHIFT) & - RD_DMA_CFG_TIMER_MASK)); /* Configure DMA parameters. */ reg = DMA_CFG_OUT_ORDER | DMA_CFG_RD_REQ_PRI; reg |= sc->alc_rcb; @@ -3120,7 +3371,7 @@ alc_init_locked(struct alc_softc *sc) * - Enable CRC generation. * Actual reconfiguration of MAC for resolved speed/duplex * is followed after detection of link establishment. - * AR8131/AR8132 always does checksum computation regardless + * AR813x/AR815x always does checksum computation regardless * of MAC_CFG_RXCSUM_ENB bit. Also the controller is known to * have bug in protocol field in Rx return structure so * these controllers can't handle fragmented frames. Disable @@ -3130,6 +3381,10 @@ alc_init_locked(struct alc_softc *sc) reg = MAC_CFG_TX_CRC_ENB | MAC_CFG_TX_AUTO_PAD | MAC_CFG_FULL_DUPLEX | ((MAC_CFG_PREAMBLE_DEFAULT << MAC_CFG_PREAMBLE_SHIFT) & MAC_CFG_PREAMBLE_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; if ((sc->alc_flags & ALC_FLAG_FASTETHER) != 0) reg |= MAC_CFG_SPEED_10_100; else Modified: stable/8/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 21:15:40 2010 (r212021) @@ -36,10 +36,17 @@ #define VENDORID_ATHEROS 0x1969 /* - * Atheros AR8131/AR8132 device ID + * Atheros AR813x/AR815x device ID */ #define DEVICEID_ATHEROS_AR8131 0x1063 /* L1C */ #define DEVICEID_ATHEROS_AR8132 0x1062 /* L2C */ +#define DEVICEID_ATHEROS_AR8151 0x1073 /* L1D V1.0 */ +#define DEVICEID_ATHEROS_AR8151_V2 0x1083 /* L1D V2.0 */ +#define DEVICEID_ATHEROS_AR8152_B 0x2060 /* L2C V1.1 */ +#define DEVICEID_ATHEROS_AR8152_B2 0x2062 /* L2C V2.0 */ + +#define ATHEROS_AR8152_B_V10 0xC0 +#define ATHEROS_AR8152_B_V11 0xC1 /* 0x0000 - 0x02FF : PCIe configuration space */ @@ -64,6 +71,12 @@ #define ALC_PCIE_PHYMISC 0x1000 #define PCIE_PHYMISC_FORCE_RCV_DET 0x00000004 +#define ALC_PCIE_PHYMISC2 0x1004 +#define PCIE_PHYMISC2_SERDES_CDR_MASK 0x00030000 +#define PCIE_PHYMISC2_SERDES_TH_MASK 0x000C0000 +#define PCIE_PHYMISC2_SERDES_CDR_SHIFT 16 +#define PCIE_PHYMISC2_SERDES_TH_SHIFT 18 + #define ALC_TWSI_DEBUG 0x1108 #define TWSI_DEBUG_DEV_EXIST 0x20000000 @@ -97,6 +110,8 @@ #define PM_CFG_L1_ENTRY_TIMER_MASK 0x000F0000 #define PM_CFG_PM_REQ_TIMER_MASK 0x00F00000 #define PM_CFG_LCKDET_TIMER_MASK 0x3F000000 +#define PM_CFG_EN_BUFS_RX_L0S 0x10000000 +#define PM_CFG_SA_DLY_ENB 0x20000000 #define PM_CFG_MAC_ASPM_CHK 0x40000000 #define PM_CFG_HOTRST 0x80000000 #define PM_CFG_L0S_ENTRY_TIMER_SHIFT 8 @@ -104,10 +119,19 @@ #define PM_CFG_PM_REQ_TIMER_SHIFT 20 #define PM_CFG_LCKDET_TIMER_SHIFT 24 +#define PM_CFG_L0S_ENTRY_TIMER_DEFAULT 6 +#define PM_CFG_L1_ENTRY_TIMER_DEFAULT 12 +#define PM_CFG_PM_REQ_TIMER_DEFAULT 1 + +#define ALC_LTSSM_ID_CFG 0x12FC +#define LTSSM_ID_WRO_ENB 0x00001000 + #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 #define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 +#define MASTER_OOB_DIS_OFF 0x00000040 +#define MASTER_SA_TIMER_ENB 0x00000080 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -122,7 +146,7 @@ #define MASTER_CHIP_REV_SHIFT 16 #define MASTER_CHIP_ID_SHIFT 24 -/* Number of ticks per usec for AR8131/AR8132. */ +/* Number of ticks per usec for AR813x/AR815x. */ #define ALC_TICK_USECS 2 #define ALC_USECS(x) ((x) / ALC_TICK_USECS) @@ -220,6 +244,8 @@ #define ALC_SERDES_LOCK 0x1424 #define SERDES_LOCK_DET 0x00000001 #define SERDES_LOCK_DET_ENB 0x00000002 +#define SERDES_MAC_CLK_SLOWDOWN 0x00020000 +#define SERDES_PHY_CLK_SLOWDOWN 0x00040000 #define ALC_MAC_CFG 0x1480 #define MAC_CFG_TX_ENB 0x00000001 @@ -249,6 +275,8 @@ #define MAC_CFG_BCAST 0x04000000 #define MAC_CFG_DBG 0x08000000 #define MAC_CFG_SINGLE_PAUSE_ENB 0x10000000 +#define MAC_CFG_HASH_ALG_CRC32 0x20000000 +#define MAC_CFG_SPEED_MODE_SW 0x40000000 #define MAC_CFG_PREAMBLE_SHIFT 10 #define MAC_CFG_PREAMBLE_DEFAULT 7 @@ -691,7 +719,7 @@ #define HDS_CFG_BACKFILLSIZE_SHIFT 8 #define HDS_CFG_MAX_HDRSIZE_SHIFT 20 -/* AR8131/AR8132 registers for MAC statistics */ +/* AR813x/AR815x registers for MAC statistics */ #define ALC_RX_MIB_BASE 0x1700 #define ALC_TX_MIB_BASE 0x1760 Modified: stable/8/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:15:40 2010 (r212021) @@ -68,13 +68,8 @@ #define ALC_PROC_MAX (ALC_RX_RING_CNT - 1) #define ALC_PROC_DEFAULT (ALC_RX_RING_CNT / 4) -#define ALC_JUMBO_FRAMELEN (9 * 1024) -#define ALC_JUMBO_MTU \ - (ALC_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) -#define ALC_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) - /* - * The number of bits reserved for MSS in AR8121/AR8132 controllers + * The number of bits reserved for MSS in AR813x/AR815x controllers * are 13 bits. This limits the maximum interface MTU size in TSO * case(8191 + sizeof(struct ip) + sizeof(struct tcphdr)) as upper * stack should not generate TCP segments with MSS greater than the @@ -192,6 +187,13 @@ struct alc_hw_stats { uint64_t tx_mcast_bytes; }; +struct alc_ident { + uint16_t vendorid; + uint16_t deviceid; + uint32_t max_framelen; + const char *name; +}; + /* * Software state per device. */ @@ -204,6 +206,7 @@ struct alc_softc { struct resource *alc_irq[ALC_MSI_MESSAGES]; struct resource_spec *alc_irq_spec; void *alc_intrhand[ALC_MSI_MESSAGES]; + struct alc_ident *alc_ident; int alc_rev; int alc_chip_rev; int alc_phyaddr; @@ -224,6 +227,9 @@ struct alc_softc { #define ALC_FLAG_ASPM_MON 0x0080 #define ALC_FLAG_CMB_BUG 0x0100 #define ALC_FLAG_SMB_BUG 0x0200 +#define ALC_FLAG_L0S 0x0400 +#define ALC_FLAG_L1S 0x0800 +#define ALC_FLAG_APS 0x1000 #define ALC_FLAG_DETACH 0x4000 #define ALC_FLAG_LINK 0x8000 From owner-svn-src-stable-8@FreeBSD.ORG Mon Aug 30 21:18:28 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4753F10656B7; Mon, 30 Aug 2010 21:18:28 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0228FC0C; Mon, 30 Aug 2010 21:18: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 o7ULIShd007851; Mon, 30 Aug 2010 21:18:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULIRiI007849; Mon, 30 Aug 2010 21:18:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302118.o7ULIRiI007849@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21: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: r212023 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2010 21:18:28 -0000 Author: yongari Date: Mon Aug 30 21:18:27 2010 New Revision: 212023 URL: http://svn.freebsd.org/changeset/base/212023 Log: MFC r211106: Document newly added controller AR8151 and AR8152. Modified: stable/8/share/man/man4/alc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/alc.4 ============================================================================== --- stable/8/share/man/man4/alc.4 Mon Aug 30 21:17:11 2010 (r212022) +++ stable/8/share/man/man4/alc.4 Mon Aug 30 21:18:27 2010 (r212023) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2009 +.Dd August 9, 2010 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR8131/AR8132 Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,9 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR8131 PCI Express -Gigabit Ethernet controllers and Atheros AR8132 PCI Express -Fast Ethernet controllers. +device driver provides support for Atheros AR813x and AR815x PCI +Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -59,8 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR8131/AR8132 supports Jumbo Frames (up to 9216 bytes), which can -be configured via the interface MTU setting. +The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 +bytes, respectively), which can be configured via the interface +MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -104,6 +104,14 @@ device driver provides support for the f Atheros AR8131 PCI Express Gigabit Ethernet controller .It Atheros AR8132 PCI Express Fast Ethernet controller +.It +Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8152 v1.1 PCI Express Fast Ethernet controller +.It +Atheros AR8152 v2.0 PCI Express Fast Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 00:15:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF94B1065675; Tue, 31 Aug 2010 00:15:20 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DE838FC18; Tue, 31 Aug 2010 00:15: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 o7V0FK1b012483; Tue, 31 Aug 2010 00:15:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0FKXL012481; Tue, 31 Aug 2010 00:15:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310015.o7V0FKXL012481@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:15: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: r212039 - stable/8/sys/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 00:15:20 -0000 Author: yongari Date: Tue Aug 31 00:15:20 2010 New Revision: 212039 URL: http://svn.freebsd.org/changeset/base/212039 Log: MFC r211648: It seems some newer RTL8139 controllers provides only memory space register mapping. I'm not sure whether it comes from the fact that controllers live behind certain PCI brdge(PLX PCI 6152 33BC) and the bridge has some issues in handling I/O space register mapping. Unfortunately it's not possible to narrow down to an exact controller that shows this issue because RealTek used the same PCI device/revision id again. In theory, it's possible to check parent PCI bridge device and change rl(4) to use memory space register mapping if the parent PCI bridge is PLX PCI 6152. But I didn't try to do that and we wouldn't get much benefit with added complexity. Blindly switching to use memory space register mapping for rl(4) may make most old controllers not to work. At least, I don't want to take potential risk from such change. So use I/O space register mapping by default but give users chance to override it via a tunable. The tunable to use memory space register mapping would be given by adding the following line to /boot/loader.conf file. dev.rl.%d.prefer_iomap="0" This change makes P811B quad-port work with this tunable. Modified: stable/8/sys/pci/if_rl.c Directory Properties: 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) Modified: stable/8/sys/pci/if_rl.c ============================================================================== --- stable/8/sys/pci/if_rl.c Mon Aug 30 23:26:10 2010 (r212038) +++ stable/8/sys/pci/if_rl.c Tue Aug 31 00:15:20 2010 (r212039) @@ -125,16 +125,6 @@ MODULE_DEPEND(rl, miibus, 1, 1, 1); /* "device miibus" required. See GENERIC if you get errors here. */ #include "miibus_if.h" -/* - * Default to using PIO access for this driver. On SMP systems, - * there appear to be problems with memory mapped mode: it looks like - * doing too many memory mapped access back to back in rapid succession - * can hang the bus. I'm inclined to blame this on crummy design/construction - * on the part of RealTek. Memory mapped mode does appear to work on - * uniprocessor systems though. - */ -#define RL_USEIOSPACE - #include /* @@ -225,14 +215,6 @@ static void rl_watchdog(struct rl_softc static void rl_setwol(struct rl_softc *); static void rl_clrwol(struct rl_softc *); -#ifdef RL_USEIOSPACE -#define RL_RES SYS_RES_IOPORT -#define RL_RID RL_PCI_LOIO -#else -#define RL_RES SYS_RES_MEMORY -#define RL_RID RL_PCI_LOMEM -#endif - static device_method_t rl_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rl_probe), @@ -806,7 +788,7 @@ rl_attach(device_t dev) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children; int error = 0, hwrev, i, pmc, rid; - int unit; + int prefer_iomap, unit; uint16_t rl_did = 0; char tn[32]; @@ -828,10 +810,31 @@ rl_attach(device_t dev) pci_enable_busmaster(dev); - /* Map control/status registers. */ - rid = RL_RID; - sc->rl_res = bus_alloc_resource_any(dev, RL_RES, &rid, RF_ACTIVE); + /* + * Map control/status registers. + * Default to using PIO access for this driver. On SMP systems, + * there appear to be problems with memory mapped mode: it looks + * like doing too many memory mapped access back to back in rapid + * succession can hang the bus. I'm inclined to blame this on + * crummy design/construction on the part of RealTek. Memory + * mapped mode does appear to work on uniprocessor systems though. + */ + prefer_iomap = 1; + snprintf(tn, sizeof(tn), "dev.rl.%d.prefer_iomap", unit); + TUNABLE_INT_FETCH(tn, &prefer_iomap); + if (prefer_iomap) { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } + if (prefer_iomap == 0 || sc->rl_res == NULL) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } if (sc->rl_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); error = ENXIO; @@ -1029,7 +1032,8 @@ rl_detach(device_t dev) if (sc->rl_irq[0]) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq[0]); if (sc->rl_res) - bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); + bus_release_resource(dev, sc->rl_res_type, sc->rl_res_id, + sc->rl_res); if (ifp) if_free(ifp); From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 00:19:04 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BE2B106564A; Tue, 31 Aug 2010 00:19:04 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EED218FC16; Tue, 31 Aug 2010 00:19: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 o7V0J3FZ012650; Tue, 31 Aug 2010 00:19:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0J39f012648; Tue, 31 Aug 2010 00:19:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310019.o7V0J39f012648@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:19: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: r212041 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 00:19:04 -0000 Author: yongari Date: Tue Aug 31 00:19:03 2010 New Revision: 212041 URL: http://svn.freebsd.org/changeset/base/212041 Log: MFC r211650,211667: r211650: Document tunable dev.rl.%unit.prefer_iomap r211667: Better wording and fix wrong explanation. Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) Modified: stable/8/share/man/man4/rl.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/rl.4 ============================================================================== --- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) +++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2008 +.Dd August 22, 2010 .Dt RL 4 .Os .Sh NAME @@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C .El .Sh LOADER TUNABLES .Bl -tag -width indent +.It Va dev.rl.%unit.prefer_iomap +This tunable controls which register mapping should be used on the +specified device. +A non-zero value enables I/O space register mapping. +For controllers that have no I/O space register mapping this tunable +should be set to 0 to use memory space register mapping. +The default value is 1 to use I/O space register mapping. .It Va dev.rl.%unit.twister_enable Non-zero value enables the long cable tuning on the specified device. Disabled by default. From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 06:56:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E1FB106564A; Tue, 31 Aug 2010 06:56:34 +0000 (UTC) (envelope-from freebsd@nagilum.org) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mx1.freebsd.org (Postfix) with ESMTP id E7EBD8FC13; Tue, 31 Aug 2010 06:56:33 +0000 (UTC) Received: from cakebox.homeunix.net (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MWOFC-1OJwfv40N8-00X55w; Tue, 31 Aug 2010 08:43:58 +0200 Received: from cakebox.homeunix.net (localhost [127.0.0.1]) by cakebox.homeunix.net (Postfix) with ESMTP id C651367804; Tue, 31 Aug 2010 08:43:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cakebox.tis X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.7 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: by cakebox.homeunix.net (Postfix, from userid 80) id 301C767803; Tue, 31 Aug 2010 08:43:49 +0200 (CEST) Received: from p50813BAB.dip0.t-ipconnect.de (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by cakebox.homeunix.net (Horde Framework) with HTTP; Tue, 31 Aug 2010 08:43:48 +0200 Message-ID: <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> Date: Tue, 31 Aug 2010 08:43:48 +0200 From: Alexander To: Pyun YongHyeon References: <201008310019.o7V0J39f012648@svn.freebsd.org> In-Reply-To: <201008310019.o7V0J39f012648@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-Provags-ID: V02:K0:4yN6+R+LoJIHXrV/r7XvWCfeNpq2uKDMoRFOUdJTbE7 xkleU+8sOHN+0aXWILi0XF+d5G21Cby0TDsMcKOpBaD9LuuA4e cgxAspr87lSnZcULyEQT+/34ZhiistK9aesca+FtCkgDBdZgp2 geHS36sk0eVmbRqhCCP2LPJ/0TlGpuxZ8QiUI/FtCoZmTv28CF Ze52WQ4SnOFUbuwOsX3doF79+tuhz+GQFhctRccsZc= 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: r212041 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 06:56:34 -0000 Can we name the known examples somewhere? ----- Message from yongari@FreeBSD.org --------- Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) From: Pyun YongHyeon Subject: svn commit: r212041 - stable/8/share/man/man4 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org > Author: yongari > Date: Tue Aug 31 00:19:03 2010 > New Revision: 212041 > URL: http://svn.freebsd.org/changeset/base/212041 > > Log: > MFC r211650,211667: > r211650: > Document tunable dev.rl.%unit.prefer_iomap > > r211667: > Better wording and fix wrong explanation. > > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) > > Modified: > stable/8/share/man/man4/rl.4 > Directory Properties: > stable/8/share/man/man4/ (props changed) > > Modified: stable/8/share/man/man4/rl.4 > ============================================================================== > --- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) > +++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd November 1, 2008 > +.Dd August 22, 2010 > .Dt RL 4 > .Os > .Sh NAME > @@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C > .El > .Sh LOADER TUNABLES > .Bl -tag -width indent > +.It Va dev.rl.%unit.prefer_iomap > +This tunable controls which register mapping should be used on the > +specified device. > +A non-zero value enables I/O space register mapping. > +For controllers that have no I/O space register mapping this tunable > +should be set to 0 to use memory space register mapping. > +The default value is 1 to use I/O space register mapping. > .It Va dev.rl.%unit.twister_enable > Non-zero value enables the long cable tuning on the specified device. > Disabled by default. > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > ----- End message from yongari@FreeBSD.org ----- ======================================================================== # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # ======================================================================== ---------------------------------------------------------------- cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 15:52:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D10421065694; Tue, 31 Aug 2010 15:52:12 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFF158FC14; Tue, 31 Aug 2010 15:52:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VFqCgQ034663; Tue, 31 Aug 2010 15:52:12 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VFqCkZ034661; Tue, 31 Aug 2010 15:52:12 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008311552.o7VFqCkZ034661@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 31 Aug 2010 15:52:12 +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: r212056 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 15:52:12 -0000 Author: ume Date: Tue Aug 31 15:52:12 2010 New Revision: 212056 URL: http://svn.freebsd.org/changeset/base/212056 Log: MFC r211435, r211530: Make `ping6 -I' work with net.inet6.ip6.use_defaultzone=1. Modified: stable/8/sys/netinet6/raw_ip6.c Directory Properties: 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) Modified: stable/8/sys/netinet6/raw_ip6.c ============================================================================== --- stable/8/sys/netinet6/raw_ip6.c Tue Aug 31 15:49:41 2010 (r212055) +++ stable/8/sys/netinet6/raw_ip6.c Tue Aug 31 15:52:12 2010 (r212056) @@ -401,6 +401,7 @@ rip6_output(m, va_alist) struct ifnet *oifp = NULL; int type = 0, code = 0; /* for ICMPv6 output statistics only */ int scope_ambiguous = 0; + int use_defzone = 0; struct in6_addr in6a; va_list ap; @@ -430,9 +431,12 @@ rip6_output(m, va_alist) * XXX: we may still need to determine the zone later. */ if (!(so->so_state & SS_ISCONNECTED)) { - if (dstsock->sin6_scope_id == 0 && !V_ip6_use_defzone) + if (!optp || !optp->ip6po_pktinfo || + !optp->ip6po_pktinfo->ipi6_ifindex) + use_defzone = V_ip6_use_defzone; + if (dstsock->sin6_scope_id == 0 && !use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(dstsock, V_ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(dstsock, use_defzone)) != 0) goto bad; } From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 20:00:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D3B10656B0; Tue, 31 Aug 2010 20:00:35 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 0CBE08FC13; Tue, 31 Aug 2010 20:00:34 +0000 (UTC) Received: by pxi17 with SMTP id 17so3035881pxi.13 for ; Tue, 31 Aug 2010 13:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=nc5Z+fI6KDgIHtT9rtzIK+OdGH5ebVRmagpP1WKgLw0=; b=VMfR8ahI5IgSWaXgue8lvpAfOUECqAzp3oYSPR/9vahirxcEncYUyKHTuY/ZumyHnS nAKOAr37MoCcrC7uTlrc7F1P91+vo4tiHCnJrDmom1Zzurlm6duSobAj7Ka0g2BFAgHp T+sy2nQJysDwsiaJXWil6AdTYss5IeduYkd6c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=QAa5JusUCj082o+qSC/prGc9nKqwsC+VK26nLhqGhAflZ7L7XPK5EkN88ihlWYoZ0c bozN5irL2iGFWO3tesUqgA9VV/xwk0N4pehiN376kP/GYZzEJ2Qr7HjUvh8Ykz0RzCqu 3hN1UPGqC0uC5DjoA1wiRtaLuIsuRpvgzbWAk= Received: by 10.114.111.5 with SMTP id j5mr3238274wac.28.1283283276241; Tue, 31 Aug 2010 12:34:36 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id o17sm10779474wal.21.2010.08.31.12.34.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 12:34:34 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 31 Aug 2010 12:34:09 -0700 From: Pyun YongHyeon Date: Tue, 31 Aug 2010 12:34:09 -0700 To: Alexander Message-ID: <20100831193409.GB9903@michelle.cdnetworks.com> References: <201008310019.o7V0J39f012648@svn.freebsd.org> <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Pyun YongHyeon Subject: Re: svn commit: r212041 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 20:00:35 -0000 On Tue, Aug 31, 2010 at 08:43:48AM +0200, Alexander wrote: > Can we name the known examples somewhere? > Do you have suggestion for somewhere? Personally I think man page is one of best place to put these kind of knobs. > ----- Message from yongari@FreeBSD.org --------- > Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) > From: Pyun YongHyeon > Subject: svn commit: r212041 - stable/8/share/man/man4 > To: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org > > > >Author: yongari > >Date: Tue Aug 31 00:19:03 2010 > >New Revision: 212041 > >URL: http://svn.freebsd.org/changeset/base/212041 > > > >Log: > > MFC r211650,211667: > > r211650: > > Document tunable dev.rl.%unit.prefer_iomap > > > > r211667: > > Better wording and fix wrong explanation. > > > > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) > > > >Modified: > > stable/8/share/man/man4/rl.4 > >Directory Properties: > > stable/8/share/man/man4/ (props changed) > > > >Modified: stable/8/share/man/man4/rl.4 > >============================================================================== > >--- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) > >+++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) > >@@ -30,7 +30,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > >-.Dd November 1, 2008 > >+.Dd August 22, 2010 > > .Dt RL 4 > > .Os > > .Sh NAME > >@@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C > > .El > > .Sh LOADER TUNABLES > > .Bl -tag -width indent > >+.It Va dev.rl.%unit.prefer_iomap > >+This tunable controls which register mapping should be used on the > >+specified device. > >+A non-zero value enables I/O space register mapping. > >+For controllers that have no I/O space register mapping this tunable > >+should be set to 0 to use memory space register mapping. > >+The default value is 1 to use I/O space register mapping. > > .It Va dev.rl.%unit.twister_enable > > Non-zero value enables the long cable tuning on the specified device. > > Disabled by default. > >_______________________________________________ > >svn-src-stable-8@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > >To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > > > > > ----- End message from yongari@FreeBSD.org ----- > > > > ======================================================================== > # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # > # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # > # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # > # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # > # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # > ======================================================================== > > > ---------------------------------------------------------------- > cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-stable-8@FreeBSD.ORG Tue Aug 31 21:53:00 2010 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D89810656B1; Tue, 31 Aug 2010 21:53:00 +0000 (UTC) (envelope-from freebsd@nagilum.org) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 365438FC13; Tue, 31 Aug 2010 21:53:00 +0000 (UTC) Received: from cakebox.homeunix.net (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MNezy-1OkUDI1iYs-007gnK; Tue, 31 Aug 2010 23:52:58 +0200 Received: from cakebox.homeunix.net (localhost [127.0.0.1]) by cakebox.homeunix.net (Postfix) with ESMTP id DF24067820; Tue, 31 Aug 2010 23:52:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cakebox.tis X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.7 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: by cakebox.homeunix.net (Postfix, from userid 80) id 6B9206781C; Tue, 31 Aug 2010 23:52:48 +0200 (CEST) Received: from p50813BAB.dip0.t-ipconnect.de (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by cakebox.homeunix.net (Horde Framework) with HTTP; Tue, 31 Aug 2010 23:52:47 +0200 Message-ID: <20100831235247.29204rr58q2db38k@cakebox.homeunix.net> Date: Tue, 31 Aug 2010 23:52:47 +0200 From: Alexander To: pyunyh@gmail.com References: <201008310019.o7V0J39f012648@svn.freebsd.org> <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> <20100831193409.GB9903@michelle.cdnetworks.com> In-Reply-To: <20100831193409.GB9903@michelle.cdnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-Provags-ID: V02:K0:QficA4VTFWi5iKNUTt1njqiL4smbQwU5XNrtcYnKMo0 AKIGmBxPjrZEIstgnqBiT8adPx8D6I2g26s9plXPks7nt/NsaQ XmabFFg6meZbeXscg3H89AF/dYCmImVw12JKl0t4o28i55+mVZ 9UEc6uL3rUUoqVu1Ol1ZNCZj7Jpeu2tPNyKu3Qo2BiEpmBxOFE 9xbyEZ7pYqATLeNRL2usv3BCfl3+3uDPAZy1tk/Na8= Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Pyun YongHyeon Subject: Re: svn commit: r212041 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 21:53:00 -0000 ----- Message from pyunyh@gmail.com --------- Date: Tue, 31 Aug 2010 12:34:09 -0700 From: Pyun YongHyeon Reply-To: pyunyh@gmail.com Subject: Re: svn commit: r212041 - stable/8/share/man/man4 To: Alexander Cc: Pyun YongHyeon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-8@FreeBSD.org > On Tue, Aug 31, 2010 at 08:43:48AM +0200, Alexander wrote: >> Can we name the known examples somewhere? >> > > Do you have suggestion for somewhere? > Personally I think man page is one of best place to put these kind > of knobs. Yeah, the man page would be my choice as well. But I was thinking of naming the adapters known to require the use of memory space register mapping. (Besides the description we you already provided.) It doesn't have to be an exhaustive list. >> ----- Message from yongari@FreeBSD.org --------- >> Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) >> From: Pyun YongHyeon >> >> >> >Author: yongari >> >Date: Tue Aug 31 00:19:03 2010 >> >New Revision: 212041 >> >URL: http://svn.freebsd.org/changeset/base/212041 >> > >> >Log: >> > MFC r211650,211667: >> > r211650: >> > Document tunable dev.rl.%unit.prefer_iomap >> > >> > r211667: >> > Better wording and fix wrong explanation. >> > >> > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) >> > >> >Modified: >> > stable/8/share/man/man4/rl.4 >> >Directory Properties: >> > stable/8/share/man/man4/ (props changed) >> > >> >Modified: stable/8/share/man/man4/rl.4 >> >============================================================================== >> >--- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) >> >+++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) >> >@@ -30,7 +30,7 @@ >> > .\" >> > .\" $FreeBSD$ >> > .\" >> >-.Dd November 1, 2008 >> >+.Dd August 22, 2010 >> > .Dt RL 4 >> > .Os >> > .Sh NAME >> >@@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C >> > .El >> > .Sh LOADER TUNABLES >> > .Bl -tag -width indent >> >+.It Va dev.rl.%unit.prefer_iomap >> >+This tunable controls which register mapping should be used on the >> >+specified device. >> >+A non-zero value enables I/O space register mapping. >> >+For controllers that have no I/O space register mapping this tunable >> >+should be set to 0 to use memory space register mapping. >> >+The default value is 1 to use I/O space register mapping. >> > .It Va dev.rl.%unit.twister_enable >> > Non-zero value enables the long cable tuning on the specified device. >> > Disabled by default. >> >_______________________________________________ >> >svn-src-stable-8@freebsd.org mailing list >> >http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 >> >> ----- End message from yongari@FreeBSD.org ----- ----- End message from pyunyh@gmail.com ----- ======================================================================== # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # ======================================================================== ---------------------------------------------------------------- cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 05:39:56 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A645E1065672; Wed, 1 Sep 2010 05:39:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 957DF8FC12; Wed, 1 Sep 2010 05: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 o815dueI052777; Wed, 1 Sep 2010 05:39:56 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o815duMQ052775; Wed, 1 Sep 2010 05:39:56 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009010539.o815duMQ052775@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 1 Sep 2010 05:39:56 +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: r212080 - in stable/8/etc: defaults periodic/daily X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 05:39:56 -0000 Author: maxim Date: Wed Sep 1 05:39:56 2010 New Revision: 212080 URL: http://svn.freebsd.org/changeset/base/212080 Log: MFC r211801: fix typo. Modified: stable/8/etc/defaults/rc.conf Directory Properties: stable/8/etc/ (props changed) stable/8/etc/periodic/daily/ (props changed) stable/8/etc/periodic/daily/800.scrub-zfs (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Wed Sep 1 05:34:17 2010 (r212079) +++ stable/8/etc/defaults/rc.conf Wed Sep 1 05:39:56 2010 (r212080) @@ -212,7 +212,7 @@ ifconfig_lo0="inet 127.0.0.1" # default #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. #vlans_fxp0="101 vlan0" # vlan(4) interfaces for fxp0 device -#create_arg_vlan0="vlan 102" # vlan tag for vlan0 device +#create_args_vlan0="vlan 102" # vlan tag for vlan0 device #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlanddebug(8) #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 06:51:43 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 186BE10656B6; Wed, 1 Sep 2010 06:51:43 +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 077AA8FC22; Wed, 1 Sep 2010 06:51:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o816pgl2054290; Wed, 1 Sep 2010 06:51:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o816pgv2054288; Wed, 1 Sep 2010 06:51:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009010651.o816pgv2054288@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Sep 2010 06:51: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: r212082 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 06:51:43 -0000 Author: kib Date: Wed Sep 1 06:51:42 2010 New Revision: 212082 URL: http://svn.freebsd.org/changeset/base/212082 Log: MFC r211966: Use NULL instead of 0 for pointer in example. Modified: stable/8/lib/libc/sys/sigaltstack.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/sigaltstack.2 ============================================================================== --- stable/8/lib/libc/sys/sigaltstack.2 Wed Sep 1 06:43:41 2010 (r212081) +++ stable/8/lib/libc/sys/sigaltstack.2 Wed Sep 1 06:51:42 2010 (r212082) @@ -104,7 +104,7 @@ if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == /* error return */ sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; -if (sigaltstack(&sigstk,0) < 0) +if (sigaltstack(&sigstk, NULL) < 0) perror("sigaltstack"); .Ed An alternative approach is provided for programs with signal handlers From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 11:11:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EC1510656B5; Wed, 1 Sep 2010 11:11:20 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3A58FC1D; Wed, 1 Sep 2010 11:11: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 o81BBKNj062036; Wed, 1 Sep 2010 11:11:20 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81BBK53062034; Wed, 1 Sep 2010 11:11:20 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201009011111.o81BBK53062034@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 1 Sep 2010 11:11: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: r212091 - stable/8/etc/periodic/daily X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 11:11:20 -0000 Author: netchild Date: Wed Sep 1 11:11:20 2010 New Revision: 212091 URL: http://svn.freebsd.org/changeset/base/212091 Log: MFC r211800: - Change the threshold from 'running next scrub the th day after the last one' to 'running next scrub the th day after the last one'. - Improve wording. Requested by: jhell Modified: stable/8/etc/periodic/daily/800.scrub-zfs (contents, props changed) Directory Properties: stable/8/etc/periodic/daily/ (props changed) Modified: stable/8/etc/periodic/daily/800.scrub-zfs ============================================================================== --- stable/8/etc/periodic/daily/800.scrub-zfs Wed Sep 1 10:50:58 2010 (r212090) +++ stable/8/etc/periodic/daily/800.scrub-zfs Wed Sep 1 11:11:20 2010 (r212091) @@ -53,7 +53,7 @@ case "$daily_scrub_zfs_enable" in # Now minus last scrub (both in seconds) converted to days. _scrub_diff=$(expr -e \( $(date +%s) - \ $(date -j -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 / 24) - if [ ${_scrub_diff} -le ${_pool_threshold} ]; then + if [ ${_scrub_diff} -lt ${_pool_threshold} ]; then echo " skipping scrubbing of pool '${pool}':" echo " last scrubbing is ${_scrub_diff} days ago, threshold is set to ${_pool_threshold} days" continue @@ -65,11 +65,11 @@ case "$daily_scrub_zfs_enable" in echo " scrubbing of pool '${pool}' already in progress, skipping:" ;; *"none requested"*) - echo " starting first scrubbing (after reboot) of pool '${pool}':" + echo " starting first scrub (since reboot) of pool '${pool}':" zpool scrub ${pool} ;; *) - echo " starting scrubbing of pool '${pool}':" + echo " starting scrub of pool '${pool}':" zpool scrub ${pool} ;; esac From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 19:36:06 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA441065672; Wed, 1 Sep 2010 19:36:06 +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 5C6788FC16; Wed, 1 Sep 2010 19:36:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81Ja6Nm078124; Wed, 1 Sep 2010 19:36:06 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81Ja63l078122; Wed, 1 Sep 2010 19:36:06 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009011936.o81Ja63l078122@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 19:36:06 +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: r212110 - stable/8/etc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 19:36:06 -0000 Author: emaste Date: Wed Sep 1 19:36:06 2010 New Revision: 212110 URL: http://svn.freebsd.org/changeset/base/212110 Log: MFC r202988, r203022 Remove vestigial NetBSD compatibility shim. Convert to 2-clause license, from NetBSD rc.subr r1.70. Modified: stable/8/etc/rc.subr Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Wed Sep 1 19:33:40 2010 (r212109) +++ stable/8/etc/rc.subr Wed Sep 1 19:36:06 2010 (r212110) @@ -15,13 +15,6 @@ # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by the NetBSD -# Foundation, Inc. and its contributors. -# 4. Neither the name of The NetBSD Foundation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -52,22 +45,12 @@ _rc_subr_loaded="YES" SYSCTL="/sbin/sysctl" SYSCTL_N="${SYSCTL} -n" -CMD_OSTYPE="${SYSCTL_N} kern.ostype" -OSTYPE=`${CMD_OSTYPE}` +SYSCTL_W="${SYSCTL}" ID="/usr/bin/id" IDCMD="if [ -x $ID ]; then $ID -un; fi" PS="/bin/ps -ww" JID=`$PS -p $$ -o jid=` -case ${OSTYPE} in -FreeBSD) - SYSCTL_W="${SYSCTL}" - ;; -NetBSD) - SYSCTL_W="${SYSCTL} -w" - ;; -esac - # # functions # --------- From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 19:49:24 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CC7C10656BC; Wed, 1 Sep 2010 19:49:24 +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 5B7778FC14; Wed, 1 Sep 2010 19:49: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 o81JnOXQ078404; Wed, 1 Sep 2010 19:49:24 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81JnOqP078402; Wed, 1 Sep 2010 19:49:24 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009011949.o81JnOqP078402@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 1 Sep 2010 19:49:24 +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: r212111 - stable/8/bin/sh X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 19:49:24 -0000 Author: jilles Date: Wed Sep 1 19:49:24 2010 New Revision: 212111 URL: http://svn.freebsd.org/changeset/base/212111 Log: MFC r210736: sh: Do not enter consecutive duplicates into the history. This simply sets a flag in libedit. It has a shortcoming in that it does not apply to multi-line commands. Note that a configuration option for this is not going to happen, but always having this seems better than not having it. NetBSD has done the same. PR: bin/54683 Obtained from: NetBSD Modified: stable/8/bin/sh/histedit.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/histedit.c ============================================================================== --- stable/8/bin/sh/histedit.c Wed Sep 1 19:36:06 2010 (r212110) +++ stable/8/bin/sh/histedit.c Wed Sep 1 19:49:24 2010 (r212111) @@ -157,6 +157,7 @@ sethistsize(hs) (histsize = atoi(hs)) < 0) histsize = 100; history(hist, &he, H_SETSIZE, histsize); + history(hist, &he, H_SETUNIQUE, 1); } } From owner-svn-src-stable-8@FreeBSD.ORG Wed Sep 1 20:25:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E04A010656AB; Wed, 1 Sep 2010 20:25:36 +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 CEA798FC12; Wed, 1 Sep 2010 20:25: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 o81KPa1W079882; Wed, 1 Sep 2010 20:25:36 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81KPahi079880; Wed, 1 Sep 2010 20:25:36 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009012025.o81KPahi079880@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 20:25: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: r212114 - stable/8/sbin/ifconfig X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Sep 2010 20:25:37 -0000 Author: emaste Date: Wed Sep 1 20:25:36 2010 New Revision: 212114 URL: http://svn.freebsd.org/changeset/base/212114 Log: MFC r202289: Reject invalid CIDR widths rather than silently stopping at the first non-digit character. Due to an issue with rc(8) in a test configuration, ifconfig was being invoked with the address used again as the width - for example, ifconfig vlan0 10.0.0.1/10.0.0.1 Prior to this change, that address/width would be interpreted as 10.0.0.1/10. Modified: stable/8/sbin/ifconfig/af_inet.c Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/af_inet.c ============================================================================== --- stable/8/sbin/ifconfig/af_inet.c Wed Sep 1 19:53:15 2010 (r212113) +++ stable/8/sbin/ifconfig/af_inet.c Wed Sep 1 20:25:36 2010 (r212114) @@ -37,6 +37,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -110,15 +111,18 @@ in_getaddr(const char *s, int which) char *p = NULL; if((p = strrchr(s, '/')) != NULL) { + const char *errstr; /* address is `name/masklen' */ int masklen; - int ret; struct sockaddr_in *min = sintab[MASK]; *p = '\0'; - ret = sscanf(p+1, "%u", &masklen); - if(ret != 1 || (masklen < 0 || masklen > 32)) { + if (!isdigit(*(p + 1))) + errstr = "invalid"; + else + masklen = (int)strtonum(p + 1, 0, 32, &errstr); + if (errstr != NULL) { *p = '/'; - errx(1, "%s: bad value", s); + errx(1, "%s: bad value (width %s)", s, errstr); } min->sin_len = sizeof(*min); min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 04:56:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A64C610656C4; Thu, 2 Sep 2010 04:56:01 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9580A8FC20; Thu, 2 Sep 2010 04:56: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 o824u1IH092519; Thu, 2 Sep 2010 04:56:01 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o824u1gG092517; Thu, 2 Sep 2010 04:56:01 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009020456.o824u1gG092517@svn.freebsd.org> From: Brian Somers Date: Thu, 2 Sep 2010 04:56: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: r212137 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 04:56:01 -0000 Author: brian Date: Thu Sep 2 04:56:01 2010 New Revision: 212137 URL: http://svn.freebsd.org/changeset/base/212137 Log: MFC r211684 & r211818; return ENOENT if we fall off the end of the directory. Modified: stable/8/sys/kern/vfs_default.c Directory Properties: 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) Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Thu Sep 2 04:39:45 2010 (r212136) +++ stable/8/sys/kern/vfs_default.c Thu Sep 2 04:56:01 2010 (r212137) @@ -284,6 +284,9 @@ get_next_dirent(struct vnode *vp, struct *cpos = dirbuf; *len = (dirbuflen - uio.uio_resid); + + if (*len == 0) + return (ENOENT); } dp = (struct dirent *)(*cpos); From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 06:07:03 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FD4C106566C; Thu, 2 Sep 2010 06:07:03 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA9B8FC1A; Thu, 2 Sep 2010 06:07: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 o82673Hh094181; Thu, 2 Sep 2010 06:07:03 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82673fA094178; Thu, 2 Sep 2010 06:07:03 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009020607.o82673fA094178@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 2 Sep 2010 06:07: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: r212139 - stable/8/sbin/kldload X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 06:07:03 -0000 Author: maxim Date: Thu Sep 2 06:07:03 2010 New Revision: 212139 URL: http://svn.freebsd.org/changeset/base/212139 Log: MFC r209970,209971,211990: add -q flag to usage() and man page synopsys. Modified: stable/8/sbin/kldload/kldload.8 stable/8/sbin/kldload/kldload.c Directory Properties: stable/8/sbin/kldload/ (props changed) Modified: stable/8/sbin/kldload/kldload.8 ============================================================================== --- stable/8/sbin/kldload/kldload.8 Thu Sep 2 05:07:34 2010 (r212138) +++ stable/8/sbin/kldload/kldload.8 Thu Sep 2 06:07:03 2010 (r212139) @@ -33,7 +33,7 @@ .Nd load a file into the kernel .Sh SYNOPSIS .Nm -.Op Fl v +.Op Fl qv .Ar .Sh DESCRIPTION The @@ -60,7 +60,7 @@ The utility will warn if a module is requested as a bare filename and is present in the current directory. .Pp -The following option is available: +The following options are available: .Bl -tag -width indent .It Fl v Be more verbose. Modified: stable/8/sbin/kldload/kldload.c ============================================================================== --- stable/8/sbin/kldload/kldload.c Thu Sep 2 05:07:34 2010 (r212138) +++ stable/8/sbin/kldload/kldload.c Thu Sep 2 06:07:03 2010 (r212139) @@ -129,7 +129,7 @@ path_check(const char *kldname, int quie static void usage(void) { - fprintf(stderr, "usage: kldload [-v] file ...\n"); + fprintf(stderr, "usage: kldload [-qv] file ...\n"); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 06:49:28 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07CCA1065702; Thu, 2 Sep 2010 06:49:28 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB18D8FC15; Thu, 2 Sep 2010 06:49: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 o826nRph094989; Thu, 2 Sep 2010 06:49:27 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o826nRLa094987; Thu, 2 Sep 2010 06:49:27 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201009020649.o826nRLa094987@svn.freebsd.org> From: Hajimu UMEMOTO Date: Thu, 2 Sep 2010 06:49: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: r212140 - stable/8/etc/rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 06:49:28 -0000 Author: ume Date: Thu Sep 2 06:49:27 2010 New Revision: 212140 URL: http://svn.freebsd.org/changeset/base/212140 Log: We don't have etc/rc.d/ip6fw anymore. Since HEAD doesn't have etc/rc.d/network_ipv6, this commit is directly into RELENG_8. Spotted by: takachan__at__running-dog.net Modified: stable/8/etc/rc.d/network_ipv6 Modified: stable/8/etc/rc.d/network_ipv6 ============================================================================== --- stable/8/etc/rc.d/network_ipv6 Thu Sep 2 06:07:03 2010 (r212139) +++ stable/8/etc/rc.d/network_ipv6 Thu Sep 2 06:49:27 2010 (r212140) @@ -29,7 +29,7 @@ # # PROVIDE: network_ipv6 -# REQUIRE: routing ip6fw +# REQUIRE: routing # KEYWORD: nojail . /etc/rc.subr From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 07:49:46 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F30010656A6; Thu, 2 Sep 2010 07:49:46 +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 2DEEF8FC0A; Thu, 2 Sep 2010 07:49: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 o827nkX8096227; Thu, 2 Sep 2010 07:49:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o827nk7m096225; Thu, 2 Sep 2010 07:49:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009020749.o827nk7m096225@svn.freebsd.org> From: Ed Schouten Date: Thu, 2 Sep 2010 07:49:46 +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: r212141 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 07:49:46 -0000 Author: ed Date: Thu Sep 2 07:49:45 2010 New Revision: 212141 URL: http://svn.freebsd.org/changeset/base/212141 Log: MFC r211633: Add missing mlink for insmntque1(). Modified: stable/8/share/man/man9/Makefile Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Thu Sep 2 06:49:27 2010 (r212140) +++ stable/8/share/man/man9/Makefile Thu Sep 2 07:49:45 2010 (r212141) @@ -699,6 +699,7 @@ MLINKS+=ieee80211_vap.9 ieee80211_vap_se MLINKS+=ifnet.9 ifaddr.9 \ ifnet.9 if_data.9 \ ifnet.9 ifqueue.9 +MLINKS+=insmntque.9 insmntque1.9 MLINKS+=ithread.9 ithread_add_handler.9 \ ithread.9 ithread_create.9 \ ithread.9 ithread_destroy.9 \ From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 13:34:54 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EDC91065704; Thu, 2 Sep 2010 13:34:54 +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 7DBFA8FC1A; Thu, 2 Sep 2010 13:34: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 o82DYs0V006130; Thu, 2 Sep 2010 13:34:54 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82DYs8e006128; Thu, 2 Sep 2010 13:34:54 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009021334.o82DYs8e006128@svn.freebsd.org> From: Ed Maste Date: Thu, 2 Sep 2010 13:34: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: r212147 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 13:34:54 -0000 Author: emaste Date: Thu Sep 2 13:34:54 2010 New Revision: 212147 URL: http://svn.freebsd.org/changeset/base/212147 Log: MFC r199972: Use switch out (SWO) instead of switch in (SWI) debug log mask in csw_out. Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: 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) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_mod.c Thu Sep 2 12:32:29 2010 (r212146) +++ stable/8/sys/dev/hwpmc/hwpmc_mod.c Thu Sep 2 13:34:54 2010 (r212147) @@ -1408,7 +1408,7 @@ pmc_process_csw_out(struct thread *td) tmp = newvalue - PMC_PCPU_SAVED(cpu,ri); - PMCDBG(CSW,SWI,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, + PMCDBG(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, tmp); if (mode == PMC_MODE_TS) { From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 16:09:09 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA9D01065789; Thu, 2 Sep 2010 16:09:09 +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 A97B48FC18; Thu, 2 Sep 2010 16:09: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 o82G99FK010407; Thu, 2 Sep 2010 16:09:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82G99b5010405; Thu, 2 Sep 2010 16:09:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009021609.o82G99b5010405@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Sep 2010 16:09:09 +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: r212150 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 16:09:09 -0000 Author: bz Date: Thu Sep 2 16:09:09 2010 New Revision: 212150 URL: http://svn.freebsd.org/changeset/base/212150 Log: MFC r211904: MFp4 CH=182972: Add explicit linkstate UP/DOWN for the epair. This is needed by carp(4) and other things to work. Modified: stable/8/sys/net/if_epair.c Directory Properties: 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) Modified: stable/8/sys/net/if_epair.c ============================================================================== --- stable/8/sys/net/if_epair.c Thu Sep 2 14:13:43 2010 (r212149) +++ stable/8/sys/net/if_epair.c Thu Sep 2 16:09:09 2010 (r212150) @@ -841,6 +841,8 @@ epair_clone_create(struct if_clone *ifc, /* Tell the world, that we are ready to rock. */ sca->ifp->if_drv_flags |= IFF_DRV_RUNNING; scb->ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(sca->ifp, LINK_STATE_UP); + if_link_state_change(scb->ifp, LINK_STATE_UP); return (0); } @@ -868,6 +870,8 @@ epair_clone_destroy(struct if_clone *ifc scb = oifp->if_softc; DPRINTF("ifp=%p oifp=%p\n", ifp, oifp); + if_link_state_change(ifp, LINK_STATE_DOWN); + if_link_state_change(oifp, LINK_STATE_DOWN); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; oifp->if_drv_flags &= ~IFF_DRV_RUNNING; ether_ifdetach(oifp); From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 2 21:52:43 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA6C11065716; Thu, 2 Sep 2010 21:52:43 +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 B7D778FC0A; Thu, 2 Sep 2010 21:52:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82LqhMq021677; Thu, 2 Sep 2010 21:52:43 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82LqhNZ021675; Thu, 2 Sep 2010 21:52:43 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009022152.o82LqhNZ021675@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 2 Sep 2010 21:52:43 +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: r212164 - stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Sep 2010 21:52:43 -0000 Author: edwin Date: Thu Sep 2 21:52:43 2010 New Revision: 212164 URL: http://svn.freebsd.org/changeset/base/212164 Log: Add nameday for Monique PR: conf/150049 Submitted by: Thierry Thomas Modified: stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes ============================================================================== --- stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:48:35 2010 (r212163) +++ stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:52:43 2010 (r212164) @@ -382,7 +382,7 @@ LANG=fr_FR.ISO8859-1 08/26 Bonne fête aux Zéphirin ! 08/26 Aujourd'hui, c'est la St(e) Eulade. 08/27 N'oubliez pas les Edwige ! -08/27 Bonne fête aux Joseph ! +08/27 Bonne fête aux Monique et aux Joseph ! 08/28 Aujourd'hui, c'est la St(e) Augustin. 08/29 N'oubliez pas les Sabine ! 08/30 Bonne fête aux Fiacre ! From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 06:30:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0C3E1065882; Fri, 3 Sep 2010 06:30:12 +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 439998FC1F; Fri, 3 Sep 2010 06:30:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o836UCvr035855; Fri, 3 Sep 2010 06:30:12 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o836UCOG035853; Fri, 3 Sep 2010 06:30:12 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009030630.o836UCOG035853@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 3 Sep 2010 06:30:12 +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: r212171 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 06:30:12 -0000 Author: jh Date: Fri Sep 3 06:30:11 2010 New Revision: 212171 URL: http://svn.freebsd.org/changeset/base/212171 Log: MFC r209256, r209549, r209816, r209844: - Fix compilation of the subr_unit.c user space test program. - Use %zu for size_t in a few format strings. - Correct a comment typo. - Assert that low and high are >= 0 in new_unrhdr(). Modified: stable/8/sys/kern/subr_unit.c Directory Properties: 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) Modified: stable/8/sys/kern/subr_unit.c ============================================================================== --- stable/8/sys/kern/subr_unit.c Fri Sep 3 03:56:09 2010 (r212170) +++ stable/8/sys/kern/subr_unit.c Fri Sep 3 06:30:11 2010 (r212171) @@ -153,6 +153,7 @@ mtx_assert(struct mtx *mp, int flag) } #define CTASSERT(foo) +#define WITNESS_WARN(flags, lock, fmt, ...) (void)0 #endif /* USERLAND */ @@ -317,7 +318,7 @@ clean_unrhdr(struct unrhdr *uh) /* * Allocate a new unrheader set. * - * Highest and lowest valid values given as paramters. + * Highest and lowest valid values given as parameters. */ struct unrhdr * @@ -325,8 +326,8 @@ new_unrhdr(int low, int high, struct mtx { struct unrhdr *uh; - KASSERT(low <= high, - ("UNR: use error: new_unrhdr(%u, %u)", low, high)); + KASSERT(low >= 0 && low <= high, + ("UNR: use error: new_unrhdr(%d, %d)", low, high)); uh = Malloc(sizeof *uh); if (mutex != NULL) uh->mtx = mutex; @@ -825,9 +826,9 @@ main(int argc __unused, const char **arg memset(a, 0, sizeof a); - fprintf(stderr, "sizeof(struct unr) %d\n", sizeof (struct unr)); - fprintf(stderr, "sizeof(struct unrb) %d\n", sizeof (struct unrb)); - fprintf(stderr, "sizeof(struct unrhdr) %d\n", sizeof (struct unrhdr)); + fprintf(stderr, "sizeof(struct unr) %zu\n", sizeof(struct unr)); + fprintf(stderr, "sizeof(struct unrb) %zu\n", sizeof(struct unrb)); + fprintf(stderr, "sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr)); fprintf(stderr, "NBITS %d\n", NBITS); x = 1; for (m = 0; m < NN * 100; m++) { From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 11:58:51 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14C2D10656FA; Fri, 3 Sep 2010 11:58:51 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCC1F8FC0C; Fri, 3 Sep 2010 11:58: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 o83BwoYb047773; Fri, 3 Sep 2010 11:58:50 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83Bwowt047771; Fri, 3 Sep 2010 11:58:50 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201009031158.o83Bwowt047771@svn.freebsd.org> From: Ulrich Spoerlein Date: Fri, 3 Sep 2010 11:58: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: r212175 - stable/8/sbin/geom/class/sched X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 11:58:51 -0000 Author: uqs Date: Fri Sep 3 11:58:50 2010 New Revision: 212175 URL: http://svn.freebsd.org/changeset/base/212175 Log: MFC r211962: gsched(8): fix example usage, mdoc nits - ad0 was referred to as da0 - wrong parameter -s instead of -a in example - use double quotes consistently Modified: stable/8/sbin/geom/class/sched/gsched.8 (contents, props changed) Directory Properties: stable/8/sbin/geom/ (props changed) Modified: stable/8/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/8/sbin/geom/class/sched/gsched.8 Fri Sep 3 10:40:53 2010 (r212174) +++ stable/8/sbin/geom/class/sched/gsched.8 Fri Sep 3 11:58:50 2010 (r212175) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 12, 2010 +.Dd August 29, 2010 .Dt GSCHED 8 .Os .Sh NAME @@ -92,7 +92,7 @@ which in turn forwards requests to the e This operation allows one to start/stop a scheduling service on an already existing provider. .Pp -A subsequent 'destroy' will remove the newly created geom and +A subsequent "destroy" will remove the newly created geom and hook the provider back to the original geom. .It Cm configure Configure existing scheduling provider. It supports the same options @@ -135,16 +135,16 @@ maximum amount of debug information is p Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES The following example shows how to create a scheduling provider for disk -.Pa /dev/da0 -, and how to destroy it. +.Pa /dev/ad0 , +and how to destroy it. .Bd -literal -offset indent # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: kldload gsched_rr gsched_as -# Configure device ad0 to use scheduler 'rr': -geom sched insert -s rr ad0 -# Now provider ad0 uses the 'rr' algorithm; +# Configure device ad0 to use scheduler "rr": +geom sched insert -a rr ad0 +# Now provider ad0 uses the "rr" algorithm; # the new geom is ad0.sched. # Remove the scheduler on the device: geom sched destroy -v ad0.sched. From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 15:33:16 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A88D1065767; Fri, 3 Sep 2010 15:33:16 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 094318FC0A; Fri, 3 Sep 2010 15:33: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 o83FXFZn053343; Fri, 3 Sep 2010 15:33:15 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83FXF73053341; Fri, 3 Sep 2010 15:33:15 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201009031533.o83FXF73053341@svn.freebsd.org> From: Jamie Gritton Date: Fri, 3 Sep 2010 15:33: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: r212178 - stable/8/lib/libjail X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 15:33:16 -0000 Author: jamie Date: Fri Sep 3 15:33:15 2010 New Revision: 212178 URL: http://svn.freebsd.org/changeset/base/212178 Log: MFC r212072: Make it clear in the example that jailparam_export's return value should be freed. Modified: stable/8/lib/libjail/jail.3 Modified: stable/8/lib/libjail/jail.3 ============================================================================== --- stable/8/lib/libjail/jail.3 Fri Sep 3 14:25:17 2010 (r212177) +++ stable/8/lib/libjail/jail.3 Fri Sep 3 15:33:15 2010 (r212178) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2009 +.Dd August 31, 2010 .Dt JAIL 3 .Os .Sh NAME @@ -208,6 +208,8 @@ jailparam_init(¶ms[1], "host.hostnam jailparam_get(params, 2, 0); hostname = jailparam_export(¶ms[1]); jailparam_free(params, 2); +... +free(hostname); .Ed .Sh RETURN VALUES The From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 15:34:29 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 599F6106570D; Fri, 3 Sep 2010 15:34:29 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DFB68FC28; Fri, 3 Sep 2010 15:34: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 o83FYTb6053405; Fri, 3 Sep 2010 15:34:29 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83FYTCx053403; Fri, 3 Sep 2010 15:34:29 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201009031534.o83FYTCx053403@svn.freebsd.org> From: Jamie Gritton Date: Fri, 3 Sep 2010 15:34: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: r212179 - stable/8/lib/libjail X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 15:34:29 -0000 Author: jamie Date: Fri Sep 3 15:34:28 2010 New Revision: 212179 URL: http://svn.freebsd.org/changeset/base/212179 Log: MFC 212073: Don't over-allocate array values in jailparam_export. MFC 212074: Whitespace and comment fixes. Modified: stable/8/lib/libjail/jail.c Directory Properties: stable/8/lib/libjail/ (props changed) Modified: stable/8/lib/libjail/jail.c ============================================================================== --- stable/8/lib/libjail/jail.c Fri Sep 3 15:33:15 2010 (r212178) +++ stable/8/lib/libjail/jail.c Fri Sep 3 15:34:28 2010 (r212179) @@ -719,6 +719,7 @@ jailparam_get(struct jailparam *jp, unsi char * jailparam_export(struct jailparam *jp) { + size_t *valuelens; char *value, *tvalue, **values; size_t valuelen; int i, nval, ival; @@ -740,6 +741,7 @@ jailparam_export(struct jailparam *jp) return (value); } values = alloca(nval * sizeof(char *)); + valuelens = alloca(nval * sizeof(size_t)); valuelen = 0; for (i = 0; i < nval; i++) { switch (jp->jp_ctltype & CTLTYPE) { @@ -784,7 +786,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -794,7 +795,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -809,11 +809,12 @@ jailparam_export(struct jailparam *jp) errno = ENOENT; return (NULL); } - valuelen += strlen(valbuf) + 1; - values[i] = alloca(valuelen); + valuelens[i] = strlen(valbuf) + 1; + valuelen += valuelens[i]; + values[i] = alloca(valuelens[i]); strcpy(values[i], valbuf); } - value = malloc(valuelen + 1); + value = malloc(valuelen); if (value == NULL) strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); else { @@ -821,8 +822,8 @@ jailparam_export(struct jailparam *jp) for (i = 0; i < nval; i++) { strcpy(tvalue, values[i]); if (i < nval - 1) { - tvalue += strlen(values[i]); - *tvalue++ = ','; + tvalue += valuelens[i]; + tvalue[-1] = ','; } } } @@ -830,7 +831,7 @@ jailparam_export(struct jailparam *jp) } /* - * Free the contents of a jail parameter list (but not thst list itself). + * Free the contents of a jail parameter list (but not the list itself). */ void jailparam_free(struct jailparam *jp, unsigned njp) @@ -891,7 +892,7 @@ jailparam_type(struct jailparam *jp) mib[1] = 4; desclen = sizeof(desc); if (sysctl(mib, (miblen / sizeof(int)) + 2, - &desc, &desclen, NULL, 0) < 0) { + &desc, &desclen, NULL, 0) < 0) { snprintf(jail_errmsg, JAIL_ERRMSGLEN, "sysctl(0.4.%s): %s", desc.s, @@ -931,7 +932,7 @@ jailparam_type(struct jailparam *jp) isarray = 1; p[-2] = 0; } - /* Look for types we understand */ + /* Look for types we understand. */ jp->jp_ctltype = desc.i; switch (desc.i & CTLTYPE) { case CTLTYPE_INT: From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 21:51:39 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A56F10656AC; Fri, 3 Sep 2010 21:51:39 +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 06B008FC19; Fri, 3 Sep 2010 21:51: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 o83Lpcf7065179; Fri, 3 Sep 2010 21:51:38 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LpcAS065169; Fri, 3 Sep 2010 21:51:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032151.o83LpcAS065169@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 21:51: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: r212188 - in stable/8/tools/regression/bin/sh: builtins expansion X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 21:51:39 -0000 Author: jilles Date: Fri Sep 3 21:51:38 2010 New Revision: 212188 URL: http://svn.freebsd.org/changeset/base/212188 Log: MFC r208476,208629,210738,211080,211341,211467: New tests that also work with stable/8 sh. Added: stable/8/tools/regression/bin/sh/builtins/break2.0 - copied unchanged from r211467, head/tools/regression/bin/sh/builtins/break2.0 stable/8/tools/regression/bin/sh/builtins/break2.0.stdout - copied unchanged from r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout stable/8/tools/regression/bin/sh/builtins/dot1.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/dot1.0 stable/8/tools/regression/bin/sh/builtins/eval4.0 - copied unchanged from r210738, head/tools/regression/bin/sh/builtins/eval4.0 stable/8/tools/regression/bin/sh/builtins/exec1.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/exec1.0 stable/8/tools/regression/bin/sh/builtins/return4.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/return4.0 stable/8/tools/regression/bin/sh/builtins/wait1.0 - copied unchanged from r208476, head/tools/regression/bin/sh/builtins/wait1.0 stable/8/tools/regression/bin/sh/builtins/wait2.0 - copied unchanged from r208476, head/tools/regression/bin/sh/builtins/wait2.0 stable/8/tools/regression/bin/sh/expansion/ifs2.0 - copied unchanged from r211341, head/tools/regression/bin/sh/expansion/ifs2.0 stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 - copied unchanged from r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/break2.0 (from r211467, head/tools/regression/bin/sh/builtins/break2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/break2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211467, head/tools/regression/bin/sh/builtins/break2.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +# It is not immediately obvious that this should work, and someone probably +# relies on it. + +while :; do + trap 'break' USR1 + kill -USR1 $$ + echo bad + exit 1 +done +echo good Copied: stable/8/tools/regression/bin/sh/builtins/break2.0.stdout (from r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/break2.0.stdout Fri Sep 3 21:51:38 2010 (r212188, copy of r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout) @@ -0,0 +1 @@ +good Copied: stable/8/tools/regression/bin/sh/builtins/dot1.0 (from r208629, head/tools/regression/bin/sh/builtins/dot1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/dot1.0) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit +trap 'rm -rf $T' 0 +cd $T || exit 3 +unset x +echo 'x=2' >testscript +. ./testscript +[ "$x" = 2 ] || failure $LINENO +cd / || exit 3 +x=1 +PATH=$T:$PATH . testscript +[ "$x" = 2 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/eval4.0 (from r210738, head/tools/regression/bin/sh/builtins/eval4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/eval4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r210738, head/tools/regression/bin/sh/builtins/eval4.0) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# eval should preserve $? from command substitutions when starting +# the parsed command. +[ $(eval 'echo $?' $(false)) = 1 ] Copied: stable/8/tools/regression/bin/sh/builtins/exec1.0 (from r208629, head/tools/regression/bin/sh/builtins/exec1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/exec1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/exec1.0) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +( + exec >/dev/null + echo bad +) +[ $? = 0 ] || failure $LINENO +( + exec sh -c 'exit 42' + echo bad +) +[ $? = 42 ] || failure $LINENO +( + exec /var/empty/nosuch + echo bad +) 2>/dev/null +[ $? = 127 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/return4.0 (from r208629, head/tools/regression/bin/sh/builtins/return4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/return4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/return4.0) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit +trap 'rm -rf $T' 0 +cd $T || exit 3 +echo 'return 42; exit 4' >testscript +. ./testscript +[ "$?" = 42 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/wait1.0 (from r208476, head/tools/regression/bin/sh/builtins/wait1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/wait1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208476, head/tools/regression/bin/sh/builtins/wait1.0) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +exit 4 & p4=$! +exit 8 & p8=$! +wait $p4 +[ $? = 4 ] || failure $LINENO +wait $p8 +[ $? = 8 ] || failure $LINENO + +exit 3 & p3=$! +exit 7 & p7=$! +wait $p7 +[ $? = 7 ] || failure $LINENO +wait $p3 +[ $? = 3 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/wait2.0 (from r208476, head/tools/regression/bin/sh/builtins/wait2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/wait2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208476, head/tools/regression/bin/sh/builtins/wait2.0) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +for i in 1 2 3 4 5 6 7 8 9 10; do + exit $i & +done +wait || failure $LINENO +wait || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/expansion/ifs2.0 (from r211341, head/tools/regression/bin/sh/expansion/ifs2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/ifs2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211341, head/tools/regression/bin/sh/expansion/ifs2.0) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +failures=0 +i=1 +set -f +while [ "$i" -le 127 ]; do + # A different byte still in the range 1..127. + i2=$((i^2+(i==2))) + # Add a character to work around command substitution's removal of + # final newlines, then remove it again. + c=$(printf \\"$(printf %o@ "$i")") + c=${c%@} + c2=$(printf \\"$(printf %o@ "$i2")") + c2=${c2%@} + IFS=$c + set -- $c2$c$c2$c$c2 + if [ "$#" -ne 3 ] || [ "$1" != "$c2" ] || [ "$2" != "$c2" ] || + [ "$3" != "$c2" ]; then + echo "Bad results for separator $i (word $i2)" >&2 + : $((failures += 1)) + fi + i=$((i+1)) +done +exit $((failures > 0)) Copied: stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 (from r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0) @@ -0,0 +1,38 @@ +# $FreeBSD$ + +# These may be a bit unclear in the POSIX spec or the proposed revisions, +# and conflict with bash's interpretation, but I think ksh93's interpretation +# makes most sense. In particular, it makes no sense to me that single-quotes +# must match but are not removed. + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- ${e:-'"'"'}'"'"'}' '1|}' +testcase "set -- \${e:-\\'}" "1|'" +testcase "set -- \${e:-\\'\\'}" "1|''" +testcase "set -- \"\${e:-'}\"" "1|'" +testcase "set -- \"\${e:-'}'}\"" "1|''}" +testcase "set -- \"\${e:-''}\"" "1|''" +testcase 'set -- ${e:-\a}' '1|a' +testcase 'set -- "${e:-\a}"' '1|\a' + +test "x$failures" = x From owner-svn-src-stable-8@FreeBSD.ORG Fri Sep 3 21:59:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61FAF10656CB; Fri, 3 Sep 2010 21:59:12 +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 5053F8FC1A; Fri, 3 Sep 2010 21:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83LxCTQ065436; Fri, 3 Sep 2010 21:59:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LxCpt065434; Fri, 3 Sep 2010 21:59:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032159.o83LxCpt065434@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 21:59:12 +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: r212189 - stable/8/tools/regression/bin/sh/expansion X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2010 21:59:12 -0000 Author: jilles Date: Fri Sep 3 21:59:12 2010 New Revision: 212189 URL: http://svn.freebsd.org/changeset/base/212189 Log: MFC r209652: sh: Remove comment that the comma operator is missing in arithmetic expansion. The comma operator is not listed in POSIX.1-2008 XCU 1.1.2.1 Arithmetic Precision and Operations (referenced by XCU 2.6.4 Arithmetic Expansion) and is therefore not required. Modified: stable/8/tools/regression/bin/sh/expansion/arith2.0 Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/tools/regression/bin/sh/expansion/arith2.0 ============================================================================== --- stable/8/tools/regression/bin/sh/expansion/arith2.0 Fri Sep 3 21:51:38 2010 (r212188) +++ stable/8/tools/regression/bin/sh/expansion/arith2.0 Fri Sep 3 21:59:12 2010 (r212189) @@ -72,6 +72,6 @@ check "v" 10 check "(v=42)&&(v|=32)==42" 1 check "v" 42 -# missing: ternary, comma +# missing: ternary exit $((failures != 0)) From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 06:05:57 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B454910656BE; Sat, 4 Sep 2010 06:05:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1D8D8FC14; Sat, 4 Sep 2010 06:05: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 o8465vXS079531; Sat, 4 Sep 2010 06:05:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8465v79079528; Sat, 4 Sep 2010 06:05:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009040605.o8465v79079528@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Sep 2010 06:05: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: r212192 - in stable/8/sys/dev/ata: . chipsets X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 06:05:57 -0000 Author: mav Date: Sat Sep 4 06:05:57 2010 New Revision: 212192 URL: http://svn.freebsd.org/changeset/base/212192 Log: MFC r211920: Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers. Modified: stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c Directory Properties: 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) Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Fri Sep 3 22:24:26 2010 (r212191) +++ stable/8/sys/dev/ata/ata-pci.h Sat Sep 4 06:05:57 2010 (r212192) @@ -204,6 +204,29 @@ struct ata_pci_controller { #define ATA_I82801JI_AH 0x3a228086 #define ATA_I82801JI_R1 0x3a258086 #define ATA_I82801JI_S2 0x3a268086 + +#define ATA_5Series_S1 0x3b208086 +#define ATA_5Series_S2 0x3b218086 +#define ATA_5Series_AH1 0x3b228086 +#define ATA_5Series_AH2 0x3b238086 +#define ATA_5Series_R1 0x3b258086 +#define ATA_5Series_S3 0x3b268086 +#define ATA_5Series_S4 0x3b288086 +#define ATA_5Series_AH3 0x3b298086 +#define ATA_5Series_R2 0x3b2c8086 +#define ATA_5Series_S5 0x3b2d8086 +#define ATA_5Series_S6 0x3b2e8086 +#define ATA_5Series_AH4 0x3b2f8086 + +#define ATA_CPT_S1 0x1c008086 +#define ATA_CPT_S2 0x1c018086 +#define ATA_CPT_AH1 0x1c028086 +#define ATA_CPT_AH2 0x1c038086 +#define ATA_CPT_R1 0x1c048086 +#define ATA_CPT_R2 0x1c058086 +#define ATA_CPT_S3 0x1c088086 +#define ATA_CPT_S4 0x1c098086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Fri Sep 3 22:24:26 2010 (r212191) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Sat Sep 4 06:05:57 2010 (r212192) @@ -140,22 +140,26 @@ ata_intel_probe(device_t dev) { ATA_I82801JI_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { 0x3b208086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b218086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b228086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b238086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b248086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b258086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b268086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b278086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b288086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b298086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2a8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2b8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2c8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2d8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2e8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2f8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, + { ATA_5Series_S1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_R1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_R2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S5, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S6, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_CPT_S1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S3, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S4, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { 0, 0, 0, 0, 0, 0}}; From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 06:09:09 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6830E10656B9; Sat, 4 Sep 2010 06:09: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 3C4AE8FC08; Sat, 4 Sep 2010 06:09: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 o84699AM079712; Sat, 4 Sep 2010 06:09:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84699VX079710; Sat, 4 Sep 2010 06:09:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009040609.o84699VX079710@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Sep 2010 06:09:09 +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: r212193 - stable/8/sys/dev/ahci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 06:09:09 -0000 Author: mav Date: Sat Sep 4 06:09:08 2010 New Revision: 212193 URL: http://svn.freebsd.org/changeset/base/212193 Log: MFC r211922: Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: 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) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat Sep 4 06:05:57 2010 (r212192) +++ stable/8/sys/dev/ahci/ahci.c Sat Sep 4 06:09:08 2010 (r212193) @@ -151,14 +151,16 @@ static struct { {0x3a058086, 0x00, "Intel ICH10", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, {0x3a258086, 0x00, "Intel ICH10", 0}, - {0x3b228086, 0x00, "Intel PCH", 0}, - {0x3b238086, 0x00, "Intel PCH", 0}, - {0x3b248086, 0x00, "Intel PCH", 0}, - {0x3b258086, 0x00, "Intel PCH", 0}, - {0x3b298086, 0x00, "Intel PCH", 0}, - {0x3b2b8086, 0x00, "Intel PCH", 0}, - {0x3b2c8086, 0x00, "Intel PCH", 0}, - {0x3b2f8086, 0x00, "Intel PCH", 0}, + {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b258086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x1c028086, 0x00, "Intel Cougar Point", 0}, + {0x1c038086, 0x00, "Intel Cougar Point", 0}, + {0x1c048086, 0x00, "Intel Cougar Point", 0}, + {0x1c058086, 0x00, "Intel Cougar Point", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 06:36:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D20AE1065672; Sat, 4 Sep 2010 06:36:12 +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 C0AEB8FC0C; Sat, 4 Sep 2010 06:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o846aCZa080450; Sat, 4 Sep 2010 06:36:12 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o846aCXS080448; Sat, 4 Sep 2010 06:36:12 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009040636.o846aCXS080448@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 4 Sep 2010 06:36:12 +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: r212194 - stable/8/sys/fs/devfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 06:36:12 -0000 Author: jh Date: Sat Sep 4 06:36:12 2010 New Revision: 212194 URL: http://svn.freebsd.org/changeset/base/212194 Log: MFC r211513: Call dev_rel() in error paths. Modified: stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: 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) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sat Sep 4 06:09:08 2010 (r212193) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sat Sep 4 06:36:12 2010 (r212194) @@ -825,6 +825,8 @@ devfs_lookupx(struct vop_lookup_args *ap *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + if (cdev != NULL) + dev_rel(cdev); return (ENOENT); } if (cdev == NULL) @@ -836,6 +838,7 @@ devfs_lookupx(struct vop_lookup_args *ap *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + dev_rel(cdev); return (ENOENT); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 11:50:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E531F106567A; Sat, 4 Sep 2010 11:50:17 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3AD18FC16; Sat, 4 Sep 2010 11:50: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 o84BoH0D003768; Sat, 4 Sep 2010 11:50:17 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84BoHaD003766; Sat, 4 Sep 2010 11:50:17 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041150.o84BoHaD003766@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 11:50: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: r212196 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 11:50:18 -0000 Author: kaiw Date: Sat Sep 4 11:50:17 2010 New Revision: 212196 URL: http://svn.freebsd.org/changeset/base/212196 Log: MFC r210321: Remove a superfluous comment. Modified: stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 08:42:19 2010 (r212195) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 11:50:17 2010 (r212196) @@ -297,7 +297,6 @@ _libelf_resync_sections(Elf *e, off_t rc else sh_type = s->s_shdr.s_shdr64.sh_type; - /* XXX Do we need the 'size' field of an SHT_NOBITS section */ if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 12:06:02 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8406910656B1; Sat, 4 Sep 2010 12:06:02 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7110B8FC14; Sat, 4 Sep 2010 12:06: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 o84C62OF004954; Sat, 4 Sep 2010 12:06:02 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84C62Tn004950; Sat, 4 Sep 2010 12:06:02 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041206.o84C62Tn004950@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:06: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: r212198 - in stable/8: cddl/contrib/opensolaris/tools/ctf/cvt lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 12:06:02 -0000 Author: kaiw Date: Sat Sep 4 12:06:02 2010 New Revision: 212198 URL: http://svn.freebsd.org/changeset/base/212198 Log: MFC r210324, r210438. r210324: - Correctly handle sections of type SHT_NOBITS. For these sections: - elf_getdata() and elf_rawdata() should return an "Elf_Data" structure that has its "d_buf" member set to NULL and "d_size" member set to the nominal 'size' of the section. - Update the manual page for these functions. - Fix a memory leak in an error handling path inside elf_getdata(). - Use _libelf_allocate_data() in elf_newdata() for consistency. r210438: (np) Catch up with r210324. d_buf will be NULL for SHT_NOBITS sections, do not attempt to copy from it in that case. Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c stable/8/lib/libelf/elf_data.c stable/8/lib/libelf/elf_getdata.3 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/lib/libelf/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 12:06:02 2010 (r212198) @@ -644,7 +644,7 @@ write_file(Elf *src, const char *srcname } #if !defined(sun) - if (ddata->d_buf == NULL) { + if (ddata->d_buf == NULL && sdata->d_buf != NULL) { ddata->d_buf = xmalloc(shdr.sh_size); bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size); } Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/lib/libelf/elf_data.c Sat Sep 4 12:06:02 2010 (r212198) @@ -39,7 +39,6 @@ Elf_Data * elf_getdata(Elf_Scn *s, Elf_Data *d) { Elf *e; - char *dst; size_t fsz, msz, count; int elfclass, elftype; unsigned int sh_type; @@ -79,20 +78,22 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || - elftype > ELF_T_LAST || - sh_offset + sh_size > (uint64_t) e->e_rawsize) { + elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && + sh_offset + sh_size > (uint64_t) e->e_rawsize)) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } - if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize)(elftype, - (size_t) 1, e->e_version)) == 0) { + if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize) + (elftype, (size_t) 1, e->e_version)) == 0) { LIBELF_SET_ERROR(UNIMPL, 0); return (NULL); } - if (sh_size % fsz) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); @@ -104,21 +105,25 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) assert(msz > 0); - if ((dst = malloc(msz*count)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = dst; + d->d_buf = NULL; d->d_off = 0; d->d_align = sh_align; d->d_size = msz * count; d->d_type = elftype; d->d_version = e->e_version; + if (sh_type == SHT_NOBITS) + return (d); + + if ((d->d_buf = malloc(msz*count)) == NULL) { + (void) _libelf_release_data(d); + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + d->d_flags |= LIBELF_F_MALLOCED; STAILQ_INSERT_TAIL(&s->s_data, d, d_next); @@ -149,14 +154,10 @@ elf_newdata(Elf_Scn *s) if (elf_getdata(s, NULL) == NULL) return (NULL); - if ((d = malloc(sizeof(Elf_Data))) == NULL) { - LIBELF_SET_ERROR(RESOURCE, errno); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - } STAILQ_INSERT_TAIL(&s->s_data, d, d_next); - d->d_flags = 0; - d->d_scn = s; d->d_align = 1; d->d_buf = NULL; @@ -180,6 +181,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) { Elf *e; int elf_class; + uint32_t sh_type; uint64_t sh_align, sh_offset, sh_size; if (s == NULL || (e = s->s_elf) == NULL || @@ -199,19 +201,24 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) assert(elf_class == ELFCLASS32 || elf_class == ELFCLASS64); if (elf_class == ELFCLASS32) { + sh_type = s->s_shdr.s_shdr32.sh_type; sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; } else { + sh_type = s->s_shdr.s_shdr64.sh_type; sh_offset = s->s_shdr.s_shdr64.sh_offset; sh_size = s->s_shdr.s_shdr64.sh_size; sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = e->e_rawfile + sh_offset; + d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size = sh_size; Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 12:06:02 2010 (r212198) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -142,6 +142,32 @@ always returns .Vt Elf_Data structures of type .Dv ELF_T_BYTE . +.Ss Special handling of SHT_NOBITS sections +For sections of type +.Dv SHT_NOBITS , +the functions +.Fn elf_getdata +and +.Fn elf_rawdata +return a pointer to a valid +.Vt Elf_Data +structure that has its +.Va d_buf +member set to NULL and its +.Va d_size +member set to the size of the section. +.Pp +If an application wishes to create a section of type +.Dv SHT_NOBITS , +it should add a data buffer to the section using function +.Fn elf_newdata . +It should then set the +.Va d_buf +and +.Va d_size +members of the returned +.Vt Elf_Data +structure to NULL and the desired size of the section respectively. .Sh RETURN VALUES These functions return a valid pointer to a data descriptor if successful, or NULL if an error occurs. From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 12:19:19 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CD561065679; Sat, 4 Sep 2010 12:19:19 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9738FC18; Sat, 4 Sep 2010 12:19: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 o84CJJIZ006150; Sat, 4 Sep 2010 12:19:19 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84CJJN6006144; Sat, 4 Sep 2010 12:19:19 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041219.o84CJJN6006144@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:19:19 +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: r212200 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 12:19:19 -0000 Author: kaiw Date: Sat Sep 4 12:19:19 2010 New Revision: 212200 URL: http://svn.freebsd.org/changeset/base/212200 Log: MFC r210325,r210326,r210328,r210349 r210325: Bug fix: when updating headers using the gelf_update_*() functions, the appropriate `dirty' bit needs to be set for both the Elf32 and Elf64 case. r210326: Improve compatibility with other implementations of the ELF(3) API: when an output file has no program headers, set the 'e_phentsize' field of the ELF executable header to zero. r210328: Bug fix: permit the creation of zero-sized sections. r210349: Remove a redundant word. Modified: stable/8/lib/libelf/elf.3 stable/8/lib/libelf/elf_update.c stable/8/lib/libelf/gelf_ehdr.c stable/8/lib/libelf/gelf_phdr.c stable/8/lib/libelf/gelf_shdr.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf.3 ============================================================================== --- stable/8/lib/libelf/elf.3 Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/elf.3 Sat Sep 4 12:19:19 2010 (r212200) @@ -36,8 +36,8 @@ .Sh DESCRIPTION The .Lb libelf -library provides functions that allow an application to read and -manipulate ELF object files, and to read +provides functions that allow an application to read and manipulate +ELF object files, and to read .Xr ar 1 archives. The library allows the manipulation of ELF objects in a byte ordering Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 12:19:19 2010 (r212200) @@ -422,8 +422,8 @@ _libelf_resync_elf(Elf *e) (E)->e_ident[EI_VERSION] = (V); \ (E)->e_ehsize = _libelf_fsize(ELF_T_EHDR, (EC), (V), \ (size_t) 1); \ - (E)->e_phentsize = _libelf_fsize(ELF_T_PHDR, (EC), (V), \ - (size_t) 1); \ + (E)->e_phentsize = (phnum == 0) ? 0 : _libelf_fsize( \ + ELF_T_PHDR, (EC), (V), (size_t) 1); \ (E)->e_shentsize = _libelf_fsize(ELF_T_SHDR, (EC), (V), \ (size_t) 1); \ } while (0) @@ -534,22 +534,24 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ int ec; size_t fsz, msz, nobjects; uint32_t sh_type; - uint64_t sh_off; + uint64_t sh_off, sh_size; int elftype; Elf_Data *d, dst; - if ((ec = e->e_class) == ELFCLASS32) + if ((ec = e->e_class) == ELFCLASS32) { sh_type = s->s_shdr.s_shdr32.sh_type; - else + sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + } else { sh_type = s->s_shdr.s_shdr64.sh_type; + sh_size = s->s_shdr.s_shdr64.sh_size; + } /* * Ignore sections that do not allocate space in the file. */ - if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) + if (sh_type == SHT_NOBITS || sh_type == SHT_NULL || sh_size == 0) return (rc); - elftype = _libelf_xlate_shtype(sh_type); assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST); Modified: stable/8/lib/libelf/gelf_ehdr.c ============================================================================== --- stable/8/lib/libelf/gelf_ehdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_ehdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -137,6 +137,8 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); + (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { eh64 = (Elf64_Ehdr *) ehdr; *eh64 = *s; @@ -161,7 +163,5 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) eh32->e_shnum = s->e_shnum; eh32->e_shstrndx = s->e_shstrndx; - (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/8/lib/libelf/gelf_phdr.c ============================================================================== --- stable/8/lib/libelf/gelf_phdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_phdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -155,6 +155,8 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P return (0); } + (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { ph64 = e->e_u.e_elf.e_phdr.e_phdr64 + ndx; *ph64 = *s; @@ -172,7 +174,5 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P LIBELF_COPY_U32(ph32, s, p_memsz); LIBELF_COPY_U32(ph32, s, p_align); - (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/8/lib/libelf/gelf_shdr.c ============================================================================== --- stable/8/lib/libelf/gelf_shdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_shdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -107,6 +107,8 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr return (0); } + (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { scn->s_shdr.s_shdr64 = *s; return (1); @@ -125,7 +127,5 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr LIBELF_COPY_U32(sh32, s, sh_addralign); LIBELF_COPY_U32(sh32, s, sh_entsize); - (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); - return (1); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 12:40:06 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C128510656AA; Sat, 4 Sep 2010 12:40:06 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A59988FC15; Sat, 4 Sep 2010 12:40: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 o84Ce6sn007707; Sat, 4 Sep 2010 12:40:06 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84Ce645007701; Sat, 4 Sep 2010 12:40:06 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041240.o84Ce645007701@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:40:06 +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: r212202 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 12:40:07 -0000 Author: kaiw Date: Sat Sep 4 12:40:06 2010 New Revision: 212202 URL: http://svn.freebsd.org/changeset/base/212202 Log: MFC r210329,r210330,r210347. r210329: Use to declare the prototype for ftruncate(). r210330: Allow an application that updates only the ELF Ehdr to work. r210347: Fix a memory leak. Modified: stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_begin.c stable/8/lib/libelf/elf_scn.c stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 12:40:06 2010 (r212202) @@ -176,6 +176,7 @@ void (*_libelf_get_translator(Elf_Type _ void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); +int _libelf_load_scn(Elf *e, void *ehdr); int _libelf_malign(Elf_Type _t, int _elfclass); size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version); void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count); Modified: stable/8/lib/libelf/elf_begin.c ============================================================================== --- stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:40:06 2010 (r212202) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "_libelf.h" Modified: stable/8/lib/libelf/elf_scn.c ============================================================================== --- stable/8/lib/libelf/elf_scn.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_scn.c Sat Sep 4 12:40:06 2010 (r212202) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); /* * Load an ELF section table and create a list of Elf_Scn structures. */ -static int +int _libelf_load_scn(Elf *e, void *ehdr) { int ec, swapbytes; Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 12:40:06 2010 (r212202) @@ -472,6 +472,11 @@ _libelf_resync_elf(Elf *e) * file. */ + if (e->e_cmd != ELF_C_WRITE && + (e->e_flags & LIBELF_F_SHDRS_LOADED) == 0 && + _libelf_load_scn(e, ehdr) == 0) + return ((off_t) -1); + if ((rc = _libelf_resync_sections(e, rc)) < 0) return ((off_t) -1); @@ -726,14 +731,9 @@ _libelf_write_elf(Elf *e, off_t newsize) assert(phoff % _libelf_falign(ELF_T_PHDR, ec) == 0); assert(fsz > 0); + src.d_buf = _libelf_getphdr(e, ec); src.d_version = dst.d_version = e->e_version; src.d_type = ELF_T_PHDR; - - if (ec == ELFCLASS32) - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr32; - else - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr64; - src.d_size = phnum * _libelf_msize(ELF_T_PHDR, ec, e->e_version); @@ -855,11 +855,13 @@ _libelf_write_elf(Elf *e, off_t newsize) e->e_u.e_elf.e_phdr.e_phdr64 = NULL; } + free(newfile); + return (rc); error: - if (newfile) - free(newfile); + free(newfile); + return ((off_t) -1); } From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 12:52:44 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B367010656C4; Sat, 4 Sep 2010 12:52:44 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8378FC08; Sat, 4 Sep 2010 12:52:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CqiGn008765; Sat, 4 Sep 2010 12:52:44 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84Cqit5008748; Sat, 4 Sep 2010 12:52:44 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041252.o84Cqit5008748@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:52:44 +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: r212204 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 12:52:44 -0000 Author: kaiw Date: Sat Sep 4 12:52:44 2010 New Revision: 212204 URL: http://svn.freebsd.org/changeset/base/212204 Log: MFC r210344,r210345,r210348. r210344: Avoid switching between "unsigned char" and "char" in the C code generated from "libelf_convert.m4". r210345: * Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()` respectively. * Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and `elf_getshdrnum()`. * Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and `elf_getshnum()`. r210348: Move helper functions `_libelf_ar_get_{name,number,string}()` and `_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c" to break the circular dependency between "elf_memory.o" and "libelf_ar.o". Added: stable/8/lib/libelf/elf_getphdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getphdrnum.3 stable/8/lib/libelf/elf_getshdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrnum.3 stable/8/lib/libelf/elf_getshdrstrndx.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrstrndx.3 stable/8/lib/libelf/libelf_ar_util.c - copied unchanged from r210348, head/lib/libelf/libelf_ar_util.c Modified: stable/8/lib/libelf/Makefile stable/8/lib/libelf/Version.map stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_getphnum.3 stable/8/lib/libelf/elf_getshnum.3 stable/8/lib/libelf/elf_getshstrndx.3 stable/8/lib/libelf/elf_phnum.c stable/8/lib/libelf/elf_shnum.c stable/8/lib/libelf/elf_shstrndx.c stable/8/lib/libelf/libelf.h stable/8/lib/libelf/libelf_ar.c stable/8/lib/libelf/libelf_convert.m4 Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/Makefile ============================================================================== --- stable/8/lib/libelf/Makefile Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/Makefile Sat Sep 4 12:52:44 2010 (r212204) @@ -44,6 +44,7 @@ SRCS= elf_begin.c \ libelf_align.c \ libelf_allocate.c \ libelf_ar.c \ + libelf_ar_util.c \ libelf_checksum.c \ libelf_data.c \ libelf_ehdr.c \ @@ -65,7 +66,8 @@ WARNS?= 6 MAN= elf.3 \ elf_begin.3 \ elf_cntl.3 \ - elf_end.3 elf_errmsg.3 \ + elf_end.3 \ + elf_errmsg.3 \ elf_fill.3 \ elf_flagdata.3 \ elf_getarhdr.3 \ @@ -74,8 +76,11 @@ MAN= elf.3 \ elf_getdata.3 \ elf_getident.3 \ elf_getscn.3 \ + elf_getphdrnum.3 \ elf_getphnum.3 \ + elf_getshdrnum.3 \ elf_getshnum.3 \ + elf_getshdrstrndx.3 \ elf_getshstrndx.3 \ elf_hash.3 \ elf_kind.3 \ Modified: stable/8/lib/libelf/Version.map ============================================================================== --- stable/8/lib/libelf/Version.map Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/Version.map Sat Sep 4 12:52:44 2010 (r212204) @@ -39,8 +39,11 @@ global: elf_getdata; elf_getident; elf_getscn; + elf_getphdrnum; elf_getphnum; + elf_getshdrnum; elf_getshnum; + elf_getshdrstrndx; elf_getshstrndx; elf_hash; elf_kind; Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 12:52:44 2010 (r212204) @@ -165,6 +165,10 @@ Elf_Scn *_libelf_allocate_scn(Elf *_e, s Elf_Arhdr *_libelf_ar_gethdr(Elf *_e); Elf *_libelf_ar_open(Elf *_e); Elf *_libelf_ar_open_member(int _fd, Elf_Cmd _c, Elf *_ar); +int _libelf_ar_get_member(char *_s, size_t _sz, int _base, size_t *_ret); +char *_libelf_ar_get_string(const char *_buf, size_t _sz, int _rawname); +char *_libelf_ar_get_name(char *_buf, size_t _sz, Elf *_e); +int _libelf_ar_get_number(char *_buf, size_t _sz, int _base, size_t *_ret); Elf_Arsym *_libelf_ar_process_symtab(Elf *_ar, size_t *_dst); unsigned long _libelf_checksum(Elf *_e, int _elfclass); void *_libelf_ehdr(Elf *_e, int _elfclass, int _allocate); Copied: stable/8/lib/libelf/elf_getphdrnum.3 (from r210345, head/lib/libelf/elf_getphdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getphdrnum.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getphdrnum.3) @@ -0,0 +1,86 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by Joseph Koshy ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETPHDRNUM 3 +.Sh NAME +.Nm elf_getphdrnum +.Nd return the number of program headers in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getphdrnum "Elf *elf" "size_t *phnum" +.Sh DESCRIPTION +Function +.Fn elf_getphdrnum +retrieves the number of ELF program headers associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar phnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects and ELF objects that use extended numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getphdrnum +returns a zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getphnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable Header. +.It Bq Er ELF_E_HEADER +The ELF Executable Header associated with argument +.Ar elf +was corrupt. +.It Bq Er ELF_E_SECTION +The section header at index +.Dv SHN_UNDEF +was corrupt. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getphnum.3 ============================================================================== --- stable/8/lib/libelf/elf_getphnum.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getphnum.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2006 +.Dd August 5, 2009 .Dt ELF_GETPHNUM 3 .Os .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getphnum "Elf *elf" "size_t *phnum" .Sh DESCRIPTION +This function is deprecated. +Please use function +.Xr elf_getphdrnum 3 +instead. +.Pp Function .Fn elf_getphnum retrieves the number of ELF program headers associated with descriptor @@ -81,7 +86,8 @@ was corrupt. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Copied: stable/8/lib/libelf/elf_getshdrnum.3 (from r210345, head/lib/libelf/elf_getshdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getshdrnum.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getshdrnum.3) @@ -0,0 +1,78 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by Joseph Koshy ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2009 +.Os +.Dt ELF_GETSHDRNUM 3 +.Sh NAME +.Nm elf_getshdrnum +.Nd return the number of sections in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrnum "Elf *elf" "size_t *shnum" +.Sh DESCRIPTION +Function +.Fn elf_getshdrnum +retrieves the number of ELF sections associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar shnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects, and ELF objects that use extended section numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getshdrnum +returns zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getshdrnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Copied: stable/8/lib/libelf/elf_getshdrstrndx.3 (from r210345, head/lib/libelf/elf_getshdrstrndx.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getshdrstrndx.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getshdrstrndx.3) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by Joseph Koshy ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETSHDRSTRNDX 3 +.Sh NAME +.Nm elf_getshdrstrndx +.Nd retrieve the index of the section name string table +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrstrndx "Elf *elf" "size_t *ndxptr" +.Sh DESCRIPTION +Function +.Fn elf_getshdrstrndx +retrieves the section index of the string table containing section +names from descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar ndxptr . +.Pp +This function allow applications to process both normal ELF +objects and ELF objects that use extended section numbering uniformly. +.Pp +.Sh RETURN VALUES +These functions return zero if successful, or -1 in case of an error. +.Sh ERRORS +These functions can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar ndx +contained a value in the reserved range of section indices. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getshnum.3 ============================================================================== --- stable/8/lib/libelf/elf_getshnum.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getshnum.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Dt ELF_GETSHNUM 3 .Os .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getshnum "Elf *elf" "size_t *shnum" .Sh DESCRIPTION +This function is deprecated. +Please use +.Xr elf_getshdrnum 3 +instead. +.Pp Function .Fn elf_getshnum retrieves the number of ELF sections associated with descriptor @@ -73,6 +78,7 @@ lacks an ELF Executable header. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getshstrndx.3 ============================================================================== --- stable/8/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Dt ELF_GETSHSTRNDX 3 .Os .Sh NAME @@ -46,6 +46,12 @@ names from descriptor .Ar elf and stores it into the location pointed to by argument .Ar ndxptr . +Function +.Fn elf_getshstrndx +is deprecated. +Please use +.Xr elf_getshdrstrndx 3 +instead. .Pp Function .Fn elf_setshstrndx @@ -82,6 +88,7 @@ contained a value in the reserved range .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_phnum.c ============================================================================== --- stable/8/lib/libelf/elf_phnum.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_phnum.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getphnum(Elf *e, size_t *phnum) +static int +_libelf_getphdrnum(Elf *e, size_t *phnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getphnum(Elf *e, size_t *phnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *phnum = e->e_u.e_elf.e_nphdr; - return (1); + return (0); +} + +int +elf_getphdrnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum)); +} + +/* Deprecated API */ +int +elf_getphnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum) >= 0); } Modified: stable/8/lib/libelf/elf_shnum.c ============================================================================== --- stable/8/lib/libelf/elf_shnum.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_shnum.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshnum(Elf *e, size_t *shnum) +static int +_libelf_getshdrnum(Elf *e, size_t *shnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getshnum(Elf *e, size_t *shnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *shnum = e->e_u.e_elf.e_nscn; - return (1); + return (0); +} + +int +elf_getshdrnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum)); +} + +/* Deprecated API. */ +int +elf_getshnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum) >= 0); } Modified: stable/8/lib/libelf/elf_shstrndx.c ============================================================================== --- stable/8/lib/libelf/elf_shstrndx.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_shstrndx.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshstrndx(Elf *e, size_t *strndx) +static int +_libelf_getshdrstrndx(Elf *e, size_t *strndx) { void *eh; int ec; @@ -41,15 +41,27 @@ elf_getshstrndx(Elf *e, size_t *strndx) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *strndx = e->e_u.e_elf.e_strndx; - return (1); + return (0); +} + +int +elf_getshdrstrndx(Elf *e, size_t *strndx) +{ + return (_libelf_getshdrstrndx(e, strndx)); +} + +int +elf_getshstrndx(Elf *e, size_t *strndx) /* Deprecated API. */ +{ + return (_libelf_getshdrstrndx(e, strndx) >= 0); } int Modified: stable/8/lib/libelf/libelf.h ============================================================================== --- stable/8/lib/libelf/libelf.h Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/libelf.h Sat Sep 4 12:52:44 2010 (r212204) @@ -192,10 +192,13 @@ Elf_Arsym *elf_getarsym(Elf *_elf, size_ off_t elf_getbase(Elf *_elf); Elf_Data *elf_getdata(Elf_Scn *, Elf_Data *); char *elf_getident(Elf *_elf, size_t *_ptr); -int elf_getphnum(Elf *_elf, size_t *_dst); +int elf_getphdrnum(Elf *_elf, size_t *_dst); +int elf_getphnum(Elf *_elf, size_t *_dst); /* Deprecated */ Elf_Scn *elf_getscn(Elf *_elf, size_t _index); -int elf_getshnum(Elf *_elf, size_t *_dst); -int elf_getshstrndx(Elf *_elf, size_t *_dst); +int elf_getshdrnum(Elf *_elf, size_t *_dst); +int elf_getshnum(Elf *_elf, size_t *_dst); /* Deprecated */ +int elf_getshdrstrndx(Elf *_elf, size_t *_dst); +int elf_getshstrndx(Elf *_elf, size_t *_dst); /* Deprecated */ unsigned long elf_hash(const char *_name); Elf_Kind elf_kind(Elf *_elf); Elf *elf_memory(char *_image, size_t _size); Modified: stable/8/lib/libelf/libelf_ar.c ============================================================================== --- stable/8/lib/libelf/libelf_ar.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/libelf_ar.c Sat Sep 4 12:52:44 2010 (r212204) @@ -72,145 +72,6 @@ __FBSDID("$FreeBSD$"); * they must be the very first objects and in that order. */ -/* - * Convert a string bounded by `start' and `start+sz' (exclusive) to a - * number in the specified base. - */ -static int -_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) -{ - int c, v; - size_t r; - char *e; - - assert(base <= 10); - - e = s + sz; - - /* skip leading blanks */ - for (;s < e && (c = *s) == ' '; s++) - ; - - r = 0L; - for (;s < e; s++) { - if ((c = *s) == ' ') - break; - if (c < '0' || c > '9') - return (0); - v = c - '0'; - if (v >= base) /* Illegal digit. */ - break; - r *= base; - r += v; - } - - *ret = r; - - return (1); -} - -/* - * Retrieve a string from a name field. If `rawname' is set, leave - * ar(1) control characters in. - */ -static char * -_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) -{ - const char *q; - char *r; - size_t sz; - - if (rawname) - sz = bufsize + 1; - else { - /* Skip back over trailing blanks. */ - for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) - ; - - if (q < buf) { - /* - * If the input buffer only had blanks in it, - * return a zero-length string. - */ - buf = ""; - sz = 1; - } else { - /* - * Remove the trailing '/' character, but only - * if the name isn't one of the special names - * "/" and "//". - */ - if (q > buf + 1 || - (q == (buf + 1) && *buf != '/')) - q--; - - sz = q - buf + 2; /* Space for a trailing NUL. */ - } - } - - if ((r = malloc(sz)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(r, buf, sz); - r[sz - 1] = '\0'; - - return (r); -} - -/* - * Retrieve the full name of the archive member. - */ -static char * -_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) -{ - char c, *q, *r, *s; - size_t len; - size_t offset; - - assert(e->e_kind == ELF_K_AR); - - if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { - /* - * The value in field ar_name is a decimal offset into - * the archive string table where the actual name - * resides. - */ - if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, - &offset) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (offset > e->e_u.e_ar.e_rawstrtabsz) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - s = q = e->e_u.e_ar.e_rawstrtab + offset; - r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; - - for (s = q; s < r && *s != '/'; s++) - ; - len = s - q + 1; /* space for the trailing NUL */ - - if ((s = malloc(len)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(s, q, len); - s[len - 1] = '\0'; - - return (s); - } - - /* - * Normal 'name' - */ - return (_libelf_ar_get_string(buf, bufsize, 0)); -} Elf_Arhdr * @@ -323,79 +184,6 @@ _libelf_ar_open_member(int fd, Elf_Cmd c return (e); } -Elf * -_libelf_ar_open(Elf *e) -{ - int i; - char *s, *end; - size_t sz; - struct ar_hdr arh; - - e->e_kind = ELF_K_AR; - e->e_u.e_ar.e_nchildren = 0; - e->e_u.e_ar.e_next = (off_t) -1; - - /* - * Look for special members. - */ - - s = e->e_rawfile + SARMAG; - end = e->e_rawfile + e->e_rawsize; - - assert(e->e_rawsize > 0); - - /* - * Look for magic names "/ " and "// " in the first two entries - * of the archive. - */ - for (i = 0; i < 2; i++) { - - if (s + sizeof(arh) > end) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - (void) memcpy(&arh, s, sizeof(arh)); - - if (arh.ar_fmag[0] != '`' || arh.ar_fmag[1] != '\n') { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (arh.ar_name[0] != '/') /* not a special symbol */ - break; - - if (_libelf_ar_get_number(arh.ar_size, sizeof(arh.ar_size), 10, &sz) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - assert(sz > 0); - - s += sizeof(arh); - - if (arh.ar_name[1] == ' ') { /* "/ " => symbol table */ - - e->e_u.e_ar.e_rawsymtab = s; - e->e_u.e_ar.e_rawsymtabsz = sz; - - } else if (arh.ar_name[1] == '/' && arh.ar_name[2] == ' ') { - - /* "// " => string table for long file names */ - e->e_u.e_ar.e_rawstrtab = s; - e->e_u.e_ar.e_rawstrtabsz = sz; - } - - sz = LIBELF_ADJUST_AR_SIZE(sz); - - s += sz; - } - - e->e_u.e_ar.e_next = (off_t) (s - e->e_rawfile); - - return (e); -} - /* * An ar(1) symbol table has the following layout: * Copied: stable/8/lib/libelf/libelf_ar_util.c (from r210348, head/lib/libelf/libelf_ar_util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/libelf_ar_util.c Sat Sep 4 12:52:44 2010 (r212204, copy of r210348, head/lib/libelf/libelf_ar_util.c) @@ -0,0 +1,253 @@ +/*- + * Copyright (c) 2006,2009 Joseph Koshy + * 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 "_libelf.h" + +/* + * Convert a string bounded by `start' and `start+sz' (exclusive) to a + * number in the specified base. + */ +int +_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) +{ + int c, v; + size_t r; + char *e; + + assert(base <= 10); + + e = s + sz; + + /* skip leading blanks */ + for (;s < e && (c = *s) == ' '; s++) + ; + + r = 0L; + for (;s < e; s++) { + if ((c = *s) == ' ') + break; + if (c < '0' || c > '9') + return (0); + v = c - '0'; + if (v >= base) /* Illegal digit. */ + break; + r *= base; + r += v; + } + + *ret = r; + + return (1); +} + +/* + * Retrieve a string from a name field. If `rawname' is set, leave + * ar(1) control characters in. + */ +char * +_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) +{ + const char *q; + char *r; + size_t sz; + + if (rawname) + sz = bufsize + 1; + else { + /* Skip back over trailing blanks. */ + for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) + ; + + if (q < buf) { + /* + * If the input buffer only had blanks in it, + * return a zero-length string. + */ + buf = ""; + sz = 1; + } else { + /* + * Remove the trailing '/' character, but only + * if the name isn't one of the special names + * "/" and "//". + */ + if (q > buf + 1 || + (q == (buf + 1) && *buf != '/')) + q--; + + sz = q - buf + 2; /* Space for a trailing NUL. */ + } + } + + if ((r = malloc(sz)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(r, buf, sz); + r[sz - 1] = '\0'; + + return (r); +} + +/* + * Retrieve the full name of the archive member. + */ +char * +_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) +{ + char c, *q, *r, *s; + size_t len; + size_t offset; + + assert(e->e_kind == ELF_K_AR); + + if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { + /* + * The value in field ar_name is a decimal offset into + * the archive string table where the actual name + * resides. + */ + if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, + &offset) == 0) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + if (offset > e->e_u.e_ar.e_rawstrtabsz) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + s = q = e->e_u.e_ar.e_rawstrtab + offset; + r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; + + for (s = q; s < r && *s != '/'; s++) + ; + len = s - q + 1; /* space for the trailing NUL */ + + if ((s = malloc(len)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(s, q, len); + s[len - 1] = '\0'; + + return (s); + } + + /* + * Normal 'name' + */ + return (_libelf_ar_get_string(buf, bufsize, 0)); +} + +/* + * Open an 'ar' archive. + */ +Elf * +_libelf_ar_open(Elf *e) +{ + int i; + char *s, *end; + size_t sz; + struct ar_hdr arh; + + e->e_kind = ELF_K_AR; + e->e_u.e_ar.e_nchildren = 0; + e->e_u.e_ar.e_next = (off_t) -1; + + /* + * Look for special members. + */ + + s = e->e_rawfile + SARMAG; + end = e->e_rawfile + e->e_rawsize; + + assert(e->e_rawsize > 0); + + /* + * Look for magic names "/ " and "// " in the first two entries + * of the archive. + */ + for (i = 0; i < 2; i++) { + + if (s + sizeof(arh) > end) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 13:00:22 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5EF210656B2; Sat, 4 Sep 2010 13:00:22 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 944288FC1E; Sat, 4 Sep 2010 13:00: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 o84D0M9D009608; Sat, 4 Sep 2010 13:00:22 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84D0Ms7009603; Sat, 4 Sep 2010 13:00:22 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041300.o84D0Ms7009603@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 13:00:22 +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: r212206 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 13:00:22 -0000 Author: kaiw Date: Sat Sep 4 13:00:22 2010 New Revision: 212206 URL: http://svn.freebsd.org/changeset/base/212206 Log: MFC r210351-r210353,r211192. r210351: * Note that ar(1) archives may also be opened using `elf_memory(3)`. * Ignore the passed in value of the `fd` argument for ar(1) archives opened with elf_memory(3). r210352: Add a cross-reference to `elf_rawfile(3)`. r210353: * Remove a superfluous error description. * Document an additional error that may be returned: `ELF_E_ARCHIVE`. r211192: Add translation support for section type SHT_SUNW_dof. Modified: stable/8/lib/libelf/elf_begin.3 stable/8/lib/libelf/elf_begin.c stable/8/lib/libelf/elf_getdata.3 stable/8/lib/libelf/libelf_data.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_begin.3 ============================================================================== --- stable/8/lib/libelf/elf_begin.3 Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_begin.3 Sat Sep 4 13:00:22 2010 (r212206) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2006 +.Dd June 20, 2010 .Dt ELF_BEGIN 3 .Os .Sh NAME @@ -163,7 +163,9 @@ archive may be opened in read mode (with set to .Dv ELF_C_READ ) using -.Fn elf_begin . +.Fn elf_begin +or +.Fn elf_memory . The returned ELF descriptor can be passed into to subsequent calls to .Fn elf_begin @@ -222,6 +224,10 @@ Function can fail with the following errors: .Pp .Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARCHIVE +The archive denoted by argument +.Ar elf +could not be parsed. .It Bq Er ELF_E_ARGUMENT An unrecognized value was specified in argument .Ar cmd . @@ -245,12 +251,6 @@ differs from the value specified when EL .Ar elf was created. .It Bq Er ELF_E_ARGUMENT -Argument -.Ar elf -was not a descriptor for an -.Xr ar 1 -archive. -.It Bq Er ELF_E_ARGUMENT An .Xr ar 1 archive was opened with with Modified: stable/8/lib/libelf/elf_begin.c ============================================================================== --- stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_begin.c Sat Sep 4 13:00:22 2010 (r212206) @@ -131,13 +131,15 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) case ELF_C_READ: /* * Descriptor `a' could be for a regular ELF file, or - * for an ar(1) archive. + * for an ar(1) archive. If descriptor `a' was opened + * using a valid file descriptor, we need to check if + * the passed in `fd' value matches the original one. */ - if (a && (a->e_fd != fd || c != a->e_cmd)) { + if (a && + ((a->e_fd != -1 && a->e_fd != fd) || c != a->e_cmd)) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } - break; default: @@ -149,7 +151,7 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) if (a == NULL) e = _libelf_open_object(fd, c); else if (a->e_kind == ELF_K_AR) - e = _libelf_ar_open_member(fd, c, a); + e = _libelf_ar_open_member(a->e_fd, c, a); else (e = a)->e_activations++; Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 13:00:22 2010 (r212206) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008,2010 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2006 +.Dd April 30, 2010 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -193,6 +193,7 @@ An out of memory condition was detected. .Xr elf_getscn 3 , .Xr elf_getshdr 3 , .Xr elf_newscn 3 , +.Xr elf_rawfile 3 , .Xr elf_update 3 , .Xr elf_version 3 , .Xr gelf 3 Modified: stable/8/lib/libelf/libelf_data.c ============================================================================== --- stable/8/lib/libelf/libelf_data.c Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:00:22 2010 (r212206) @@ -77,6 +77,8 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_MOVE); case SHT_SUNW_syminfo: return (ELF_T_SYMINFO); + case SHT_SUNW_dof: + return (ELF_T_BYTE); #endif case SHT_AMD64_UNWIND: /* == SHT_IA_64_UNWIND */ return (ELF_T_BYTE); From owner-svn-src-stable-8@FreeBSD.ORG Sat Sep 4 13:13:01 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B31F10656D4; Sat, 4 Sep 2010 13:13:01 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 280B68FC16; Sat, 4 Sep 2010 13:13: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 o84DD1DL010593; Sat, 4 Sep 2010 13:13:01 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84DD0rP010578; Sat, 4 Sep 2010 13:13:00 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041313.o84DD0rP010578@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 13:13: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: r212208 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 13:13:01 -0000 Author: kaiw Date: Sat Sep 4 13:13:00 2010 New Revision: 212208 URL: http://svn.freebsd.org/changeset/base/212208 Log: MFC r210331-r210333,r210335,r210336,r210338,r210340,r210341,r210559. r210331: Add a new ELF type denoting GNU style hash tables. r210332: Changes for supporting GNU Hash sections. r210333: Note that the *_fsize() functions are only defined for ELF types that have a fixed size. r210335: - Return zero for file sizes of ELF types that have a variable size. - Neaten a few comments. r210336: Reduce verbosity. r210338: Perform additional checks when translating between file and memory representations of ELF types. The ELF(3) API allows applications to request a conversion that is `in-place', i.e., with source and destinations data buffers being the same. However, the file and memory sizes of ELF sections that have additional internal structure, such as those of type `Elf_Note', or `Elf_GNU_Hash_Header', can be determined only known after the type-specific headers that comprise the first few words in these sections are read and translated. Pass in the size of destination buffer to type translation routines in "libelf_convert.m4" and have these routines return an error code if the translated data would not fit inside the destination buffer. r210340: - Document that the *fsize() functions return a size of 1 for Elf types that don't have a fixed size. - The *fsize() functions should return a size of 1, for variable length types. - Redefine symbol ELF_T_LAST to match the current end of the list. r210341: Add support for translating sections of type ELF_T_GNUHASH. r210559: Protect GNUHASH translation functions with #ifdef; unbreak cross toolchain build. Modified: stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_data.c stable/8/lib/libelf/elf_scn.c stable/8/lib/libelf/elf_types.m4 stable/8/lib/libelf/gelf_fsize.3 stable/8/lib/libelf/libelf.h stable/8/lib/libelf/libelf_align.c stable/8/lib/libelf/libelf_convert.m4 stable/8/lib/libelf/libelf_data.c stable/8/lib/libelf/libelf_ehdr.c stable/8/lib/libelf/libelf_fsize.m4 stable/8/lib/libelf/libelf_msize.m4 stable/8/lib/libelf/libelf_phdr.c stable/8/lib/libelf/libelf_xlate.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 13:13:00 2010 (r212208) @@ -175,8 +175,8 @@ void *_libelf_ehdr(Elf *_e, int _elfclas int _libelf_falign(Elf_Type _t, int _elfclass); size_t _libelf_fsize(Elf_Type _t, int _elfclass, unsigned int _version, size_t count); -void (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass)) - (char *_dst, char *_src, size_t _cnt, int _byteswap); +int (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass)) + (char *_dst, size_t dsz, char *_src, size_t _cnt, int _byteswap); void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_data.c Sat Sep 4 13:13:00 2010 (r212208) @@ -43,7 +43,7 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) int elfclass, elftype; unsigned int sh_type; uint64_t sh_align, sh_offset, sh_size; - void (*xlate)(char *_d, char *_s, size_t _c, int _swap); + int (*xlate)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); if (s == NULL || (e = s->s_elf) == NULL || e->e_kind != ELF_K_ELF || (d != NULL && s != d->d_scn)) { @@ -125,11 +125,16 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) } d->d_flags |= LIBELF_F_MALLOCED; - STAILQ_INSERT_TAIL(&s->s_data, d, d_next); xlate = _libelf_get_translator(elftype, ELF_TOMEMORY, elfclass); - (*xlate)(d->d_buf, e->e_rawfile + sh_offset, count, e->e_byteorder != - LIBELF_PRIVATE(byteorder)); + if (!(*xlate)(d->d_buf, d->d_size, e->e_rawfile + sh_offset, count, + e->e_byteorder != LIBELF_PRIVATE(byteorder))) { + _libelf_release_data(d); + LIBELF_SET_ERROR(DATA, 0); + return (NULL); + } + + STAILQ_INSERT_TAIL(&s->s_data, d, d_next); return (d); } Modified: stable/8/lib/libelf/elf_scn.c ============================================================================== --- stable/8/lib/libelf/elf_scn.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_scn.c Sat Sep 4 13:13:00 2010 (r212208) @@ -48,7 +48,7 @@ _libelf_load_scn(Elf *e, void *ehdr) Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; Elf_Scn *scn; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(e != NULL); assert(ehdr != NULL); @@ -101,7 +101,8 @@ _libelf_load_scn(Elf *e, void *ehdr) if ((scn = _libelf_allocate_scn(e, i)) == NULL) return (0); - (*xlator)((char *) &scn->s_shdr, src, (size_t) 1, swapbytes); + (*xlator)((char *) &scn->s_shdr, sizeof(scn->s_shdr), src, + (size_t) 1, swapbytes); if (ec == ELFCLASS32) { scn->s_offset = scn->s_rawoff = Modified: stable/8/lib/libelf/elf_types.m4 ============================================================================== --- stable/8/lib/libelf/elf_types.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_types.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -46,6 +46,7 @@ define(`ELF_TYPE_LIST', `CAP, Cap, 700025', `DYN, Dyn, 600102', `EHDR, Ehdr, 600102', + `GNUHASH, -, 800062', `HALF, Half, 600102', `LWORD, Lword, 700025', `MOVE, Move, 700025', Modified: stable/8/lib/libelf/gelf_fsize.3 ============================================================================== --- stable/8/lib/libelf/gelf_fsize.3 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/gelf_fsize.3 Sat Sep 4 13:13:00 2010 (r212208) @@ -47,6 +47,8 @@ These functions return the size in bytes .Ar count numbers of objects of ELF type .Ar type . +For ELF types that are of variable length, these functions return a +size of one byte. .Pp Functions .Fn elf32_fsize Modified: stable/8/lib/libelf/libelf.h ============================================================================== --- stable/8/lib/libelf/libelf.h Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf.h Sat Sep 4 13:13:00 2010 (r212208) @@ -75,11 +75,12 @@ typedef enum { ELF_T_VNEED, ELF_T_WORD, ELF_T_XWORD, + ELF_T_GNUHASH, /* GNU style hash tables. */ ELF_T_NUM } Elf_Type; #define ELF_T_FIRST ELF_T_ADDR -#define ELF_T_LAST ELF_T_XWORD +#define ELF_T_LAST ELF_T_GNUHASH /* Commands */ typedef enum { Modified: stable/8/lib/libelf/libelf_align.c ============================================================================== --- stable/8/lib/libelf/libelf_align.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_align.c Sat Sep 4 13:13:00 2010 (r212208) @@ -51,6 +51,10 @@ struct align { .a32 = 0, \ .a64 = __alignof__(Elf64_##V) \ } +#define MALIGN_WORD() { \ + .a32 = __alignof__(int32_t), \ + .a64 = __alignof__(int64_t) \ + } #else #error Need the __alignof__ builtin. #endif @@ -92,7 +96,10 @@ static struct align malign[ELF_T_NUM] = [ELF_T_VNEED] = MALIGN(Verneed), #endif [ELF_T_WORD] = MALIGN(Word), - [ELF_T_XWORD] = MALIGN64(Xword) + [ELF_T_XWORD] = MALIGN64(Xword), +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = MALIGN_WORD() +#endif }; int @@ -140,7 +147,10 @@ static struct align falign[ELF_T_NUM] = [ELF_T_VNEED] = FALIGN(4,4), #endif [ELF_T_WORD] = FALIGN(4,4), - [ELF_T_XWORD] = FALIGN(0,8) + [ELF_T_XWORD] = FALIGN(0,8), +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = FALIGN(4,8) +#endif }; int Modified: stable/8/lib/libelf/libelf_convert.m4 ============================================================================== --- stable/8/lib/libelf/libelf_convert.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_convert.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -234,8 +234,10 @@ define(`IGNORE', IGNORE(MOVEP) IGNORE(NOTE) +IGNORE(GNUHASH) define(IGNORE_BYTE, 1) /* 'lator, leave 'em bytes alone */ +define(IGNORE_GNUHASH, 1) define(IGNORE_NOTE, 1) define(IGNORE_SXWORD32, 1) define(IGNORE_XWORD32, 1) @@ -274,18 +276,18 @@ define(`SIZEDEP_OFF', 1) * `$4': ELF class specifier for types, one of [`32', `64'] */ define(`MAKEPRIM_TO_F',` -static void -libelf_cvt_$1$3_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_$1$3_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$4_$2 t, *s = (Elf$4_$2 *) (uintptr_t) src; size_t c; - if (dst == src && !byteswap) - return; + (void) dsz; if (!byteswap) { (void) memcpy(dst, src, count * sizeof(*s)); - return; + return (1); } for (c = 0; c < count; c++) { @@ -293,22 +295,25 @@ libelf_cvt_$1$3_tof(char *dst, char *src SWAP_$1$3(t); WRITE_$1$3(dst,t); } + + return (1); } ') define(`MAKEPRIM_TO_M',` -static void -libelf_cvt_$1$3_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_$1$3_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$4_$2 t, *d = (Elf$4_$2 *) (uintptr_t) dst; size_t c; - if (dst == src && !byteswap) - return; + if (dsz < count * sizeof(Elf$4_$2)) + return (0); if (!byteswap) { (void) memcpy(dst, src, count * sizeof(*d)); - return; + return (1); } for (c = 0; c < count; c++) { @@ -316,6 +321,8 @@ libelf_cvt_$1$3_tom(char *dst, char *src SWAP_$1$3(t); *d++ = t; } + + return (1); } ') @@ -392,12 +399,15 @@ define(`READ_STRUCT', define(`MAKE_TO_F', `ifdef(`IGNORE_'$1$3,`',` -static void -libelf_cvt$3_$1_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt$3_$1_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$3_$2 t, *s; size_t c; + (void) dsz; + s = (Elf$3_$2 *) (uintptr_t) src; for (c = 0; c < count; c++) { t = *s++; @@ -406,13 +416,16 @@ libelf_cvt$3_$1_tof(char *dst, char *src } WRITE_STRUCT($2,$3) } + + return (1); } ')') define(`MAKE_TO_M', `ifdef(`IGNORE_'$1$3,`',` -static void -libelf_cvt$3_$1_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt$3_$1_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$3_$2 t, *d; char *s,*s0; @@ -422,6 +435,9 @@ libelf_cvt$3_$1_tom(char *dst, char *src d = ((Elf$3_$2 *) (uintptr_t) dst) + (count - 1); s0 = (char *) src + (count - 1) * fsz; + if (dsz < count * sizeof(Elf$3_$2)) + return (0); + while (count--) { s = s0; READ_STRUCT($2,$3) @@ -430,6 +446,8 @@ libelf_cvt$3_$1_tom(char *dst, char *src } *d-- = t; s0 -= fsz; } + + return (1); } ')') @@ -475,84 +493,300 @@ divert(0) * simple memcpy suffices for both directions of conversion. */ -static void -libelf_cvt_BYTE_tox(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_BYTE_tox(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { (void) byteswap; + if (dsz < count) + return (0); if (dst != src) (void) memcpy(dst, src, count); + return (1); } +MAKE_TYPE_CONVERTERS(ELF_TYPE_LIST) + +#if __FreeBSD_version >= 800062 +/* + * Sections of type ELF_T_GNUHASH start with a header containing 4 32-bit + * words. Bloom filter data comes next, followed by hash buckets and the + * hash chain. + * + * Bloom filter words are 64 bit wide on ELFCLASS64 objects and are 32 bit + * wide on ELFCLASS32 objects. The other objects in this section are 32 + * bits wide. + * + * Argument `srcsz' denotes the number of bytes to be converted. In the + * 32-bit case we need to translate `srcsz' to a count of 32-bit words. + */ + +static int +libelf_cvt32_GNUHASH_tom(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + return (libelf_cvt_WORD_tom(dst, dsz, src, srcsz / sizeof(uint32_t), + byteswap)); +} + +static int +libelf_cvt32_GNUHASH_tof(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + return (libelf_cvt_WORD_tof(dst, dsz, src, srcsz / sizeof(uint32_t), + byteswap)); +} + +static int +libelf_cvt64_GNUHASH_tom(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + size_t sz; + uint64_t t64, *bloom64; + Elf_GNU_Hash_Header *gh; + uint32_t n, nbuckets, nchains, maskwords, shift2, symndx, t32; + uint32_t *buckets, *chains; + + sz = 4 * sizeof(uint32_t); /* File header is 4 words long. */ + if (dsz < sizeof(Elf_GNU_Hash_Header) || srcsz < sz) + return (0); + + /* Read in the section header and byteswap if needed. */ + READ_WORD(src, nbuckets); + READ_WORD(src, symndx); + READ_WORD(src, maskwords); + READ_WORD(src, shift2); + + srcsz -= sz; + + if (byteswap) { + SWAP_WORD(nbuckets); + SWAP_WORD(symndx); + SWAP_WORD(maskwords); + SWAP_WORD(shift2); + } + + /* Check source buffer and destination buffer sizes. */ + sz = nbuckets * sizeof(uint32_t) + maskwords * sizeof(uint64_t); + if (srcsz < sz || dsz < sz + sizeof(Elf_GNU_Hash_Header)) + return (0); + + gh = (Elf_GNU_Hash_Header *) (uintptr_t) dst; + gh->gh_nbuckets = nbuckets; + gh->gh_symndx = symndx; + gh->gh_maskwords = maskwords; + gh->gh_shift2 = shift2; + + dsz -= sizeof(Elf_GNU_Hash_Header); + dst += sizeof(Elf_GNU_Hash_Header); + + bloom64 = (uint64_t *) (uintptr_t) dst; + + /* Copy bloom filter data. */ + for (n = 0; n < maskwords; n++) { + READ_XWORD(src, t64); + if (byteswap) + SWAP_XWORD(t64); + bloom64[n] = t64; + } + + /* The hash buckets follows the bloom filter. */ + dst += maskwords * sizeof(uint64_t); + buckets = (uint32_t *) (uintptr_t) dst; + + for (n = 0; n < nbuckets; n++) { + READ_WORD(src, t32); + if (byteswap) + SWAP_WORD(t32); + buckets[n] = t32; + } + + dst += nbuckets * sizeof(uint32_t); + + /* The hash chain follows the hash buckets. */ + dsz -= sz; + srcsz -= sz; + + if (dsz < srcsz) /* Destination lacks space. */ + return (0); + + nchains = srcsz / sizeof(uint32_t); + chains = (uint32_t *) (uintptr_t) dst; + + for (n = 0; n < nchains; n++) { + READ_WORD(src, t32); + if (byteswap) + SWAP_WORD(t32); + *chains++ = t32; + } + + return (1); +} + +static int +libelf_cvt64_GNUHASH_tof(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + uint32_t *s32; + size_t sz, hdrsz; + uint64_t *s64, t64; + Elf_GNU_Hash_Header *gh; + uint32_t maskwords, n, nbuckets, nchains, t0, t1, t2, t3, t32; + + hdrsz = 4 * sizeof(uint32_t); /* Header is 4x32 bits. */ + if (dsz < hdrsz || srcsz < sizeof(Elf_GNU_Hash_Header)) + return (0); + + gh = (Elf_GNU_Hash_Header *) (uintptr_t) src; + + t0 = nbuckets = gh->gh_nbuckets; + t1 = gh->gh_symndx; + t2 = maskwords = gh->gh_maskwords; + t3 = gh->gh_shift2; + + src += sizeof(Elf_GNU_Hash_Header); + srcsz -= sizeof(Elf_GNU_Hash_Header); + dsz -= hdrsz; + + sz = gh->gh_nbuckets * sizeof(uint32_t) + gh->gh_maskwords * + sizeof(uint64_t); + + if (srcsz < sz || dsz < sz) + return (0); + + /* Write out the header. */ + if (byteswap) { + SWAP_WORD(t0); + SWAP_WORD(t1); + SWAP_WORD(t2); + SWAP_WORD(t3); + } + + WRITE_WORD(dst, t0); + WRITE_WORD(dst, t1); + WRITE_WORD(dst, t2); + WRITE_WORD(dst, t3); + + /* Copy the bloom filter and the hash table. */ + s64 = (uint64_t *) (uintptr_t) src; + for (n = 0; n < maskwords; n++) { + t64 = *s64++; + if (byteswap) + SWAP_XWORD(t64); + WRITE_WORD64(dst, t64); + } + + s32 = (uint32_t *) s64; + for (n = 0; n < nbuckets; n++) { + t32 = *s32++; + if (byteswap) + SWAP_WORD(t32); + WRITE_WORD(dst, t32); + } + + srcsz -= sz; + dsz -= sz; + + /* Copy out the hash chains. */ + if (dsz < srcsz) + return (0); + + nchains = srcsz / sizeof(uint32_t); + for (n = 0; n < nchains; n++) { + t32 = *s32++; + if (byteswap) + SWAP_WORD(t32); + WRITE_WORD(dst, t32); + } + + return (1); +} +#endif + /* * Elf_Note structures comprise a fixed size header followed by variable * length strings. The fixed size header needs to be byte swapped, but * not the strings. * * Argument `count' denotes the total number of bytes to be converted. + * The destination buffer needs to be at least `count' bytes in size. */ -static void -libelf_cvt_NOTE_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_NOTE_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { uint32_t namesz, descsz, type; Elf_Note *en; - size_t sz; + size_t sz, hdrsz; - if (dst == src && !byteswap) - return; + if (dsz < count) /* Destination buffer is too small. */ + return (0); + + hdrsz = 3 * sizeof(uint32_t); + if (count < hdrsz) /* Source too small. */ + return (0); if (!byteswap) { (void) memcpy(dst, src, count); - return; + return (1); } - while (count > sizeof(Elf_Note)) { - + /* Process all notes in the section. */ + while (count > hdrsz) { + /* Read the note header. */ READ_WORD(src, namesz); READ_WORD(src, descsz); READ_WORD(src, type); - if (byteswap) { - SWAP_WORD(namesz); - SWAP_WORD(descsz); - SWAP_WORD(type); - } + /* Translate. */ + SWAP_WORD(namesz); + SWAP_WORD(descsz); + SWAP_WORD(type); + /* Copy out the translated note header. */ en = (Elf_Note *) (uintptr_t) dst; en->n_namesz = namesz; en->n_descsz = descsz; en->n_type = type; + dsz -= sizeof(Elf_Note); dst += sizeof(Elf_Note); + count -= hdrsz; ROUNDUP2(namesz, 4); ROUNDUP2(descsz, 4); sz = namesz + descsz; - if (count < sz) - sz = count; + if (count < sz || dsz < sz) /* Buffers are too small. */ + return (0); (void) memcpy(dst, src, sz); src += sz; dst += sz; + count -= sz; + dsz -= sz; } + + return (1); } -static void -libelf_cvt_NOTE_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_NOTE_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { uint32_t namesz, descsz, type; Elf_Note *en; size_t sz; - if (dst == src && !byteswap) - return; + if (dsz < count) + return (0); if (!byteswap) { (void) memcpy(dst, src, count); - return; + return (1); } while (count > sizeof(Elf_Note)) { @@ -562,12 +796,9 @@ libelf_cvt_NOTE_tof(char *dst, char *src descsz = en->n_descsz; type = en->n_type; - if (byteswap) { - SWAP_WORD(namesz); - SWAP_WORD(descsz); - SWAP_WORD(type); - } - + SWAP_WORD(namesz); + SWAP_WORD(descsz); + SWAP_WORD(type); WRITE_WORD(dst, namesz); WRITE_WORD(dst, descsz); @@ -589,15 +820,19 @@ libelf_cvt_NOTE_tof(char *dst, char *src dst += sz; count -= sz; } -} -MAKE_TYPE_CONVERTERS(ELF_TYPE_LIST) + return (1); +} struct converters { - void (*tof32)(char *dst, char *src, size_t cnt, int byteswap); - void (*tom32)(char *dst, char *src, size_t cnt, int byteswap); - void (*tof64)(char *dst, char *src, size_t cnt, int byteswap); - void (*tom64)(char *dst, char *src, size_t cnt, int byteswap); + int (*tof32)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tom32)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tof64)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tom64)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); }; divert(-1) @@ -639,6 +874,16 @@ CONVERTER_NAMES(ELF_TYPE_LIST) .tof64 = libelf_cvt_BYTE_tox, .tom64 = libelf_cvt_BYTE_tox }, + +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = { + .tof32 = libelf_cvt32_GNUHASH_tof, + .tom32 = libelf_cvt32_GNUHASH_tom, + .tof64 = libelf_cvt64_GNUHASH_tof, + .tom64 = libelf_cvt64_GNUHASH_tom + }, +#endif + [ELF_T_NOTE] = { .tof32 = libelf_cvt_NOTE_tof, .tom32 = libelf_cvt_NOTE_tom, @@ -647,8 +892,8 @@ CONVERTER_NAMES(ELF_TYPE_LIST) } }; -void (*_libelf_get_translator(Elf_Type t, int direction, int elfclass)) - (char *_dst, char *_src, size_t _cnt, int _byteswap) +int (*_libelf_get_translator(Elf_Type t, int direction, int elfclass)) + (char *_dst, size_t dsz, char *_src, size_t _cnt, int _byteswap) { assert(elfclass == ELFCLASS32 || elfclass == ELFCLASS64); assert(direction == ELF_TOFILE || direction == ELF_TOMEMORY); Modified: stable/8/lib/libelf/libelf_data.c ============================================================================== --- stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:13:00 2010 (r212208) @@ -42,6 +42,10 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_SYM); case SHT_FINI_ARRAY: return (ELF_T_ADDR); +#if __FreeBSD_version >= 800062 + case SHT_GNU_HASH: + return (ELF_T_GNUHASH); +#endif case SHT_GROUP: return (ELF_T_WORD); case SHT_HASH: Modified: stable/8/lib/libelf/libelf_ehdr.c ============================================================================== --- stable/8/lib/libelf/libelf_ehdr.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_ehdr.c Sat Sep 4 13:13:00 2010 (r212208) @@ -46,7 +46,7 @@ _libelf_load_extended(Elf *e, int ec, ui { Elf_Scn *scn; size_t fsz; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); uint32_t shtype; assert(STAILQ_EMPTY(&e->e_u.e_elf.e_scn)); @@ -63,7 +63,8 @@ _libelf_load_extended(Elf *e, int ec, ui return (0); xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec); - (*xlator)((char *) &scn->s_shdr, e->e_rawfile + shoff, (size_t) 1, + (*xlator)((char *) &scn->s_shdr, sizeof(scn->s_shdr), + e->e_rawfile + shoff, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); #define GET_SHDR_MEMBER(M) ((ec == ELFCLASS32) ? scn->s_shdr.s_shdr32.M : \ @@ -105,7 +106,7 @@ _libelf_ehdr(Elf *e, int ec, int allocat size_t fsz, msz; uint16_t phnum, shnum, strndx; uint64_t shoff; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(ec == ELFCLASS32 || ec == ELFCLASS64); @@ -167,7 +168,7 @@ _libelf_ehdr(Elf *e, int ec, int allocat return (ehdr); xlator = _libelf_get_translator(ELF_T_EHDR, ELF_TOMEMORY, ec); - (*xlator)(ehdr, e->e_rawfile, (size_t) 1, + (*xlator)(ehdr, msz, e->e_rawfile, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); /* Modified: stable/8/lib/libelf/libelf_fsize.m4 ============================================================================== --- stable/8/lib/libelf/libelf_fsize.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_fsize.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -43,15 +43,18 @@ include(SRCDIR`/elf_types.m4') * representations. */ -/* `Basic' types */ +/* `Basic' types. */ define(`BYTE_SIZE', 1) define(`IDENT_SIZE', `EI_NIDENT') -define(`NOTE_SIZE', 1) /* Elf_Note structures have variable length. */ -/* Currently unimplemented types */ +/* Types that have variable length. */ +define(`GNUHASH_SIZE', 1) +define(`NOTE_SIZE', 1) + +/* Currently unimplemented types. */ define(`MOVEP_SIZE', 0) -/* Overrides for 32 bit types that do not exist */ +/* Overrides for 32 bit types that do not exist. */ define(`XWORD_SIZE32', 0) define(`SXWORD_SIZE32', 0) Modified: stable/8/lib/libelf/libelf_msize.m4 ============================================================================== --- stable/8/lib/libelf/libelf_msize.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_msize.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -49,6 +49,7 @@ divert(-1) include(SRCDIR`/elf_types.m4') define(BYTE_SIZE, 1) +define(GNUHASH_SIZE, 1) define(NOTE_SIZE, 1) /* Modified: stable/8/lib/libelf/libelf_phdr.c ============================================================================== --- stable/8/lib/libelf/libelf_phdr.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_phdr.c Sat Sep 4 13:13:00 2010 (r212208) @@ -45,7 +45,7 @@ _libelf_getphdr(Elf *e, int ec) Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; void *ehdr, *phdr; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(ec == ELFCLASS32 || ec == ELFCLASS64); @@ -103,7 +103,7 @@ _libelf_getphdr(Elf *e, int ec) xlator = _libelf_get_translator(ELF_T_PHDR, ELF_TOMEMORY, ec); - (*xlator)(phdr, e->e_rawfile + phoff, phnum, + (*xlator)(phdr, phnum * msz, e->e_rawfile + phoff, phnum, e->e_byteorder != LIBELF_PRIVATE(byteorder)); return (phdr); Modified: stable/8/lib/libelf/libelf_xlate.c ============================================================================== --- stable/8/lib/libelf/libelf_xlate.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_xlate.c Sat Sep 4 13:13:00 2010 (r212208) @@ -48,6 +48,7 @@ Elf_Data * _libelf_xlate(Elf_Data *dst, const Elf_Data *src, unsigned int encoding, int elfclass, int direction) { + int byteswap; size_t cnt, dsz, fsz, msz; uintptr_t sb, se, db, de; @@ -132,12 +133,17 @@ _libelf_xlate(Elf_Data *dst, const Elf_D dst->d_type = src->d_type; dst->d_size = dsz; + byteswap = encoding != LIBELF_PRIVATE(byteorder); + if (src->d_size == 0 || - (db == sb && encoding == LIBELF_PRIVATE(byteorder) && fsz == msz)) + (db == sb && !byteswap && fsz == msz)) return (dst); /* nothing more to do */ - (_libelf_get_translator(src->d_type, direction, elfclass))(dst->d_buf, - src->d_buf, cnt, encoding != LIBELF_PRIVATE(byteorder)); + if (!(_libelf_get_translator(src->d_type, direction, elfclass)) + (dst->d_buf, dsz, src->d_buf, cnt, byteswap)) { + LIBELF_SET_ERROR(DATA, 0); + return (NULL); + } return (dst); }